diff --git a/client.c b/client.c index 0445e1051..72df3f36d 100644 --- a/client.c +++ b/client.c @@ -375,7 +375,7 @@ manage(Display * disp, int screen, DC *drawcontext, Window w, XWindowAttributes } else { - ScreenInfo *si = get_display_info(disp, awesomeconf->statusbar); + ScreenInfo *si = get_display_info(disp, screen, awesomeconf->statusbar); if(c->x + c->w + 2 * c->border > si->x_org + si->width) c->x = c->rx = si->x_org + si->width - c->w - 2 * c->border; diff --git a/config.h b/config.h index 0893706d4..4ccaae841 100644 --- a/config.h +++ b/config.h @@ -89,6 +89,8 @@ typedef struct Window window; /** Drawable object */ Drawable drawable; + /** Screen */ + int screen; } Statusbar; /** Main configuration structure */ diff --git a/event.c b/event.c index c42afaf83..63758401c 100644 --- a/event.c +++ b/event.c @@ -60,7 +60,7 @@ movemouse(Client * c, awesome_config *awesomeconf) XEvent ev; ScreenInfo *si; - si = get_display_info(c->display, awesomeconf->statusbar); + si = get_display_info(c->display, c->screen, awesomeconf->statusbar); ocx = nx = c->x; ocy = ny = c->y; diff --git a/screen.c b/screen.c index 6ce39d828..afb70b9ff 100644 --- a/screen.c +++ b/screen.c @@ -61,11 +61,12 @@ get_screen_info(Display *disp, Statusbar statusbar, int *screen_number) /** Get display info * \param disp Display ref - * \param statusbar statusbar + * \param screen Screen number + * \param statusbar the statusbar * \return ScreenInfo struct pointer with all display info */ ScreenInfo * -get_display_info(Display *disp, Statusbar statusbar) +get_display_info(Display *disp, int screen, Statusbar statusbar) { ScreenInfo *si; @@ -73,8 +74,8 @@ get_display_info(Display *disp, Statusbar statusbar) si->x_org = 0; si->y_org = statusbar.position == BarTop ? statusbar.height : 0; - si->width = DisplayWidth(disp, DefaultScreen(disp)); - si->height = DisplayHeight(disp, DefaultScreen(disp)) - + si->width = DisplayWidth(disp, screen); + si->height = DisplayHeight(disp, screen) - ((statusbar.position == BarTop || statusbar.position == BarBot) ? statusbar.height : 0); return si; diff --git a/screen.h b/screen.h index 5b1da9305..3cb791bb6 100644 --- a/screen.h +++ b/screen.h @@ -30,6 +30,6 @@ typedef XineramaScreenInfo ScreenInfo; ScreenInfo * get_screen_info(Display *, Statusbar, int *); -ScreenInfo * get_display_info(Display *disp, Statusbar statusbar); +ScreenInfo * get_display_info(Display *disp, int, Statusbar statusbar); #endif diff --git a/statusbar.c b/statusbar.c index 486dbd79a..eebf834eb 100644 --- a/statusbar.c +++ b/statusbar.c @@ -93,6 +93,8 @@ initstatusbar(Display *disp, int screen, DC *drawcontext, Statusbar *statusbar) { XSetWindowAttributes wa; + statusbar->screen = screen; + wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | EnterWindowMask | LeaveWindowMask | StructureNotifyMask; wa.cursor = drawcontext->cursor[CurNormal]; @@ -124,7 +126,7 @@ updatebarpos(Display *disp, Statusbar statusbar) XMoveWindow(disp, statusbar.window, 0, 0); break; case BarBot: - si = get_display_info(disp, statusbar); + si = get_display_info(disp, statusbar.screen, statusbar); XMoveWindow(disp, statusbar.window, 0, si->height); XFree(si); break;