diff options
author | Tony Crisci <tony@dubstepdish.com> | 2017-10-27 15:22:00 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2017-10-27 15:22:00 -0400 |
commit | c555a66ddafe3ea06f3abbf38194a8589733082d (patch) | |
tree | 2298ce1eb691b3d9d5a8ae69cb77894333f943c1 /rootston | |
parent | 325def38418f5caefd6dc23749dd2ca6bae0a36c (diff) | |
parent | b97160238fa5b61fef81316102559c8c3e137cd2 (diff) |
Merge branch 'master' into feature/xwm-rewrite
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/config.c | 81 | ||||
-rw-r--r-- | rootston/cursor.c | 94 | ||||
-rw-r--r-- | rootston/desktop.c | 28 | ||||
-rw-r--r-- | rootston/input.c | 15 | ||||
-rw-r--r-- | rootston/keyboard.c | 52 | ||||
-rw-r--r-- | rootston/meson.build | 3 | ||||
-rw-r--r-- | rootston/output.c | 3 | ||||
-rw-r--r-- | rootston/wl_shell.c | 3 | ||||
-rw-r--r-- | rootston/xcursor.c | 42 | ||||
-rw-r--r-- | rootston/xdg_shell_v6.c | 3 | ||||
-rw-r--r-- | rootston/xwayland.c | 3 |
11 files changed, 264 insertions, 63 deletions
diff --git a/rootston/config.c b/rootston/config.c index c9c892f9..6f81170b 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -147,8 +147,46 @@ void add_binding_config(struct wl_list *bindings, const char* combination, } } +static void config_handle_keyboard(struct roots_config *config, + const char *device_name, const char *name, const char *value) { + struct keyboard_config *kc; + bool found = false; + wl_list_for_each(kc, &config->keyboards, link) { + if (strcmp(kc->name, device_name) == 0) { + found = true; + break; + } + } + + if (!found) { + kc = calloc(1, sizeof(struct keyboard_config)); + kc->name = strdup(device_name); + wl_list_insert(&config->keyboards, &kc->link); + } + + if (strcmp(name, "meta-key") == 0) { + kc->meta_key = parse_modifier(value); + if (kc->meta_key == 0) { + wlr_log(L_ERROR, "got unknown meta key: %s", name); + } + } else if (strcmp(name, "rules") == 0) { + kc->rules = strdup(value); + } else if (strcmp(name, "model") == 0) { + kc->model = strdup(value); + } else if (strcmp(name, "layout") == 0) { + kc->layout = strdup(value); + } else if (strcmp(name, "variant") == 0) { + kc->variant = strdup(value); + } else if (strcmp(name, "options") == 0) { + kc->options = strdup(value); + } else { + wlr_log(L_ERROR, "got unknown keyboard config: %s", name); + } +} + static const char *output_prefix = "output:"; static const char *device_prefix = "device:"; +static const char *keyboard_prefix = "keyboard:"; static int config_ini_handler(void *user, const char *section, const char *name, const char *value) { @@ -219,9 +257,9 @@ static int config_ini_handler(void *user, const char *section, const char *name, } } else if (strncmp(device_prefix, section, strlen(device_prefix)) == 0) { const char *device_name = section + strlen(device_prefix); + struct device_config *dc; bool found = false; - wl_list_for_each(dc, &config->devices, link) { if (strcmp(dc->name, device_name) == 0) { found = true; @@ -245,14 +283,10 @@ static int config_ini_handler(void *user, const char *section, const char *name, wlr_log(L_ERROR, "got unknown device config: %s", name); } } else if (strcmp(section, "keyboard") == 0) { - if (strcmp(name, "meta-key") == 0) { - config->keyboard.meta_key = parse_modifier(value); - if (config->keyboard.meta_key == 0) { - wlr_log(L_ERROR, "got unknown meta key: %s", name); - } - } else { - wlr_log(L_ERROR, "got unknown keyboard config: %s", name); - } + config_handle_keyboard(config, "", name, value); + } else if (strncmp(keyboard_prefix, section, strlen(keyboard_prefix)) == 0) { + const char *device_name = section + strlen(keyboard_prefix); + config_handle_keyboard(config, device_name, name, value); } else if (strcmp(section, "bindings") == 0) { add_binding_config(&config->bindings, name, value); } else { @@ -271,6 +305,7 @@ struct roots_config *parse_args(int argc, char *argv[]) { config->xwayland = true; wl_list_init(&config->outputs); wl_list_init(&config->devices); + wl_list_init(&config->keyboards); wl_list_init(&config->bindings); int c; @@ -305,10 +340,12 @@ struct roots_config *parse_args(int argc, char *argv[]) { if (result == -1) { wlr_log(L_DEBUG, "No config file found. Using sensible defaults."); - config->keyboard.meta_key = WLR_MODIFIER_LOGO; add_binding_config(&config->bindings, "Logo+Shift+E", "exit"); add_binding_config(&config->bindings, "Ctrl+q", "close"); add_binding_config(&config->bindings, "Alt+Tab", "next_window"); + struct keyboard_config *kc = calloc(1, sizeof(struct keyboard_config)); + kc->meta_key = WLR_MODIFIER_LOGO; + wl_list_insert(&config->keyboards, &kc->link); } else if (result == -2) { wlr_log(L_ERROR, "Could not allocate memory to parse config file"); exit(1); @@ -335,6 +372,17 @@ void roots_config_destroy(struct roots_config *config) { free(dc); } + struct keyboard_config *kc, *ktmp = NULL; + wl_list_for_each_safe(kc, ktmp, &config->bindings, link) { + free(kc->name); + free(kc->rules); + free(kc->model); + free(kc->layout); + free(kc->variant); + free(kc->options); + free(kc); + } + struct binding_config *bc, *btmp = NULL; wl_list_for_each_safe(bc, btmp, &config->bindings, link) { free(bc->keysyms); @@ -371,3 +419,16 @@ struct device_config *config_get_device(struct roots_config *config, return NULL; } + +struct keyboard_config *config_get_keyboard(struct roots_config *config, + struct wlr_input_device *device) { + struct keyboard_config *kc; + wl_list_for_each(kc, &config->keyboards, link) { + if ((device != NULL && strcmp(kc->name, device->name) == 0) || + (device == NULL && strcmp(kc->name, "") == 0)) { + return kc; + } + } + + return NULL; +} diff --git a/rootston/cursor.c b/rootston/cursor.c index 9193f9b7..2cf90539 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -31,6 +31,28 @@ const struct roots_input_event *get_input_event(struct roots_input *input, return NULL; } +static void cursor_set_xcursor_image(struct roots_input *input, + struct wlr_xcursor_image *image) { + struct roots_output *output; + wl_list_for_each(output, &input->server->desktop->outputs, link) { + if (!wlr_output_set_cursor(output->wlr_output, image->buffer, + image->width, image->width, image->height, + image->hotspot_x, image->hotspot_y)) { + wlr_log(L_DEBUG, "Failed to set hardware cursor"); + return; + } + } +} + +static void cursor_set_surface(struct roots_input *input, + struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y) { + struct roots_output *output; + wl_list_for_each(output, &input->server->desktop->outputs, link) { + wlr_output_set_cursor_surface(output->wlr_output, surface, + hotspot_x, hotspot_y); + } +} + void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor, struct roots_view *view) { input->mode = ROOTS_CURSOR_MOVE; @@ -39,6 +61,11 @@ void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor, input->view_x = view->x; input->view_y = view->y; wlr_seat_pointer_clear_focus(input->wl_seat); + + struct wlr_xcursor *xcursor = get_move_xcursor(input->xcursor_theme); + if (xcursor != NULL) { + cursor_set_xcursor_image(input, xcursor->images[0]); + } } void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor, @@ -54,6 +81,11 @@ void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor, input->view_height = size.height; input->resize_edges = edges; wlr_seat_pointer_clear_focus(input->wl_seat); + + struct wlr_xcursor *xcursor = get_resize_xcursor(input->xcursor_theme, edges); + if (xcursor != NULL) { + cursor_set_xcursor_image(input, xcursor->images[0]); + } } void view_begin_rotate(struct roots_input *input, struct wlr_cursor *cursor, @@ -63,18 +95,10 @@ void view_begin_rotate(struct roots_input *input, struct wlr_cursor *cursor, input->offs_y = cursor->y; input->view_rotation = view->rotation; wlr_seat_pointer_clear_focus(input->wl_seat); -} -static void cursor_set_xcursor_image(struct roots_input *input, - struct wlr_xcursor_image *image) { - struct roots_output *output; - wl_list_for_each(output, &input->server->desktop->outputs, link) { - if (!wlr_output_set_cursor(output->wlr_output, image->buffer, - image->width, image->width, image->height, - image->hotspot_x, image->hotspot_y)) { - wlr_log(L_DEBUG, "Failed to set hardware cursor"); - return; - } + struct wlr_xcursor *xcursor = get_rotate_xcursor(input->xcursor_theme); + if (xcursor != NULL) { + cursor_set_xcursor_image(input, xcursor->images[0]); } } @@ -94,8 +118,8 @@ void cursor_update_position(struct roots_input *input, uint32_t time) { set_compositor_cursor = view_client != input->cursor_client; } if (set_compositor_cursor) { - wlr_log(L_DEBUG, "Switching to compositor cursor"); - cursor_set_xcursor_image(input, input->xcursor->images[0]); + struct wlr_xcursor *xcursor = get_default_xcursor(input->xcursor_theme); + cursor_set_xcursor_image(input, xcursor->images[0]); input->cursor_client = NULL; } if (view) { @@ -172,11 +196,11 @@ void set_view_focus(struct roots_input *input, struct roots_desktop *desktop, if (!view) { return; } + if (view->type == ROOTS_XWAYLAND_VIEW && view->xwayland_surface->override_redirect) { return; } - input->last_active_view = view; size_t index = 0; for (size_t i = 0; i < desktop->views->length; ++i) { @@ -220,8 +244,16 @@ static void handle_cursor_axis(struct wl_listener *listener, void *data) { event->orientation, event->delta); } -static bool is_meta_pressed(struct roots_input *input) { - uint32_t meta_key = input->server->config->keyboard.meta_key; +static bool is_meta_pressed(struct roots_input *input, + struct wlr_input_device *device) { + uint32_t meta_key = 0; + struct keyboard_config *config; + if ((config = config_get_keyboard(input->server->config, device))) { + meta_key = config->meta_key; + } else if (!meta_key && (config = config_get_keyboard(input->server->config, + NULL))) { + meta_key = config->meta_key; + } if (meta_key == 0) { return false; } @@ -246,20 +278,31 @@ static void do_cursor_button_press(struct roots_input *input, struct roots_view *view = view_at(desktop, input->cursor->x, input->cursor->y, &surface, &sx, &sy); - if (state == WLR_BUTTON_PRESSED && view && is_meta_pressed(input)) { + if (state == WLR_BUTTON_PRESSED && view && is_meta_pressed(input, device)) { set_view_focus(input, desktop, view); + uint32_t edges; switch (button) { case BTN_LEFT: view_begin_move(input, cursor, view); break; case BTN_RIGHT: - view_begin_resize(input, cursor, view, - ROOTS_CURSOR_RESIZE_EDGE_RIGHT | - ROOTS_CURSOR_RESIZE_EDGE_BOTTOM); + edges = 0; + if (sx < view->wlr_surface->current->width/2) { + edges |= ROOTS_CURSOR_RESIZE_EDGE_LEFT; + } else { + edges |= ROOTS_CURSOR_RESIZE_EDGE_RIGHT; + } + if (sy < view->wlr_surface->current->height/2) { + edges |= ROOTS_CURSOR_RESIZE_EDGE_TOP; + } else { + edges |= ROOTS_CURSOR_RESIZE_EDGE_BOTTOM; + } + view_begin_resize(input, cursor, view, edges); break; case BTN_MIDDLE: view_begin_rotate(input, cursor, view); + break; } return; } @@ -271,6 +314,7 @@ static void do_cursor_button_press(struct roots_input *input, switch (state) { case WLR_BUTTON_RELEASED: set_view_focus(input, desktop, NULL); + cursor_update_position(input, time); break; case WLR_BUTTON_PRESSED: i = input->input_events_idx; @@ -431,19 +475,13 @@ static void handle_request_set_cursor(struct wl_listener *listener, wl_resource_get_client(focused_surface->resource); ok = event->client == focused_client; } - if (!ok) { + if (!ok || input->mode != ROOTS_CURSOR_PASSTHROUGH) { wlr_log(L_DEBUG, "Denying request to set cursor from unfocused client"); return; } wlr_log(L_DEBUG, "Setting client cursor"); - - struct roots_output *output; - wl_list_for_each(output, &input->server->desktop->outputs, link) { - wlr_output_set_cursor_surface(output->wlr_output, event->surface, - event->hotspot_x, event->hotspot_y); - } - + cursor_set_surface(input, event->surface, event->hotspot_x, event->hotspot_y); input->cursor_client = event->client; } diff --git a/rootston/desktop.c b/rootston/desktop.c index 9438ecea..f93d1df8 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -7,11 +7,13 @@ #include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_cursor.h> #include <wlr/types/wlr_gamma_control.h> +#include <wlr/types/wlr_server_decoration.h> #include <wlr/types/wlr_output_layout.h> #include <wlr/types/wlr_wl_shell.h> #include <wlr/types/wlr_xdg_shell_v6.h> #include <wlr/util/log.h> -#include "rootston/desktop.h" +#include <server-decoration-protocol.h> +#include "rootston/server.h" #include "rootston/server.h" void view_destroy(struct roots_view *view) { @@ -22,9 +24,6 @@ void view_destroy(struct roots_view *view) { input->active_view = NULL; input->mode = ROOTS_CURSOR_PASSTHROUGH; } - if (input->last_active_view == view) { - input->last_active_view = NULL; - } for (size_t i = 0; i < desktop->views->length; ++i) { struct roots_view *_view = desktop->views->items[i]; @@ -107,13 +106,25 @@ bool view_center(struct roots_view *view) { return true; } -void view_initialize(struct roots_view *view) { +void view_setup(struct roots_view *view) { view_center(view); - struct roots_input *input = view->desktop->server->input; + struct roots_input *input = view->desktop->server->input; set_view_focus(input, view->desktop, view); } +void view_teardown(struct roots_view *view) { + struct wlr_list *views = view->desktop->views; + if (views->length < 2 || views->items[views->length-1] != view) { + return; + } + + struct roots_view *prev_view = views->items[views->length-2]; + struct roots_input *input = prev_view->desktop->server->input; + set_view_focus(input, prev_view->desktop, prev_view); + wlr_seat_keyboard_notify_enter(input->wl_seat, prev_view->wlr_surface); +} + 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) { @@ -251,6 +262,11 @@ struct roots_desktop *desktop_create(struct roots_server *server, server->wl_display); desktop->screenshooter = wlr_screenshooter_create(server->wl_display, server->renderer); + desktop->server_decoration_manager = + wlr_server_decoration_manager_create(server->wl_display); + wlr_server_decoration_manager_set_default_mode( + desktop->server_decoration_manager, + ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT); return desktop; } diff --git a/rootston/input.c b/rootston/input.c index f424485e..a6792bdb 100644 --- a/rootston/input.c +++ b/rootston/input.c @@ -81,16 +81,17 @@ struct roots_input *input_create(struct roots_server *server, input->config = config; input->server = server; - input->theme = wlr_xcursor_theme_load("default", 16); - if (input->theme == NULL) { + input->xcursor_theme = wlr_xcursor_theme_load("default", 16); + if (input->xcursor_theme == NULL) { wlr_log(L_ERROR, "Cannot load xcursor theme"); free(input); return NULL; } - input->xcursor = wlr_xcursor_theme_get_cursor(input->theme, "left_ptr"); - if (input->xcursor == NULL) { + + struct wlr_xcursor *xcursor = get_default_xcursor(input->xcursor_theme); + if (xcursor == NULL) { wlr_log(L_ERROR, "Cannot load xcursor from theme"); - wlr_xcursor_theme_destroy(input->theme); + wlr_xcursor_theme_destroy(input->xcursor_theme); free(input); return NULL; } @@ -98,7 +99,7 @@ struct roots_input *input_create(struct roots_server *server, input->wl_seat = wlr_seat_create(server->wl_display, "seat0"); if (input->wl_seat == NULL) { wlr_log(L_ERROR, "Cannot create seat"); - wlr_xcursor_theme_destroy(input->theme); + wlr_xcursor_theme_destroy(input->xcursor_theme); free(input); return NULL; } @@ -117,7 +118,7 @@ struct roots_input *input_create(struct roots_server *server, input->cursor = wlr_cursor_create(); cursor_initialize(input); - wlr_cursor_set_xcursor(input->cursor, input->xcursor); + wlr_cursor_set_xcursor(input->cursor, xcursor); wlr_cursor_attach_output_layout(input->cursor, server->desktop->layout); wlr_cursor_map_to_region(input->cursor, config->cursor.mapped_box); diff --git a/rootston/keyboard.c b/rootston/keyboard.c index ef0826aa..ed0ca135 100644 --- a/rootston/keyboard.c +++ b/rootston/keyboard.c @@ -29,8 +29,10 @@ static void keyboard_binding_execute(struct roots_keyboard *keyboard, if (strcmp(command, "exit") == 0) { wl_display_terminate(server->wl_display); } else if (strcmp(command, "close") == 0) { - if (keyboard->input->last_active_view != NULL) { - view_close(keyboard->input->last_active_view); + if (server->desktop->views->length > 0) { + struct roots_view *view = + server->desktop->views->items[server->desktop->views->length-1]; + view_close(view); } } else if (strcmp(command, "next_window") == 0) { if (server->desktop->views->length > 0) { @@ -123,6 +125,28 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) { } } +static void keyboard_config_merge(struct keyboard_config *config, + struct keyboard_config *fallback) { + if (fallback == NULL) { + return; + } + if (config->rules == NULL) { + config->rules = fallback->rules; + } + if (config->model == NULL) { + config->model = fallback->model; + } + if (config->layout == NULL) { + config->layout = fallback->layout; + } + if (config->variant == NULL) { + config->variant = fallback->variant; + } + if (config->options == NULL) { + config->options = fallback->options; + } +} + void keyboard_add(struct wlr_input_device *device, struct roots_input *input) { struct roots_keyboard *keyboard = calloc(sizeof(struct roots_keyboard), 1); if (keyboard == NULL) { @@ -135,13 +159,27 @@ void keyboard_add(struct wlr_input_device *device, struct roots_input *input) { wl_signal_add(&device->keyboard->events.key, &keyboard->key); wl_list_insert(&input->keyboards, &keyboard->link); + struct keyboard_config config; + memset(&config, 0, sizeof(config)); + keyboard_config_merge(&config, config_get_keyboard(input->config, device)); + keyboard_config_merge(&config, config_get_keyboard(input->config, NULL)); + + struct keyboard_config env_config = { + .rules = getenv("XKB_DEFAULT_RULES"), + .model = getenv("XKB_DEFAULT_MODEL"), + .layout = getenv("XKB_DEFAULT_LAYOUT"), + .variant = getenv("XKB_DEFAULT_VARIANT"), + .options = getenv("XKB_DEFAULT_OPTIONS"), + }; + keyboard_config_merge(&config, &env_config); + struct xkb_rule_names rules; memset(&rules, 0, sizeof(rules)); - rules.rules = getenv("XKB_DEFAULT_RULES"); - rules.model = getenv("XKB_DEFAULT_MODEL"); - rules.layout = getenv("XKB_DEFAULT_LAYOUT"); - rules.variant = getenv("XKB_DEFAULT_VARIANT"); - rules.options = getenv("XKB_DEFAULT_OPTIONS"); + rules.rules = config.rules; + rules.model = config.model; + rules.layout = config.layout; + rules.variant = config.variant; + rules.options = config.options; struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); if (context == NULL) { wlr_log(L_ERROR, "Cannot create XKB context"); diff --git a/rootston/meson.build b/rootston/meson.build index f2621450..d84422d8 100644 --- a/rootston/meson.build +++ b/rootston/meson.build @@ -10,6 +10,7 @@ sources = [ 'pointer.c', 'tablet_tool.c', 'touch.c', + 'xcursor.c', 'xdg_shell_v6.c', 'wl_shell.c', ] @@ -17,5 +18,5 @@ if get_option('enable_xwayland') sources += ['xwayland.c'] endif executable( - 'rootston', sources, dependencies: wlroots + 'rootston', sources, dependencies: [wlroots, wlr_protos] ) diff --git a/rootston/output.c b/rootston/output.c index 89e1475b..5fcd02a2 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -200,7 +200,8 @@ void output_add_notify(struct wl_listener *listener, void *data) { cursor_load_config(config, input->cursor, input, desktop); - struct wlr_xcursor_image *image = input->xcursor->images[0]; + struct wlr_xcursor *xcursor = get_default_xcursor(input->xcursor_theme); + struct wlr_xcursor_image *image = xcursor->images[0]; // TODO the cursor must be set depending on which surface it is displayed // over which should happen in the compositor. if (!wlr_output_set_cursor(wlr_output, image->buffer, diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c index 88397af8..e5366672 100644 --- a/rootston/wl_shell.c +++ b/rootston/wl_shell.c @@ -56,6 +56,7 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) { static void handle_destroy(struct wl_listener *listener, void *data) { struct roots_wl_shell_surface *roots_surface = wl_container_of(listener, roots_surface, destroy); + view_teardown(roots_surface->view); wl_list_remove(&roots_surface->destroy.link); wl_list_remove(&roots_surface->request_move.link); wl_list_remove(&roots_surface->request_resize.link); @@ -111,7 +112,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) { view->desktop = desktop; roots_surface->view = view; wlr_list_add(desktop->views, view); - view_initialize(view); + view_setup(view); if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TRANSIENT) { // we need to map it relative to the parent diff --git a/rootston/xcursor.c b/rootston/xcursor.c new file mode 100644 index 00000000..43cbfc51 --- /dev/null +++ b/rootston/xcursor.c @@ -0,0 +1,42 @@ +#include <wlr/types/wlr_cursor.h> +#include "rootston/input.h" + +struct wlr_xcursor *get_default_xcursor(struct wlr_xcursor_theme *theme) { + return wlr_xcursor_theme_get_cursor(theme, "left_ptr"); +} + +struct wlr_xcursor *get_move_xcursor(struct wlr_xcursor_theme *theme) { + return wlr_xcursor_theme_get_cursor(theme, "grabbing"); +} + +static const char *get_resize_xcursor_name(uint32_t edges) { + if (edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) { + if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) { + return "ne-resize"; + } else if (edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) { + return "nw-resize"; + } + return "n-resize"; + } else if (edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) { + if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) { + return "se-resize"; + } else if (edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) { + return "sw-resize"; + } + return "s-resize"; + } else if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) { + return "e-resize"; + } else if (edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) { + return "w-resize"; + } + return "se-resize"; // fallback +} + +struct wlr_xcursor *get_resize_xcursor(struct wlr_xcursor_theme *theme, + uint32_t edges) { + return wlr_xcursor_theme_get_cursor(theme, get_resize_xcursor_name(edges)); +} + +struct wlr_xcursor *get_rotate_xcursor(struct wlr_xcursor_theme *theme) { + return wlr_xcursor_theme_get_cursor(theme, "grabbing"); +} diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index 95b20a8b..85871144 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -74,6 +74,7 @@ static void handle_commit(struct wl_listener *listener, void *data) { static void handle_destroy(struct wl_listener *listener, void *data) { struct roots_xdg_surface_v6 *roots_xdg_surface = wl_container_of(listener, roots_xdg_surface, destroy); + view_teardown(roots_xdg_surface->view); wl_list_remove(&roots_xdg_surface->commit.link); wl_list_remove(&roots_xdg_surface->destroy.link); wl_list_remove(&roots_xdg_surface->request_move.link); @@ -126,5 +127,5 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { roots_surface->view = view; wlr_list_add(desktop->views, view); - view_initialize(view); + view_setup(view); } diff --git a/rootston/xwayland.c b/rootston/xwayland.c index 9a6e33fd..3d066093 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -39,6 +39,7 @@ static void close(struct roots_view *view) { static void handle_destroy(struct wl_listener *listener, void *data) { struct roots_xwayland_surface *roots_surface = wl_container_of(listener, roots_surface, destroy); + view_teardown(roots_surface->view); wl_list_remove(&roots_surface->destroy.link); wl_list_remove(&roots_surface->map_notify.link); wl_list_remove(&roots_surface->unmap_notify.link); @@ -191,6 +192,6 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { wlr_list_add(desktop->views, view); if (!surface->override_redirect) { - view_initialize(view); + view_setup(view); } } |