aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-05-20 23:12:33 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-05-20 23:12:33 -0400
commit82cd55a67006a2817daa466fd2a56e3e5aa11e17 (patch)
tree483fbc00ce738270067487978199b670e970893a /sway/input/cursor.c
parentMerge pull request #2007 from swaywm/fix-focus-follows-mouse (diff)
downloadsway-82cd55a67006a2817daa466fd2a56e3e5aa11e17.tar.gz
sway-82cd55a67006a2817daa466fd2a56e3e5aa11e17.tar.zst
sway-82cd55a67006a2817daa466fd2a56e3e5aa11e17.zip
Fix border commands from changing focus
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 3a73954c..b0ce8002 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -135,7 +135,8 @@ static struct sway_container *container_at_coords(
135 return output->swayc; 135 return output->swayc;
136} 136}
137 137
138void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec) { 138void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
139 bool allow_refocusing) {
139 if (time_msec == 0) { 140 if (time_msec == 0) {
140 time_msec = get_current_time_msec(); 141 time_msec = get_current_time_msec();
141 } 142 }
@@ -145,7 +146,7 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec)
145 double sx, sy; 146 double sx, sy;
146 struct sway_container *c = container_at_coords(cursor->seat, 147 struct sway_container *c = container_at_coords(cursor->seat,
147 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); 148 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
148 if (c && config->focus_follows_mouse) { 149 if (c && config->focus_follows_mouse && allow_refocusing) {
149 if (c->type == C_WORKSPACE) { 150 if (c->type == C_WORKSPACE) {
150 // Only follow the mouse if it would move to a new output 151 // Only follow the mouse if it would move to a new output
151 // Otherwise we'll focus the workspace, which is probably wrong 152 // Otherwise we'll focus the workspace, which is probably wrong
@@ -193,7 +194,7 @@ static void handle_cursor_motion(struct wl_listener *listener, void *data) {
193 struct wlr_event_pointer_motion *event = data; 194 struct wlr_event_pointer_motion *event = data;
194 wlr_cursor_move(cursor->cursor, event->device, 195 wlr_cursor_move(cursor->cursor, event->device,
195 event->delta_x, event->delta_y); 196 event->delta_x, event->delta_y);
196 cursor_send_pointer_motion(cursor, event->time_msec); 197 cursor_send_pointer_motion(cursor, event->time_msec, true);
197} 198}
198 199
199static void handle_cursor_motion_absolute( 200static void handle_cursor_motion_absolute(
@@ -203,7 +204,7 @@ static void handle_cursor_motion_absolute(
203 wlr_idle_notify_activity(cursor->seat->input->server->idle, cursor->seat->wlr_seat); 204 wlr_idle_notify_activity(cursor->seat->input->server->idle, cursor->seat->wlr_seat);
204 struct wlr_event_pointer_motion_absolute *event = data; 205 struct wlr_event_pointer_motion_absolute *event = data;
205 wlr_cursor_warp_absolute(cursor->cursor, event->device, event->x, event->y); 206 wlr_cursor_warp_absolute(cursor->cursor, event->device, event->x, event->y);
206 cursor_send_pointer_motion(cursor, event->time_msec); 207 cursor_send_pointer_motion(cursor, event->time_msec, true);
207} 208}
208 209
209void dispatch_cursor_button(struct sway_cursor *cursor, 210void dispatch_cursor_button(struct sway_cursor *cursor,
@@ -373,7 +374,7 @@ static void handle_tool_axis(struct wl_listener *listener, void *data) {
373 } 374 }
374 375
375 wlr_cursor_warp_absolute(cursor->cursor, event->device, x, y); 376 wlr_cursor_warp_absolute(cursor->cursor, event->device, x, y);
376 cursor_send_pointer_motion(cursor, event->time_msec); 377 cursor_send_pointer_motion(cursor, event->time_msec, true);
377} 378}
378 379
379static void handle_tool_tip(struct wl_listener *listener, void *data) { 380static void handle_tool_tip(struct wl_listener *listener, void *data) {