commit 7e34583396b053f7be51b0e36c319c26c10e0ad1
parent 58e9e5b44e270e3dc1404fe6e02f5a57544763b9
Author: Michael Forney <mforney@mforney.org>
Date: Sat, 25 Jan 2014 01:03:00 -0800
cursor_plane: Restore cursor on session activation
Diffstat:
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/libswc/cursor_plane.c b/libswc/cursor_plane.c
@@ -25,6 +25,7 @@
#include "buffer.h"
#include "drm.h"
#include "internal.h"
+#include "launch.h"
#include "util.h"
#include <errno.h>
@@ -89,12 +90,29 @@ static const struct swc_view_impl view_impl = {
.move = &move
};
+static void handle_launch_event(struct wl_listener * listener, void * data)
+{
+ struct swc_event * event = data;
+ struct swc_cursor_plane * plane
+ = CONTAINER_OF(listener, typeof(*plane), launch_listener);
+
+ switch (event->type)
+ {
+ case SWC_LAUNCH_EVENT_ACTIVATED:
+ move(&plane->view, plane->view.geometry.x, plane->view.geometry.y);
+ attach(&plane->view, plane->view.buffer);
+ break;
+ }
+}
+
bool swc_cursor_plane_initialize(struct swc_cursor_plane * plane, uint32_t crtc)
{
if (drmModeSetCursor(swc.drm->fd, crtc, 0, 0, 0) != 0)
return false;
plane->crtc = crtc;
+ plane->launch_listener.notify = &handle_launch_event;
+ wl_signal_add(&swc.launch->event_signal, &plane->launch_listener);
swc_view_initialize(&plane->view, &view_impl);
return true;
diff --git a/libswc/cursor_plane.h b/libswc/cursor_plane.h
@@ -30,6 +30,7 @@ struct swc_cursor_plane
{
struct swc_view view;
uint32_t crtc;
+ struct wl_listener launch_listener;
};
bool swc_cursor_plane_initialize(struct swc_cursor_plane * plane,