commit 2a378d5

Michael Forney  ·  2013-09-14 02:36:27 +0000 UTC
parent 33ee03b
Move key handling stuff to keyboard.c and mouse handling stuff to pointer.c
7 files changed,  +235, -208
+8, -8
 1@@ -159,7 +159,7 @@ static bool handle_key(struct swc_keyboard * keyboard, uint32_t time,
 2     {
 3         xkb_keysym_t keysym;
 4 
 5-        keysym = xkb_state_key_get_one_sym(seat->xkb.state, key + 8);
 6+        keysym = xkb_state_key_get_one_sym(keyboard->xkb.state, key + 8);
 7 
 8         wl_array_for_each(binding, &compositor->key_bindings)
 9         {
10@@ -167,18 +167,18 @@ static bool handle_key(struct swc_keyboard * keyboard, uint32_t time,
11             {
12                 xkb_mod_mask_t mod_mask;
13                 uint32_t modifiers = 0;
14-                mod_mask = xkb_state_serialize_mods(seat->xkb.state,
15+                mod_mask = xkb_state_serialize_mods(keyboard->xkb.state,
16                                                     XKB_STATE_MODS_EFFECTIVE);
17-                mod_mask = xkb_state_mod_mask_remove_consumed(seat->xkb.state, key + 8,
18+                mod_mask = xkb_state_mod_mask_remove_consumed(keyboard->xkb.state, key + 8,
19                                                               mod_mask);
20 
21-                if (mod_mask & (1 << seat->xkb.indices.ctrl))
22+                if (mod_mask & (1 << keyboard->xkb.indices.ctrl))
23                     modifiers |= SWC_MOD_CTRL;
24-                if (mod_mask & (1 << seat->xkb.indices.alt))
25+                if (mod_mask & (1 << keyboard->xkb.indices.alt))
26                     modifiers |= SWC_MOD_ALT;
27-                if (mod_mask & (1 << seat->xkb.indices.super))
28+                if (mod_mask & (1 << keyboard->xkb.indices.super))
29                     modifiers |= SWC_MOD_LOGO;
30-                if (mod_mask & (1 << seat->xkb.indices.shift))
31+                if (mod_mask & (1 << keyboard->xkb.indices.shift))
32                     modifiers |= SWC_MOD_SHIFT;
33 
34                 if (binding->modifiers == SWC_MOD_ANY
35@@ -483,7 +483,7 @@ bool swc_compositor_initialize(struct swc_compositor * compositor,
36                                    output->geometry.height);
37     }
38 
39-    swc_seat_set_pointer_region(&compositor->seat, &pointer_region);
40+    swc_pointer_set_region(&compositor->seat.pointer, &pointer_region);
41     pixman_region32_fini(&pointer_region);
42 
43     pixman_region32_init(&compositor->damage);
+110, -0
  1@@ -2,6 +2,7 @@
  2 #include "util.h"
  3 
  4 #include <stdio.h>
  5+#include <string.h>
  6 
  7 static void enter(struct swc_input_focus_handler * handler,
  8                   struct wl_resource * resource, struct swc_surface * surface)
  9@@ -36,6 +37,15 @@ static void leave(struct swc_input_focus_handler * handler,
 10 
 11 bool swc_keyboard_initialize(struct swc_keyboard * keyboard)
 12 {
 13+    if (!swc_xkb_initialize(&keyboard->xkb))
 14+    {
 15+        printf("could not initialize XKB\n");
 16+        goto error0;
 17+    }
 18+
 19+    if (!swc_input_focus_initialize(&keyboard->focus, &keyboard->focus_handler))
 20+        goto error1;
 21+
 22     wl_array_init(&keyboard->keys);
 23 
 24     keyboard->focus_handler.enter = &enter;
 25@@ -44,12 +54,18 @@ bool swc_keyboard_initialize(struct swc_keyboard * keyboard)
 26     swc_input_focus_initialize(&keyboard->focus, &keyboard->focus_handler);
 27 
 28     return true;
 29+
 30+  error1:
 31+    swc_xkb_finish(&keyboard->xkb);
 32+  error0:
 33+    return false;
 34 }
 35 
 36 void swc_keyboard_finish(struct swc_keyboard * keyboard)
 37 {
 38     wl_array_release(&keyboard->keys);
 39     swc_input_focus_finish(&keyboard->focus);
 40+    swc_xkb_finish(&keyboard->xkb);
 41 }
 42 
 43 /**
 44@@ -77,6 +93,100 @@ struct wl_resource * swc_keyboard_bind(struct swc_keyboard * keyboard,
 45     wl_resource_set_implementation(client_resource, NULL, keyboard, &unbind);
 46     swc_input_focus_add_resource(&keyboard->focus, client_resource);
 47 
 48+    /* Subtract one to remove terminating NULL character. */
 49+    wl_keyboard_send_keymap(client_resource, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
 50+                            keyboard->xkb.keymap.fd,
 51+                            keyboard->xkb.keymap.size - 1);
 52+
 53     return client_resource;
 54 }
 55 
 56+void swc_keyboard_handle_key(struct swc_keyboard * keyboard, uint32_t time,
 57+                             uint32_t key, uint32_t state)
 58+{
 59+    uint32_t * pressed_key;
 60+    uint32_t mods_depressed, mods_latched, mods_locked, mods_active, group;
 61+    struct wl_display * display;
 62+    uint32_t serial;
 63+    enum xkb_key_direction direction;
 64+    struct swc_xkb * xkb = &keyboard->xkb;
 65+
 66+    if (keyboard->focus.resource)
 67+    {
 68+        struct wl_client * client
 69+            = wl_resource_get_client(keyboard->focus.resource);
 70+        display = wl_client_get_display(client);
 71+    }
 72+
 73+    /* Update keyboard state state */
 74+    wl_array_for_each(pressed_key, &keyboard->keys)
 75+    {
 76+        if (*pressed_key == key)
 77+        {
 78+            /* Ignore repeat events. */
 79+            if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
 80+                return;
 81+            else
 82+            {
 83+                /* Remove the key from the array */
 84+                uint32_t bytes_to_copy = keyboard->keys.size + 1
 85+                    - (((void *) pressed_key) - keyboard->keys.data);
 86+
 87+                if (bytes_to_copy > 0)
 88+                    memmove(pressed_key, pressed_key + 1, bytes_to_copy);
 89+
 90+                keyboard->keys.size -= sizeof key;
 91+
 92+                break;
 93+            }
 94+        }
 95+    }
 96+
 97+    if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
 98+    {
 99+        pressed_key = wl_array_add(&keyboard->keys, sizeof key);
100+        *pressed_key = key;
101+    }
102+
103+    /* Check if the key event is handled by the keyboard handler. */
104+    if ((!keyboard->handler || !keyboard->handler->key
105+         || !keyboard->handler->key(keyboard, time, key, state))
106+        && keyboard->focus.resource)
107+    {
108+        serial = wl_display_next_serial(display);
109+        wl_keyboard_send_key(keyboard->focus.resource, serial, time,
110+                             key, state);
111+    }
112+
113+    /* Update XKB state. Apparently the keycodes are offset by 8 in XKB. */
114+    direction = state == WL_KEYBOARD_KEY_STATE_PRESSED ? XKB_KEY_DOWN
115+                                                       : XKB_KEY_UP;
116+    xkb_state_update_key(xkb->state, key + 8, direction);
117+
118+    mods_depressed = xkb_state_serialize_mods(xkb->state, XKB_STATE_DEPRESSED);
119+    mods_latched = xkb_state_serialize_mods(xkb->state, XKB_STATE_LATCHED);
120+    mods_locked = xkb_state_serialize_mods(xkb->state, XKB_STATE_LOCKED);
121+    mods_active = mods_depressed | mods_latched;
122+
123+    group = xkb_state_serialize_layout(xkb->state, XKB_STATE_LAYOUT_EFFECTIVE);
124+
125+    if (mods_depressed != keyboard->modifiers.mods_depressed
126+        || mods_latched != keyboard->modifiers.mods_latched
127+        || mods_locked != keyboard->modifiers.mods_locked
128+        || group != keyboard->modifiers.group)
129+    {
130+        if (keyboard->focus.resource)
131+        {
132+            serial = wl_display_next_serial(display);
133+            wl_keyboard_send_modifiers(keyboard->focus.resource,
134+                                       serial, mods_depressed, mods_latched,
135+                                       mods_locked, group);
136+        }
137+    }
138+
139+    keyboard->modifiers.mods_depressed = mods_depressed;
140+    keyboard->modifiers.mods_latched = mods_latched;
141+    keyboard->modifiers.mods_locked = mods_locked;
142+    keyboard->modifiers.group = group;
143+}
144+
+4, -0
 1@@ -3,6 +3,7 @@
 2 
 3 #include "surface.h"
 4 #include "input_focus.h"
 5+#include "xkb.h"
 6 
 7 #include <wayland-server.h>
 8 
 9@@ -24,6 +25,7 @@ struct swc_keyboard
10 
11     struct swc_keyboard_handler * handler;
12 
13+    struct swc_xkb xkb;
14     struct wl_array keys;
15 
16     struct
17@@ -41,6 +43,8 @@ void swc_keyboard_set_focus(struct swc_keyboard * keyboard,
18                             struct swc_surface * surface);
19 struct wl_resource * swc_keyboard_bind(struct swc_keyboard * keyboard,
20                                        struct wl_client * client, uint32_t id);
21+void swc_keyboard_handle_key(struct swc_keyboard * keyboard, uint32_t time,
22+                             uint32_t key, uint32_t state);
23 
24 #endif
25 
+98, -0
  1@@ -3,6 +3,7 @@
  2 #include "event.h"
  3 
  4 #include <stdio.h>
  5+#include <assert.h>
  6 
  7 static void enter(struct swc_input_focus_handler * handler,
  8                   struct wl_resource * resource, struct swc_surface * surface)
  9@@ -63,6 +64,7 @@ bool swc_pointer_initialize(struct swc_pointer * pointer)
 10     pointer->cursor.destroy_listener.notify = &handle_cursor_surface_destroy;
 11 
 12     swc_input_focus_initialize(&pointer->focus, &pointer->focus_handler);
 13+    pixman_region32_init(&pointer->region);
 14 
 15     return true;
 16 }
 17@@ -70,6 +72,7 @@ bool swc_pointer_initialize(struct swc_pointer * pointer)
 18 void swc_pointer_finish(struct swc_pointer * pointer)
 19 {
 20     swc_input_focus_finish(&pointer->focus);
 21+    pixman_region32_fini(&pointer->region);
 22 }
 23 
 24 /**
 25@@ -81,6 +84,38 @@ void swc_pointer_set_focus(struct swc_pointer * pointer,
 26     swc_input_focus_set(&pointer->focus, surface);
 27 }
 28 
 29+static void clip_position(struct swc_pointer * pointer,
 30+                          wl_fixed_t fx, wl_fixed_t fy)
 31+{
 32+    int32_t x, y, last_x, last_y;
 33+    pixman_box32_t box;
 34+
 35+    x = wl_fixed_to_int(fx);
 36+    y = wl_fixed_to_int(fy);
 37+    last_x = wl_fixed_to_int(pointer->x);
 38+    last_y = wl_fixed_to_int(pointer->y);
 39+
 40+    if (!pixman_region32_contains_point(&pointer->region, x, y, NULL))
 41+    {
 42+        assert(pixman_region32_contains_point(&pointer->region,
 43+                                              last_x, last_y, &box));
 44+
 45+        /* Do some clipping. */
 46+        x = MAX(MIN(x, box.x2 - 1), box.x1);
 47+        y = MAX(MIN(y, box.y2 - 1), box.y1);
 48+    }
 49+
 50+    pointer->x = wl_fixed_from_int(x);
 51+    pointer->y = wl_fixed_from_int(y);
 52+}
 53+
 54+void swc_pointer_set_region(struct swc_pointer * pointer,
 55+                            pixman_region32_t * region)
 56+{
 57+    pixman_region32_copy(&pointer->region, region);
 58+    clip_position(pointer, pointer->x, pointer->y);
 59+}
 60+
 61 static void set_cursor(struct wl_client * client,
 62                        struct wl_resource * resource, uint32_t serial,
 63                        struct wl_resource * surface_resource,
 64@@ -141,3 +176,66 @@ struct wl_resource * swc_pointer_bind(struct swc_pointer * pointer,
 65     return client_resource;
 66 }
 67 
 68+void swc_pointer_handle_button(struct swc_pointer * pointer, uint32_t time,
 69+                               uint32_t button, uint32_t state)
 70+{
 71+    if ((!pointer->handler || !pointer->handler->button
 72+         || !pointer->handler->button(pointer, time, button, state))
 73+        && pointer->focus.resource)
 74+    {
 75+        struct wl_client * client
 76+            = wl_resource_get_client(pointer->focus.resource);
 77+        struct wl_display * display = wl_client_get_display(client);
 78+        uint32_t serial = wl_display_next_serial(display);
 79+
 80+        wl_pointer_send_button(pointer->focus.resource, serial, time,
 81+                               button, state);
 82+    }
 83+}
 84+
 85+void swc_pointer_handle_axis(struct swc_pointer * pointer, uint32_t time,
 86+                             uint32_t axis, wl_fixed_t amount)
 87+{
 88+    if ((!pointer->handler || !pointer->handler->axis
 89+         || !pointer->handler->axis(pointer, time, axis, amount))
 90+        && pointer->focus.resource)
 91+    {
 92+        struct wl_client * client
 93+            = wl_resource_get_client(pointer->focus.resource);
 94+        struct wl_display * display = wl_client_get_display(client);
 95+
 96+        wl_pointer_send_axis(pointer->focus.resource, time, axis, amount);
 97+    }
 98+}
 99+
100+void swc_pointer_handle_relative_motion
101+    (struct swc_pointer * pointer, uint32_t time, wl_fixed_t dx, wl_fixed_t dy)
102+{
103+    clip_position(pointer, pointer->x + dx, pointer->y + dy);
104+
105+    if (pointer->handler && pointer->handler->focus)
106+        pointer->handler->focus(pointer);
107+
108+    if ((!pointer->handler || !pointer->handler->motion
109+         || !pointer->handler->motion(pointer, time))
110+        && pointer->focus.resource)
111+    {
112+        wl_fixed_t surface_x, surface_y;
113+        surface_x = pointer->x
114+            - wl_fixed_from_int(pointer->focus.surface->geometry.x);
115+        surface_y = pointer->y
116+            - wl_fixed_from_int(pointer->focus.surface->geometry.y);
117+
118+        wl_pointer_send_motion(pointer->focus.resource, time,
119+                               surface_x, surface_y);
120+
121+        if (pointer->cursor.surface)
122+        {
123+            swc_surface_move
124+                (pointer->cursor.surface,
125+                 wl_fixed_to_int(pointer->x) - pointer->cursor.hotspot_x,
126+                 wl_fixed_to_int(pointer->y) - pointer->cursor.hotspot_y);
127+        }
128+    }
129+}
130+
+10, -2
 1@@ -5,6 +5,7 @@
 2 #include "input_focus.h"
 3 
 4 #include <wayland-server.h>
 5+#include <pixman.h>
 6 
 7 struct swc_pointer;
 8 
 9@@ -45,16 +46,23 @@ struct swc_pointer
10     struct swc_pointer_handler * handler;
11 
12     wl_fixed_t x, y;
13-
14-    uint32_t button_count;
15+    pixman_region32_t region;
16 };
17 
18 bool swc_pointer_initialize(struct swc_pointer * pointer);
19 void swc_pointer_finish(struct swc_pointer * pointer);
20 void swc_pointer_set_focus(struct swc_pointer * pointer,
21                            struct swc_surface * surface);
22+void swc_pointer_set_region(struct swc_pointer * pointer,
23+                            pixman_region32_t * region);
24 struct wl_resource * swc_pointer_bind(struct swc_pointer * pointer,
25                                       struct wl_client * client, uint32_t id);
26+void swc_pointer_handle_button(struct swc_pointer * pointer, uint32_t time,
27+                               uint32_t button, uint32_t state);
28+void swc_pointer_handle_axis(struct swc_pointer * pointer, uint32_t time,
29+                             uint32_t axis, wl_fixed_t amount);
30+void swc_pointer_handle_relative_motion
31+    (struct swc_pointer * pointer, uint32_t time, wl_fixed_t dx, wl_fixed_t dy);
32 
33 #endif
34 
+5, -192
  1@@ -8,7 +8,6 @@
  2 #include <stdlib.h>
  3 #include <stdio.h>
  4 #include <string.h>
  5-#include <assert.h>
  6 
  7 struct evdev_device_entry
  8 {
  9@@ -18,193 +17,28 @@ struct evdev_device_entry
 10     struct wl_list link;
 11 };
 12 
 13-static void clip_position(struct swc_seat * seat, wl_fixed_t fx, wl_fixed_t fy)
 14-{
 15-    int32_t x, y, last_x, last_y;
 16-    pixman_box32_t box;
 17-
 18-    x = wl_fixed_to_int(fx);
 19-    y = wl_fixed_to_int(fy);
 20-    last_x = wl_fixed_to_int(seat->pointer.x);
 21-    last_y = wl_fixed_to_int(seat->pointer.y);
 22-
 23-    if (!pixman_region32_contains_point(&seat->pointer_region, x, y, NULL))
 24-    {
 25-        assert(pixman_region32_contains_point(&seat->pointer_region,
 26-                                              last_x, last_y, &box));
 27-
 28-        /* Do some clipping. */
 29-        x = MAX(MIN(x, box.x2 - 1), box.x1);
 30-        y = MAX(MIN(y, box.y2 - 1), box.y1);
 31-    }
 32-
 33-    seat->pointer.x = wl_fixed_from_int(x);
 34-    seat->pointer.y = wl_fixed_from_int(y);
 35-}
 36-
 37 static void handle_key(struct swc_seat * seat, uint32_t time, uint32_t key,
 38                        uint32_t state)
 39 {
 40-    uint32_t * pressed_key;
 41-    struct swc_keyboard * keyboard = &seat->keyboard;
 42-    struct swc_xkb * xkb = &seat->xkb;
 43-    struct wl_display * display;
 44-    uint32_t serial;
 45-    enum xkb_key_direction direction;
 46-
 47-    if (keyboard->focus.resource)
 48-    {
 49-        struct wl_client * client
 50-            = wl_resource_get_client(keyboard->focus.resource);
 51-        display = wl_client_get_display(client);
 52-    }
 53-
 54-    /* Update keyboard state state */
 55-    wl_array_for_each(pressed_key, &keyboard->keys)
 56-    {
 57-        if (*pressed_key == key)
 58-        {
 59-            /* Ignore repeat evdev events. */
 60-            if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
 61-                return;
 62-            else
 63-            {
 64-                /* Remove the key from the array */
 65-                uint32_t bytes_to_copy = keyboard->keys.size + 1
 66-                    - (((void *) pressed_key) - keyboard->keys.data);
 67-
 68-                if (bytes_to_copy > 0)
 69-                    memmove(pressed_key, pressed_key + 1, bytes_to_copy);
 70-
 71-                keyboard->keys.size -= sizeof key;
 72-
 73-                break;
 74-            }
 75-        }
 76-    }
 77-
 78-    if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
 79-    {
 80-        //keyboard->grab_key = key;
 81-        //keyboard->grab_time = time;
 82-        pressed_key = wl_array_add(&keyboard->keys, sizeof key);
 83-        *pressed_key = key;
 84-    }
 85-
 86-    /* See if the key press is not handled by the compositor */
 87-    if ((!keyboard->handler || !keyboard->handler->key
 88-         || !keyboard->handler->key(keyboard, time, key, state))
 89-        && keyboard->focus.resource)
 90-    {
 91-        serial = wl_display_next_serial(display);
 92-        wl_keyboard_send_key(keyboard->focus.resource, serial, time,
 93-                             key, state);
 94-    }
 95-
 96-    /* Update XKB state. Apparently the keycodes are offset by 8 in XKB. */
 97-    direction = state == WL_KEYBOARD_KEY_STATE_PRESSED ? XKB_KEY_DOWN
 98-                                                       : XKB_KEY_UP;
 99-    xkb_state_update_key(xkb->state, key + 8, direction);
100-
101-    {
102-        uint32_t mods_depressed, mods_latched, mods_locked, mods_active;
103-        uint32_t group;
104-
105-        mods_depressed = xkb_state_serialize_mods(xkb->state, XKB_STATE_DEPRESSED);
106-        mods_latched = xkb_state_serialize_mods(xkb->state, XKB_STATE_LATCHED);
107-        mods_locked = xkb_state_serialize_mods(xkb->state, XKB_STATE_LOCKED);
108-        mods_active = mods_depressed | mods_latched;
109-
110-        group = xkb_state_serialize_layout(xkb->state, XKB_STATE_LAYOUT_EFFECTIVE);
111-
112-        if (mods_depressed != keyboard->modifiers.mods_depressed
113-            || mods_latched != keyboard->modifiers.mods_latched
114-            || mods_locked != keyboard->modifiers.mods_locked
115-            || group != keyboard->modifiers.group)
116-        {
117-            if (keyboard->focus.resource)
118-            {
119-                serial = wl_display_next_serial(display);
120-                wl_keyboard_send_modifiers(keyboard->focus.resource,
121-                                           serial, mods_depressed, mods_latched,
122-                                           mods_locked, group);
123-            }
124-        }
125-
126-        keyboard->modifiers.mods_depressed = mods_depressed;
127-        keyboard->modifiers.mods_latched = mods_latched;
128-        keyboard->modifiers.mods_locked = mods_locked;
129-        keyboard->modifiers.group = group;
130-    }
131+    swc_keyboard_handle_key(&seat->keyboard, time, key, state);
132 }
133 
134 static void handle_button(struct swc_seat * seat, uint32_t time,
135                           uint32_t button, uint32_t state)
136 {
137-    struct swc_pointer * pointer = &seat->pointer;
138-
139-    if ((!pointer->handler || !pointer->handler->button
140-         || !pointer->handler->button(pointer, time, button, state))
141-        && pointer->focus.resource)
142-    {
143-        struct wl_client * client
144-            = wl_resource_get_client(pointer->focus.resource);
145-        struct wl_display * display = wl_client_get_display(client);
146-        uint32_t serial = wl_display_next_serial(display);
147-
148-        wl_pointer_send_button(pointer->focus.resource, serial, time,
149-                               button, state);
150-    }
151+    swc_pointer_handle_button(&seat->pointer, time, button, state);
152 }
153 
154 static void handle_relative_motion(struct swc_seat * seat, uint32_t time,
155                                    wl_fixed_t dx, wl_fixed_t dy)
156 {
157-    struct swc_pointer * pointer = &seat->pointer;
158-
159-    clip_position(seat, pointer->x + dx, pointer->y + dy);
160-
161-    if (pointer->handler && pointer->handler->focus)
162-        pointer->handler->focus(pointer);
163-
164-    if ((!pointer->handler || !pointer->handler->motion
165-         || !pointer->handler->motion(pointer, time))
166-        && pointer->focus.resource)
167-    {
168-        wl_fixed_t surface_x, surface_y;
169-        surface_x = pointer->x
170-            - wl_fixed_from_int(pointer->focus.surface->geometry.x);
171-        surface_y = pointer->y
172-            - wl_fixed_from_int(pointer->focus.surface->geometry.y);
173-
174-        wl_pointer_send_motion(pointer->focus.resource, time,
175-                               surface_x, surface_y);
176-
177-        if (pointer->cursor.surface)
178-        {
179-            swc_surface_move
180-                (pointer->cursor.surface,
181-                 wl_fixed_to_int(pointer->x) - pointer->cursor.hotspot_x,
182-                 wl_fixed_to_int(pointer->y) - pointer->cursor.hotspot_y);
183-        }
184-    }
185+    swc_pointer_handle_relative_motion(&seat->pointer, time, dx, dy);
186 }
187 
188 static void handle_axis_motion(struct swc_seat * seat, uint32_t time,
189                                enum wl_pointer_axis axis, wl_fixed_t amount)
190 {
191-    struct swc_pointer * pointer = &seat->pointer;
192-
193-    if ((!pointer->handler || !pointer->handler->axis
194-         || !pointer->handler->axis(pointer, time, axis, amount))
195-        && pointer->focus.resource)
196-    {
197-        struct wl_client * client
198-            = wl_resource_get_client(pointer->focus.resource);
199-        struct wl_display * display = wl_client_get_display(client);
200-
201-        wl_pointer_send_axis(pointer->focus.resource, time, axis, amount);
202-    }
203+    swc_pointer_handle_axis(&seat->pointer, time, axis, amount);
204 }
205 
206 static void handle_evdev_event(struct wl_listener * listener, void * data)
207@@ -300,10 +134,6 @@ static void get_keyboard(struct wl_client * client, struct wl_resource * resourc
208     struct swc_keyboard * keyboard = &seat->keyboard;
209 
210     client_resource = swc_keyboard_bind(keyboard, client, id);
211-
212-    /* Subtract one to remove terminating NULL character. */
213-    wl_keyboard_send_keymap(client_resource, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
214-                            seat->xkb.keymap.fd, seat->xkb.keymap.size - 1);
215 }
216 
217 static void get_touch(struct wl_client * client, struct wl_resource * resource,
218@@ -396,16 +226,10 @@ bool swc_seat_initialize(struct swc_seat * seat, struct udev * udev,
219     seat->keyboard_focus_listener.notify = &handle_keyboard_focus_event;
220     seat->data_device_listener.notify = &handle_data_device_event;
221 
222-    if (!swc_xkb_initialize(&seat->xkb))
223-    {
224-        printf("could not initialize XKB\n");
225-        goto error_name;
226-    }
227-
228     if (!swc_data_device_initialize(&seat->data_device))
229     {
230         printf("could not initialize data device\n");
231-        goto error_xkb;
232+        goto error_name;
233     }
234 
235     if (!swc_keyboard_initialize(&seat->keyboard))
236@@ -427,7 +251,6 @@ bool swc_seat_initialize(struct swc_seat * seat, struct udev * udev,
237 
238     wl_list_init(&seat->resources);
239     wl_signal_init(&seat->destroy_signal);
240-    pixman_region32_init(&seat->pointer_region);
241     wl_list_init(&seat->devices);
242     swc_seat_add_devices(seat, udev);
243 
244@@ -437,8 +260,6 @@ bool swc_seat_initialize(struct swc_seat * seat, struct udev * udev,
245     swc_keyboard_finish(&seat->keyboard);
246   error_data_device:
247     swc_data_device_finish(&seat->data_device);
248-  error_xkb:
249-    swc_xkb_finish(&seat->xkb);
250   error_name:
251     free(seat->name);
252   error_base:
253@@ -453,7 +274,6 @@ void swc_seat_finish(struct swc_seat * seat)
254 
255     swc_pointer_finish(&seat->pointer);
256     swc_keyboard_finish(&seat->keyboard);
257-    swc_xkb_finish(&seat->xkb);
258 
259     free(seat->name);
260 
261@@ -504,10 +324,3 @@ void swc_seat_add_devices(struct swc_seat * seat, struct udev * udev)
262     udev_enumerate_unref(enumerate);
263 }
264 
265-void swc_seat_set_pointer_region(struct swc_seat * seat,
266-                                 pixman_region32_t * region)
267-{
268-    pixman_region32_copy(&seat->pointer_region, region);
269-    clip_position(seat, seat->pointer.x, seat->pointer.y);
270-}
271-
+0, -6
 1@@ -10,15 +10,12 @@
 2 #include <stdbool.h>
 3 #include <libudev.h>
 4 #include <wayland-server.h>
 5-#include <pixman.h>
 6 
 7 struct swc_seat
 8 {
 9     char * name;
10     uint32_t capabilities;
11 
12-    struct swc_xkb xkb;
13-
14     struct wl_list resources;
15     struct wl_signal destroy_signal;
16 
17@@ -29,7 +26,6 @@ struct swc_seat
18     struct wl_listener keyboard_focus_listener;
19 
20     struct swc_pointer pointer;
21-    pixman_region32_t pointer_region;
22 
23     struct wl_list devices;
24 };
25@@ -46,8 +42,6 @@ void swc_seat_add_event_sources(struct swc_seat * seat,
26 
27 void swc_seat_add_devices(struct swc_seat * seat, struct udev * udev);
28 
29-void swc_seat_set_pointer_region(struct swc_seat * seat,
30-                                 pixman_region32_t * region);
31 
32 #endif
33