aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
Diffstat (limited to 'rootston')
-rw-r--r--rootston/cursor.c54
-rw-r--r--rootston/desktop.c77
-rw-r--r--rootston/input.c11
-rw-r--r--rootston/keyboard.c5
-rw-r--r--rootston/main.c2
-rw-r--r--rootston/meson.build1
-rw-r--r--rootston/output.c64
-rw-r--r--rootston/tablet_tool.c24
-rw-r--r--rootston/wl_shell.c27
-rw-r--r--rootston/xdg_shell_v6.c30
-rw-r--r--rootston/xwayland.c19
11 files changed, 252 insertions, 62 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 2742e7cd..c24e6989 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -29,18 +29,33 @@ void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor,
wlr_seat_pointer_clear_focus(input->wl_seat);
}
+void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor,
+ struct roots_view *view, uint32_t edges) {
+ input->mode = ROOTS_CURSOR_RESIZE;
+ wlr_log(L_DEBUG, "begin resize");
+ input->offs_x = cursor->x;
+ input->offs_y = cursor->y;
+ input->view_x = view->x;
+ input->view_y = view->y;
+ struct wlr_box size;
+ view_get_size(view, &size);
+ input->view_width = size.width;
+ input->view_height = size.height;
+ input->resize_edges = edges;
+ wlr_seat_pointer_clear_focus(input->wl_seat);
+}
+
void cursor_update_position(struct roots_input *input, uint32_t time) {
struct roots_desktop *desktop = input->server->desktop;
struct roots_view *view;
+ struct wlr_surface *surface;
+ double sx, sy;
switch (input->mode) {
case ROOTS_CURSOR_PASSTHROUGH:
- view = view_at(desktop, input->cursor->x, input->cursor->y);
+ view = view_at(desktop, input->cursor->x, input->cursor->y, &surface,
+ &sx, &sy);
if (view) {
- struct wlr_box box;
- view_get_input_bounds(view, &box);
- double sx = input->cursor->x - view->x;
- double sy = input->cursor->y - view->y;
- wlr_seat_pointer_enter(input->wl_seat, view->wlr_surface, sx, sy);
+ wlr_seat_pointer_enter(input->wl_seat, surface, sx, sy);
wlr_seat_pointer_send_motion(input->wl_seat, time, sx, sy);
} else {
wlr_seat_pointer_clear_focus(input->wl_seat);
@@ -53,6 +68,27 @@ void cursor_update_position(struct roots_input *input, uint32_t time) {
}
break;
case ROOTS_CURSOR_RESIZE:
+ if (input->active_view) {
+ int dx = input->cursor->x - input->offs_x;
+ int dy = input->cursor->y - input->offs_y;
+ int width = input->view_width;
+ int height = input->view_height;
+ if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) {
+ input->active_view->y = input->view_y + dy;
+ height -= dy;
+ }
+ if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) {
+ height += dy;
+ }
+ if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
+ input->active_view->x = input->view_x + dx;
+ width -= dx;
+ }
+ if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
+ width += dx;
+ }
+ view_resize(input->active_view, width, height);
+ }
break;
case ROOTS_CURSOR_ROTATE:
break;
@@ -109,8 +145,10 @@ static void do_cursor_button_press(struct roots_input *input,
struct wlr_cursor *cursor, struct wlr_input_device *device,
uint32_t time, uint32_t button, uint32_t state) {
struct roots_desktop *desktop = input->server->desktop;
+ struct wlr_surface *surface;
+ double sx, sy;
struct roots_view *view = view_at(desktop,
- input->cursor->x, input->cursor->y);
+ input->cursor->x, input->cursor->y, &surface, &sx, &sy);
uint32_t serial = wlr_seat_pointer_send_button(
input->wl_seat, time, button, state);
int i;
@@ -128,7 +166,7 @@ static void do_cursor_button_press(struct roots_input *input,
% (sizeof(input->input_events) / sizeof(input->input_events[0]));
set_view_focus(input, desktop, view);
if (view) {
- wlr_seat_keyboard_enter(input->wl_seat, view->wlr_surface);
+ wlr_seat_keyboard_enter(input->wl_seat, surface);
}
break;
}
diff --git a/rootston/desktop.c b/rootston/desktop.c
index cd417755..8d1d34d6 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -25,14 +25,24 @@ void view_destroy(struct roots_view *view) {
free(view);
}
+void view_get_size(struct roots_view *view, struct wlr_box *box) {
+ if (view->get_size) {
+ view->get_size(view, box);
+ return;
+ }
+ box->x = box->y = 0;
+ box->width = view->wlr_surface->current->width;
+ box->height = view->wlr_surface->current->height;
+}
+
void view_get_input_bounds(struct roots_view *view, struct wlr_box *box) {
if (view->get_input_bounds) {
view->get_input_bounds(view, box);
return;
}
box->x = box->y = 0;
- box->width = view->wlr_surface->current.width;
- box->height = view->wlr_surface->current.height;
+ box->width = view->wlr_surface->current->width;
+ box->height = view->wlr_surface->current->height;
}
void view_activate(struct roots_view *view, bool activate) {
@@ -41,14 +51,66 @@ void view_activate(struct roots_view *view, bool activate) {
}
}
-struct roots_view *view_at(struct roots_desktop *desktop, int x, int y) {
- for (size_t i = 0; i < desktop->views->length; ++i) {
+void view_resize(struct roots_view *view, uint32_t width, uint32_t height) {
+ if (view->resize) {
+ view->resize(view, width, height);
+ }
+}
+
+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: 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 && sub_y < sub_y + sub_height)) {
+ *sub_x = _sub_x;
+ *sub_y = _sub_y;
+ return subsurface;
+ }
+ }
+
+ 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) {
struct roots_view *view = desktop->views->items[i];
+
+ double view_sx = lx - view->x;
+ double view_sy = ly - view->y;
+
+ double sub_x, sub_y;
+ struct wlr_subsurface *subsurface =
+ 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;
+ *surface = subsurface->surface;
+ return view;
+ }
+
struct wlr_box box;
view_get_input_bounds(view, &box);
box.x += view->x;
box.y += view->y;
- if (wlr_box_contains_point(&box, x, y)) {
+ if (wlr_box_contains_point(&box, lx, ly)) {
+ *sx = view_sx;
+ *sy = view_sy;
+ *surface = view->wlr_surface;
return view;
}
}
@@ -78,11 +140,6 @@ struct roots_desktop *desktop_create(struct roots_server *server,
desktop->compositor = wlr_compositor_create(
server->wl_display, server->renderer);
- wlr_cursor_attach_output_layout(server->input->cursor, desktop->layout);
- wlr_cursor_map_to_region(server->input->cursor, config->cursor.mapped_box);
- cursor_load_config(config, server->input->cursor,
- server->input, desktop);
-
desktop->xdg_shell_v6 = wlr_xdg_shell_v6_create(server->wl_display);
wl_signal_add(&desktop->xdg_shell_v6->events.new_surface,
&desktop->xdg_shell_v6_surface);
diff --git a/rootston/input.c b/rootston/input.c
index b4427212..9700b840 100644
--- a/rootston/input.c
+++ b/rootston/input.c
@@ -40,7 +40,7 @@ static void input_add_notify(struct wl_listener *listener, void *data) {
//touch_add(device, input);
break;
case WLR_INPUT_DEVICE_TABLET_TOOL:
- //tablet_tool_add(device, input);
+ tablet_tool_add(device, input);
break;
default:
break;
@@ -61,7 +61,7 @@ static void input_remove_notify(struct wl_listener *listener, void *data) {
//touch_remove(device, input);
break;
case WLR_INPUT_DEVICE_TABLET_TOOL:
- //tablet_tool_remove(device, input);
+ tablet_tool_remove(device, input);
break;
default:
break;
@@ -71,6 +71,8 @@ static void input_remove_notify(struct wl_listener *listener, void *data) {
struct roots_input *input_create(struct roots_server *server,
struct roots_config *config) {
wlr_log(L_DEBUG, "Initializing roots input");
+ assert(server->desktop);
+
struct roots_input *input = calloc(1, sizeof(struct roots_input));
assert(input);
@@ -104,6 +106,11 @@ struct roots_input *input_create(struct roots_server *server,
cursor_initialize(input);
wlr_cursor_set_xcursor(input->cursor, input->xcursor);
+ wlr_cursor_attach_output_layout(input->cursor, server->desktop->layout);
+ wlr_cursor_map_to_region(input->cursor, config->cursor.mapped_box);
+ cursor_load_config(config, input->cursor,
+ input, server->desktop);
+
return input;
}
diff --git a/rootston/keyboard.c b/rootston/keyboard.c
index c4c98c91..003aab98 100644
--- a/rootston/keyboard.c
+++ b/rootston/keyboard.c
@@ -59,9 +59,8 @@ void keyboard_add(struct wlr_input_device *device, struct roots_input *input) {
rules.options = getenv("XKB_DEFAULT_OPTIONS");
struct xkb_context *context;
assert(context = xkb_context_new(XKB_CONTEXT_NO_FLAGS));
- wlr_keyboard_set_keymap(device->keyboard,
- xkb_map_new_from_names(context, &rules,
- XKB_KEYMAP_COMPILE_NO_FLAGS));
+ wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
+ &rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
xkb_context_unref(context);
wlr_seat_attach_keyboard(input->wl_seat, device);
}
diff --git a/rootston/main.c b/rootston/main.c
index c8ec1249..7b1ca298 100644
--- a/rootston/main.c
+++ b/rootston/main.c
@@ -20,8 +20,8 @@ int main(int argc, char **argv) {
assert(server.renderer = wlr_gles2_renderer_create(server.backend));
wl_display_init_shm(server.wl_display);
- server.input = input_create(&server, server.config);
server.desktop = desktop_create(&server, server.config);
+ server.input = input_create(&server, server.config);
server.data_device_manager = wlr_data_device_manager_create(
server.wl_display);
diff --git a/rootston/meson.build b/rootston/meson.build
index 59f73e96..1eb0704d 100644
--- a/rootston/meson.build
+++ b/rootston/meson.build
@@ -9,6 +9,7 @@ executable(
'main.c',
'output.c',
'pointer.c',
+ 'tablet_tool.c',
'xdg_shell_v6.c',
'xwayland.c',
'wl_shell.c',
diff --git a/rootston/output.c b/rootston/output.c
index 5aeb71b1..14d1783e 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -16,28 +16,49 @@ static inline int64_t timespec_to_msec(const struct timespec *a) {
return (int64_t)a->tv_sec * 1000 + a->tv_nsec / 1000000;
}
-static void render_view(struct roots_desktop *desktop,
- struct wlr_output *wlr_output, struct timespec *when,
- struct roots_view *view, double ox, double oy) {
- struct wlr_surface *surface = view->wlr_surface;
- float matrix[16];
- float transform[16];
+static void render_surface(struct wlr_surface *surface,
+ struct roots_desktop *desktop, struct wlr_output *wlr_output,
+ struct timespec *when, double lx, double ly) {
wlr_surface_flush_damage(surface);
if (surface->texture->valid) {
- wlr_matrix_translate(&transform, ox, oy, 0);
- wlr_surface_get_matrix(surface, &matrix,
- &wlr_output->transform_matrix, &transform);
- wlr_render_with_matrix(desktop->server->renderer,
- surface->texture, &matrix);
-
- struct wlr_frame_callback *cb, *cnext;
- wl_list_for_each_safe(cb, cnext, &surface->frame_callback_list, link) {
- wl_callback_send_done(cb->resource, timespec_to_msec(when));
- wl_resource_destroy(cb->resource);
+ int width = surface->current->buffer_width;
+ int height = surface->current->buffer_height;
+ double ox = lx, oy = ly;
+ wlr_output_layout_output_coords(desktop->layout, wlr_output, &ox, &oy);
+
+ if (wlr_output_layout_intersects(desktop->layout, wlr_output,
+ lx, ly, lx + width, ly + height)) {
+ float matrix[16];
+ float transform[16];
+ wlr_matrix_translate(&transform, ox, oy, 0);
+ wlr_surface_get_matrix(surface, &matrix,
+ &wlr_output->transform_matrix, &transform);
+ wlr_render_with_matrix(desktop->server->renderer,
+ surface->texture, &matrix);
+
+ struct wlr_frame_callback *cb, *cnext;
+ wl_list_for_each_safe(cb, cnext,
+ &surface->current->frame_callback_list, link) {
+ wl_callback_send_done(cb->resource, timespec_to_msec(when));
+ wl_resource_destroy(cb->resource);
+ }
+ }
+
+ struct wlr_subsurface *subsurface;
+ wl_list_for_each(subsurface, &surface->subsurface_list, parent_link) {
+ render_surface(subsurface->surface, desktop, wlr_output, when,
+ lx + subsurface->surface->current->subsurface_position.x,
+ ly + subsurface->surface->current->subsurface_position.y);
}
}
}
+static void render_view(struct roots_view *view, struct roots_desktop *desktop,
+ struct wlr_output *wlr_output, struct timespec *when) {
+ render_surface(view->wlr_surface, desktop, wlr_output, when,
+ view->x, view->y);
+}
+
static void output_frame_notify(struct wl_listener *listener, void *data) {
struct wlr_output *wlr_output = data;
struct roots_output *output = wl_container_of(listener, output, frame);
@@ -52,16 +73,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
for (size_t i = 0; i < desktop->views->length; ++i) {
struct roots_view *view = desktop->views->items[i];
- int width = view->wlr_surface->current.buffer_width;
- int height = view->wlr_surface->current.buffer_height;
-
- if (wlr_output_layout_intersects(desktop->layout, wlr_output,
- view->x, view->y, view->x + width, view->y + height)) {
- double ox = view->x, oy = view->y;
- wlr_output_layout_output_coords(
- desktop->layout, wlr_output, &ox, &oy);
- render_view(desktop, wlr_output, &now, view, ox, oy);
- }
+ render_view(view, desktop, wlr_output, &now);
}
wlr_renderer_end(server->renderer);
diff --git a/rootston/tablet_tool.c b/rootston/tablet_tool.c
new file mode 100644
index 00000000..a612e683
--- /dev/null
+++ b/rootston/tablet_tool.c
@@ -0,0 +1,24 @@
+#include <stdlib.h>
+#include <wayland-server.h>
+#include <wlr/types/wlr_input_device.h>
+#include <wlr/types/wlr_pointer.h>
+#include <wlr/util/log.h>
+#include "rootston/input.h"
+
+void tablet_tool_add(struct wlr_input_device *device, struct roots_input *input) {
+ struct roots_tablet_tool *tool = calloc(sizeof(struct roots_tablet_tool), 1);
+ device->data = tool;
+ tool->device = device;
+ tool->input = input;
+ wl_list_insert(&input->tablet_tools, &tool->link);
+ wlr_cursor_attach_input_device(input->cursor, device);
+ cursor_load_config(input->server->config, input->cursor,
+ input, input->server->desktop);
+}
+
+void tablet_tool_remove(struct wlr_input_device *device, struct roots_input *input) {
+ struct roots_tablet_tool *tablet_tool = device->data;
+ wlr_cursor_detach_input_device(input->cursor, device);
+ wl_list_remove(&tablet_tool->link);
+ free(tablet_tool);
+}
diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c
index 4189e910..1991d332 100644
--- a/rootston/wl_shell.c
+++ b/rootston/wl_shell.c
@@ -10,7 +10,14 @@
#include "rootston/server.h"
#include "rootston/input.h"
-static void handle_move(struct wl_listener *listener, void *data) {
+static void resize(struct roots_view *view, uint32_t width, uint32_t height) {
+ assert(view->type == ROOTS_WL_SHELL_VIEW);
+ struct wlr_wl_shell_surface *surf = view->wl_shell_surface;
+ wlr_wl_shell_surface_configure(surf, WL_SHELL_SURFACE_RESIZE_NONE, width,
+ height);
+}
+
+static void handle_request_move(struct wl_listener *listener, void *data) {
struct roots_wl_shell_surface *roots_surface =
wl_container_of(listener, roots_surface, request_move);
struct roots_view *view = roots_surface->view;
@@ -23,6 +30,19 @@ static void handle_move(struct wl_listener *listener, void *data) {
view_begin_move(input, event->cursor, view);
}
+static void handle_request_resize(struct wl_listener *listener, void *data) {
+ struct roots_wl_shell_surface *roots_surface =
+ wl_container_of(listener, roots_surface, request_resize);
+ struct roots_view *view = roots_surface->view;
+ struct roots_input *input = view->desktop->server->input;
+ struct wlr_wl_shell_surface_resize_event *e = data;
+ const struct roots_input_event *event = get_input_event(input, e->serial);
+ if (!event || input->mode != ROOTS_CURSOR_PASSTHROUGH) {
+ return;
+ }
+ view_begin_resize(input, event->cursor, view, e->edges);
+}
+
static void handle_destroy(struct wl_listener *listener, void *data) {
struct roots_wl_shell_surface *roots_surface =
wl_container_of(listener, roots_surface, destroy);
@@ -53,9 +73,11 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
wl_signal_add(&surface->events.destroy, &roots_surface->destroy);
wl_list_init(&roots_surface->ping_timeout.link);
wl_list_init(&roots_surface->request_move.link);
- roots_surface->request_move.notify = handle_move;
+ roots_surface->request_move.notify = handle_request_move;
wl_signal_add(&surface->events.request_move, &roots_surface->request_move);
wl_list_init(&roots_surface->request_resize.link);
+ roots_surface->request_resize.notify = handle_request_resize;
+ wl_signal_add(&surface->events.request_resize, &roots_surface->request_resize);
wl_list_init(&roots_surface->request_set_fullscreen.link);
wl_list_init(&roots_surface->request_set_maximized.link);
@@ -65,6 +87,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
view->wl_shell_surface = surface;
view->roots_wl_shell_surface = roots_surface;
view->wlr_surface = surface->surface;
+ view->resize = resize;
view->desktop = desktop;
roots_surface->view = view;
list_add(desktop->views, view);
diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c
index e8edaa8f..ab34f52a 100644
--- a/rootston/xdg_shell_v6.c
+++ b/rootston/xdg_shell_v6.c
@@ -10,9 +10,10 @@
#include "rootston/server.h"
#include "rootston/input.h"
-static void get_input_bounds(struct roots_view *view, struct wlr_box *box) {
+static void get_size(struct roots_view *view, struct wlr_box *box) {
assert(view->type == ROOTS_XDG_SHELL_V6_VIEW);
struct wlr_xdg_surface_v6 *surf = view->xdg_surface_v6;
+ // TODO: surf->geometry can be NULL
memcpy(box, surf->geometry, sizeof(struct wlr_box));
}
@@ -24,6 +25,14 @@ static void activate(struct roots_view *view, bool active) {
}
}
+static void resize(struct roots_view *view, uint32_t width, uint32_t height) {
+ assert(view->type == ROOTS_XDG_SHELL_V6_VIEW);
+ struct wlr_xdg_surface_v6 *surf = view->xdg_surface_v6;
+ if (surf->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
+ wlr_xdg_toplevel_v6_set_size(surf, width, height);
+ }
+}
+
static void handle_request_move(struct wl_listener *listener, void *data) {
struct roots_xdg_surface_v6 *roots_xdg_surface =
wl_container_of(listener, roots_xdg_surface, request_move);
@@ -37,6 +46,19 @@ static void handle_request_move(struct wl_listener *listener, void *data) {
view_begin_move(input, event->cursor, view);
}
+static void handle_request_resize(struct wl_listener *listener, void *data) {
+ struct roots_xdg_surface_v6 *roots_xdg_surface =
+ wl_container_of(listener, roots_xdg_surface, request_resize);
+ struct roots_view *view = roots_xdg_surface->view;
+ struct roots_input *input = view->desktop->server->input;
+ struct wlr_xdg_toplevel_v6_resize_event *e = data;
+ const struct roots_input_event *event = get_input_event(input, e->serial);
+ if (!event || input->mode != ROOTS_CURSOR_PASSTHROUGH) {
+ return;
+ }
+ view_begin_resize(input, event->cursor, view, e->edges);
+}
+
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);
@@ -71,6 +93,9 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
roots_surface->request_move.notify = handle_request_move;
wl_signal_add(&surface->events.request_move, &roots_surface->request_move);
wl_list_init(&roots_surface->request_resize.link);
+ roots_surface->request_resize.notify = handle_request_resize;
+ wl_signal_add(&surface->events.request_resize,
+ &roots_surface->request_resize);
wl_list_init(&roots_surface->request_show_window_menu.link);
struct roots_view *view = calloc(1, sizeof(struct roots_view));
@@ -79,8 +104,9 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
view->xdg_surface_v6 = surface;
view->roots_xdg_surface_v6 = roots_surface;
view->wlr_surface = surface->surface;
- view->get_input_bounds = get_input_bounds;
+ view->get_size = get_size;
view->activate = activate;
+ view->resize = resize;
view->desktop = desktop;
roots_surface->view = view;
list_add(desktop->views, view);
diff --git a/rootston/xwayland.c b/rootston/xwayland.c
index 181b959d..7ecc4d4f 100644
--- a/rootston/xwayland.c
+++ b/rootston/xwayland.c
@@ -9,6 +9,13 @@
#include "rootston/desktop.h"
#include "rootston/server.h"
+static void resize(struct roots_view *view, uint32_t width, uint32_t height) {
+ assert(view->type == ROOTS_XWAYLAND_VIEW);
+ struct wlr_xwayland_surface *xwayland_surface = view->xwayland_surface;
+ wlr_xwayland_surface_configure(view->desktop->xwayland, xwayland_surface,
+ xwayland_surface->x, xwayland_surface->y, width, height);
+}
+
static void handle_destroy(struct wl_listener *listener, void *data) {
struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, destroy);
@@ -17,23 +24,18 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
free(roots_surface);
}
-static void handle_configure(struct wl_listener *listener, void *data) {
+static void handle_request_configure(struct wl_listener *listener, void *data) {
struct roots_xwayland_surface *roots_surface =
wl_container_of(listener, roots_surface, request_configure);
struct wlr_xwayland_surface *xwayland_surface =
roots_surface->view->xwayland_surface;
struct wlr_xwayland_surface_configure_event *event = data;
- xwayland_surface->x = event->x;
- xwayland_surface->y = event->y;
- xwayland_surface->width = event->width;
- xwayland_surface->height = event->height;
-
roots_surface->view->x = (double)event->x;
roots_surface->view->y = (double)event->y;
wlr_xwayland_surface_configure(roots_surface->view->desktop->xwayland,
- xwayland_surface);
+ xwayland_surface, event->x, event->y, event->width, event->height);
}
static void activate(struct roots_view *view, bool active) {
@@ -58,7 +60,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
roots_surface->destroy.notify = handle_destroy;
wl_signal_add(&surface->events.destroy, &roots_surface->destroy);
wl_list_init(&roots_surface->request_configure.link);
- roots_surface->request_configure.notify = handle_configure;
+ roots_surface->request_configure.notify = handle_request_configure;
wl_signal_add(&surface->events.request_configure,
&roots_surface->request_configure);
@@ -75,6 +77,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
view->wlr_surface = surface->surface;
view->desktop = desktop;
view->activate = activate;
+ view->resize = resize;
roots_surface->view = view;
list_add(desktop->views, view);
}