From d46d791df036c95e4f6e4622cb65b877dcb8958d Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 20 Sep 2005 07:59:19 +0000 Subject: [PATCH] Do return the correct owner for CLIPBOARD (i.e., the owner of the Windows 2005-09-20 Tor Lillqvist * gdk/win32/gdkselection-win32.c (gdk_selection_owner_get_for_display): Do return the correct owner for CLIPBOARD (i.e., the owner of the Windows Clipboard, if it is a window GDK knows about). The reason to return NULL seems to have gone when in the fix for bug #163702 the artificial GDK_SELECTION_CLEAR event generation was removed from gdk_selection_send_notify_for_display(). Fixes bug #316552. --- ChangeLog | 10 ++++++++++ ChangeLog.pre-2-10 | 10 ++++++++++ gdk/win32/gdkselection-win32.c | 19 +++++++++++-------- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f02a50938..fcba1e8cfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-09-20 Tor Lillqvist + + * gdk/win32/gdkselection-win32.c + (gdk_selection_owner_get_for_display): Do return the correct owner + for CLIPBOARD (i.e., the owner of the Windows Clipboard, if it is + a window GDK knows about). The reason to return NULL seems to have + gone when in the fix for bug #163702 the artificial + GDK_SELECTION_CLEAR event generation was removed from + gdk_selection_send_notify_for_display(). Fixes bug #316552. + 2005-09-20 Matthias Clasen Avoid unnecessary XkbGetState() calls and XkbStateNotify diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 9f02a50938..fcba1e8cfc 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +2005-09-20 Tor Lillqvist + + * gdk/win32/gdkselection-win32.c + (gdk_selection_owner_get_for_display): Do return the correct owner + for CLIPBOARD (i.e., the owner of the Windows Clipboard, if it is + a window GDK knows about). The reason to return NULL seems to have + gone when in the fix for bug #163702 the artificial + GDK_SELECTION_CLEAR event generation was removed from + gdk_selection_send_notify_for_display(). Fixes bug #316552. + 2005-09-20 Matthias Clasen Avoid unnecessary XkbGetState() calls and XkbStateNotify diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c index 1bcdaa5497..6389571300 100644 --- a/gdk/win32/gdkselection-win32.c +++ b/gdk/win32/gdkselection-win32.c @@ -280,14 +280,15 @@ gdk_selection_owner_get_for_display (GdkDisplay *display, g_return_val_if_fail (display == _gdk_display, NULL); g_return_val_if_fail (selection != GDK_NONE, NULL); - /* Return NULL for CLIPBOARD, because otherwise cut&paste inside the - * same application doesn't work. We must pretend to gtk that we - * don't have the selection, so that we always fetch it from the - * Windows clipboard. See also comments in - * gdk_selection_send_notify(). - */ if (selection == GDK_SELECTION_CLIPBOARD) - return NULL; + { + HWND owner = GetClipboardOwner (); + + if (owner == NULL) + return NULL; + + return gdk_win32_handle_table_lookup ((GdkNativeWindow) owner); + } window = gdk_window_lookup ((GdkNativeWindow) g_hash_table_lookup (sel_owner_table, selection)); @@ -746,7 +747,9 @@ gdk_selection_send_notify_for_display (GdkDisplay *display, GdkAtom property, guint32 time) { +#ifdef G_ENABLE_DEBUG gchar *sel_name, *tgt_name, *prop_name; +#endif g_return_if_fail (display == _gdk_display); @@ -754,7 +757,7 @@ gdk_selection_send_notify_for_display (GdkDisplay *display, (sel_name = gdk_atom_name (selection), tgt_name = gdk_atom_name (target), prop_name = gdk_atom_name (property), - g_print ("gdk_selection_send_notify: %#x %#x (%s) %#x (%s) %#x (%s)\n", + g_print ("gdk_selection_send_notify_for_display: %#x %#x (%s) %#x (%s) %#x (%s)\n", requestor, (guint) selection, sel_name, (guint) target, tgt_name,