add get_display_info function to screen.c and use it for getting windows_area geom
This commit is contained in:
parent
c7735d4d1f
commit
59c870db3e
23
client.c
23
client.c
|
@ -24,6 +24,7 @@
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/extensions/shape.h>
|
#include <X11/extensions/shape.h>
|
||||||
|
|
||||||
|
#include "screen.h"
|
||||||
#include "awesome.h"
|
#include "awesome.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
@ -371,20 +372,18 @@ manage(Display * disp, DC *drawcontext, Window w, XWindowAttributes * wa, awesom
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int wax = get_windows_area_x(awesomeconf->statusbar);
|
ScreenInfo *si = get_display_info(disp, awesomeconf->statusbar);
|
||||||
int way = get_windows_area_y(awesomeconf->statusbar);
|
|
||||||
int waw = get_windows_area_width(disp, awesomeconf->statusbar);
|
|
||||||
int wah = get_windows_area_height(disp, awesomeconf->statusbar);
|
|
||||||
|
|
||||||
if(c->x + c->w + 2 * c->border > wax + waw)
|
if(c->x + c->w + 2 * c->border > si->x_org + si->width)
|
||||||
c->x = c->rx = wax + waw - c->w - 2 * c->border;
|
c->x = c->rx = si->x_org + si->width - c->w - 2 * c->border;
|
||||||
if(c->y + c->h + 2 * c->border > way + wah)
|
if(c->y + c->h + 2 * c->border > si->y_org + si->height)
|
||||||
c->y = c->ry = way + wah - c->h - 2 * c->border;
|
c->y = c->ry = si->y_org + si->height - c->h - 2 * c->border;
|
||||||
if(c->x < wax)
|
if(c->x < si->x_org)
|
||||||
c->x = c->rx = wax;
|
c->x = c->rx = si->x_org;
|
||||||
if(c->y < way)
|
if(c->y < si->y_org)
|
||||||
c->y = c->ry = way;
|
c->y = c->ry = si->y_org;
|
||||||
c->border = awesomeconf->borderpx;
|
c->border = awesomeconf->borderpx;
|
||||||
|
XFree(si);
|
||||||
}
|
}
|
||||||
wc.border_width = c->border;
|
wc.border_width = c->border;
|
||||||
XConfigureWindow(disp, w, CWBorderWidth, &wc);
|
XConfigureWindow(disp, w, CWBorderWidth, &wc);
|
||||||
|
|
27
screen.c
27
screen.c
|
@ -22,6 +22,12 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
|
/** Get screens info
|
||||||
|
* \param disp Display ref
|
||||||
|
* \param statusbar statusbar
|
||||||
|
* \param screen_number int pointer filled with number of screens
|
||||||
|
* \return ScreenInfo struct array with all screens info
|
||||||
|
*/
|
||||||
ScreenInfo *
|
ScreenInfo *
|
||||||
get_screen_info(Display *disp, Statusbar statusbar, int *screen_number)
|
get_screen_info(Display *disp, Statusbar statusbar, int *screen_number)
|
||||||
{
|
{
|
||||||
|
@ -52,3 +58,24 @@ get_screen_info(Display *disp, Statusbar statusbar, int *screen_number)
|
||||||
|
|
||||||
return si;
|
return si;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get display info
|
||||||
|
* \param disp Display ref
|
||||||
|
* \param statusbar statusbar
|
||||||
|
* \return ScreenInfo struct pointer with all display info
|
||||||
|
*/
|
||||||
|
ScreenInfo *
|
||||||
|
get_display_info(Display *disp, Statusbar statusbar)
|
||||||
|
{
|
||||||
|
ScreenInfo *si;
|
||||||
|
|
||||||
|
si = p_new(ScreenInfo, 1);
|
||||||
|
|
||||||
|
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)) -
|
||||||
|
((statusbar.position == BarTop || statusbar.position == BarBot) ? statusbar.height : 0);
|
||||||
|
|
||||||
|
return si;
|
||||||
|
}
|
||||||
|
|
1
screen.h
1
screen.h
|
@ -30,5 +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);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue