r->bar->id = xcb_generate_id(conn);
wa[0] = r->s->c[SWM_S_COLOR_BAR].pixel;
wa[1] = r->s->c[SWM_S_COLOR_BAR_BORDER_UNFOCUS].pixel;
- wa[2] = XCB_EVENT_MASK_EXPOSURE;
+ wa[2] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_POINTER_MOTION |
+ XCB_EVENT_MASK_POINTER_MOTION_HINT;
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),
conf_load(const char *filename, int keymapping)
{
FILE *config;
- char *line = NULL, *cp, *optsub, *optval;
+ char *line = NULL, *cp, *optsub, *optval = NULL;
size_t linelen, lineno = 0;
int wordlen, i, optidx;
struct config_option *opt = NULL;
if (line)
free(line);
- if ((line = fparseln(config, &linelen, &lineno, NULL, 0))
- == NULL) {
+ if ((line = fparseln(config, &linelen, &lineno, NULL,
+ FPARSELN_UNESCCOMM | FPARSELN_UNESCCONT)) == NULL) {
if (ferror(config))
err(1, "%s", filename);
else
/* If no windows on pointer region, then focus root. */
r = root_to_region(e->root, SWM_CK_POINTER);
if (r == NULL) {
- DNPRINTF(SWM_D_EVENT, "enterntoify: "
+ DNPRINTF(SWM_D_EVENT, "enternotify: "
"NULL region; ignoring.\n");
return;
}
focus_win(get_focus_magic(win));
}
- focus_flush();
+ xcb_flush(conn);
}
#ifdef SWM_DEBUG
int ncrtc = 0;
#endif /* SWM_XRR_HAS_CRTC */
struct swm_region *r;
+ struct ws_win *win;
int num_screens;
xcb_randr_get_screen_resources_current_cookie_t src;
xcb_randr_get_screen_resources_current_reply_t *srr;
xcb_destroy_window(conn, r->id);
TAILQ_REMOVE(&screens[i].rl, r, entry);
TAILQ_INSERT_TAIL(&screens[i].orl, r, entry);
-
- if (r->s->r_focus == r)
- r->s->r_focus = NULL;
}
outputs = 0;
screen->height_in_pixels);
out:
+ /* Cleanup unused previously visible workspaces. */
+ TAILQ_FOREACH(r, &screens[i].orl, entry) {
+ TAILQ_FOREACH(win, &r->ws->winlist, entry)
+ unmap_window(win);
+
+ /* The screen shouldn't focus on an unused region. */
+ if (screens[i].r_focus == r)
+ screens[i].r_focus = NULL;
+ }
+
DNPRINTF(SWM_D_MISC, "scan_xrandr: done.\n");
}
for (i = 0; i < num_screens; i++) {
TAILQ_FOREACH(r, &screens[i].rl, entry)
bar_setup(r);
-
- /* Focus on first region. */
- r = TAILQ_FIRST(&screens[0].rl);
- if (r)
- focus_region(r);
}
stack();
+
+ /* Make sure a region has focus on each screen. */
+ for (i = 0; i < num_screens; i++) {
+ if (screens[i].r_focus == NULL) {
+ r = TAILQ_FIRST(&screens[i].rl);
+ if (r != NULL)
+ focus_region(r);
+ }
+ }
+
bar_draw();
focus_flush();
}