commit 8a03536703bb4c1c7373258b46f6b6e2f087380d
parent 551b808f9fec56b867bcfb4dcce86f8f8c6129e1
Author: Michael Forney <mforney@mforney.org>
Date: Mon, 24 Feb 2014 12:24:19 -0800
framebuffer_plane: Move session activation handling to framebuffer_plane.c
Diffstat:
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/libswc/compositor.c b/libswc/compositor.c
@@ -774,15 +774,12 @@ static void handle_switch_vt(void * data, uint32_t time,
static void handle_launch_event(struct wl_listener * listener, void * data)
{
struct swc_event * event = data;
- struct screen * screen;
switch (event->type)
{
case SWC_LAUNCH_EVENT_ACTIVATED:
compositor.active = true;
schedule_updates(-1);
- wl_list_for_each(screen, &swc.screens, link)
- screen->planes.framebuffer.need_modeset = true;
break;
case SWC_LAUNCH_EVENT_DEACTIVATED:
compositor.active = false;
diff --git a/libswc/framebuffer_plane.c b/libswc/framebuffer_plane.c
@@ -24,6 +24,7 @@
#include "framebuffer_plane.h"
#include "drm.h"
#include "internal.h"
+#include "launch.h"
#include "util.h"
#include <errno.h>
@@ -167,6 +168,20 @@ static void handle_page_flip(struct swc_drm_handler * handler, uint32_t time)
view_frame(&plane->view, time);
}
+static void handle_launch_event(struct wl_listener * listener, void * data)
+{
+ struct swc_event * event = data;
+ struct framebuffer_plane * plane
+ = CONTAINER_OF(listener, typeof(*plane), launch_listener);
+
+ switch (event->type)
+ {
+ case SWC_LAUNCH_EVENT_ACTIVATED:
+ plane->need_modeset = true;
+ break;
+ }
+}
+
bool framebuffer_plane_initialize(struct framebuffer_plane * plane,
uint32_t crtc, struct swc_mode * mode,
uint32_t * connectors,
@@ -201,12 +216,14 @@ bool framebuffer_plane_initialize(struct framebuffer_plane * plane,
}
plane->crtc = crtc;
- plane->drm_handler.page_flip = &handle_page_flip;
plane->need_modeset = true;
view_initialize(&plane->view, &view_impl);
plane->view.geometry.width = mode->width;
plane->view.geometry.height = mode->height;
+ plane->drm_handler.page_flip = &handle_page_flip;
+ plane->launch_listener.notify = &handle_launch_event;
plane->mode = *mode;
+ wl_signal_add(&swc.launch->event_signal, &plane->launch_listener);
return true;
diff --git a/libswc/framebuffer_plane.h b/libswc/framebuffer_plane.h
@@ -38,6 +38,7 @@ struct framebuffer_plane
struct wl_array connectors;
bool need_modeset;
struct swc_drm_handler drm_handler;
+ struct wl_listener launch_listener;
};
bool framebuffer_plane_initialize(struct framebuffer_plane * plane,