get_display_info take screen and screen is stored in statusbar struct

This commit is contained in:
Julien Danjou 2007-09-15 23:04:04 +02:00
parent 53e5630c6c
commit e4e8a2966f
6 changed files with 13 additions and 8 deletions

View File

@ -375,7 +375,7 @@ manage(Display * disp, int screen, DC *drawcontext, Window w, XWindowAttributes
} }
else 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) 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; c->x = c->rx = si->x_org + si->width - c->w - 2 * c->border;

View File

@ -89,6 +89,8 @@ typedef struct
Window window; Window window;
/** Drawable object */ /** Drawable object */
Drawable drawable; Drawable drawable;
/** Screen */
int screen;
} Statusbar; } Statusbar;
/** Main configuration structure */ /** Main configuration structure */

View File

@ -60,7 +60,7 @@ movemouse(Client * c, awesome_config *awesomeconf)
XEvent ev; XEvent ev;
ScreenInfo *si; ScreenInfo *si;
si = get_display_info(c->display, awesomeconf->statusbar); si = get_display_info(c->display, c->screen, awesomeconf->statusbar);
ocx = nx = c->x; ocx = nx = c->x;
ocy = ny = c->y; ocy = ny = c->y;

View File

@ -61,11 +61,12 @@ get_screen_info(Display *disp, Statusbar statusbar, int *screen_number)
/** Get display info /** Get display info
* \param disp Display ref * \param disp Display ref
* \param statusbar statusbar * \param screen Screen number
* \param statusbar the statusbar
* \return ScreenInfo struct pointer with all display info * \return ScreenInfo struct pointer with all display info
*/ */
ScreenInfo * ScreenInfo *
get_display_info(Display *disp, Statusbar statusbar) get_display_info(Display *disp, int screen, Statusbar statusbar)
{ {
ScreenInfo *si; ScreenInfo *si;
@ -73,8 +74,8 @@ get_display_info(Display *disp, Statusbar statusbar)
si->x_org = 0; si->x_org = 0;
si->y_org = statusbar.position == BarTop ? statusbar.height : 0; si->y_org = statusbar.position == BarTop ? statusbar.height : 0;
si->width = DisplayWidth(disp, DefaultScreen(disp)); si->width = DisplayWidth(disp, screen);
si->height = DisplayHeight(disp, DefaultScreen(disp)) - si->height = DisplayHeight(disp, screen) -
((statusbar.position == BarTop || statusbar.position == BarBot) ? statusbar.height : 0); ((statusbar.position == BarTop || statusbar.position == BarBot) ? statusbar.height : 0);
return si; return si;

View File

@ -30,6 +30,6 @@
typedef XineramaScreenInfo ScreenInfo; typedef XineramaScreenInfo ScreenInfo;
ScreenInfo * get_screen_info(Display *, Statusbar, int *); 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 #endif

View File

@ -93,6 +93,8 @@ initstatusbar(Display *disp, int screen, DC *drawcontext, Statusbar *statusbar)
{ {
XSetWindowAttributes wa; XSetWindowAttributes wa;
statusbar->screen = screen;
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask; | EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
wa.cursor = drawcontext->cursor[CurNormal]; wa.cursor = drawcontext->cursor[CurNormal];
@ -124,7 +126,7 @@ updatebarpos(Display *disp, Statusbar statusbar)
XMoveWindow(disp, statusbar.window, 0, 0); XMoveWindow(disp, statusbar.window, 0, 0);
break; break;
case BarBot: case BarBot:
si = get_display_info(disp, statusbar); si = get_display_info(disp, statusbar.screen, statusbar);
XMoveWindow(disp, statusbar.window, 0, si->height); XMoveWindow(disp, statusbar.window, 0, si->height);
XFree(si); XFree(si);
break; break;