#define SWM_DEBUG
#ifdef SWM_DEBUG
-#define DPRINTF(x...) do { if (swm_debug) fprintf(stderr, x); } while (0)
-#define DNPRINTF(n,x...) do { if (swm_debug & n) { fprintf(stderr, "%ld ", (long)time(NULL)); fprintf(stderr, x); } } while (0)
+#define DPRINTF(x...) do { \
+ if (swm_debug) \
+ fprintf(stderr, x); \
+} while (0)
+#define DNPRINTF(n,x...) do { \
+ if (swm_debug & n) { \
+ fprintf(stderr, "%ld ", (long)(time(NULL) - time_started)); \
+ fprintf(stderr, x); \
+ } \
+} while (0)
#define SWM_D_MISC 0x0001
#define SWM_D_EVENT 0x0002
#define SWM_D_WS 0x0004
int disable_border = 0;
int border_width = 1;
int verbose_layout = 0;
+time_t time_started;
pid_t bar_pid;
XFontSet bar_fs;
XFontSetExtents *bar_fs_extents;
int num_missing_charsets = 0;
int i;
xcb_screen_t *screen = get_screen(r->s->idx);
- uint32_t wa[2];
+ uint32_t wa[3];
if (bar_fs) {
XFreeFontSet(display, bar_fs);
r->bar->id = xcb_generate_id(conn);
wa[0] = r->s->c[SWM_S_COLOR_BAR].color;
wa[1] = r->s->c[SWM_S_COLOR_BAR_BORDER].color;
+ wa[2] = XCB_EVENT_MASK_EXPOSURE;
xcb_create_window(conn, XCB_COPY_FROM_PARENT, r->bar->id, r->s->root,
X(r->bar), Y(r->bar), WIDTH(r->bar), HEIGHT(r->bar),
bar_border_width, XCB_WINDOW_CLASS_INPUT_OUTPUT,
- XCB_COPY_FROM_PARENT, XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL, wa);
+ XCB_COPY_FROM_PARENT, XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL
+ | XCB_CW_EVENT_MASK, wa);
r->bar->buffer = xcb_generate_id(conn);
xcb_create_pixmap(conn, screen->root_depth, r->bar->buffer, r->bar->id,
return;
}
+ xcb_flush(conn);
buttonrelease = 0;
while ((evt = xcb_poll_for_event(conn)) && buttonrelease != 1) {
/*
return;
}
+ xcb_flush(conn);
buttonrelease = 0;
while ((evt = xcb_poll_for_event(conn)) && buttonrelease != 1) {
/*
void
expose(xcb_expose_event_t *e)
{
+ int i, num_screens;
+ struct swm_region *r;
+
DNPRINTF(SWM_D_EVENT, "expose: window: 0x%x\n", e->window);
+
+ num_screens = xcb_setup_roots_length(xcb_get_setup(conn));
+ for (i = 0; i < num_screens; i++)
+ TAILQ_FOREACH(r, &screens[i].rl, entry)
+ if (e->window == WINID(r->bar))
+ bar_update();
+
+ xcb_flush(conn);
}
void
{
struct swm_region *r, *rr;
struct ws_win *winfocus = NULL;
- struct timeval tv;
union arg a;
char conf[PATH_MAX], *cfile = NULL;
struct stat sb;
int xfd, i, num_screens;
- fd_set rd;
struct sigaction sact;
xcb_generic_event_t *evt;
+#if 0
+ struct timeval tv;
+ fd_set rd;
+#endif
+
+ time_started = time(NULL);
start_argv = argv;
warnx("Welcome to spectrwm V%s Build: %s", SPECTRWM_VERSION, buildstr);
continue;
}
+#if 0
FD_ZERO(&rd);
FD_SET(xfd, &rd);
tv.tv_sec = 1;
if (select(xfd + 1, &rd, NULL, NULL, &tv) == -1)
if (errno != EINTR)
DNPRINTF(SWM_D_MISC, "select failed");
+#endif
if (restart_wm == 1)
restart(NULL, NULL);
if (search_resp == 1)