Merge branch 'master' into refactor-arrange-windows

This commit is contained in:
emersion 2018-04-29 13:10:59 +01:00 committed by GitHub
commit 976e6b99b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 15 deletions

View file

@ -228,13 +228,15 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
struct sway_xdg_shell_v6_view *xdg_shell_v6_view = struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
wl_container_of(listener, xdg_shell_v6_view, request_fullscreen); wl_container_of(listener, xdg_shell_v6_view, request_fullscreen);
struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data; struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data;
struct wlr_xdg_surface_v6 *xdg_surface =
xdg_shell_v6_view->view.wlr_xdg_surface_v6;
if (!sway_assert(xdg_shell_v6_view->view.wlr_xdg_surface_v6->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL, if (!sway_assert(xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL,
"xdg_shell_v6 requested fullscreen of surface with role %i", "xdg_shell_v6 requested fullscreen of surface with role %i",
xdg_shell_v6_view->view.wlr_xdg_surface_v6->role)) { xdg_surface->role)) {
return; return;
} }
if (!xdg_shell_v6_view->view.wlr_xdg_surface_v6->mapped) { if (!xdg_surface->mapped) {
return; return;
} }
@ -267,7 +269,6 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
// TODO: // TODO:
// - Look up pid and open on appropriate workspace // - Look up pid and open on appropriate workspace
// - Criteria
xdg_shell_v6_view->map.notify = handle_map; xdg_shell_v6_view->map.notify = handle_map;
wl_signal_add(&xdg_surface->events.map, &xdg_shell_v6_view->map); wl_signal_add(&xdg_surface->events.map, &xdg_shell_v6_view->map);

View file

@ -280,6 +280,9 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
wl_container_of(listener, xwayland_view, request_fullscreen); wl_container_of(listener, xwayland_view, request_fullscreen);
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
if (!xsurface->mapped) {
return;
}
view_set_fullscreen(view, xsurface->fullscreen); view_set_fullscreen(view, xsurface->fullscreen);
} }
@ -309,7 +312,6 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
// TODO: // TODO:
// - Look up pid and open on appropriate workspace // - Look up pid and open on appropriate workspace
// - Criteria
wl_signal_add(&xsurface->events.destroy, &xwayland_view->destroy); wl_signal_add(&xsurface->events.destroy, &xwayland_view->destroy);
xwayland_view->destroy.notify = handle_destroy; xwayland_view->destroy.notify = handle_destroy;

View file

@ -1,4 +1,5 @@
#define _XOPEN_SOURCE 700 #define _XOPEN_SOURCE 700
#include <math.h>
#ifdef __linux__ #ifdef __linux__
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
#elif __FreeBSD__ #elif __FreeBSD__
@ -262,18 +263,11 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) {
} }
static double apply_mapping_from_coord(double low, double high, double value) { static double apply_mapping_from_coord(double low, double high, double value) {
if (value == -1) { if (isnan(value)) {
return value; return value;
} }
value = (value - low) / (high - low); return (value - low) / (high - low);
if (value < 0) {
return 0;
} else if (value > 1) {
return 1;
} else {
return value;
}
} }
static void apply_mapping_from_region(struct wlr_input_device *device, static 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) {
struct wlr_event_tablet_tool_axis *event = data; struct wlr_event_tablet_tool_axis *event = data;
struct sway_input_device *input_device = event->device->data; struct sway_input_device *input_device = event->device->data;
double x = -1, y = -1; double x = NAN, y = NAN;
if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X)) { if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X)) {
x = event->x; x = event->x;
} }