aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-07-21 11:23:48 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-07-22 23:10:19 +1000
commit9df660ee3188386c907d8feb999636ce8d61d095 (patch)
treeeb9343b66221d664ac995995d7bcceb45d25ee94 /sway/desktop
parent6767d8a593723a9b69d018eed13d24a789be9516 (diff)
Store last button and use it when views request to move or resize
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/xdg_shell.c13
-rw-r--r--sway/desktop/xdg_shell_v6.c13
2 files changed, 12 insertions, 14 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index d6c3a9a7..c5d53d1d 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -1,9 +1,4 @@
#define _POSIX_C_SOURCE 199309L
-#ifdef __linux__
-#include <linux/input-event-codes.h>
-#elif __FreeBSD__
-#include <dev/evdev/input-event-codes.h>
-#endif
#include <stdbool.h>
#include <stdlib.h>
#include <wayland-server.h>
@@ -259,7 +254,9 @@ static void handle_request_move(struct wl_listener *listener, void *data) {
struct sway_view *view = &xdg_shell_view->view;
struct wlr_xdg_toplevel_move_event *e = data;
struct sway_seat *seat = e->seat->seat->data;
- seat_begin_move(seat, view->swayc);
+ if (e->serial == seat->last_button_serial) {
+ seat_begin_move(seat, view->swayc, seat->last_button);
+ }
}
static void handle_request_resize(struct wl_listener *listener, void *data) {
@@ -268,7 +265,9 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
struct sway_view *view = &xdg_shell_view->view;
struct wlr_xdg_toplevel_resize_event *e = data;
struct sway_seat *seat = e->seat->seat->data;
- seat_begin_resize(seat, view->swayc, BTN_LEFT, e->edges);
+ if (e->serial == seat->last_button_serial) {
+ seat_begin_resize(seat, view->swayc, seat->last_button, e->edges);
+ }
}
static void handle_unmap(struct wl_listener *listener, void *data) {
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index 241bd9b0..4bd6af5e 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -1,9 +1,4 @@
#define _POSIX_C_SOURCE 199309L
-#ifdef __linux__
-#include <linux/input-event-codes.h>
-#elif __FreeBSD__
-#include <dev/evdev/input-event-codes.h>
-#endif
#include <stdbool.h>
#include <stdlib.h>
#include <wayland-server.h>
@@ -254,7 +249,9 @@ static void handle_request_move(struct wl_listener *listener, void *data) {
struct sway_view *view = &xdg_shell_v6_view->view;
struct wlr_xdg_toplevel_v6_move_event *e = data;
struct sway_seat *seat = e->seat->seat->data;
- seat_begin_move(seat, view->swayc);
+ if (e->serial == seat->last_button_serial) {
+ seat_begin_move(seat, view->swayc, seat->last_button);
+ }
}
static void handle_request_resize(struct wl_listener *listener, void *data) {
@@ -263,7 +260,9 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
struct sway_view *view = &xdg_shell_v6_view->view;
struct wlr_xdg_toplevel_v6_resize_event *e = data;
struct sway_seat *seat = e->seat->seat->data;
- seat_begin_resize(seat, view->swayc, BTN_LEFT, e->edges);
+ if (e->serial == seat->last_button_serial) {
+ seat_begin_resize(seat, view->swayc, seat->last_button, e->edges);
+ }
}
static void handle_unmap(struct wl_listener *listener, void *data) {