diff options
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/config.c | 16 | ||||
-rw-r--r-- | rootston/desktop.c | 90 | ||||
-rw-r--r-- | rootston/meson.build | 33 | ||||
-rw-r--r-- | rootston/rootston.ini.example | 4 |
4 files changed, 50 insertions, 93 deletions
diff --git a/rootston/config.c b/rootston/config.c index d454c2d9..4918c8dd 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -5,6 +5,7 @@ #include <limits.h> #include <getopt.h> #include <string.h> +#include <strings.h> #include <unistd.h> #include <sys/param.h> #include <wlr/util/log.h> @@ -114,7 +115,19 @@ static const char *device_prefix = "device:"; static int config_ini_handler(void *user, const char *section, const char *name, const char *value) { struct roots_config *config = user; - if (strncmp(output_prefix, section, strlen(output_prefix)) == 0) { + if (strcmp(section, "core") == 0) { + if (strcmp(name, "xwayland") == 0) { + if (strcasecmp(value, "true") == 0) { + config->xwayland = true; + } else if (strcasecmp(value, "false") == 0) { + config->xwayland = false; + } else { + wlr_log(L_ERROR, "got unknown xwayland value: %s", value); + } + } else { + wlr_log(L_ERROR, "got unknown core config: %s", name); + } + } else if (strncmp(output_prefix, section, strlen(output_prefix)) == 0) { const char *output_name = section + strlen(output_prefix); struct output_config *oc; bool found = false; @@ -251,6 +264,7 @@ static int config_ini_handler(void *user, const char *section, const char *name, struct roots_config *parse_args(int argc, char *argv[]) { struct roots_config *config = calloc(1, sizeof(struct roots_config)); + config->xwayland = true; wl_list_init(&config->outputs); wl_list_init(&config->devices); wl_list_init(&config->bindings); diff --git a/rootston/desktop.c b/rootston/desktop.c index b34fb19e..bef0fad4 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -98,75 +98,6 @@ bool view_initialize(struct roots_view *view) { return centered; } -static struct wlr_subsurface *subsurface_at(struct wlr_surface *surface, - double sx, double sy, double *sub_x, double *sub_y) { - struct wlr_subsurface *subsurface; - wl_list_for_each(subsurface, &surface->subsurface_list, parent_link) { - double _sub_x = subsurface->surface->current->subsurface_position.x; - double _sub_y = subsurface->surface->current->subsurface_position.y; - struct wlr_subsurface *sub = - subsurface_at(subsurface->surface, _sub_x + sx, _sub_y + sy, - sub_x, sub_y); - if (sub) { - // TODO: This won't work for nested subsurfaces. Convert sub_x and - // sub_y to the parent coordinate system - return sub; - } - - int sub_width = subsurface->surface->current->buffer_width; - int sub_height = subsurface->surface->current->buffer_height; - if ((sx > _sub_x && sx < _sub_x + sub_width) && - (sy > _sub_y && sy < _sub_y + sub_height)) { - if (pixman_region32_contains_point( - &subsurface->surface->current->input, - sx - _sub_x, sy - _sub_y, NULL)) { - *sub_x = _sub_x; - *sub_y = _sub_y; - return subsurface; - } - } - } - - return NULL; -} - -static struct wlr_xdg_surface_v6 *xdg_v6_popup_at( - struct wlr_xdg_surface_v6 *surface, double sx, double sy, - double *popup_sx, double *popup_sy) { - // XXX: I think this is so complicated because we're mixing geometry - // coordinates with surface coordinates. Input handling should only deal - // with surface coordinates. - struct wlr_xdg_surface_v6 *popup; - wl_list_for_each(popup, &surface->popups, popup_link) { - double _popup_sx = surface->geometry->x + popup->popup_state->geometry.x; - double _popup_sy = surface->geometry->y + popup->popup_state->geometry.y; - int popup_width = popup->popup_state->geometry.width; - int popup_height = popup->popup_state->geometry.height; - - struct wlr_xdg_surface_v6 *_popup = - xdg_v6_popup_at(popup, sx - _popup_sx + popup->geometry->x, - sy - _popup_sy + popup->geometry->y, popup_sx, popup_sy); - if (_popup) { - *popup_sx = *popup_sx + _popup_sx - popup->geometry->x; - *popup_sy = *popup_sy + _popup_sy - popup->geometry->y; - return _popup; - } - - if ((sx > _popup_sx && sx < _popup_sx + popup_width) && - (sy > _popup_sy && sy < _popup_sy + popup_height)) { - if (pixman_region32_contains_point(&popup->surface->current->input, - sx - _popup_sx + popup->geometry->x, - sy - _popup_sy + popup->geometry->y, NULL)) { - *popup_sx = _popup_sx - popup->geometry->x; - *popup_sy = _popup_sy - popup->geometry->y; - return popup; - } - } - } - - return NULL; -} - struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly, struct wlr_surface **surface, double *sx, double *sy) { for (int i = desktop->views->length - 1; i >= 0; --i) { @@ -196,8 +127,8 @@ struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly, // TODO: test if this works with rotated views double popup_sx, popup_sy; struct wlr_xdg_surface_v6 *popup = - xdg_v6_popup_at(view->xdg_surface_v6, view_sx, view_sy, - &popup_sx, &popup_sy); + wlr_xdg_surface_v6_popup_at(view->xdg_surface_v6, + view_sx, view_sy, &popup_sx, &popup_sy); if (popup) { *sx = view_sx - popup_sx; @@ -209,7 +140,8 @@ struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly, double sub_x, sub_y; struct wlr_subsurface *subsurface = - subsurface_at(view->wlr_surface, view_sx, view_sy, &sub_x, &sub_y); + wlr_surface_subsurface_at(view->wlr_surface, + view_sx, view_sy, &sub_x, &sub_y); if (subsurface) { *sx = view_sx - sub_x; *sy = view_sy - sub_y; @@ -262,11 +194,15 @@ struct roots_desktop *desktop_create(struct roots_server *server, &desktop->wl_shell_surface); desktop->wl_shell_surface.notify = handle_wl_shell_surface; - desktop->xwayland = wlr_xwayland_create(server->wl_display, - desktop->compositor); - wl_signal_add(&desktop->xwayland->events.new_surface, - &desktop->xwayland_surface); - desktop->xwayland_surface.notify = handle_xwayland_surface; +#ifdef HAS_XWAYLAND + if (config->xwayland) { + desktop->xwayland = wlr_xwayland_create(server->wl_display, + desktop->compositor); + wl_signal_add(&desktop->xwayland->events.new_surface, + &desktop->xwayland_surface); + desktop->xwayland_surface.notify = handle_xwayland_surface; + } +#endif desktop->gamma_control_manager = wlr_gamma_control_manager_create( server->wl_display); diff --git a/rootston/meson.build b/rootston/meson.build index 1eb0704d..7ff79f8e 100644 --- a/rootston/meson.build +++ b/rootston/meson.build @@ -1,17 +1,20 @@ +sources = [ + 'config.c', + 'cursor.c', + 'desktop.c', + 'ini.c', + 'input.c', + 'keyboard.c', + 'main.c', + 'output.c', + 'pointer.c', + 'tablet_tool.c', + 'xdg_shell_v6.c', + 'wl_shell.c', +] +if get_option('enable_xwayland') + sources += ['xwayland.c'] +endif executable( - 'rootston', [ - 'config.c', - 'cursor.c', - 'desktop.c', - 'ini.c', - 'input.c', - 'keyboard.c', - 'main.c', - 'output.c', - 'pointer.c', - 'tablet_tool.c', - 'xdg_shell_v6.c', - 'xwayland.c', - 'wl_shell.c', - ], dependencies: wlroots + 'rootston', sources, dependencies: wlroots ) diff --git a/rootston/rootston.ini.example b/rootston/rootston.ini.example index 8ac474d4..460efa13 100644 --- a/rootston/rootston.ini.example +++ b/rootston/rootston.ini.example @@ -1,3 +1,7 @@ +[core] +# Disable X11 support. Enabled by default. +xwayland=false + # Single output configuration. String after semicolon must match output's name. [output:VGA-1] # Set logical (layout) coordinates for this screen |