x11: Set background as transparent as possible
authorBenjamin Otte <otte@redhat.com>
Mon, 18 Jun 2018 14:26:06 +0000 (16:26 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 18 Jun 2018 21:49:53 +0000 (23:49 +0200)
Instead of making the background black, make it transparent black for
RGBA visuals and set a None background otherwise.

gdk/x11/gdksurface-x11.c

index 96eba372740d6abae47ff46844931f4865cadee9..a833b7ccd55f4aafc5cb903c2f1b6c7700277be2 100644 (file)
@@ -885,10 +885,19 @@ _gdk_x11_display_create_surface_impl (GdkDisplay    *display,
     {
       class = InputOutput;
 
-      xattributes.background_pixel = BlackPixel (xdisplay, x11_screen->screen_num);
+      if (gdk_display_is_rgba (display))
+        {
+          xattributes.background_pixel = 0;
+          xattributes_mask |= CWBackPixel;
+        }
+      else
+        {
+          xattributes.background_pixmap = None;
+          xattributes_mask |= CWBackPixmap;
+        }
 
       xattributes.border_pixel = BlackPixel (xdisplay, x11_screen->screen_num);
-      xattributes_mask |= CWBorderPixel | CWBackPixel;
+      xattributes_mask |= CWBorderPixel;
 
       xattributes.bit_gravity = NorthWestGravity;
       xattributes_mask |= CWBitGravity;