mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
WindowServer: Add IPC endpoint to get the color under cursor
This allows any client to ask the WindowServer to give it the color of the screen bitmap under the cursor. There's currently no way to get the screen bitmap *without* the cursor already drawn on it, so for now we just take a pixel beside the actual cursor position to avoid just getting the cursors color.
This commit is contained in:
parent
3da4fdd0eb
commit
69d708fb21
3 changed files with 12 additions and 0 deletions
|
@ -1048,6 +1048,16 @@ Messages::WindowServer::GetScreenBitmapAroundCursorResponse ClientConnection::ge
|
|||
return { {} };
|
||||
}
|
||||
|
||||
Messages::WindowServer::GetColorUnderCursorResponse ClientConnection::get_color_under_cursor()
|
||||
{
|
||||
// FIXME: Add a mechanism to get screen bitmap without cursor, so we don't have to do this
|
||||
// manual translation to avoid sampling the color on the actual cursor itself.
|
||||
auto cursor_location = ScreenInput::the().cursor_location().translated(-1, -1);
|
||||
auto& screen_with_cursor = ScreenInput::the().cursor_location_screen();
|
||||
auto color = Compositor::the().color_at_position({}, screen_with_cursor, cursor_location);
|
||||
return color;
|
||||
}
|
||||
|
||||
Messages::WindowServer::IsWindowModifiedResponse ClientConnection::is_window_modified(i32 window_id)
|
||||
{
|
||||
auto it = m_windows.find(window_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue