From 1a7e49ece8e9811ef2fceaebd38178c6ae7b8a46 Mon Sep 17 00:00:00 2001
From: Seth ProductEngine <slitovchuk@productengine.com>
Date: Wed, 30 Nov 2011 01:01:22 +0200
Subject: [PATCH] EXP-1580 FIXED applying "MinWindowWidth" and
 "MinWindowHeight" settings to Linux viewer window. Added minimum size setting
 method for X11 viewer window on Linux.

---
 indra/llwindow/llwindowsdl.cpp | 41 ++++++++++++++++------------------
 indra/llwindow/llwindowsdl.h   |  2 +-
 2 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index a70791d39f6..10f2c2f04d3 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -179,20 +179,6 @@ 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
 
 
@@ -752,8 +738,6 @@ 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
 		{
@@ -1050,6 +1034,25 @@ void LLWindowSDL::setMouseClipping( BOOL b )
     //SDL_WM_GrabInput(b ? SDL_GRAB_ON : SDL_GRAB_OFF);
 }
 
+// virtual
+void LLWindowSDL::setMinSize(U32 min_width, U32 min_height)
+{
+	LLWindow::setMinSize(min_width, min_height);
+
+#if LL_X11
+	// 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
+}
+
 BOOL LLWindowSDL::setCursorPosition(const LLCoordWindow position)
 {
 	BOOL result = TRUE;
@@ -1880,12 +1883,6 @@ 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 a98b1b74bd2..76019999b11 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -76,6 +76,7 @@ class LLWindowSDL : public LLWindow
 	/*virtual*/ void captureMouse();
 	/*virtual*/ void releaseMouse();
 	/*virtual*/ void setMouseClipping( BOOL b );
+	/*virtual*/	void setMinSize(U32 min_width, U32 min_height);
 
 	/*virtual*/ BOOL isClipboardTextAvailable();
 	/*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst);
@@ -140,7 +141,6 @@ class LLWindowSDL : public LLWindow
 #if LL_X11
 	static Window get_SDL_XWindowID(void);
 	static Display* get_SDL_Display(void);
-	void setXWindowMinSize();
 #endif // LL_X11	
 
 protected:
-- 
GitLab