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:
Norman Feske 2014-04-25 23:27:20 +02:00
parent 13cc423050
commit b9cf2eade8

View File

@ -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 */