mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:27:35 +00:00
WindowServer+Magnifier: Make Magnifier buttery smooth :^)
This patch moves the magnifier rect computation over to the server side to ensure that the mouse cursor position and the screen image never get out of sync.
This commit is contained in:
parent
0ea1fd2d54
commit
cb295ab644
5 changed files with 18 additions and 9 deletions
|
@ -904,6 +904,20 @@ Messages::WindowServer::GetScreenBitmapResponse ClientConnection::get_screen_bit
|
|||
return bitmap.to_shareable_bitmap();
|
||||
}
|
||||
|
||||
Messages::WindowServer::GetScreenBitmapAroundCursorResponse ClientConnection::get_screen_bitmap_around_cursor(Gfx::IntSize const& size)
|
||||
{
|
||||
auto scale_factor = WindowManager::the().scale_factor();
|
||||
auto cursor_location = Screen::the().cursor_location();
|
||||
Gfx::Rect rect { (cursor_location.x() * scale_factor) - (size.width() / 2), (cursor_location.y() * scale_factor) - (size.height() / 2), size.width(), size.height() };
|
||||
|
||||
// Recompose the screen to make sure the cursor is painted in the location we think it is.
|
||||
// FIXME: This is rather wasteful. We can probably think of a way to avoid this.
|
||||
Compositor::the().compose();
|
||||
|
||||
auto bitmap = Compositor::the().front_bitmap_for_screenshot({}).cropped(rect);
|
||||
return bitmap->to_shareable_bitmap();
|
||||
}
|
||||
|
||||
Messages::WindowServer::IsWindowModifiedResponse ClientConnection::is_window_modified(i32 window_id)
|
||||
{
|
||||
auto it = m_windows.find(window_id);
|
||||
|
|
|
@ -147,6 +147,7 @@ private:
|
|||
virtual void set_scroll_step_size(u32) override;
|
||||
virtual Messages::WindowServer::GetScrollStepSizeResponse get_scroll_step_size() override;
|
||||
virtual Messages::WindowServer::GetScreenBitmapResponse get_screen_bitmap(Optional<Gfx::IntRect> const&) override;
|
||||
virtual Messages::WindowServer::GetScreenBitmapAroundCursorResponse get_screen_bitmap_around_cursor(Gfx::IntSize const&) override;
|
||||
virtual void set_double_click_speed(i32) override;
|
||||
virtual Messages::WindowServer::GetDoubleClickSpeedResponse get_double_click_speed() override;
|
||||
virtual void set_window_modified(i32, bool) override;
|
||||
|
|
|
@ -121,6 +121,7 @@ endpoint WindowServer
|
|||
get_scroll_step_size() => (u32 step_size)
|
||||
|
||||
get_screen_bitmap(Optional<Gfx::IntRect> rect) => (Gfx::ShareableBitmap bitmap)
|
||||
get_screen_bitmap_around_cursor(Gfx::IntSize size) => (Gfx::ShareableBitmap bitmap)
|
||||
|
||||
pong() =|
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue