mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-26 19:26:32 +00:00
use wlr_box for monitor regions
This commit is contained in:
parent
2fb9f53483
commit
5dd8a5f22f
1 changed files with 11 additions and 14 deletions
25
dwl.c
25
dwl.c
|
@ -96,8 +96,8 @@ struct Monitor {
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
struct wlr_output *wlr_output;
|
struct wlr_output *wlr_output;
|
||||||
struct wl_listener frame;
|
struct wl_listener frame;
|
||||||
struct wlr_box *geom; /* layout-relative */
|
struct wlr_box m; /* monitor area, layout-relative */
|
||||||
int wx, wy, ww, wh; /* layout-relative */
|
struct wlr_box w; /* window area, layout-relative */
|
||||||
const Layout *lt[2];
|
const Layout *lt[2];
|
||||||
unsigned int seltags;
|
unsigned int seltags;
|
||||||
unsigned int sellt;
|
unsigned int sellt;
|
||||||
|
@ -885,12 +885,9 @@ rendermon(struct wl_listener *listener, void *data)
|
||||||
/* wlr_output_attach_render makes the OpenGL context current. */
|
/* wlr_output_attach_render makes the OpenGL context current. */
|
||||||
if (!wlr_output_attach_render(m->wlr_output, NULL))
|
if (!wlr_output_attach_render(m->wlr_output, NULL))
|
||||||
return;
|
return;
|
||||||
/* Get effective monitor geometry and window area */
|
/* Get effective monitor geometry to use for window area */
|
||||||
m->geom = wlr_output_layout_get_box(output_layout, m->wlr_output);
|
m->m = *wlr_output_layout_get_box(output_layout, m->wlr_output);
|
||||||
m->wx = m->geom->x;
|
m->w = m->m;
|
||||||
m->wy = m->geom->y;
|
|
||||||
m->ww = m->geom->width;
|
|
||||||
m->wh = m->geom->height;
|
|
||||||
|
|
||||||
arrange(m);
|
arrange(m);
|
||||||
|
|
||||||
|
@ -1231,21 +1228,21 @@ tile(Monitor *m)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (n > m->nmaster)
|
if (n > m->nmaster)
|
||||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
mw = m->nmaster ? m->w.width * m->mfact : 0;
|
||||||
else
|
else
|
||||||
mw = m->ww;
|
mw = m->w.width;
|
||||||
i = my = ty = 0;
|
i = my = ty = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (!VISIBLEON(c, m) || c->isfloating)
|
if (!VISIBLEON(c, m) || c->isfloating)
|
||||||
continue;
|
continue;
|
||||||
wlr_xdg_surface_get_geometry(c->xdg_surface, &ca);
|
wlr_xdg_surface_get_geometry(c->xdg_surface, &ca);
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
h = (m->w.height - my) / (MIN(n, m->nmaster) - i);
|
||||||
resize(c, m->wx, m->wy + my, mw, h);
|
resize(c, m->w.x, m->w.y + my, mw, h);
|
||||||
my += ca.height + 2 * c->bw;
|
my += ca.height + 2 * c->bw;
|
||||||
} else {
|
} else {
|
||||||
h = (m->wh - ty) / (n - i);
|
h = (m->w.height - ty) / (n - i);
|
||||||
resize(c, m->wx + mw, m->wy + ty, m->ww - mw, h);
|
resize(c, m->w.x + mw, m->w.y + ty, m->w.width - mw, h);
|
||||||
ty += ca.height + 2 * c->bw;
|
ty += ca.height + 2 * c->bw;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
|
Loading…
Reference in a new issue