mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
format code index to tab no space
This commit is contained in:
parent
0af8799a2d
commit
5aaf8d7625
11 changed files with 8896 additions and 8749 deletions
4
.clang-format
Normal file
4
.clang-format
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
UseTab: Always
|
||||||
|
TabWidth: 4
|
||||||
|
IndentWidth: 4
|
||||||
|
|
@ -8,405 +8,413 @@
|
||||||
/* Leave these functions first; they're used in the others */
|
/* Leave these functions first; they're used in the others */
|
||||||
static inline int client_is_x11(Client *c) {
|
static inline int client_is_x11(Client *c) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
return c->type == X11;
|
return c->type == X11;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct wlr_surface *client_surface(Client *c) {
|
static inline struct wlr_surface *client_surface(Client *c) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c))
|
if (client_is_x11(c))
|
||||||
return c->surface.xwayland->surface;
|
return c->surface.xwayland->surface;
|
||||||
#endif
|
#endif
|
||||||
return c->surface.xdg->surface;
|
return c->surface.xdg->surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int toplevel_from_wlr_surface(struct wlr_surface *s, Client **pc,
|
static inline int toplevel_from_wlr_surface(struct wlr_surface *s, Client **pc,
|
||||||
LayerSurface **pl) {
|
LayerSurface **pl) {
|
||||||
struct wlr_xdg_surface *xdg_surface, *tmp_xdg_surface;
|
struct wlr_xdg_surface *xdg_surface, *tmp_xdg_surface;
|
||||||
struct wlr_surface *root_surface;
|
struct wlr_surface *root_surface;
|
||||||
struct wlr_layer_surface_v1 *layer_surface;
|
struct wlr_layer_surface_v1 *layer_surface;
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
LayerSurface *l = NULL;
|
LayerSurface *l = NULL;
|
||||||
int type = -1;
|
int type = -1;
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
struct wlr_xwayland_surface *xsurface;
|
struct wlr_xwayland_surface *xsurface;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
return -1;
|
return -1;
|
||||||
root_surface = wlr_surface_get_root_surface(s);
|
root_surface = wlr_surface_get_root_surface(s);
|
||||||
|
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(root_surface))) {
|
if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(root_surface))) {
|
||||||
c = xsurface->data;
|
c = xsurface->data;
|
||||||
type = c->type;
|
type = c->type;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((layer_surface =
|
if ((layer_surface =
|
||||||
wlr_layer_surface_v1_try_from_wlr_surface(root_surface))) {
|
wlr_layer_surface_v1_try_from_wlr_surface(root_surface))) {
|
||||||
l = layer_surface->data;
|
l = layer_surface->data;
|
||||||
type = LayerShell;
|
type = LayerShell;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
xdg_surface = wlr_xdg_surface_try_from_wlr_surface(root_surface);
|
xdg_surface = wlr_xdg_surface_try_from_wlr_surface(root_surface);
|
||||||
while (xdg_surface) {
|
while (xdg_surface) {
|
||||||
tmp_xdg_surface = NULL;
|
tmp_xdg_surface = NULL;
|
||||||
switch (xdg_surface->role) {
|
switch (xdg_surface->role) {
|
||||||
case WLR_XDG_SURFACE_ROLE_POPUP:
|
case WLR_XDG_SURFACE_ROLE_POPUP:
|
||||||
if (!xdg_surface->popup || !xdg_surface->popup->parent)
|
if (!xdg_surface->popup || !xdg_surface->popup->parent)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
tmp_xdg_surface =
|
tmp_xdg_surface = wlr_xdg_surface_try_from_wlr_surface(
|
||||||
wlr_xdg_surface_try_from_wlr_surface(xdg_surface->popup->parent);
|
xdg_surface->popup->parent);
|
||||||
|
|
||||||
if (!tmp_xdg_surface)
|
if (!tmp_xdg_surface)
|
||||||
return toplevel_from_wlr_surface(xdg_surface->popup->parent, pc, pl);
|
return toplevel_from_wlr_surface(xdg_surface->popup->parent, pc,
|
||||||
|
pl);
|
||||||
|
|
||||||
xdg_surface = tmp_xdg_surface;
|
xdg_surface = tmp_xdg_surface;
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
||||||
c = xdg_surface->data;
|
c = xdg_surface->data;
|
||||||
type = c->type;
|
type = c->type;
|
||||||
goto end;
|
goto end;
|
||||||
case WLR_XDG_SURFACE_ROLE_NONE:
|
case WLR_XDG_SURFACE_ROLE_NONE:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (pl)
|
if (pl)
|
||||||
*pl = l;
|
*pl = l;
|
||||||
if (pc)
|
if (pc)
|
||||||
*pc = c;
|
*pc = c;
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The others */
|
/* The others */
|
||||||
static inline void client_activate_surface(struct wlr_surface *s,
|
static inline void client_activate_surface(struct wlr_surface *s,
|
||||||
int activated) {
|
int activated) {
|
||||||
struct wlr_xdg_toplevel *toplevel;
|
struct wlr_xdg_toplevel *toplevel;
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
struct wlr_xwayland_surface *xsurface;
|
struct wlr_xwayland_surface *xsurface;
|
||||||
if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(s))) {
|
if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(s))) {
|
||||||
wlr_xwayland_surface_activate(xsurface, activated);
|
wlr_xwayland_surface_activate(xsurface, activated);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if ((toplevel = wlr_xdg_toplevel_try_from_wlr_surface(s)))
|
if ((toplevel = wlr_xdg_toplevel_try_from_wlr_surface(s)))
|
||||||
wlr_xdg_toplevel_set_activated(toplevel, activated);
|
wlr_xdg_toplevel_set_activated(toplevel, activated);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t client_set_bounds(Client *c, int32_t width,
|
static inline uint32_t client_set_bounds(Client *c, int32_t width,
|
||||||
int32_t height) {
|
int32_t height) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c))
|
if (client_is_x11(c))
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
if (wl_resource_get_version(c->surface.xdg->toplevel->resource) >=
|
if (wl_resource_get_version(c->surface.xdg->toplevel->resource) >=
|
||||||
XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION &&
|
XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION &&
|
||||||
width >= 0 && height >= 0 &&
|
width >= 0 && height >= 0 &&
|
||||||
(c->bounds.width != width || c->bounds.height != height)) {
|
(c->bounds.width != width || c->bounds.height != height)) {
|
||||||
c->bounds.width = width;
|
c->bounds.width = width;
|
||||||
c->bounds.height = height;
|
c->bounds.height = height;
|
||||||
return wlr_xdg_toplevel_set_bounds(c->surface.xdg->toplevel, width, height);
|
return wlr_xdg_toplevel_set_bounds(c->surface.xdg->toplevel, width,
|
||||||
}
|
height);
|
||||||
return 0;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const char *client_get_appid(Client *c) {
|
static inline const char *client_get_appid(Client *c) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c))
|
if (client_is_x11(c))
|
||||||
return c->surface.xwayland->class ? c->surface.xwayland->class : "broken";
|
return c->surface.xwayland->class ? c->surface.xwayland->class
|
||||||
|
: "broken";
|
||||||
#endif
|
#endif
|
||||||
return c->surface.xdg->toplevel->app_id ? c->surface.xdg->toplevel->app_id
|
return c->surface.xdg->toplevel->app_id ? c->surface.xdg->toplevel->app_id
|
||||||
: "broken";
|
: "broken";
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int client_get_pid(Client *c) {
|
static inline int client_get_pid(Client *c) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c))
|
if (client_is_x11(c))
|
||||||
return c->surface.xwayland->pid;
|
return c->surface.xwayland->pid;
|
||||||
#endif
|
#endif
|
||||||
wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL);
|
wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL);
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void client_get_clip(Client *c, struct wlr_box *clip) {
|
static inline void client_get_clip(Client *c, struct wlr_box *clip) {
|
||||||
*clip = (struct wlr_box){
|
*clip = (struct wlr_box){
|
||||||
.x = 0,
|
.x = 0,
|
||||||
.y = 0,
|
.y = 0,
|
||||||
.width = c->geom.width - c->bw,
|
.width = c->geom.width - c->bw,
|
||||||
.height = c->geom.height - c->bw,
|
.height = c->geom.height - c->bw,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c))
|
if (client_is_x11(c))
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
clip->x = c->surface.xdg->geometry.x;
|
clip->x = c->surface.xdg->geometry.x;
|
||||||
clip->y = c->surface.xdg->geometry.y;
|
clip->y = c->surface.xdg->geometry.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void client_get_geometry(Client *c, struct wlr_box *geom) {
|
static inline void client_get_geometry(Client *c, struct wlr_box *geom) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
if (client_is_x11(c)) {
|
||||||
geom->x = c->surface.xwayland->x;
|
geom->x = c->surface.xwayland->x;
|
||||||
geom->y = c->surface.xwayland->y;
|
geom->y = c->surface.xwayland->y;
|
||||||
geom->width = c->surface.xwayland->width;
|
geom->width = c->surface.xwayland->width;
|
||||||
geom->height = c->surface.xwayland->height;
|
geom->height = c->surface.xwayland->height;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
*geom = c->surface.xdg->geometry;
|
*geom = c->surface.xdg->geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Client *client_get_parent(Client *c) {
|
static inline Client *client_get_parent(Client *c) {
|
||||||
Client *p = NULL;
|
Client *p = NULL;
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
if (client_is_x11(c)) {
|
||||||
if (c->surface.xwayland->parent)
|
if (c->surface.xwayland->parent)
|
||||||
toplevel_from_wlr_surface(c->surface.xwayland->parent->surface, &p, NULL);
|
toplevel_from_wlr_surface(c->surface.xwayland->parent->surface, &p,
|
||||||
return p;
|
NULL);
|
||||||
}
|
return p;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (c->surface.xdg->toplevel->parent)
|
if (c->surface.xdg->toplevel->parent)
|
||||||
toplevel_from_wlr_surface(c->surface.xdg->toplevel->parent->base->surface,
|
toplevel_from_wlr_surface(
|
||||||
&p, NULL);
|
c->surface.xdg->toplevel->parent->base->surface, &p, NULL);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int client_has_children(Client *c) {
|
static inline int client_has_children(Client *c) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c))
|
if (client_is_x11(c))
|
||||||
return !wl_list_empty(&c->surface.xwayland->children);
|
return !wl_list_empty(&c->surface.xwayland->children);
|
||||||
#endif
|
#endif
|
||||||
/* surface.xdg->link is never empty because it always contains at least the
|
/* surface.xdg->link is never empty because it always contains at least the
|
||||||
* surface itself. */
|
* surface itself. */
|
||||||
return wl_list_length(&c->surface.xdg->link) > 1;
|
return wl_list_length(&c->surface.xdg->link) > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const char *client_get_title(Client *c) {
|
static inline const char *client_get_title(Client *c) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c))
|
if (client_is_x11(c))
|
||||||
return c->surface.xwayland->title ? c->surface.xwayland->title : "broken";
|
return c->surface.xwayland->title ? c->surface.xwayland->title
|
||||||
|
: "broken";
|
||||||
#endif
|
#endif
|
||||||
return c->surface.xdg->toplevel->title ? c->surface.xdg->toplevel->title
|
return c->surface.xdg->toplevel->title ? c->surface.xdg->toplevel->title
|
||||||
: "broken";
|
: "broken";
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int client_is_float_type(Client *c) {
|
static inline int client_is_float_type(Client *c) {
|
||||||
struct wlr_xdg_toplevel *toplevel;
|
struct wlr_xdg_toplevel *toplevel;
|
||||||
struct wlr_xdg_toplevel_state state;
|
struct wlr_xdg_toplevel_state state;
|
||||||
|
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
if (client_is_x11(c)) {
|
||||||
struct wlr_xwayland_surface *surface = c->surface.xwayland;
|
struct wlr_xwayland_surface *surface = c->surface.xwayland;
|
||||||
xcb_size_hints_t *size_hints = surface->size_hints;
|
xcb_size_hints_t *size_hints = surface->size_hints;
|
||||||
if (surface->modal)
|
if (surface->modal)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (wlr_xwayland_surface_has_window_type(
|
if (wlr_xwayland_surface_has_window_type(
|
||||||
surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DIALOG) ||
|
surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DIALOG) ||
|
||||||
wlr_xwayland_surface_has_window_type(
|
wlr_xwayland_surface_has_window_type(
|
||||||
surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH) ||
|
surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH) ||
|
||||||
wlr_xwayland_surface_has_window_type(
|
wlr_xwayland_surface_has_window_type(
|
||||||
surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLBAR) ||
|
surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLBAR) ||
|
||||||
wlr_xwayland_surface_has_window_type(
|
wlr_xwayland_surface_has_window_type(
|
||||||
surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY)) {
|
surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return size_hints && size_hints->min_width > 0 &&
|
return size_hints && size_hints->min_width > 0 &&
|
||||||
size_hints->min_height > 0 &&
|
size_hints->min_height > 0 &&
|
||||||
(size_hints->max_width == size_hints->min_width ||
|
(size_hints->max_width == size_hints->min_width ||
|
||||||
size_hints->max_height == size_hints->min_height);
|
size_hints->max_height == size_hints->min_height);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
toplevel = c->surface.xdg->toplevel;
|
toplevel = c->surface.xdg->toplevel;
|
||||||
state = toplevel->current;
|
state = toplevel->current;
|
||||||
return toplevel->parent || (state.min_width != 0 && state.min_height != 0 &&
|
return toplevel->parent || (state.min_width != 0 && state.min_height != 0 &&
|
||||||
(state.min_width == state.max_width ||
|
(state.min_width == state.max_width ||
|
||||||
state.min_height == state.max_height));
|
state.min_height == state.max_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int client_is_rendered_on_mon(Client *c, Monitor *m) {
|
static inline int client_is_rendered_on_mon(Client *c, Monitor *m) {
|
||||||
/* This is needed for when you don't want to check formal assignment,
|
/* This is needed for when you don't want to check formal assignment,
|
||||||
* but rather actual displaying of the pixels.
|
* but rather actual displaying of the pixels.
|
||||||
* Usually VISIBLEON suffices and is also faster. */
|
* Usually VISIBLEON suffices and is also faster. */
|
||||||
struct wlr_surface_output *s;
|
struct wlr_surface_output *s;
|
||||||
int unused_lx, unused_ly;
|
int unused_lx, unused_ly;
|
||||||
if (!wlr_scene_node_coords(&c->scene->node, &unused_lx, &unused_ly))
|
if (!wlr_scene_node_coords(&c->scene->node, &unused_lx, &unused_ly))
|
||||||
return 0;
|
return 0;
|
||||||
wl_list_for_each(s, &client_surface(c)->current_outputs,
|
wl_list_for_each(s, &client_surface(c)->current_outputs,
|
||||||
link) if (s->output == m->wlr_output) return 1;
|
link) if (s->output == m->wlr_output) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int client_is_stopped(Client *c) {
|
static inline int client_is_stopped(Client *c) {
|
||||||
int pid;
|
int pid;
|
||||||
siginfo_t in = {0};
|
siginfo_t in = {0};
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c))
|
if (client_is_x11(c))
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL);
|
wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL);
|
||||||
if (waitid(P_PID, pid, &in, WNOHANG | WCONTINUED | WSTOPPED | WNOWAIT) < 0) {
|
if (waitid(P_PID, pid, &in, WNOHANG | WCONTINUED | WSTOPPED | WNOWAIT) <
|
||||||
/* This process is not our child process, while is very unluckely that
|
0) {
|
||||||
* it is stopped, in order to do not skip frames assume that it is. */
|
/* This process is not our child process, while is very unluckely that
|
||||||
if (errno == ECHILD)
|
* it is stopped, in order to do not skip frames assume that it is. */
|
||||||
return 1;
|
if (errno == ECHILD)
|
||||||
} else if (in.si_pid) {
|
return 1;
|
||||||
if (in.si_code == CLD_STOPPED || in.si_code == CLD_TRAPPED)
|
} else if (in.si_pid) {
|
||||||
return 1;
|
if (in.si_code == CLD_STOPPED || in.si_code == CLD_TRAPPED)
|
||||||
if (in.si_code == CLD_CONTINUED)
|
return 1;
|
||||||
return 0;
|
if (in.si_code == CLD_CONTINUED)
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int client_is_unmanaged(Client *c) {
|
static inline int client_is_unmanaged(Client *c) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c))
|
if (client_is_x11(c))
|
||||||
return c->surface.xwayland->override_redirect;
|
return c->surface.xwayland->override_redirect;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void client_notify_enter(struct wlr_surface *s,
|
static inline void client_notify_enter(struct wlr_surface *s,
|
||||||
struct wlr_keyboard *kb) {
|
struct wlr_keyboard *kb) {
|
||||||
if (kb)
|
if (kb)
|
||||||
wlr_seat_keyboard_notify_enter(seat, s, kb->keycodes, kb->num_keycodes,
|
wlr_seat_keyboard_notify_enter(seat, s, kb->keycodes, kb->num_keycodes,
|
||||||
&kb->modifiers);
|
&kb->modifiers);
|
||||||
else
|
else
|
||||||
wlr_seat_keyboard_notify_enter(seat, s, NULL, 0, NULL);
|
wlr_seat_keyboard_notify_enter(seat, s, NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void client_send_close(Client *c) {
|
static inline void client_send_close(Client *c) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
if (client_is_x11(c)) {
|
||||||
wlr_xwayland_surface_close(c->surface.xwayland);
|
wlr_xwayland_surface_close(c->surface.xwayland);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
wlr_xdg_toplevel_send_close(c->surface.xdg->toplevel);
|
wlr_xdg_toplevel_send_close(c->surface.xdg->toplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void client_set_border_color(Client *c,
|
static inline void client_set_border_color(Client *c,
|
||||||
const float color[static 4]) {
|
const float color[static 4]) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
wlr_scene_rect_set_color(c->border[i], color);
|
wlr_scene_rect_set_color(c->border[i], color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void client_set_fullscreen(Client *c, int fullscreen) {
|
static inline void client_set_fullscreen(Client *c, int fullscreen) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
if (client_is_x11(c)) {
|
||||||
wlr_xwayland_surface_set_fullscreen(c->surface.xwayland, fullscreen);
|
wlr_xwayland_surface_set_fullscreen(c->surface.xwayland, fullscreen);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
wlr_xdg_toplevel_set_fullscreen(c->surface.xdg->toplevel, fullscreen);
|
wlr_xdg_toplevel_set_fullscreen(c->surface.xdg->toplevel, fullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void client_set_scale(struct wlr_surface *s, float scale) {
|
static inline void client_set_scale(struct wlr_surface *s, float scale) {
|
||||||
wlr_fractional_scale_v1_notify_scale(s, scale);
|
wlr_fractional_scale_v1_notify_scale(s, scale);
|
||||||
wlr_surface_set_preferred_buffer_scale(s, (int32_t)ceilf(scale));
|
wlr_surface_set_preferred_buffer_scale(s, (int32_t)ceilf(scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t client_set_size(Client *c, uint32_t width,
|
static inline uint32_t client_set_size(Client *c, uint32_t width,
|
||||||
uint32_t height) {
|
uint32_t height) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
if (client_is_x11(c)) {
|
||||||
wlr_xwayland_surface_configure(c->surface.xwayland, c->geom.x + c->bw,
|
wlr_xwayland_surface_configure(c->surface.xwayland, c->geom.x + c->bw,
|
||||||
c->geom.y + c->bw, width, height);
|
c->geom.y + c->bw, width, height);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if ((int32_t)width == c->surface.xdg->toplevel->current.width &&
|
if ((int32_t)width == c->surface.xdg->toplevel->current.width &&
|
||||||
(int32_t)height == c->surface.xdg->toplevel->current.height)
|
(int32_t)height == c->surface.xdg->toplevel->current.height)
|
||||||
return 0;
|
return 0;
|
||||||
return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, (int32_t)width,
|
return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, (int32_t)width,
|
||||||
(int32_t)height);
|
(int32_t)height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void client_set_tiled(Client *c, uint32_t edges) {
|
static inline void client_set_tiled(Client *c, uint32_t edges) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
if (client_is_x11(c)) {
|
||||||
wlr_xwayland_surface_set_maximized(
|
wlr_xwayland_surface_set_maximized(c->surface.xwayland,
|
||||||
c->surface.xwayland, edges != WLR_EDGE_NONE, edges != WLR_EDGE_NONE);
|
edges != WLR_EDGE_NONE,
|
||||||
return;
|
edges != WLR_EDGE_NONE);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (wl_resource_get_version(c->surface.xdg->toplevel->resource) >=
|
if (wl_resource_get_version(c->surface.xdg->toplevel->resource) >=
|
||||||
XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION) {
|
XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION) {
|
||||||
wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges);
|
wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges);
|
||||||
}
|
}
|
||||||
wlr_xdg_toplevel_set_maximized(c->surface.xdg->toplevel,
|
wlr_xdg_toplevel_set_maximized(c->surface.xdg->toplevel,
|
||||||
edges != WLR_EDGE_NONE);
|
edges != WLR_EDGE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void client_set_suspended(Client *c, int suspended) {
|
static inline void client_set_suspended(Client *c, int suspended) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c))
|
if (client_is_x11(c))
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended);
|
wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int client_should_ignore_focus(Client *c) {
|
static inline int client_should_ignore_focus(Client *c) {
|
||||||
|
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
if (client_is_x11(c)) {
|
||||||
struct wlr_xwayland_surface *surface = c->surface.xwayland;
|
struct wlr_xwayland_surface *surface = c->surface.xwayland;
|
||||||
// 处理不需要焦点的窗口类型
|
// 处理不需要焦点的窗口类型
|
||||||
const uint32_t no_focus_types[] = {
|
const uint32_t no_focus_types[] = {
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_COMBO,
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_COMBO,
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DND,
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DND,
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_MENU,
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_MENU,
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_NOTIFICATION,
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_NOTIFICATION,
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_POPUP_MENU,
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_POPUP_MENU,
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH,
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH,
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DESKTOP,
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DESKTOP,
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLTIP,
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLTIP,
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY};
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY};
|
||||||
// 检查窗口类型是否需要禁止焦点
|
// 检查窗口类型是否需要禁止焦点
|
||||||
for (size_t i = 0; i < sizeof(no_focus_types) / sizeof(no_focus_types[0]);
|
for (size_t i = 0;
|
||||||
++i) {
|
i < sizeof(no_focus_types) / sizeof(no_focus_types[0]); ++i) {
|
||||||
if (wlr_xwayland_surface_has_window_type(surface, no_focus_types[i])) {
|
if (wlr_xwayland_surface_has_window_type(surface,
|
||||||
return 1;
|
no_focus_types[i])) {
|
||||||
}
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int client_wants_focus(Client *c) {
|
static inline int client_wants_focus(Client *c) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
return client_is_unmanaged(c) &&
|
return client_is_unmanaged(c) &&
|
||||||
wlr_xwayland_surface_override_redirect_wants_focus(
|
wlr_xwayland_surface_override_redirect_wants_focus(
|
||||||
c->surface.xwayland) &&
|
c->surface.xwayland) &&
|
||||||
wlr_xwayland_surface_icccm_input_model(c->surface.xwayland) !=
|
wlr_xwayland_surface_icccm_input_model(c->surface.xwayland) !=
|
||||||
WLR_ICCCM_INPUT_MODEL_NONE;
|
WLR_ICCCM_INPUT_MODEL_NONE;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int client_wants_fullscreen(Client *c) {
|
static inline int client_wants_fullscreen(Client *c) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c))
|
if (client_is_x11(c))
|
||||||
return c->surface.xwayland->fullscreen;
|
return c->surface.xwayland->fullscreen;
|
||||||
#endif
|
#endif
|
||||||
return c->surface.xdg->toplevel->requested.fullscreen;
|
return c->surface.xdg->toplevel->requested.fullscreen;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,34 +7,34 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static void die_if_null(void *ptr) {
|
static void die_if_null(void *ptr) {
|
||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
perror("Failed to allocate memory");
|
perror("Failed to allocate memory");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *xzalloc(size_t size) {
|
void *xzalloc(size_t size) {
|
||||||
if (!size) {
|
if (!size) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
void *ptr = calloc(1, size);
|
void *ptr = calloc(1, size);
|
||||||
die_if_null(ptr);
|
die_if_null(ptr);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *xrealloc(void *ptr, size_t size) {
|
void *xrealloc(void *ptr, size_t size) {
|
||||||
if (!size) {
|
if (!size) {
|
||||||
free(ptr);
|
free(ptr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ptr = realloc(ptr, size);
|
ptr = realloc(ptr, size);
|
||||||
die_if_null(ptr);
|
die_if_null(ptr);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *xstrdup(const char *str) {
|
char *xstrdup(const char *str) {
|
||||||
assert(str);
|
assert(str);
|
||||||
char *copy = strdup(str);
|
char *copy = strdup(str);
|
||||||
die_if_null(copy);
|
die_if_null(copy);
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,18 +47,17 @@ char *xstrdup(const char *str);
|
||||||
* <ptr> before assigning the result.
|
* <ptr> before assigning the result.
|
||||||
*/
|
*/
|
||||||
#define xstrdup_replace(ptr, str) \
|
#define xstrdup_replace(ptr, str) \
|
||||||
do { \
|
do { \
|
||||||
free(ptr); \
|
free(ptr); \
|
||||||
(ptr) = xstrdup(str); \
|
(ptr) = xstrdup(str); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Frees memory pointed to by <ptr> and sets <ptr> to NULL.
|
* Frees memory pointed to by <ptr> and sets <ptr> to NULL.
|
||||||
* Does nothing if <ptr> is already NULL.
|
* Does nothing if <ptr> is already NULL.
|
||||||
*/
|
*/
|
||||||
#define zfree(ptr) \
|
#define zfree(ptr) \
|
||||||
do { \
|
do { \
|
||||||
free(ptr); \
|
free(ptr); \
|
||||||
(ptr) = NULL; \
|
(ptr) = NULL; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,71 +11,63 @@
|
||||||
#include <pcre2.h>
|
#include <pcre2.h>
|
||||||
|
|
||||||
void die(const char *fmt, ...) {
|
void die(const char *fmt, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vfprintf(stderr, fmt, ap);
|
vfprintf(stderr, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if (fmt[0] && fmt[strlen(fmt) - 1] == ':') {
|
if (fmt[0] && fmt[strlen(fmt) - 1] == ':') {
|
||||||
fputc(' ', stderr);
|
fputc(' ', stderr);
|
||||||
perror(NULL);
|
perror(NULL);
|
||||||
} else {
|
} else {
|
||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *ecalloc(size_t nmemb, size_t size) {
|
void *ecalloc(size_t nmemb, size_t size) {
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
if (!(p = calloc(nmemb, size)))
|
if (!(p = calloc(nmemb, size)))
|
||||||
die("calloc:");
|
die("calloc:");
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fd_set_nonblock(int fd) {
|
int fd_set_nonblock(int fd) {
|
||||||
int flags = fcntl(fd, F_GETFL);
|
int flags = fcntl(fd, F_GETFL);
|
||||||
if (flags < 0) {
|
if (flags < 0) {
|
||||||
perror("fcntl(F_GETFL):");
|
perror("fcntl(F_GETFL):");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
|
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
|
||||||
perror("fcntl(F_SETFL):");
|
perror("fcntl(F_SETFL):");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int regex_match(const char *pattern, const char *str) {
|
int regex_match(const char *pattern, const char *str) {
|
||||||
int errnum;
|
int errnum;
|
||||||
PCRE2_SIZE erroffset;
|
PCRE2_SIZE erroffset;
|
||||||
pcre2_code *re = pcre2_compile(
|
pcre2_code *re = pcre2_compile((PCRE2_SPTR)pattern, PCRE2_ZERO_TERMINATED,
|
||||||
(PCRE2_SPTR)pattern,
|
PCRE2_UTF, // 启用 UTF-8 支持
|
||||||
PCRE2_ZERO_TERMINATED,
|
&errnum, &erroffset, NULL);
|
||||||
PCRE2_UTF, // 启用 UTF-8 支持
|
if (!re) {
|
||||||
&errnum, &erroffset, NULL
|
PCRE2_UCHAR errbuf[256];
|
||||||
);
|
pcre2_get_error_message(errnum, errbuf, sizeof(errbuf));
|
||||||
if (!re) {
|
fprintf(stderr, "PCRE2 error: %s at offset %zu\n", errbuf, erroffset);
|
||||||
PCRE2_UCHAR errbuf[256];
|
return 0;
|
||||||
pcre2_get_error_message(errnum, errbuf, sizeof(errbuf));
|
}
|
||||||
fprintf(stderr, "PCRE2 error: %s at offset %zu\n", errbuf, erroffset);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pcre2_match_data *match_data = pcre2_match_data_create_from_pattern(re, NULL);
|
pcre2_match_data *match_data =
|
||||||
int ret = pcre2_match(
|
pcre2_match_data_create_from_pattern(re, NULL);
|
||||||
re,
|
int ret =
|
||||||
(PCRE2_SPTR)str,
|
pcre2_match(re, (PCRE2_SPTR)str, strlen(str), 0, 0, match_data, NULL);
|
||||||
strlen(str),
|
|
||||||
0, 0,
|
|
||||||
match_data,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
pcre2_match_data_free(match_data);
|
pcre2_match_data_free(match_data);
|
||||||
pcre2_code_free(re);
|
pcre2_code_free(re);
|
||||||
return ret >= 0;
|
return ret >= 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
/* See LICENSE.dwm file for copyright and license details. */
|
/* See LICENSE.dwm file for copyright and license details. */
|
||||||
|
|
||||||
|
|
||||||
void die(const char *fmt, ...);
|
void die(const char *fmt, ...);
|
||||||
void *ecalloc(size_t nmemb, size_t size);
|
void *ecalloc(size_t nmemb, size_t size);
|
||||||
int fd_set_nonblock(int fd);
|
int fd_set_nonblock(int fd);
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -4,22 +4,22 @@
|
||||||
/* speedie's maomao config */
|
/* speedie's maomao config */
|
||||||
|
|
||||||
#define COLOR(hex) \
|
#define COLOR(hex) \
|
||||||
{((hex >> 24) & 0xFF) / 255.0f, ((hex >> 16) & 0xFF) / 255.0f, \
|
{((hex >> 24) & 0xFF) / 255.0f, ((hex >> 16) & 0xFF) / 255.0f, \
|
||||||
((hex >> 8) & 0xFF) / 255.0f, (hex & 0xFF) / 255.0f}
|
((hex >> 8) & 0xFF) / 255.0f, (hex & 0xFF) / 255.0f}
|
||||||
|
|
||||||
/* animaion */
|
/* animaion */
|
||||||
char *animation_type_open = "slide"; // 是否启用动画 //slide,zoom
|
char *animation_type_open = "slide"; // 是否启用动画 //slide,zoom
|
||||||
char *animation_type_close = "slide"; // 是否启用动画 //slide,zoom
|
char *animation_type_close = "slide"; // 是否启用动画 //slide,zoom
|
||||||
int animations = 1; // 是否启用动画
|
int animations = 1; // 是否启用动画
|
||||||
int tag_animation_direction = HORIZONTAL; // 标签动画方向
|
int tag_animation_direction = HORIZONTAL; // 标签动画方向
|
||||||
int animation_fade_in = 1; // Enable animation fade in
|
int animation_fade_in = 1; // Enable animation fade in
|
||||||
int animation_fade_out = 1; // Enable animation fade out
|
int animation_fade_out = 1; // Enable animation fade out
|
||||||
float zoom_initial_ratio = 0.5; // 动画起始窗口比例
|
float zoom_initial_ratio = 0.5; // 动画起始窗口比例
|
||||||
float fadein_begin_opacity = 0.5; // Begin opac window ratio for animations
|
float fadein_begin_opacity = 0.5; // Begin opac window ratio for animations
|
||||||
float fadeout_begin_opacity = 0.5; // Begin opac window ratio for animations
|
float fadeout_begin_opacity = 0.5; // Begin opac window ratio for animations
|
||||||
uint32_t animation_duration_move = 500; // Animation move speed
|
uint32_t animation_duration_move = 500; // Animation move speed
|
||||||
uint32_t animation_duration_open = 400; // Animation open speed
|
uint32_t animation_duration_open = 400; // Animation open speed
|
||||||
uint32_t animation_duration_tag = 300; // Animation tag speed
|
uint32_t animation_duration_tag = 300; // Animation tag speed
|
||||||
uint32_t animation_duration_close = 300; // Animation close speed
|
uint32_t animation_duration_close = 300; // Animation close speed
|
||||||
double animation_curve_move[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
double animation_curve_move[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
||||||
double animation_curve_open[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
double animation_curve_open[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
||||||
|
|
@ -28,20 +28,20 @@ double animation_curve_close[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
unsigned int axis_bind_apply_timeout = 100; // 滚轮绑定动作的触发的时间间隔
|
unsigned int axis_bind_apply_timeout = 100; // 滚轮绑定动作的触发的时间间隔
|
||||||
unsigned int focus_on_activate = 1; // 收到窗口激活请求是否自动跳转聚焦
|
unsigned int focus_on_activate = 1; // 收到窗口激活请求是否自动跳转聚焦
|
||||||
unsigned int new_is_master = 1; // 新窗口是否插在头部
|
unsigned int new_is_master = 1; // 新窗口是否插在头部
|
||||||
double default_mfact = 0.55f; // master 窗口比例
|
double default_mfact = 0.55f; // master 窗口比例
|
||||||
double default_smfact = 0.5f; // 第一个stack窗口比例
|
double default_smfact = 0.5f; // 第一个stack窗口比例
|
||||||
unsigned int default_nmaster = 1; // 默认master数量
|
unsigned int default_nmaster = 1; // 默认master数量
|
||||||
/* logging */
|
/* logging */
|
||||||
int log_level = WLR_ERROR;
|
int log_level = WLR_ERROR;
|
||||||
unsigned int numlockon = 1; // 是否打开右边小键盘
|
unsigned int numlockon = 1; // 是否打开右边小键盘
|
||||||
unsigned int capslock = 0; // 是否启用快捷键
|
unsigned int capslock = 0; // 是否启用快捷键
|
||||||
|
|
||||||
unsigned int ov_tab_mode = 0; // alt tab切换模式
|
unsigned int ov_tab_mode = 0; // alt tab切换模式
|
||||||
unsigned int hotarea_size = 10; // 热区大小,10x10
|
unsigned int hotarea_size = 10; // 热区大小,10x10
|
||||||
unsigned int enable_hotarea = 1; // 是否启用鼠标热区
|
unsigned int enable_hotarea = 1; // 是否启用鼠标热区
|
||||||
int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||||
int sloppyfocus = 1; /* focus follows mouse */
|
int sloppyfocus = 1; /* focus follows mouse */
|
||||||
unsigned int gappih = 5; /* horiz inner gap between windows */
|
unsigned int gappih = 5; /* horiz inner gap between windows */
|
||||||
unsigned int gappiv = 5; /* vert inner gap between windows */
|
unsigned int gappiv = 5; /* vert inner gap between windows */
|
||||||
|
|
@ -65,8 +65,8 @@ unsigned int cursor_hide_timeout = 0;
|
||||||
unsigned int swipe_min_threshold = 20;
|
unsigned int swipe_min_threshold = 20;
|
||||||
|
|
||||||
int bypass_surface_visibility =
|
int bypass_surface_visibility =
|
||||||
0; /* 1 means idle inhibitors will disable idle tracking even if it's
|
0; /* 1 means idle inhibitors will disable idle tracking even if it's
|
||||||
surface isn't visible */
|
surface isn't visible */
|
||||||
unsigned int borderpx = 4; /* border pixel of windows */
|
unsigned int borderpx = 4; /* border pixel of windows */
|
||||||
float rootcolor[] = COLOR(0x323232ff);
|
float rootcolor[] = COLOR(0x323232ff);
|
||||||
float bordercolor[] = COLOR(0x444444ff);
|
float bordercolor[] = COLOR(0x444444ff);
|
||||||
|
|
@ -78,36 +78,36 @@ float globalcolor[] = COLOR(0xb153a7ff);
|
||||||
float overlaycolor[] = COLOR(0x14a57cff);
|
float overlaycolor[] = COLOR(0x14a57cff);
|
||||||
// char *cursor_theme = "Bibata-Modern-Ice";
|
// char *cursor_theme = "Bibata-Modern-Ice";
|
||||||
|
|
||||||
int overviewgappi = 5; /* overview时 窗口与边缘 缝隙大小 */
|
int overviewgappi = 5; /* overview时 窗口与边缘 缝隙大小 */
|
||||||
int overviewgappo = 30; /* overview时 窗口与窗口 缝隙大小 */
|
int overviewgappo = 30; /* overview时 窗口与窗口 缝隙大小 */
|
||||||
|
|
||||||
/* To conform the xdg-protocol, set the alpha to zero to restore the old
|
/* To conform the xdg-protocol, set the alpha to zero to restore the old
|
||||||
* behavior */
|
* behavior */
|
||||||
float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};
|
float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};
|
||||||
|
|
||||||
int warpcursor = 1; /* Warp cursor to focused client */
|
int warpcursor = 1; /* Warp cursor to focused client */
|
||||||
int xwayland_persistence = 1; /* xwayland persistence */
|
int xwayland_persistence = 1; /* xwayland persistence */
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
Layout overviewlayout = {"", overview, "overview"};
|
Layout overviewlayout = {"", overview, "overview"};
|
||||||
|
|
||||||
Layout layouts[] = {
|
Layout layouts[] = {
|
||||||
// 最少两个,不能删除少于两个
|
// 最少两个,不能删除少于两个
|
||||||
/* symbol arrange function name */
|
/* symbol arrange function name */
|
||||||
{"S", scroller, "scroller"}, // 滚动布局
|
{"S", scroller, "scroller"}, // 滚动布局
|
||||||
{"T", tile, "tile"}, // 堆栈布局
|
{"T", tile, "tile"}, // 堆栈布局
|
||||||
{"G", grid, "grid"}, {"M", monocle, "monocle"},
|
{"G", grid, "grid"}, {"M", monocle, "monocle"},
|
||||||
{"D", dwindle, "dwindle"}, {"P", spiral, "spiral"},
|
{"D", dwindle, "dwindle"}, {"P", spiral, "spiral"},
|
||||||
{"K", deck, "deck"},
|
{"K", deck, "deck"},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* keyboard */
|
/* keyboard */
|
||||||
struct xkb_rule_names xkb_rules = {
|
struct xkb_rule_names xkb_rules = {
|
||||||
/* can specify fields: rules, model, layout, variant, options */
|
/* can specify fields: rules, model, layout, variant, options */
|
||||||
/* example:
|
/* example:
|
||||||
.options = "ctrl:nocaps",
|
.options = "ctrl:nocaps",
|
||||||
*/
|
*/
|
||||||
.options = NULL,
|
.options = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
int repeat_rate = 25;
|
int repeat_rate = 25;
|
||||||
|
|
@ -138,7 +138,7 @@ LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS
|
||||||
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER
|
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER
|
||||||
*/
|
*/
|
||||||
enum libinput_config_click_method click_method =
|
enum libinput_config_click_method click_method =
|
||||||
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
||||||
|
|
||||||
/* You can choose between:
|
/* You can choose between:
|
||||||
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED
|
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED
|
||||||
|
|
@ -152,7 +152,7 @@ LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
|
||||||
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
|
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
|
||||||
*/
|
*/
|
||||||
enum libinput_config_accel_profile accel_profile =
|
enum libinput_config_accel_profile accel_profile =
|
||||||
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
|
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
|
||||||
double accel_speed = 0.0;
|
double accel_speed = 0.0;
|
||||||
/* You can choose between:
|
/* You can choose between:
|
||||||
LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
|
LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
|
||||||
|
|
@ -164,5 +164,5 @@ enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
||||||
#define MODKEY WLR_MODIFIER_ALT
|
#define MODKEY WLR_MODIFIER_ALT
|
||||||
|
|
||||||
static const char *tags[] = {
|
static const char *tags[] = {
|
||||||
"1", "2", "3", "4", "5", "6", "7", "8", "9",
|
"1", "2", "3", "4", "5", "6", "7", "8", "9",
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,119 +1,122 @@
|
||||||
void fibonacci(Monitor *mon, int s) {
|
void fibonacci(Monitor *mon, int s) {
|
||||||
unsigned int i = 0, n = 0, nx, ny, nw, nh;
|
unsigned int i = 0, n = 0, nx, ny, nw, nh;
|
||||||
Client *c;
|
Client *c;
|
||||||
unsigned int cur_gappih = enablegaps ? mon->gappih : 0;
|
unsigned int cur_gappih = enablegaps ? mon->gappih : 0;
|
||||||
unsigned int cur_gappiv = enablegaps ? mon->gappiv : 0;
|
unsigned int cur_gappiv = enablegaps ? mon->gappiv : 0;
|
||||||
unsigned int cur_gappoh = enablegaps ? mon->gappoh : 0;
|
unsigned int cur_gappoh = enablegaps ? mon->gappoh : 0;
|
||||||
unsigned int cur_gappov = enablegaps ? mon->gappov : 0;
|
unsigned int cur_gappov = enablegaps ? mon->gappov : 0;
|
||||||
|
|
||||||
cur_gappih = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappih;
|
cur_gappih = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappih;
|
||||||
cur_gappiv = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappiv;
|
cur_gappiv = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappiv;
|
||||||
cur_gappoh = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappoh;
|
||||||
cur_gappov = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && mon->visible_clients == 1 ? 0 : cur_gappov;
|
||||||
// Count visible clients
|
// Count visible clients
|
||||||
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, mon) && ISTILED(c)) n++;
|
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, mon) && ISTILED(c))
|
||||||
|
n++;
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Initial dimensions including outer gaps
|
// Initial dimensions including outer gaps
|
||||||
nx = mon->w.x + cur_gappoh;
|
nx = mon->w.x + cur_gappoh;
|
||||||
ny = mon->w.y + cur_gappov;
|
ny = mon->w.y + cur_gappov;
|
||||||
nw = mon->w.width - 2 * cur_gappoh;
|
nw = mon->w.width - 2 * cur_gappoh;
|
||||||
nh = mon->w.height - 2 * cur_gappov;
|
nh = mon->w.height - 2 * cur_gappov;
|
||||||
|
|
||||||
// First pass: calculate client geometries
|
// First pass: calculate client geometries
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (!VISIBLEON(c, mon) || !ISTILED(c))
|
if (!VISIBLEON(c, mon) || !ISTILED(c))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
c->bw = mon->visible_clients == 1 && no_border_when_single && smartgaps
|
c->bw = mon->visible_clients == 1 && no_border_when_single && smartgaps
|
||||||
? 0
|
? 0
|
||||||
: borderpx;
|
: borderpx;
|
||||||
if ((i % 2 && nh / 2 > 2 * c->bw) || (!(i % 2) && nw / 2 > 2 * c->bw)) {
|
if ((i % 2 && nh / 2 > 2 * c->bw) || (!(i % 2) && nw / 2 > 2 * c->bw)) {
|
||||||
if (i < n - 1) {
|
if (i < n - 1) {
|
||||||
if (i % 2) {
|
if (i % 2) {
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
nh = nh * mon->pertag->smfacts[mon->pertag->curtag];
|
nh = nh * mon->pertag->smfacts[mon->pertag->curtag];
|
||||||
} else {
|
} else {
|
||||||
nh = (nh - cur_gappiv) / 2;
|
nh = (nh - cur_gappiv) / 2;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
nw = (nw - cur_gappih) / 2;
|
nw = (nw - cur_gappih) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((i % 4) == 2 && !s)
|
if ((i % 4) == 2 && !s)
|
||||||
nx += nw + cur_gappih;
|
nx += nw + cur_gappih;
|
||||||
else if ((i % 4) == 3 && !s)
|
else if ((i % 4) == 3 && !s)
|
||||||
ny += nh + cur_gappiv;
|
ny += nh + cur_gappiv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((i % 4) == 0) {
|
if ((i % 4) == 0) {
|
||||||
if (s)
|
if (s)
|
||||||
ny += nh + cur_gappiv;
|
ny += nh + cur_gappiv;
|
||||||
else
|
else
|
||||||
ny -= nh + cur_gappiv;
|
ny -= nh + cur_gappiv;
|
||||||
} else if ((i % 4) == 1)
|
} else if ((i % 4) == 1)
|
||||||
nx += nw + cur_gappih;
|
nx += nw + cur_gappih;
|
||||||
else if ((i % 4) == 2)
|
else if ((i % 4) == 2)
|
||||||
ny += nh + cur_gappiv;
|
ny += nh + cur_gappiv;
|
||||||
else if ((i % 4) == 3) {
|
else if ((i % 4) == 3) {
|
||||||
if (s)
|
if (s)
|
||||||
nx += nw + cur_gappih;
|
nx += nw + cur_gappih;
|
||||||
else
|
else
|
||||||
nx -= nw + cur_gappih;
|
nx -= nw + cur_gappih;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
if (n != 1)
|
if (n != 1)
|
||||||
nw = (mon->w.width - 2 * cur_gappoh) *
|
nw = (mon->w.width - 2 * cur_gappoh) *
|
||||||
mon->pertag->mfacts[mon->pertag->curtag];
|
mon->pertag->mfacts[mon->pertag->curtag];
|
||||||
ny = mon->w.y + cur_gappov;
|
ny = mon->w.y + cur_gappov;
|
||||||
} else if (i == 1) {
|
} else if (i == 1) {
|
||||||
nw = mon->w.width - 2 * cur_gappoh - nw - cur_gappih;
|
nw = mon->w.width - 2 * cur_gappoh - nw - cur_gappih;
|
||||||
} else if (i == 2) {
|
} else if (i == 2) {
|
||||||
nh = mon->w.height - 2 * cur_gappov - nh - cur_gappiv;
|
nh = mon->w.height - 2 * cur_gappov - nh - cur_gappiv;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->geom = (struct wlr_box){.x = nx, .y = ny, .width = nw, .height = nh};
|
c->geom = (struct wlr_box){.x = nx, .y = ny, .width = nw, .height = nh};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second pass: apply gaps between clients
|
// Second pass: apply gaps between clients
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (!VISIBLEON(c, mon) || !ISTILED(c))
|
if (!VISIBLEON(c, mon) || !ISTILED(c))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
unsigned int right_gap = 0;
|
unsigned int right_gap = 0;
|
||||||
unsigned int bottom_gap = 0;
|
unsigned int bottom_gap = 0;
|
||||||
Client *nc;
|
Client *nc;
|
||||||
|
|
||||||
wl_list_for_each(nc, &clients, link) {
|
wl_list_for_each(nc, &clients, link) {
|
||||||
if (!VISIBLEON(nc, mon) || !ISTILED(nc))
|
if (!VISIBLEON(nc, mon) || !ISTILED(nc))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (c == nc)
|
if (c == nc)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Check for right neighbor
|
// Check for right neighbor
|
||||||
if (c->geom.y == nc->geom.y && c->geom.x + c->geom.width == nc->geom.x) {
|
if (c->geom.y == nc->geom.y &&
|
||||||
right_gap = cur_gappih;
|
c->geom.x + c->geom.width == nc->geom.x) {
|
||||||
}
|
right_gap = cur_gappih;
|
||||||
|
}
|
||||||
|
|
||||||
// Check for bottom neighbor
|
// Check for bottom neighbor
|
||||||
if (c->geom.x == nc->geom.x && c->geom.y + c->geom.height == nc->geom.y) {
|
if (c->geom.x == nc->geom.x &&
|
||||||
bottom_gap = cur_gappiv;
|
c->geom.y + c->geom.height == nc->geom.y) {
|
||||||
}
|
bottom_gap = cur_gappiv;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resize(c,
|
resize(c,
|
||||||
(struct wlr_box){.x = c->geom.x,
|
(struct wlr_box){.x = c->geom.x,
|
||||||
.y = c->geom.y,
|
.y = c->geom.y,
|
||||||
.width = c->geom.width - right_gap,
|
.width = c->geom.width - right_gap,
|
||||||
.height = c->geom.height - bottom_gap},
|
.height = c->geom.height - bottom_gap},
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dwindle(Monitor *mon) { fibonacci(mon, 1); }
|
void dwindle(Monitor *mon) { fibonacci(mon, 1); }
|
||||||
|
|
@ -122,370 +125,377 @@ void spiral(Monitor *mon) { fibonacci(mon, 0); }
|
||||||
|
|
||||||
// 网格布局窗口大小和位置计算
|
// 网格布局窗口大小和位置计算
|
||||||
void grid(Monitor *m) {
|
void grid(Monitor *m) {
|
||||||
unsigned int i, n;
|
unsigned int i, n;
|
||||||
unsigned int cx, cy, cw, ch;
|
unsigned int cx, cy, cw, ch;
|
||||||
unsigned int dx;
|
unsigned int dx;
|
||||||
unsigned int cols, rows, overcols;
|
unsigned int cols, rows, overcols;
|
||||||
Client *c;
|
Client *c;
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
// 第一次遍历,计算 n 的值
|
// 第一次遍历,计算 n 的值
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (VISIBLEON(c, c->mon) && !c->isunglobal && (m->isoverview || ISTILED(c))) {
|
if (VISIBLEON(c, c->mon) && !c->isunglobal &&
|
||||||
n++;
|
(m->isoverview || ISTILED(c))) {
|
||||||
}
|
n++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
return; // 没有需要处理的客户端,直接返回
|
return; // 没有需要处理的客户端,直接返回
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n == 1) {
|
if (n == 1) {
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
c->bw =
|
||||||
? 0
|
m->visible_clients == 1 && no_border_when_single && smartgaps
|
||||||
: borderpx;
|
? 0
|
||||||
if (VISIBLEON(c, c->mon) && !c->isunglobal && (m->isoverview || ISTILED(c))) {
|
: borderpx;
|
||||||
cw = (m->w.width - 2 * overviewgappo) * 0.7;
|
if (VISIBLEON(c, c->mon) && !c->isunglobal &&
|
||||||
ch = (m->w.height - 2 * overviewgappo) * 0.8;
|
(m->isoverview || ISTILED(c))) {
|
||||||
c->geom.x = m->w.x + (m->w.width - cw) / 2;
|
cw = (m->w.width - 2 * overviewgappo) * 0.7;
|
||||||
c->geom.y = m->w.y + (m->w.height - ch) / 2;
|
ch = (m->w.height - 2 * overviewgappo) * 0.8;
|
||||||
c->geom.width = cw - 2 * c->bw;
|
c->geom.x = m->w.x + (m->w.width - cw) / 2;
|
||||||
c->geom.height = ch - 2 * c->bw;
|
c->geom.y = m->w.y + (m->w.height - ch) / 2;
|
||||||
resize(c, c->geom, 0);
|
c->geom.width = cw - 2 * c->bw;
|
||||||
return;
|
c->geom.height = ch - 2 * c->bw;
|
||||||
}
|
resize(c, c->geom, 0);
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
cw = (m->w.width - 2 * overviewgappo - overviewgappi) / 2;
|
cw = (m->w.width - 2 * overviewgappo - overviewgappi) / 2;
|
||||||
ch = (m->w.height - 2 * overviewgappo) * 0.65;
|
ch = (m->w.height - 2 * overviewgappo) * 0.65;
|
||||||
i = 0;
|
i = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
c->bw =
|
||||||
? 0
|
m->visible_clients == 1 && no_border_when_single && smartgaps
|
||||||
: borderpx;
|
? 0
|
||||||
if (VISIBLEON(c, c->mon) && !c->isunglobal && (m->isoverview || ISTILED(c))) {
|
: borderpx;
|
||||||
if (i == 0) {
|
if (VISIBLEON(c, c->mon) && !c->isunglobal &&
|
||||||
c->geom.x = m->w.x + overviewgappo;
|
(m->isoverview || ISTILED(c))) {
|
||||||
c->geom.y = m->w.y + (m->w.height - ch) / 2 + overviewgappo;
|
if (i == 0) {
|
||||||
c->geom.width = cw - 2 * c->bw;
|
c->geom.x = m->w.x + overviewgappo;
|
||||||
c->geom.height = ch - 2 * c->bw;
|
c->geom.y = m->w.y + (m->w.height - ch) / 2 + overviewgappo;
|
||||||
resize(c, c->geom, 0);
|
c->geom.width = cw - 2 * c->bw;
|
||||||
} else if (i == 1) {
|
c->geom.height = ch - 2 * c->bw;
|
||||||
c->geom.x = m->w.x + cw + overviewgappo + overviewgappi;
|
resize(c, c->geom, 0);
|
||||||
c->geom.y = m->w.y + (m->w.height - ch) / 2 + overviewgappo;
|
} else if (i == 1) {
|
||||||
c->geom.width = cw - 2 * c->bw;
|
c->geom.x = m->w.x + cw + overviewgappo + overviewgappi;
|
||||||
c->geom.height = ch - 2 * c->bw;
|
c->geom.y = m->w.y + (m->w.height - ch) / 2 + overviewgappo;
|
||||||
resize(c, c->geom, 0);
|
c->geom.width = cw - 2 * c->bw;
|
||||||
}
|
c->geom.height = ch - 2 * c->bw;
|
||||||
i++;
|
resize(c, c->geom, 0);
|
||||||
}
|
}
|
||||||
}
|
i++;
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 计算列数和行数
|
// 计算列数和行数
|
||||||
for (cols = 0; cols <= n / 2; cols++) {
|
for (cols = 0; cols <= n / 2; cols++) {
|
||||||
if (cols * cols >= n) {
|
if (cols * cols >= n) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rows = (cols && (cols - 1) * cols >= n) ? cols - 1 : cols;
|
rows = (cols && (cols - 1) * cols >= n) ? cols - 1 : cols;
|
||||||
|
|
||||||
// 计算每个客户端的高度和宽度
|
// 计算每个客户端的高度和宽度
|
||||||
ch = (m->w.height - 2 * overviewgappo - (rows - 1) * overviewgappi) / rows;
|
ch = (m->w.height - 2 * overviewgappo - (rows - 1) * overviewgappi) / rows;
|
||||||
cw = (m->w.width - 2 * overviewgappo - (cols - 1) * overviewgappi) / cols;
|
cw = (m->w.width - 2 * overviewgappo - (cols - 1) * overviewgappi) / cols;
|
||||||
|
|
||||||
// 处理多余的列
|
// 处理多余的列
|
||||||
overcols = n % cols;
|
overcols = n % cols;
|
||||||
if (overcols) {
|
if (overcols) {
|
||||||
dx = (m->w.width - overcols * cw - (overcols - 1) * overviewgappi) / 2 -
|
dx = (m->w.width - overcols * cw - (overcols - 1) * overviewgappi) / 2 -
|
||||||
overviewgappo;
|
overviewgappo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调整每个客户端的位置和大小
|
// 调整每个客户端的位置和大小
|
||||||
i = 0;
|
i = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
||||||
? 0
|
? 0
|
||||||
: borderpx;
|
: borderpx;
|
||||||
if (VISIBLEON(c, c->mon) && !c->isunglobal && (m->isoverview || ISTILED(c))) {
|
if (VISIBLEON(c, c->mon) && !c->isunglobal &&
|
||||||
cx = m->w.x + (i % cols) * (cw + overviewgappi);
|
(m->isoverview || ISTILED(c))) {
|
||||||
cy = m->w.y + (i / cols) * (ch + overviewgappi);
|
cx = m->w.x + (i % cols) * (cw + overviewgappi);
|
||||||
if (overcols && i >= n - overcols) {
|
cy = m->w.y + (i / cols) * (ch + overviewgappi);
|
||||||
cx += dx;
|
if (overcols && i >= n - overcols) {
|
||||||
}
|
cx += dx;
|
||||||
c->geom.x = cx + overviewgappo;
|
}
|
||||||
c->geom.y = cy + overviewgappo;
|
c->geom.x = cx + overviewgappo;
|
||||||
c->geom.width = cw - 2 * c->bw;
|
c->geom.y = cy + overviewgappo;
|
||||||
c->geom.height = ch - 2 * c->bw;
|
c->geom.width = cw - 2 * c->bw;
|
||||||
resize(c, c->geom, 0);
|
c->geom.height = ch - 2 * c->bw;
|
||||||
i++;
|
resize(c, c->geom, 0);
|
||||||
}
|
i++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void deck(Monitor *m) {
|
void deck(Monitor *m) {
|
||||||
unsigned int mw, my;
|
unsigned int mw, my;
|
||||||
int i, n = 0;
|
int i, n = 0;
|
||||||
Client *c;
|
Client *c;
|
||||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||||
|
|
||||||
cur_gappih = smartgaps && m->visible_clients == 1 ? 0 : cur_gappih;
|
cur_gappih = smartgaps && m->visible_clients == 1 ? 0 : cur_gappih;
|
||||||
cur_gappiv = smartgaps && m->visible_clients == 1 ? 0 : cur_gappiv;
|
cur_gappiv = smartgaps && m->visible_clients == 1 ? 0 : cur_gappiv;
|
||||||
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
||||||
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, m) && ISTILED(c)) n++;
|
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, m) && ISTILED(c)) n++;
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Calculate master width using mfact from pertag
|
// Calculate master width using mfact from pertag
|
||||||
float mfact = m->pertag ? m->pertag->mfacts[m->pertag->curtag] : m->mfact;
|
float mfact = m->pertag ? m->pertag->mfacts[m->pertag->curtag] : m->mfact;
|
||||||
|
|
||||||
// Calculate master width including outer gaps
|
// Calculate master width including outer gaps
|
||||||
if (n > m->nmaster)
|
if (n > m->nmaster)
|
||||||
mw = m->nmaster ? round((m->w.width - 2 * cur_gappoh) * mfact) : 0;
|
mw = m->nmaster ? round((m->w.width - 2 * cur_gappoh) * mfact) : 0;
|
||||||
else
|
else
|
||||||
mw = m->w.width - 2 * cur_gappoh;
|
mw = m->w.width - 2 * cur_gappoh;
|
||||||
|
|
||||||
i = my = 0;
|
i = my = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (!VISIBLEON(c, m) || !ISTILED(c))
|
if (!VISIBLEON(c, m) || !ISTILED(c))
|
||||||
continue;
|
continue;
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
// Master area clients
|
// Master area clients
|
||||||
resize(c,
|
resize(c,
|
||||||
(struct wlr_box){.x = m->w.x + cur_gappoh,
|
(struct wlr_box){
|
||||||
.y = m->w.y + cur_gappov + my,
|
.x = m->w.x + cur_gappoh,
|
||||||
.width = mw,
|
.y = m->w.y + cur_gappov + my,
|
||||||
.height =
|
.width = mw,
|
||||||
(m->w.height - cur_gappov - my - cur_gappiv) /
|
.height = (m->w.height - cur_gappov - my - cur_gappiv) /
|
||||||
(MIN(n, m->nmaster) - i)},
|
(MIN(n, m->nmaster) - i)},
|
||||||
0);
|
0);
|
||||||
my += c->geom.height + cur_gappiv;
|
my += c->geom.height + cur_gappiv;
|
||||||
} else {
|
} else {
|
||||||
// Stack area clients
|
// Stack area clients
|
||||||
resize(c,
|
resize(c,
|
||||||
(struct wlr_box){.x = m->w.x + mw + cur_gappoh + cur_gappih,
|
(struct wlr_box){.x = m->w.x + mw + cur_gappoh + cur_gappih,
|
||||||
.y = m->w.y + cur_gappov,
|
.y = m->w.y + cur_gappov,
|
||||||
.width =
|
.width = m->w.width - mw - 2 * cur_gappoh -
|
||||||
m->w.width - mw - 2 * cur_gappoh - cur_gappih,
|
cur_gappih,
|
||||||
.height = m->w.height - 2 * cur_gappov},
|
.height = m->w.height - 2 * cur_gappov},
|
||||||
0);
|
0);
|
||||||
if (c == focustop(m))
|
if (c == focustop(m))
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 滚动布局
|
// 滚动布局
|
||||||
void scroller(Monitor *m) {
|
void scroller(Monitor *m) {
|
||||||
unsigned int i, n;
|
unsigned int i, n;
|
||||||
|
|
||||||
Client *c, *root_client = NULL;
|
Client *c, *root_client = NULL;
|
||||||
Client **tempClients = NULL; // 初始化为 NULL
|
Client **tempClients = NULL; // 初始化为 NULL
|
||||||
n = 0;
|
n = 0;
|
||||||
struct wlr_box target_geom;
|
struct wlr_box target_geom;
|
||||||
int focus_client_index = 0;
|
int focus_client_index = 0;
|
||||||
bool need_scroller = false;
|
bool need_scroller = false;
|
||||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||||
|
|
||||||
cur_gappih = smartgaps && m->visible_clients == 1 ? 0 : cur_gappih;
|
cur_gappih = smartgaps && m->visible_clients == 1 ? 0 : cur_gappih;
|
||||||
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
||||||
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
||||||
|
|
||||||
unsigned int max_client_width =
|
unsigned int max_client_width =
|
||||||
m->w.width - 2 * scroller_structs - cur_gappih;
|
m->w.width - 2 * scroller_structs - cur_gappih;
|
||||||
|
|
||||||
// 第一次遍历,计算 n 的值
|
// 第一次遍历,计算 n 的值
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (VISIBLEON(c, c->mon) && ISTILED(c)) {
|
if (VISIBLEON(c, c->mon) && ISTILED(c)) {
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
return; // 没有需要处理的客户端,直接返回
|
return; // 没有需要处理的客户端,直接返回
|
||||||
}
|
}
|
||||||
|
|
||||||
// 动态分配内存
|
// 动态分配内存
|
||||||
tempClients = malloc(n * sizeof(Client *));
|
tempClients = malloc(n * sizeof(Client *));
|
||||||
if (!tempClients) {
|
if (!tempClients) {
|
||||||
// 处理内存分配失败的情况
|
// 处理内存分配失败的情况
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 第二次遍历,填充 tempClients
|
// 第二次遍历,填充 tempClients
|
||||||
n = 0;
|
n = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (VISIBLEON(c, c->mon) && ISTILED(c)) {
|
if (VISIBLEON(c, c->mon) && ISTILED(c)) {
|
||||||
tempClients[n] = c;
|
tempClients[n] = c;
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n == 1) {
|
if (n == 1) {
|
||||||
c = tempClients[0];
|
c = tempClients[0];
|
||||||
target_geom.height = m->w.height - 2 * cur_gappov;
|
target_geom.height = m->w.height - 2 * cur_gappov;
|
||||||
target_geom.width =
|
target_geom.width =
|
||||||
(m->w.width - 2 * cur_gappoh) * scroller_default_proportion_single;
|
(m->w.width - 2 * cur_gappoh) * scroller_default_proportion_single;
|
||||||
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
||||||
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
||||||
resize(c, target_geom, 0);
|
resize(c, target_geom, 0);
|
||||||
free(tempClients); // 释放内存
|
free(tempClients); // 释放内存
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating &&
|
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating &&
|
||||||
!m->sel->ismaxmizescreen && !m->sel->isfullscreen) {
|
!m->sel->ismaxmizescreen && !m->sel->isfullscreen) {
|
||||||
root_client = m->sel;
|
root_client = m->sel;
|
||||||
} else if (m->prevsel && !client_is_unmanaged(m->prevsel) &&
|
} else if (m->prevsel && !client_is_unmanaged(m->prevsel) &&
|
||||||
!m->prevsel->isfloating && !m->prevsel->ismaxmizescreen &&
|
!m->prevsel->isfloating && !m->prevsel->ismaxmizescreen &&
|
||||||
!m->prevsel->isfullscreen) {
|
!m->prevsel->isfullscreen) {
|
||||||
root_client = m->prevsel;
|
root_client = m->prevsel;
|
||||||
} else {
|
} else {
|
||||||
root_client = center_select(m);
|
root_client = center_select(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!root_client) {
|
if (!root_client) {
|
||||||
free(tempClients); // 释放内存
|
free(tempClients); // 释放内存
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
c = tempClients[i];
|
c = tempClients[i];
|
||||||
if (root_client == c) {
|
if (root_client == c) {
|
||||||
if (!c->is_open_animation && c->geom.x >= m->w.x + scroller_structs &&
|
if (!c->is_open_animation &&
|
||||||
c->geom.x + c->geom.width <= m->w.x + m->w.width - scroller_structs) {
|
c->geom.x >= m->w.x + scroller_structs &&
|
||||||
need_scroller = false;
|
c->geom.x + c->geom.width <=
|
||||||
} else {
|
m->w.x + m->w.width - scroller_structs) {
|
||||||
need_scroller = true;
|
need_scroller = false;
|
||||||
}
|
} else {
|
||||||
focus_client_index = i;
|
need_scroller = true;
|
||||||
break;
|
}
|
||||||
}
|
focus_client_index = i;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
target_geom.height = m->w.height - 2 * cur_gappov;
|
target_geom.height = m->w.height - 2 * cur_gappov;
|
||||||
target_geom.width = max_client_width * c->scroller_proportion;
|
target_geom.width = max_client_width * c->scroller_proportion;
|
||||||
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
||||||
|
|
||||||
if (need_scroller) {
|
if (need_scroller) {
|
||||||
if (scroller_focus_center ||
|
if (scroller_focus_center ||
|
||||||
((!m->prevsel ||
|
((!m->prevsel ||
|
||||||
(m->prevsel->scroller_proportion * max_client_width) +
|
(m->prevsel->scroller_proportion * max_client_width) +
|
||||||
(root_client->scroller_proportion * max_client_width) >
|
(root_client->scroller_proportion * max_client_width) >
|
||||||
m->w.width - 2 * scroller_structs - cur_gappih) &&
|
m->w.width - 2 * scroller_structs - cur_gappih) &&
|
||||||
scroller_prefer_center)) {
|
scroller_prefer_center)) {
|
||||||
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
||||||
} else {
|
} else {
|
||||||
target_geom.x =
|
target_geom.x = root_client->geom.x > m->w.x + (m->w.width) / 2
|
||||||
root_client->geom.x > m->w.x + (m->w.width) / 2
|
? m->w.x + (m->w.width -
|
||||||
? m->w.x + (m->w.width -
|
root_client->scroller_proportion *
|
||||||
root_client->scroller_proportion * max_client_width -
|
max_client_width -
|
||||||
scroller_structs)
|
scroller_structs)
|
||||||
: m->w.x + scroller_structs;
|
: m->w.x + scroller_structs;
|
||||||
}
|
}
|
||||||
resize(tempClients[focus_client_index], target_geom, 0);
|
resize(tempClients[focus_client_index], target_geom, 0);
|
||||||
} else {
|
} else {
|
||||||
target_geom.x = c->geom.x;
|
target_geom.x = c->geom.x;
|
||||||
resize(tempClients[focus_client_index], target_geom, 0);
|
resize(tempClients[focus_client_index], target_geom, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i <= focus_client_index; i++) {
|
for (i = 1; i <= focus_client_index; i++) {
|
||||||
c = tempClients[focus_client_index - i];
|
c = tempClients[focus_client_index - i];
|
||||||
target_geom.width = max_client_width * c->scroller_proportion;
|
target_geom.width = max_client_width * c->scroller_proportion;
|
||||||
target_geom.x = tempClients[focus_client_index - i + 1]->geom.x -
|
target_geom.x = tempClients[focus_client_index - i + 1]->geom.x -
|
||||||
cur_gappih - target_geom.width;
|
cur_gappih - target_geom.width;
|
||||||
resize(c, target_geom, 0);
|
resize(c, target_geom, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < n - focus_client_index; i++) {
|
for (i = 1; i < n - focus_client_index; i++) {
|
||||||
c = tempClients[focus_client_index + i];
|
c = tempClients[focus_client_index + i];
|
||||||
target_geom.width = max_client_width * c->scroller_proportion;
|
target_geom.width = max_client_width * c->scroller_proportion;
|
||||||
target_geom.x = tempClients[focus_client_index + i - 1]->geom.x +
|
target_geom.x = tempClients[focus_client_index + i - 1]->geom.x +
|
||||||
cur_gappih +
|
cur_gappih +
|
||||||
tempClients[focus_client_index + i - 1]->geom.width;
|
tempClients[focus_client_index + i - 1]->geom.width;
|
||||||
resize(c, target_geom, 0);
|
resize(c, target_geom, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(tempClients); // 最后释放内存
|
free(tempClients); // 最后释放内存
|
||||||
}
|
}
|
||||||
|
|
||||||
void tile(Monitor *m) {
|
void tile(Monitor *m) {
|
||||||
unsigned int i, n = 0, h, r, ie = enablegaps, mw, my, ty;
|
unsigned int i, n = 0, h, r, ie = enablegaps, mw, my, ty;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
wl_list_for_each(c, &clients,
|
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, m) && ISTILED(c)) n++;
|
||||||
link) if (VISIBLEON(c, m) && ISTILED(c)) n++;
|
if (n == 0)
|
||||||
if (n == 0)
|
return;
|
||||||
return;
|
|
||||||
|
|
||||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||||
|
|
||||||
cur_gappih = smartgaps && m->visible_clients == 1 ? 0 : cur_gappih;
|
cur_gappih = smartgaps && m->visible_clients == 1 ? 0 : cur_gappih;
|
||||||
cur_gappiv = smartgaps && m->visible_clients == 1 ? 0 : cur_gappiv;
|
cur_gappiv = smartgaps && m->visible_clients == 1 ? 0 : cur_gappiv;
|
||||||
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
||||||
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
||||||
|
|
||||||
if (n > selmon->pertag->nmasters[selmon->pertag->curtag])
|
if (n > selmon->pertag->nmasters[selmon->pertag->curtag])
|
||||||
mw = selmon->pertag->nmasters[selmon->pertag->curtag]
|
mw = selmon->pertag->nmasters[selmon->pertag->curtag]
|
||||||
? (m->w.width + cur_gappiv * ie) *
|
? (m->w.width + cur_gappiv * ie) *
|
||||||
selmon->pertag->mfacts[selmon->pertag->curtag]
|
selmon->pertag->mfacts[selmon->pertag->curtag]
|
||||||
: 0;
|
: 0;
|
||||||
else
|
else
|
||||||
mw = m->w.width - 2 * cur_gappov + cur_gappiv * ie;
|
mw = m->w.width - 2 * cur_gappov + cur_gappiv * ie;
|
||||||
i = 0;
|
i = 0;
|
||||||
my = ty = cur_gappoh;
|
my = ty = cur_gappoh;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (!VISIBLEON(c, m) || !ISTILED(c))
|
if (!VISIBLEON(c, m) || !ISTILED(c))
|
||||||
continue;
|
continue;
|
||||||
if (i < selmon->pertag->nmasters[selmon->pertag->curtag]) {
|
if (i < selmon->pertag->nmasters[selmon->pertag->curtag]) {
|
||||||
r = MIN(n, selmon->pertag->nmasters[selmon->pertag->curtag]) - i;
|
r = MIN(n, selmon->pertag->nmasters[selmon->pertag->curtag]) - i;
|
||||||
h = (m->w.height - my - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
|
h = (m->w.height - my - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
|
||||||
resize(c,
|
resize(c,
|
||||||
(struct wlr_box){.x = m->w.x + cur_gappov,
|
(struct wlr_box){.x = m->w.x + cur_gappov,
|
||||||
.y = m->w.y + my,
|
.y = m->w.y + my,
|
||||||
.width = mw - cur_gappiv * ie,
|
.width = mw - cur_gappiv * ie,
|
||||||
.height = h},
|
.height = h},
|
||||||
0);
|
0);
|
||||||
my += c->geom.height + cur_gappih * ie;
|
my += c->geom.height + cur_gappih * ie;
|
||||||
} else {
|
} else {
|
||||||
r = n - i;
|
r = n - i;
|
||||||
h = (m->w.height - ty - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
|
h = (m->w.height - ty - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
|
||||||
resize(c,
|
resize(c,
|
||||||
(struct wlr_box){.x = m->w.x + mw + cur_gappov,
|
(struct wlr_box){.x = m->w.x + mw + cur_gappov,
|
||||||
.y = m->w.y + ty,
|
.y = m->w.y + ty,
|
||||||
.width = m->w.width - mw - 2 * cur_gappov,
|
.width = m->w.width - mw - 2 * cur_gappov,
|
||||||
.height = h},
|
.height = h},
|
||||||
0);
|
0);
|
||||||
ty += c->geom.height + cur_gappih * ie;
|
ty += c->geom.height + cur_gappih * ie;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void // 17
|
void // 17
|
||||||
monocle(Monitor *m) {
|
monocle(Monitor *m) {
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (!VISIBLEON(c, m) || !ISTILED(c))
|
if (!VISIBLEON(c, m) || !ISTILED(c))
|
||||||
continue;
|
continue;
|
||||||
resize(c, m->w, 0);
|
resize(c, m->w, 0);
|
||||||
}
|
}
|
||||||
if ((c = focustop(m)))
|
if ((c = focustop(m)))
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||||
}
|
}
|
||||||
11336
src/maomao.c
11336
src/maomao.c
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue