summaryrefslogtreecommitdiffstats
path: root/contrib/fltk/04-str2636-fltk-1.3.x-clipboard-win32.patch
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/fltk/04-str2636-fltk-1.3.x-clipboard-win32.patch')
-rw-r--r--contrib/fltk/04-str2636-fltk-1.3.x-clipboard-win32.patch99
1 files changed, 99 insertions, 0 deletions
diff --git a/contrib/fltk/04-str2636-fltk-1.3.x-clipboard-win32.patch b/contrib/fltk/04-str2636-fltk-1.3.x-clipboard-win32.patch
new file mode 100644
index 00000000..ac94779c
--- /dev/null
+++ b/contrib/fltk/04-str2636-fltk-1.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) {