static const char *cvstag = "$scrotwm$";
-#define SWM_VERSION "1.0"
+#define SWM_VERSION "0.9.11"
#include <stdio.h>
#include <stdlib.h>
long data[] = {state, None};
XEvent ev;
XWindowAttributes wa;
+ int putback;
DNPRINTF(SWM_D_EVENT, "set_win_state: window: %lu\n", win->id);
(unsigned char *)data, 2);
/* wait for completion of XChangeProperty */
+ putback = 0;
while (XCheckIfEvent(display, &ev, set_win_notify_cb, (char *)win))
- ;
+ putback = 1;
+ if (putback)
+ XPutBackEvent(display, &ev);
}
long
{
XClientMessageEvent cm;
+ if (win == NULL)
+ return;
+
bzero(&cm, sizeof cm);
cm.type = ClientMessage;
cm.window = win->id;
DNPRINTF(SWM_D_MISC, "config_win: win %lu x %d y %d w %d h %d\n",
win->id, win->g.x, win->g.y, win->g.w, win->g.h);
+
+ if (win == NULL)
+ return;
+
ce.type = ConfigureNotify;
ce.display = display;
ce.event = win->id;
{
XEvent ev;
XWindowAttributes wa;
+ int putback;
if (win == NULL)
return;
XUnmapWindow(display, win->id);
/* make sure we wait for XUnmapWindow completion */
+ putback = 0;
while (XCheckIfEvent(display, &ev, unmap_window_cb, (char *)win))
- ;
+ putback = 1;
+ if (putback)
+ XPutBackEvent(display, &ev);
}
void
{
XKeyEvent event;
+ if (win == NULL)
+ return;
+
event.display = display; /* Ignored, but what the hell */
event.window = win->id;
event.root = win->s->root;
{
if (win == NULL)
return;
-
+ if (win->ws == NULL)
+ return;
if (win->ws->r == NULL)
return;
if (win == NULL)
return;
+ if (win->ws == NULL)
+ return;
/* use big hammer to make sure it works under all use cases */
unfocus_all();
struct ws_win *win, *winfocus = NULL, *parent = NULL;
struct workspace *new_ws, *old_ws;
+ if (!(r && r->s)) {
+ fprintf(stderr, "r && r->s failed\n");
+ abort();
+ }
+ if (wsid < 0 || wsid > SWM_WS_MAX) {
+ fprintf(stderr, "illegal wsid\n");
+ abort();
+ }
+
this_r = r;
old_ws = this_r->ws;
new_ws = &this_r->s->ws[wsid];
"%d -> %d\n", r->s->idx, WIDTH(r), HEIGHT(r), X(r), Y(r),
old_ws->idx, wsid);
+ if (new_ws == NULL || old_ws == NULL) {
+ fprintf(stderr, "new_ws = %p old_ws = %p\n", new_ws, old_ws);
+ abort();
+ }
+
if (new_ws == old_ws)
return;
"(screen %d, region %d)\n", r->ws->idx, i, j++);
/* start with screen geometry, adjust for bar */
+ if (r == NULL) {
+ fprintf(stderr, "illegal r\n");
+ abort();
+ }
g = r->g;
g.w -= 2;
g.h -= 2;
g.y += bar_height;
g.h -= bar_height;
}
-
+ if (r->ws == NULL) {
+ fprintf(stderr, "illegal ws\n");
+ abort();
+ }
+ if (r->ws->cur_layout == NULL) {
+ fprintf(stderr, "illegal cur_layout\n");
+ abort();
+ }
r->ws->restack = 0;
+ if (r->ws->cur_layout->l_stack == NULL) {
+ fprintf(stderr, "illegal l_stack\n");
+ abort();
+ }
r->ws->cur_layout->l_stack(r->ws, &g);
}
}
}
}
- if (win->java && win->transient) {
- }
/* alter window position if quirky */
if (win->quirks & SWM_Q_ANYWHERE) {
win->manual = 1; /* don't center the quirky windows */
DNPRINTF(SWM_D_MISC, "unmanage_window: %lu\n", win->id);
+ /* needed for restart wm */
+ set_win_state(win, WithdrawnState);
+
if (win->transient) {
parent = find_window(win->transient);
if (parent)
/* attach windows to a region */
/* normal windows */
for (j = 0; j < no; j++) {
- XGetWindowAttributes(display, wins[j], &wa);
if (!XGetWindowAttributes(display, wins[j], &wa) ||
wa.override_redirect ||
XGetTransientForHint(display, wins[j], &d1))
}
/* transient windows */
for (j = 0; j < no; j++) {
- if (!XGetWindowAttributes(display, wins[j], &wa))
+ if (!XGetWindowAttributes(display, wins[j], &wa) ||
+ wa.override_redirect)
continue;
state = getstate(wins[j]);