From a7446792a1a0fd9fe3391f041d7bbfe9e2b11255 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 22 Oct 2017 23:19:21 -0400 Subject: Consider scale factor when rendering views --- include/wlr/types/wlr_surface.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index ea4184aa..e1a07566 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -1,10 +1,10 @@ #ifndef WLR_TYPES_WLR_SURFACE_H #define WLR_TYPES_WLR_SURFACE_H - #include #include #include #include +#include struct wlr_frame_callback { struct wl_resource *resource; @@ -135,4 +135,8 @@ struct wlr_surface *wlr_surface_get_main_surface(struct wlr_surface *surface); */ struct wlr_subsurface *wlr_surface_subsurface_at(struct wlr_surface *surface, double sx, double sy, double *sub_x, double *sub_y); + +void wlr_surface_send_enter(struct wlr_surface *surface, + struct wlr_output *output); + #endif -- cgit v1.2.3 From a6930cd8ea2424f12aafc8d0b67426d0e5161c44 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 25 Oct 2017 22:37:02 -0400 Subject: Handle output enter/leave correctly --- include/rootston/view.h | 5 ++-- include/wlr/types/wlr_surface.h | 3 +++ rootston/desktop.c | 59 +++++++++++++++++++++++------------------ rootston/xdg_shell_v6.c | 2 +- types/wlr_output.c | 1 - types/wlr_surface.c | 13 ++++++++- 6 files changed, 51 insertions(+), 32 deletions(-) (limited to 'include/wlr') diff --git a/include/rootston/view.h b/include/rootston/view.h index 4a5e8d08..79d61ba6 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -48,7 +48,6 @@ enum roots_view_type { struct roots_view { struct roots_desktop *desktop; - struct roots_output *output; double x, y; float rotation; // TODO: Something for roots-enforced width/height @@ -72,14 +71,14 @@ struct roots_view { // configure event from the xdg_shell // If not then this should follow the typical type/impl pattern we use // elsewhere - void (*get_size)(struct roots_view *view, struct wlr_box *box); + void (*get_size)(const struct roots_view *view, struct wlr_box *box); void (*activate)(struct roots_view *view, bool active); void (*resize)(struct roots_view *view, uint32_t width, uint32_t height); void (*set_position)(struct roots_view *view, double x, double y); void (*close)(struct roots_view *view); }; -void view_get_size(struct roots_view *view, struct wlr_box *box); +void view_get_size(const struct roots_view *view, struct wlr_box *box); void view_activate(struct roots_view *view, bool active); void view_resize(struct roots_view *view, uint32_t width, uint32_t height); void view_set_position(struct roots_view *view, double x, double y); diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index e1a07566..cea53109 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -139,4 +139,7 @@ struct wlr_subsurface *wlr_surface_subsurface_at(struct wlr_surface *surface, void wlr_surface_send_enter(struct wlr_surface *surface, struct wlr_output *output); +void wlr_surface_send_leave(struct wlr_surface *surface, + struct wlr_output *output); + #endif diff --git a/rootston/desktop.c b/rootston/desktop.c index 37022ca4..0cc2180d 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -35,45 +35,52 @@ void view_destroy(struct roots_view *view) { free(view); } -void view_get_size(struct roots_view *view, struct wlr_box *box) { +void view_get_size(const struct roots_view *view, struct wlr_box *box) { if (view->get_size) { view->get_size(view, box); - return; + } else { + box->width = view->wlr_surface->current->width; + box->height = view->wlr_surface->current->height; } - box->x = box->y = 0; - box->width = view->wlr_surface->current->width; - box->height = view->wlr_surface->current->height; + box->x = view->x; + box->y = view->y; } -static void view_update_output(struct roots_view *view) { +static void view_update_output(const struct roots_view *view, + const struct wlr_box *before) { struct roots_desktop *desktop = view->desktop; - struct roots_output *output = NULL, *_output; + struct roots_output *output; struct wlr_box box; view_get_size(view, &box); - wl_list_for_each(_output, &desktop->outputs, link) { - if (!wlr_output_layout_intersects(desktop->layout, _output->wlr_output, - view->x, view->y, view->x + box.width, view->x + box.height)) { - continue; + wl_list_for_each(output, &desktop->outputs, link) { + bool intersected = before->x != -1 && wlr_output_layout_intersects( + desktop->layout, output->wlr_output, + before->x, before->y, before->x + before->width, + before->y + before->height); + bool intersects = wlr_output_layout_intersects( + desktop->layout, output->wlr_output, + view->x, view->y, view->x + box.width, view->y + box.height); + if (intersected && !intersects) { + wlr_log(L_DEBUG, "Leaving output %s", output->wlr_output->name); + wlr_surface_send_leave(view->wlr_surface, output->wlr_output); } - if (output == NULL - || output->wlr_output->scale < _output->wlr_output->scale) { - output = _output; + if (!intersected && intersects) { + wlr_log(L_DEBUG, "Entering output %s", output->wlr_output->name); + wlr_surface_send_enter(view->wlr_surface, output->wlr_output); } } - if (output && output != view->output) { - view->output = output; - wlr_surface_send_enter(view->wlr_surface, output->wlr_output); - } } void view_set_position(struct roots_view *view, double x, double y) { + struct wlr_box before; + view_get_size(view, &before); if (view->set_position) { view->set_position(view, x, y); } else { view->x = x; view->y = y; } - view_update_output(view); + view_update_output(view, &before); } void view_activate(struct roots_view *view, bool activate) { @@ -83,10 +90,12 @@ void view_activate(struct roots_view *view, bool activate) { } void view_resize(struct roots_view *view, uint32_t width, uint32_t height) { + struct wlr_box before; + view_get_size(view, &before); if (view->resize) { view->resize(view, width, height); } - view_update_output(view); + view_update_output(view, &before); } void view_close(struct roots_view *view) { @@ -96,8 +105,8 @@ void view_close(struct roots_view *view) { } bool view_center(struct roots_view *view) { - struct wlr_box size; - view_get_size(view, &size); + struct wlr_box box; + view_get_size(view, &box); struct roots_desktop *desktop = view->desktop; struct wlr_cursor *cursor = desktop->server->input->cursor; @@ -122,16 +131,14 @@ bool view_center(struct roots_view *view) { double view_x = (double)(width - size.width) / 2 + l_output->x; double view_y = (double)(height - size.height) / 2 + l_output->y; - view_set_position(view, view_x, view_y); return true; } -void view_setup(struct roots_view *view) { - view_center(view); - +void view_initialize(struct roots_view *view) { struct roots_input *input = view->desktop->server->input; + view_center(view); set_view_focus(input, view->desktop, view); wlr_seat_keyboard_notify_enter(input->wl_seat, view->wlr_surface); view_update_output(view); diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index 704ccb1e..2d83019f 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -10,7 +10,7 @@ #include "rootston/server.h" #include "rootston/input.h" -static void get_size(struct roots_view *view, struct wlr_box *box) { +static void get_size(const 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 diff --git a/types/wlr_output.c b/types/wlr_output.c index dd7e8d6a..d6efd9bf 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -43,7 +43,6 @@ static void wl_output_send_to_resource(struct wl_resource *resource) { } } if (version >= WL_OUTPUT_SCALE_SINCE_VERSION) { - wlr_log(L_DEBUG, "Sending scale"); wl_output_send_scale(resource, output->scale); } if (version >= WL_OUTPUT_DONE_SINCE_VERSION) { diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 28f3d05b..a21be8de 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -901,9 +901,20 @@ void wlr_surface_send_enter(struct wlr_surface *surface, struct wl_resource *resource; wl_resource_for_each(resource, &output->wl_resources) { if (client == wl_resource_get_client(resource)) { - wlr_log(L_DEBUG, "sending output enter"); wl_surface_send_enter(surface->resource, resource); break; } } } + +void wlr_surface_send_leave(struct wlr_surface *surface, + struct wlr_output *output) { + struct wl_client *client = wl_resource_get_client(surface->resource); + struct wl_resource *resource; + wl_resource_for_each(resource, &output->wl_resources) { + if (client == wl_resource_get_client(resource)) { + wl_surface_send_leave(surface->resource, resource); + break; + } + } +} -- cgit v1.2.3 From 6d8e1abfc0a266e8ff1a8c9ba1a004faeaac79d5 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sat, 4 Nov 2017 01:35:12 -0400 Subject: Improve input sensitivity We now use doubles until the last minute, which makes it so we can move the pointer more precisely. This also includes a fix for tablet tools, which move absolutely and sometimes do not update the X or Y axis. --- backend/libinput/tablet_tool.c | 2 ++ include/wlr/types/wlr_output.h | 5 +++-- rootston/cursor.c | 9 +++++++++ types/wlr_cursor.c | 4 ++-- types/wlr_output.c | 6 ++++-- 5 files changed, 20 insertions(+), 6 deletions(-) (limited to 'include/wlr') diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index 3caaf3f7..3d5fafc3 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -70,6 +70,8 @@ void handle_tablet_tool_axis(struct libinput_event *event, wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_WHEEL; wlr_event.wheel_delta = libinput_event_tablet_tool_get_wheel_delta(tevent); } + wlr_log(L_DEBUG, "Tablet tool axis event %d @ %f,%f", + wlr_event.updated_axes, wlr_event.x_mm, wlr_event.y_mm); wl_signal_emit(&wlr_dev->tablet_tool->events.axis, &wlr_event); } diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index e6323f9c..df123639 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -14,7 +14,7 @@ struct wlr_output_mode { struct wlr_output_cursor { struct wlr_output *output; - int32_t x, y; + double x, y; bool enabled; uint32_t width, height; int32_t hotspot_x, hotspot_y; @@ -95,7 +95,8 @@ bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor, int32_t hotspot_x, int32_t hotspot_y); void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor, struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y); -bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y); +bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, + double x, double y); void wlr_output_cursor_destroy(struct wlr_output_cursor *cursor); #endif diff --git a/rootston/cursor.c b/rootston/cursor.c index 31001a9f..aa8e5122 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -378,11 +378,20 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) { static void handle_tool_axis(struct wl_listener *listener, void *data) { struct roots_input *input = wl_container_of(listener, input, cursor_tool_axis); struct wlr_event_tablet_tool_axis *event = data; + if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X) && (event->updated_axes & WLR_TABLET_TOOL_AXIS_Y)) { wlr_cursor_warp_absolute(input->cursor, event->device, event->x_mm / event->width_mm, event->y_mm / event->height_mm); cursor_update_position(input, event->time_msec); + } else if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X)) { + wlr_cursor_warp_absolute(input->cursor, event->device, + event->x_mm / event->width_mm, -1); + cursor_update_position(input, event->time_msec); + } else if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_Y)) { + wlr_cursor_warp_absolute(input->cursor, event->device, + -1, event->y_mm / event->height_mm); + cursor_update_position(input, event->time_msec); } } diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c index 83d36d14..dfaccb53 100644 --- a/types/wlr_cursor.c +++ b/types/wlr_cursor.c @@ -261,8 +261,8 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur, mapping = wlr_output_layout_get_box(cur->state->layout, NULL); } - double x = mapping->width * x_mm + mapping->x; - double y = mapping->height * y_mm + mapping->y; + double x = x_mm > 0 ? mapping->width * x_mm + mapping->x : cur->x; + double y = y_mm > 0 ? mapping->height * y_mm + mapping->y : cur->y; wlr_cursor_warp_unchecked(cur, x, y); } diff --git a/types/wlr_output.c b/types/wlr_output.c index ff8b07be..3ad69ce3 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -472,9 +472,11 @@ void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor, } } -bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y) { +bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, + double x, double y) { x *= cursor->output->scale; y *= cursor->output->scale; + wlr_log(L_DEBUG, "Moving cursor to %f,%f", x, y); cursor->x = x; cursor->y = y; @@ -486,7 +488,7 @@ bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y) { if (!cursor->output->impl->move_cursor) { return false; } - return cursor->output->impl->move_cursor(cursor->output, x, y); + return cursor->output->impl->move_cursor(cursor->output, (int)x, (int)y); } struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output) { -- cgit v1.2.3 From 26dadacb7199d28af672cca3f91713e173a41258 Mon Sep 17 00:00:00 2001 From: emersion Date: Thu, 9 Nov 2017 20:06:05 +0100 Subject: Add wl_shell support for maximized views --- include/rootston/view.h | 3 ++- include/wlr/types/wlr_wl_shell.h | 2 ++ rootston/wl_shell.c | 28 ++++++++++++++++++++++++++++ types/wlr_wl_shell.c | 11 ++++------- xwayland/xwm.c | 2 -- 5 files changed, 36 insertions(+), 10 deletions(-) (limited to 'include/wlr') diff --git a/include/rootston/view.h b/include/rootston/view.h index f6ac0d23..1b0fb831 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -11,9 +11,10 @@ struct roots_wl_shell_surface { // TODO: Maybe destroy listener should go in roots_view struct wl_listener destroy; - struct wl_listener ping_timeout; struct wl_listener request_move; struct wl_listener request_resize; + struct wl_listener request_set_maximized; + struct wl_listener set_state; struct wl_listener surface_commit; }; diff --git a/include/wlr/types/wlr_wl_shell.h b/include/wlr/types/wlr_wl_shell.h index 4e814817..1f0630f2 100644 --- a/include/wlr/types/wlr_wl_shell.h +++ b/include/wlr/types/wlr_wl_shell.h @@ -42,6 +42,8 @@ struct wlr_wl_shell_popup_grab { enum wlr_wl_shell_surface_state { WLR_WL_SHELL_SURFACE_STATE_NONE, WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL, + WLR_WL_SHELL_SURFACE_STATE_MAXIMIZED, + WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN, WLR_WL_SHELL_SURFACE_STATE_TRANSIENT, WLR_WL_SHELL_SURFACE_STATE_POPUP, }; diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c index e38eb697..3ac8fe61 100644 --- a/rootston/wl_shell.c +++ b/rootston/wl_shell.c @@ -49,6 +49,26 @@ static void handle_request_resize(struct wl_listener *listener, void *data) { view_begin_resize(input, event->cursor, view, e->edges); } +static void handle_request_set_maximized(struct wl_listener *listener, + void *data) { + struct roots_wl_shell_surface *roots_surface = + wl_container_of(listener, roots_surface, request_set_maximized); + struct roots_view *view = roots_surface->view; + //struct wlr_wl_shell_surface_set_maximized_event *e = data; + view_maximize(view, true); +} + +static void handle_set_state(struct wl_listener *listener, void *data) { + struct roots_wl_shell_surface *roots_surface = + wl_container_of(listener, roots_surface, set_state); + struct roots_view *view = roots_surface->view; + struct wlr_wl_shell_surface *surface = view->wl_shell_surface; + if (view->maximized && + surface->state != WLR_WL_SHELL_SURFACE_STATE_MAXIMIZED) { + view_maximize(view, false); + } +} + static void handle_surface_commit(struct wl_listener *listener, void *data) { // TODO do we need to do anything here? } @@ -60,6 +80,9 @@ static void handle_destroy(struct wl_listener *listener, void *data) { wl_list_remove(&roots_surface->destroy.link); wl_list_remove(&roots_surface->request_move.link); wl_list_remove(&roots_surface->request_resize.link); + wl_list_remove(&roots_surface->request_set_maximized.link); + wl_list_remove(&roots_surface->set_state.link); + wl_list_remove(&roots_surface->surface_commit.link); view_destroy(roots_surface->view); free(roots_surface); } @@ -93,6 +116,11 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) { roots_surface->request_resize.notify = handle_request_resize; wl_signal_add(&surface->events.request_resize, &roots_surface->request_resize); + roots_surface->request_set_maximized.notify = handle_request_set_maximized; + wl_signal_add(&surface->events.request_set_maximized, + &roots_surface->request_set_maximized); + roots_surface->set_state.notify = handle_set_state; + wl_signal_add(&surface->events.set_state, &roots_surface->set_state); roots_surface->surface_commit.notify = handle_surface_commit; wl_signal_add(&surface->surface->events.commit, &roots_surface->surface_commit); diff --git a/types/wlr_wl_shell.c b/types/wlr_wl_shell.c index fe61075e..f0287ba9 100644 --- a/types/wlr_wl_shell.c +++ b/types/wlr_wl_shell.c @@ -171,7 +171,6 @@ static void shell_surface_destroy_popup_state( } } - static void shell_surface_protocol_resize(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat_resource, uint32_t serial, enum wl_shell_surface_resize edges) { @@ -287,9 +286,8 @@ static void shell_surface_protocol_set_fullscreen(struct wl_client *client, output = wl_resource_get_user_data(output_resource); } - if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL) { - return; - } + shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN, + NULL, NULL); struct wlr_wl_shell_surface_set_fullscreen_event *event = calloc(1, sizeof(struct wlr_wl_shell_surface_set_fullscreen_event)); @@ -377,9 +375,8 @@ static void shell_surface_protocol_set_maximized(struct wl_client *client, output = wl_resource_get_user_data(output_resource); } - if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL) { - return; - } + shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_MAXIMIZED, + NULL, NULL); struct wlr_wl_shell_surface_set_maximized_event *event = calloc(1, sizeof(struct wlr_wl_shell_surface_set_maximized_event)); diff --git a/xwayland/xwm.c b/xwayland/xwm.c index e5806d5b..dff9fac2 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -839,11 +839,9 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm, xsurface_set_net_wm_state(xsurface); } else if (property == xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT] && update_state(action, &xsurface->maximized_vert)) { - wlr_log(L_DEBUG, "cc sava"); xsurface_set_net_wm_state(xsurface); } else if (property == xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ] && update_state(action, &xsurface->maximized_horz)) { - wlr_log(L_DEBUG, "mwa sava"); xsurface_set_net_wm_state(xsurface); } } -- cgit v1.2.3 From bf1b12a72500fb8cb41cbc60d29e602c25c97fc2 Mon Sep 17 00:00:00 2001 From: emersion Date: Thu, 9 Nov 2017 21:41:11 +0100 Subject: Fix maximize delay in xdg-shell --- include/rootston/view.h | 1 + include/wlr/types/wlr_xdg_shell_v6.h | 2 ++ rootston/xdg_shell_v6.c | 19 ++++++++++++++----- types/wlr_xdg_shell_v6.c | 6 ++++++ 4 files changed, 23 insertions(+), 5 deletions(-) (limited to 'include/wlr') diff --git a/include/rootston/view.h b/include/rootston/view.h index 1b0fb831..956ba1d3 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -27,6 +27,7 @@ struct roots_xdg_surface_v6 { struct wl_listener destroy; struct wl_listener request_move; struct wl_listener request_resize; + struct wl_listener request_maximize; }; struct roots_xwayland_surface { diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index b0de41e2..bc78428b 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -126,6 +126,8 @@ struct wlr_xdg_surface_v6 { struct wl_signal ack_configure; struct wl_signal ping_timeout; + struct wl_signal request_maximize; + struct wl_signal request_fullscreen; struct wl_signal request_minimize; struct wl_signal request_move; struct wl_signal request_resize; diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index 45691d16..a86899be 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -128,9 +128,9 @@ static void handle_request_resize(struct wl_listener *listener, void *data) { view_begin_resize(input, event->cursor, view, e->edges); } -static void handle_commit(struct wl_listener *listener, void *data) { +static void handle_request_maximize(struct wl_listener *listener, void *data) { struct roots_xdg_surface_v6 *roots_xdg_surface = - wl_container_of(listener, roots_xdg_surface, commit); + wl_container_of(listener, roots_xdg_surface, request_maximize); struct roots_view *view = roots_xdg_surface->view; struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6; @@ -138,9 +138,15 @@ static void handle_commit(struct wl_listener *listener, void *data) { return; } - if (view->maximized != surface->toplevel_state->current.maximized) { - view_maximize(view, surface->toplevel_state->current.maximized); - } + view_maximize(view, surface->toplevel_state->next.maximized); +} + +static void handle_commit(struct wl_listener *listener, void *data) { + //struct roots_xdg_surface_v6 *roots_xdg_surface = + // wl_container_of(listener, roots_xdg_surface, commit); + //struct roots_view *view = roots_xdg_surface->view; + //struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6; + // TODO } static void handle_destroy(struct wl_listener *listener, void *data) { @@ -185,6 +191,9 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { roots_surface->request_resize.notify = handle_request_resize; wl_signal_add(&surface->events.request_resize, &roots_surface->request_resize); + roots_surface->request_maximize.notify = handle_request_maximize; + wl_signal_add(&surface->events.request_maximize, + &roots_surface->request_maximize); struct roots_view *view = calloc(1, sizeof(struct roots_view)); if (!view) { diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c index fc45bc17..c260fd5e 100644 --- a/types/wlr_xdg_shell_v6.c +++ b/types/wlr_xdg_shell_v6.c @@ -667,24 +667,28 @@ static void xdg_toplevel_protocol_set_maximized(struct wl_client *client, struct wl_resource *resource) { struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource); surface->toplevel_state->next.maximized = true; + wl_signal_emit(&surface->events.request_maximize, surface); } static void xdg_toplevel_protocol_unset_maximized(struct wl_client *client, struct wl_resource *resource) { struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource); surface->toplevel_state->next.maximized = false; + wl_signal_emit(&surface->events.request_maximize, surface); } static void xdg_toplevel_protocol_set_fullscreen(struct wl_client *client, struct wl_resource *resource, struct wl_resource *output_resource) { struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource); surface->toplevel_state->next.fullscreen = true; + wl_signal_emit(&surface->events.request_fullscreen, surface); } static void xdg_toplevel_protocol_unset_fullscreen(struct wl_client *client, struct wl_resource *resource) { struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource); surface->toplevel_state->next.fullscreen = false; + wl_signal_emit(&surface->events.request_fullscreen, surface); } static void xdg_toplevel_protocol_set_minimized(struct wl_client *client, @@ -1146,6 +1150,8 @@ static void xdg_shell_get_xdg_surface(struct wl_client *wl_client, wl_list_init(&surface->configure_list); wl_list_init(&surface->popups); + wl_signal_init(&surface->events.request_maximize); + wl_signal_init(&surface->events.request_fullscreen); wl_signal_init(&surface->events.request_minimize); wl_signal_init(&surface->events.request_move); wl_signal_init(&surface->events.request_resize); -- cgit v1.2.3 From 80bf3cfff05d3ddabf75b2e53ed040aff0bbae62 Mon Sep 17 00:00:00 2001 From: Timidger Date: Thu, 9 Nov 2017 18:38:13 -0800 Subject: Fixes #399 Adds wlr_data_device_manager destructor Fixed issues --- include/wlr/types/wlr_data_device.h | 5 +++++ types/wlr_data_device.c | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h index 691e2df8..f45c15a2 100644 --- a/include/wlr/types/wlr_data_device.h +++ b/include/wlr/types/wlr_data_device.h @@ -74,6 +74,11 @@ struct wlr_drag { struct wlr_data_device_manager *wlr_data_device_manager_create( struct wl_display *display); +/** + * Destroys a wlr_data_device_manager and removes its wl_data_device_manager global. + */ +void wlr_data_device_manager_destroy(struct wlr_data_device_manager *manager); + /** * Creates a new wl_data_offer if there is a wl_data_source currently set as * the seat selection and sends it to the seat client, followed by the diff --git a/types/wlr_data_device.c b/types/wlr_data_device.c index ea28ef50..df18317b 100644 --- a/types/wlr_data_device.c +++ b/types/wlr_data_device.c @@ -815,3 +815,11 @@ struct wlr_data_device_manager *wlr_data_device_manager_create( return manager; } + +void wlr_data_device_manager_destroy(struct wlr_data_device_manager *manager) { + if (!manager) { + return; + } + wl_global_destroy(manager->global); + free(manager); +} -- cgit v1.2.3 From 5be11a5c95457c6d4f6cd9720162f962286c2258 Mon Sep 17 00:00:00 2001 From: Eric Molitor Date: Fri, 10 Nov 2017 15:12:00 +0000 Subject: Remove VLA from session.h VLAs are optional C11 features and not supported by C++. --- backend/session/session.c | 2 +- include/wlr/backend/session.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include/wlr') diff --git a/backend/session/session.c b/backend/session/session.c index b14ca4d0..760830c3 100644 --- a/backend/session/session.c +++ b/backend/session/session.c @@ -257,7 +257,7 @@ static size_t explicit_find_gpus(struct wlr_session *session, * If it's not found, it returns the first valid GPU it finds. */ size_t wlr_session_find_gpus(struct wlr_session *session, - size_t ret_len, int ret[static ret_len]) { + size_t ret_len, int *ret) { const char *explicit = getenv("WLR_DRM_DEVICES"); if (explicit) { return explicit_find_gpus(session, ret_len, ret, explicit); diff --git a/include/wlr/backend/session.h b/include/wlr/backend/session.h index 94002bc5..5c822ea9 100644 --- a/include/wlr/backend/session.h +++ b/include/wlr/backend/session.h @@ -79,6 +79,6 @@ void wlr_session_signal_add(struct wlr_session *session, int fd, bool wlr_session_change_vt(struct wlr_session *session, unsigned vt); size_t wlr_session_find_gpus(struct wlr_session *session, - size_t ret_len, int ret[static ret_len]); + size_t ret_len, int *ret); #endif -- cgit v1.2.3