mirror of
https://github.com/0intro/wmii
synced 2024-11-22 05:42:05 +03:00
Restrict wmii9menu to logical Xinerama screen. Closes issue #142.
This commit is contained in:
parent
79bbf50cb8
commit
c26f563c55
@ -24,10 +24,10 @@ OWMIIR=wmiir.o $(OFILES) $(LIBIXP)
|
||||
wmiir.out: $(OWMIIR)
|
||||
$(LINK) $@ $(STATIC) $(OWMIIR)
|
||||
|
||||
wmii/x11.o wmii/map.o: dall
|
||||
wmii/x11.o wmii/xext.o wmii/geom.o wmii/map.o: dall
|
||||
true
|
||||
|
||||
O9MENU=wmii9menu.o clientutil.o wmii/x11.o wmii/map.o $(OFILES) $(LIBIXP)
|
||||
O9MENU=wmii9menu.o clientutil.o wmii/x11.o wmii/xext.o wmii/geom.o wmii/map.o $(OFILES) $(LIBIXP)
|
||||
wmii9menu.out: $(O9MENU)
|
||||
$(LINK) $@ $(O9MENU) $$(pkg-config --libs $(X11PACKAGES)) -lXext -lbio
|
||||
$(LINK) $@ $(O9MENU) $$(pkg-config --libs $(X11PACKAGES) xrandr xinerama) -lXext -lbio
|
||||
|
||||
|
@ -85,6 +85,33 @@ ErrorCode ignored_xerrors[] = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
/* xext.c */
|
||||
void xext_init(void);
|
||||
Rectangle* xinerama_screens(int*);
|
||||
/* geom.c */
|
||||
bool rect_haspoint_p(Point, Rectangle);
|
||||
|
||||
Cursor cursor[1];
|
||||
Visual* render_visual;
|
||||
|
||||
void init_screens(void);
|
||||
void
|
||||
init_screens(void) {
|
||||
Rectangle *rects;
|
||||
Point p;
|
||||
int i, n;
|
||||
|
||||
rects = xinerama_screens(&n);
|
||||
p = querypointer(&scr.root);
|
||||
for(i=0; i < n; i++) {
|
||||
if(rect_haspoint_p(p, rects[i]))
|
||||
break;
|
||||
}
|
||||
if(i == n)
|
||||
i = 0;
|
||||
scr.rect = rects[i];
|
||||
}
|
||||
|
||||
/* main --- crack arguments, set up X stuff, run the main menu loop */
|
||||
|
||||
int
|
||||
@ -115,6 +142,8 @@ main(int argc, char **argv)
|
||||
usage();
|
||||
|
||||
initdisplay();
|
||||
xext_init();
|
||||
init_screens();
|
||||
create_window();
|
||||
|
||||
numitems = argc;
|
||||
@ -258,16 +287,12 @@ size_window(int wide, int high)
|
||||
|
||||
p = querypointer(&scr.root);
|
||||
p.x -= wide / 2;
|
||||
if(p.x < 0)
|
||||
p.x = 0;
|
||||
else if(p.x + wide > Dx(scr.rect))
|
||||
p.x = Dx(scr.rect) - wide;
|
||||
p.x = max(p.x, scr.rect.min.x);
|
||||
p.x = min(p.x, scr.rect.max.x - wide);
|
||||
|
||||
p.y -= cur * high + high / 2;
|
||||
if(p.y < 0)
|
||||
p.y = 0;
|
||||
else if(p.y + h > Dy(scr.rect))
|
||||
p.y = Dy(scr.rect) - h;
|
||||
p.y = max(p.y, scr.rect.min.y);
|
||||
p.y = min(p.y, scr.rect.max.y - h);
|
||||
|
||||
reshapewin(menuwin, rectaddpt(r, p));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user