get_display_info take screen and screen is stored in statusbar struct
This commit is contained in:
parent
53e5630c6c
commit
e4e8a2966f
2
client.c
2
client.c
|
@ -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;
|
||||||
|
|
2
config.h
2
config.h
|
@ -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 */
|
||||||
|
|
2
event.c
2
event.c
|
@ -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;
|
||||||
|
|
9
screen.c
9
screen.c
|
@ -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;
|
||||||
|
|
2
screen.h
2
screen.h
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue