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;
{
XConfigureRequestEvent cr;
- if (win == NULL)
+ /* 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);
"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 &&
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)
{
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);
}
- config_win(win);
}
}
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;
}