nitpicker: Report pointer position
This commit is contained in:
parent
2a576da2b0
commit
7c23d6cd81
|
@ -31,6 +31,7 @@
|
||||||
#include <os/pixel_rgb565.h>
|
#include <os/pixel_rgb565.h>
|
||||||
#include <os/session_policy.h>
|
#include <os/session_policy.h>
|
||||||
#include <os/server.h>
|
#include <os/server.h>
|
||||||
|
#include <os/reporter.h>
|
||||||
|
|
||||||
/* local includes */
|
/* local includes */
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
@ -821,6 +822,9 @@ struct Nitpicker::Main
|
||||||
Root<PT> np_root = { session_list, global_keys, ep.rpc_ep(),
|
Root<PT> np_root = { session_list, global_keys, ep.rpc_ep(),
|
||||||
user_state, sliced_heap, screen,
|
user_state, sliced_heap, screen,
|
||||||
framebuffer, MENUBAR_HEIGHT };
|
framebuffer, MENUBAR_HEIGHT };
|
||||||
|
|
||||||
|
Genode::Reporter pointer_reporter = { "pointer" };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configuration-update dispatcher, executed in the context of the RPC
|
* Configuration-update dispatcher, executed in the context of the RPC
|
||||||
* entrypoint.
|
* entrypoint.
|
||||||
|
@ -884,6 +888,14 @@ void Nitpicker::Main::handle_input(unsigned)
|
||||||
|
|
||||||
Point const new_mouse_pos = user_state.mouse_pos();
|
Point const new_mouse_pos = user_state.mouse_pos();
|
||||||
|
|
||||||
|
/* report mouse-position updates */
|
||||||
|
if (pointer_reporter.is_enabled() && old_mouse_pos != new_mouse_pos)
|
||||||
|
Genode::Reporter::Xml_generator xml(pointer_reporter, [&] ()
|
||||||
|
{
|
||||||
|
xml.attribute("xpos", new_mouse_pos.x());
|
||||||
|
xml.attribute("ypos", new_mouse_pos.y());
|
||||||
|
});
|
||||||
|
|
||||||
/* update mouse cursor */
|
/* update mouse cursor */
|
||||||
if (old_mouse_pos != new_mouse_pos)
|
if (old_mouse_pos != new_mouse_pos)
|
||||||
user_state.viewport(mouse_cursor,
|
user_state.viewport(mouse_cursor,
|
||||||
|
@ -926,6 +938,13 @@ void Nitpicker::Main::handle_config(unsigned)
|
||||||
.attribute("color").value(&background.color);
|
.attribute("color").value(&background.color);
|
||||||
} catch (...) { }
|
} catch (...) { }
|
||||||
|
|
||||||
|
/* enable or disable reporting */
|
||||||
|
try {
|
||||||
|
pointer_reporter.enabled(config()->xml_node().sub_node("report")
|
||||||
|
.attribute("pointer")
|
||||||
|
.has_value("yes"));
|
||||||
|
} catch (...) { }
|
||||||
|
|
||||||
/* update session policies */
|
/* update session policies */
|
||||||
for (::Session *s = session_list.first(); s; s = s->next())
|
for (::Session *s = session_list.first(); s; s = s->next())
|
||||||
s->apply_session_color();
|
s->apply_session_color();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user