commit 8a03536

Michael Forney  ·  2014-02-24 20:24:19 +0000 UTC
parent 551b808
framebuffer_plane: Move session activation handling to framebuffer_plane.c
3 files changed,  +19, -4
+0, -3
 1@@ -774,15 +774,12 @@ static void handle_switch_vt(void * data, uint32_t time,
 2 static void handle_launch_event(struct wl_listener * listener, void * data)
 3 {
 4     struct swc_event * event = data;
 5-    struct screen * screen;
 6 
 7     switch (event->type)
 8     {
 9         case SWC_LAUNCH_EVENT_ACTIVATED:
10             compositor.active = true;
11             schedule_updates(-1);
12-            wl_list_for_each(screen, &swc.screens, link)
13-                screen->planes.framebuffer.need_modeset = true;
14             break;
15         case SWC_LAUNCH_EVENT_DEACTIVATED:
16             compositor.active = false;
+18, -1
 1@@ -24,6 +24,7 @@
 2 #include "framebuffer_plane.h"
 3 #include "drm.h"
 4 #include "internal.h"
 5+#include "launch.h"
 6 #include "util.h"
 7 
 8 #include <errno.h>
 9@@ -167,6 +168,20 @@ static void handle_page_flip(struct swc_drm_handler * handler, uint32_t time)
10     view_frame(&plane->view, time);
11 }
12 
13+static void handle_launch_event(struct wl_listener * listener, void * data)
14+{
15+    struct swc_event * event = data;
16+    struct framebuffer_plane * plane
17+        = CONTAINER_OF(listener, typeof(*plane), launch_listener);
18+
19+    switch (event->type)
20+    {
21+        case SWC_LAUNCH_EVENT_ACTIVATED:
22+            plane->need_modeset = true;
23+            break;
24+    }
25+}
26+
27 bool framebuffer_plane_initialize(struct framebuffer_plane * plane,
28                                   uint32_t crtc, struct swc_mode * mode,
29                                   uint32_t * connectors,
30@@ -201,12 +216,14 @@ bool framebuffer_plane_initialize(struct framebuffer_plane * plane,
31     }
32 
33     plane->crtc = crtc;
34-    plane->drm_handler.page_flip = &handle_page_flip;
35     plane->need_modeset = true;
36     view_initialize(&plane->view, &view_impl);
37     plane->view.geometry.width = mode->width;
38     plane->view.geometry.height = mode->height;
39+    plane->drm_handler.page_flip = &handle_page_flip;
40+    plane->launch_listener.notify = &handle_launch_event;
41     plane->mode = *mode;
42+    wl_signal_add(&swc.launch->event_signal, &plane->launch_listener);
43 
44     return true;
45 
+1, -0
1@@ -38,6 +38,7 @@ struct framebuffer_plane
2     struct wl_array connectors;
3     bool need_modeset;
4     struct swc_drm_handler drm_handler;
5+    struct wl_listener launch_listener;
6 };
7 
8 bool framebuffer_plane_initialize(struct framebuffer_plane * plane,