simple-egl: Only set alpha_size=0 when -o is passed.
authorScott Moreau <oreaus@gmail.com>
Thu, 30 Aug 2012 20:44:16 +0000 (14:44 -0600)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 31 Aug 2012 23:43:08 +0000 (19:43 -0400)
When starting simple-egl with -f for fullscreen and toggling to 'windowed' mode with F11,
the surface is opaque instead of semi-trnasparent as it is when starting without -f. We
only want to create the surface with alpha_size=0 when the user explicitly passes -o
because otherwise it will never have the ability to use alpha.

clients/simple-egl.c

index 5b77b9d..a331571 100644 (file)
@@ -278,10 +278,12 @@ toggle_fullscreen(struct window *window, int fullscreen)
        window->configured = 0;
 
        if (fullscreen) {
+               window->opaque = 1;
                wl_shell_surface_set_fullscreen(window->shell_surface,
                                                WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
                                                0, NULL);
        } else {
+               window->opaque = 0;
                wl_shell_surface_set_toplevel(window->shell_surface);
                handle_configure(window, window->shell_surface, 0,
                                 window->window_size.width,
@@ -587,7 +589,7 @@ main(int argc, char **argv)
        struct sigaction sigint;
        struct display display = { 0 };
        struct window  window  = { 0 };
-       int i;
+       int i, opaque = 0;
 
        window.display = &display;
        display.window = &window;
@@ -598,7 +600,7 @@ main(int argc, char **argv)
                if (strcmp("-f", argv[i]) == 0)
                        window.fullscreen = 1;
                else if (strcmp("-o", argv[i]) == 0)
-                       window.opaque = 1;
+                       opaque = 1;
                else if (strcmp("-h", argv[i]) == 0)
                        usage(EXIT_SUCCESS);
                else
@@ -617,7 +619,7 @@ main(int argc, char **argv)
        if (window.fullscreen)
                window.opaque = 1;
 
-       init_egl(&display, window.opaque);
+       init_egl(&display, opaque);
        create_surface(&window);
        init_gl(&window);