diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-06-01 18:54:54 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-06-01 18:54:54 +0000 |
commit | ad5c3168a9f21c3f387df09ce5cd501a9ea1b2d8 (patch) | |
tree | b5f264f0f29de660f28b647f66f1894d9dc04a84 | |
parent | 56a1cbe2172063759a647dfa39db97c477b6518b (diff) | |
parent | 8f1db27b6be1a0154a0bfce7d9882db298f7dc5e (diff) | |
download | gtk+-ad5c3168a9f21c3f387df09ce5cd501a9ea1b2d8.tar.gz |
Merge branch 'wip/chergert/GTK_DEBUG_TEXT_DIR' into 'main'
main: add GTK_DEBUG_TEXT_DIR environment variable
See merge request GNOME/gtk!4768
-rw-r--r-- | gtk/gtkdebug.h | 1 | ||||
-rw-r--r-- | gtk/gtkmain.c | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h index f1cad3ea59..a5b8eff2d1 100644 --- a/gtk/gtkdebug.h +++ b/gtk/gtkdebug.h @@ -82,6 +82,7 @@ typedef enum { GTK_DEBUG_BUILDER_OBJECTS = 1 << 16, GTK_DEBUG_A11Y = 1 << 17, GTK_DEBUG_ICONFALLBACK = 1 << 18, + GTK_DEBUG_INVERT_TEXT_DIR = 1 << 19, } GtkDebugFlags; #ifdef G_ENABLE_DEBUG diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 7cc39c35f8..80c7542b03 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -203,6 +203,7 @@ static const GdkDebugKey gtk_debug_keys[] = { { "snapshot", GTK_DEBUG_SNAPSHOT, "Generate debug render nodes" }, { "accessibility", GTK_DEBUG_A11Y, "Information about accessibility state changes" }, { "iconfallback", GTK_DEBUG_ICONFALLBACK, "Information about icon fallback" }, + { "invert-text-dir", GTK_DEBUG_INVERT_TEXT_DIR, "Invert the default text direction" }, }; /* This checks to see if the process is running suid or sgid @@ -523,6 +524,7 @@ static void do_post_parse_initialization (void) { GdkDisplayManager *display_manager; + GtkTextDirection text_dir; gint64 before G_GNUC_UNUSED; if (gtk_initialized) @@ -536,7 +538,16 @@ do_post_parse_initialization (void) signal (SIGPIPE, SIG_IGN); #endif - gtk_widget_set_default_direction (gtk_get_locale_direction ()); + text_dir = gtk_get_locale_direction (); + + /* We always allow inverting the text direction, even in + * production builds, as SDK/IDE tooling may provide the + * ability for developers to test rtl/ltr inverted. + */ + if (gtk_get_debug_flags () & GTK_DEBUG_INVERT_TEXT_DIR) + text_dir = (text_dir == GTK_TEXT_DIR_LTR) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR; + + gtk_widget_set_default_direction (text_dir); gdk_event_init_types (); |