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>2009-11-09 14:39:33 +0200
commit8d5b738ba169c44d223ab6d99ec12e763ce5bc8e (patch)
tree3c1d4dd1b3c32f9a03dd456ea921a66ed7f6c7fd /client/cursor_channel.cpp
parent082934699611d5985ecf3386259d270d75e41c12 (diff)
downloadspice-8d5b738ba169c44d223ab6d99ec12e763ce5bc8e.tar.gz
spice-8d5b738ba169c44d223ab6d99ec12e763ce5bc8e.tar.xz
spice-8d5b738ba169c44d223ab6d99ec12e763ce5bc8e.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 {