From c909198eca202f1a2424ce739c541a740dd61281 Mon Sep 17 00:00:00 2001 From: Arnon Gilboa Date: Fri, 1 Oct 2010 16:06:10 +0200 Subject: client: support clipboard/selection-owner model (v2) -includes most of Hans' review fixes (up to the SelectionRequest comment [4]) & X11 wips sent by Hans (10x!) -use the VD_AGENT_CLIPBOARD_* types in the platform code -add ifs for VD_AGENT_CAP_CLIPBOARD_BY_DEMAND in both sides -support the GRAB/REQUEST/DATA/RELEASE verbs in both ways -pasting clipboard data is now "only-by-demand" from both sides (client and agent), whose behavior is symmetric -client and agent don't read or send the contents of the clipboard unnecessarily (e.g. copy, internal paste, repeating paste, focus change) -set client as clipboard listener instead of application -add atexit(cleanup) in win platform linux: -instead of clipboard atom selection instead of XA_PRIMARY -enable USE_XRANDR_1_2 and support clipboard in MultyMonScreen -send utf8 with no null termination, remove ++size -add xfixes in configure.ac & Makefile.am windows: -bonus: support image cut & paste, currently only on windows not done yet: -clipboards formats are still uint32_t, not mime types stores as strings -platform_win is still used, not the root window -not replaced the ugly windows CF_DIB in agent/winclient --- client/red_client.h | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'client/red_client.h') diff --git a/client/red_client.h b/client/red_client.h index ba8b4ee9..3ccb8e32 100644 --- a/client/red_client.h +++ b/client/red_client.h @@ -144,16 +144,31 @@ public: uint32_t _color_depth; }; -class ClipboardEvent : public Event { +class ClipboardGrabEvent : public Event { public: + ClipboardGrabEvent(uint32_t type) : _type (type) {} virtual void response(AbstractProcessLoop& events_loop); + +private: + uint32_t _type; }; -class RedClient: public RedChannel { +class ClipboardRequestEvent : public Event { +public: + ClipboardRequestEvent(uint32_t type) : _type (type) {} + virtual void response(AbstractProcessLoop& events_loop); + +private: + uint32_t _type; +}; + +class RedClient: public RedChannel, + public Platform::ClipboardListener { public: friend class RedChannel; friend class Migrate; - friend class ClipboardEvent; + friend class ClipboardGrabEvent; + friend class ClipboardRequestEvent; RedClient(Application& application); ~RedClient(); @@ -192,7 +207,10 @@ public: PixmapCache& get_pixmap_cache() {return _pixmap_cache;} uint64_t get_pixmap_cache_size() { return _pixmap_cache_size;} void on_display_mode_change(); - void on_clipboard_change(); + void on_clipboard_grab(uint32_t type); + void on_clipboard_request(uint32_t type); + void on_clipboard_notify(uint32_t type, uint8_t* data, int32_t size); + void for_each_channel(ForEachChannelFunc& func); void on_mouse_capture_trigger(RedScreen& screen); @@ -228,13 +246,13 @@ private: void handle_agent_data(RedPeer::InMessage* message); void handle_agent_tokens(RedPeer::InMessage* message); void handle_migrate_switch_host(RedPeer::InMessage* message); + void dispatch_agent_message(VDAgentMessage* msg, void* data); void on_agent_reply(VDAgentReply* reply); void on_agent_announce_capabilities(VDAgentAnnounceCapabilities* caps, uint32_t msg_size); - void on_agent_clipboard(VDAgentClipboard* clipboard, uint32_t size); - void send_agent_clipboard(); void do_send_agent_clipboard(); + void send_agent_clipboard_message(uint32_t message_type, uint32_t size = 0, void* data = NULL); ChannelFactory* find_factory(uint32_t type); void create_channel(uint32_t type, uint32_t id); -- cgit