]> git.tdb.fi Git - geometrycompositor.git/commitdiff
Some tweaks to GL context usage
authorMikko Rasa <tdb@tdb.fi>
Sun, 13 Dec 2015 16:32:32 +0000 (18:32 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 13 Dec 2015 16:32:32 +0000 (18:32 +0200)
source/main.c

index 30833db0cf7854cc1749a2c789e71a8a71506020..bfb01a4dac17ebacaf28d7df339409bc4e699b1c 100644 (file)
@@ -271,13 +271,11 @@ unsigned create_2d_texture()
        return texture;
 }
 
-int create_gl_resources(Compositor *compositor, CompositedScreen *screen)
+int create_gl_resources(CompositedScreen *screen)
 {
        unsigned stride;
        int loc;
 
-       use_gl(compositor, screen);
-
        screen->shaders[0] = compile_shader(GL_VERTEX_SHADER, vshader_src);
        screen->shaders[1] = compile_shader(GL_FRAGMENT_SHADER, fshader_src);
        screen->shaders[2] = compile_shader(GL_FRAGMENT_SHADER, masked_fshader_src);
@@ -830,7 +828,9 @@ int initialize_screen(Compositor *compositor, unsigned number)
        if(!initialize_gl(compositor, screen))
                return 0;
 
-       if(!create_gl_resources(compositor, screen))
+       use_gl(compositor, screen);
+
+       if(!create_gl_resources(screen))
                return 0;
 
        xrr_res = XRRGetScreenResources(compositor->display, screen->root);
@@ -1007,7 +1007,10 @@ void process_destroy_window_event(Compositor *compositor, XDestroyWindowEvent *e
 
        if((screen = find_screen_by_root(compositor, event->event)))
                if((window = find_window(screen, event->window)))
+               {
+                       use_gl(compositor, screen);
                        remove_window(compositor, screen, window, 1);
+               }
 }
 
 void process_map_event(Compositor *compositor, XMapEvent *event)