genode/repos/os/src/server/nitpicker/user_state.h

101 lines
1.9 KiB
C
Raw Normal View History

2011-12-22 16:19:25 +01:00
/*
* \brief Nitpicker user state handling
* \author Norman Feske
* \date 2006-08-09
*
* This class comprehends the policy of user interaction.
* It manages the toggling of Nitpicker's different modes
* and routes input events to corresponding client sessions.
*/
/*
2013-01-10 21:44:47 +01:00
* Copyright (C) 2006-2013 Genode Labs GmbH
2011-12-22 16:19:25 +01:00
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _USER_STATE_H_
#define _USER_STATE_H_
#include "mode.h"
#include "menubar.h"
#include "view_stack.h"
2013-09-06 17:34:16 +02:00
#include "global_keys.h"
2011-12-22 16:19:25 +01:00
class User_state : public Mode, public View_stack
{
private:
2013-09-06 17:34:16 +02:00
/*
* Policy for the routing of global keys
*/
Global_keys &_global_keys;
2011-12-22 16:19:25 +01:00
/*
* Menubar to display trusted labeling information
* according to the current Mitpicker mode and the
* focused session.
2011-12-22 16:19:25 +01:00
*/
2013-09-07 02:02:26 +02:00
Menubar &_menubar;
2011-12-22 16:19:25 +01:00
/*
* Current mouse cursor position
*/
Point _mouse_pos;
2011-12-22 16:19:25 +01:00
/*
* Currently pointed-at session
2011-12-22 16:19:25 +01:00
*/
Session *_pointed_session = nullptr;
2011-12-22 16:19:25 +01:00
2013-09-06 17:34:16 +02:00
/*
* Session that receives the current stream of input events
*/
Session *_input_receiver = nullptr;
2013-09-06 17:34:16 +02:00
/*
* True while a global key sequence is processed
*/
bool _global_key_sequence = false;
void _update_menubar();
void _update_all();
2013-09-06 17:34:16 +02:00
2011-12-22 16:19:25 +01:00
public:
/**
* Constructor
*/
User_state(Global_keys &, Area view_stack_size, Menubar &);
2011-12-22 16:19:25 +01:00
/**
* Handle input event
*
* This function controls the Nitpicker mode and the user state
* variables.
2011-12-22 16:19:25 +01:00
*/
void handle_event(Input::Event ev);
2011-12-22 16:19:25 +01:00
/**
* Accessors
*/
Point mouse_pos() { return _mouse_pos; }
2011-12-22 16:19:25 +01:00
/**
* (Re-)apply origin policy to all views
*/
void apply_origin_policy(View &pointer_origin)
{
View_stack::apply_origin_policy(pointer_origin);
}
2011-12-22 16:19:25 +01:00
/**
* Mode interface
*/
void forget(Session const &) override;
void focused_session(Session *) override;
2011-12-22 16:19:25 +01:00
};
#endif