diff options
author | Yaniv Kamay <ykamay@redhat.com> | 2009-11-16 17:50:16 +0200 |
---|---|---|
committer | Yaniv Kamay <ykamay@redhat.com> | 2009-11-30 18:03:35 +0200 |
commit | 3b51087b3656b111886c7397d0ddd499a96f9e2d (patch) | |
tree | 21cdb7b0dc282062bd811f65ee295a7074b58275 /client/inputs_channel.cpp | |
parent | a70110c4e50aad99de7a844bb78eb868768e7841 (diff) | |
download | spice-3b51087b3656b111886c7397d0ddd499a96f9e2d.tar.gz spice-3b51087b3656b111886c7397d0ddd499a96f9e2d.tar.xz spice-3b51087b3656b111886c7397d0ddd499a96f9e2d.zip |
client: interactive screen layer
Diffstat (limited to 'client/inputs_channel.cpp')
-rw-r--r-- | client/inputs_channel.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/client/inputs_channel.cpp b/client/inputs_channel.cpp index df434937..e1b63964 100644 --- a/client/inputs_channel.cpp +++ b/client/inputs_channel.cpp @@ -21,6 +21,7 @@ #include "debug.h" #include "red_client.h" #include "application.h" +#include "display_channel.h" #define SYNC_REMOTH_MODIFIRES @@ -28,9 +29,30 @@ class SetInputsHandlerEvent: public Event { public: SetInputsHandlerEvent(InputsChannel& channel) : _channel (channel) {} + class AttachFunc: public ForEachChannelFunc { + public: + AttachFunc(InputsChannel& channel) + : _channel (channel) + { + } + + virtual bool operator() (RedChannel& channel) + { + if (channel.get_type() == RED_CHANNEL_DISPLAY) { + static_cast<DisplayChannel&>(channel).attach_inputs(&_channel); + } + return true; + } + + public: + InputsChannel& _channel; + }; + virtual void response(AbstractProcessLoop& events_loop) { static_cast<Application*>(events_loop.get_owner())->set_inputs_handler(_channel); + AttachFunc func(_channel); + _channel.get_client().for_each_channel(func); } private: @@ -56,9 +78,22 @@ class RemoveInputsHandlerEvent: public SyncEvent { public: RemoveInputsHandlerEvent(InputsChannel& channel) : _channel (channel) {} + class DetachFunc: public ForEachChannelFunc { + public: + virtual bool operator() (RedChannel& channel) + { + if (channel.get_type() == RED_CHANNEL_DISPLAY) { + static_cast<DisplayChannel&>(channel).detach_inputs(); + } + return true; + } + }; + virtual void do_response(AbstractProcessLoop& events_loop) { static_cast<Application*>(events_loop.get_owner())->remove_inputs_handler(_channel); + DetachFunc detach_func; + _channel.get_client().for_each_channel(detach_func); } private: |