...
 
Commits (2)
......@@ -1504,15 +1504,17 @@ steplayout(union arg arg)
void
stepmon(union arg arg)
{
struct monitor *m, *srcmon, *dstmon;
struct monitor *srcmon, *dstmon;
unsigned int srcpos, dstpos;
/* find index of source monitor */
assert(seat->selmon);
srcmon = seat->selmon;
LIST_FOR (seat->monitors, srcpos, m)
if (m == srcmon)
break;
if (!srcmon) {
warn("Seat does not focus any monitor");
return;
}
srcpos = list_find_index(seat->monitors, srcmon, NULL);
assert(srcpos < seat->monitors->size);
/* find destination monitor */
......
......@@ -78,7 +78,12 @@ bstack_apply(struct layout *l, struct rectangle *area)
static void
init_icon(struct layout *l)
{
struct config const *config = config_get();
uint64_t *icon_lines;
uint32_t fg_focused = config->bar.focused.foreground.colour;
uint32_t bg_focused = config->bar.focused.background.colour;
uint32_t fg_unfocused = config->bar.unfocused.foreground.colour;
uint32_t bg_unfocused = config->bar.unfocused.background.colour;
/* icons */
switch (l->type) {
......@@ -140,9 +145,9 @@ init_icon(struct layout *l)
};
break;
}
l->icon_active = icon_create(17, 15, 0xAFD700, 0x222222);
l->icon_active = icon_create(17, 15, fg_focused, bg_focused);
icon_draw(l->icon_active, icon_lines);
l->icon_inactive = icon_create(17, 15, 0x555555, 0x222222);
l->icon_inactive = icon_create(17, 15, fg_unfocused, bg_unfocused);
icon_draw(l->icon_inactive, icon_lines);
}
......
......@@ -91,17 +91,15 @@ monitor_focus(struct monitor *mon, bool focus)
{
if (mon->focused == focus)
return;
if (focus && !mon->seat)
die("Attempt to focus unattached monitor");
mon->focused = focus;
if (mon->selws)
if (mon->scratchpad)
workspace_focus(mon->scratchpad, focus);
else if (mon->selws)
workspace_focus(mon->selws, focus);
else if (focus)
XSetInputFocus(x11.dpy, x11.root, RevertToPointerRoot,
CurrentTime);
statusbar_focus(mon->bar, focus);
}
......
......@@ -67,11 +67,10 @@ statusbar_redraw(struct statusbar *bar)
struct monitor *mon = bar->monitor;
struct layout *l;
struct icon *i;
bool focused = mon->seat && mon == mon->seat->selmon;
uint32_t fg = focused ? config->bar.focused.foreground.colour
: config->bar.unfocused.foreground.colour;
uint32_t bg = focused ? config->bar.focused.background.colour
: config->bar.unfocused.background.colour;
uint32_t fg = bar->focused ? config->bar.focused.foreground.colour
: config->bar.unfocused.foreground.colour;
uint32_t bg = bar->focused ? config->bar.focused.background.colour
: config->bar.unfocused.background.colour;
if (bar->pos.x != mon->dim.x
|| bar->pos.y != mon->dim.y
......@@ -96,7 +95,7 @@ statusbar_redraw(struct statusbar *bar)
if (mon->selws) {
/* layout icon */
l = mon->selws->layout;
i = focused ? l->icon_active : l->icon_inactive;
i = bar->focused ? l->icon_active : l->icon_inactive;
XCopyArea(x11.dpy, i->pixmap, bar->pm, x11.gc,
0, 0, i->w, i->h, 2, 0);
......