Ejemplo n.º 1
0
void
ewmh_process_state_atom(Client *c, Atom state, int set) {
	CARD32 data[2];

	data[1] = None;
	if (state == atom[WindowStateFs]) {
		focus(c);
		if ((set == _NET_WM_STATE_ADD || set == _NET_WM_STATE_TOGGLE)
				&& !c->ismax) {
			c->wasfloating = c->isfloating;
			if (!c->isfloating)
				togglefloating(NULL);
			togglemax(NULL);
			data[0] = state;
		} else if ((set == _NET_WM_STATE_REMOVE ||
				set == _NET_WM_STATE_TOGGLE) && c->ismax) {
			togglemax(NULL);
			if (!c->wasfloating)
				togglefloating(NULL);
			data[0] = None;
		}
		XChangeProperty(dpy, c->win, atom[WindowState], XA_ATOM, 32,
		    PropModeReplace, (unsigned char *) data, 2);
		DPRINT;
		arrange(curmonitor());
		DPRINTF("%s: x%d y%d w%d h%d\n", c->name, c->x, c->y, c->w, c->h);
	}
	if (state == atom[WindowStateModal])
		focus(c);
}
Ejemplo n.º 2
0
void
maximize(int x, int y, int w, int h) {
	XEvent ev;

	if(!selmon->sel || selmon->sel->isfixed)
		return;
	XRaiseWindow(dpy, selmon->sel->win);
	if(!selmon->sel->ismax) {
		if(!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating)
			selmon->sel->wasfloating = True;
		else {
			togglefloating(NULL);
			selmon->sel->wasfloating = False;
		}
		selmon->sel->oldx = selmon->sel->x;
		selmon->sel->oldy = selmon->sel->y;
		selmon->sel->oldw = selmon->sel->w;
		selmon->sel->oldh = selmon->sel->h;
		resize(selmon->sel, x, y, w, h, True);
		selmon->sel->ismax = True;
	}
	else {
		resize(selmon->sel, selmon->sel->oldx, selmon->sel->oldy, selmon->sel->oldw, selmon->sel->oldh, True);
		if(!selmon->sel->wasfloating)
			togglefloating(NULL);
		selmon->sel->ismax = False;
	}
	drawbar(selmon);
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
Ejemplo n.º 3
0
static void moveresize(const Arg *arg) {

XEvent ev;
Monitor *m = selmon;

if(!(m->sel && arg && arg->v))
      return;
if(m->lt[m->sellt]->arrange && !m->sel->isfloating)
      togglefloating(NULL);
resize(m->sel, m->sel->x + ((int *)arg->v)[0],
    m->sel->y + ((int *)arg->v)[1],
    m->sel->w + ((int *)arg->v)[2],
    m->sel->h + ((int *)arg->v)[3],
    True);

while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}