mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 22:55:58 +01:00
Add wl_shell support for maximized views
This commit is contained in:
parent
758514fe5d
commit
26dadacb71
5 changed files with 36 additions and 10 deletions
|
@ -11,9 +11,10 @@ struct roots_wl_shell_surface {
|
||||||
|
|
||||||
// TODO: Maybe destroy listener should go in roots_view
|
// TODO: Maybe destroy listener should go in roots_view
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
struct wl_listener ping_timeout;
|
|
||||||
struct wl_listener request_move;
|
struct wl_listener request_move;
|
||||||
struct wl_listener request_resize;
|
struct wl_listener request_resize;
|
||||||
|
struct wl_listener request_set_maximized;
|
||||||
|
struct wl_listener set_state;
|
||||||
|
|
||||||
struct wl_listener surface_commit;
|
struct wl_listener surface_commit;
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,6 +42,8 @@ struct wlr_wl_shell_popup_grab {
|
||||||
enum wlr_wl_shell_surface_state {
|
enum wlr_wl_shell_surface_state {
|
||||||
WLR_WL_SHELL_SURFACE_STATE_NONE,
|
WLR_WL_SHELL_SURFACE_STATE_NONE,
|
||||||
WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL,
|
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_TRANSIENT,
|
||||||
WLR_WL_SHELL_SURFACE_STATE_POPUP,
|
WLR_WL_SHELL_SURFACE_STATE_POPUP,
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,6 +49,26 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
|
||||||
view_begin_resize(input, event->cursor, view, e->edges);
|
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) {
|
static void handle_surface_commit(struct wl_listener *listener, void *data) {
|
||||||
// TODO do we need to do anything here?
|
// 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->destroy.link);
|
||||||
wl_list_remove(&roots_surface->request_move.link);
|
wl_list_remove(&roots_surface->request_move.link);
|
||||||
wl_list_remove(&roots_surface->request_resize.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);
|
view_destroy(roots_surface->view);
|
||||||
free(roots_surface);
|
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;
|
roots_surface->request_resize.notify = handle_request_resize;
|
||||||
wl_signal_add(&surface->events.request_resize,
|
wl_signal_add(&surface->events.request_resize,
|
||||||
&roots_surface->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;
|
roots_surface->surface_commit.notify = handle_surface_commit;
|
||||||
wl_signal_add(&surface->surface->events.commit,
|
wl_signal_add(&surface->surface->events.commit,
|
||||||
&roots_surface->surface_commit);
|
&roots_surface->surface_commit);
|
||||||
|
|
|
@ -171,7 +171,6 @@ static void shell_surface_destroy_popup_state(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void shell_surface_protocol_resize(struct wl_client *client,
|
static void shell_surface_protocol_resize(struct wl_client *client,
|
||||||
struct wl_resource *resource, struct wl_resource *seat_resource,
|
struct wl_resource *resource, struct wl_resource *seat_resource,
|
||||||
uint32_t serial, enum wl_shell_surface_resize edges) {
|
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);
|
output = wl_resource_get_user_data(output_resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL) {
|
shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN,
|
||||||
return;
|
NULL, NULL);
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_wl_shell_surface_set_fullscreen_event *event =
|
struct wlr_wl_shell_surface_set_fullscreen_event *event =
|
||||||
calloc(1, sizeof(struct wlr_wl_shell_surface_set_fullscreen_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);
|
output = wl_resource_get_user_data(output_resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL) {
|
shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_MAXIMIZED,
|
||||||
return;
|
NULL, NULL);
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_wl_shell_surface_set_maximized_event *event =
|
struct wlr_wl_shell_surface_set_maximized_event *event =
|
||||||
calloc(1, sizeof(struct wlr_wl_shell_surface_set_maximized_event));
|
calloc(1, sizeof(struct wlr_wl_shell_surface_set_maximized_event));
|
||||||
|
|
|
@ -839,11 +839,9 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm,
|
||||||
xsurface_set_net_wm_state(xsurface);
|
xsurface_set_net_wm_state(xsurface);
|
||||||
} else if (property == xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT] &&
|
} else if (property == xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT] &&
|
||||||
update_state(action, &xsurface->maximized_vert)) {
|
update_state(action, &xsurface->maximized_vert)) {
|
||||||
wlr_log(L_DEBUG, "cc sava");
|
|
||||||
xsurface_set_net_wm_state(xsurface);
|
xsurface_set_net_wm_state(xsurface);
|
||||||
} else if (property == xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ] &&
|
} else if (property == xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ] &&
|
||||||
update_state(action, &xsurface->maximized_horz)) {
|
update_state(action, &xsurface->maximized_horz)) {
|
||||||
wlr_log(L_DEBUG, "mwa sava");
|
|
||||||
xsurface_set_net_wm_state(xsurface);
|
xsurface_set_net_wm_state(xsurface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue