mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 22:46:15 +01:00
Merge branch 'easy-uwp-patches' into 'master'
Some (probably) easy uwp patches See merge request GNOME/glib!1057
This commit is contained in:
commit
29388470f8
@ -192,9 +192,16 @@ g_on_error_query (const gchar *prg_name)
|
||||
if (!prg_name)
|
||||
prg_name = g_get_prgname ();
|
||||
|
||||
/* MessageBox is allowed on UWP apps only when building against
|
||||
* the debug CRT, which will set -D_DEBUG */
|
||||
#if defined(_DEBUG) || !defined(G_WINAPI_ONLY_APP)
|
||||
MessageBox (NULL, "g_on_error_query called, program terminating",
|
||||
(prg_name && *prg_name) ? prg_name : NULL,
|
||||
MB_OK|MB_ICONERROR);
|
||||
#else
|
||||
printf ("g_on_error_query called, program '%s' terminating\n",
|
||||
(prg_name && *prg_name) ? prg_name : "(null)");
|
||||
#endif
|
||||
_exit(0);
|
||||
#endif
|
||||
}
|
||||
|
@ -1358,7 +1358,9 @@ g_logv (const gchar *log_domain,
|
||||
|
||||
if ((test_level & G_LOG_FLAG_FATAL) && !masquerade_fatal)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
/* MessageBox is allowed on UWP apps only when building against
|
||||
* the debug CRT, which will set -D_DEBUG */
|
||||
#if defined(G_OS_WIN32) && (defined(_DEBUG) || !defined(G_WINAPI_ONLY_APP))
|
||||
if (win32_keep_fatal_message)
|
||||
{
|
||||
gchar *locale_msg = g_locale_from_utf8 (fatal_msg_buf, -1, NULL, NULL, NULL);
|
||||
@ -1366,7 +1368,7 @@ g_logv (const gchar *log_domain,
|
||||
MessageBox (NULL, locale_msg, NULL,
|
||||
MB_ICONERROR|MB_SETFOREGROUND);
|
||||
}
|
||||
#endif /* !G_OS_WIN32 */
|
||||
#endif
|
||||
|
||||
_g_log_abort (!(test_level & G_LOG_FLAG_RECURSION));
|
||||
}
|
||||
@ -2675,7 +2677,9 @@ handled:
|
||||
/* Abort if the message was fatal. */
|
||||
if (log_level & G_LOG_FLAG_FATAL)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
/* MessageBox is allowed on UWP apps only when building against
|
||||
* the debug CRT, which will set -D_DEBUG */
|
||||
#if defined(G_OS_WIN32) && (defined(_DEBUG) || !defined(G_WINAPI_ONLY_APP))
|
||||
if (!g_test_initialized ())
|
||||
{
|
||||
gchar *locale_msg = NULL;
|
||||
|
@ -95,28 +95,6 @@
|
||||
#ifdef G_OS_WIN32
|
||||
# include <direct.h>
|
||||
# include <shlobj.h>
|
||||
/* older SDK (e.g. msvc 5.0) does not have these*/
|
||||
# ifndef CSIDL_MYMUSIC
|
||||
# define CSIDL_MYMUSIC 13
|
||||
# endif
|
||||
# ifndef CSIDL_MYVIDEO
|
||||
# define CSIDL_MYVIDEO 14
|
||||
# endif
|
||||
# ifndef CSIDL_INTERNET_CACHE
|
||||
# define CSIDL_INTERNET_CACHE 32
|
||||
# endif
|
||||
# ifndef CSIDL_COMMON_APPDATA
|
||||
# define CSIDL_COMMON_APPDATA 35
|
||||
# endif
|
||||
# ifndef CSIDL_MYPICTURES
|
||||
# define CSIDL_MYPICTURES 0x27
|
||||
# endif
|
||||
# ifndef CSIDL_COMMON_DOCUMENTS
|
||||
# define CSIDL_COMMON_DOCUMENTS 46
|
||||
# endif
|
||||
# ifndef CSIDL_PROFILE
|
||||
# define CSIDL_PROFILE 40
|
||||
# endif
|
||||
# include <process.h>
|
||||
#endif
|
||||
|
||||
|
@ -39,12 +39,6 @@
|
||||
#include <sys/cygwin.h>
|
||||
#endif
|
||||
|
||||
/* Default family is DESKTOP_APP which is DESKTOP | APP
|
||||
* We want to know when we're only building for apps */
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
#define G_WINAPI_ONLY_APP
|
||||
#endif
|
||||
|
||||
static void
|
||||
set_error (const gchar *format,
|
||||
...)
|
||||
@ -133,8 +127,11 @@ find_in_any_module_using_toolhelp (const gchar *symbol_name)
|
||||
HANDLE snapshot;
|
||||
MODULEENTRY32 me32;
|
||||
|
||||
gpointer p;
|
||||
gpointer p = NULL;
|
||||
|
||||
/* Under UWP, Module32Next and Module32First are not available since we're
|
||||
* not allowed to search in the address space of arbitrary loaded DLLs */
|
||||
#if !defined(G_WINAPI_ONLY_APP)
|
||||
if ((snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPMODULE, 0)) == (HANDLE) -1)
|
||||
return NULL;
|
||||
|
||||
@ -149,6 +146,7 @@ find_in_any_module_using_toolhelp (const gchar *symbol_name)
|
||||
}
|
||||
|
||||
CloseHandle (snapshot);
|
||||
#endif
|
||||
|
||||
return p;
|
||||
}
|
||||
|
17
meson.build
17
meson.build
@ -400,9 +400,22 @@ add_project_arguments(cc.get_supported_arguments(warning_c_args), language: 'c')
|
||||
# improve this.
|
||||
glib_link_flags = cc.get_supported_link_arguments(warning_c_link_args)
|
||||
|
||||
# Windows Support (7+)
|
||||
# Windows SDK requirements and checks
|
||||
if host_system == 'windows'
|
||||
glib_conf.set('_WIN32_WINNT', '0x0601')
|
||||
# Check whether we're building for UWP apps
|
||||
code = '''
|
||||
#include <windows.h>
|
||||
#if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
|
||||
#error "Not building for UWP"
|
||||
#endif'''
|
||||
if cc.compiles(code, name : 'building for UWP')
|
||||
glib_conf.set('G_WINAPI_ONLY_APP', true)
|
||||
# We require Windows 10+ on WinRT
|
||||
glib_conf.set('_WIN32_WINNT', '0x0A00')
|
||||
else
|
||||
# We require Windows 7+ on Win32
|
||||
glib_conf.set('_WIN32_WINNT', '0x0601')
|
||||
endif
|
||||
endif
|
||||
|
||||
functions = [
|
||||
|
Loading…
Reference in New Issue
Block a user