commit 7e34583
Michael Forney
·
2014-01-25 09:03:00 +0000 UTC
parent 58e9e5b
cursor_plane: Restore cursor on session activation
2 files changed,
+19,
-0
+18,
-0
1@@ -25,6 +25,7 @@
2 #include "buffer.h"
3 #include "drm.h"
4 #include "internal.h"
5+#include "launch.h"
6 #include "util.h"
7
8 #include <errno.h>
9@@ -89,12 +90,29 @@ static const struct swc_view_impl view_impl = {
10 .move = &move
11 };
12
13+static void handle_launch_event(struct wl_listener * listener, void * data)
14+{
15+ struct swc_event * event = data;
16+ struct swc_cursor_plane * plane
17+ = CONTAINER_OF(listener, typeof(*plane), launch_listener);
18+
19+ switch (event->type)
20+ {
21+ case SWC_LAUNCH_EVENT_ACTIVATED:
22+ move(&plane->view, plane->view.geometry.x, plane->view.geometry.y);
23+ attach(&plane->view, plane->view.buffer);
24+ break;
25+ }
26+}
27+
28 bool swc_cursor_plane_initialize(struct swc_cursor_plane * plane, uint32_t crtc)
29 {
30 if (drmModeSetCursor(swc.drm->fd, crtc, 0, 0, 0) != 0)
31 return false;
32
33 plane->crtc = crtc;
34+ plane->launch_listener.notify = &handle_launch_event;
35+ wl_signal_add(&swc.launch->event_signal, &plane->launch_listener);
36 swc_view_initialize(&plane->view, &view_impl);
37
38 return true;
+1,
-0
1@@ -30,6 +30,7 @@ struct swc_cursor_plane
2 {
3 struct swc_view view;
4 uint32_t crtc;
5+ struct wl_listener launch_listener;
6 };
7
8 bool swc_cursor_plane_initialize(struct swc_cursor_plane * plane,