Windows: Build with UNICODE

Build with UNICODE (and _UNICODE) defined when targeting Windows.
This commit is contained in:
Luca Bacci 2024-05-06 14:27:33 +02:00
parent 59a00d6768
commit 7f9363d471
17 changed files with 122 additions and 96 deletions

View File

@ -1408,7 +1408,7 @@ register_clipboard_notification ()
WNDCLASS wclass = { 0, };
ATOM klass;
wclass.lpszClassName = "GdkClipboardNotification";
wclass.lpszClassName = L"GdkClipboardNotification";
wclass.lpfnWndProc = _clipboard_window_procedure;
wclass.hInstance = this_module ();
wclass.cbWndExtra = sizeof (GdkWin32ClipboardThread *);
@ -1506,9 +1506,9 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
GdkWin32ContentFormatPair fmt;
HMODULE user32;
thread_wakeup_message = RegisterWindowMessage ("GDK_WORKER_THREAD_WEAKEUP");
thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP");
user32 = LoadLibrary ("user32.dll");
user32 = LoadLibrary (L"user32.dll");
win32_clipdrop->GetUpdatedClipboardFormats = (GetUpdatedClipboardFormatsFunc) GetProcAddress (user32, "GetUpdatedClipboardFormats");
FreeLibrary (user32);
@ -1557,21 +1557,21 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
* the lead and map the GDK contentformat "image/png" to the clipboard
* format name "PNG" etc.
*/
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG) = RegisterClipboardFormatA ("PNG");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF) = RegisterClipboardFormatA ("JFIF");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF) = RegisterClipboardFormatA ("GIF");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG) = RegisterClipboardFormat (L"PNG");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF) = RegisterClipboardFormat (L"JFIF");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF) = RegisterClipboardFormat (L"GIF");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_UNIFORMRESOURCELOCATORW) = RegisterClipboardFormatA ("UniformResourceLocatorW");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_CFSTR_SHELLIDLIST) = RegisterClipboardFormatA (CFSTR_SHELLIDLIST);
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_HTML_FORMAT) = RegisterClipboardFormatA ("HTML Format");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_HTML) = RegisterClipboardFormatA ("text/html");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_UNIFORMRESOURCELOCATORW) = RegisterClipboardFormat (L"UniformResourceLocatorW");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_CFSTR_SHELLIDLIST) = RegisterClipboardFormat (CFSTR_SHELLIDLIST);
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_HTML_FORMAT) = RegisterClipboardFormat (L"HTML Format");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_HTML) = RegisterClipboardFormat (L"text/html");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_PNG) = RegisterClipboardFormatA ("image/png");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_JPEG) = RegisterClipboardFormatA ("image/jpeg");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_BMP) = RegisterClipboardFormatA ("image/bmp");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_GIF) = RegisterClipboardFormatA ("image/gif");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_URI_LIST) = RegisterClipboardFormatA ("text/uri-list");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_PLAIN_UTF8) = RegisterClipboardFormatA ("text/plain;charset=utf-8");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_PNG) = RegisterClipboardFormat (L"image/png");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_JPEG) = RegisterClipboardFormat (L"image/jpeg");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_BMP) = RegisterClipboardFormat (L"image/bmp");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_IMAGE_GIF) = RegisterClipboardFormat (L"image/gif");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_URI_LIST) = RegisterClipboardFormat (L"text/uri-list");
_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_TEXT_PLAIN_UTF8) = RegisterClipboardFormat (L"text/plain;charset=utf-8");
win32_clipdrop->active_source_drags = g_hash_table_new_full (NULL, NULL, (GDestroyNotify) g_object_unref, NULL);
@ -2364,9 +2364,9 @@ transmute_cf_dib_to_image_bmp (const guchar *data,
* check?
*/
(IsClipboardFormatAvailable
(RegisterClipboardFormatA ("application/x-moz-nativeimage")) ||
(RegisterClipboardFormat (L"application/x-moz-nativeimage")) ||
IsClipboardFormatAvailable
(RegisterClipboardFormatA ("UniformResourceLocatorW"))) &&
(RegisterClipboardFormat (L"UniformResourceLocatorW"))) &&
#endif
TRUE)
{

View File

@ -31,7 +31,7 @@
static struct {
char *name;
char *id;
const wchar_t *id;
} default_cursors[] = {
/* -- Win32 cursor names: -- */
{ "appstarting", IDC_APPSTARTING },
@ -457,32 +457,32 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
break;
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL:
result = gdk_win32_hcursor_new (display,
LoadImageA (NULL,
(const char *) cursor->resource_name,
IMAGE_CURSOR,
cursor->width,
cursor->height,
cursor->load_flags),
LoadImage (NULL,
cursor->resource_name,
IMAGE_CURSOR,
cursor->width,
cursor->height,
cursor->load_flags),
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
break;
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_THIS:
result = gdk_win32_hcursor_new (display,
LoadImageA (GetModuleHandle (NULL),
(const char *) cursor->resource_name,
IMAGE_CURSOR,
cursor->width,
cursor->height,
cursor->load_flags),
LoadImage (GetModuleHandle (NULL),
cursor->resource_name,
IMAGE_CURSOR,
cursor->width,
cursor->height,
cursor->load_flags),
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
break;
case GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_GTK:
result = gdk_win32_hcursor_new (display,
LoadImageA (this_module (),
(const char *) cursor->resource_name,
IMAGE_CURSOR,
cursor->width,
cursor->height,
cursor->load_flags),
LoadImage (this_module (),
cursor->resource_name,
IMAGE_CURSOR,
cursor->width,
cursor->height,
cursor->load_flags),
cursor->load_flags & LR_SHARED ? FALSE : TRUE);
break;
case GDK_WIN32_CURSOR_CREATE:
@ -499,12 +499,12 @@ win32_cursor_create_win32hcursor (GdkWin32Display *display,
}
static Win32Cursor *
win32_cursor_new (GdkWin32CursorLoadType load_type,
gpointer resource_name,
int width,
int height,
guint load_flags,
int xcursor_number)
win32_cursor_new (GdkWin32CursorLoadType load_type,
wchar_t *resource_name,
int width,
int height,
guint load_flags,
int xcursor_number)
{
Win32Cursor *result;
@ -632,9 +632,9 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
/* Prefer W32 cursors */
if (cursors[i].builtin)
shared_hcursor = LoadImageA (NULL, cursors[i].builtin, IMAGE_CURSOR,
size, size,
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
shared_hcursor = LoadImage (NULL, cursors[i].builtin, IMAGE_CURSOR,
size, size,
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
/* Fall back to X cursors, but only if we've got no theme cursor */
if (shared_hcursor == NULL && g_hash_table_lookup (theme->named_cursors, cursors[i].name) == NULL)
@ -646,7 +646,7 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
DestroyCursor (x_hcursor);
cursor = win32_cursor_new (shared_hcursor ? GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL : GDK_WIN32_CURSOR_CREATE,
(gpointer) cursors[i].builtin,
(wchar_t*) cursors[i].builtin,
size,
size,
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
@ -661,14 +661,14 @@ win32_cursor_theme_load_system (Win32CursorTheme *theme,
if (default_cursors[i].name == NULL)
break;
shared_hcursor = LoadImageA (NULL, default_cursors[i].id, IMAGE_CURSOR, size, size,
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
shared_hcursor = LoadImage (NULL, default_cursors[i].id, IMAGE_CURSOR, size, size,
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0));
if (shared_hcursor == NULL)
continue;
cursor = win32_cursor_new (GDK_WIN32_CURSOR_LOAD_FROM_RESOURCE_NULL,
(gpointer) default_cursors[i].id,
(wchar_t*) default_cursors[i].id,
size,
size,
LR_SHARED | (size == 0 ? LR_DEFAULTSIZE : 0),
@ -780,8 +780,8 @@ win32hcursor_idc_from_name (GdkWin32Display *display,
continue;
return gdk_win32_hcursor_new (display,
LoadImageA (NULL, default_cursors[i].id, IMAGE_CURSOR, 0, 0,
LR_SHARED | LR_DEFAULTSIZE),
LoadImage (NULL, default_cursors[i].id, IMAGE_CURSOR, 0, 0,
LR_SHARED | LR_DEFAULTSIZE),
FALSE);
}
@ -885,7 +885,7 @@ gdk_win32hcursor_create_for_name (GdkWin32Display *display,
/* Allow to load named cursor resources linked into the executable.
* Cursors obtained with LoadCursor() cannot be destroyed.
*/
return gdk_win32_hcursor_new (display, LoadCursor (hinstance, name), FALSE);
return gdk_win32_hcursor_new (display, LoadCursorA (hinstance, name), FALSE);
}
static HICON

View File

@ -121,7 +121,7 @@ gdk_device_manager_win32_finalize (GObject *object)
#if DEBUG_WINTAB
static void
print_lc(LOGCONTEXT *lc)
print_lc(LOGCONTEXTA *lc)
{
g_print ("lcName = %s\n", lc->lcName);
g_print ("lcOptions =");
@ -374,13 +374,13 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
wintab_contexts = NULL;
n = GetSystemDirectory (&dummy, 0);
n = GetSystemDirectoryA (&dummy, 0);
if (n <= 0)
return;
wintab32_dll_path = g_malloc (n + 1 + strlen (WINTAB32_DLL));
k = GetSystemDirectory (wintab32_dll_path, n);
k = GetSystemDirectoryA (wintab32_dll_path, n);
if (k == 0 || k > n)
{
@ -392,7 +392,7 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
strcat (wintab32_dll_path, G_DIR_SEPARATOR_S);
strcat (wintab32_dll_path, WINTAB32_DLL);
if ((wintab32 = LoadLibrary (wintab32_dll_path)) == NULL)
if ((wintab32 = LoadLibraryA (wintab32_dll_path)) == NULL)
return;
if ((p_WTInfoA = (t_WTInfoA) GetProcAddress (wintab32, "WTInfoA")) == NULL)
@ -433,7 +433,7 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
for (devix = 0; devix < ndevices; devix++)
{
LOGCONTEXT lc;
LOGCONTEXTA lc;
/* We open the Wintab device (hmm, what if there are several, or
* can there even be several, probably not?) as a system

View File

@ -480,7 +480,7 @@ register_display_change_notification (GdkDisplay *display)
WNDCLASS wclass = { 0, };
ATOM klass;
wclass.lpszClassName = "GdkDisplayChange";
wclass.lpszClassName = L"GdkDisplayChange";
wclass.lpfnWndProc = display_change_window_procedure;
wclass.hInstance = this_module ();
wclass.style = CS_OWNDC;
@ -606,7 +606,7 @@ gdk_win32_display_get_name (GdkDisplay *display)
window_station_name = "WinSta0";
}
processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle ("kernel32.dll"), "ProcessIdToSessionId");
processIdToSessionId = (PFN_ProcessIdToSessionId) GetProcAddress (GetModuleHandle (L"kernel32.dll"), "ProcessIdToSessionId");
if (!processIdToSessionId || !processIdToSessionId (GetCurrentProcessId (), &session_id))
session_id = 0;

View File

@ -658,7 +658,7 @@ _gdk_win32_dnd_thread_main (gpointer data)
/* Create a message queue */
PeekMessage (&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
thread_wakeup_message = RegisterWindowMessage ("GDK_WORKER_THREAD_WEAKEUP");
thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP");
/* Signal the main thread that we're ready.
* This is the only time the queue works in reverse.

View File

@ -419,7 +419,7 @@ set_up_low_level_keyboard_hook (void)
else
WIN32_API_FAILED ("SetWindowsHookEx");
aerosnap_message = RegisterWindowMessage ("GDK_WIN32_AEROSNAP_MESSAGE");
aerosnap_message = RegisterWindowMessage (L"GDK_WIN32_AEROSNAP_MESSAGE");
}
void
@ -470,7 +470,7 @@ _gdk_events_init (GdkDisplay *display)
};
#endif
got_gdk_events_message = RegisterWindowMessage ("GDK_WIN32_GOT_EVENTS");
got_gdk_events_message = RegisterWindowMessage (L"GDK_WIN32_GOT_EVENTS");
#if 0
/* Check if we have some input locale identifier loaded that uses a
@ -1685,7 +1685,7 @@ _gdk_win32_surface_fill_min_max_info (GdkSurface *window,
nearest_monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
nearest_info.cbSize = sizeof (nearest_info);
if (GetMonitorInfoA (nearest_monitor, &nearest_info))
if (GetMonitorInfo (nearest_monitor, &nearest_info))
{
/* MSDN says that we must specify maximized window
* size as if it was located on the primary monitor.

View File

@ -269,7 +269,7 @@ create_dummy_gl_window (void)
ATOM klass;
HWND hwnd = NULL;
wclass.lpszClassName = "GdkGLDummyWindow";
wclass.lpszClassName = L"GdkGLDummyWindow";
wclass.lpfnWndProc = DefWindowProc;
wclass.hInstance = this_module ();
wclass.style = CS_OWNDC;

View File

@ -730,7 +730,7 @@ _gdk_win32_key_to_string (LONG lParam)
char buf[100];
char *keyname_utf8;
if (GetKeyNameText (lParam, buf, sizeof (buf)) &&
if (GetKeyNameTextA (lParam, buf, sizeof (buf)) &&
(keyname_utf8 = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL)) != NULL)
{
char *retval = static_printf ("%s", keyname_utf8);
@ -780,7 +780,7 @@ _gdk_win32_cf_to_string (UINT format)
if (format >= CF_PRIVATEFIRST &&
format <= CF_PRIVATELAST)
return static_printf ("CF_PRIVATE%d", format - CF_PRIVATEFIRST);
if (GetClipboardFormatName (format, buf, sizeof (buf)))
if (GetClipboardFormatNameA (format, buf, sizeof (buf)))
return static_printf ("'%s'", buf);
else
return static_printf ("unk-%#lx", format);

View File

@ -197,7 +197,7 @@ typedef struct _Win32Cursor Win32Cursor;
struct _Win32Cursor {
GdkWin32CursorLoadType load_type;
gunichar2 *resource_name;
wchar_t *resource_name;
int width;
int height;
guint load_flags;

View File

@ -326,7 +326,7 @@ RegisterGdkClass (GType wtype)
static WNDCLASSEXW wcl;
ATOM klass = 0;
wcl.cbSize = sizeof (WNDCLASSEX);
wcl.cbSize = sizeof (WNDCLASSEXW);
wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw
* on WM_SIZE and WM_MOVE. Flicker, Performance!
*/
@ -340,7 +340,7 @@ RegisterGdkClass (GType wtype)
/* initialize once! */
if (0 == hAppIcon && 0 == hAppIconSm)
{
char sLoc [MAX_PATH+1];
wchar_t sLoc [MAX_PATH+1];
// try to load first icon of executable program
if (0 != GetModuleFileName (NULL, sLoc, MAX_PATH))
@ -2064,7 +2064,7 @@ stash_window (GdkSurface *window,
hmonitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
hmonitor_info.cbSize = sizeof (hmonitor_info);
if (!GetMonitorInfoA (hmonitor, &hmonitor_info))
if (!GetMonitorInfo (hmonitor, &hmonitor_info))
return;
if (impl->snap_stash == NULL)

View File

@ -1,4 +1,4 @@
static const struct { const char *name; const char *builtin; int type; guchar width; guchar height; guchar hotx; guchar hoty; char *data; } cursors[] = {
static const struct { const char *name; const wchar_t *builtin; int type; guchar width; guchar height; guchar hotx; guchar hoty; char *data; } cursors[] = {
{ "X_cursor", NULL, 0, 16, 16, 7, 7,
"\125\000\000\125\152\100\001\251\152\220\006\251\152\244\032\251"
"\032\251\152\244\006\252\252\220\001\252\252\100\000\152\251\000"

View File

@ -726,7 +726,7 @@ gtk_im_context_ime_set_preedit_font (GtkIMContext *context)
gunichar wc;
PangoContext *pango_context;
PangoFont *font;
LOGFONT *logfont;
LOGFONTA *logfont;
PangoFontDescription *font_desc;
GtkCssStyle *style;
@ -818,7 +818,7 @@ gtk_im_context_ime_set_preedit_font (GtkIMContext *context)
logfont = pango_win32_font_logfont (font);
if (logfont)
ImmSetCompositionFont (himc, logfont);
ImmSetCompositionFontA (himc, logfont);
g_object_unref (font);

View File

@ -278,7 +278,7 @@ static char *script_to_check = NULL;
static gboolean setlocale_called = FALSE;
static BOOL CALLBACK
enum_locale_proc (LPTSTR locale)
enum_locale_proc (LPSTR locale)
{
LCID lcid;
char iso639[10];
@ -288,8 +288,8 @@ enum_locale_proc (LPTSTR locale)
lcid = strtoul (locale, &endptr, 16);
if (*endptr == '\0' &&
GetLocaleInfo (lcid, LOCALE_SISO639LANGNAME, iso639, sizeof (iso639)) &&
GetLocaleInfo (lcid, LOCALE_SISO3166CTRYNAME, iso3166, sizeof (iso3166)))
GetLocaleInfoA (lcid, LOCALE_SISO639LANGNAME, iso639, sizeof (iso639)) &&
GetLocaleInfoA (lcid, LOCALE_SISO3166CTRYNAME, iso3166, sizeof (iso3166)))
{
if (strcmp (iso639, iso639_to_check) == 0 &&
((iso3166_to_check != NULL &&
@ -342,8 +342,8 @@ enum_locale_proc (LPTSTR locale)
SetThreadLocale (lcid);
if (GetLocaleInfo (lcid, LOCALE_SENGLANGUAGE, language, sizeof (language)) &&
GetLocaleInfo (lcid, LOCALE_SENGCOUNTRY, country, sizeof (country)))
if (GetLocaleInfoA (lcid, LOCALE_SENGLANGUAGE, language, sizeof (language)) &&
GetLocaleInfoA (lcid, LOCALE_SENGCOUNTRY, country, sizeof (country)))
{
char str[300];
@ -425,7 +425,7 @@ setlocale_initialization (void)
iso3166_to_check = (char *) "SP";
}
EnumSystemLocales (enum_locale_proc, LCID_SUPPORTED);
EnumSystemLocalesA (enum_locale_proc, LCID_SUPPORTED);
}
g_free (p);
}

View File

@ -121,10 +121,6 @@ guint gtk_get_portal_interface_version (GDBusConnection *connection,
#define PORTAL_SCREENSHOT_INTERFACE "org.freedesktop.portal.Screenshot"
#define PORTAL_INHIBIT_INTERFACE "org.freedesktop.portal.Inhibit"
#ifdef G_OS_WIN32
void _gtk_load_dll_with_libgtk3_manifest (const char *dllname);
#endif
void gtk_set_display_debug_flags (GdkDisplay *display,
GtkDebugFlags flags);
GtkDebugFlags gtk_get_display_debug_flags (GdkDisplay *display);
@ -161,5 +157,13 @@ void gtk_synthesize_crossing_events (GtkRoot *toplevel,
GdkCrossingMode mode,
GdkDrop *drop);
#ifdef G_OS_WIN32
void _gtk_load_dll_with_libgtk3_manifest (const wchar_t *dllname);
wchar_t * g_wcsdup (const wchar_t *wcs);
#endif /* G_OS_WIN32 */
G_END_DECLS

View File

@ -48,18 +48,18 @@ this_module (void)
static BOOL CALLBACK
find_first_manifest (HMODULE module_handle,
LPCSTR resource_type,
LPSTR resource_name,
LPCWSTR resource_type,
LPWSTR resource_name,
LONG_PTR user_data)
{
LPSTR *result_name = (LPSTR *) user_data;
LPWSTR *result_name = (LPWSTR *) user_data;
if (resource_type == RT_MANIFEST)
{
if (IS_INTRESOURCE (resource_name))
*result_name = resource_name;
else
*result_name = g_strdup (resource_name);
*result_name = g_wcsdup (resource_name);
return FALSE;
}
return TRUE;
@ -82,12 +82,12 @@ find_first_manifest (HMODULE module_handle,
* g_once_init_enter (leaking once is OK, Windows will clean up after us).
*/
void
_gtk_load_dll_with_libgtk3_manifest (const char *dll_name)
_gtk_load_dll_with_libgtk3_manifest (const wchar_t *dll_name)
{
HANDLE activation_ctx_handle;
ACTCTXA activation_ctx_descriptor;
ACTCTX activation_ctx_descriptor;
ULONG_PTR activation_cookie;
LPSTR resource_name;
LPWSTR resource_name;
BOOL activated;
DWORD error_code;
@ -96,7 +96,7 @@ _gtk_load_dll_with_libgtk3_manifest (const char *dll_name)
(LONG_PTR) &resource_name);
if (resource_name == NULL)
resource_name = MAKEINTRESOURCEA (EMPIRIC_MANIFEST_RESOURCE_INDEX);
resource_name = MAKEINTRESOURCE (EMPIRIC_MANIFEST_RESOURCE_INDEX);
memset (&activation_ctx_descriptor, 0, sizeof (activation_ctx_descriptor));
activation_ctx_descriptor.cbSize = sizeof (activation_ctx_descriptor);
@ -120,7 +120,7 @@ _gtk_load_dll_with_libgtk3_manifest (const char *dll_name)
if (!activated)
g_warning ("Failed to ActivateActCtx: %lu", GetLastError ());
LoadLibraryA (dll_name);
LoadLibrary (dll_name);
if (activated && !DeactivateActCtx (0, activation_cookie))
g_warning ("Failed to DeactivateActCtx: %lu", GetLastError ());
@ -219,3 +219,20 @@ _gtk_get_data_prefix (void)
return gtk_data_prefix;
}
wchar_t *
g_wcsdup (const wchar_t *wcs)
{
wchar_t *new_wcs = NULL;
gsize length;
if G_LIKELY (wcs)
{
length = wcslen (wcs) + 1;
new_wcs = g_new (wchar_t, length);
wcscpy (new_wcs, wcs);
new_wcs[length - 1] = L'\0';
}
return new_wcs;
}

View File

@ -1730,7 +1730,7 @@ gtk_print_operation_run_with_dialog (GtkPrintOperation *op,
if (!initialized)
g_warning ("Failed to InitCommonControlsEx: %lu", GetLastError ());
_gtk_load_dll_with_libgtk3_manifest ("comdlg32.dll");
_gtk_load_dll_with_libgtk3_manifest (L"comdlg32.dll");
g_once_init_leave (&common_controls_initialized, initialized ? 1 : 0);
}
@ -1816,7 +1816,7 @@ gtk_print_operation_run_with_dialog (GtkPrintOperation *op,
callback = print_callback_new ();
printdlgex->lpCallback = (IUnknown *)callback;
got_gdk_events_message = RegisterWindowMessage ("GDK_WIN32_GOT_EVENTS");
got_gdk_events_message = RegisterWindowMessage (L"GDK_WIN32_GOT_EVENTS");
hResult = PrintDlgExW (printdlgex);
IUnknown_Release ((IUnknown *)callback);
@ -2159,7 +2159,7 @@ gtk_print_run_page_setup_dialog (GtkWindow *parent,
pagesetupdlg->Flags |= PSD_ENABLEPAGESETUPHOOK;
pagesetupdlg->lpfnPageSetupHook = run_mainloop_hook;
got_gdk_events_message = RegisterWindowMessage ("GDK_WIN32_GOT_EVENTS");
got_gdk_events_message = RegisterWindowMessage (L"GDK_WIN32_GOT_EVENTS");
res = PageSetupDlgW (pagesetupdlg);
gdk_win32_set_modal_dialog_libgtk_only (NULL);

View File

@ -59,6 +59,11 @@ add_project_arguments('-DGTK_VERSION="@0@"'.format(meson.project_version()), lan
add_project_arguments('-D_GNU_SOURCE', language: 'c')
if host_machine.system() == 'windows'
add_project_arguments(['-DUNICODE',
'-D_UNICODE'], language: 'c')
endif
# Use debug/optimization flags to determine whether to enable debug or disable
# cast checks
gtk_debug_cflags = []