From 28aacf3db47109c6cd0cd686d989e40d64b31e55 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Tue, 20 Aug 2024 16:12:56 +0800 Subject: [PATCH] GDK/Win32: Drop input locale global variables Rename gdkwin32id.c as gdkwin32misc.c. Fold these items into GdkWin32Display, and also fold gdkproperty-win32.c and gdkwin32langnoticiation.[c|h] into gdkwin32misc.c and gdkdisplay-win32.h as appropriate. This way, we get rid of few more global variables, and these items should have been initialized (and registered with the system) when we open a GdkWin32Display anyways. --- gdk/win32/gdkdisplay-win32.c | 16 +- gdk/win32/gdkdisplay-win32.h | 12 +- gdk/win32/gdkevents-win32.c | 9 +- gdk/win32/gdkglobals-win32.c | 3 - gdk/win32/gdkprivate-win32.h | 13 +- gdk/win32/gdkwin32id.c | 87 ------ gdk/win32/gdkwin32langnotification.c | 172 ------------ gdk/win32/gdkwin32langnotification.h | 24 -- .../{gdkproperty-win32.c => gdkwin32misc.c} | 249 +++++++++++++++++- gdk/win32/meson.build | 4 +- 10 files changed, 266 insertions(+), 323 deletions(-) delete mode 100644 gdk/win32/gdkwin32id.c delete mode 100644 gdk/win32/gdkwin32langnotification.c delete mode 100644 gdk/win32/gdkwin32langnotification.h rename gdk/win32/{gdkproperty-win32.c => gdkwin32misc.c} (56%) diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index b8acdf0549..31f12b7f73 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -38,7 +38,6 @@ #include -#include "gdkwin32langnotification.h" #ifdef HAVE_EGL # include #endif @@ -535,7 +534,7 @@ _gdk_win32_display_open (const char *display_name) NULL); _gdk_device_manager->display = _gdk_display; - _gdk_win32_lang_notification_init (); + gdk_win32_display_lang_notification_init (win32_display); _gdk_drag_init (); _gdk_display->clipboard = gdk_win32_clipboard_new (_gdk_display); @@ -689,7 +688,7 @@ gdk_win32_display_finalize (GObject *object) _gdk_win32_display_finalize_cursors (display_win32); _gdk_win32_dnd_exit (); - _gdk_win32_lang_notification_exit (); + gdk_win32_display_lang_notification_exit (display_win32); g_list_store_remove_all (G_LIST_STORE (display_win32->monitors)); g_object_unref (display_win32->monitors); @@ -1175,17 +1174,6 @@ gdk_win32_display_get_monitor_scale_factor (GdkWin32Display *display_win32, return 1; } -static gboolean -gdk_win32_display_get_setting (GdkDisplay *display, - const char *name, - GValue *value) -{ - if (gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS) - return FALSE; - - return _gdk_win32_get_setting (name, value); -} - #ifndef EGL_PLATFORM_ANGLE_ANGLE #define EGL_PLATFORM_ANGLE_ANGLE 0x3202 #endif diff --git a/gdk/win32/gdkdisplay-win32.h b/gdk/win32/gdkdisplay-win32.h index 11ba2ad5e4..8390de2110 100644 --- a/gdk/win32/gdkdisplay-win32.h +++ b/gdk/win32/gdkdisplay-win32.h @@ -26,10 +26,16 @@ #include "gdkglversionprivate.h" +/* Used for active language or text service change notifications */ +#define COBJMACROS +#include + #ifdef HAVE_EGL # include #endif +typedef struct _GdkWin32InputLocaleItems GdkWin32InputLocaleItems; + /* Define values used to set DPI-awareness */ typedef enum _GdkWin32ProcessDpiAwareness { PROCESS_DPI_UNAWARE = 0, @@ -125,11 +131,11 @@ struct _GdkWin32Display HWND hwnd; + GListModel *monitors; + GdkWin32InputLocaleItems *input_locale_items; + /* WGL/OpenGL Items */ GdkWin32GLDummyContextWGL dummy_context_wgl; - - GListModel *monitors; - guint hasWglARBCreateContext : 1; guint hasWglEXTSwapControl : 1; guint hasWglOMLSyncControl : 1; diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 540462980d..6de01b1416 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -1830,18 +1830,19 @@ gdk_event_translate (MSG *msg, { GdkWin32Keymap *win32_keymap; GdkTranslatedKey translated; + HKL input_locale; win32_keymap = GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display)); - _gdk_input_locale = (HKL) msg->lParam; - _gdk_win32_keymap_set_active_layout (win32_keymap, _gdk_input_locale); + input_locale = (HKL) msg->lParam; + gdk_win32_display_set_input_locale (win32_display, input_locale); + _gdk_win32_keymap_set_active_layout (win32_keymap, input_locale); _gdk_keymap_serial++; - GDK_NOTE (EVENTS, g_print (" cs:%lu hkl:%p%s", (gulong) msg->wParam, (gpointer) msg->lParam, - _gdk_input_locale_is_ime ? " (IME)" : "")); + gdk_win32_display_input_locale_is_ime (win32_display) ? " (IME)" : "")); gdk_display_setting_changed (display, "gtk-im-module"); /* Generate a dummy key event to "nudge" IMContext */ diff --git a/gdk/win32/gdkglobals-win32.c b/gdk/win32/gdkglobals-win32.c index 0669d85736..a75653bb9d 100644 --- a/gdk/win32/gdkglobals-win32.c +++ b/gdk/win32/gdkglobals-win32.c @@ -32,9 +32,6 @@ GdkDeviceManagerWin32 *_gdk_device_manager = NULL; int _gdk_input_ignore_core; -HKL _gdk_input_locale; -gboolean _gdk_input_locale_is_ime = FALSE; - GdkWin32ModalOpKind _modal_operation_in_progress = GDK_WIN32_MODAL_OP_NONE; HWND _modal_move_resize_hwnd = NULL; diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index 3ac8cfd031..d4f1b632b2 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -144,8 +144,6 @@ extern int _gdk_input_ignore_core; /* These are thread specific, but GDK/win32 works OK only when invoked * from a single thread anyway. */ -extern HKL _gdk_input_locale; -extern gboolean _gdk_input_locale_is_ime; extern guint _gdk_keymap_serial; @@ -236,8 +234,17 @@ GdkDrag *_gdk_win32_surface_drag_begin (GdkSurface *surface, double x_root, double y_root); +/* miscellaneous items (property setup, language notification) */ +gboolean gdk_win32_display_get_setting (GdkDisplay *display, + const char *name, + GValue *value); +void gdk_win32_display_lang_notification_init (GdkWin32Display *display); +void gdk_win32_display_lang_notification_exit (GdkWin32Display *display); +void gdk_win32_display_set_input_locale (GdkWin32Display *display, + HKL input_locale); +gboolean gdk_win32_display_input_locale_is_ime (GdkWin32Display *display); + /* Stray GdkWin32Screen members */ -gboolean _gdk_win32_get_setting (const char *name, GValue *value); void _gdk_win32_screen_on_displaychange_event (GdkWin32Screen *screen); /* Distributed display manager implementation */ diff --git a/gdk/win32/gdkwin32id.c b/gdk/win32/gdkwin32id.c deleted file mode 100644 index 6eb5871b2c..0000000000 --- a/gdk/win32/gdkwin32id.c +++ /dev/null @@ -1,87 +0,0 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#include "config.h" -#include - -#include "gdkprivate-win32.h" - -static GHashTable *handle_ht = NULL; - -static guint -gdk_handle_hash (HANDLE *handle) -{ -#ifdef _WIN64 - return ((guint *) handle)[0] ^ ((guint *) handle)[1]; -#else - return (guint) *handle; -#endif -} - -static int -gdk_handle_equal (HANDLE *a, - HANDLE *b) -{ - return (*a == *b); -} - -void -gdk_win32_handle_table_insert (HANDLE *handle, - gpointer data) -{ - g_return_if_fail (handle != NULL); - - if (!handle_ht) - handle_ht = g_hash_table_new ((GHashFunc) gdk_handle_hash, - (GEqualFunc) gdk_handle_equal); - - g_hash_table_insert (handle_ht, handle, data); -} - -void -gdk_win32_handle_table_remove (HANDLE handle) -{ - if (!handle_ht) - handle_ht = g_hash_table_new ((GHashFunc) gdk_handle_hash, - (GEqualFunc) gdk_handle_equal); - - g_hash_table_remove (handle_ht, &handle); -} - -gpointer -gdk_win32_handle_table_lookup_ (HWND handle) -{ - gpointer data = NULL; - - if (handle_ht) - data = g_hash_table_lookup (handle_ht, &handle); - - return data; -} - -gpointer -gdk_win32_handle_table_lookup (HWND handle) -{ - return gdk_win32_handle_table_lookup_ (handle); -} diff --git a/gdk/win32/gdkwin32langnotification.c b/gdk/win32/gdkwin32langnotification.c deleted file mode 100644 index 2ea28e824f..0000000000 --- a/gdk/win32/gdkwin32langnotification.c +++ /dev/null @@ -1,172 +0,0 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 2019 Руслан Ижбулатов - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include "config.h" - -#define COBJMACROS -#include - -#include - -#include "gdkprivate-win32.h" - -struct _GdkWin32ALPNSink -{ - ITfActiveLanguageProfileNotifySink itf_alpn_sink; - - int ref_count; -}; - -typedef struct _GdkWin32ALPNSink GdkWin32ALPNSink; - -static GdkWin32ALPNSink *actlangchangenotify = NULL; -static ITfSource *itf_source = NULL; -static DWORD actlangchangenotify_id = 0; - -static ULONG STDMETHODCALLTYPE -alpn_sink_addref (ITfActiveLanguageProfileNotifySink *This) -{ - GdkWin32ALPNSink *alpn_sink = (GdkWin32ALPNSink *) This; - int ref_count = ++alpn_sink->ref_count; - - return ref_count; -} - -static HRESULT STDMETHODCALLTYPE -alpn_sink_queryinterface (ITfActiveLanguageProfileNotifySink *This, - REFIID riid, - LPVOID *ppvObject) -{ - *ppvObject = NULL; - - if (IsEqualGUID (riid, &IID_IUnknown)) - { - ITfActiveLanguageProfileNotifySink_AddRef (This); - *ppvObject = This; - return S_OK; - } - - if (IsEqualGUID (riid, &IID_ITfActiveLanguageProfileNotifySink)) - { - ITfActiveLanguageProfileNotifySink_AddRef (This); - *ppvObject = This; - return S_OK; - } - - return E_NOINTERFACE; -} - -static ULONG STDMETHODCALLTYPE -alpn_sink_release (ITfActiveLanguageProfileNotifySink *This) -{ - GdkWin32ALPNSink *alpn_sink = (GdkWin32ALPNSink *) This; - int ref_count = --alpn_sink->ref_count; - - if (ref_count == 0) - { - g_free (This); - } - - return ref_count; -} - -static HRESULT STDMETHODCALLTYPE -alpn_sink_on_activated (ITfActiveLanguageProfileNotifySink *This, - REFCLSID clsid, - REFGUID guidProfile, - BOOL fActivated) -{ - _gdk_input_locale_is_ime = fActivated; - return S_OK; -} - -static ITfActiveLanguageProfileNotifySinkVtbl alpn_sink_vtbl = { - alpn_sink_queryinterface, - alpn_sink_addref, - alpn_sink_release, - alpn_sink_on_activated, -}; - -static GdkWin32ALPNSink * -alpn_sink_new () -{ - GdkWin32ALPNSink *result; - - result = g_new0 (GdkWin32ALPNSink, 1); - result->itf_alpn_sink.lpVtbl = &alpn_sink_vtbl; - result->ref_count = 0; - - ITfActiveLanguageProfileNotifySink_AddRef (&result->itf_alpn_sink); - - return result; -} - - -void -_gdk_win32_lang_notification_init () -{ - HRESULT hr; - ITfThreadMgr *itf_threadmgr; - - CoInitializeEx (NULL, COINIT_APARTMENTTHREADED); - - if (actlangchangenotify != NULL) - return; - - hr = CoCreateInstance (&CLSID_TF_ThreadMgr, - NULL, - CLSCTX_INPROC_SERVER, - &IID_ITfThreadMgr, - (LPVOID *) &itf_threadmgr); - - if (!SUCCEEDED (hr)) - return; - - hr = ITfThreadMgr_QueryInterface (itf_threadmgr, &IID_ITfSource, (VOID **) &itf_source); - ITfThreadMgr_Release (itf_threadmgr); - - if (!SUCCEEDED (hr)) - return; - - actlangchangenotify = alpn_sink_new (); - - hr = ITfSource_AdviseSink (itf_source, - &IID_ITfActiveLanguageProfileNotifySink, - (IUnknown *) actlangchangenotify, - &actlangchangenotify_id); - - if (!SUCCEEDED (hr)) - { - ITfActiveLanguageProfileNotifySink_Release (&actlangchangenotify->itf_alpn_sink); - actlangchangenotify = NULL; - ITfSource_Release (itf_source); - itf_source = NULL; - } -} - -void -_gdk_win32_lang_notification_exit () -{ - if (actlangchangenotify != NULL && itf_source != NULL) - { - ITfSource_UnadviseSink (itf_source, actlangchangenotify_id); - ITfSource_Release (itf_source); - ITfActiveLanguageProfileNotifySink_Release (&actlangchangenotify->itf_alpn_sink); - } - - CoUninitialize (); -} diff --git a/gdk/win32/gdkwin32langnotification.h b/gdk/win32/gdkwin32langnotification.h deleted file mode 100644 index dbba23e0ee..0000000000 --- a/gdk/win32/gdkwin32langnotification.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * gdkwin32langnotification.h - * - * Copyright 2019 Руслан Ижбулатов - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see . - */ - -#pragma once - -void _gdk_win32_lang_notification_init (void); -void _gdk_win32_lang_notification_exit (void); - diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkwin32misc.c similarity index 56% rename from gdk/win32/gdkproperty-win32.c rename to gdk/win32/gdkwin32misc.c index c92853e70b..021e5c5b78 100644 --- a/gdk/win32/gdkproperty-win32.c +++ b/gdk/win32/gdkwin32misc.c @@ -1,6 +1,5 @@ /* GDK - The GIMP Drawing Kit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * Copyright (C) 1998-2002 Tor Lillqvist * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,15 +23,240 @@ */ #include "config.h" -#include -#include -#include -#include -#include "gdkdisplayprivate.h" #include "gdkprivate-win32.h" #include "gdkdisplay-win32.h" -#include "gdkwin32.h" + +#include + +struct _GdkWin32ALPNSink +{ + ITfActiveLanguageProfileNotifySink itf_alpn_sink; + + int ref_count; + guint input_locale_is_ime : 1; +}; + +typedef struct _GdkWin32ALPNSink GdkWin32ALPNSink; + +struct _GdkWin32InputLocaleItems +{ + /* Input locale items */ + HKL input_locale; + + /* COM objects to receive language or text service change notifcations in GdkWin32 */ + GdkWin32ALPNSink *notification_sink; + ITfSource *itf_source; + DWORD actlangchangenotify_id; +}; + +static GHashTable *handle_ht = NULL; + +static guint +gdk_handle_hash (HANDLE *handle) +{ +#ifdef _WIN64 + return ((guint *) handle)[0] ^ ((guint *) handle)[1]; +#else + return (guint) *handle; +#endif +} + +static int +gdk_handle_equal (HANDLE *a, + HANDLE *b) +{ + return (*a == *b); +} + +void +gdk_win32_handle_table_insert (HANDLE *handle, + gpointer data) +{ + g_return_if_fail (handle != NULL); + + if (!handle_ht) + handle_ht = g_hash_table_new ((GHashFunc) gdk_handle_hash, + (GEqualFunc) gdk_handle_equal); + + g_hash_table_insert (handle_ht, handle, data); +} + +void +gdk_win32_handle_table_remove (HANDLE handle) +{ + if (!handle_ht) + handle_ht = g_hash_table_new ((GHashFunc) gdk_handle_hash, + (GEqualFunc) gdk_handle_equal); + + g_hash_table_remove (handle_ht, &handle); +} + +gpointer +gdk_win32_handle_table_lookup_ (HWND handle) +{ + gpointer data = NULL; + + if (handle_ht) + data = g_hash_table_lookup (handle_ht, &handle); + + return data; +} + +gpointer +gdk_win32_handle_table_lookup (HWND handle) +{ + return gdk_win32_handle_table_lookup_ (handle); +} + +/* set up input language or text service change notification for our GdkDisplay */ + +/* COM implementation for receiving notifications when input language or text service has changed in GDK */ +static ULONG STDMETHODCALLTYPE +alpn_sink_addref (ITfActiveLanguageProfileNotifySink *This) +{ + GdkWin32ALPNSink *alpn_sink = (GdkWin32ALPNSink *) This; + int ref_count = ++alpn_sink->ref_count; + + return ref_count; +} + +static HRESULT STDMETHODCALLTYPE +alpn_sink_queryinterface (ITfActiveLanguageProfileNotifySink *This, + REFIID riid, + LPVOID *ppvObject) +{ + *ppvObject = NULL; + + if (IsEqualGUID (riid, &IID_IUnknown)) + { + ITfActiveLanguageProfileNotifySink_AddRef (This); + *ppvObject = This; + return S_OK; + } + + if (IsEqualGUID (riid, &IID_ITfActiveLanguageProfileNotifySink)) + { + ITfActiveLanguageProfileNotifySink_AddRef (This); + *ppvObject = This; + return S_OK; + } + + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE +alpn_sink_release (ITfActiveLanguageProfileNotifySink *This) +{ + GdkWin32ALPNSink *alpn_sink = (GdkWin32ALPNSink *) This; + int ref_count = --alpn_sink->ref_count; + + if (ref_count == 0) + { + g_free (This); + } + + return ref_count; +} + +static HRESULT STDMETHODCALLTYPE +alpn_sink_on_activated (ITfActiveLanguageProfileNotifySink *This, + REFCLSID clsid, + REFGUID guidProfile, + BOOL fActivated) +{ + GdkWin32ALPNSink *alpn_sink = (GdkWin32ALPNSink *) This; + + alpn_sink->input_locale_is_ime = fActivated; + return S_OK; +} + +static const ITfActiveLanguageProfileNotifySinkVtbl alpn_sink_vtbl = { + alpn_sink_queryinterface, + alpn_sink_addref, + alpn_sink_release, + alpn_sink_on_activated, +}; + +void +gdk_win32_display_lang_notification_init (GdkWin32Display *display) +{ + HRESULT hr; + ITfThreadMgr *itf_threadmgr; + + if (display->input_locale_items == NULL) + display->input_locale_items = g_new0 (GdkWin32InputLocaleItems, 1); + + CoInitializeEx (NULL, COINIT_APARTMENTTHREADED); + + if (display->input_locale_items->notification_sink != NULL) + return; + + hr = CoCreateInstance (&CLSID_TF_ThreadMgr, + NULL, + CLSCTX_INPROC_SERVER, + &IID_ITfThreadMgr, + (LPVOID *) &itf_threadmgr); + + if (!SUCCEEDED (hr)) + return; + + hr = ITfThreadMgr_QueryInterface (itf_threadmgr, &IID_ITfSource, (VOID **) &display->input_locale_items->itf_source); + ITfThreadMgr_Release (itf_threadmgr); + + if (!SUCCEEDED (hr)) + return; + + display->input_locale_items->notification_sink = g_new0 (GdkWin32ALPNSink, 1); + display->input_locale_items->notification_sink->itf_alpn_sink.lpVtbl = &alpn_sink_vtbl; + display->input_locale_items->notification_sink->ref_count = 0; + ITfActiveLanguageProfileNotifySink_AddRef (&display->input_locale_items->notification_sink->itf_alpn_sink); + + hr = ITfSource_AdviseSink (display->input_locale_items->itf_source, + &IID_ITfActiveLanguageProfileNotifySink, + (IUnknown *) display->input_locale_items->notification_sink, + &display->input_locale_items->actlangchangenotify_id); + + if (!SUCCEEDED (hr)) + { + ITfActiveLanguageProfileNotifySink_Release (&display->input_locale_items->notification_sink->itf_alpn_sink); + display->input_locale_items->notification_sink = NULL; + ITfSource_Release (display->input_locale_items->itf_source); + display->input_locale_items->itf_source = NULL; + } +} + +void +gdk_win32_display_lang_notification_exit (GdkWin32Display *display) +{ + if (display->input_locale_items->notification_sink != NULL && display->input_locale_items->itf_source != NULL) + { + ITfSource_UnadviseSink (display->input_locale_items->itf_source, display->input_locale_items->actlangchangenotify_id); + ITfSource_Release (display->input_locale_items->itf_source); + ITfActiveLanguageProfileNotifySink_Release (&display->input_locale_items->notification_sink->itf_alpn_sink); + } + + CoUninitialize (); + + g_free (display->input_locale_items->notification_sink); + g_free (display->input_locale_items); +} + +void +gdk_win32_display_set_input_locale (GdkWin32Display *display, + HKL input_locale) +{ + g_return_if_fail (GDK_IS_WIN32_DISPLAY (display)); + display->input_locale_items->input_locale = input_locale; +} + +gboolean +gdk_win32_display_input_locale_is_ime (GdkWin32Display *display) +{ + g_return_val_if_fail (GDK_IS_WIN32_DISPLAY (display), FALSE); + + return display->input_locale_items->notification_sink->input_locale_is_ime; +} static char * _get_system_font_name (HDC hdc) @@ -61,9 +285,13 @@ _get_system_font_name (HDC hdc) } gboolean -_gdk_win32_get_setting (const char *name, - GValue *value) +gdk_win32_display_get_setting (GdkDisplay *display, + const char *name, + GValue *value) { + if (gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS) + return FALSE; + if (strcmp ("gtk-alternative-button-order", name) == 0) { GDK_NOTE(MISC, g_print("gdk_display_get_setting(\"%s\") : TRUE\n", name)); @@ -145,7 +373,7 @@ _gdk_win32_get_setting (const char *name, } else if (strcmp ("gtk-im-module", name) == 0) { - const char *im_module = _gdk_input_locale_is_ime ? "ime" : ""; + const char *im_module = GDK_WIN32_DISPLAY (display)->input_locale_items->notification_sink->input_locale_is_ime ? "ime" : ""; GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %s\n", name, im_module)); g_value_set_static_string (value, im_module); return TRUE; @@ -258,3 +486,4 @@ _gdk_win32_get_setting (const char *name, return FALSE; } + diff --git a/gdk/win32/meson.build b/gdk/win32/meson.build index cc56a15d95..7161f7cffc 100644 --- a/gdk/win32/meson.build +++ b/gdk/win32/meson.build @@ -5,7 +5,7 @@ gdk_win32_public_sources = files([ 'gdkdrag-win32.c', 'gdkglcontext-win32.c', 'gdkglcontext-win32-wgl.c', - 'gdkwin32id.c', + 'gdkwin32misc.c', 'gdksurface-win32.c', 'gdkevents-win32.c', 'gdkmonitor-win32.c', @@ -30,9 +30,7 @@ gdk_win32_sources = gdk_win32_public_sources + files([ 'gdkkeys-win32.c', 'gdkkeys-win32-impl.c', 'gdkkeys-win32-impl-wow64.c', - 'gdkwin32langnotification.c', 'gdkmain-win32.c', - 'gdkproperty-win32.c', 'gdkvulkancontext-win32.c', 'gdkwin32cursor.h', 'gdkwin32display.h',