diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-01-22 18:48:45 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-02-04 13:15:46 -0500 |
commit | 2b95d1a34ed7cd70ea3eaaa9b7d8add200b5a9d2 (patch) | |
tree | 70806ae21128b61582e38eba62d8286f5c19eeb7 /gdk | |
parent | 15060a8f24bdce8fe2dac911059ca996f60c3456 (diff) | |
download | gtk+-2b95d1a34ed7cd70ea3eaaa9b7d8add200b5a9d2.tar.gz |
Introduce API to get the preferred visual
Unless GDK_RGBA=0 is set, this will be the RGBA visual.
The new function is called gdk_screen_get_preferred_visual().
https://bugzilla.gnome.org/show_bug.cgi?id=630217
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkscreen.c | 30 | ||||
-rw-r--r-- | gdk/gdkscreen.h | 2 | ||||
-rw-r--r-- | gdk/gdkscreenprivate.h | 1 |
3 files changed, 33 insertions, 0 deletions
diff --git a/gdk/gdkscreen.c b/gdk/gdkscreen.c index 743b850bd5..113d2a4052 100644 --- a/gdk/gdkscreen.c +++ b/gdk/gdkscreen.c @@ -913,6 +913,36 @@ gdk_screen_get_rgba_visual (GdkScreen *screen) } /** + * gdk_screen_get_preferred_visual: + * @screen: a #GdkScreen + * + * Returns the visual that is preferred when creating windows. + * + * This will be the visual returned by gdk_screen_get_rgba_visual() + * unless that is not available, or unless the environment + * variable <envar>GDK_RGBA</envar> is set to 0. + * + * Return value: (transfer none): the preferred visual to use + * for windows + * + * Since: 3.12 + */ +GdkVisual * +gdk_screen_get_preferred_visual (GdkScreen *screen) +{ + GdkVisual *visual; + + g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); + + visual = gdk_screen_get_rgba_visual (screen); + + if (visual == NULL || g_strcmp0 (g_getenv ("GDK_RGBA"), "0") == 0) + visual = gdk_screen_get_system_visual (screen); + + return visual; +} + +/** * gdk_screen_is_composited: * @screen: a #GdkScreen * diff --git a/gdk/gdkscreen.h b/gdk/gdkscreen.h index dde5524fa4..57d613245b 100644 --- a/gdk/gdkscreen.h +++ b/gdk/gdkscreen.h @@ -45,6 +45,8 @@ GDK_AVAILABLE_IN_ALL GdkVisual * gdk_screen_get_system_visual (GdkScreen *screen); GDK_AVAILABLE_IN_ALL GdkVisual * gdk_screen_get_rgba_visual (GdkScreen *screen); +GDK_AVAILABLE_IN_3_12 +GdkVisual * gdk_screen_get_preferred_visual (GdkScreen *screen); GDK_AVAILABLE_IN_ALL gboolean gdk_screen_is_composited (GdkScreen *screen); diff --git a/gdk/gdkscreenprivate.h b/gdk/gdkscreenprivate.h index 23cf1bdae2..b73a0926f0 100644 --- a/gdk/gdkscreenprivate.h +++ b/gdk/gdkscreenprivate.h @@ -66,6 +66,7 @@ struct _GdkScreenClass GList * (* list_visuals) (GdkScreen *screen); GdkVisual * (* get_system_visual) (GdkScreen *screen); GdkVisual * (* get_rgba_visual) (GdkScreen *screen); + GdkVisual * (* get_preferred_visual) (GdkScreen *screen); gboolean (* is_composited) (GdkScreen *screen); gchar * (* make_display_name) (GdkScreen *screen); GdkWindow * (* get_active_window) (GdkScreen *screen); |