[gtk/wip/chergert/GTK_DEBUG_TEXT_DIR] main: add GTK_DEBUG_TEXT_DIR environment variable
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/GTK_DEBUG_TEXT_DIR] main: add GTK_DEBUG_TEXT_DIR environment variable
- Date: Fri, 27 May 2022 20:19:13 +0000 (UTC)
commit 300a94fc4bcfff29cb8642e11b1960c26bb824af
Author: Christian Hergert <chergert redhat com>
Date: Fri May 27 13:05:44 2022 -0700
main: add GTK_DEBUG_TEXT_DIR environment variable
From Builder, we need a way to start a program with a given text direction
so that we can simplify the process for developers to test GTK
applications with settings different than their native locale.
This adds a "GTK_DEBUG_TEXT_DIR" environment variable which may be set to
either rtl or ltr. DEBUG is used in the name to make it clear that this
environment variable is meant for that case only, not as API which can be
relied on for workarounds.
Related to GNOME/gnome-builder#935
gtk/gtkmain.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 7cc39c35f8..a7001be52d 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -523,6 +523,7 @@ static void
do_post_parse_initialization (void)
{
GdkDisplayManager *display_manager;
+ const char *debug_text_dir;
gint64 before G_GNUC_UNUSED;
if (gtk_initialized)
@@ -536,7 +537,14 @@ do_post_parse_initialization (void)
signal (SIGPIPE, SIG_IGN);
#endif
- gtk_widget_set_default_direction (gtk_get_locale_direction ());
+ debug_text_dir = g_getenv ("GTK_DEBUG_TEXT_DIR");
+
+ if (g_strcmp0 (debug_text_dir, "rtl") == 0)
+ gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
+ else if (g_strcmp0 (debug_text_dir, "ltr") == 0)
+ gtk_widget_set_default_direction (GTK_TEXT_DIR_LTR);
+ else
+ gtk_widget_set_default_direction (gtk_get_locale_direction ());
gdk_event_init_types ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]