summaryrefslogtreecommitdiffstats
path: root/client/screen_layer.cpp
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2009-11-08 16:34:12 +0200
committerYaniv Kamay <ykamay@redhat.com>2010-01-03 17:17:06 +0200
commit78f8d4b9e8fdb09055c04e82e30b6a0290795339 (patch)
treeaa883b71aec074544d3d56b5e0a2040d5ef1cc2e /client/screen_layer.cpp
parent83efc81f30b4625f40983a5771cfdccc5860f8e6 (diff)
downloadspice-78f8d4b9e8fdb09055c04e82e30b6a0290795339.tar.gz
spice-78f8d4b9e8fdb09055c04e82e30b6a0290795339.tar.xz
spice-78f8d4b9e8fdb09055c04e82e30b6a0290795339.zip
spice client: creating a general process loop.
The process loop is responsible for: 1) waiting for events 2) timers 3) events queue for actions that should be performed in the context of the thread and are pushed from other threads. The benefits: 1) remove duplicity: till now, there was one implementaion of events loop for the channels and another one for the main thread. 2) timers can be executed on each thread and not only on the main thread. 3) events can be pushed to each thread and not only to the main thread. In this commit, only the main thread was modified to use the new process loop.
Diffstat (limited to 'client/screen_layer.cpp')
-rw-r--r--client/screen_layer.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/client/screen_layer.cpp b/client/screen_layer.cpp
index f521b465..9940ad86 100644
--- a/client/screen_layer.cpp
+++ b/client/screen_layer.cpp
@@ -24,18 +24,23 @@
class AttacheLayerEvent: public SyncEvent {
public:
- AttacheLayerEvent(ScreenLayer& layer, int screen_id) : _layer (layer), _screen_id (screen_id) {}
+ AttacheLayerEvent(ScreenLayer& layer, int screen_id)
+ : _layer (layer)
+ , _screen_id (screen_id)
+ {
+ }
- virtual void do_responce(Application& application);
+ virtual void do_response(AbstractProcessLoop& events_loop);
private:
ScreenLayer& _layer;
int _screen_id;
};
-void AttacheLayerEvent::do_responce(Application& application)
+void AttacheLayerEvent::do_response(AbstractProcessLoop& events_loop)
{
- AutoRef<RedScreen> screen(application.get_screen(_screen_id));
+ Application* app = (Application*)(events_loop.get_owner());
+ AutoRef<RedScreen> screen(app->get_screen(_screen_id));
(*screen)->attach_layer(_layer);
}
@@ -43,13 +48,13 @@ class DetacheLayerEvent: public SyncEvent {
public:
DetacheLayerEvent(ScreenLayer& _layer) : _layer (_layer) {}
- virtual void do_responce(Application& application);
+ virtual void do_response(AbstractProcessLoop& events_loop);
private:
ScreenLayer& _layer;
};
-void DetacheLayerEvent::do_responce(Application& application)
+void DetacheLayerEvent::do_response(AbstractProcessLoop& events_loop)
{
_layer.screen()->detach_layer(_layer);
}