[gtk/gtk-3-24: 1/2] GDK W32: Use Vista+ clipboard API
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/2] GDK W32: Use Vista+ clipboard API
- Date: Thu, 6 Feb 2020 12:52:58 +0000 (UTC)
commit e860ac5cf6210f6b4490326f9e2bdc888668c87e
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date: Mon Oct 21 19:07:01 2019 +0000
GDK W32: Use Vista+ clipboard API
Use RemoveClipboardFormatListener() and AddClipboardFormatListener().
These APIs remove the need for us to maintain the integrity of the
clipboard chain, which turned out to be problematic for some reason
that is yet to be identified.
Fixes #2215
Fixes #442
gdk/win32/gdkdisplay-win32.c | 29 ++---------------------------
1 file changed, 2 insertions(+), 27 deletions(-)
---
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index eabf139393..5c18ba689e 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -523,8 +523,6 @@ gdk_win32_display_supports_selection_notification (GdkDisplay *display)
return TRUE;
}
-static HWND _hwnd_next_viewer = NULL;
-
/*
* maybe this should be integrated with the default message loop - or maybe not ;-)
*/
@@ -538,24 +536,11 @@ inner_clipboard_window_procedure (HWND hwnd,
{
case WM_DESTROY: /* remove us from chain */
{
- ChangeClipboardChain (hwnd, _hwnd_next_viewer);
+ RemoveClipboardFormatListener (hwnd);
PostQuitMessage (0);
return 0;
}
- case WM_CHANGECBCHAIN:
- {
- HWND hwndRemove = (HWND) wparam; /* handle of window being removed */
- HWND hwndNext = (HWND) lparam; /* handle of next window in chain */
-
- if (hwndRemove == _hwnd_next_viewer)
- _hwnd_next_viewer = hwndNext == hwnd ? NULL : hwndNext;
- else if (_hwnd_next_viewer != NULL)
- return SendMessage (_hwnd_next_viewer, message, wparam, lparam);
-
- return 0;
- }
case WM_CLIPBOARDUPDATE:
- case WM_DRAWCLIPBOARD:
{
HWND hwnd_owner;
HWND stored_hwnd_owner;
@@ -632,9 +617,6 @@ inner_clipboard_window_procedure (HWND hwnd,
event->owner_change.selection_time = GDK_CURRENT_TIME;
_gdk_win32_append_event (event);
- if (_hwnd_next_viewer != NULL)
- return SendMessage (_hwnd_next_viewer, message, wparam, lparam);
-
/* clear error to avoid confusing SetClipboardViewer() return */
SetLastError (0);
return 0;
@@ -694,16 +676,10 @@ register_clipboard_notification (GdkDisplay *display)
goto failed;
SetLastError (0);
- _hwnd_next_viewer = SetClipboardViewer (display_win32->clipboard_hwnd);
- if (_hwnd_next_viewer == NULL && GetLastError() != 0)
+ if (AddClipboardFormatListener (display_win32->clipboard_hwnd) == FALSE)
goto failed;
- /* FIXME: http://msdn.microsoft.com/en-us/library/ms649033(v=VS.85).aspx */
- /* This is only supported by Vista, and not yet by mingw64 */
- /* if (AddClipboardFormatListener (hwnd) == FALSE) */
- /* goto failed; */
-
return TRUE;
failed:
@@ -850,7 +826,6 @@ gdk_win32_display_dispose (GObject *object)
{
DestroyWindow (display_win32->clipboard_hwnd);
display_win32->clipboard_hwnd = NULL;
- _hwnd_next_viewer = NULL;
}
if (display_win32->have_at_least_win81)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]