From 6af853c7a0e2f0c7eb9a7a69c46f76b15054eda1 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 25 Oct 2024 07:39:43 +0200 Subject: [PATCH] win32: Some trivial cleanups * Make a function static * Don't lookup function that exists since Windows XP --- gdk/win32/gdkclipboard-win32.c | 4 ++-- gdk/win32/gdkclipdrop-win32.c | 25 ++++++++++--------------- gdk/win32/gdkclipdrop-win32.h | 14 -------------- 3 files changed, 12 insertions(+), 31 deletions(-) diff --git a/gdk/win32/gdkclipboard-win32.c b/gdk/win32/gdkclipboard-win32.c index 196bf7b58e..c66f58642f 100644 --- a/gdk/win32/gdkclipboard-win32.c +++ b/gdk/win32/gdkclipboard-win32.c @@ -67,7 +67,7 @@ gdk_win32_clipboard_request_contentformats (GdkWin32Clipboard *cb) DWORD error_code; SetLastError (0); - success = clipdrop->GetUpdatedClipboardFormats (NULL, 0, &w32_formats_allocated); + success = GetUpdatedClipboardFormats (NULL, 0, &w32_formats_allocated); error_code = GetLastError (); if (!success && error_code != ERROR_INSUFFICIENT_BUFFER) @@ -79,7 +79,7 @@ gdk_win32_clipboard_request_contentformats (GdkWin32Clipboard *cb) w32_formats = g_new0 (UINT, w32_formats_allocated); SetLastError (0); - success = clipdrop->GetUpdatedClipboardFormats (w32_formats, w32_formats_allocated, &w32_formats_len); + success = GetUpdatedClipboardFormats (w32_formats, w32_formats_allocated, &w32_formats_len); error_code = GetLastError (); if (!success) diff --git a/gdk/win32/gdkclipdrop-win32.c b/gdk/win32/gdkclipdrop-win32.c index cf558498de..4f4f88960d 100644 --- a/gdk/win32/gdkclipdrop-win32.c +++ b/gdk/win32/gdkclipdrop-win32.c @@ -1107,9 +1107,9 @@ discard_render (GdkWin32ClipboardThreadRender *render, static LRESULT inner_clipboard_hwnd_procedure (HWND hwnd, - UINT message, - WPARAM wparam, - LPARAM lparam) + UINT message, + WPARAM wparam, + LPARAM lparam) { GdkWin32Clipdrop *clipdrop = NULL; @@ -1383,11 +1383,11 @@ inner_clipboard_hwnd_procedure (HWND hwnd, } } -LRESULT CALLBACK -_clipboard_hwnd_procedure (HWND hwnd, - UINT message, - WPARAM wparam, - LPARAM lparam) +static LRESULT CALLBACK +clipboard_hwnd_procedure (HWND hwnd, + UINT message, + WPARAM wparam, + LPARAM lparam) { LRESULT retval; @@ -1410,7 +1410,7 @@ register_clipboard_notification (GdkWin32Clipdrop *clipdrop) ATOM klass; wclass.lpszClassName = L"GdkClipboardNotification"; - wclass.lpfnWndProc = _clipboard_hwnd_procedure; + wclass.lpfnWndProc = clipboard_hwnd_procedure; wclass.hInstance = this_module (); wclass.cbWndExtra = sizeof (GdkWin32ClipboardThread *); @@ -1520,14 +1520,9 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) int i; GArray *comp; GdkWin32ContentFormatPair fmt; - HMODULE user32; - + win32_clipdrop->thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP"); - user32 = LoadLibrary (L"user32.dll"); - win32_clipdrop->GetUpdatedClipboardFormats = (GetUpdatedClipboardFormatsFunc) GetProcAddress (user32, "GetUpdatedClipboardFormats"); - FreeLibrary (user32); - atoms = g_array_sized_new (FALSE, TRUE, sizeof (const char *), GDK_WIN32_ATOM_INDEX_LAST); g_array_set_size (atoms, GDK_WIN32_ATOM_INDEX_LAST); cfs = g_array_sized_new (FALSE, TRUE, sizeof (UINT), GDK_WIN32_CF_INDEX_LAST); diff --git a/gdk/win32/gdkclipdrop-win32.h b/gdk/win32/gdkclipdrop-win32.h index a779cd7062..90b406db61 100644 --- a/gdk/win32/gdkclipdrop-win32.h +++ b/gdk/win32/gdkclipdrop-win32.h @@ -113,12 +113,6 @@ typedef enum _GdkWin32CFIndex GdkWin32CFIndex; typedef struct _GdkWin32Clipdrop GdkWin32Clipdrop; typedef struct _GdkWin32ClipdropClass GdkWin32ClipdropClass; -typedef BOOL (WINAPI * GetUpdatedClipboardFormatsFunc)( - _Out_ PUINT lpuiFormats, - _In_ UINT cFormats, - _Out_ PUINT pcFormatsOut -); - /* This object is just a sink to hold all the clipboard- and dnd-related data * that otherwise would be in global variables. */ @@ -147,14 +141,6 @@ struct _GdkWin32Clipdrop /* A format-keyed hash table of GArrays of GdkAtoms describing compatibility contentformats for a w32format */ GHashTable *compatibility_contentformats; - /* By all rights we should be able to just use this function - * normally, as our target platform is Vista-or-later. - * This pointer is manually retrieved only to allow - * GTK to be compiled with old MinGW versions, which - * don't have GetUpdatedClipboardFormats in the import libs. - */ - GetUpdatedClipboardFormatsFunc GetUpdatedClipboardFormats; - /* The thread that tries to open the clipboard and then * do stuff with it. Since clipboard opening can * fail, we split the code into a thread, and let