int can_delete;
int take_focus;
int java;
- int init_configreq_tweak_done;
unsigned long quirks;
struct workspace *ws; /* always valid */
struct swm_screen *s; /* always valid, never changes */
#define SWM_Q_ANYWHERE (1<<2) /* don't position this window */
#define SWM_Q_XTERM_FONTADJ (1<<3) /* adjust xterm fonts when resizing */
#define SWM_Q_FULLSCREEN (1<<4) /* remove border */
-#define SWM_Q_HONOR_CONFREQ (1<<5) /* Accomodate applications that
- need the dimensions in configuration
- requests to be honored.
- */
};
int quirks_size = 0, quirks_length = 0;
struct quirk *quirks = NULL;
}
void
-configreq_win(struct ws_win *win)
-{
- XConfigureRequestEvent cr;
-
- /* This function may be of dubious value; it is always called
- immediately after a call to XConfigureWindow, which generates a
- ConfigureRequestEvent of its own. The event generated here seems
- redundant and prevents XEmacs from completely filling the window
- frame. Simply eliminating confreq_win appeared to have no ill
- effects, but my testing was limited. As such, I've retained it.
- */
- if (win == NULL || (win->quirks & SWM_Q_HONOR_CONFREQ))
- return;
-
- bzero(&cr, sizeof cr);
- cr.type = ConfigureRequest;
- cr.display = display;
- cr.parent = win->id;
- cr.window = win->id;
- cr.x = win->g.x;
- cr.y = win->g.y;
- cr.width = win->g.w;
- cr.height = win->g.h;
- cr.border_width = border_width;
-
- XSendEvent(display, win->id, False, StructureNotifyMask, (XEvent *)&cr);
-}
-
-void
-config_win(struct ws_win *win)
+config_win(struct ws_win *win, XConfigureRequestEvent *ev)
{
XConfigureEvent ce;
+ fprintf(stderr, "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);
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;
- ce.window = win->id;
- ce.x = win->g.x;
- ce.y = win->g.y;
- ce.width = win->g.w;
- ce.height = win->g.h;
- ce.border_width = border_width; /* XXX store this! */
- ce.above = None;
- ce.override_redirect = False;
+ if (ev == NULL) {
+ ce.type = ConfigureNotify;
+ ce.display = display;
+ ce.event = win->id;
+ ce.window = win->id;
+ ce.x = win->g.x;
+ ce.y = win->g.y;
+ ce.width = win->g.w;
+ ce.height = win->g.h;
+ ce.border_width = border_width;
+ ce.above = None;
+ ce.override_redirect = False;
+ } else {
+ ce.type = ConfigureNotify;
+ ce.display = ev->display;
+ ce.event = ev->window;
+ ce.window = ev->window;
+ ce.x = ev->x;
+ ce.y = ev->y;
+ ce.width = ev->width;
+ ce.height = ev->height;
+ ce.border_width = ev->border_width;
+ ce.above = ev->above;
+ ce.override_redirect = False;
+ }
+
XSendEvent(display, win->id, False, StructureNotifyMask, (XEvent *)&ce);
}
win->id, wc.x, wc.y, wc.width, wc.height);
XConfigureWindow(display, win->id, mask, &wc);
- configreq_win(win);
}
/*
adjust_font(win);
mask = CWX | CWY | CWWidth | CWHeight | CWBorderWidth;
XConfigureWindow(display, win->id, mask, &wc);
- configreq_win(win);
}
if (XGetWindowAttributes(display, win->id, &wa))
}
mask = CWX | CWY | CWWidth | CWHeight | CWBorderWidth;
XConfigureWindow(display, win->id, mask, &wc);
- configreq_win(win);
}
/* unmap only if we don't have multi screen */
if (win != ws->focus)
win->id, wc.x, wc.y, wc.width, wc.height);
XConfigureWindow(display, win->id, mask, &wc);
- configreq_win(win);
}
void
win->id, wc.x, wc.y, wc.width, wc.height);
XConfigureWindow(display, win->id, mask, &wc);
- configreq_win(win);
}
void
"ANYWHERE",
"XTERM_FONTADJ",
"FULLSCREEN",
- "HONOR_CONFREQ",
};
/* SWM_Q_WS: retain '|' for back compat for now (2009-08-11) */
setquirk("Xitk", "Xine Window", SWM_Q_FLOAT | SWM_Q_ANYWHERE);
setquirk("xine", "xine Video Fullscreen Window", SWM_Q_FULLSCREEN | SWM_Q_FLOAT);
setquirk("pcb", "pcb", SWM_Q_FLOAT);
- setquirk("Emacs", "emacs", SWM_Q_HONOR_CONFREQ);
- setquirk("Emacs", "Ediff", SWM_Q_FLOAT);
}
/* conf file stuff */
win->g_floatvalid = 0;
win->floatmaxed = 0;
win->ewmh_flags = 0;
- win->init_configreq_tweak_done = 0;
/* Set window properties so we can remember this after reincarnation */
if (ws_idx_atom && prop == NULL &&
wc.border_width = border_width;
mask = CWBorderWidth;
XConfigureWindow(display, win->id, mask, &wc);
- configreq_win(win);
}
XSelectInput(display, id, EnterWindowMask | FocusChangeMask |
buttons[i].func(win, &buttons[i].args);
}
-/*
- * honor_configreq: allow fussy windows to work in scrotwm
- *
- * XEmacs (and maybe other applications) expects ConfigureNotify
- * events that exactly match the ConfigureRequests that it generates.
- * Because Scrotwm specifies both the location *and* size of new
- * windows, these applications will not be satisfied and will repeat
- * the request forever. This bogs down the system and makes the
- * application unusable.
- *
- * To resolve this conflict, this function responds to ConfigureRequest
- * by sending a ConfigureNotify that contains the requested dimensions.
- * It then resizes the window to the dimensions computed by scrotwm.
- * And then it gets stranger still: after the initial response, the
- * height stored in window manager's dimensions needs to be different
- * than the value initially computed. If it's not, the window contents
- * aren't resized to fill the frame.
- *
- */
-void honor_configreq (
- struct ws_win* win,
- XConfigureRequestEvent* ev
- )
-{
- XConfigureEvent ce;
-
- ce.type = ConfigureNotify;
- ce.display = ev->display;
- ce.event = ev->window;
- ce.window = ev->window;
- ce.x = ev->x;
- ce.y = ev->y;
- ce.width = ev->width;
- ce.height = ev->height;
- ce.border_width = ev->border_width;
- ce.above = ev->above;
- ce.override_redirect = False;
-
- XSendEvent(ev->display, ev->window, False, StructureNotifyMask,
- (XEvent *)&ce);
-
- XResizeWindow(display, ev->window, win->g.w, win->g.h);
-
- if (win->init_configreq_tweak_done == 0) {
- win->init_configreq_tweak_done = 1;
- win->g.h--;
- }
-}
-
void
configurerequest(XEvent *e)
{
} else {
DNPRINTF(SWM_D_EVENT, "configurerequest: change window: %lu\n",
ev->window);
+#if 0
if (win->floating) {
if (ev->value_mask & CWX)
win->g.x = ev->x;
win->g.w = ev->width;
if (ev->value_mask & CWHeight)
win->g.h = ev->height;
- config_win(win);
- } else if (win->quirks & SWM_Q_HONOR_CONFREQ) {
- honor_configreq(win, ev);
- } else {
- config_win(win);
}
+#endif
+ config_win(win, ev);
}
}
if (window_name_enabled)
bar_update();
break;
- case XA_WM_NAME:
- /* Be responsive to clients that change the application name. */
- bar_update();
- break;
default:
break;
}
else {
/* TODO: Change stack sizes */
}
- config_win(win);
+ config_win(win, NULL);
}
if (ev->message_type == ewmh[_NET_WM_STATE].atom) {
DNPRINTF(SWM_D_EVENT, "clientmessage: _NET_WM_STATE \n");
(X(r) + WIDTH(r)) > x &&
Y(r) < (y + h) &&
(Y(r) + HEIGHT(r)) > y) {
- if (r->ws->r != NULL)
+ if (r->ws->r != NULL)
r->ws->old_r = r->ws->r;
r->ws->r = NULL;
XDestroyWindow(display, r->bar_window);