mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-17 06:59:52 -05:00
opt: Distinguish whether to maximize based on the client's request
This commit is contained in:
parent
9e41545ed5
commit
e658274b71
2 changed files with 23 additions and 35 deletions
|
|
@ -475,6 +475,18 @@ static inline bool client_request_minimize(Client *c, void *data) {
|
||||||
return c->surface.xdg->toplevel->requested.minimized;
|
return c->surface.xdg->toplevel->requested.minimized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool client_request_maximize(Client *c, void *data) {
|
||||||
|
|
||||||
|
#ifdef XWAYLAND
|
||||||
|
if (client_is_x11(c)) {
|
||||||
|
struct wlr_xwayland_surface *surface = c->surface.xwayland;
|
||||||
|
return surface->maximized_vert || surface->maximized_horz;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return c->surface.xdg->toplevel->requested.maximized;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void client_set_size_bound(Client *c) {
|
static inline void client_set_size_bound(Client *c) {
|
||||||
struct wlr_xdg_toplevel *toplevel;
|
struct wlr_xdg_toplevel *toplevel;
|
||||||
struct wlr_xdg_toplevel_state state;
|
struct wlr_xdg_toplevel_state state;
|
||||||
|
|
|
||||||
46
src/mango.c
46
src/mango.c
|
|
@ -3568,31 +3568,22 @@ mapnotify(struct wl_listener *listener, void *data) {
|
||||||
printstatus();
|
printstatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void // 0.5 custom
|
void maximizenotify(struct wl_listener *listener, void *data) {
|
||||||
maximizenotify(struct wl_listener *listener, void *data) {
|
|
||||||
/* This event is raised when a client would like to maximize itself,
|
|
||||||
* typically because the user clicked on the maximize button on
|
|
||||||
* client-side decorations. dwl doesn't support maximization, but
|
|
||||||
* to conform to xdg-shell protocol we still must send a configure.
|
|
||||||
* Since xdg-shell protocol v5 we should ignore request of unsupported
|
|
||||||
* capabilities, just schedule a empty configure when the client uses <5
|
|
||||||
* protocol version
|
|
||||||
* wlr_xdg_surface_schedule_configure() is used to send an empty reply.
|
|
||||||
*/
|
|
||||||
// Client *c = wl_container_of(listener, c, maximize);
|
|
||||||
// if (wl_resource_get_version(c->surface.xdg->toplevel->resource)
|
|
||||||
// < XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION)
|
|
||||||
// wlr_xdg_surface_schedule_configure(c->surface.xdg);
|
|
||||||
// togglemaximizescreen(&(Arg){0});
|
|
||||||
Client *c = wl_container_of(listener, c, maximize);
|
Client *c = wl_container_of(listener, c, maximize);
|
||||||
|
|
||||||
if (!c || !c->mon || c->iskilling || c->ignore_maximize)
|
if (!c || !c->mon || c->iskilling || c->ignore_maximize)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (c->ismaximizescreen || c->isfullscreen)
|
if (!client_is_x11(c) && !c->surface.xdg->initialized) {
|
||||||
setmaximizescreen(c, 0);
|
return;
|
||||||
else
|
}
|
||||||
|
|
||||||
|
if (client_request_maximize(c, data)) {
|
||||||
setmaximizescreen(c, 1);
|
setmaximizescreen(c, 1);
|
||||||
|
} else {
|
||||||
|
setmaximizescreen(c, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unminimize(Client *c) {
|
void unminimize(Client *c) {
|
||||||
|
|
@ -3636,22 +3627,7 @@ void set_minimized(Client *c) {
|
||||||
wl_list_insert(clients.prev, &c->link); // 插入尾部
|
wl_list_insert(clients.prev, &c->link); // 插入尾部
|
||||||
}
|
}
|
||||||
|
|
||||||
void // 0.5 custom
|
void minimizenotify(struct wl_listener *listener, void *data) {
|
||||||
minimizenotify(struct wl_listener *listener, void *data) {
|
|
||||||
/* This event is raised when a client would like to maximize itself,
|
|
||||||
* typically because the user clicked on the maximize button on
|
|
||||||
* client-side decorations. dwl doesn't support maximization, but
|
|
||||||
* to conform to xdg-shell protocol we still must send a configure.
|
|
||||||
* Since xdg-shell protocol v5 we should ignore request of unsupported
|
|
||||||
* capabilities, just schedule a empty configure when the client uses <5
|
|
||||||
* protocol version
|
|
||||||
* wlr_xdg_surface_schedule_configure() is used to send an empty reply.
|
|
||||||
*/
|
|
||||||
// Client *c = wl_container_of(listener, c, maximize);
|
|
||||||
// if (wl_resource_get_version(c->surface.xdg->toplevel->resource)
|
|
||||||
// < XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION)
|
|
||||||
// wlr_xdg_surface_schedule_configure(c->surface.xdg);
|
|
||||||
// togglemaximizescreen(&(Arg){0});
|
|
||||||
|
|
||||||
Client *c = wl_container_of(listener, c, minimize);
|
Client *c = wl_container_of(listener, c, minimize);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue