summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2009-09-22 21:32:17 -0400
committerKristian Høgsberg <krh@redhat.com>2009-09-22 21:32:17 -0400
commit44c0f0c77a4e0cea07c61d1e0a583d217c4e5e00 (patch)
treee058dfd847b82b9ce9ac364e6f16df588e2e5971
parentc05910e27035d7a006c557049f0dd3fb24d122e8 (diff)
Use meta (win) key for moving surfacesHEADwayland
-rw-r--r--src/wayland.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/wayland.c b/src/wayland.c
index 0205d5e7..12e55ba0 100644
--- a/src/wayland.c
+++ b/src/wayland.c
@@ -88,6 +88,8 @@ struct xwl_output {
xf86Monitor monitor;
};
+#define MODIFIER_META 0x01
+
struct xwl_input_device {
DeviceIntPtr pointer;
DeviceIntPtr keyboard;
@@ -96,7 +98,7 @@ struct xwl_input_device {
int grab;
struct xwl_window *focus_window;
int32_t grab_x, grab_y;
- int alt;
+ uint32_t modifiers;
};
/* OMG the horror of the xf86 input wrapper... Fortunately, we don't
@@ -303,7 +305,8 @@ handle_button(void *data, struct wl_input_device *input_device,
struct xwl_context *context = d->context;
int index;
- if (button == BTN_LEFT && state == 1 && d->alt) {
+ if (button == BTN_LEFT && state == 1 &&
+ (d->modifiers & MODIFIER_META)) {
if (d->focus_window->window->parent == NULL) {
d->grab_x = context->root_x - x;
d->grab_y = context->root_y - y;
@@ -337,14 +340,23 @@ handle_key(void *data, struct wl_input_device *input_device,
uint32_t key, uint32_t state)
{
struct xwl_input_device *d = data;
+ uint32_t modifier;
switch (key) {
- case KEY_LEFTALT:
- case KEY_RIGHTALT:
- d->alt = state;
+ case KEY_LEFTMETA:
+ case KEY_RIGHTMETA:
+ modifier = MODIFIER_META;
+ break;
+ default:
+ modifier = 0;
break;
}
+ if (state)
+ d->modifiers |= modifier;
+ else
+ d->modifiers &= ~modifier;
+
xf86PostKeyboardEvent(d->keyboard, key + 8, state);
}
@@ -380,9 +392,9 @@ handle_keyboard_focus(void *data,
end = (uint32_t *) ((char *) keys->data + keys->size);
for (k = keys->data; k < end; k++) {
switch (*k) {
- case KEY_LEFTALT:
- case KEY_RIGHTALT:
- d->alt = 1;
+ case KEY_LEFTMETA:
+ case KEY_RIGHTMETA:
+ d->modifiers |= MODIFIER_META;
break;
}
}