mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 08:25:38 +00:00
nitpicker: center initial pointer position
This commit is contained in:
parent
e77aa70ba2
commit
14180d60be
@ -228,6 +228,12 @@ struct Nitpicker::Main : Focus_updater
|
||||
|
||||
Reconstructible<Framebuffer_screen> _fb_screen = { _env.rm(), _framebuffer };
|
||||
|
||||
Point _initial_pointer_pos()
|
||||
{
|
||||
Area const scr_size = _fb_screen->screen.size();
|
||||
return Point(scr_size.w()/2, scr_size.h()/2);
|
||||
}
|
||||
|
||||
void _handle_fb_mode();
|
||||
|
||||
Signal_handler<Main> _fb_mode_handler = { _env.ep(), *this, &Main::_handle_fb_mode };
|
||||
@ -250,7 +256,7 @@ struct Nitpicker::Main : Focus_updater
|
||||
|
||||
Focus _focus { };
|
||||
View_stack _view_stack { _fb_screen->screen.size(), _focus };
|
||||
User_state _user_state { _focus, _global_keys, _view_stack };
|
||||
User_state _user_state { _focus, _global_keys, _view_stack, _initial_pointer_pos() };
|
||||
|
||||
View_owner _global_view_owner { };
|
||||
|
||||
@ -361,6 +367,7 @@ struct Nitpicker::Main : Focus_updater
|
||||
{
|
||||
_view_stack.default_background(_builtin_background);
|
||||
_view_stack.stack(_pointer_origin);
|
||||
_view_stack.geometry(_pointer_origin, Rect(_user_state.pointer_pos(), Area()));
|
||||
_view_stack.stack(_builtin_background);
|
||||
|
||||
_config_rom.sigh(_config_handler);
|
||||
|
@ -78,7 +78,7 @@ class Nitpicker::User_state
|
||||
/*
|
||||
* Current pointer position
|
||||
*/
|
||||
Point _pointer_pos { };
|
||||
Point _pointer_pos;
|
||||
|
||||
/*
|
||||
* Currently pointed-at view owner
|
||||
@ -164,9 +164,11 @@ class Nitpicker::User_state
|
||||
* \param focus exported focus information, to be consumed by the
|
||||
* view stack to tailor its view drawing operations
|
||||
*/
|
||||
User_state(Focus &focus, Global_keys &global_keys, View_stack &view_stack)
|
||||
User_state(Focus &focus, Global_keys &global_keys, View_stack &view_stack,
|
||||
Point initial_pointer_pos)
|
||||
:
|
||||
_focus(focus), _global_keys(global_keys), _view_stack(view_stack)
|
||||
_focus(focus), _global_keys(global_keys), _view_stack(view_stack),
|
||||
_pointer_pos(initial_pointer_pos)
|
||||
{ }
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user