aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/wm/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cmd/wm/input.c')
-rw-r--r--sys/cmd/wm/input.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/sys/cmd/wm/input.c b/sys/cmd/wm/input.c
index eb5fdd1..93bdc50 100644
--- a/sys/cmd/wm/input.c
+++ b/sys/cmd/wm/input.c
@@ -61,11 +61,12 @@ free_keyboard(struct wl_listener *l, void *data)
struct wlr_input_device *device = data;
Keyboard *keyboard = device->data;
- /*
+ /* XXX: debug
wl_list_remove(&keyboard->link);
wl_list_remove(&keyboard->event.modify.link);
wl_list_remove(&keyboard->event.press.link);
wl_list_remove(&keyboard->event.destroy.link);
+
free(keyboard);
*/
}
@@ -78,6 +79,9 @@ make_keyboard(struct wlr_input_device *device)
struct xkb_context *context;
struct xkb_keymap *keymap;
+ keyboard = device->data = calloc(1, sizeof(*keyboard));
+ keyboard->device = device;
+
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
keymap = xkb_keymap_new_from_names(context, nil, XKB_KEYMAP_COMPILE_NO_FLAGS);
@@ -88,9 +92,6 @@ make_keyboard(struct wlr_input_device *device)
wlr_keyboard_set_repeat_info(device->keyboard, cfg·repeat_rate, cfg·repeat_delay);
- keyboard = calloc(1, sizeof(*keyboard));
- keyboard->device = device;
-
keyboard->event.modify.notify = keymodifier;
wl_signal_add(&device->keyboard->events.modifiers, &keyboard->event.modify);
@@ -101,6 +102,7 @@ make_keyboard(struct wlr_input_device *device)
wl_signal_add(&device->keyboard->events.destroy, &keyboard->event.destroy);
wlr_seat_set_keyboard(server.input.seat, device);
+
wl_list_insert(&server.input.keyboards, &keyboard->link);
}
@@ -144,6 +146,7 @@ move(uint32 time)
{
double sx, sy;
Client *client;
+ struct wlr_box box;
struct wlr_surface *surface;
if(time) {
@@ -164,17 +167,18 @@ move(uint32 time)
}
if(server.cursor.mode == CursorResize) {
+ wlr_xdg_surface_get_geometry(server.grab.client->xdg, &box);
resize(server.grab.client,
- server.cursor.dot->x,
- server.cursor.dot->y,
- server.grab.client->geometry.width,
- server.grab.client->geometry.height,
+ server.grab.box.x - box.x,
+ server.grab.box.y - box.y,
+ server.cursor.dot->x - server.grab.x - server.grab.box.x,
+ server.cursor.dot->y - server.grab.y - server.grab.box.y,
1
);
return;
}
- /* Otherwise, find the client under the pointer and send the event along. */
+ /* otherwise, find the client under the pointer and send the event along. */
client = client_at(server.cursor.dot->x, server.cursor.dot->y);
if(!client) {
wlr_xcursor_manager_set_cursor_image(server.cursor.manager, "left_ptr", server.cursor.dot);