summaryrefslogtreecommitdiffstats
path: root/client/cursor_channel.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/cursor_channel.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/cursor_channel.cpp')
-rw-r--r--client/cursor_channel.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/client/cursor_channel.cpp b/client/cursor_channel.cpp
index a78eba35..d5a64b2b 100644
--- a/client/cursor_channel.cpp
+++ b/client/cursor_channel.cpp
@@ -331,7 +331,7 @@ public:
cursor->set_opaque(native_cursor);
}
- virtual void responce(Application& application)
+ virtual void response(AbstractProcessLoop& events_loop)
{
CursorData *cursor = *_cursor;
create_cursor();
@@ -345,7 +345,8 @@ public:
_channel._cursor_rect.top = _y - cursor->header().hot_spot_y;
_channel._cursor_rect.bottom = _channel._cursor_rect.top + cursor->header().height;
- if (application.get_mouse_mode() == RED_MOUSE_MODE_CLIENT) {
+ if (static_cast<Application*>(events_loop.get_owner())->get_mouse_mode() ==
+ RED_MOUSE_MODE_CLIENT) {
RedScreen* screen = _channel.screen();
ASSERT(screen);
screen->set_cursor(_visible ? cursor : NULL);
@@ -381,10 +382,11 @@ public:
{
}
- virtual void responce(Application& application)
+ virtual void response(AbstractProcessLoop& events_loop)
{
_channel._cursor_visible = true;
- if (application.get_mouse_mode() == RED_MOUSE_MODE_CLIENT) {
+ if (static_cast<Application*>(events_loop.get_owner())->get_mouse_mode() ==
+ RED_MOUSE_MODE_CLIENT) {
RedScreen* screen = _channel.screen();
ASSERT(screen);
screen->set_cursor(_channel._cursor);
@@ -412,10 +414,11 @@ private:
class CursorHideEvent: public Event {
public:
CursorHideEvent(CursorChannel& channel): _channel (channel) {}
- virtual void responce(Application& application)
+ virtual void response(AbstractProcessLoop& events_loop)
{
_channel._cursor_visible = false;
- if (application.get_mouse_mode() == RED_MOUSE_MODE_CLIENT) {
+ if (static_cast<Application*>(events_loop.get_owner())->get_mouse_mode() ==
+ RED_MOUSE_MODE_CLIENT) {
RedScreen* screen = _channel.screen();
ASSERT(screen);
screen->set_cursor(NULL);
@@ -431,7 +434,7 @@ private:
class CursorRemoveEvent: public Event {
public:
CursorRemoveEvent(CursorChannel& channel): _channel (channel) {}
- virtual void responce(Application& application)
+ virtual void response(AbstractProcessLoop& events_loop)
{
_channel._cursor_visible = false;
_channel.clear_area();
@@ -455,13 +458,14 @@ class CursorModeEvent: public Event {
public:
CursorModeEvent(CursorChannel& channel): _channel (channel) {}
- virtual void responce(Application& application)
+ virtual void response(AbstractProcessLoop& events_loop)
{
RedScreen* screen = _channel.screen();
if (!screen) {
return;
}
- if (application.get_mouse_mode() == RED_MOUSE_MODE_CLIENT) {
+ if (static_cast<Application*>(events_loop.get_owner())->get_mouse_mode() ==
+ RED_MOUSE_MODE_CLIENT) {
_channel.clear_area();
screen->set_cursor(_channel._cursor_visible ? _channel._cursor : NULL);
} else {