LibGUI/WindowServer: Rename mouse capture -> mouse relative
My terminology was incorrect and this is more correct
This commit is contained in:
parent
4519c48284
commit
af0a46e79c
|
@ -142,10 +142,10 @@ namespace LibGUI
|
||||||
return on_socket_error(__FUNCTION__);
|
return on_socket_error(__FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::set_mouse_capture(bool captured)
|
void Window::set_mouse_relative(bool enabled)
|
||||||
{
|
{
|
||||||
WindowPacket::WindowSetMouseCapture packet;
|
WindowPacket::WindowSetMouseRelative packet;
|
||||||
packet.captured = captured;
|
packet.enabled = enabled;
|
||||||
|
|
||||||
if (auto ret = packet.send_serialized(m_server_fd); ret.is_error())
|
if (auto ret = packet.send_serialized(m_server_fd); ret.is_error())
|
||||||
return on_socket_error(__FUNCTION__);
|
return on_socket_error(__FUNCTION__);
|
||||||
|
|
|
@ -205,7 +205,7 @@ namespace LibGUI
|
||||||
WindowInvalidate,
|
WindowInvalidate,
|
||||||
WindowSetPosition,
|
WindowSetPosition,
|
||||||
WindowSetAttributes,
|
WindowSetAttributes,
|
||||||
WindowSetMouseCapture,
|
WindowSetMouseRelative,
|
||||||
WindowSetSize,
|
WindowSetSize,
|
||||||
WindowSetMinSize,
|
WindowSetMinSize,
|
||||||
WindowSetMaxSize,
|
WindowSetMaxSize,
|
||||||
|
@ -266,8 +266,8 @@ namespace LibGUI
|
||||||
);
|
);
|
||||||
|
|
||||||
DEFINE_PACKET(
|
DEFINE_PACKET(
|
||||||
WindowSetMouseCapture,
|
WindowSetMouseRelative,
|
||||||
bool, captured
|
bool, enabled
|
||||||
);
|
);
|
||||||
|
|
||||||
DEFINE_PACKET(
|
DEFINE_PACKET(
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace LibGUI
|
||||||
void invalidate(int32_t x, int32_t y, uint32_t width, uint32_t height);
|
void invalidate(int32_t x, int32_t y, uint32_t width, uint32_t height);
|
||||||
void invalidate() { return invalidate(0, 0, width(), height()); }
|
void invalidate() { return invalidate(0, 0, width(), height()); }
|
||||||
|
|
||||||
void set_mouse_capture(bool captured);
|
void set_mouse_relative(bool enabled);
|
||||||
void set_fullscreen(bool fullscreen);
|
void set_fullscreen(bool fullscreen);
|
||||||
void set_title(BAN::StringView title);
|
void set_title(BAN::StringView title);
|
||||||
|
|
||||||
|
|
|
@ -199,13 +199,13 @@ void WindowServer::on_window_set_attributes(int fd, const LibGUI::WindowPacket::
|
||||||
dwarnln("could not send window shown event: {}", ret.error());
|
dwarnln("could not send window shown event: {}", ret.error());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowServer::on_window_set_mouse_capture(int fd, const LibGUI::WindowPacket::WindowSetMouseCapture& packet)
|
void WindowServer::on_window_set_mouse_relative(int fd, const LibGUI::WindowPacket::WindowSetMouseRelative& packet)
|
||||||
{
|
{
|
||||||
if (m_is_mouse_captured && packet.captured)
|
if (m_is_mouse_relative && packet.enabled)
|
||||||
{
|
{
|
||||||
ASSERT(m_focused_window);
|
ASSERT(m_focused_window);
|
||||||
if (fd != m_focused_window->client_fd())
|
if (fd != m_focused_window->client_fd())
|
||||||
dwarnln("client tried to set mouse capture while other window has it already captured");
|
dwarnln("client tried to set mouse relative while other window has it already");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,11 +221,11 @@ void WindowServer::on_window_set_mouse_capture(int fd, const LibGUI::WindowPacke
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet.captured == m_is_mouse_captured)
|
if (packet.enabled == m_is_mouse_relative)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
set_focused_window(target_window);
|
set_focused_window(target_window);
|
||||||
m_is_mouse_captured = packet.captured;
|
m_is_mouse_relative = packet.enabled;
|
||||||
invalidate(cursor_area());
|
invalidate(cursor_area());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ void WindowServer::on_key_event(LibInput::KeyEvent event)
|
||||||
|
|
||||||
void WindowServer::on_mouse_button(LibInput::MouseButtonEvent event)
|
void WindowServer::on_mouse_button(LibInput::MouseButtonEvent event)
|
||||||
{
|
{
|
||||||
if (m_is_mouse_captured)
|
if (m_is_mouse_relative)
|
||||||
{
|
{
|
||||||
ASSERT(m_focused_window);
|
ASSERT(m_focused_window);
|
||||||
|
|
||||||
|
@ -681,7 +681,7 @@ void WindowServer::on_mouse_move_impl(int32_t new_x, int32_t new_y)
|
||||||
|
|
||||||
void WindowServer::on_mouse_move(LibInput::MouseMoveEvent event)
|
void WindowServer::on_mouse_move(LibInput::MouseMoveEvent event)
|
||||||
{
|
{
|
||||||
if (m_is_mouse_captured)
|
if (m_is_mouse_relative)
|
||||||
{
|
{
|
||||||
ASSERT(m_focused_window);
|
ASSERT(m_focused_window);
|
||||||
|
|
||||||
|
@ -767,9 +767,9 @@ void WindowServer::set_focused_window(BAN::RefPtr<Window> window)
|
||||||
if (m_focused_window == window)
|
if (m_focused_window == window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_is_mouse_captured)
|
if (m_is_mouse_relative)
|
||||||
{
|
{
|
||||||
m_is_mouse_captured = false;
|
m_is_mouse_relative = false;
|
||||||
invalidate(cursor_area());
|
invalidate(cursor_area());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,7 +903,7 @@ void WindowServer::invalidate(Rectangle area)
|
||||||
mark_pending_sync(dst_area);
|
mark_pending_sync(dst_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_is_mouse_captured)
|
if (!m_is_mouse_relative)
|
||||||
{
|
{
|
||||||
auto cursor_area = this->cursor_area();
|
auto cursor_area = this->cursor_area();
|
||||||
cursor_area.x -= m_focused_window->client_x();
|
cursor_area.x -= m_focused_window->client_x();
|
||||||
|
@ -1140,7 +1140,7 @@ void WindowServer::invalidate(Rectangle area)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_is_mouse_captured)
|
if (!m_is_mouse_relative)
|
||||||
{
|
{
|
||||||
if (const auto overlap = cursor_area().get_overlap(area); overlap.has_value())
|
if (const auto overlap = cursor_area().get_overlap(area); overlap.has_value())
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
void on_window_invalidate(int fd, const LibGUI::WindowPacket::WindowInvalidate&);
|
void on_window_invalidate(int fd, const LibGUI::WindowPacket::WindowInvalidate&);
|
||||||
void on_window_set_position(int fd, const LibGUI::WindowPacket::WindowSetPosition&);
|
void on_window_set_position(int fd, const LibGUI::WindowPacket::WindowSetPosition&);
|
||||||
void on_window_set_attributes(int fd, const LibGUI::WindowPacket::WindowSetAttributes&);
|
void on_window_set_attributes(int fd, const LibGUI::WindowPacket::WindowSetAttributes&);
|
||||||
void on_window_set_mouse_capture(int fd, const LibGUI::WindowPacket::WindowSetMouseCapture&);
|
void on_window_set_mouse_relative(int fd, const LibGUI::WindowPacket::WindowSetMouseRelative&);
|
||||||
void on_window_set_size(int fd, const LibGUI::WindowPacket::WindowSetSize&);
|
void on_window_set_size(int fd, const LibGUI::WindowPacket::WindowSetSize&);
|
||||||
void on_window_set_min_size(int fd, const LibGUI::WindowPacket::WindowSetMinSize&);
|
void on_window_set_min_size(int fd, const LibGUI::WindowPacket::WindowSetMinSize&);
|
||||||
void on_window_set_max_size(int fd, const LibGUI::WindowPacket::WindowSetMaxSize&);
|
void on_window_set_max_size(int fd, const LibGUI::WindowPacket::WindowSetMaxSize&);
|
||||||
|
@ -112,7 +112,7 @@ private:
|
||||||
uint8_t m_resize_quadrant { 0 };
|
uint8_t m_resize_quadrant { 0 };
|
||||||
Position m_resize_start;
|
Position m_resize_start;
|
||||||
|
|
||||||
bool m_is_mouse_captured { false };
|
bool m_is_mouse_relative { false };
|
||||||
|
|
||||||
bool m_deleted_window { false };
|
bool m_deleted_window { false };
|
||||||
bool m_is_stopped { false };
|
bool m_is_stopped { false };
|
||||||
|
|
|
@ -368,7 +368,7 @@ int main()
|
||||||
WINDOW_PACKET_CASE(WindowInvalidate, on_window_invalidate);
|
WINDOW_PACKET_CASE(WindowInvalidate, on_window_invalidate);
|
||||||
WINDOW_PACKET_CASE(WindowSetPosition, on_window_set_position);
|
WINDOW_PACKET_CASE(WindowSetPosition, on_window_set_position);
|
||||||
WINDOW_PACKET_CASE(WindowSetAttributes, on_window_set_attributes);
|
WINDOW_PACKET_CASE(WindowSetAttributes, on_window_set_attributes);
|
||||||
WINDOW_PACKET_CASE(WindowSetMouseCapture, on_window_set_mouse_capture);
|
WINDOW_PACKET_CASE(WindowSetMouseRelative, on_window_set_mouse_relative);
|
||||||
WINDOW_PACKET_CASE(WindowSetSize, on_window_set_size);
|
WINDOW_PACKET_CASE(WindowSetSize, on_window_set_size);
|
||||||
WINDOW_PACKET_CASE(WindowSetMinSize, on_window_set_min_size);
|
WINDOW_PACKET_CASE(WindowSetMinSize, on_window_set_min_size);
|
||||||
WINDOW_PACKET_CASE(WindowSetMaxSize, on_window_set_max_size);
|
WINDOW_PACKET_CASE(WindowSetMaxSize, on_window_set_max_size);
|
||||||
|
|
Loading…
Reference in New Issue