summaryrefslogtreecommitdiffstats
path: root/tigervnc/build/patches/fltk-1_v2.3.x-clipboard-win32.patch
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2015-04-11 21:47:56 +0000
committer Eric Hameleers <alien@slackware.com>2015-04-11 21:47:56 +0000
commit904d7edf33c5e2e2a8bc4a6c488d232168b066e5 (patch)
tree7dc722c334344bfe434b623a3aadaddef855f1d3 /tigervnc/build/patches/fltk-1_v2.3.x-clipboard-win32.patch
parentb340f092dd2a92ebb473f995f2428be9f56d249f (diff)
downloadasb-904d7edf33c5e2e2a8bc4a6c488d232168b066e5.tar.gz
asb-904d7edf33c5e2e2a8bc4a6c488d232168b066e5.tar.xz
Initial revision
Diffstat (limited to 'tigervnc/build/patches/fltk-1_v2.3.x-clipboard-win32.patch')
-rw-r--r--tigervnc/build/patches/fltk-1_v2.3.x-clipboard-win32.patch99
1 files changed, 99 insertions, 0 deletions
diff --git a/tigervnc/build/patches/fltk-1_v2.3.x-clipboard-win32.patch b/tigervnc/build/patches/fltk-1_v2.3.x-clipboard-win32.patch
new file mode 100644
index 00000000..ac94779c
--- /dev/null
+++ b/tigervnc/build/patches/fltk-1_v2.3.x-clipboard-win32.patch
@@ -0,0 +1,99 @@
+diff -ur fltk-1.3.0r9110.org/src/Fl.cxx fltk-1.3.0r9110/src/Fl.cxx
+--- fltk-1.3.0r9110.org/src/Fl.cxx 2012-06-17 19:47:09.988183253 +0200
++++ fltk-1.3.0r9110/src/Fl.cxx 2012-06-17 19:47:10.127189919 +0200
+@@ -1421,6 +1421,7 @@
+ // hide() destroys the X window, it does not do unmap!
+
+ #if defined(WIN32)
++extern void fl_clipboard_notify_untarget(HWND wnd);
+ extern void fl_update_clipboard(void);
+ #elif USE_XFT
+ extern void fl_destroy_xft_draw(Window);
+@@ -1471,6 +1472,8 @@
+ // to destroy the window that owns the selection.
+ if (GetClipboardOwner()==ip->xid)
+ fl_update_clipboard();
++ // Make sure we unlink this window from the clipboard chain
++ fl_clipboard_notify_untarget(ip->xid);
+ // Send a message to myself so that I'll get out of the event loop...
+ PostMessage(ip->xid, WM_APP, 0, 0);
+ if (ip->private_dc) fl_release_dc(ip->xid, ip->private_dc);
+diff -ur fltk-1.3.0r9110.org/src/Fl_win32.cxx fltk-1.3.0r9110/src/Fl_win32.cxx
+--- fltk-1.3.0r9110.org/src/Fl_win32.cxx 2012-06-17 19:47:09.987183205 +0200
++++ fltk-1.3.0r9110/src/Fl_win32.cxx 2012-06-17 19:47:19.069618739 +0200
+@@ -646,6 +646,38 @@
+ }
+ }
+
++static HWND clipboard_wnd = 0;
++static HWND next_clipboard_wnd = 0;
++
++static bool initial_clipboard = true;
++
++void fl_clipboard_notify_change() {
++ // No need to do anything here...
++}
++
++void fl_clipboard_notify_target(HWND wnd) {
++ if (clipboard_wnd)
++ return;
++
++ // We get one fake WM_DRAWCLIPBOARD immediately, which we therefore
++ // need to ignore.
++ initial_clipboard = true;
++
++ clipboard_wnd = wnd;
++ next_clipboard_wnd = SetClipboardViewer(wnd);
++}
++
++void fl_clipboard_notify_untarget(HWND wnd) {
++ if (wnd != clipboard_wnd)
++ return;
++
++ ChangeClipboardChain(wnd, next_clipboard_wnd);
++ clipboard_wnd = next_clipboard_wnd = 0;
++
++ if (Fl::first_window())
++ fl_clipboard_notify_target(fl_xid(Fl::first_window()));
++}
++
+ ////////////////////////////////////////////////////////////////
+ char fl_is_ime = 0;
+ void fl_get_codepage()
+@@ -1327,6 +1359,27 @@
+ Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL);
+ return 0;
+
++ case WM_CHANGECBCHAIN:
++ if ((hWnd == clipboard_wnd) &&
++ (next_clipboard_wnd == (HWND)wParam)) {
++ next_clipboard_wnd = (HWND)lParam;
++ return 0;
++ }
++ break;
++
++ case WM_DRAWCLIPBOARD:
++ // When the clipboard moves between two FLTK windows,
++ // fl_i_own_selection will temporarily be false as we are
++ // processing this message. Hence the need to use fl_find().
++ if (!initial_clipboard && !fl_find(GetClipboardOwner()))
++ fl_trigger_clipboard_notify(1);
++ initial_clipboard = false;
++
++ if (next_clipboard_wnd)
++ SendMessage(next_clipboard_wnd, WM_DRAWCLIPBOARD, wParam, lParam);
++
++ return 0;
++
+ default:
+ if (Fl::handle(0,0)) return 0;
+ break;
+@@ -1685,6 +1738,8 @@
+ x->next = Fl_X::first;
+ Fl_X::first = x;
+
++ fl_clipboard_notify_target(x->xid);
++
+ x->wait_for_expose = 1;
+ if (fl_show_iconic) {showit = 0; fl_show_iconic = 0;}
+ if (showit) {