summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindowsdl.cpp
diff options
context:
space:
mode:
authorLeslie Linden <leslie@lindenlab.com>2011-11-29 10:40:45 -0800
committerLeslie Linden <leslie@lindenlab.com>2011-11-29 10:40:45 -0800
commite919349054c8ae80a054f047756e6596b58a3e13 (patch)
tree4d2abc589c448fe2b54f7be09385e644fd5b87af /indra/llwindow/llwindowsdl.cpp
parentec6893db5099b1e95802254277de0cc2e9bea83c (diff)
parentadeb71d98279fc4e8af7859cd36114be9f95e6da (diff)
Merge with viewer-experience
Diffstat (limited to 'indra/llwindow/llwindowsdl.cpp')
-rw-r--r--indra/llwindow/llwindowsdl.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index da2222ad51..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
{
@@ -966,7 +979,7 @@ BOOL LLWindowSDL::setPosition(const LLCoordScreen position)
return TRUE;
}
-BOOL LLWindowSDL::setSize(const LLCoordScreen size)
+BOOL LLWindowSDL::setSizeImpl(const LLCoordScreen size)
{
if(mWindow)
{
@@ -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;
}