aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-04-29 13:10:59 +0100
committerLibravatar GitHub <noreply@github.com>2018-04-29 13:10:59 +0100
commit976e6b99b62891a72e48fca21b93708e060c134a (patch)
tree472f59488b8ae77b5f296de8d17e5ba68d4407fb /sway
parentRefactor arrange_windows() (diff)
parentMerge pull request #1867 from emersion/wlroots-923 (diff)
downloadsway-976e6b99b62891a72e48fca21b93708e060c134a.tar.gz
sway-976e6b99b62891a72e48fca21b93708e060c134a.tar.zst
sway-976e6b99b62891a72e48fca21b93708e060c134a.zip
Merge branch 'master' into refactor-arrange-windows
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/xdg_shell_v6.c9
-rw-r--r--sway/desktop/xwayland.c4
-rw-r--r--sway/input/cursor.c14
3 files changed, 12 insertions, 15 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index fdfb9346..2aaedd6c 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -228,13 +228,15 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
228 struct sway_xdg_shell_v6_view *xdg_shell_v6_view = 228 struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
229 wl_container_of(listener, xdg_shell_v6_view, request_fullscreen); 229 wl_container_of(listener, xdg_shell_v6_view, request_fullscreen);
230 struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data; 230 struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data;
231 struct wlr_xdg_surface_v6 *xdg_surface =
232 xdg_shell_v6_view->view.wlr_xdg_surface_v6;
231 233
232 if (!sway_assert(xdg_shell_v6_view->view.wlr_xdg_surface_v6->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL, 234 if (!sway_assert(xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL,
233 "xdg_shell_v6 requested fullscreen of surface with role %i", 235 "xdg_shell_v6 requested fullscreen of surface with role %i",
234 xdg_shell_v6_view->view.wlr_xdg_surface_v6->role)) { 236 xdg_surface->role)) {
235 return; 237 return;
236 } 238 }
237 if (!xdg_shell_v6_view->view.wlr_xdg_surface_v6->mapped) { 239 if (!xdg_surface->mapped) {
238 return; 240 return;
239 } 241 }
240 242
@@ -267,7 +269,6 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
267 269
268 // TODO: 270 // TODO:
269 // - Look up pid and open on appropriate workspace 271 // - Look up pid and open on appropriate workspace
270 // - Criteria
271 272
272 xdg_shell_v6_view->map.notify = handle_map; 273 xdg_shell_v6_view->map.notify = handle_map;
273 wl_signal_add(&xdg_surface->events.map, &xdg_shell_v6_view->map); 274 wl_signal_add(&xdg_surface->events.map, &xdg_shell_v6_view->map);
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 63d9c66e..aa9e1797 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -280,6 +280,9 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
280 wl_container_of(listener, xwayland_view, request_fullscreen); 280 wl_container_of(listener, xwayland_view, request_fullscreen);
281 struct sway_view *view = &xwayland_view->view; 281 struct sway_view *view = &xwayland_view->view;
282 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; 282 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
283 if (!xsurface->mapped) {
284 return;
285 }
283 view_set_fullscreen(view, xsurface->fullscreen); 286 view_set_fullscreen(view, xsurface->fullscreen);
284} 287}
285 288
@@ -309,7 +312,6 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
309 312
310 // TODO: 313 // TODO:
311 // - Look up pid and open on appropriate workspace 314 // - Look up pid and open on appropriate workspace
312 // - Criteria
313 315
314 wl_signal_add(&xsurface->events.destroy, &xwayland_view->destroy); 316 wl_signal_add(&xsurface->events.destroy, &xwayland_view->destroy);
315 xwayland_view->destroy.notify = handle_destroy; 317 xwayland_view->destroy.notify = handle_destroy;
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 944ad8eb..64b95e7d 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -1,4 +1,5 @@
1#define _XOPEN_SOURCE 700 1#define _XOPEN_SOURCE 700
2#include <math.h>
2#ifdef __linux__ 3#ifdef __linux__
3#include <linux/input-event-codes.h> 4#include <linux/input-event-codes.h>
4#elif __FreeBSD__ 5#elif __FreeBSD__
@@ -262,18 +263,11 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) {
262} 263}
263 264
264static double apply_mapping_from_coord(double low, double high, double value) { 265static double apply_mapping_from_coord(double low, double high, double value) {
265 if (value == -1) { 266 if (isnan(value)) {
266 return value; 267 return value;
267 } 268 }
268 269
269 value = (value - low) / (high - low); 270 return (value - low) / (high - low);
270 if (value < 0) {
271 return 0;
272 } else if (value > 1) {
273 return 1;
274 } else {
275 return value;
276 }
277} 271}
278 272
279static void apply_mapping_from_region(struct wlr_input_device *device, 273static void apply_mapping_from_region(struct wlr_input_device *device,
@@ -300,7 +294,7 @@ static void handle_tool_axis(struct wl_listener *listener, void *data) {
300 struct wlr_event_tablet_tool_axis *event = data; 294 struct wlr_event_tablet_tool_axis *event = data;
301 struct sway_input_device *input_device = event->device->data; 295 struct sway_input_device *input_device = event->device->data;
302 296
303 double x = -1, y = -1; 297 double x = NAN, y = NAN;
304 if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X)) { 298 if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X)) {
305 x = event->x; 299 x = event->x;
306 } 300 }