mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
nitpicker: reflect seq number in clicked report
This patch makes nitpicker's "clicked" report useful for the detection of clicks outside of any client. This is needed in situations where the dialog should close when clicking outside its screen area. In the new version, a click outside any client results in a report without a 'label' attribute. Furthermore, the report is augmented by the sequence number of the click, which allows for freshness checks by the consumer of the report (i.e., sculpt_manager). Issue #4398
This commit is contained in:
parent
616a92a193
commit
3b8fe1b410
@ -89,6 +89,9 @@ static Input::Event merge_motion_events(Input::Event const *ev, unsigned n)
|
||||
|
||||
void User_state::_handle_input_event(Input::Event ev)
|
||||
{
|
||||
ev.handle_seq_number([&] (Input::Seq_number const &seq) {
|
||||
_last_seq_number.construct(seq); });
|
||||
|
||||
/* transparently convert relative into absolute motion event */
|
||||
ev.handle_relative_motion([&] (int x, int y) {
|
||||
|
||||
@ -154,6 +157,8 @@ void User_state::_handle_input_event(Input::Event ev)
|
||||
if (_mouse_button(keycode))
|
||||
_clicked_count++;
|
||||
|
||||
_last_clicked = nullptr;
|
||||
|
||||
/* update focused session */
|
||||
if (_mouse_button(keycode)
|
||||
&& _hovered
|
||||
@ -414,6 +419,9 @@ void User_state::report_focused_view_owner(Xml_generator &xml, bool active) cons
|
||||
|
||||
void User_state::report_last_clicked_view_owner(Xml_generator &xml) const
|
||||
{
|
||||
if (_last_seq_number.constructed())
|
||||
xml.attribute("seq", _last_seq_number->value);
|
||||
|
||||
if (_last_clicked)
|
||||
_last_clicked->report(xml);
|
||||
|
||||
|
@ -106,6 +106,8 @@ class Nitpicker::User_state
|
||||
*/
|
||||
View_owner *_last_clicked = nullptr;
|
||||
|
||||
Constructible<Input::Seq_number> _last_seq_number { };
|
||||
|
||||
/**
|
||||
* Number of clicks, used to detect whether a focus-relevant click
|
||||
* happened during '_handle_input_event'.
|
||||
|
Loading…
x
Reference in New Issue
Block a user