From b9cf2eade826d0091e14df296425329964333227 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 25 Apr 2014 23:27:20 +0200 Subject: [PATCH] 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. --- os/src/server/nitpicker/main.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/os/src/server/nitpicker/main.cc b/os/src/server/nitpicker/main.cc index 4f3cda5b6..d161d0fc8 100644 --- a/os/src/server/nitpicker/main.cc +++ b/os/src/server/nitpicker/main.cc @@ -971,14 +971,18 @@ void Nitpicker::Main::handle_input(unsigned) import_input_events(ev_buf, input.flush(), user_state, 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 */ - 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, [&] () { - xml.attribute("xpos", new_mouse_pos.x()); - xml.attribute("ypos", new_mouse_pos.y()); + xml.attribute("xpos", report_pos.x()); + xml.attribute("ypos", report_pos.y()); }); /* update mouse cursor */