diff options
Diffstat (limited to 'sway/input/seatop_down.c')
-rw-r--r-- | sway/input/seatop_down.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/sway/input/seatop_down.c b/sway/input/seatop_down.c index 7607a598..cc54b90b 100644 --- a/sway/input/seatop_down.c +++ b/sway/input/seatop_down.c | |||
@@ -10,7 +10,8 @@ | |||
10 | 10 | ||
11 | struct seatop_down_event { | 11 | struct seatop_down_event { |
12 | struct sway_container *con; | 12 | struct sway_container *con; |
13 | double ref_lx, ref_ly; // cursor's x/y at start of op | 13 | struct wlr_surface *surface; |
14 | double ref_lx, ref_ly; // cursor's x/y at start of op | ||
14 | double ref_con_lx, ref_con_ly; // container's x/y at start of op | 15 | double ref_con_lx, ref_con_ly; // container's x/y at start of op |
15 | }; | 16 | }; |
16 | 17 | ||
@@ -40,8 +41,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
40 | 41 | ||
41 | static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { | 42 | static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { |
42 | struct seatop_down_event *e = seat->seatop_data; | 43 | struct seatop_down_event *e = seat->seatop_data; |
43 | struct sway_container *con = e->con; | 44 | if (seat_is_input_allowed(seat, e->surface)) { |
44 | if (seat_is_input_allowed(seat, con->view->surface)) { | ||
45 | double moved_x = seat->cursor->cursor->x - e->ref_lx; | 45 | double moved_x = seat->cursor->cursor->x - e->ref_lx; |
46 | double moved_y = seat->cursor->cursor->y - e->ref_ly; | 46 | double moved_y = seat->cursor->cursor->y - e->ref_ly; |
47 | double sx = e->ref_con_lx + moved_x; | 47 | double sx = e->ref_con_lx + moved_x; |
@@ -62,8 +62,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, | |||
62 | static void handle_tablet_tool_motion(struct sway_seat *seat, | 62 | static void handle_tablet_tool_motion(struct sway_seat *seat, |
63 | struct sway_tablet_tool *tool, uint32_t time_msec) { | 63 | struct sway_tablet_tool *tool, uint32_t time_msec) { |
64 | struct seatop_down_event *e = seat->seatop_data; | 64 | struct seatop_down_event *e = seat->seatop_data; |
65 | struct sway_container *con = e->con; | 65 | if (seat_is_input_allowed(seat, e->surface)) { |
66 | if (seat_is_input_allowed(seat, con->view->surface)) { | ||
67 | double moved_x = seat->cursor->cursor->x - e->ref_lx; | 66 | double moved_x = seat->cursor->cursor->x - e->ref_lx; |
68 | double moved_y = seat->cursor->cursor->y - e->ref_ly; | 67 | double moved_y = seat->cursor->cursor->y - e->ref_ly; |
69 | double sx = e->ref_con_lx + moved_x; | 68 | double sx = e->ref_con_lx + moved_x; |
@@ -99,6 +98,7 @@ void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, | |||
99 | return; | 98 | return; |
100 | } | 99 | } |
101 | e->con = con; | 100 | e->con = con; |
101 | e->surface = con->view->surface; | ||
102 | e->ref_lx = seat->cursor->cursor->x; | 102 | e->ref_lx = seat->cursor->cursor->x; |
103 | e->ref_ly = seat->cursor->cursor->y; | 103 | e->ref_ly = seat->cursor->cursor->y; |
104 | e->ref_con_lx = sx; | 104 | e->ref_con_lx = sx; |
@@ -110,3 +110,23 @@ void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, | |||
110 | container_raise_floating(con); | 110 | container_raise_floating(con); |
111 | transaction_commit_dirty(); | 111 | transaction_commit_dirty(); |
112 | } | 112 | } |
113 | |||
114 | void seatop_begin_down_on_layer_surface(struct sway_seat *seat, | ||
115 | struct wlr_surface *surface, uint32_t time_msec, double sx, double sy) { | ||
116 | seatop_end(seat); | ||
117 | |||
118 | struct seatop_down_event *e = | ||
119 | calloc(1, sizeof(struct seatop_down_event)); | ||
120 | if (!e) { | ||
121 | return; | ||
122 | } | ||
123 | e->con = NULL; | ||
124 | e->surface = surface; | ||
125 | e->ref_lx = seat->cursor->cursor->x; | ||
126 | e->ref_ly = seat->cursor->cursor->y; | ||
127 | e->ref_con_lx = sx; | ||
128 | e->ref_con_ly = sy; | ||
129 | |||
130 | seat->seatop_impl = &seatop_impl; | ||
131 | seat->seatop_data = e; | ||
132 | } | ||