genode/repos/os/src/server/nitpicker/user_state.h
Norman Feske d22cddd1e8 nitpicker: Perform redraw asynchronously
This patch changes nitpicker's way of redrawing. Originally, redraw
operations were triggered immediately by the RPC functions invoked by
clients. In the presence of clients that invoked a large number of those
functions, the server could become overloaded with processing redraw
operations. The new version performs redraw operations out of band with
the RPC functions. Similar to the design of the DOpE GUI server, redraw
operations are processed periodically. The RPC functions merely modify
meta data and track the dirty areas that need to be updated.
Consequently, nitpicker's RPC functions become light-weight operations.

As a nice collateral effect of this patch, nitpicker's internal
structure could be simplified because the drawing backend is no longer
needed by the code that dispatches the RPC interface.
2014-08-11 15:55:32 +02:00

96 lines
1.8 KiB
C++

/*
* \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.
*/
/*
* Copyright (C) 2006-2013 Genode Labs GmbH
*
* 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"
#include "global_keys.h"
class User_state : public Mode, public View_stack
{
private:
/*
* Policy for the routing of global keys
*/
Global_keys &_global_keys;
/*
* Number of currently pressed keys.
* This counter is used to determine if the user
* is dragging an item.
*/
unsigned _key_cnt;
/*
* Menubar to display trusted labeling information
* according to the current Mitpicker mode and the
* focused view.
*/
Menubar &_menubar;
/*
* Current mouse cursor position
*/
Point _mouse_pos;
/*
* Currently pointed-at view
*/
View const *_pointed_view;
/*
* Session that receives the current stream of input events
*/
Session *_input_receiver;
/*
* True while a global key sequence is processed
*/
bool _global_key_sequence;
public:
/**
* Constructor
*/
User_state(Global_keys &, Area view_stack_size, Menubar &);
/**
* Handle input event
*
* This function controls the Nitpicker mode and the user state
* variables.
*/
void handle_event(Input::Event ev);
/**
* Accessors
*/
Point mouse_pos() { return _mouse_pos; }
/**
* Mode interface
*/
void forget(View const &) override;
};
#endif