summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorDebi King (Dessie) <dessie@lindenlab.com>2011-12-13 17:36:29 -0500
committerDebi King (Dessie) <dessie@lindenlab.com>2011-12-13 17:36:29 -0500
commite4f1f611a4736e4b0b78c0d61c3c5f576fec93d0 (patch)
tree87aeed34bc9378648e1b8729bacf8462b4d9ec2d /indra/llwindow
parent20bc02d2544320a5ad99c61b8d012608319e3161 (diff)
parentd8aa31d10a89aa826cc549594c083a054a2ad967 (diff)
merged .hgtags
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llmousehandler.h2
-rw-r--r--indra/llwindow/llwindowmacosx.cpp5
-rw-r--r--indra/llwindow/llwindowsdl.cpp14
-rw-r--r--indra/llwindow/llwindowwin32.cpp70
4 files changed, 78 insertions, 13 deletions
diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h
index bbbc3d4406..d825a3424c 100644
--- a/indra/llwindow/llmousehandler.h
+++ b/indra/llwindow/llmousehandler.h
@@ -65,7 +65,7 @@ public:
virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0;
virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0;
virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) = 0;
- virtual std::string getName() const = 0;
+ virtual const std::string& getName() const = 0;
virtual void onMouseCaptureLost() = 0;
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 4dd11541b9..d116f0dfff 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -1266,7 +1266,6 @@ BOOL LLWindowMacOSX::setSize(const LLCoordScreen size)
void LLWindowMacOSX::swapBuffers()
{
- glFinish();
aglSwapBuffers(mContext);
}
@@ -2545,8 +2544,8 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
{
// This is where we would constrain move/resize to a particular screen
- const S32 MIN_WIDTH = 320;
- const S32 MIN_HEIGHT = 240;
+ const S32 MIN_WIDTH = 1024;
+ const S32 MIN_HEIGHT = 768;
Rect currentBounds;
Rect previousBounds;
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index e41aa9820f..8acb52516a 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -63,6 +63,9 @@ 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;
@@ -985,7 +988,6 @@ void LLWindowSDL::swapBuffers()
{
if (mWindow)
{
- glFinish();
SDL_GL_SwapBuffers();
}
}
@@ -1843,11 +1845,15 @@ void LLWindowSDL::gatherInput()
break;
case SDL_VIDEORESIZE: // *FIX: handle this?
+ {
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);
+
// *FIX: I'm not sure this is necessary!
- mWindow = SDL_SetVideoMode(event.resize.w, event.resize.h, 32, mSDLFlags);
+ mWindow = SDL_SetVideoMode(width, height, 32, mSDLFlags);
if (!mWindow)
{
// *FIX: More informative dialog?
@@ -1861,9 +1867,9 @@ void LLWindowSDL::gatherInput()
break;
}
- mCallbacks->handleResize(this, event.resize.w, event.resize.h );
+ mCallbacks->handleResize(this, width, height);
break;
-
+ }
case SDL_ACTIVEEVENT:
if (event.active.state & SDL_APPINPUTFOCUS)
{
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 121c7880df..799f0a3fab 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -41,6 +41,7 @@
#include "llgl.h"
#include "llstring.h"
#include "lldir.h"
+#include "llglslshader.h"
// System includes
#include <commdlg.h>
@@ -1031,6 +1032,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
mhInstance,
NULL);
+ LL_INFOS("Window") << "window is created." << llendl ;
+
//-----------------------------------------------------------------------
// Create GL drawing context
//-----------------------------------------------------------------------
@@ -1120,8 +1123,10 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
return FALSE;
}
- gGLManager.initWGL();
+ LL_INFOS("Window") << "Drawing context is created." << llendl ;
+ gGLManager.initWGL();
+
if (wglChoosePixelFormatARB)
{
// OK, at this point, use the ARB wglChoosePixelFormatsARB function to see if we
@@ -1256,7 +1261,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
LL_INFOS("Window") << "Choosing pixel formats: " << num_formats << " pixel formats returned" << LL_ENDL;
}
-
+ LL_INFOS("Window") << "pixel formats done." << llendl ;
S32 swap_method = 0;
S32 cur_format = num_formats-1;
@@ -1306,6 +1311,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
mhInstance,
NULL);
+ LL_INFOS("Window") << "recreate window done." << llendl ;
+
if (!(mhDC = GetDC(mWindowHandle)))
{
close();
@@ -1378,7 +1385,53 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
return FALSE;
}
- if (!(mhRC = wglCreateContext(mhDC)))
+ mhRC = 0;
+ if (wglCreateContextAttribsARB)
+ { //attempt to create a specific versioned context
+ S32 attribs[] =
+ { //start at 4.2
+ WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
+ WGL_CONTEXT_MINOR_VERSION_ARB, 2,
+ WGL_CONTEXT_PROFILE_MASK_ARB, LLRender::sGLCoreProfile ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
+ WGL_CONTEXT_FLAGS_ARB, gDebugGL ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
+ 0
+ };
+
+ bool done = false;
+ while (!done)
+ {
+ mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs);
+
+ if (!mhRC)
+ {
+ if (attribs[3] > 0)
+ { //decrement minor version
+ attribs[3]--;
+ }
+ else if (attribs[1] > 3)
+ { //decrement major version and start minor version over at 3
+ attribs[1]--;
+ attribs[3] = 3;
+ }
+ else
+ { //we reached 3.0 and still failed, bail out
+ done = true;
+ }
+ }
+ else
+ {
+ llinfos << "Created OpenGL " << llformat("%d.%d", attribs[1], attribs[3]) << " context." << llendl;
+ done = true;
+
+ if (LLRender::sGLCoreProfile)
+ {
+ LLGLSLShader::sNoFixedFunction = true;
+ }
+ }
+ }
+ }
+
+ if (!mhRC && !(mhRC = wglCreateContext(mhDC)))
{
close();
OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK);
@@ -1398,7 +1451,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
-
+
// Disable vertical sync for swap
if (disable_vsync && wglSwapIntervalEXT)
{
@@ -2354,6 +2407,14 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
return 0;
}
+ case WM_GETMINMAXINFO:
+ {
+ LPMINMAXINFO min_max = (LPMINMAXINFO)l_param;
+ min_max->ptMinTrackSize.x = 1024;
+ min_max->ptMinTrackSize.y = 768;
+ return 0;
+ }
+
case WM_SIZE:
{
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SIZE");
@@ -2896,7 +2957,6 @@ BOOL LLWindowWin32::resetDisplayResolution()
void LLWindowWin32::swapBuffers()
{
- glFinish();
SwapBuffers(mhDC);
}