commit 9d4ba7f
Michael Forney
·
2014-02-26 03:42:51 +0000 UTC
parent b076b2d
pointer, keyboard: Use display global
2 files changed,
+7,
-24
+5,
-14
1@@ -27,6 +27,7 @@
2
3 #include "swc.h"
4 #include "compositor.h"
5+#include "internal.h"
6 #include "keyboard.h"
7 #include "util.h"
8
9@@ -36,16 +37,11 @@
10 static void enter(struct input_focus_handler * handler,
11 struct wl_resource * resource, struct compositor_view * view)
12 {
13- struct keyboard * keyboard;
14- struct wl_client * client;
15- struct wl_display * display;
16+ struct keyboard * keyboard
17+ = CONTAINER_OF(handler, typeof(*keyboard), focus_handler);
18 uint32_t serial;
19
20- keyboard = CONTAINER_OF(handler, typeof(*keyboard), focus_handler);
21- client = wl_resource_get_client(resource);
22- display = wl_client_get_display(client);
23- serial = wl_display_next_serial(display);
24-
25+ serial = wl_display_next_serial(swc.display);
26 wl_keyboard_send_enter(resource, serial, view->surface->resource,
27 &keyboard->client_handler.keys);
28 }
29@@ -53,14 +49,9 @@ static void enter(struct input_focus_handler * handler,
30 static void leave(struct input_focus_handler * handler,
31 struct wl_resource * resource, struct compositor_view * view)
32 {
33- struct wl_client * client;
34- struct wl_display * display;
35 uint32_t serial;
36
37- client = wl_resource_get_client(resource);
38- display = wl_client_get_display(client);
39- serial = wl_display_next_serial(display);
40-
41+ serial = wl_display_next_serial(swc.display);
42 wl_keyboard_send_leave(resource, serial, view->surface->resource);
43 }
44
+2,
-10
1@@ -38,15 +38,11 @@ static void enter(struct input_focus_handler * handler,
2 struct wl_resource * resource, struct compositor_view * view)
3 {
4 struct pointer * pointer;
5- struct wl_client * client;
6- struct wl_display * display;
7 uint32_t serial;
8 wl_fixed_t surface_x, surface_y;
9
10 pointer = CONTAINER_OF(handler, typeof(*pointer), focus_handler);
11- client = wl_resource_get_client(resource);
12- display = wl_client_get_display(client);
13- serial = wl_display_next_serial(display);
14+ serial = wl_display_next_serial(swc.display);
15
16 surface_x = pointer->x - wl_fixed_from_int(view->base.geometry.x);
17 surface_y = pointer->y - wl_fixed_from_int(view->base.geometry.y);
18@@ -58,13 +54,9 @@ static void enter(struct input_focus_handler * handler,
19 static void leave(struct input_focus_handler * handler,
20 struct wl_resource * resource, struct compositor_view * view)
21 {
22- struct wl_client * client;
23- struct wl_display * display;
24 uint32_t serial;
25
26- client = wl_resource_get_client(resource);
27- display = wl_client_get_display(client);
28- serial = wl_display_next_serial(display);
29+ serial = wl_display_next_serial(swc.display);
30
31 wl_pointer_send_leave(resource, serial, view->surface->resource);
32 }