mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
nitpicker: Consider menubar for pointer reports
The pointer-report facility used to report the screen-absolute position of the mouse pointer. For nitpicker clients, however, this position is meaningless because their coordinate is always constrained to the area below the menu bar. This patch offsets the reported position accordingly.
This commit is contained in:
parent
13cc423050
commit
b9cf2eade8
@ -971,14 +971,18 @@ void Nitpicker::Main::handle_input(unsigned)
|
|||||||
import_input_events(ev_buf, input.flush(), user_state,
|
import_input_events(ev_buf, input.flush(), user_state,
|
||||||
canvas_accessor.canvas());
|
canvas_accessor.canvas());
|
||||||
|
|
||||||
Point const new_mouse_pos = user_state.mouse_pos();
|
Point const new_mouse_pos = user_state.mouse_pos();
|
||||||
|
Point const menubar_offset = Point(0, Framebuffer_screen::MENUBAR_HEIGHT);
|
||||||
|
Point const report_pos = new_mouse_pos - menubar_offset;
|
||||||
|
|
||||||
/* report mouse-position updates */
|
/* report mouse-position updates */
|
||||||
if (pointer_reporter.is_enabled() && old_mouse_pos != new_mouse_pos)
|
if (pointer_reporter.is_enabled() && old_mouse_pos != new_mouse_pos
|
||||||
|
&& new_mouse_pos.y() >= 0)
|
||||||
|
|
||||||
Genode::Reporter::Xml_generator xml(pointer_reporter, [&] ()
|
Genode::Reporter::Xml_generator xml(pointer_reporter, [&] ()
|
||||||
{
|
{
|
||||||
xml.attribute("xpos", new_mouse_pos.x());
|
xml.attribute("xpos", report_pos.x());
|
||||||
xml.attribute("ypos", new_mouse_pos.y());
|
xml.attribute("ypos", report_pos.y());
|
||||||
});
|
});
|
||||||
|
|
||||||
/* update mouse cursor */
|
/* update mouse cursor */
|
||||||
|
Loading…
Reference in New Issue
Block a user