This tells the wm when a windows state changes from by some external
means, such as a request by the application.
Fullscreen windows are also saved across tab switches using this
interface.
(cme->message_type == atoms[NET_STATE]) &&
(cme->data.l[1] == atoms[NET_FULL] ||
cme->data.l[2] == atoms[NET_FULL])) {
(cme->message_type == atoms[NET_STATE]) &&
(cme->data.l[1] == atoms[NET_FULL] ||
cme->data.l[2] == atoms[NET_FULL])) {
- if (cme->data.l[0] == 1 || /* _NET_WM_STATE_ADD */
- (cme->data.l[0] == 2 && /* _NET_WM_STATE_TOGGLE */
- win->state != ST_FULL))
- sys_show(win, ST_FULL);
- else
- sys_show(win, ST_SHOW);
+ state_t next = (cme->data.l[0] == 1 || /* _NET_WM_STATE_ADD */
+ (cme->data.l[0] == 2 && /* _NET_WM_STATE_TOGGLE */
+ win->state != ST_FULL)) ? ST_FULL : ST_SHOW;
+ wm_handle_state(win, win->state, next);
+ sys_show(win, next);
}
}
else if (type == PropertyNotify) {
}
}
else if (type == PropertyNotify) {
typedef struct {
win_t *win; // the window
int height; // win height in _this_ tag
typedef struct {
win_t *win; // the window
int height; // win height in _this_ tag
- state_t state; // state of window
} row_t;
typedef struct {
} row_t;
typedef struct {
flt->h = dpy->geom->h / 2;
flt->x = dpy->geom->x + flt->w / 2;
flt->y = dpy->geom->y + flt->h / 2;
flt->h = dpy->geom->h / 2;
flt->x = dpy->geom->x + flt->w / 2;
flt->y = dpy->geom->y + flt->h / 2;
if (dpy->flt) {
flt->x = dpy->flt->x + 20;
flt->y = dpy->flt->y + 20;
if (dpy->flt) {
flt->x = dpy->flt->x + 20;
flt->y = dpy->flt->y + 20;
col->width, dpy->geom->h-2*margin);
break;
}
col->width, dpy->geom->h-2*margin);
break;
}
- ROW(lrow)->state = state;
sys_show(win, state);
if (focus == win)
sys_raise(win);
sys_show(win, state);
if (focus == win)
sys_raise(win);
flt_t *flt = lflt->data;
sys_move(win, flt->x, flt->y, flt->w, flt->h);
sys_raise(flt->win);
flt_t *flt = lflt->data;
sys_move(win, flt->x, flt->y, flt->w, flt->h);
sys_raise(flt->win);
+ sys_show(flt->win, flt->state);
- /* Show/hide tags */
- tag_foreach_col(wm_tag, dpy, col, row, win)
- sys_show(win, ROW(row)->state);
- tag_foreach_flt(wm_tag, dpy, flt, win)
- sys_show(win, FLT(flt)->state);
for (list_t *tag = wm ->tags; tag; tag = tag->next)
if (tag->data != wm_tag) {
tag_foreach_col(TAG(tag), dpy, col, row, win)
for (list_t *tag = wm ->tags; tag; tag = tag->next)
if (tag->data != wm_tag) {
tag_foreach_col(TAG(tag), dpy, col, row, win)
+int wm_handle_state(win_t *win, state_t prev, state_t next)
+{
+ flt_t *flt = NULL;
+
+ if (FLOATING != search(wm_tag, win, NULL, NULL, NULL, &flt)) {
+ cut_win(win, wm_tag);
+ put_win(win, wm_tag, FLOATING);
+ search(wm_tag, win, NULL, NULL, NULL, &flt);
+ }
+
+ flt->state = next;
+
+ if (prev == ST_MAX || prev == ST_FULL)
+ wm_update();
+
+ return 1;
+}
+
void wm_insert(win_t *win)
{
printf("wm_insert: %p\n", win);
void wm_insert(win_t *win)
{
printf("wm_insert: %p\n", win);
/* Called for each mouse movement */
int wm_handle_ptr(win_t *win, ptr_t ptr);
/* Called for each mouse movement */
int wm_handle_ptr(win_t *win, ptr_t ptr);
+/* Called when a window changes states */
+int wm_handle_state(win_t *win, state_t prev, state_t next);
+
/* Begin managing a window, called for each new window */
void wm_insert(win_t *win);
/* Begin managing a window, called for each new window */
void wm_insert(win_t *win);