...
 
Commits (10)
......@@ -11,9 +11,38 @@
#include <X11/Xatom.h>
#include <X11/Xutil.h>
static void apply_sizehints(struct client *c, struct size *size);
static void grab_input(struct client *c);
static void set_border(struct client *c);
static void
apply_sizehints(struct client *c, struct size *size)
{
int unsigned *w = &size->width, *h = &size->height, u;
/* base+increment size */
if (c->basew > 0 && c->incw > 0) {
u = (*w - c->basew) / c->incw;
*w = c->basew + u * c->incw;
}
if (c->baseh > 0 && c->inch > 0) {
u = (*h-c->baseh)/c->inch;
*h = c->baseh+u*c->inch;
}
/* minimum size */
if (c->minw > 0)
*w = MAX(*w, c->minw);
if (c->minh > 0)
*h = MAX(*h, c->minh);
/* maximum size */
if (c->maxw > 0)
*w = MIN(*w, c->maxw);
if (c->maxh > 0)
*h = MIN(*h, c->maxh);
}
static void
grab_input(struct client *c)
{
......@@ -51,50 +80,6 @@ set_border(struct client *c)
XSetWindowBorderWidth(x11.dpy, c->win, c->border.width);
}
bool
client_check_size_hints(struct client *c, int unsigned *w, int unsigned *h)
{
int unsigned u;
bool change = false;
/* don't respect size hints for tiled or fullscreen windows */
if (!c->floating || c->fullscreen) {
return *w != c->dim.width || *h != c->dim.height;
}
if (*w != c->dim.width) {
if (c->basew > 0 && c->incw > 0) {
u = (*w - c->basew) / c->incw;
*w = c->basew + u * c->incw;
}
if (c->minw > 0) {
*w = MAX(*w, c->minw);
}
if (c->maxw > 0) {
*w = MIN(*w, c->maxw);
}
if (*w != c->dim.width) {
change = true;
}
}
if (*h != c->dim.height) {
if (c->baseh > 0 && c->inch > 0) {
u = (*h-c->baseh)/c->inch;
*h = c->baseh+u*c->inch;
}
if (c->minh > 0) {
*h = MAX(*h, c->minh);
}
if (c->maxh > 0) {
*h = MIN(*h, c->maxh);
}
if (*h != c->dim.height) {
change = true;
}
}
return change;
}
struct client *
client_create(Window win, bool viewable)
{
......@@ -122,6 +107,8 @@ client_create(Window win, bool viewable)
sizeof(struct client), strerror(errno));
}
c->win = win;
/* dimensions */
c->dim = (struct rectangle) {
.x = 0,
.y = 0,
......@@ -134,23 +121,30 @@ client_create(Window win, bool viewable)
.width = (int unsigned) wa.width,
.height = (int unsigned) wa.height,
};
debug("new window's size attributes: %ux%u%+d%+d",
c->dim_floating.width, c->dim_floating.height,
c->dim_floating.x, c->dim_floating.y);
c->floating = false;
c->fullscreen = false;
c->dirty = false;
c->border.width = config_get()->window.border.width;
XSetWindowBorderWidth(x11.dpy, c->win, c->border.width);
client_query_size_hints(c);
/* name */
c->name[0] = '\0';
client_query_name(c);
/* type */
c->floating = false;
c->dialog = false;
client_query_window_type(c);
/* state */
c->fullscreen = false;
client_query_window_state(c);
/* input and appearance */
c->focused = false;
c->border.width = config_get()->window.border.width;
XSetWindowBorderWidth(x11.dpy, c->win, c->border.width);
grab_input(c);
set_border(c);
/* TODO: ??? */
c->dirty = false;
return c;
}
......@@ -179,17 +173,27 @@ client_kill(struct client *c)
void
client_move(struct client *c, struct position pos)
{
c->dim.pos = pos;
if (c->floating && !c->fullscreen)
if (c->floating)
c->dim_floating.pos = pos;
XMoveWindow(x11.dpy, c->win, pos.x, pos.y);
if (!c->fullscreen) {
c->dim.pos = pos;
XMoveWindow(x11.dpy, c->win, pos.x, pos.y);
}
}
void
client_moveresize(struct client *c, struct rectangle dimension)
{
client_move(c, dimension.pos);
client_resize(c, dimension.size);
}
void
client_moveresize(struct client *c, struct position pos, struct size size)
client_moveresize_fullscreen(struct client *c, struct rectangle dimension)
{
client_move(c, pos);
client_resize(c, size);
c->dim = dimension;
XMoveResizeWindow(x11.dpy, c->win, dimension.x, dimension.y,
dimension.width, dimension.height);
}
void
......@@ -267,22 +271,88 @@ client_query_size_hints(struct client *c)
/* maximum size */
if (hints.flags & PMaxSize) {
c->maxw = (int unsigned) hints.max_width;
c->maxw = (int unsigned) hints.max_height;
c->maxh = (int unsigned) hints.max_height;
} else {
c->maxw = c->maxh = 0;
}
}
void
client_query_window_state(struct client *c)
{
int ret;
int long unsigned length, offset;
Atom atom, req_type;
Bool delete;
char unsigned *property;
int unsigned format;
int long unsigned nitems, remaining;
length = sizeof(atom);
offset = 0lu;
delete = False;
req_type = XA_ATOM;
ret = XGetWindowProperty(x11.dpy, c->win, x11.netatom[NetWMState],
(int signed) offset, (int signed) length,
delete, req_type, &atom,
(int signed *) &format, &nitems, &remaining,
&property);
if (ret != Success)
return;
if (!property)
return;
if ((Atom) *property == x11.netatom[NetWMStateFullscreen])
c->fullscreen = true;
else
warn("XGetWindowProperty returned unknown _NET_WM_STATE");
XFree(property);
}
void
client_query_window_type(struct client *c)
{
int ret;
int long unsigned length, offset;
Atom atom, req_type;
Bool delete;
char unsigned *property;
int unsigned format;
int long unsigned nitems, remaining;
/* query if dialog */
length = sizeof(atom);
offset = 0lu;
delete = False;
req_type = XA_ATOM;
ret = XGetWindowProperty(x11.dpy, c->win, x11.netatom[NetWMWindowType],
(int signed) offset, (int signed) length,
delete, req_type, &atom,
(int signed *) &format, &nitems, &remaining,
&property);
if (ret != Success)
return;
if (!property)
return;
if ((Atom) *property == x11.netatom[NetWMWindowTypeDialog])
c->floating = c->dialog = true;
else
warn("XGetWindowProperty returned unknown _NET_WM_WINDOW_TYPE");
XFree(property);
}
void
client_resize(struct client *c, struct size size)
{
/* TODO: add asserts */
size.width = MAX(size.width, 1);
size.height = MAX(size.height, 1);
if (client_check_size_hints(c, &size.width, &size.height)) {
size.width = MAX(1, size.width);
size.height = MAX(1, size.height);
if (c->floating) {
apply_sizehints(c, &size);
c->dim_floating.size = size;
}
if (!c->fullscreen) {
c->dim.size = size;
if (c->floating && !c->fullscreen)
c->dim_floating.size = size;
XResizeWindow(x11.dpy, c->win, size.width, size.height);
}
}
......
......@@ -21,15 +21,16 @@ struct client {
bool focused;
};
bool client_check_size_hints(struct client *c,
int unsigned *w, int unsigned *h);
struct client *client_create(Window win, bool viewable);
void client_destroy(struct client *c);
void client_kill(struct client *c);
void client_move(struct client *c, struct position pos);
void client_moveresize(struct client *c, struct position pos, struct size size);
void client_moveresize(struct client *c, struct rectangle dimension);
void client_moveresize_fullscreen(struct client *c, struct rectangle dimension);
void client_query_name(struct client *c);
void client_query_size_hints(struct client *c);
void client_query_window_state(struct client *c);
void client_query_window_type(struct client *c);
void client_resize(struct client *c, struct size size);
bool client_send_event(struct client *c, Atom atom);
void client_set_focus(struct client *c, bool focus);
......
......@@ -72,7 +72,6 @@ static size_t unifyscreens(XineramaScreenInfo **, size_t);
static void unmapnotify(XEvent *);
static void updateclient(struct client *);
static void updategeom(void);
static void updatemon(struct monitor *, int, int, unsigned int, unsigned int);
static void updatetransient(struct client *);
static void updatewsm(void);
static void updatewsmbox(struct workspace *);
......@@ -1010,8 +1009,8 @@ setfullscreen(struct client *c, bool fullscreen)
c->fullscreen = fullscreen;
if (fullscreen) {
XSetWindowBorderWidth(x11.dpy, c->win, 0);
XRaiseWindow(x11.dpy, c->win);
client_moveresize(c, c->ws->mon->dim.pos, c->ws->mon->dim.size);
monitor_restack(c->ws->mon);
monitor_arrange(c->ws->mon);
} else {
XSetWindowBorderWidth(x11.dpy, c->win, c->border.width);
monitor_arrange(c->ws->mon);
......@@ -1496,9 +1495,7 @@ void
togglepad(union arg arg)
{
struct config const *config = config_get();
struct position pos;
struct size size;
int unsigned padmargin = config->scratchpad.margin;
struct rectangle paddim;
int unsigned borderwidth = config->window.border.width;
(void) arg;
......@@ -1520,15 +1517,10 @@ togglepad(union arg arg)
monitor_focus(seat->selmon, false);
state->scratchpad.monitor = seat->selmon;
pos.x = state->scratchpad.monitor->dim_work.x
+ (int signed) padmargin;
pos.y = state->scratchpad.monitor->dim_work.y
+ (int signed) padmargin;
size.width = state->scratchpad.monitor->dim_work.width
- 2 * (padmargin + borderwidth);
size.height = state->scratchpad.monitor->dim_work.height
- 2 * (padmargin + borderwidth);
client_moveresize(state->scratchpad.client, pos, size);
paddim = state->scratchpad.monitor->dim_pad;
paddim.width -= 2 * borderwidth;
paddim.height -= 2 * borderwidth;
client_moveresize(state->scratchpad.client, paddim);
client_show(state->scratchpad.client, true);
XRaiseWindow(x11.dpy, state->scratchpad.client->win);
......@@ -1663,33 +1655,16 @@ unmapnotify(XEvent *e)
void
updateclient(struct client *c)
{
int ret, di;
unsigned long dl;
unsigned char *p = NULL;
Atom da;
/* window state */
ret = XGetWindowProperty(x11.dpy, c->win, x11.netatom[NetWMState], 0,
sizeof(da), false, XA_ATOM, &da, &di, &dl, &dl,
&p);
if (ret == Success && p) {
if ((Atom) *p == x11.netatom[NetWMStateFullscreen]) {
setfullscreen(c, true);
}
free(p);
}
/* window type */
ret = XGetWindowProperty(x11.dpy, c->win, x11.netatom[NetWMWindowType],
0, sizeof(da), false, XA_ATOM, &da, &di, &dl,
&dl, &p);
if (ret == Success && p) {
if ((Atom) *p == x11.netatom[NetWMWindowTypeDialog]) {
debug("\033[32mwindow %lu is a dialog!\033[0m", c->win);
c->dialog = true;
setfloating(c, true);
}
free(p);
client_query_window_state(c);
if (c->fullscreen) {
debug("\033[32mwindow %lu has fullscreen state\033[0m", c->win);
setfullscreen(c, true);
}
client_query_window_type(c);
if (c->dialog) {
debug("\033[32mwindow %lu is a dialog!\033[0m", c->win);
setfloating(c, true);
}
}
......@@ -1702,6 +1677,8 @@ updategeom(void)
XineramaScreenInfo *info;
struct monitor *mon;
struct workspace *ws;
int x, y;
int unsigned w, h;
int wsx;
if (!XineramaIsActive(x11.dpy)) {
......@@ -1726,9 +1703,16 @@ updategeom(void)
}
monitor_show_workspace(mon, ws);
}
updatemon(seat->selmon, 0, 0,
(int unsigned) DisplayWidth(x11.dpy, x11.screen),
(int unsigned) DisplayHeight(x11.dpy, x11.screen));
x = 0;
y = 0;
w = (int unsigned) DisplayWidth(x11.dpy, x11.screen);
h = (int unsigned) DisplayHeight(x11.dpy, x11.screen);
monitor_moveresize(mon, (struct rectangle) {
.x = x,
.y = y,
.width = w,
.height = h,
});
return;
}
......@@ -1774,27 +1758,20 @@ updategeom(void)
monitor_show_workspace(mon, ws);
}
mon = seat->monitors->elements[i];
updatemon(mon, info[i].x_org, info[i].y_org,
(int unsigned) info[i].width,
(int unsigned) info[i].height);
x = info[i].x_org;
y = info[i].y_org;
w = (int unsigned) info[i].width;
h = (int unsigned) info[i].height;
monitor_moveresize(mon, (struct rectangle) {
.x = x,
.y = y,
.width = w,
.height = h,
});
}
free(info);
}
void
updatemon(struct monitor *mon, int x, int y, unsigned int w, unsigned int h)
{
mon->dim = (struct rectangle) { .x = x, .y = y,
.width = w, .height = h };
statusbar_update(mon->bar);
/* TODO: what if bar is higher than monitor? */
mon->dim_work = mon->dim;
mon->dim_work.y += (int signed) mon->bar->size.height;
mon->dim_work.height -= mon->bar->size.height;
monitor_arrange(mon);
}
void
updatetransient(struct client *c)
{
......
......@@ -32,8 +32,7 @@ bstack_apply(struct layout *l, struct rectangle *area)
{
struct config const *config = config_get();
struct stack_state *state = l->state;
struct position pos;
struct size size, realsize;
struct rectangle cdim, real_cdim;
int unsigned i, borderwidth = config->window.border.width;
size_t nmaster;
float mfact;
......@@ -47,34 +46,32 @@ bstack_apply(struct layout *l, struct rectangle *area)
: nmaster >= l->clients->size ? 1.0f
: state->mfact;
if (nmaster > 0) {
pos.y = area->y;
size.width = area->width / (int unsigned) nmaster;
size.height = (int unsigned) (mfact * (float) area->height);
cdim.y = area->y;
cdim.width = area->width / (int unsigned) nmaster;
cdim.height = (int unsigned) (mfact * (float) area->height);
for (i = 0; i < nmaster; ++i) {
pos.x = area->x + (int signed) (i * size.width);
realsize = (struct size) {
size.width - 2 * borderwidth,
size.height - 2 * borderwidth,
};
client_moveresize(l->clients->elements[i],
pos, realsize);
real_cdim = cdim;
real_cdim.x = area->x + (int signed) (i * cdim.width);
real_cdim.width -= 2 * borderwidth;
real_cdim.height -= 2 * borderwidth;
client_moveresize(l->clients->elements[i], real_cdim);
}
}
if (nmaster == l->clients->size)
return;
/* stack area */
pos.y = area->y + (int signed) (mfact * (float) area->height);
size.width = area->width / (int unsigned) (l->clients->size - nmaster);
size.height = area->height - (int unsigned) (pos.y - area->y);
cdim.y = area->y + (int signed) (mfact * (float) area->height);
cdim.width = area->width / (int unsigned) (l->clients->size - nmaster);
cdim.height = area->height - (int unsigned) (cdim.y - area->y);
for (i = (int unsigned) nmaster; i < l->clients->size; ++i) {
pos.x = area->x + (int signed) ((i - (int unsigned) nmaster)
* size.width);
realsize = (struct size) {
size.width - 2 * borderwidth,
size.height - 2 * borderwidth,
};
client_moveresize(l->clients->elements[i], pos, realsize);
real_cdim = cdim;
real_cdim.x = area->x
+ (int signed) ((i - (int unsigned) nmaster)
* cdim.width);
real_cdim.width -= 2 * borderwidth;
real_cdim.height -= 2 * borderwidth;
client_moveresize(l->clients->elements[i], real_cdim);
}
}
......@@ -154,8 +151,7 @@ lfixed_apply(struct layout *l, struct rectangle *area)
{
struct config const *config = config_get();
struct lfixed_state *state = l->state;
struct position pos;
struct size size, realsize;
struct rectangle cdim, real_cdim;
int unsigned i, wfixed, borderwidth = config->window.border.width;
size_t nfixed;
struct rectangle stack_area;
......@@ -168,17 +164,15 @@ lfixed_apply(struct layout *l, struct rectangle *area)
area->width - 2 * borderwidth - 1);
nfixed = MIN(state->nfixed, l->clients->size);
if (nfixed > 0) {
pos.x = area->x;
pos.y = area->y;
size.width = nfixed == l->clients->size ? area->width : wfixed;
size.height = area->height;
cdim.x = area->x;
cdim.y = area->y;
cdim.width = nfixed == l->clients->size ? area->width : wfixed;
cdim.height = area->height;
for (i = 0; i < nfixed; ++i) {
realsize = (struct size) {
size.width - 2 * borderwidth,
size.height - 2 * borderwidth,
};
client_moveresize(l->clients->elements[i],
pos, realsize);
real_cdim = cdim;
real_cdim.width -= 2 * borderwidth;
real_cdim.height -= 2 * borderwidth;
client_moveresize(l->clients->elements[i], real_cdim);
}
}
if (nfixed == l->clients->size)
......@@ -223,8 +217,7 @@ rstack_apply(struct layout *l, struct rectangle *area)
{
struct config const *config = config_get();
struct stack_state *state = l->state;
struct position pos;
struct size size, realsize;
struct rectangle cdim, real_cdim;
int unsigned i, borderwidth = config->window.border.width;
size_t nmaster;
float mfact;
......@@ -235,34 +228,32 @@ rstack_apply(struct layout *l, struct rectangle *area)
: nmaster >= l->clients->size ? 1.0f
: state->mfact;
if (nmaster > 0) {
pos.x = area->x;
size.width = (int unsigned) (mfact * (float) area->width);
size.height = area->height / (int unsigned) nmaster;
cdim.x = area->x;
cdim.width = (int unsigned) (mfact * (float) area->width);
cdim.height = area->height / (int unsigned) nmaster;
for (i = 0; i < nmaster; ++i) {
pos.y = area->y + (int signed) (i * size.height);
realsize = (struct size) {
size.width - 2 * borderwidth,
size.height - 2 * borderwidth,
};
client_moveresize(l->clients->elements[i],
pos, realsize);
real_cdim = cdim;
real_cdim.y = area->y + (int signed) (i * cdim.height);
real_cdim.width -= 2 * borderwidth;
real_cdim.height -= 2 * borderwidth;
client_moveresize(l->clients->elements[i], real_cdim);
}
}
if (nmaster == l->clients->size)
return;
/* draw stack area */
pos.x = area->x + (int signed) (mfact * (float) area->width);
size.width = area->width - (int unsigned) (pos.x - area->x);
size.height = area->height
cdim.x = area->x + (int signed) (mfact * (float) area->width);
cdim.width = area->width - (int unsigned) (cdim.x - area->x);
cdim.height = area->height
/ (int unsigned) (l->clients->size - nmaster);
for (i = (int unsigned) nmaster; i < l->clients->size; ++i) {
pos.y = area->y + (int signed) ((i - nmaster) * size.height);
realsize = (struct size) {
size.width - 2 * borderwidth,
size.height - 2 * borderwidth,
};
client_moveresize(l->clients->elements[i], pos, realsize);
real_cdim = cdim;
real_cdim.y = area->y
+ (int signed) ((i - nmaster) * cdim.height);
real_cdim.width -= 2 * borderwidth;
real_cdim.height -= 2 * borderwidth;
client_moveresize(l->clients->elements[i], real_cdim);
}
}
......
#include "monitor.h"
#include "client.h"
#include "config.h"
#include "karuiwm.h"
#include "layout.h"
#include "list.h"
......@@ -31,14 +32,34 @@ monitor_arrange(struct monitor *mon)
int unsigned i;
state_set_clientmask(mon->seat->state, false);
layout_apply(mon->selws->layout, &mon->dim_work);
/* scratchpad */
if (mon->scratchpad)
layout_apply(mon->scratchpad->layout, &mon->dim_pad);
/* fullscreen */
for (i = 0; i < mon->selws->tiled->size; ++i) {
c = mon->selws->tiled->elements[i];
if (c->fullscreen)
client_moveresize_fullscreen(c, mon->dim);
}
for (i = 0; i < mon->selws->floating->size; ++i) {
c = mon->selws->floating->elements[i];
if (c->fullscreen)
client_moveresize_fullscreen(c, mon->dim);
}
/* floating */
for (i = 0; i < mon->selws->floating->size; i++) {
c = mon->selws->floating->elements[i];
fit(mon->dim_work, &c->dim_floating);
client_moveresize(c, c->dim_floating.pos, c->dim_floating.size);
client_moveresize(c, c->dim_floating);
}
/* tiled */
layout_apply(mon->selws->layout, &mon->dim_work);
state_set_clientmask(mon->seat->state, true);
mon->selws->mon = mon;
}
struct monitor *
......@@ -54,9 +75,11 @@ monitor_create(void)
mon->dim = (struct rectangle) { .x = 0, .y = 0,
.width = 1u, .height = 1u };
mon->dim_work = mon->dim;
mon->dim_pad = mon->dim;
mon->bar = statusbar_create(mon);
mon->seat = NULL;
mon->focused = false;
mon->scratchpad = NULL;
mon->selws = NULL;
return mon;
}
......@@ -87,6 +110,37 @@ monitor_focus(struct monitor *mon, bool focus)
statusbar_focus(mon->bar, focus);
}
void
monitor_moveresize(struct monitor *mon, struct rectangle dimensions)
{
struct config const *config = config_get();
int unsigned padmargin = config->scratchpad.margin;
/* update dimensions */
mon->dim = dimensions;
mon->dim_work = (struct rectangle) {
.x = mon->dim.x,
.y = mon->dim.y + (int signed) mon->bar->size.height,
.width = mon->dim.width,
.height = mon->dim.height
- MIN(mon->dim.height - 1, mon->bar->size.height),
};
mon->dim_pad = (struct rectangle) {
.x = mon->dim.x + (int signed) padmargin,
.y = mon->dim.y + (int signed) padmargin,
.width = mon->dim.width
- MIN(mon->dim_work.width - 1, 2 * (padmargin)),
.height = mon->dim.height
- MIN(mon->dim_work.height - 1, 2 * (padmargin)),
};
/* update statusbar */
statusbar_update(mon->bar);
/* rearrange clients */
monitor_arrange(mon);
}
void
monitor_restack(struct monitor *mon)
{
......@@ -98,6 +152,9 @@ monitor_restack(struct monitor *mon)
if (!mon->selws)
return;
nwindows = mon->selws->tiled->size + mon->selws->floating->size;
if (mon->scratchpad)
/* scratchpad should not have any floating windows */
nwindows += mon->scratchpad->tiled->size;
windows = calloc(nwindows, sizeof(Window));
if (!windows)
die("Could not allocate %zu bytes for list of %zu X windows",
......@@ -105,7 +162,31 @@ monitor_restack(struct monitor *mon)
si = 0;
/* fullscreen clients */
/* scratchpad */
if (mon->scratchpad) {
for (i = 0; i < mon->scratchpad->tiled->size; ++i) {
c = mon->scratchpad->tiled->elements[i];
if (c == mon->scratchpad->selcli)
windows[si++] = c->win;
}
for (i = 0; i < mon->scratchpad->tiled->size; ++i) {
c = mon->scratchpad->tiled->elements[i];
if (c != mon->scratchpad->selcli)
windows[si++] = c->win;
}
}
/* fullscreen */
for (i = 0; i < mon->selws->tiled->size; ++i) {
c = mon->selws->tiled->elements[i];
if (c->fullscreen && c == mon->selws->selcli)
windows[si++] = c->win;
}
for (i = 0; i < mon->selws->floating->size; ++i) {
c = mon->selws->floating->elements[i];
if (c->fullscreen && c == mon->selws->selcli)
windows[si++] = c->win;
}
for (i = 0; i < mon->selws->tiled->size; ++i) {
c = mon->selws->tiled->elements[i];
if (c->fullscreen)
......@@ -117,21 +198,19 @@ monitor_restack(struct monitor *mon)
windows[si++] = c->win;
}
/* floating clients */
/* floating */
for (i = 0; i < mon->selws->floating->size; ++i) {
c = mon->selws->floating->elements[i];
if (!c->fullscreen)
windows[si++] = c->win;
}
/* focused tiled client */
/* tiled */
for (i = 0; i < mon->selws->tiled->size; ++i) {
c = mon->selws->tiled->elements[i];
if (!c->fullscreen && c == mon->selws->selcli)
windows[si++] = c->win;
}
/* tiled clients */
for (i = 0; i < mon->selws->tiled->size; ++i) {
c = mon->selws->tiled->elements[i];
if (!c->fullscreen && c != mon->selws->selcli)
......@@ -153,9 +232,7 @@ monitor_show_workspace(struct monitor *mon, struct workspace *ws)
oldmon = ws ? ws->mon : NULL;
/* if nothing changes, don't do anything */
if (ws == oldws)
return;
if (mon == oldmon)
if (ws == oldws || mon == oldmon)
return;
/* update workspace for this monitor */
......
......@@ -6,9 +6,10 @@
struct monitor {
struct workspace *selws;
struct rectangle dim, dim_work;
struct rectangle dim, dim_work, dim_pad;
struct statusbar *bar;
struct seat *seat;
struct workspace *scratchpad;
bool focused;
};
......@@ -19,6 +20,7 @@ void monitor_arrange(struct monitor *mon);
struct monitor *monitor_create(void);
void monitor_destroy(struct monitor *mon);
void monitor_focus(struct monitor *mon, bool focus);
void monitor_moveresize(struct monitor *mon, struct rectangle dimensions);
void monitor_restack(struct monitor *mon);
void monitor_show_workspace(struct monitor *mon, struct workspace *ws);
......