devdraw: full-screen cleanup

This commit is contained in:
Russ Cox 2008-01-30 12:03:11 -05:00
parent e601e525de
commit c155dcfeb7
3 changed files with 16 additions and 1 deletions

View file

@ -101,6 +101,7 @@ extern char* _xgetsnarf(void);
extern void _xputsnarf(char *data); extern void _xputsnarf(char *data);
extern void _xtopwindow(void); extern void _xtopwindow(void);
extern void _xresizewindow(Rectangle); extern void _xresizewindow(Rectangle);
extern void _xmovewindow(Rectangle);
extern int _xreplacescreenimage(void); extern int _xreplacescreenimage(void);
#define MouseMask (\ #define MouseMask (\

View file

@ -536,7 +536,7 @@ runxevent(XEvent *xev)
XLookupString((XKeyEvent*)xev, NULL, 0, &k, NULL); XLookupString((XKeyEvent*)xev, NULL, 0, &k, NULL);
if(k == XK_F11){ if(k == XK_F11){
fullscreen = !fullscreen; fullscreen = !fullscreen;
_xresizewindow(fullscreen ? screenrect : windowrect); _xmovewindow(fullscreen ? screenrect : windowrect);
return; return;
} }
if((c = _xtoplan9kbd(xev)) < 0) if((c = _xtoplan9kbd(xev)) < 0)

View file

@ -20,6 +20,20 @@ _xresizewindow(Rectangle r)
XWindowChanges e; XWindowChanges e;
int value_mask; int value_mask;
memset(&e, 0, sizeof e);
value_mask = CWX|CWY|CWWidth|CWHeight;
e.width = Dx(r);
e.height = Dy(r);
XConfigureWindow(_x.display, _x.drawable, value_mask, &e);
XFlush(_x.display);
}
void
_xmovewindow(Rectangle r)
{
XWindowChanges e;
int value_mask;
memset(&e, 0, sizeof e); memset(&e, 0, sizeof e);
value_mask = CWX|CWY|CWWidth|CWHeight; value_mask = CWX|CWY|CWWidth|CWHeight;
e.x = r.min.x; e.x = r.min.x;