win32: Some trivial cleanups

* Make a function static

* Don't lookup function that exists since Windows XP
This commit is contained in:
Benjamin Otte
2024-10-25 07:39:43 +02:00
parent 97254aaa33
commit 557130efa1
3 changed files with 12 additions and 31 deletions

View File

@@ -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)

View File

@@ -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);

View File

@@ -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