compositor-wayland: Move vfunc setting from set_size to enable
authorArmin Krezović <krezovic.armin@gmail.com>
Sun, 9 Oct 2016 15:30:26 +0000 (17:30 +0200)
committerDaniel Stone <daniels@collabora.com>
Mon, 21 Nov 2016 16:44:38 +0000 (16:44 +0000)
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
libweston/compositor-wayland.c

index c6ac5fe0973ddd443158fdbefc4568b7baa42b12..aa7e4266fa65f20cd4c9405314d175735db10657 100644 (file)
@@ -1088,11 +1088,21 @@ wayland_output_enable(struct weston_output *base)
        if (b->use_pixman) {
                if (wayland_output_init_pixman_renderer(output) < 0)
                        goto err_output;
+
+               output->base.repaint = wayland_output_repaint_pixman;
        } else {
                if (wayland_output_init_gl_renderer(output) < 0)
                        goto err_output;
+
+               output->base.repaint = wayland_output_repaint_gl;
        }
 
+       output->base.start_repaint_loop = wayland_output_start_repaint_loop;
+       output->base.assign_planes = NULL;
+       output->base.set_backlight = NULL;
+       output->base.set_dpms = NULL;
+       output->base.switch_mode = wayland_output_switch_mode;
+
        if (b->sprawl_across_outputs) {
                wayland_output_set_fullscreen(output,
                                              WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER,
@@ -1166,7 +1176,6 @@ static int
 wayland_output_set_size(struct weston_output *base, int width, int height)
 {
        struct wayland_output *output = to_wayland_output(base);
-       struct wayland_backend *b = to_wayland_backend(base->compositor);
        int output_width, output_height;
 
        /* We can only be called once. */
@@ -1208,17 +1217,6 @@ wayland_output_set_size(struct weston_output *base, int width, int height)
        output->base.mm_width = width;
        output->base.mm_height = height;
 
-       if (b->use_pixman)
-               output->base.repaint = wayland_output_repaint_pixman;
-       else
-               output->base.repaint = wayland_output_repaint_gl;
-
-       output->base.start_repaint_loop = wayland_output_start_repaint_loop;
-       output->base.assign_planes = NULL;
-       output->base.set_backlight = NULL;
-       output->base.set_dpms = NULL;
-       output->base.switch_mode = wayland_output_switch_mode;
-
        return 0;
 }