[Mesa-dev] [PATCH] glxgears: Honor -fullscreen in initial reshape

Aaron Plattner aplattner at nvidia.com
Thu Oct 4 16:30:32 PDT 2012


If glxgears is started on a bare X server without a window manager, it does not
get a ConfigureNotify event.  This means that the only time the viewport is
initialized is in main, when it calls reshape(winWidth, winHeight).  This does
not take the size mangling caused by -fullscreen into account, so the gears
appear in a 300x300 box in the lower-left corner of the window instead of
filling the window as intended.

Fix this by moving the size override from make_window to main, and pass the
overridden size to both make_window and the initial reshape.

Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
---
 src/xdemos/glxgears.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/xdemos/glxgears.c b/src/xdemos/glxgears.c
index 79b7226..2089715 100644
--- a/src/xdemos/glxgears.c
+++ b/src/xdemos/glxgears.c
@@ -517,12 +517,6 @@ make_window( Display *dpy, const char *name,
    scrnum = DefaultScreen( dpy );
    root = RootWindow( dpy, scrnum );
 
-   if (fullscreen) {
-      x = 0; y = 0;
-      width = DisplayWidth( dpy, scrnum );
-      height = DisplayHeight( dpy, scrnum );
-   }
-
    visinfo = glXChooseVisual(dpy, scrnum, attribs);
    if (!visinfo) {
       printf("Error: couldn't get an RGB, Double-buffered");
@@ -770,6 +764,14 @@ main(int argc, char *argv[])
       return -1;
    }
 
+   if (fullscreen) {
+      int scrnum = DefaultScreen(dpy);
+
+      x = 0; y = 0;
+      winWidth = DisplayWidth(dpy, scrnum);
+      winHeight = DisplayHeight(dpy, scrnum);
+   }
+
    make_window(dpy, "glxgears", x, y, winWidth, winHeight, &win, &ctx);
    XMapWindow(dpy, win);
    glXMakeCurrent(dpy, win, ctx);
-- 
1.7.12



More information about the mesa-dev mailing list