win32: Stop sending clipboard_hwnd to main thread

With the switch to using the glib main context in the clipboard thread,
the clipboard hwnd is no longer used for sending messages.

This means it's not necessary to know it in the main thread.

And that means there's no small window where the clipboard thread spins
up and the window doesn't exist and any copy operation fails.
The main context can be created before spinning up the thread so
that is avoided.

Fixes the gtk/textbuffer test in the testsuite.
This commit is contained in:
Benjamin Otte 2024-10-26 04:22:11 +02:00
parent 4b4e7276f6
commit 06d61c5d39
2 changed files with 0 additions and 27 deletions

View File

@ -456,18 +456,6 @@ _gdk_win32_format_uses_hdata (UINT w32format)
}
}
/* This function is called in the main thread */
static gboolean
clipboard_hwnd_created (gpointer user_data)
{
GdkWin32Clipdrop *clipdrop = gdk_win32_display_get_clipdrop (gdk_display_get_default ());
clipdrop->clipboard_hwnd = (HWND) user_data;
return G_SOURCE_REMOVE;
}
/* This function is called in the main thread */
static gboolean
clipboard_owner_changed (gpointer user_data)
@ -1369,8 +1357,6 @@ register_clipboard_notification (GdkWin32Clipdrop *clipdrop)
goto failed;
}
g_idle_add_full (G_PRIORITY_DEFAULT, clipboard_hwnd_created, (gpointer) CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_hwnd), NULL);
return TRUE;
failed:
@ -2725,8 +2711,6 @@ _gdk_win32_advertise_clipboard_contentformats (GdkClipboard *cb,
gsize mime_types_len;
gsize i;
g_assert (clipdrop->clipboard_hwnd != NULL);
adv->parent.item_type = GDK_WIN32_CLIPBOARD_THREAD_QUEUE_ITEM_ADVERTISE;
adv->parent.start_time = g_get_monotonic_time ();
adv->parent.end_time = adv->parent.start_time + CLIPBOARD_OPERATION_TIMEOUT;
@ -2761,8 +2745,6 @@ _gdk_win32_retrieve_clipboard_contentformats (GdkClipboard *cb,
gsize mime_types_len;
gsize i;
g_assert (clipdrop->clipboard_hwnd != NULL);
retr->parent.item_type = GDK_WIN32_CLIPBOARD_THREAD_QUEUE_ITEM_RETRIEVE;
retr->parent.start_time = g_get_monotonic_time ();
retr->parent.end_time = retr->parent.start_time + CLIPBOARD_OPERATION_TIMEOUT;
@ -2870,8 +2852,6 @@ _gdk_win32_store_clipboard_contentformats (GdkClipboard *cb,
GdkWin32Clipdrop *clipdrop = gdk_win32_display_get_clipdrop (gdk_clipboard_get_display (cb));
GdkWin32ClipboardStorePrep *prep;
g_assert (clipdrop->clipboard_hwnd != NULL);
mime_types = gdk_content_formats_get_mime_types (contentformats, &n_mime_types);
pairs = g_array_sized_new (FALSE,

View File

@ -169,13 +169,6 @@ struct _GdkWin32Clipdrop
*/
GAsyncQueue *clipboard_render_queue;
/* Window handle for the clipboard surface that we
* receive from the clipboard thread. We use that
* to wake up the clipboard surface main loop by
* posting a message to it.
*/
HWND clipboard_hwnd;
/* The thread that calls DoDragDrop (), which would
* normally block our main thread, as it runs its own
* Windows message loop.