aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/cursor.c10
-rw-r--r--sway/input/seat.c29
2 files changed, 24 insertions, 15 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index afad6f6f..3c62acb9 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -567,15 +567,15 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
struct wlr_surface *surface = NULL;
double sx, sy;
- // Find the node beneath the pointer's previous position
- struct sway_node *prev_node = node_at_coords(seat,
- cursor->previous.x, cursor->previous.y, &surface, &sx, &sy);
+ struct sway_node *prev_node = cursor->previous.node;
+ struct sway_node *node = node_at_coords(seat,
+ cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
+
// Update the stored previous position
cursor->previous.x = cursor->cursor->x;
cursor->previous.y = cursor->cursor->y;
+ cursor->previous.node = node;
- struct sway_node *node = node_at_coords(seat,
- cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
if (node && config->focus_follows_mouse && allow_refocusing) {
struct sway_node *focus = seat_get_focus(seat);
if (focus && node->type == N_WORKSPACE) {
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 69bee47e..15c56a43 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -606,6 +606,18 @@ static int handle_urgent_timeout(void *data) {
return 0;
}
+static void container_raise_floating(struct sway_container *con) {
+ // Bring container to front by putting it at the end of the floating list.
+ struct sway_container *floater = con;
+ while (floater->parent) {
+ floater = floater->parent;
+ }
+ if (container_is_floating(floater)) {
+ list_move_to_end(floater->workspace->floating, floater);
+ node_set_dirty(&floater->workspace->node);
+ }
+}
+
void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
bool warp, bool notify) {
if (seat->focused_layer) {
@@ -733,16 +745,8 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
}
// If we've focused a floating container, bring it to the front.
- // We do this by putting it at the end of the floating list.
- if (container) {
- struct sway_container *floater = container;
- while (floater->parent) {
- floater = floater->parent;
- }
- if (container_is_floating(floater)) {
- list_move_to_end(floater->workspace->floating, floater);
- node_set_dirty(&floater->workspace->node);
- }
+ if (container && config->raise_floating) {
+ container_raise_floating(container);
}
if (last_focus) {
@@ -1017,6 +1021,11 @@ void seat_begin_down(struct sway_seat *seat, struct sway_container *con,
seat->op_ref_con_lx = sx;
seat->op_ref_con_ly = sy;
seat->op_moved = false;
+
+ // In case the container was not raised by gaining focus, raise on click
+ if (con && !config->raise_floating) {
+ container_raise_floating(con);
+ }
}
void seat_begin_move_floating(struct sway_seat *seat,