summaryrefslogtreecommitdiff
path: root/src/Fl_win32.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fl_win32.cxx')
-rw-r--r--src/Fl_win32.cxx42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index bbe9905e6..3a4cdfab4 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -790,23 +790,8 @@ static HWND clipboard_wnd = 0;
static HWND next_clipboard_wnd = 0;
static bool initial_clipboard = true;
-void fl_clipboard_notify_target(HWND wnd);
-void fl_clipboard_notify_change() {
- // untarget clipboard monitor if no handlers are registered
- if (clipboard_wnd != NULL && fl_clipboard_notify_empty())
- {
- fl_clipboard_notify_untarget(clipboard_wnd);
- return;
- }
-
- // if there are clipboard notify handlers but no window targeted
- // target first window if available
- if (clipboard_wnd == NULL && Fl::first_window())
- fl_clipboard_notify_target(fl_xid(Fl::first_window()));
-}
-
-void fl_clipboard_notify_target(HWND wnd) {
+static void fl_clipboard_notify_target(HWND wnd) {
if (clipboard_wnd)
return;
@@ -818,17 +803,40 @@ void fl_clipboard_notify_target(HWND wnd) {
next_clipboard_wnd = SetClipboardViewer(wnd);
}
-void fl_clipboard_notify_untarget(HWND wnd) {
+static void fl_clipboard_notify_untarget(HWND wnd) {
if (wnd != clipboard_wnd)
return;
ChangeClipboardChain(wnd, next_clipboard_wnd);
clipboard_wnd = next_clipboard_wnd = 0;
+}
+
+void fl_clipboard_notify_retarget(HWND wnd) {
+ // The given window is getting destroyed. If it's part of the
+ // clipboard chain then we need to unregister it and find a
+ // replacement window.
+ if (wnd != clipboard_wnd)
+ return;
+
+ fl_clipboard_notify_untarget(wnd);
if (Fl::first_window())
fl_clipboard_notify_target(fl_xid(Fl::first_window()));
}
+void fl_clipboard_notify_change() {
+ // untarget clipboard monitor if no handlers are registered
+ if (clipboard_wnd != NULL && fl_clipboard_notify_empty()) {
+ fl_clipboard_notify_untarget(clipboard_wnd);
+ return;
+ }
+
+ // if there are clipboard notify handlers but no window targeted
+ // target first window if available
+ if (clipboard_wnd == NULL && Fl::first_window())
+ fl_clipboard_notify_target(fl_xid(Fl::first_window()));
+}
+
////////////////////////////////////////////////////////////////
void fl_get_codepage()
{