mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 22:41:43 +00:00
Merge branch 'matthiasc/for-main' into 'main'
gdk: Improve logging for backends Closes #5704 See merge request GNOME/gtk!5737
This commit is contained in:
commit
db9883584d
@ -60,7 +60,11 @@ GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display);
|
|||||||
void gdk_display_set_debug_flags (GdkDisplay *display,
|
void gdk_display_set_debug_flags (GdkDisplay *display,
|
||||||
GdkDebugFlags flags);
|
GdkDebugFlags flags);
|
||||||
|
|
||||||
|
#ifdef GLIB_USING_SYSTEM_PRINTF
|
||||||
|
#define gdk_debug_message(format, ...) fprintf (stderr, format "\n", ##__VA_ARGS__)
|
||||||
|
#else
|
||||||
#define gdk_debug_message(format, ...) g_fprintf (stderr, format "\n", ##__VA_ARGS__)
|
#define gdk_debug_message(format, ...) g_fprintf (stderr, format "\n", ##__VA_ARGS__)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef G_ENABLE_DEBUG
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
|
||||||
|
@ -410,12 +410,19 @@ gdk_display_manager_open_display (GdkDisplayManager *manager,
|
|||||||
{
|
{
|
||||||
const char *backend = backends[i];
|
const char *backend = backends[i];
|
||||||
gboolean any = g_str_equal (backend, "*");
|
gboolean any = g_str_equal (backend, "*");
|
||||||
|
gboolean found = FALSE;
|
||||||
|
|
||||||
if (!allow_any && !any && !strstr (allowed_backends, backend))
|
if (!allow_any && !any && !strstr (allowed_backends, backend))
|
||||||
continue;
|
{
|
||||||
|
GDK_DEBUG (MISC, "Skipping %s backend", backend);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (j = 0; gdk_backends[j].name != NULL; j++)
|
for (j = 0; gdk_backends[j].name != NULL; j++)
|
||||||
{
|
{
|
||||||
|
if (g_str_equal (backend, gdk_backends[j].name))
|
||||||
|
found = TRUE;
|
||||||
|
|
||||||
if ((any && allow_any) ||
|
if ((any && allow_any) ||
|
||||||
(any && strstr (allowed_backends, gdk_backends[j].name)) ||
|
(any && strstr (allowed_backends, gdk_backends[j].name)) ||
|
||||||
g_str_equal (backend, gdk_backends[j].name))
|
g_str_equal (backend, gdk_backends[j].name))
|
||||||
@ -423,9 +430,15 @@ gdk_display_manager_open_display (GdkDisplayManager *manager,
|
|||||||
GDK_DEBUG (MISC, "Trying %s backend", gdk_backends[j].name);
|
GDK_DEBUG (MISC, "Trying %s backend", gdk_backends[j].name);
|
||||||
display = gdk_backends[j].open_display (name);
|
display = gdk_backends[j].open_display (name);
|
||||||
if (display)
|
if (display)
|
||||||
break;
|
{
|
||||||
|
GDK_DEBUG (MISC, "Using %s display %s", gdk_backends[j].name, gdk_display_get_name (display));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!found && !display)
|
||||||
|
g_warning ("No such backend: %s", backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (backends);
|
g_strfreev (backends);
|
||||||
|
@ -634,34 +634,29 @@ gtk_init_check (void)
|
|||||||
* gtk_init:
|
* gtk_init:
|
||||||
*
|
*
|
||||||
* Call this function before using any other GTK functions in your GUI
|
* Call this function before using any other GTK functions in your GUI
|
||||||
* applications. It will initialize everything needed to operate the
|
* applications. It will initialize everything needed to operate the
|
||||||
* toolkit.
|
* toolkit.
|
||||||
*
|
*
|
||||||
* If you are using `GtkApplication`, you don't have to call gtk_init()
|
* If you are using `GtkApplication`, you don't have to call this
|
||||||
* or gtk_init_check(); the `GApplication::startup` handler
|
* function; the `GApplication::startup` handler does it for you.
|
||||||
* does it for you.
|
|
||||||
*
|
*
|
||||||
* This function will terminate your program if it was unable to
|
* This function will terminate your program if it was unable to
|
||||||
* initialize the windowing system for some reason. If you want
|
* initialize the windowing system for some reason. If you want
|
||||||
* your program to fall back to a textual interface you want to
|
* your program to fall back to a textual interface, call
|
||||||
* call gtk_init_check() instead.
|
* [func@Gtk.init_check] instead.
|
||||||
*
|
*
|
||||||
* GTK calls `signal (SIGPIPE, SIG_IGN)`
|
* GTK calls `signal (SIGPIPE, SIG_IGN)` during initialization, to ignore
|
||||||
* during initialization, to ignore SIGPIPE signals, since these are
|
* SIGPIPE signals, since these are almost never wanted in graphical
|
||||||
* almost never wanted in graphical applications. If you do need to
|
* applications. If you do need to handle SIGPIPE for some reason, reset
|
||||||
* handle SIGPIPE for some reason, reset the handler after gtk_init(),
|
* the handler after gtk_init(), but notice that other libraries (e.g.
|
||||||
* but notice that other libraries (e.g. libdbus or gvfs) might do
|
* libdbus or gvfs) might do similar things.
|
||||||
* similar things.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_init (void)
|
gtk_init (void)
|
||||||
{
|
{
|
||||||
if (!gtk_init_check ())
|
if (!gtk_init_check ())
|
||||||
{
|
{
|
||||||
const char *display_name_arg;
|
g_warning ("Failed to open display");
|
||||||
|
|
||||||
display_name_arg = getenv ("DISPLAY");
|
|
||||||
g_warning ("cannot open display: %s", display_name_arg ? display_name_arg : "");
|
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -731,8 +726,9 @@ gtk_init_check_abi_check (int num_checks, size_t sizeof_GtkWindow, size_t sizeof
|
|||||||
/**
|
/**
|
||||||
* gtk_is_initialized:
|
* gtk_is_initialized:
|
||||||
*
|
*
|
||||||
* Use this function to check if GTK has been initialized with gtk_init()
|
* Use this function to check if GTK has been initialized.
|
||||||
* or gtk_init_check().
|
*
|
||||||
|
* See [func@Gtk.init].
|
||||||
*
|
*
|
||||||
* Returns: the initialization status
|
* Returns: the initialization status
|
||||||
*/
|
*/
|
||||||
@ -769,12 +765,11 @@ gtk_is_initialized (void)
|
|||||||
* update_locale (const char *new_locale)
|
* update_locale (const char *new_locale)
|
||||||
* {
|
* {
|
||||||
* setlocale (LC_ALL, new_locale);
|
* setlocale (LC_ALL, new_locale);
|
||||||
* GtkTextDirection direction = gtk_get_locale_direction ();
|
* gtk_widget_set_default_direction (gtk_get_locale_direction ());
|
||||||
* gtk_widget_set_default_direction (direction);
|
|
||||||
* }
|
* }
|
||||||
* ]|
|
* ]|
|
||||||
*
|
*
|
||||||
* Returns: the `GtkTextDirection` of the current locale
|
* Returns: the direction of the current locale
|
||||||
*/
|
*/
|
||||||
GtkTextDirection
|
GtkTextDirection
|
||||||
gtk_get_locale_direction (void)
|
gtk_get_locale_direction (void)
|
||||||
@ -825,12 +820,10 @@ gtk_get_locale_direction (void)
|
|||||||
* locale. It determines, for example, whether GTK uses
|
* locale. It determines, for example, whether GTK uses
|
||||||
* the right-to-left or left-to-right text direction.
|
* the right-to-left or left-to-right text direction.
|
||||||
*
|
*
|
||||||
* This function is equivalent to
|
* This function is equivalent to [func@Pango.Language.get_default].
|
||||||
* [func@Pango.Language.get_default].
|
|
||||||
* See that function for details.
|
* See that function for details.
|
||||||
*
|
*
|
||||||
* Returns: (transfer none): the default language as a
|
* Returns: (transfer none): the default language
|
||||||
* `PangoLanguage`
|
|
||||||
*/
|
*/
|
||||||
PangoLanguage *
|
PangoLanguage *
|
||||||
gtk_get_default_language (void)
|
gtk_get_default_language (void)
|
||||||
|
Loading…
Reference in New Issue
Block a user