aboutsummaryrefslogtreecommitdiff
path: root/rootston/cursor.c
diff options
context:
space:
mode:
authorBrian Ashworth <RedSoxFan@users.noreply.github.com>2018-07-29 22:03:53 -0400
committerGitHub <noreply@github.com>2018-07-29 22:03:53 -0400
commita3c33e93b80ffd3bd9f9c8dd9af9032ca578b726 (patch)
treef38b2d3a5c2f2b60804fdf00a05c238ea95bf20b /rootston/cursor.c
parent1c7957cdc1b9bc395510ab7decc1394c1bcd1206 (diff)
parent2e6eb097b6e23b8923bbfc68b1843d5ccde1955b (diff)
Merge pull request #1167 from ammen99/master
rootston: focus newly-created surfaces
Diffstat (limited to 'rootston/cursor.c')
-rw-r--r--rootston/cursor.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 94f5520e..9a9f9af6 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -101,6 +101,7 @@ static void seat_view_deco_button(struct roots_seat_view *view, double sx,
static void roots_passthrough_cursor(struct roots_cursor *cursor,
uint32_t time) {
+ bool focus_changed;
double sx, sy;
struct roots_view *view = NULL;
struct roots_seat *seat = cursor->seat;
@@ -136,8 +137,11 @@ static void roots_passthrough_cursor(struct roots_cursor *cursor,
}
if (surface) {
+ focus_changed = (seat->seat->pointer_state.focused_surface != surface);
wlr_seat_pointer_notify_enter(seat->seat, surface, sx, sy);
- wlr_seat_pointer_notify_motion(seat->seat, time, sx, sy);
+ if (!focus_changed) {
+ wlr_seat_pointer_notify_motion(seat->seat, time, sx, sy);
+ }
} else {
wlr_seat_pointer_clear_focus(seat->seat);
}
@@ -148,8 +152,8 @@ static void roots_passthrough_cursor(struct roots_cursor *cursor,
}
}
-static void roots_cursor_update_position(
- struct roots_cursor *cursor, uint32_t time) {
+void roots_cursor_update_position(struct roots_cursor *cursor,
+ uint32_t time) {
struct roots_seat *seat = cursor->seat;
struct roots_view *view;
switch (cursor->mode) {
@@ -266,13 +270,7 @@ static void roots_cursor_press_button(struct roots_cursor *cursor,
cursor->mode = ROOTS_CURSOR_PASSTHROUGH;
}
- switch (state) {
- case WLR_BUTTON_RELEASED:
- if (!is_touch) {
- roots_cursor_update_position(cursor, time);
- }
- break;
- case WLR_BUTTON_PRESSED:
+ if (state == WLR_BUTTON_PRESSED) {
if (view) {
roots_seat_set_focus(seat, view);
}
@@ -283,7 +281,6 @@ static void roots_cursor_press_button(struct roots_cursor *cursor,
roots_seat_set_focus_layer(seat, layer);
}
}
- break;
}
}