diff options
author | Seth ProductEngine <slitovchuk@productengine.com> | 2011-11-29 16:45:10 +0200 |
---|---|---|
committer | Seth ProductEngine <slitovchuk@productengine.com> | 2011-11-29 16:45:10 +0200 |
commit | 9a5a96aadc5fe5e8582663bd616b457def749b5b (patch) | |
tree | e5cb0b54fcfce074cc13082a992b25641af8cbf4 | |
parent | a16bc265da9229bebc7ced7aeccdf56693b88a80 (diff) |
EXP-1580 FIXED resize indicator on Linux showing Viewer window can be resized below minimum size.
Fixed using minimum window dimensions configured in debug settings.
-rw-r--r-- | indra/llwindow/llwindowsdl.cpp | 29 | ||||
-rw-r--r-- | indra/llwindow/llwindowsdl.h | 1 |
2 files changed, 25 insertions, 5 deletions
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index c75b6c2dce..a70791d39f 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -63,9 +63,6 @@ extern BOOL gDebugWindowProc; const S32 MAX_NUM_RESOLUTIONS = 200; -const S32 MIN_WINDOW_WIDTH = 1024; -const S32 MIN_WINDOW_HEIGHT = 768; - // static variable for ATI mouse cursor crash work-around: static bool ATIbug = false; @@ -182,6 +179,20 @@ Display* LLWindowSDL::get_SDL_Display(void) } return NULL; } + +void LLWindowSDL::setXWindowMinSize() +{ + // Set the minimum size limits for X11 window + // so the window manager doesn't allow resizing below those limits. + XSizeHints* hints = XAllocSizeHints(); + hints->flags |= PMinSize; + hints->min_width = mMinWindowWidth; + hints->min_height = mMinWindowHeight; + + XSetWMNormalHints(mSDL_Display, mSDL_XWindowID, hints); + + XFree(hints); +} #endif // LL_X11 @@ -741,6 +752,8 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B mSDL_XWindowID = info.info.x11.wmwindow; Lock_Display = info.info.x11.lock_func; Unlock_Display = info.info.x11.unlock_func; + + setXWindowMinSize(); } else { @@ -1850,8 +1863,8 @@ void LLWindowSDL::gatherInput() llinfos << "Handling a resize event: " << event.resize.w << "x" << event.resize.h << llendl; - S32 width = llmax(event.resize.w, MIN_WINDOW_WIDTH); - S32 height = llmax(event.resize.h, MIN_WINDOW_HEIGHT); + S32 width = llmax(event.resize.w, (S32)mMinWindowWidth); + S32 height = llmax(event.resize.h, (S32)mMinWindowHeight); // *FIX: I'm not sure this is necessary! mWindow = SDL_SetVideoMode(width, height, 32, mSDLFlags); @@ -1868,6 +1881,12 @@ void LLWindowSDL::gatherInput() break; } +#if LL_X11 + // The minimum size limits should be reset after + // each successful SDL_SetVideoMode() call. + setXWindowMinSize(); +#endif + mCallbacks->handleResize(this, width, height); break; } diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 03dbfc22e0..a98b1b74bd 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -140,6 +140,7 @@ public: #if LL_X11 static Window get_SDL_XWindowID(void); static Display* get_SDL_Display(void); + void setXWindowMinSize(); #endif // LL_X11 protected: |