[gtk+] wayland: Fix up visual implementation



commit c6cdddd68d248c1ba3ea0d09c844e8bec5e187a1
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Mar 26 14:58:48 2016 -0400

    wayland: Fix up visual implementation
    
    Don't return visuals that don't match the requested depth
    and/or visual type.

 gdk/wayland/gdkscreen-wayland.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 3620295..f1db311 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -864,14 +864,20 @@ static GdkVisual*
 gdk_wayland_screen_visual_get_best_with_depth (GdkScreen *screen,
                                               gint       depth)
 {
-  return GDK_WAYLAND_SCREEN (screen)->visual;
+  if (depth == 32)
+    return GDK_WAYLAND_SCREEN (screen)->visual;
+  else
+    return NULL;
 }
 
 static GdkVisual*
 gdk_wayland_screen_visual_get_best_with_type (GdkScreen     *screen,
                                              GdkVisualType  visual_type)
 {
-  return GDK_WAYLAND_SCREEN (screen)->visual;
+  if (visual_type == GDK_VISUAL_TRUE_COLOR)
+    return GDK_WAYLAND_SCREEN (screen)->visual;
+  else
+    return NULL;
 }
 
 static GdkVisual*
@@ -879,7 +885,10 @@ gdk_wayland_screen_visual_get_best_with_both (GdkScreen     *screen,
                                              gint           depth,
                                              GdkVisualType  visual_type)
 {
-  return GDK_WAYLAND_SCREEN (screen)->visual;
+  if (depth == 32 && visual_type == GDK_VISUAL_TRUE_COLOR)
+    return GDK_WAYLAND_SCREEN (screen)->visual;
+  else
+    return NULL;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]