From 54a9a2d61dd9e6a2753f42207b4a332276dfb7b5 Mon Sep 17 00:00:00 2001 From: stephena Date: Thu, 27 Jun 2013 16:25:27 +0000 Subject: [PATCH] Fixed error with maximize button appearing in the app title bar in Linux/UNIX. This bug has been present since 3.2; too bad I didn't find it 24 hours ago, as it could have been included in 3.9. Bumped version #, and starting all over again ... git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2762 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/common/Version.hxx | 2 +- src/unix/OSystemUNIX.cxx | 31 +++++++++++++++++-------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/common/Version.hxx b/src/common/Version.hxx index cde90fccc..9a24d6312 100644 --- a/src/common/Version.hxx +++ b/src/common/Version.hxx @@ -22,7 +22,7 @@ #include -#define STELLA_VERSION "3.9" +#define STELLA_VERSION "3.10_pre" #define STELLA_BUILD atoi("$Rev$" + 6) #endif diff --git a/src/unix/OSystemUNIX.cxx b/src/unix/OSystemUNIX.cxx index 07b2f5f21..b11dfca42 100644 --- a/src/unix/OSystemUNIX.cxx +++ b/src/unix/OSystemUNIX.cxx @@ -53,27 +53,30 @@ OSystemUNIX::~OSystemUNIX() void OSystemUNIX::setAppWindowPos(int x, int y, int, int) { #if defined(HAVE_X11) + // TODO: This functionality is deprecated, since the x/y fields + // of XSizeHints are obsolete. SDL2 will provide native methods + // for app centering (which is all this is currently used for). + SDL_SysWMinfo sdl_info; memset(&sdl_info, 0, sizeof(sdl_info)); SDL_VERSION (&sdl_info.version); if(SDL_GetWMInfo(&sdl_info) > 0 && sdl_info.subsystem == SDL_SYSWM_X11) { - XSizeHints* hints = XAllocSizeHints(); - if(hints) - { - Display* display = sdl_info.info.x11.display; - Window window = sdl_info.info.x11.wmwindow; - hints->flags |= USPosition; - hints->x = x; - hints->y = y; - XMoveWindow(display, window, hints->x, hints->y); + Display* display = sdl_info.info.x11.display; + Window window = sdl_info.info.x11.wmwindow; + XSizeHints hints; + long supplied_return; + XGetWMNormalHints(display, window, &hints, &supplied_return); - /* Flush the resize event so we don't catch it later */ - XSync(display, True); - XSetWMNormalHints(display, window, hints); - XFree(hints); - } + // Change X/Y position + hints.x = x; + hints.y = y; + XMoveWindow(display, window, hints.x, hints.y); + + // Flush the resize event so we don't catch it later + XSync(display, True); + XSetWMNormalHints(display, window, &hints); } #endif }