aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llwindow
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/llwindow
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/llwindow')
-rw-r--r--linden/indra/llwindow/lldxhardware.cpp37
-rw-r--r--linden/indra/llwindow/lldxhardware.h7
-rw-r--r--linden/indra/llwindow/llgl.cpp4
-rw-r--r--linden/indra/llwindow/llglstates.h20
-rw-r--r--linden/indra/llwindow/llkeyboard.cpp1
-rw-r--r--linden/indra/llwindow/llkeyboardmacosx.cpp4
-rw-r--r--linden/indra/llwindow/llkeyboardsdl.cpp4
-rw-r--r--linden/indra/llwindow/llkeyboardwin32.cpp6
-rw-r--r--linden/indra/llwindow/lllogitechlcd.cpp5
-rw-r--r--linden/indra/llwindow/llpreeditor.h2
-rw-r--r--linden/indra/llwindow/llwindow.cpp50
-rw-r--r--linden/indra/llwindow/llwindow.h15
-rw-r--r--linden/indra/llwindow/llwindowheadless.h4
-rw-r--r--linden/indra/llwindow/llwindowlinux.h2
-rw-r--r--linden/indra/llwindow/llwindowmacosx.cpp30
-rw-r--r--linden/indra/llwindow/llwindowmacosx.h13
-rw-r--r--linden/indra/llwindow/llwindowmesaheadless.h4
-rw-r--r--linden/indra/llwindow/llwindowsdl.cpp45
-rw-r--r--linden/indra/llwindow/llwindowsdl.h7
-rw-r--r--linden/indra/llwindow/llwindowsolaris.h4
-rw-r--r--linden/indra/llwindow/llwindowwin32.cpp1074
-rw-r--r--linden/indra/llwindow/llwindowwin32.h7
22 files changed, 482 insertions, 863 deletions
diff --git a/linden/indra/llwindow/lldxhardware.cpp b/linden/indra/llwindow/lldxhardware.cpp
index 352a5a3..4eb8cab 100644
--- a/linden/indra/llwindow/lldxhardware.cpp
+++ b/linden/indra/llwindow/lldxhardware.cpp
@@ -233,9 +233,10 @@ LLDXHardware::LLDXHardware()
233 233
234void LLDXHardware::cleanup() 234void LLDXHardware::cleanup()
235{ 235{
236 for_each(mDevices.begin(), mDevices.end(), DeletePairedPointer()); 236 // for_each(mDevices.begin(), mDevices.end(), DeletePairedPointer());
237} 237}
238 238
239/*
239LLString LLDXHardware::dumpDevices() 240LLString LLDXHardware::dumpDevices()
240{ 241{
241 if (gWriteDebug) 242 if (gWriteDebug)
@@ -284,6 +285,7 @@ LLDXDevice *LLDXHardware::findDevice(const std::string &vendor, const std::strin
284 285
285 return NULL; 286 return NULL;
286} 287}
288*/
287 289
288BOOL LLDXHardware::getInfo(BOOL vram_only) 290BOOL LLDXHardware::getInfo(BOOL vram_only)
289{ 291{
@@ -296,7 +298,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
296 IDxDiagProvider *dx_diag_providerp = NULL; 298 IDxDiagProvider *dx_diag_providerp = NULL;
297 IDxDiagContainer *dx_diag_rootp = NULL; 299 IDxDiagContainer *dx_diag_rootp = NULL;
298 IDxDiagContainer *devices_containerp = NULL; 300 IDxDiagContainer *devices_containerp = NULL;
299 IDxDiagContainer *system_device_containerp= NULL; 301 // IDxDiagContainer *system_device_containerp= NULL;
300 IDxDiagContainer *device_containerp = NULL; 302 IDxDiagContainer *device_containerp = NULL;
301 IDxDiagContainer *file_containerp = NULL; 303 IDxDiagContainer *file_containerp = NULL;
302 IDxDiagContainer *driver_containerp = NULL; 304 IDxDiagContainer *driver_containerp = NULL;
@@ -362,15 +364,18 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
362 } 364 }
363 365
364 // Get the English VRAM string 366 // Get the English VRAM string
365 std::string ram_str = get_string(device_containerp, L"szDisplayMemoryEnglish"); 367 {
368 std::string ram_str = get_string(device_containerp, L"szDisplayMemoryEnglish");
366 369
367 // We don't need the device any more 370 // We don't need the device any more
368 SAFE_RELEASE(device_containerp); 371 SAFE_RELEASE(device_containerp);
372
373 // Dump the string as an int into the structure
374 char *stopstring;
375 mVRAM = strtol(ram_str.c_str(), &stopstring, 10);
376 llinfos << "VRAM Detected: " << mVRAM << " DX9 string: " << ram_str << llendl;
377 }
369 378
370 // Dump the string as an int into the structure
371 char *stopstring;
372 mVRAM = strtol(ram_str.c_str(), &stopstring, 10);
373 llinfos << "VRAM Detected: " << mVRAM << " DX9 string: " << ram_str << llendl;
374 379
375 if (vram_only) 380 if (vram_only)
376 { 381 {
@@ -378,6 +383,11 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
378 goto LCleanup; 383 goto LCleanup;
379 } 384 }
380 385
386
387 /* for now, we ONLY do vram_only the rest of this
388 is commented out, to ensure no-one is tempted
389 to use it
390
381 // Now let's get device and driver information 391 // Now let's get device and driver information
382 // Get the IDxDiagContainer object called "DxDiag_SystemDevices". 392 // Get the IDxDiagContainer object called "DxDiag_SystemDevices".
383 // This call may take some time while dxdiag gathers the info. 393 // This call may take some time while dxdiag gathers the info.
@@ -504,11 +514,12 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
504 } 514 }
505 SAFE_RELEASE(device_containerp); 515 SAFE_RELEASE(device_containerp);
506 } 516 }
517 */
507 } 518 }
508 519
509 dumpDevices(); 520 // dumpDevices();
510 ok = TRUE; 521 ok = TRUE;
511 522
512LCleanup: 523LCleanup:
513 if (!ok) 524 if (!ok)
514 { 525 {
@@ -526,7 +537,7 @@ LCleanup:
526 CoUninitialize(); 537 CoUninitialize();
527 538
528 return ok; 539 return ok;
529} 540 }
530 541
531LLSD LLDXHardware::getDisplayInfo() 542LLSD LLDXHardware::getDisplayInfo()
532{ 543{
diff --git a/linden/indra/llwindow/lldxhardware.h b/linden/indra/llwindow/lldxhardware.h
index f4f364e..12d106a 100644
--- a/linden/indra/llwindow/lldxhardware.h
+++ b/linden/indra/llwindow/lldxhardware.h
@@ -85,6 +85,7 @@ class LLDXHardware
85{ 85{
86public: 86public:
87 LLDXHardware(); 87 LLDXHardware();
88
88 void setWriteDebugFunc(void (*func)(const char*)); 89 void setWriteDebugFunc(void (*func)(const char*));
89 void cleanup(); 90 void cleanup();
90 91
@@ -100,12 +101,12 @@ public:
100 // Empty strings indicate that you don't care. 101 // Empty strings indicate that you don't care.
101 // You can separate multiple devices with '|' chars to indicate you want 102 // You can separate multiple devices with '|' chars to indicate you want
102 // ANY of them to match and return. 103 // ANY of them to match and return.
103 LLDXDevice *findDevice(const std::string &vendor, const std::string &devices); 104 // LLDXDevice *findDevice(const std::string &vendor, const std::string &devices);
104 105
105 LLString dumpDevices(); 106 // LLString dumpDevices();
106public: 107public:
107 typedef std::map<std::string, LLDXDevice *> device_map_t; 108 typedef std::map<std::string, LLDXDevice *> device_map_t;
108 device_map_t mDevices; 109 // device_map_t mDevices;
109protected: 110protected:
110 S32 mVRAM; 111 S32 mVRAM;
111}; 112};
diff --git a/linden/indra/llwindow/llgl.cpp b/linden/indra/llwindow/llgl.cpp
index 07840c1..a059cd4 100644
--- a/linden/indra/llwindow/llgl.cpp
+++ b/linden/indra/llwindow/llgl.cpp
@@ -563,7 +563,9 @@ void LLGLManager::initExtensions()
563 mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression"); 563 mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression");
564 mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts); 564 mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts);
565 mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts); 565 mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts);
566 mHasFramebufferObject = ExtensionExists("GL_EXT_framebuffer_object", gGLHExts.mSysExts); 566 // mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad
567 mHasFramebufferObject = ExtensionExists("GL_EXT_framebuffer_object", gGLHExts.mSysExts)
568 && ExtensionExists("GL_EXT_packed_depth_stencil", gGLHExts.mSysExts);
567#if !LL_DARWIN 569#if !LL_DARWIN
568 mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); 570 mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts);
569#endif 571#endif
diff --git a/linden/indra/llwindow/llglstates.h b/linden/indra/llwindow/llglstates.h
index 7d65952..e53640c 100644
--- a/linden/indra/llwindow/llglstates.h
+++ b/linden/indra/llwindow/llglstates.h
@@ -62,7 +62,8 @@ protected:
62 LLGLEnable mColorMaterial; 62 LLGLEnable mColorMaterial;
63 LLGLDisable mAlphaTest, mBlend, mCullFace, mDither, mFog, 63 LLGLDisable mAlphaTest, mBlend, mCullFace, mDither, mFog,
64 mLineSmooth, mLineStipple, mNormalize, mPolygonSmooth, 64 mLineSmooth, mLineStipple, mNormalize, mPolygonSmooth,
65 mTextureGenQ, mTextureGenR, mTextureGenS, mTextureGenT; 65 mTextureGenQ, mTextureGenR, mTextureGenS, mTextureGenT,
66 mGLMultisample;
66public: 67public:
67 LLGLSDefault() 68 LLGLSDefault()
68 : 69 :
@@ -81,7 +82,8 @@ public:
81 mTextureGenQ(GL_TEXTURE_GEN_Q), 82 mTextureGenQ(GL_TEXTURE_GEN_Q),
82 mTextureGenR(GL_TEXTURE_GEN_R), 83 mTextureGenR(GL_TEXTURE_GEN_R),
83 mTextureGenS(GL_TEXTURE_GEN_S), 84 mTextureGenS(GL_TEXTURE_GEN_S),
84 mTextureGenT(GL_TEXTURE_GEN_T) 85 mTextureGenT(GL_TEXTURE_GEN_T),
86 mGLMultisample(GL_MULTISAMPLE_ARB)
85 { } 87 { }
86}; 88};
87 89
@@ -117,7 +119,7 @@ public:
117 119
118//---------------------------------------------------------------------------- 120//----------------------------------------------------------------------------
119 121
120class LLGLSUIDefault // : public LLGLSDefault 122class LLGLSUIDefault
121{ 123{
122protected: 124protected:
123 LLGLEnable mBlend, mAlphaTest; 125 LLGLEnable mBlend, mAlphaTest;
@@ -176,7 +178,7 @@ public:
176 178
177//---------------------------------------------------------------------------- 179//----------------------------------------------------------------------------
178 180
179class LLGLSPipeline // : public LLGLSDefault 181class LLGLSPipeline
180{ 182{
181protected: 183protected:
182 LLGLEnable mCullFace; 184 LLGLEnable mCullFace;
@@ -199,7 +201,7 @@ public:
199 { } 201 { }
200}; 202};
201 203
202class LLGLSPipelineEmbossBump // : public LLGLSPipelineAlpha 204class LLGLSPipelineEmbossBump
203{ 205{
204protected: 206protected:
205 LLGLDisable mFog; 207 LLGLDisable mFog;
@@ -209,7 +211,7 @@ public:
209 { } 211 { }
210}; 212};
211 213
212class LLGLSPipelineSelection // : public LLGLSPipelineAlpha 214class LLGLSPipelineSelection
213{ 215{
214protected: 216protected:
215 LLGLDisable mCullFace; 217 LLGLDisable mCullFace;
@@ -219,7 +221,7 @@ public:
219 {} 221 {}
220}; 222};
221 223
222class LLGLSPipelineAvatar // : public LLGLSPipeline 224class LLGLSPipelineAvatar
223{ 225{
224protected: 226protected:
225 LLGLEnable mNormalize; 227 LLGLEnable mNormalize;
@@ -229,7 +231,7 @@ public:
229 {} 231 {}
230}; 232};
231 233
232class LLGLSPipelineSkyBox // : public LLGLSPipeline 234class LLGLSPipelineSkyBox
233{ 235{
234protected: 236protected:
235 LLGLDisable mAlphaTest, mCullFace, mFog; 237 LLGLDisable mAlphaTest, mCullFace, mFog;
@@ -239,7 +241,7 @@ public:
239 { } 241 { }
240}; 242};
241 243
242class LLGLSTracker // : public LLGLSDefault 244class LLGLSTracker
243{ 245{
244protected: 246protected:
245 LLGLEnable mCullFace, mBlend, mAlphaTest; 247 LLGLEnable mCullFace, mBlend, mAlphaTest;
diff --git a/linden/indra/llwindow/llkeyboard.cpp b/linden/indra/llwindow/llkeyboard.cpp
index 9be23df..c6502ed 100644
--- a/linden/indra/llwindow/llkeyboard.cpp
+++ b/linden/indra/llwindow/llkeyboard.cpp
@@ -96,6 +96,7 @@ LLKeyboard::LLKeyboard() : mCallbacks(NULL), mNumpadDistinct(ND_NUMLOCK_OFF)
96 addKeyName(KEY_SUBTRACT, "Subtract" ); 96 addKeyName(KEY_SUBTRACT, "Subtract" );
97 addKeyName(KEY_MULTIPLY, "Multiply" ); 97 addKeyName(KEY_MULTIPLY, "Multiply" );
98 addKeyName(KEY_DIVIDE, "Divide" ); 98 addKeyName(KEY_DIVIDE, "Divide" );
99 addKeyName(KEY_PAD_DIVIDE, "PAD_DIVIDE" );
99 addKeyName(KEY_PAD_LEFT, "PAD_LEFT" ); 100 addKeyName(KEY_PAD_LEFT, "PAD_LEFT" );
100 addKeyName(KEY_PAD_RIGHT, "PAD_RIGHT" ); 101 addKeyName(KEY_PAD_RIGHT, "PAD_RIGHT" );
101 addKeyName(KEY_PAD_DOWN, "PAD_DOWN" ); 102 addKeyName(KEY_PAD_DOWN, "PAD_DOWN" );
diff --git a/linden/indra/llwindow/llkeyboardmacosx.cpp b/linden/indra/llwindow/llkeyboardmacosx.cpp
index 4cb1029..181e264 100644
--- a/linden/indra/llwindow/llkeyboardmacosx.cpp
+++ b/linden/indra/llwindow/llkeyboardmacosx.cpp
@@ -83,7 +83,7 @@ LLKeyboardMacOSX::LLKeyboardMacOSX()
83 mTranslateKeyMap[0x29] = ';'; 83 mTranslateKeyMap[0x29] = ';';
84 mTranslateKeyMap[0x2a] = '\\'; 84 mTranslateKeyMap[0x2a] = '\\';
85 mTranslateKeyMap[0x2b] = ','; 85 mTranslateKeyMap[0x2b] = ',';
86 mTranslateKeyMap[0x2c] = '/'; 86 mTranslateKeyMap[0x2c] = KEY_DIVIDE;
87 mTranslateKeyMap[0x2d] = 'N'; 87 mTranslateKeyMap[0x2d] = 'N';
88 mTranslateKeyMap[0x2e] = 'M'; 88 mTranslateKeyMap[0x2e] = 'M';
89 mTranslateKeyMap[0x2f] = '.'; 89 mTranslateKeyMap[0x2f] = '.';
@@ -100,7 +100,7 @@ LLKeyboardMacOSX::LLKeyboardMacOSX()
100 mTranslateKeyMap[0x41] = '.'; // keypad 100 mTranslateKeyMap[0x41] = '.'; // keypad
101 mTranslateKeyMap[0x43] = '*'; // keypad 101 mTranslateKeyMap[0x43] = '*'; // keypad
102 mTranslateKeyMap[0x45] = '+'; // keypad 102 mTranslateKeyMap[0x45] = '+'; // keypad
103 mTranslateKeyMap[0x4b] = '/'; // keypad 103 mTranslateKeyMap[0x4b] = KEY_PAD_DIVIDE; // keypad
104 mTranslateKeyMap[0x4c] = KEY_RETURN; // keypad enter 104 mTranslateKeyMap[0x4c] = KEY_RETURN; // keypad enter
105 mTranslateKeyMap[0x4e] = '-'; // keypad 105 mTranslateKeyMap[0x4e] = '-'; // keypad
106 mTranslateKeyMap[0x51] = '='; // keypad 106 mTranslateKeyMap[0x51] = '='; // keypad
diff --git a/linden/indra/llwindow/llkeyboardsdl.cpp b/linden/indra/llwindow/llkeyboardsdl.cpp
index f9d59ac..196a623 100644
--- a/linden/indra/llwindow/llkeyboardsdl.cpp
+++ b/linden/indra/llwindow/llkeyboardsdl.cpp
@@ -103,7 +103,7 @@ LLKeyboardSDL::LLKeyboardSDL()
103 mTranslateKeyMap[SDLK_KP_PLUS] = KEY_ADD; 103 mTranslateKeyMap[SDLK_KP_PLUS] = KEY_ADD;
104 mTranslateKeyMap[SDLK_KP_MINUS] = KEY_SUBTRACT; 104 mTranslateKeyMap[SDLK_KP_MINUS] = KEY_SUBTRACT;
105 mTranslateKeyMap[SDLK_KP_MULTIPLY] = KEY_MULTIPLY; 105 mTranslateKeyMap[SDLK_KP_MULTIPLY] = KEY_MULTIPLY;
106 mTranslateKeyMap[SDLK_KP_DIVIDE] = KEY_DIVIDE; 106 mTranslateKeyMap[SDLK_KP_DIVIDE] = KEY_PAD_DIVIDE;
107 mTranslateKeyMap[SDLK_F1] = KEY_F1; 107 mTranslateKeyMap[SDLK_F1] = KEY_F1;
108 mTranslateKeyMap[SDLK_F2] = KEY_F2; 108 mTranslateKeyMap[SDLK_F2] = KEY_F2;
109 mTranslateKeyMap[SDLK_F3] = KEY_F3; 109 mTranslateKeyMap[SDLK_F3] = KEY_F3;
@@ -121,7 +121,7 @@ LLKeyboardSDL::LLKeyboardSDL()
121 mTranslateKeyMap[SDLK_MINUS] = '-'; 121 mTranslateKeyMap[SDLK_MINUS] = '-';
122 mTranslateKeyMap[SDLK_PERIOD] = '.'; 122 mTranslateKeyMap[SDLK_PERIOD] = '.';
123 mTranslateKeyMap[SDLK_BACKQUOTE] = '`'; 123 mTranslateKeyMap[SDLK_BACKQUOTE] = '`';
124 mTranslateKeyMap[SDLK_SLASH] = '/'; 124 mTranslateKeyMap[SDLK_SLASH] = KEY_DIVIDE;
125 mTranslateKeyMap[SDLK_SEMICOLON] = ';'; 125 mTranslateKeyMap[SDLK_SEMICOLON] = ';';
126 mTranslateKeyMap[SDLK_LEFTBRACKET] = '['; 126 mTranslateKeyMap[SDLK_LEFTBRACKET] = '[';
127 mTranslateKeyMap[SDLK_BACKSLASH] = '\\'; 127 mTranslateKeyMap[SDLK_BACKSLASH] = '\\';
diff --git a/linden/indra/llwindow/llkeyboardwin32.cpp b/linden/indra/llwindow/llkeyboardwin32.cpp
index 1b68112..68cedf1 100644
--- a/linden/indra/llwindow/llkeyboardwin32.cpp
+++ b/linden/indra/llwindow/llkeyboardwin32.cpp
@@ -77,7 +77,7 @@ LLKeyboardWin32::LLKeyboardWin32()
77 mTranslateKeyMap[VK_OEM_COMMA] = ','; 77 mTranslateKeyMap[VK_OEM_COMMA] = ',';
78 mTranslateKeyMap[VK_OEM_MINUS] = '-'; 78 mTranslateKeyMap[VK_OEM_MINUS] = '-';
79 mTranslateKeyMap[VK_OEM_PERIOD] = '.'; 79 mTranslateKeyMap[VK_OEM_PERIOD] = '.';
80 mTranslateKeyMap[VK_OEM_2] = '/'; 80 mTranslateKeyMap[VK_OEM_2] = KEY_PAD_DIVIDE;
81 mTranslateKeyMap[VK_OEM_3] = '`'; 81 mTranslateKeyMap[VK_OEM_3] = '`';
82 mTranslateKeyMap[VK_OEM_4] = '['; 82 mTranslateKeyMap[VK_OEM_4] = '[';
83 mTranslateKeyMap[VK_OEM_5] = '\\'; 83 mTranslateKeyMap[VK_OEM_5] = '\\';
@@ -137,7 +137,11 @@ LLKeyboardWin32::LLKeyboardWin32()
137 mTranslateNumpadMap[0x67] = KEY_PAD_HOME; // keypad 7 137 mTranslateNumpadMap[0x67] = KEY_PAD_HOME; // keypad 7
138 mTranslateNumpadMap[0x68] = KEY_PAD_UP; // keypad 8 138 mTranslateNumpadMap[0x68] = KEY_PAD_UP; // keypad 8
139 mTranslateNumpadMap[0x69] = KEY_PAD_PGUP; // keypad 9 139 mTranslateNumpadMap[0x69] = KEY_PAD_PGUP; // keypad 9
140 mTranslateNumpadMap[0x6A] = KEY_PAD_MULTIPLY; // keypad *
141 mTranslateNumpadMap[0x6B] = KEY_PAD_ADD; // keypad +
142 mTranslateNumpadMap[0x6D] = KEY_PAD_SUBTRACT; // keypad -
140 mTranslateNumpadMap[0x6E] = KEY_PAD_DEL; // keypad . 143 mTranslateNumpadMap[0x6E] = KEY_PAD_DEL; // keypad .
144 mTranslateNumpadMap[0x6F] = KEY_PAD_DIVIDE; // keypad /
141 145
142 for (iter = mTranslateNumpadMap.begin(); iter != mTranslateNumpadMap.end(); iter++) 146 for (iter = mTranslateNumpadMap.begin(); iter != mTranslateNumpadMap.end(); iter++)
143 { 147 {
diff --git a/linden/indra/llwindow/lllogitechlcd.cpp b/linden/indra/llwindow/lllogitechlcd.cpp
index 8bd77cb..81e97a0 100644
--- a/linden/indra/llwindow/lllogitechlcd.cpp
+++ b/linden/indra/llwindow/lllogitechlcd.cpp
@@ -47,6 +47,7 @@ extern LLControlGroup gSavedSettings;
47 47
48LLLCDPageGroup::LLLCDPageGroup(CEzLcd *LCD, int type, HICON SLIcon): 48LLLCDPageGroup::LLLCDPageGroup(CEzLcd *LCD, int type, HICON SLIcon):
49mType(type), 49mType(type),
50mHandle(NULL),
50mSLIcon(SLIcon), 51mSLIcon(SLIcon),
51mDisplayPage(false), 52mDisplayPage(false),
52mLCD(LCD) 53mLCD(LCD)
@@ -100,7 +101,9 @@ mDebounceTimer(),
100mPageToShow(-1), 101mPageToShow(-1),
101mInstance(instance), 102mInstance(instance),
102mDestinationLCD(-1), 103mDestinationLCD(-1),
103mFirstTimeThru(true) 104mFirstTimeThru(true),
105mCurrentGroupBeingShown(NULL),
106mSLIcon(NULL)
104{ 107{
105 HRESULT res_ = S_OK; 108 HRESULT res_ = S_OK;
106 109
diff --git a/linden/indra/llwindow/llpreeditor.h b/linden/indra/llwindow/llpreeditor.h
index f66a390..884101a 100644
--- a/linden/indra/llwindow/llpreeditor.h
+++ b/linden/indra/llwindow/llpreeditor.h
@@ -100,7 +100,7 @@ public:
100 // This is a back door of the method of same name of LLWindowCallback. 100 // This is a back door of the method of same name of LLWindowCallback.
101 // called_from_parent should be set to FALSE if calling through LLPreeditor. 101 // called_from_parent should be set to FALSE if calling through LLPreeditor.
102 102
103 virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) = 0; 103 virtual BOOL handleUnicodeCharHere(llwchar uni_char) = 0;
104}; 104};
105 105
106#endif 106#endif
diff --git a/linden/indra/llwindow/llwindow.cpp b/linden/indra/llwindow/llwindow.cpp
index 5e05f03..9963228 100644
--- a/linden/indra/llwindow/llwindow.cpp
+++ b/linden/indra/llwindow/llwindow.cpp
@@ -143,6 +143,11 @@ BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated)
143 return FALSE; 143 return FALSE;
144} 144}
145 145
146BOOL LLWindowCallbacks::handleActivateApp(LLWindow *window, BOOL activating)
147{
148 return FALSE;
149}
150
146void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, MASK mask) 151void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, MASK mask)
147{ 152{
148} 153}
@@ -190,6 +195,15 @@ void LLWindowCallbacks::handleDataCopy(LLWindow *window, S32 data_type, void *da
190{ 195{
191} 196}
192 197
198BOOL LLWindowCallbacks::handleTimerEvent(LLWindow *window)
199{
200 return FALSE;
201}
202
203BOOL LLWindowCallbacks::handleDeviceChange(LLWindow *window)
204{
205 return FALSE;
206}
193 207
194S32 OSMessageBox(const char* text, const char* caption, U32 type) 208S32 OSMessageBox(const char* text, const char* caption, U32 type)
195{ 209{
@@ -247,15 +261,6 @@ LLWindow::LLWindow(BOOL fullscreen, U32 flags)
247 mFlags(flags), 261 mFlags(flags),
248 mHighSurrogate(0) 262 mHighSurrogate(0)
249{ 263{
250 for (U32 i = 0; i < 8; i++)
251 {
252 mJoyAxis[i] = 0;
253 }
254
255 for (U32 i = 0; i < 16; i++)
256 {
257 mJoyButtonState[i] = 0;
258 }
259} 264}
260 265
261// virtual 266// virtual
@@ -273,24 +278,6 @@ void LLWindow::decBusyCount()
273 } 278 }
274} 279}
275 280
276F32 LLWindow::getJoystickAxis(U32 axis)
277{
278 if (axis < 8)
279 {
280 return mJoyAxis[axis];
281 }
282 return 0.f;
283}
284
285U8 LLWindow::getJoystickButton(U32 button)
286{
287 if (button < 16)
288 {
289 return mJoyButtonState[button];
290 }
291 return 0;
292}
293
294void LLWindow::setCallbacks(LLWindowCallbacks *callbacks) 281void LLWindow::setCallbacks(LLWindowCallbacks *callbacks)
295{ 282{
296 mCallbacks = callbacks; 283 mCallbacks = callbacks;
@@ -440,7 +427,8 @@ LLWindow* LLWindowManager::createWindow(
440 BOOL clearBg, 427 BOOL clearBg,
441 BOOL disable_vsync, 428 BOOL disable_vsync,
442 BOOL use_gl, 429 BOOL use_gl,
443 BOOL ignore_pixel_depth) 430 BOOL ignore_pixel_depth,
431 U32 fsaa_samples)
444{ 432{
445 LLWindow* new_window; 433 LLWindow* new_window;
446 434
@@ -453,15 +441,15 @@ LLWindow* LLWindowManager::createWindow(
453#elif LL_SDL 441#elif LL_SDL
454 new_window = new LLWindowSDL( 442 new_window = new LLWindowSDL(
455 title, x, y, width, height, flags, 443 title, x, y, width, height, flags,
456 fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth); 444 fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
457#elif LL_WINDOWS 445#elif LL_WINDOWS
458 new_window = new LLWindowWin32( 446 new_window = new LLWindowWin32(
459 title, name, x, y, width, height, flags, 447 title, name, x, y, width, height, flags,
460 fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth); 448 fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
461#elif LL_DARWIN 449#elif LL_DARWIN
462 new_window = new LLWindowMacOSX( 450 new_window = new LLWindowMacOSX(
463 title, name, x, y, width, height, flags, 451 title, name, x, y, width, height, flags,
464 fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth); 452 fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
465#elif LL_LINUX 453#elif LL_LINUX
466 new_window = new LLWindowLinux( 454 new_window = new LLWindowLinux(
467 title, name, x, y, width, height, flags, 455 title, name, x, y, width, height, flags,
diff --git a/linden/indra/llwindow/llwindow.h b/linden/indra/llwindow/llwindow.h
index 48ee4d6..89de5a0 100644
--- a/linden/indra/llwindow/llwindow.h
+++ b/linden/indra/llwindow/llwindow.h
@@ -107,6 +107,7 @@ public:
107 virtual BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); 107 virtual BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
108 virtual BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); 108 virtual BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
109 virtual BOOL handleActivate(LLWindow *window, BOOL activated); 109 virtual BOOL handleActivate(LLWindow *window, BOOL activated);
110 virtual BOOL handleActivateApp(LLWindow *window, BOOL activating);
110 virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask); 111 virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
111 virtual void handleScrollWheel(LLWindow *window, S32 clicks); 112 virtual void handleScrollWheel(LLWindow *window, S32 clicks);
112 virtual void handleResize(LLWindow *window, S32 width, S32 height); 113 virtual void handleResize(LLWindow *window, S32 width, S32 height);
@@ -118,6 +119,8 @@ public:
118 virtual void handleWindowBlock(LLWindow *window); // window is taking over CPU for a while 119 virtual void handleWindowBlock(LLWindow *window); // window is taking over CPU for a while
119 virtual void handleWindowUnblock(LLWindow *window); // window coming back after taking over CPU for a while 120 virtual void handleWindowUnblock(LLWindow *window); // window coming back after taking over CPU for a while
120 virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data); 121 virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data);
122 virtual BOOL handleTimerEvent(LLWindow *window);
123 virtual BOOL handleDeviceChange(LLWindow *window);
121}; 124};
122 125
123// Refer to llwindow_test in test/common/llwindow for usage example 126// Refer to llwindow_test in test/common/llwindow for usage example
@@ -154,7 +157,7 @@ public:
154 virtual BOOL getSize(LLCoordWindow *size) = 0; 157 virtual BOOL getSize(LLCoordWindow *size) = 0;
155 virtual BOOL setPosition(LLCoordScreen position) = 0; 158 virtual BOOL setPosition(LLCoordScreen position) = 0;
156 virtual BOOL setSize(LLCoordScreen size) = 0; 159 virtual BOOL setSize(LLCoordScreen size) = 0;
157 virtual BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) = 0; 160 virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) = 0;
158 virtual BOOL setCursorPosition(LLCoordWindow position) = 0; 161 virtual BOOL setCursorPosition(LLCoordWindow position) = 0;
159 virtual BOOL getCursorPosition(LLCoordWindow *position) = 0; 162 virtual BOOL getCursorPosition(LLCoordWindow *position) = 0;
160 virtual void showCursor() = 0; 163 virtual void showCursor() = 0;
@@ -184,6 +187,8 @@ public:
184 virtual void flashIcon(F32 seconds) = 0; 187 virtual void flashIcon(F32 seconds) = 0;
185 virtual F32 getGamma() = 0; 188 virtual F32 getGamma() = 0;
186 virtual BOOL setGamma(const F32 gamma) = 0; // Set the gamma 189 virtual BOOL setGamma(const F32 gamma) = 0; // Set the gamma
190 virtual void setFSAASamples(const U32 fsaa_samples) = 0; //set number of FSAA samples
191 virtual U32 getFSAASamples() = 0;
187 virtual BOOL restoreGamma() = 0; // Restore original gamma table (before updating gamma) 192 virtual BOOL restoreGamma() = 0; // Restore original gamma table (before updating gamma)
188 virtual ESwapMethod getSwapMethod() { return mSwapMethod; } 193 virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
189 virtual void gatherInput() = 0; 194 virtual void gatherInput() = 0;
@@ -212,9 +217,6 @@ public:
212 virtual F32 getPixelAspectRatio() = 0; 217 virtual F32 getPixelAspectRatio() = 0;
213 virtual void setNativeAspectRatio(F32 aspect) = 0; 218 virtual void setNativeAspectRatio(F32 aspect) = 0;
214 219
215 F32 getJoystickAxis(U32 axis);
216 U8 getJoystickButton(U32 button);
217
218 void setCallbacks(LLWindowCallbacks *callbacks); 220 void setCallbacks(LLWindowCallbacks *callbacks);
219 221
220 virtual void beforeDialog() {}; // prepare to put up an OS dialog (if special measures are required, such as in fullscreen mode) 222 virtual void beforeDialog() {}; // prepare to put up an OS dialog (if special measures are required, such as in fullscreen mode)
@@ -258,8 +260,6 @@ protected:
258 ESwapMethod mSwapMethod; 260 ESwapMethod mSwapMethod;
259 BOOL mHideCursorPermanent; 261 BOOL mHideCursorPermanent;
260 U32 mFlags; 262 U32 mFlags;
261 F32 mJoyAxis[8];
262 U8 mJoyButtonState[16];
263 U16 mHighSurrogate; 263 U16 mHighSurrogate;
264 264
265 // Handle a UTF-16 encoding unit received from keyboard. 265 // Handle a UTF-16 encoding unit received from keyboard.
@@ -340,7 +340,8 @@ public:
340 BOOL clearBg = FALSE, 340 BOOL clearBg = FALSE,
341 BOOL disable_vsync = TRUE, 341 BOOL disable_vsync = TRUE,
342 BOOL use_gl = TRUE, 342 BOOL use_gl = TRUE,
343 BOOL ignore_pixel_depth = FALSE); 343 BOOL ignore_pixel_depth = FALSE,
344 U32 fsaa_samples = 0);
344 static BOOL destroyWindow(LLWindow* window); 345 static BOOL destroyWindow(LLWindow* window);
345 static BOOL isWindowValid(LLWindow *window); 346 static BOOL isWindowValid(LLWindow *window);
346}; 347};
diff --git a/linden/indra/llwindow/llwindowheadless.h b/linden/indra/llwindow/llwindowheadless.h
index 15e7196..7cef7d8 100644
--- a/linden/indra/llwindow/llwindowheadless.h
+++ b/linden/indra/llwindow/llwindowheadless.h
@@ -50,7 +50,7 @@ public:
50 /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;}; 50 /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;};
51 /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;}; 51 /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
52 /*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;}; 52 /*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;};
53 /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) {return FALSE;}; 53 /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
54 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;}; 54 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
55 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;}; 55 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
56 /*virtual*/ void showCursor() {}; 56 /*virtual*/ void showCursor() {};
@@ -69,6 +69,8 @@ public:
69 /*virtual*/ void flashIcon(F32 seconds) {}; 69 /*virtual*/ void flashIcon(F32 seconds) {};
70 /*virtual*/ F32 getGamma() {return 1.0f; }; 70 /*virtual*/ F32 getGamma() {return 1.0f; };
71 /*virtual*/ BOOL setGamma(const F32 gamma) {return FALSE; }; // Set the gamma 71 /*virtual*/ BOOL setGamma(const F32 gamma) {return FALSE; }; // Set the gamma
72 /*virtual*/ void setFSAASamples(const U32 fsaa_samples) { }
73 /*virtual*/ U32 getFSAASamples() { return 0; }
72 /*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma) 74 /*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma)
73 //virtual ESwapMethod getSwapMethod() { return mSwapMethod; } 75 //virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
74 /*virtual*/ void gatherInput() {}; 76 /*virtual*/ void gatherInput() {};
diff --git a/linden/indra/llwindow/llwindowlinux.h b/linden/indra/llwindow/llwindowlinux.h
index bebf25a..da80fd4 100644
--- a/linden/indra/llwindow/llwindowlinux.h
+++ b/linden/indra/llwindow/llwindowlinux.h
@@ -50,7 +50,7 @@ public:
50 /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;}; 50 /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;};
51 /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;}; 51 /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
52 /*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;}; 52 /*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;};
53 /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) {return FALSE;}; 53 /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
54 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;}; 54 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
55 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;}; 55 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
56 /*virtual*/ void showCursor() {}; 56 /*virtual*/ void showCursor() {};
diff --git a/linden/indra/llwindow/llwindowmacosx.cpp b/linden/indra/llwindow/llwindowmacosx.cpp
index 5c91cc0..f5cc8c6 100644
--- a/linden/indra/llwindow/llwindowmacosx.cpp
+++ b/linden/indra/llwindow/llwindowmacosx.cpp
@@ -246,7 +246,8 @@ LLWindowMacOSX::LLWindowMacOSX(char *title, char *name, S32 x, S32 y, S32 width,
246 S32 height, U32 flags, 246 S32 height, U32 flags,
247 BOOL fullscreen, BOOL clearBg, 247 BOOL fullscreen, BOOL clearBg,
248 BOOL disable_vsync, BOOL use_gl, 248 BOOL disable_vsync, BOOL use_gl,
249 BOOL ignore_pixel_depth) 249 BOOL ignore_pixel_depth,
250 U32 fsaa_samples)
250 : LLWindow(fullscreen, flags) 251 : LLWindow(fullscreen, flags)
251{ 252{
252 // Voodoo for calling cocoa from carbon (see llwindowmacosx-objc.mm). 253 // Voodoo for calling cocoa from carbon (see llwindowmacosx-objc.mm).
@@ -277,6 +278,8 @@ LLWindowMacOSX::LLWindowMacOSX(char *title, char *name, S32 x, S32 y, S32 width,
277 mTSMScriptCode = 0; 278 mTSMScriptCode = 0;
278 mTSMLangCode = 0; 279 mTSMLangCode = 0;
279 mPreeditor = NULL; 280 mPreeditor = NULL;
281 mFSAASamples = fsaa_samples;
282 mForceRebuild = FALSE;
280 283
281 // For reasons that aren't clear to me, LLTimers seem to be created in the "started" state. 284 // For reasons that aren't clear to me, LLTimers seem to be created in the "started" state.
282 // Since the started state of this one is used to track whether the NMRec has been installed, it wants to start out in the "stopped" state. 285 // Since the started state of this one is used to track whether the NMRec has been installed, it wants to start out in the "stopped" state.
@@ -558,6 +561,8 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
558 AGL_RGBA, 561 AGL_RGBA,
559 AGL_FULLSCREEN, 562 AGL_FULLSCREEN,
560 // AGL_NO_RECOVERY, // MBW -- XXX -- Not sure if we want this attribute 563 // AGL_NO_RECOVERY, // MBW -- XXX -- Not sure if we want this attribute
564 AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
565 AGL_SAMPLES_ARB, mFSAASamples,
561 AGL_DOUBLEBUFFER, 566 AGL_DOUBLEBUFFER,
562 AGL_CLOSEST_POLICY, 567 AGL_CLOSEST_POLICY,
563 AGL_ACCELERATED, 568 AGL_ACCELERATED,
@@ -586,6 +591,8 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
586 AGL_DOUBLEBUFFER, 591 AGL_DOUBLEBUFFER,
587 AGL_CLOSEST_POLICY, 592 AGL_CLOSEST_POLICY,
588 AGL_ACCELERATED, 593 AGL_ACCELERATED,
594 AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
595 AGL_SAMPLES_ARB, mFSAASamples,
589 AGL_RED_SIZE, 8, 596 AGL_RED_SIZE, 8,
590 AGL_GREEN_SIZE, 8, 597 AGL_GREEN_SIZE, 8,
591 AGL_BLUE_SIZE, 8, 598 AGL_BLUE_SIZE, 8,
@@ -819,13 +826,16 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
819 } 826 }
820 } 827 }
821 828
829 //make sure multisample starts off disabled
830 glDisable(GL_MULTISAMPLE_ARB);
831
822 // Don't need to get the current gamma, since there's a call that restores it to the system defaults. 832 // Don't need to get the current gamma, since there's a call that restores it to the system defaults.
823 return TRUE; 833 return TRUE;
824} 834}
825 835
826 836
827// changing fullscreen resolution, or switching between windowed and fullscreen mode. 837// changing fullscreen resolution, or switching between windowed and fullscreen mode.
828BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) 838BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
829{ 839{
830 BOOL needsRebuild = FALSE; 840 BOOL needsRebuild = FALSE;
831 BOOL result = true; 841 BOOL result = true;
@@ -897,8 +907,9 @@ BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL dis
897 } 907 }
898 908
899 stop_glerror(); 909 stop_glerror();
900 if(needsRebuild) 910 if(needsRebuild || mForceRebuild)
901 { 911 {
912 mForceRebuild = FALSE;
902 destroyContext(); 913 destroyContext();
903 result = createContext(0, 0, size.mX, size.mY, 0, fullscreen, disable_vsync); 914 result = createContext(0, 0, size.mX, size.mY, 0, fullscreen, disable_vsync);
904 if (result) 915 if (result)
@@ -1318,6 +1329,17 @@ F32 LLWindowMacOSX::getGamma()
1318 return result; 1329 return result;
1319} 1330}
1320 1331
1332U32 LLWindowMacOSX::getFSAASamples()
1333{
1334 return mFSAASamples;
1335}
1336
1337void LLWindowMacOSX::setFSAASamples(const U32 samples)
1338{
1339 mFSAASamples = samples;
1340 mForceRebuild = TRUE;
1341}
1342
1321BOOL LLWindowMacOSX::restoreGamma() 1343BOOL LLWindowMacOSX::restoreGamma()
1322{ 1344{
1323 CGDisplayRestoreColorSyncSettings(); 1345 CGDisplayRestoreColorSyncSettings();
@@ -2031,7 +2053,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
2031 { 2053 {
2032 for (LLWString::const_iterator i = fix_string.begin(); i != fix_string.end(); i++) 2054 for (LLWString::const_iterator i = fix_string.begin(); i != fix_string.end(); i++)
2033 { 2055 {
2034 mPreeditor->handleUnicodeCharHere(*i, FALSE); 2056 mPreeditor->handleUnicodeCharHere(*i);
2035 } 2057 }
2036 } 2058 }
2037 2059
diff --git a/linden/indra/llwindow/llwindowmacosx.h b/linden/indra/llwindow/llwindowmacosx.h
index 789e2ed..1edb218 100644
--- a/linden/indra/llwindow/llwindowmacosx.h
+++ b/linden/indra/llwindow/llwindowmacosx.h
@@ -59,7 +59,7 @@ public:
59 /*virtual*/ BOOL getSize(LLCoordWindow *size); 59 /*virtual*/ BOOL getSize(LLCoordWindow *size);
60 /*virtual*/ BOOL setPosition(LLCoordScreen position); 60 /*virtual*/ BOOL setPosition(LLCoordScreen position);
61 /*virtual*/ BOOL setSize(LLCoordScreen size); 61 /*virtual*/ BOOL setSize(LLCoordScreen size);
62 /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync); 62 /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
63 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position); 63 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
64 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position); 64 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
65 /*virtual*/ void showCursor(); 65 /*virtual*/ void showCursor();
@@ -78,6 +78,8 @@ public:
78 /*virtual*/ void flashIcon(F32 seconds); 78 /*virtual*/ void flashIcon(F32 seconds);
79 /*virtual*/ F32 getGamma(); 79 /*virtual*/ F32 getGamma();
80 /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma 80 /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
81 /*virtual*/ U32 getFSAASamples();
82 /*virtual*/ void setFSAASamples(const U32 fsaa_samples);
81 /*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma) 83 /*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
82 /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; } 84 /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
83 /*virtual*/ void gatherInput(); 85 /*virtual*/ void gatherInput();
@@ -118,7 +120,8 @@ protected:
118 LLWindowMacOSX( 120 LLWindowMacOSX(
119 char *title, char *name, int x, int y, int width, int height, U32 flags, 121 char *title, char *name, int x, int y, int width, int height, U32 flags,
120 BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, 122 BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
121 BOOL ignore_pixel_depth); 123 BOOL ignore_pixel_depth,
124 U32 fsaa_samples);
122 ~LLWindowMacOSX(); 125 ~LLWindowMacOSX();
123 126
124 void initCursors(); 127 void initCursors();
@@ -184,7 +187,9 @@ protected:
184 LLCoordScreen mNeedsResizeSize; 187 LLCoordScreen mNeedsResizeSize;
185 F32 mOverrideAspectRatio; 188 F32 mOverrideAspectRatio;
186 BOOL mMinimized; 189 BOOL mMinimized;
187 190 U32 mFSAASamples;
191 BOOL mForceRebuild;
192
188 F32 mBounceTime; 193 F32 mBounceTime;
189 NMRec mBounceRec; 194 NMRec mBounceRec;
190 LLTimer mBounceTimer; 195 LLTimer mBounceTimer;
@@ -195,7 +200,7 @@ protected:
195 ScriptCode mTSMScriptCode; 200 ScriptCode mTSMScriptCode;
196 LangCode mTSMLangCode; 201 LangCode mTSMLangCode;
197 LLPreeditor* mPreeditor; 202 LLPreeditor* mPreeditor;
198 203
199 friend class LLWindowManager; 204 friend class LLWindowManager;
200}; 205};
201 206
diff --git a/linden/indra/llwindow/llwindowmesaheadless.h b/linden/indra/llwindow/llwindowmesaheadless.h
index 29e5878..fb32e38 100644
--- a/linden/indra/llwindow/llwindowmesaheadless.h
+++ b/linden/indra/llwindow/llwindowmesaheadless.h
@@ -54,7 +54,7 @@ public:
54 /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;}; 54 /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;};
55 /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;}; 55 /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
56 /*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;}; 56 /*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;};
57 /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) {return FALSE;}; 57 /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
58 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;}; 58 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
59 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;}; 59 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
60 /*virtual*/ void showCursor() {}; 60 /*virtual*/ void showCursor() {};
@@ -74,6 +74,8 @@ public:
74 /*virtual*/ F32 getGamma() {return 1.0f; }; 74 /*virtual*/ F32 getGamma() {return 1.0f; };
75 /*virtual*/ BOOL setGamma(const F32 gamma) {return FALSE; }; // Set the gamma 75 /*virtual*/ BOOL setGamma(const F32 gamma) {return FALSE; }; // Set the gamma
76 /*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma) 76 /*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma)
77 /*virtual*/ void setFSAASamples(const U32 fsaa_samples) { /* FSAA not supported yet on Mesa headless.*/ }
78 /*virtual*/ U32 getFSAASamples() { return 0; }
77 //virtual ESwapMethod getSwapMethod() { return mSwapMethod; } 79 //virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
78 /*virtual*/ void gatherInput() {}; 80 /*virtual*/ void gatherInput() {};
79 /*virtual*/ void delayInputProcessing() {}; 81 /*virtual*/ void delayInputProcessing() {};
diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp
index 73753c3..d9dc040 100644
--- a/linden/indra/llwindow/llwindowsdl.cpp
+++ b/linden/indra/llwindow/llwindowsdl.cpp
@@ -82,7 +82,7 @@ static BOOL was_fullscreen = FALSE;
82 82
83void maybe_lock_display(void) 83void maybe_lock_display(void)
84{ 84{
85 if (gWindowImplementation) { 85 if (gWindowImplementation && gWindowImplementation->Lock_Display) {
86 gWindowImplementation->Lock_Display(); 86 gWindowImplementation->Lock_Display();
87 } 87 }
88} 88}
@@ -90,7 +90,7 @@ void maybe_lock_display(void)
90 90
91void maybe_unlock_display(void) 91void maybe_unlock_display(void)
92{ 92{
93 if (gWindowImplementation) { 93 if (gWindowImplementation && gWindowImplementation->Unlock_Display) {
94 gWindowImplementation->Unlock_Display(); 94 gWindowImplementation->Unlock_Display();
95 } 95 }
96} 96}
@@ -218,7 +218,7 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width,
218 S32 height, U32 flags, 218 S32 height, U32 flags,
219 BOOL fullscreen, BOOL clearBg, 219 BOOL fullscreen, BOOL clearBg,
220 BOOL disable_vsync, BOOL use_gl, 220 BOOL disable_vsync, BOOL use_gl,
221 BOOL ignore_pixel_depth) 221 BOOL ignore_pixel_depth, U32 fsaa_samples)
222 : LLWindow(fullscreen, flags), mGamma(1.0f) 222 : LLWindow(fullscreen, flags), mGamma(1.0f)
223{ 223{
224 // Initialize the keyboard 224 // Initialize the keyboard
@@ -237,6 +237,7 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width,
237 mReallyCapturedCount = 0; 237 mReallyCapturedCount = 0;
238 mHaveInputFocus = -1; 238 mHaveInputFocus = -1;
239 mIsMinimized = -1; 239 mIsMinimized = -1;
240 mFSAASamples = fsaa_samples;
240 241
241#if LL_X11 242#if LL_X11
242 mSDL_XWindowID = None; 243 mSDL_XWindowID = None;
@@ -261,7 +262,7 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width,
261 mWindowTitle = new char[strlen(title) + 1]; /* Flawfinder: ignore */ 262 mWindowTitle = new char[strlen(title) + 1]; /* Flawfinder: ignore */
262 if(mWindowTitle == NULL) 263 if(mWindowTitle == NULL)
263 { 264 {
264 llerrs << "Memory allocation failure" << llendl; 265 llwarns << "Memory allocation failure" << llendl;
265 return; 266 return;
266 } 267 }
267 268
@@ -536,6 +537,12 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
536 537
537 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); 538 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
538 539
540 if (mFSAASamples > 0)
541 {
542 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
543 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, mFSAASamples);
544 }
545
539 mSDLFlags = sdlflags; 546 mSDLFlags = sdlflags;
540 547
541 if (mFullscreen) 548 if (mFullscreen)
@@ -747,6 +754,9 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
747#if LL_X11 754#if LL_X11
748 init_x11clipboard(); 755 init_x11clipboard();
749#endif // LL_X11 756#endif // LL_X11
757
758 //make sure multisampling is disabled by default
759 glDisable(GL_MULTISAMPLE_ARB);
750 760
751 // We need to do this here, once video is init'd 761 // We need to do this here, once video is init'd
752 if (-1 == SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 762 if (-1 == SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,
@@ -759,7 +769,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
759 769
760 770
761// changing fullscreen resolution, or switching between windowed and fullscreen mode. 771// changing fullscreen resolution, or switching between windowed and fullscreen mode.
762BOOL LLWindowSDL::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) 772BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
763{ 773{
764 const BOOL needsRebuild = TRUE; // Just nuke the context and start over. 774 const BOOL needsRebuild = TRUE; // Just nuke the context and start over.
765 BOOL result = true; 775 BOOL result = true;
@@ -797,7 +807,6 @@ void LLWindowSDL::destroyContext()
797 gGLManager.shutdownGL(); 807 gGLManager.shutdownGL();
798 llinfos << "SDL_QuitSS/VID begins" << llendl; 808 llinfos << "SDL_QuitSS/VID begins" << llendl;
799 SDL_QuitSubSystem(SDL_INIT_VIDEO); // *FIX: this might be risky... 809 SDL_QuitSubSystem(SDL_INIT_VIDEO); // *FIX: this might be risky...
800 //unload_all_glsyms();
801 810
802 mWindow = NULL; 811 mWindow = NULL;
803} 812}
@@ -923,10 +932,10 @@ BOOL LLWindowSDL::getSize(LLCoordScreen *size)
923 { 932 {
924 size->mX = mWindow->w; 933 size->mX = mWindow->w;
925 size->mY = mWindow->h; 934 size->mY = mWindow->h;
926 return (TRUE); 935 return (TRUE);
927 } 936 }
928 937
929 llerrs << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl; 938 llwarns << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl;
930 return (FALSE); 939 return (FALSE);
931} 940}
932 941
@@ -936,10 +945,10 @@ BOOL LLWindowSDL::getSize(LLCoordWindow *size)
936 { 945 {
937 size->mX = mWindow->w; 946 size->mX = mWindow->w;
938 size->mY = mWindow->h; 947 size->mY = mWindow->h;
939 return (TRUE); 948 return (TRUE);
940 } 949 }
941 950
942 llerrs << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl; 951 llwarns << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl;
943 return (FALSE); 952 return (FALSE);
944} 953}
945 954
@@ -971,6 +980,16 @@ void LLWindowSDL::swapBuffers()
971 SDL_GL_SwapBuffers(); 980 SDL_GL_SwapBuffers();
972} 981}
973 982
983U32 LLWindowSDL::getFSAASamples()
984{
985 return mFSAASamples;
986}
987
988void LLWindowSDL::setFSAASamples(const U32 samples)
989{
990 mFSAASamples = samples;
991}
992
974F32 LLWindowSDL::getGamma() 993F32 LLWindowSDL::getGamma()
975{ 994{
976 return 1/mGamma; 995 return 1/mGamma;
@@ -1117,8 +1136,10 @@ F32 LLWindowSDL::getPixelAspectRatio()
1117 if (getFullscreen()) 1136 if (getFullscreen())
1118 { 1137 {
1119 LLCoordScreen screen_size; 1138 LLCoordScreen screen_size;
1120 getSize(&screen_size); 1139 if (getSize(&screen_size))
1121 pixel_aspect = getNativeAspectRatio() * (F32)screen_size.mY / (F32)screen_size.mX; 1140 {
1141 pixel_aspect = getNativeAspectRatio() * (F32)screen_size.mY / (F32)screen_size.mX;
1142 }
1122 } 1143 }
1123 1144
1124 return pixel_aspect; 1145 return pixel_aspect;
diff --git a/linden/indra/llwindow/llwindowsdl.h b/linden/indra/llwindow/llwindowsdl.h
index 3d102b9..d1b2b77 100644
--- a/linden/indra/llwindow/llwindowsdl.h
+++ b/linden/indra/llwindow/llwindowsdl.h
@@ -66,7 +66,7 @@ public:
66 /*virtual*/ BOOL getSize(LLCoordWindow *size); 66 /*virtual*/ BOOL getSize(LLCoordWindow *size);
67 /*virtual*/ BOOL setPosition(LLCoordScreen position); 67 /*virtual*/ BOOL setPosition(LLCoordScreen position);
68 /*virtual*/ BOOL setSize(LLCoordScreen size); 68 /*virtual*/ BOOL setSize(LLCoordScreen size);
69 /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync); 69 /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
70 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position); 70 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
71 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position); 71 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
72 /*virtual*/ void showCursor(); 72 /*virtual*/ void showCursor();
@@ -85,6 +85,8 @@ public:
85 /*virtual*/ void flashIcon(F32 seconds); 85 /*virtual*/ void flashIcon(F32 seconds);
86 /*virtual*/ F32 getGamma(); 86 /*virtual*/ F32 getGamma();
87 /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma 87 /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
88 /*virtual*/ U32 getFSAASamples();
89 /*virtual*/ void setFSAASamples(const U32 samples);
88 /*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma) 90 /*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
89 /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; } 91 /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
90 /*virtual*/ void gatherInput(); 92 /*virtual*/ void gatherInput();
@@ -132,7 +134,7 @@ protected:
132 LLWindowSDL( 134 LLWindowSDL(
133 char *title, int x, int y, int width, int height, U32 flags, 135 char *title, int x, int y, int width, int height, U32 flags,
134 BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, 136 BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
135 BOOL ignore_pixel_depth); 137 BOOL ignore_pixel_depth, U32 fsaa_samples);
136 ~LLWindowSDL(); 138 ~LLWindowSDL();
137 139
138 void initCursors(); 140 void initCursors();
@@ -183,6 +185,7 @@ protected:
183 LLCoordScreen mNeedsResizeSize; 185 LLCoordScreen mNeedsResizeSize;
184 F32 mOverrideAspectRatio; 186 F32 mOverrideAspectRatio;
185 F32 mGamma; 187 F32 mGamma;
188 U32 mFSAASamples;
186 189
187 int mSDLFlags; 190 int mSDLFlags;
188 191
diff --git a/linden/indra/llwindow/llwindowsolaris.h b/linden/indra/llwindow/llwindowsolaris.h
index 7aeac58..7a271c0 100644
--- a/linden/indra/llwindow/llwindowsolaris.h
+++ b/linden/indra/llwindow/llwindowsolaris.h
@@ -50,7 +50,7 @@ public:
50 /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;}; 50 /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;};
51 /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;}; 51 /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
52 /*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;}; 52 /*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;};
53 /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) {return FALSE;}; 53 /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
54 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;}; 54 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
55 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;}; 55 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
56 /*virtual*/ void showCursor() {}; 56 /*virtual*/ void showCursor() {};
@@ -69,6 +69,8 @@ public:
69 /*virtual*/ void flashIcon(F32 seconds) {}; 69 /*virtual*/ void flashIcon(F32 seconds) {};
70 /*virtual*/ F32 getGamma() {return 1.0f; }; 70 /*virtual*/ F32 getGamma() {return 1.0f; };
71 /*virtual*/ BOOL setGamma(const F32 gamma) {return FALSE; }; // Set the gamma 71 /*virtual*/ BOOL setGamma(const F32 gamma) {return FALSE; }; // Set the gamma
72 /*virtual*/ U32 getFSAASamples() { return 0; }
73 /*virtual*/ void setFSAASamples(const U32 samples) { }
72 /*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma) 74 /*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma)
73 //virtual ESwapMethod getSwapMethod() { return mSwapMethod; } 75 //virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
74 /*virtual*/ void gatherInput() {}; 76 /*virtual*/ void gatherInput() {};
diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp
index f6beb79..b14df5e 100644
--- a/linden/indra/llwindow/llwindowwin32.cpp
+++ b/linden/indra/llwindow/llwindowwin32.cpp
@@ -1,4 +1,4 @@
1/** 1/**
2 * @file llwindowwin32.cpp 2 * @file llwindowwin32.cpp
3 * @brief Platform-dependent implementation of llwindow 3 * @brief Platform-dependent implementation of llwindow
4 * 4 *
@@ -46,7 +46,7 @@
46#define DIRECTINPUT_VERSION 0x0800 46#define DIRECTINPUT_VERSION 0x0800
47 47
48#include <dinput.h> 48#include <dinput.h>
49 49#include <Dbt.h.>
50 50
51#include "llkeyboardwin32.h" 51#include "llkeyboardwin32.h"
52#include "llerror.h" 52#include "llerror.h"
@@ -103,7 +103,7 @@ LLCoordWindow LLWindowWin32::sWinIMEWindowPosition(-1,-1);
103// as a default, and we can't link against imm32.lib statically. 103// as a default, and we can't link against imm32.lib statically.
104// I believe DLL loading of this type is best suited to do 104// I believe DLL loading of this type is best suited to do
105// in a static initialization of a class. What I'm not sure is 105// in a static initialization of a class. What I'm not sure is
106// whether it follows the Linden Conding Standard... 106// whether it follows the Linden Conding Standard...
107// See http://wiki.secondlife.com/wiki/Coding_standards#Static_Members 107// See http://wiki.secondlife.com/wiki/Coding_standards#Static_Members
108 108
109class LLWinImm 109class LLWinImm
@@ -113,16 +113,16 @@ public:
113 113
114public: 114public:
115 // Wrappers for IMM API. 115 // Wrappers for IMM API.
116 static BOOL isIME(HKL hkl); 116 static BOOL isIME(HKL hkl);
117 static HWND getDefaultIMEWnd(HWND hwnd); 117 static HWND getDefaultIMEWnd(HWND hwnd);
118 static HIMC getContext(HWND hwnd); 118 static HIMC getContext(HWND hwnd);
119 static BOOL releaseContext(HWND hwnd, HIMC himc); 119 static BOOL releaseContext(HWND hwnd, HIMC himc);
120 static BOOL getOpenStatus(HIMC himc); 120 static BOOL getOpenStatus(HIMC himc);
121 static BOOL setOpenStatus(HIMC himc, BOOL status); 121 static BOOL setOpenStatus(HIMC himc, BOOL status);
122 static BOOL getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence); 122 static BOOL getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence);
123 static BOOL setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence); 123 static BOOL setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence);
124 static BOOL getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form); 124 static BOOL getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form);
125 static BOOL setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form); 125 static BOOL setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form);
126 static LONG getCompositionString(HIMC himc, DWORD index, LPVOID data, DWORD length); 126 static LONG getCompositionString(HIMC himc, DWORD index, LPVOID data, DWORD length);
127 static BOOL setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength); 127 static BOOL setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength);
128 static BOOL setCompositionFont(HIMC himc, LPLOGFONTW logfont); 128 static BOOL setCompositionFont(HIMC himc, LPLOGFONTW logfont);
@@ -160,10 +160,10 @@ LLWinImm LLWinImm::sTheInstance;
160 160
161LLWinImm::LLWinImm() : mHImmDll(NULL) 161LLWinImm::LLWinImm() : mHImmDll(NULL)
162{ 162{
163 // Check system metrics 163 // Check system metrics
164 if ( !GetSystemMetrics( SM_DBCSENABLED ) ) 164 if ( !GetSystemMetrics( SM_DBCSENABLED ) )
165 return; 165 return;
166 166
167 167
168 mHImmDll = LoadLibraryA("Imm32"); 168 mHImmDll = LoadLibraryA("Imm32");
169 if (mHImmDll != NULL) 169 if (mHImmDll != NULL)
@@ -200,13 +200,13 @@ LLWinImm::LLWinImm() : mHImmDll(NULL)
200 mImmSetCandidateWindow == NULL || 200 mImmSetCandidateWindow == NULL ||
201 mImmNotifyIME == NULL) 201 mImmNotifyIME == NULL)
202 { 202 {
203 // If any of the above API entires are not found, we can't use IMM API. 203 // If any of the above API entires are not found, we can't use IMM API.
204 // So, turn off the IMM support. We should log some warning message in 204 // So, turn off the IMM support. We should log some warning message in
205 // the case, since it is very unusual; these APIs are available from 205 // the case, since it is very unusual; these APIs are available from
206 // the beginning, and all versions of IMM32.DLL should have them all. 206 // the beginning, and all versions of IMM32.DLL should have them all.
207 // Unfortunately, this code may be executed before initialization of 207 // Unfortunately, this code may be executed before initialization of
208 // the logging channel (llwarns), and we can't do it here... Yes, this 208 // the logging channel (llwarns), and we can't do it here... Yes, this
209 // is one of disadvantages to use static constraction to DLL loading. 209 // is one of disadvantages to use static constraction to DLL loading.
210 FreeLibrary(mHImmDll); 210 FreeLibrary(mHImmDll);
211 mHImmDll = NULL; 211 mHImmDll = NULL;
212 212
@@ -231,117 +231,117 @@ LLWinImm::LLWinImm() : mHImmDll(NULL)
231} 231}
232 232
233 233
234// static 234// static
235BOOL LLWinImm::isIME(HKL hkl) 235BOOL LLWinImm::isIME(HKL hkl)
236{ 236{
237 if ( sTheInstance.mImmIsIME ) 237 if ( sTheInstance.mImmIsIME )
238 return sTheInstance.mImmIsIME(hkl); 238 return sTheInstance.mImmIsIME(hkl);
239 return FALSE; 239 return FALSE;
240} 240}
241 241
242// static 242// static
243HIMC LLWinImm::getContext(HWND hwnd) 243HIMC LLWinImm::getContext(HWND hwnd)
244{ 244{
245 if ( sTheInstance.mImmGetContext ) 245 if ( sTheInstance.mImmGetContext )
246 return sTheInstance.mImmGetContext(hwnd); 246 return sTheInstance.mImmGetContext(hwnd);
247 return 0; 247 return 0;
248} 248}
249 249
250//static 250//static
251BOOL LLWinImm::releaseContext(HWND hwnd, HIMC himc) 251BOOL LLWinImm::releaseContext(HWND hwnd, HIMC himc)
252{ 252{
253 if ( sTheInstance.mImmIsIME ) 253 if ( sTheInstance.mImmIsIME )
254 return sTheInstance.mImmReleaseContext(hwnd, himc); 254 return sTheInstance.mImmReleaseContext(hwnd, himc);
255 return FALSE; 255 return FALSE;
256} 256}
257 257
258// static 258// static
259BOOL LLWinImm::getOpenStatus(HIMC himc) 259BOOL LLWinImm::getOpenStatus(HIMC himc)
260{ 260{
261 if ( sTheInstance.mImmGetOpenStatus ) 261 if ( sTheInstance.mImmGetOpenStatus )
262 return sTheInstance.mImmGetOpenStatus(himc); 262 return sTheInstance.mImmGetOpenStatus(himc);
263 return FALSE; 263 return FALSE;
264} 264}
265 265
266// static 266// static
267BOOL LLWinImm::setOpenStatus(HIMC himc, BOOL status) 267BOOL LLWinImm::setOpenStatus(HIMC himc, BOOL status)
268{ 268{
269 if ( sTheInstance.mImmSetOpenStatus ) 269 if ( sTheInstance.mImmSetOpenStatus )
270 return sTheInstance.mImmSetOpenStatus(himc, status); 270 return sTheInstance.mImmSetOpenStatus(himc, status);
271 return FALSE; 271 return FALSE;
272} 272}
273 273
274// static 274// static
275BOOL LLWinImm::getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence) 275BOOL LLWinImm::getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence)
276{ 276{
277 if ( sTheInstance.mImmGetConversionStatus ) 277 if ( sTheInstance.mImmGetConversionStatus )
278 return sTheInstance.mImmGetConversionStatus(himc, conversion, sentence); 278 return sTheInstance.mImmGetConversionStatus(himc, conversion, sentence);
279 return FALSE; 279 return FALSE;
280} 280}
281 281
282// static 282// static
283BOOL LLWinImm::setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence) 283BOOL LLWinImm::setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence)
284{ 284{
285 if ( sTheInstance.mImmSetConversionStatus ) 285 if ( sTheInstance.mImmSetConversionStatus )
286 return sTheInstance.mImmSetConversionStatus(himc, conversion, sentence); 286 return sTheInstance.mImmSetConversionStatus(himc, conversion, sentence);
287 return FALSE; 287 return FALSE;
288} 288}
289 289
290// static 290// static
291BOOL LLWinImm::getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form) 291BOOL LLWinImm::getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form)
292{ 292{
293 if ( sTheInstance.mImmGetCompostitionWindow ) 293 if ( sTheInstance.mImmGetCompostitionWindow )
294 return sTheInstance.mImmGetCompostitionWindow(himc, form); 294 return sTheInstance.mImmGetCompostitionWindow(himc, form);
295 return FALSE; 295 return FALSE;
296} 296}
297 297
298// static 298// static
299BOOL LLWinImm::setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form) 299BOOL LLWinImm::setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form)
300{ 300{
301 if ( sTheInstance.mImmSetCompostitionWindow ) 301 if ( sTheInstance.mImmSetCompostitionWindow )
302 return sTheInstance.mImmSetCompostitionWindow(himc, form); 302 return sTheInstance.mImmSetCompostitionWindow(himc, form);
303 return FALSE; 303 return FALSE;
304} 304}
305 305
306 306
307// static 307// static
308LONG LLWinImm::getCompositionString(HIMC himc, DWORD index, LPVOID data, DWORD length) 308LONG LLWinImm::getCompositionString(HIMC himc, DWORD index, LPVOID data, DWORD length)
309{ 309{
310 if ( sTheInstance.mImmGetCompositionString ) 310 if ( sTheInstance.mImmGetCompositionString )
311 return sTheInstance.mImmGetCompositionString(himc, index, data, length); 311 return sTheInstance.mImmGetCompositionString(himc, index, data, length);
312 return FALSE; 312 return FALSE;
313} 313}
314 314
315 315
316// static 316// static
317BOOL LLWinImm::setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength) 317BOOL LLWinImm::setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength)
318{ 318{
319 if ( sTheInstance.mImmSetCompositionString ) 319 if ( sTheInstance.mImmSetCompositionString )
320 return sTheInstance.mImmSetCompositionString(himc, index, pComp, compLength, pRead, readLength); 320 return sTheInstance.mImmSetCompositionString(himc, index, pComp, compLength, pRead, readLength);
321 return FALSE; 321 return FALSE;
322} 322}
323 323
324// static 324// static
325BOOL LLWinImm::setCompositionFont(HIMC himc, LPLOGFONTW pFont) 325BOOL LLWinImm::setCompositionFont(HIMC himc, LPLOGFONTW pFont)
326{ 326{
327 if ( sTheInstance.mImmSetCompositionFont ) 327 if ( sTheInstance.mImmSetCompositionFont )
328 return sTheInstance.mImmSetCompositionFont(himc, pFont); 328 return sTheInstance.mImmSetCompositionFont(himc, pFont);
329 return FALSE; 329 return FALSE;
330} 330}
331 331
332// static 332// static
333BOOL LLWinImm::setCandidateWindow(HIMC himc, LPCANDIDATEFORM form) 333BOOL LLWinImm::setCandidateWindow(HIMC himc, LPCANDIDATEFORM form)
334{ 334{
335 if ( sTheInstance.mImmSetCandidateWindow ) 335 if ( sTheInstance.mImmSetCandidateWindow )
336 return sTheInstance.mImmSetCandidateWindow(himc, form); 336 return sTheInstance.mImmSetCandidateWindow(himc, form);
337 return FALSE; 337 return FALSE;
338} 338}
339 339
340// static 340// static
341BOOL LLWinImm::notifyIME(HIMC himc, DWORD action, DWORD index, DWORD value) 341BOOL LLWinImm::notifyIME(HIMC himc, DWORD action, DWORD index, DWORD value)
342{ 342{
343 if ( sTheInstance.mImmNotifyIME ) 343 if ( sTheInstance.mImmNotifyIME )
344 return sTheInstance.mImmNotifyIME(himc, action, index, value); 344 return sTheInstance.mImmNotifyIME(himc, action, index, value);
345 return FALSE; 345 return FALSE;
346} 346}
347 347
@@ -359,22 +359,15 @@ LLWinImm::~LLWinImm()
359} 359}
360 360
361 361
362LPDIRECTINPUT8 g_pDI = NULL;
363LPDIRECTINPUTDEVICE8 g_pJoystick = NULL;
364BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance,
365 VOID* pContext );
366BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi,
367 VOID* pContext );
368
369
370LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width, 362LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
371 S32 height, U32 flags, 363 S32 height, U32 flags,
372 BOOL fullscreen, BOOL clearBg, 364 BOOL fullscreen, BOOL clearBg,
373 BOOL disable_vsync, BOOL use_gl, 365 BOOL disable_vsync, BOOL use_gl,
374 BOOL ignore_pixel_depth) 366 BOOL ignore_pixel_depth,
367 U32 fsaa_samples)
375 : LLWindow(fullscreen, flags) 368 : LLWindow(fullscreen, flags)
376{ 369{
377 S32 i = 0; 370 mFSAASamples = fsaa_samples;
378 mIconResource = gIconResource; 371 mIconResource = gIconResource;
379 mOverrideAspectRatio = 0.f; 372 mOverrideAspectRatio = 0.f;
380 mNativeAspectRatio = 0.f; 373 mNativeAspectRatio = 0.f;
@@ -389,10 +382,7 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
389 // based on the system's (user's) default settings. 382 // based on the system's (user's) default settings.
390 allowLanguageTextInput(mPreeditor, FALSE); 383 allowLanguageTextInput(mPreeditor, FALSE);
391 384
392 GLuint pixel_format;
393 WNDCLASS wc; 385 WNDCLASS wc;
394 DWORD dw_ex_style;
395 DWORD dw_style;
396 RECT window_rect; 386 RECT window_rect;
397 387
398 // Set the window title 388 // Set the window title
@@ -442,8 +432,8 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
442 432
443 // Grab screen size to sanitize the window 433 // Grab screen size to sanitize the window
444 S32 window_border_y = GetSystemMetrics(SM_CYBORDER); 434 S32 window_border_y = GetSystemMetrics(SM_CYBORDER);
445 S32 virtual_screen_x = GetSystemMetrics(SM_XVIRTUALSCREEN); 435 S32 virtual_screen_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
446 S32 virtual_screen_y = GetSystemMetrics(SM_YVIRTUALSCREEN); 436 S32 virtual_screen_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
447 S32 virtual_screen_width = GetSystemMetrics(SM_CXVIRTUALSCREEN); 437 S32 virtual_screen_width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
448 S32 virtual_screen_height = GetSystemMetrics(SM_CYVIRTUALSCREEN); 438 S32 virtual_screen_height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
449 439
@@ -554,7 +544,7 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
554 success = setDisplayResolution(width, height, BITS_PER_PIXEL, closest_refresh); 544 success = setDisplayResolution(width, height, BITS_PER_PIXEL, closest_refresh);
555 } 545 }
556 546
557 // Keep a copy of the actual current device mode in case we minimize 547 // Keep a copy of the actual current device mode in case we minimize
558 // and change the screen resolution. JC 548 // and change the screen resolution. JC
559 EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode); 549 EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode);
560 550
@@ -586,49 +576,7 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
586 OSMessageBox(error, "Error", OSMB_OK); 576 OSMessageBox(error, "Error", OSMB_OK);
587 } 577 }
588 } 578 }
589 579
590 //-----------------------------------------------------------------------
591 // Resize window to account for borders
592 //-----------------------------------------------------------------------
593 if (mFullscreen)
594 {
595 dw_ex_style = WS_EX_APPWINDOW;
596 dw_style = WS_POPUP;
597
598 // Move window borders out not to cover window contents
599 AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
600 }
601 else
602 {
603 // Window with an edge
604 dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
605 dw_style = WS_OVERLAPPEDWINDOW;
606 }
607
608 //-----------------------------------------------------------------------
609 // Create the window
610 // Microsoft help indicates that GL windows must be created with
611 // WS_CLIPSIBLINGS and WS_CLIPCHILDREN, but not CS_PARENTDC
612 //-----------------------------------------------------------------------
613 mWindowHandle = CreateWindowEx(dw_ex_style,
614 mWindowClassName,
615 mWindowTitle,
616 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | dw_style,
617 x, // x pos
618 y, // y pos
619 window_rect.right - window_rect.left, // width
620 window_rect.bottom - window_rect.top, // height
621 NULL,
622 NULL,
623 mhInstance,
624 NULL);
625
626 if (!mWindowHandle)
627 {
628 OSMessageBox("Window creation error", "Error", OSMB_OK);
629 return;
630 }
631
632 // TODO: add this after resolving _WIN32_WINNT issue 580 // TODO: add this after resolving _WIN32_WINNT issue
633 // if (!fullscreen) 581 // if (!fullscreen)
634 // { 582 // {
@@ -637,380 +585,21 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
637 // track_mouse_event.dwFlags = TME_LEAVE; 585 // track_mouse_event.dwFlags = TME_LEAVE;
638 // track_mouse_event.hwndTrack = mWindowHandle; 586 // track_mouse_event.hwndTrack = mWindowHandle;
639 // track_mouse_event.dwHoverTime = HOVER_DEFAULT; 587 // track_mouse_event.dwHoverTime = HOVER_DEFAULT;
640 // TrackMouseEvent( &track_mouse_event ); 588 // TrackMouseEvent( &track_mouse_event );
641 // } 589 // }
642 590
643 591
644
645 S32 pfdflags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER;
646 if (use_gl)
647 {
648 pfdflags |= PFD_SUPPORT_OPENGL;
649 }
650
651 //----------------------------------------------------------------------- 592 //-----------------------------------------------------------------------
652 // Create GL drawing context 593 // Create GL drawing context
653 //----------------------------------------------------------------------- 594 //-----------------------------------------------------------------------
654 PIXELFORMATDESCRIPTOR pfd = 595 LLCoordScreen windowPos(x,y);
596 LLCoordScreen windowSize(window_rect.right - window_rect.left,
597 window_rect.bottom - window_rect.top);
598 if (!switchContext(mFullscreen, windowSize, TRUE, &windowPos))
655 { 599 {
656 sizeof(PIXELFORMATDESCRIPTOR),
657 1,
658 pfdflags,
659 PFD_TYPE_RGBA,
660 BITS_PER_PIXEL,
661 0, 0, 0, 0, 0, 0, // RGB bits and shift, unused
662 8, // alpha bits
663 0, // alpha shift
664 0, // accum bits
665 0, 0, 0, 0, // accum RGBA
666 24, // depth bits
667 8, // stencil bits, avi added for stencil test
668 0,
669 PFD_MAIN_PLANE,
670 0,
671 0, 0, 0
672 };
673
674 if (!(mhDC = GetDC(mWindowHandle)))
675 {
676 close();
677 OSMessageBox("Can't make GL device context", "Error", OSMB_OK);
678 return; 600 return;
679 } 601 }
680 602
681 if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd)))
682 {
683 close();
684 OSMessageBox("Can't find suitable pixel format", "Error", OSMB_OK);
685 return;
686 }
687
688 // Verify what pixel format we actually received.
689 if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),
690 &pfd))
691 {
692 close();
693 OSMessageBox("Can't get pixel format description", "Error", OSMB_OK);
694 return;
695 }
696
697 // sanity check pfd returned by Windows
698 if (!ignore_pixel_depth && (pfd.cColorBits < 32))
699 {
700 close();
701 OSMessageBox(
702 "Second Life requires True Color (32-bit) to run in a window.\n"
703 "Please go to Control Panels -> Display -> Settings and\n"
704 "set the screen to 32-bit color.\n"
705 "Alternately, if you choose to run fullscreen, Second Life\n"
706 "will automatically adjust the screen each time it runs.",
707 "Error",
708 OSMB_OK);
709 return;
710 }
711
712 if (!ignore_pixel_depth && (pfd.cAlphaBits < 8))
713 {
714 close();
715 OSMessageBox(
716 "Second Life is unable to run because it can't get an 8 bit alpha\n"
717 "channel. Usually this is due to video card driver issues.\n"
718 "Please make sure you have the latest video card drivers installed.\n"
719 "Also be sure your monitor is set to True Color (32-bit) in\n"
720 "Control Panels -> Display -> Settings.\n"
721 "If you continue to receive this message, contact customer service.",
722 "Error",
723 OSMB_OK);
724 return;
725 }
726
727 if (!SetPixelFormat(mhDC, pixel_format, &pfd))
728 {
729 close();
730 OSMessageBox("Can't set pixel format", "Error", OSMB_OK);
731 return;
732 }
733
734 if (use_gl)
735 {
736 if (!(mhRC = wglCreateContext(mhDC)))
737 {
738 close();
739 OSMessageBox("Can't create GL rendering context", "Error", OSMB_OK);
740 return;
741 }
742
743 if (!wglMakeCurrent(mhDC, mhRC))
744 {
745 close();
746 OSMessageBox("Can't activate GL rendering context", "Error", OSMB_OK);
747 return;
748 }
749
750 gGLManager.initWGL();
751
752 if (gGLManager.mHasWGLARBPixelFormat && (wglChoosePixelFormatARB != NULL))
753 {
754 // OK, at this point, use the ARB wglChoosePixelFormatsARB function to see if we
755 // can get exactly what we want.
756 GLint attrib_list[256];
757 S32 cur_attrib = 0;
758
759 attrib_list[cur_attrib++] = WGL_DEPTH_BITS_ARB;
760 attrib_list[cur_attrib++] = 24;
761
762 attrib_list[cur_attrib++] = WGL_STENCIL_BITS_ARB;
763 attrib_list[cur_attrib++] = 8;
764
765 attrib_list[cur_attrib++] = WGL_DRAW_TO_WINDOW_ARB;
766 attrib_list[cur_attrib++] = GL_TRUE;
767
768 attrib_list[cur_attrib++] = WGL_ACCELERATION_ARB;
769 attrib_list[cur_attrib++] = WGL_FULL_ACCELERATION_ARB;
770
771 attrib_list[cur_attrib++] = WGL_SUPPORT_OPENGL_ARB;
772 attrib_list[cur_attrib++] = GL_TRUE;
773
774 attrib_list[cur_attrib++] = WGL_DOUBLE_BUFFER_ARB;
775 attrib_list[cur_attrib++] = GL_TRUE;
776
777 attrib_list[cur_attrib++] = WGL_COLOR_BITS_ARB;
778 attrib_list[cur_attrib++] = 32;
779
780 attrib_list[cur_attrib++] = WGL_RED_BITS_ARB;
781 attrib_list[cur_attrib++] = 8;
782
783 attrib_list[cur_attrib++] = WGL_GREEN_BITS_ARB;
784 attrib_list[cur_attrib++] = 8;
785
786 attrib_list[cur_attrib++] = WGL_BLUE_BITS_ARB;
787 attrib_list[cur_attrib++] = 8;
788
789 attrib_list[cur_attrib++] = WGL_ALPHA_BITS_ARB;
790 attrib_list[cur_attrib++] = 8;
791
792 // End the list
793 attrib_list[cur_attrib++] = 0;
794
795 GLint pixel_formats[256];
796 U32 num_formats = 0;
797
798 // First we try and get a 32 bit depth pixel format
799 BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
800 if (!result)
801 {
802 close();
803 show_window_creation_error("Error after wglChoosePixelFormatARB 32-bit");
804 return;
805 }
806
807 if (!num_formats)
808 {
809 llinfos << "No 32 bit z-buffer, trying 24 bits instead" << llendl;
810 // Try 24-bit format
811 attrib_list[1] = 24;
812 BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
813 if (!result)
814 {
815 close();
816 show_window_creation_error("Error after wglChoosePixelFormatARB 24-bit");
817 return;
818 }
819
820 if (!num_formats)
821 {
822 llwarns << "Couldn't get 24 bit z-buffer,trying 16 bits instead!" << llendl;
823 attrib_list[1] = 16;
824 BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
825 if (!result || !num_formats)
826 {
827 close();
828 show_window_creation_error("Error after wglChoosePixelFormatARB 16-bit");
829 return;
830 }
831 }
832
833 llinfos << "Choosing pixel formats: " << num_formats << " pixel formats returned" << llendl;
834
835 pixel_format = pixel_formats[0];
836 }
837
838 DestroyWindow(mWindowHandle);
839
840 mWindowHandle = CreateWindowEx(dw_ex_style,
841 mWindowClassName,
842 mWindowTitle,
843 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | dw_style,
844 x, // x pos
845 y, // y pos
846 window_rect.right - window_rect.left, // width
847 window_rect.bottom - window_rect.top, // height
848 NULL,
849 NULL,
850 mhInstance,
851 NULL);
852
853 if (!(mhDC = GetDC(mWindowHandle)))
854 {
855 close();
856 OSMessageBox("Can't make GL device context", "Error", OSMB_OK);
857 return;
858 }
859
860 if (!SetPixelFormat(mhDC, pixel_format, &pfd))
861 {
862 close();
863 OSMessageBox("Can't set pixel format", "Error", OSMB_OK);
864 return;
865 }
866
867 int swap_method = 0;
868 GLint swap_query = WGL_SWAP_METHOD_ARB;
869
870 if (wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method))
871 {
872 switch (swap_method)
873 {
874 case WGL_SWAP_EXCHANGE_ARB:
875 mSwapMethod = SWAP_METHOD_EXCHANGE;
876 llinfos << "Swap Method: Exchange" << llendl;
877 break;
878 case WGL_SWAP_COPY_ARB:
879 mSwapMethod = SWAP_METHOD_COPY;
880 llinfos << "Swap Method: Copy" << llendl;
881 break;
882 case WGL_SWAP_UNDEFINED_ARB:
883 mSwapMethod = SWAP_METHOD_UNDEFINED;
884 llinfos << "Swap Method: Undefined" << llendl;
885 break;
886 default:
887 mSwapMethod = SWAP_METHOD_UNDEFINED;
888 llinfos << "Swap Method: Unknown" << llendl;
889 break;
890 }
891 }
892 }
893 else
894 {
895 llwarns << "No wgl_ARB_pixel_format extension, using default ChoosePixelFormat!" << llendl;
896 }
897
898 // Verify what pixel format we actually received.
899 if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),
900 &pfd))
901 {
902 close();
903 OSMessageBox("Can't get pixel format description", "Error", OSMB_OK);
904 return;
905 }
906 llinfos << "GL buffer: Color Bits " << S32(pfd.cColorBits)
907 << " Alpha Bits " << S32(pfd.cAlphaBits)
908 << " Depth Bits " << S32(pfd.cDepthBits)
909 << llendl;
910
911 if (pfd.cColorBits < 32)
912 {
913 close();
914 OSMessageBox(
915 "Second Life requires True Color (32-bit) to run in a window.\n"
916 "Please go to Control Panels -> Display -> Settings and\n"
917 "set the screen to 32-bit color.\n"
918 "Alternately, if you choose to run fullscreen, Second Life\n"
919 "will automatically adjust the screen each time it runs.",
920 "Error",
921 OSMB_OK);
922 return;
923 }
924
925 if (pfd.cAlphaBits < 8)
926 {
927 close();
928 OSMessageBox(
929 "Second Life is unable to run because it can't get an 8 bit alpha\n"
930 "channel. Usually this is due to video card driver issues.\n"
931 "Please make sure you have the latest video card drivers installed.\n"
932 "Also be sure your monitor is set to True Color (32-bit) in\n"
933 "Control Panels -> Display -> Settings.\n"
934 "If you continue to receive this message, contact customer service.",
935 "Error",
936 OSMB_OK);
937 return;
938 }
939
940 if (!(mhRC = wglCreateContext(mhDC)))
941 {
942 close();
943 OSMessageBox("Can't create GL rendering context", "Error", OSMB_OK);
944 return;
945 }
946
947 if (!wglMakeCurrent(mhDC, mhRC))
948 {
949 close();
950 OSMessageBox("Can't activate GL rendering context", "Error", OSMB_OK);
951 return;
952 }
953
954 if (!gGLManager.initGL())
955 {
956 close();
957 OSMessageBox(
958 "Second Life is unable to run because your video card drivers\n"
959 "are out of date or unsupported. Please make sure you have\n"
960 "the latest video card drivers installed.\n\n"
961 "If you continue to receive this message, contact customer service.",
962 "Error",
963 OSMB_OK);
964 return;
965 }
966
967 // Disable vertical sync for swap
968 if (disable_vsync && wglSwapIntervalEXT)
969 {
970 llinfos << "Disabling vertical sync" << llendl;
971 wglSwapIntervalEXT(0);
972 }
973 else
974 {
975 llinfos << "Keeping vertical sync" << llendl;
976 }
977
978
979 // OK, let's get the current gamma information and store it off.
980 mCurrentGamma = 0.f; // Not set, default;
981 if (!GetDeviceGammaRamp(mhDC, mPrevGammaRamp))
982 {
983 llwarns << "Unable to get device gamma ramp" << llendl;
984 }
985
986 // Calculate what the current gamma is. From a posting by Garrett T. Bass, Get/SetDeviceGammaRamp Demystified
987 // http://apollo.iwt.uni-bielefeld.de/~ml_robot/OpenGL-04-2000/0058.html
988
989 // We're going to assume that gamma's the same for all 3 channels, because I don't feel like doing it otherwise.
990 // Using the red channel.
991
992 F32 Csum = 0.0;
993 S32 Ccount = 0;
994 for (i = 0; i < 256; i++)
995 {
996 if (i != 0 && mPrevGammaRamp[i] != 0 && mPrevGammaRamp[i] != 65536)
997 {
998 F64 B = (i % 256) / 256.0;
999 F64 A = mPrevGammaRamp[i] / 65536.0;
1000 F32 C = (F32) ( log(A) / log(B) );
1001 Csum += C;
1002 Ccount++;
1003 }
1004 }
1005 mCurrentGamma = Csum / Ccount;
1006
1007 llinfos << "Previous gamma: " << mCurrentGamma << llendl;
1008 }
1009
1010
1011 //store this pointer for wndProc callback
1012 SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this);
1013
1014 //start with arrow cursor 603 //start with arrow cursor
1015 initCursors(); 604 initCursors();
1016 setCursor( UI_CURSOR_ARROW ); 605 setCursor( UI_CURSOR_ARROW );
@@ -1019,40 +608,6 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
1019 // based on the system's (or user's) default settings. 608 // based on the system's (or user's) default settings.
1020 allowLanguageTextInput(NULL, FALSE); 609 allowLanguageTextInput(NULL, FALSE);
1021 610
1022 initInputDevices();
1023}
1024
1025void LLWindowWin32::initInputDevices()
1026{
1027 // Direct Input
1028 HRESULT hr;
1029
1030 if( FAILED( hr = DirectInput8Create( GetModuleHandle(NULL), DIRECTINPUT_VERSION,
1031 IID_IDirectInput8, (VOID**)&g_pDI, NULL ) ) )
1032 {
1033 llwarns << "Direct8InputCreate failed!" << llendl;
1034 }
1035 else
1036 {
1037 while(1)
1038 {
1039 // Look for a simple joystick we can use for this sample program.
1040 if (FAILED( hr = g_pDI->EnumDevices( DI8DEVCLASS_GAMECTRL,
1041 EnumJoysticksCallback,
1042 NULL, DIEDFL_ATTACHEDONLY ) ) )
1043 break;
1044 if (!g_pJoystick)
1045 break;
1046 if( FAILED( hr = g_pJoystick->SetDataFormat( &c_dfDIJoystick ) ) )
1047 break;
1048 if( FAILED( hr = g_pJoystick->EnumObjects( EnumObjectsCallback,
1049 (VOID*)mWindowHandle, DIDFT_ALL ) ) )
1050 break;
1051 g_pJoystick->Acquire();
1052 break;
1053 }
1054 }
1055
1056 SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer 611 SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer
1057} 612}
1058 613
@@ -1149,7 +704,7 @@ void LLWindowWin32::close()
1149 } 704 }
1150 705
1151 llinfos << "Destroying Window" << llendl; 706 llinfos << "Destroying Window" << llendl;
1152 707
1153 // Don't process events in our mainWindowProc any longer. 708 // Don't process events in our mainWindowProc any longer.
1154 SetWindowLong(mWindowHandle, GWL_USERDATA, NULL); 709 SetWindowLong(mWindowHandle, GWL_USERDATA, NULL);
1155 710
@@ -1283,7 +838,7 @@ BOOL LLWindowWin32::setSize(const LLCoordScreen size)
1283} 838}
1284 839
1285// changing fullscreen resolution 840// changing fullscreen resolution
1286BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) 841BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
1287{ 842{
1288 GLuint pixel_format; 843 GLuint pixel_format;
1289 DEVMODE dev_mode; 844 DEVMODE dev_mode;
@@ -1360,7 +915,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
1360 success = setDisplayResolution(width, height, BITS_PER_PIXEL, closest_refresh); 915 success = setDisplayResolution(width, height, BITS_PER_PIXEL, closest_refresh);
1361 } 916 }
1362 917
1363 // Keep a copy of the actual current device mode in case we minimize 918 // Keep a copy of the actual current device mode in case we minimize
1364 // and change the screen resolution. JC 919 // and change the screen resolution. JC
1365 EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode); 920 EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode);
1366 921
@@ -1405,10 +960,10 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
1405 else 960 else
1406 { 961 {
1407 mFullscreen = FALSE; 962 mFullscreen = FALSE;
1408 window_rect.left = (long) 0; 963 window_rect.left = (long) (posp ? posp->mX : 0);
1409 window_rect.right = (long) width; // Windows GDI rects don't include rightmost pixel 964 window_rect.right = (long) width + window_rect.left; // Windows GDI rects don't include rightmost pixel
1410 window_rect.top = (long) 0; 965 window_rect.top = (long) (posp ? posp->mY : 0);
1411 window_rect.bottom = (long) height; 966 window_rect.bottom = (long) height + window_rect.top;
1412 // Window with an edge 967 // Window with an edge
1413 dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; 968 dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
1414 dw_style = WS_OVERLAPPEDWINDOW; 969 dw_style = WS_OVERLAPPEDWINDOW;
@@ -1437,9 +992,9 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
1437 //----------------------------------------------------------------------- 992 //-----------------------------------------------------------------------
1438 static PIXELFORMATDESCRIPTOR pfd = 993 static PIXELFORMATDESCRIPTOR pfd =
1439 { 994 {
1440 sizeof(PIXELFORMATDESCRIPTOR), 995 sizeof(PIXELFORMATDESCRIPTOR),
1441 1, 996 1,
1442 PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, 997 PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
1443 PFD_TYPE_RGBA, 998 PFD_TYPE_RGBA,
1444 BITS_PER_PIXEL, 999 BITS_PER_PIXEL,
1445 0, 0, 0, 0, 0, 0, // RGB bits and shift, unused 1000 0, 0, 0, 0, 0, 0, // RGB bits and shift, unused
@@ -1558,17 +1113,19 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
1558 attrib_list[cur_attrib++] = WGL_COLOR_BITS_ARB; 1113 attrib_list[cur_attrib++] = WGL_COLOR_BITS_ARB;
1559 attrib_list[cur_attrib++] = 24; 1114 attrib_list[cur_attrib++] = 24;
1560 1115
1561 attrib_list[cur_attrib++] = WGL_RED_BITS_ARB; 1116 attrib_list[cur_attrib++] = WGL_ALPHA_BITS_ARB;
1562 attrib_list[cur_attrib++] = 8;
1563
1564 attrib_list[cur_attrib++] = WGL_GREEN_BITS_ARB;
1565 attrib_list[cur_attrib++] = 8; 1117 attrib_list[cur_attrib++] = 8;
1566 1118
1567 attrib_list[cur_attrib++] = WGL_BLUE_BITS_ARB; 1119 U32 end_attrib = 0;
1568 attrib_list[cur_attrib++] = 8; 1120 if (mFSAASamples > 0)
1121 {
1122 end_attrib = cur_attrib;
1123 attrib_list[cur_attrib++] = WGL_SAMPLE_BUFFERS_ARB;
1124 attrib_list[cur_attrib++] = GL_TRUE;
1569 1125
1570 attrib_list[cur_attrib++] = WGL_ALPHA_BITS_ARB; 1126 attrib_list[cur_attrib++] = WGL_SAMPLES_ARB;
1571 attrib_list[cur_attrib++] = 8; 1127 attrib_list[cur_attrib++] = mFSAASamples;
1128 }
1572 1129
1573 // End the list 1130 // End the list
1574 attrib_list[cur_attrib++] = 0; 1131 attrib_list[cur_attrib++] = 0;
@@ -1587,36 +1144,67 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
1587 1144
1588 if (!num_formats) 1145 if (!num_formats)
1589 { 1146 {
1590 llinfos << "No 32 bit z-buffer, trying 24 bits instead" << llendl; 1147 if (end_attrib > 0)
1591 // Try 24-bit format
1592 attrib_list[1] = 24;
1593 BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
1594 if (!result)
1595 { 1148 {
1596 close(); 1149 llinfos << "No valid pixel format for " << mFSAASamples << "x anti-aliasing." << llendl;
1597 show_window_creation_error("Error after wglChoosePixelFormatARB 24-bit"); 1150 attrib_list[end_attrib] = 0;
1598 return FALSE; 1151
1152 BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
1153 if (!result)
1154 {
1155 close();
1156 show_window_creation_error("Error after wglChoosePixelFormatARB 32-bit no AA");
1157 return FALSE;
1158 }
1599 } 1159 }
1600 1160
1601 if (!num_formats) 1161 if (!num_formats)
1602 { 1162 {
1603 llwarns << "Couldn't get 24 bit z-buffer,trying 16 bits instead!" << llendl; 1163 llinfos << "No 32 bit z-buffer, trying 24 bits instead" << llendl;
1604 attrib_list[1] = 16; 1164 // Try 24-bit format
1165 attrib_list[1] = 24;
1605 BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats); 1166 BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
1606 if (!result || !num_formats) 1167 if (!result)
1607 { 1168 {
1608 close(); 1169 close();
1609 show_window_creation_error("Error after wglChoosePixelFormatARB 16-bit"); 1170 show_window_creation_error("Error after wglChoosePixelFormatARB 24-bit");
1610 return FALSE; 1171 return FALSE;
1611 } 1172 }
1173
1174 if (!num_formats)
1175 {
1176 llwarns << "Couldn't get 24 bit z-buffer,trying 16 bits instead!" << llendl;
1177 attrib_list[1] = 16;
1178 BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
1179 if (!result || !num_formats)
1180 {
1181 close();
1182 show_window_creation_error("Error after wglChoosePixelFormatARB 16-bit");
1183 return FALSE;
1184 }
1185 }
1612 } 1186 }
1613 1187
1614 llinfos << "Choosing pixel formats: " << num_formats << " pixel formats returned" << llendl; 1188 llinfos << "Choosing pixel formats: " << num_formats << " pixel formats returned" << llendl;
1189 }
1190
1191 pixel_format = pixel_formats[0];
1615 1192
1616 pixel_format = pixel_formats[0]; 1193 if (mhDC != 0) // Does The Window Have A Device Context?
1194 {
1195 wglMakeCurrent(mhDC, 0); // Set The Current Active Rendering Context To Zero
1196 if (mhRC != 0) // Does The Window Have A Rendering Context?
1197 {
1198 wglDeleteContext (mhRC); // Release The Rendering Context
1199 mhRC = 0; // Zero The Rendering Context
1200
1201 }
1202 ReleaseDC (mWindowHandle, mhDC); // Release The Device Context
1203 mhDC = 0; // Zero The Device Context
1617 } 1204 }
1205 DestroyWindow (mWindowHandle); // Destroy The Window
1206
1618 1207
1619 DestroyWindow(mWindowHandle);
1620 mWindowHandle = CreateWindowEx(dw_ex_style, 1208 mWindowHandle = CreateWindowEx(dw_ex_style,
1621 mWindowClassName, 1209 mWindowClassName,
1622 mWindowTitle, 1210 mWindowTitle,
@@ -1668,7 +1256,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
1668 llinfos << "Swap Method: Unknown" << llendl; 1256 llinfos << "Swap Method: Unknown" << llendl;
1669 break; 1257 break;
1670 } 1258 }
1671 } 1259 }
1672 } 1260 }
1673 else 1261 else
1674 { 1262 {
@@ -1684,12 +1272,13 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
1684 return FALSE; 1272 return FALSE;
1685 } 1273 }
1686 1274
1687 llinfos << "GL buffer: Color Bits " << S32(pfd.cColorBits) 1275 llinfos << "GL buffer: Color Bits " << S32(pfd.cColorBits)
1688 << " Alpha Bits " << S32(pfd.cAlphaBits) 1276 << " Alpha Bits " << S32(pfd.cAlphaBits)
1689 << " Depth Bits " << S32(pfd.cDepthBits) 1277 << " Depth Bits " << S32(pfd.cDepthBits)
1690 << llendl; 1278 << llendl;
1691 1279
1692 if (pfd.cColorBits < 32) 1280 // make sure we have 32 bits per pixel
1281 if (pfd.cColorBits < 32 || GetDeviceCaps(mhDC, BITSPIXEL) < 32)
1693 { 1282 {
1694 close(); 1283 close();
1695 OSMessageBox( 1284 OSMessageBox(
@@ -1759,7 +1348,9 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
1759 SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this); 1348 SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this);
1760 show(); 1349 show();
1761 1350
1762 initInputDevices(); 1351 //make sure multi sampling is disabled by default
1352 glDisable(GL_MULTISAMPLE_ARB);
1353
1763 1354
1764 // ok to post quit messages now 1355 // ok to post quit messages now
1765 mPostQuit = TRUE; 1356 mPostQuit = TRUE;
@@ -1884,10 +1475,10 @@ void LLWindowWin32::initCursors()
1884 mCursor[ UI_CURSOR_CROSS ] = LoadCursor(NULL, IDC_CROSS); 1475 mCursor[ UI_CURSOR_CROSS ] = LoadCursor(NULL, IDC_CROSS);
1885 mCursor[ UI_CURSOR_SIZENWSE ] = LoadCursor(NULL, IDC_SIZENWSE); 1476 mCursor[ UI_CURSOR_SIZENWSE ] = LoadCursor(NULL, IDC_SIZENWSE);
1886 mCursor[ UI_CURSOR_SIZENESW ] = LoadCursor(NULL, IDC_SIZENESW); 1477 mCursor[ UI_CURSOR_SIZENESW ] = LoadCursor(NULL, IDC_SIZENESW);
1887 mCursor[ UI_CURSOR_SIZEWE ] = LoadCursor(NULL, IDC_SIZEWE); 1478 mCursor[ UI_CURSOR_SIZEWE ] = LoadCursor(NULL, IDC_SIZEWE);
1888 mCursor[ UI_CURSOR_SIZENS ] = LoadCursor(NULL, IDC_SIZENS); 1479 mCursor[ UI_CURSOR_SIZENS ] = LoadCursor(NULL, IDC_SIZENS);
1889 mCursor[ UI_CURSOR_NO ] = LoadCursor(NULL, IDC_NO); 1480 mCursor[ UI_CURSOR_NO ] = LoadCursor(NULL, IDC_NO);
1890 mCursor[ UI_CURSOR_WORKING ] = LoadCursor(NULL, IDC_APPSTARTING); 1481 mCursor[ UI_CURSOR_WORKING ] = LoadCursor(NULL, IDC_APPSTARTING);
1891 1482
1892 HMODULE module = GetModuleHandle(NULL); 1483 HMODULE module = GetModuleHandle(NULL);
1893 mCursor[ UI_CURSOR_TOOLGRAB ] = LoadCursor(module, TEXT("TOOLGRAB")); 1484 mCursor[ UI_CURSOR_TOOLGRAB ] = LoadCursor(module, TEXT("TOOLGRAB"));
@@ -1902,7 +1493,7 @@ void LLWindowWin32::initCursors()
1902 mCursor[ UI_CURSOR_ARROWLOCKED ]= LoadCursor(module, TEXT("ARROWLOCKED")); 1493 mCursor[ UI_CURSOR_ARROWLOCKED ]= LoadCursor(module, TEXT("ARROWLOCKED"));
1903 mCursor[ UI_CURSOR_GRABLOCKED ] = LoadCursor(module, TEXT("GRABLOCKED")); 1494 mCursor[ UI_CURSOR_GRABLOCKED ] = LoadCursor(module, TEXT("GRABLOCKED"));
1904 mCursor[ UI_CURSOR_TOOLTRANSLATE ] = LoadCursor(module, TEXT("TOOLTRANSLATE")); 1495 mCursor[ UI_CURSOR_TOOLTRANSLATE ] = LoadCursor(module, TEXT("TOOLTRANSLATE"));
1905 mCursor[ UI_CURSOR_TOOLROTATE ] = LoadCursor(module, TEXT("TOOLROTATE")); 1496 mCursor[ UI_CURSOR_TOOLROTATE ] = LoadCursor(module, TEXT("TOOLROTATE"));
1906 mCursor[ UI_CURSOR_TOOLSCALE ] = LoadCursor(module, TEXT("TOOLSCALE")); 1497 mCursor[ UI_CURSOR_TOOLSCALE ] = LoadCursor(module, TEXT("TOOLSCALE"));
1907 mCursor[ UI_CURSOR_TOOLCAMERA ] = LoadCursor(module, TEXT("TOOLCAMERA")); 1498 mCursor[ UI_CURSOR_TOOLCAMERA ] = LoadCursor(module, TEXT("TOOLCAMERA"));
1908 mCursor[ UI_CURSOR_TOOLPAN ] = LoadCursor(module, TEXT("TOOLPAN")); 1499 mCursor[ UI_CURSOR_TOOLPAN ] = LoadCursor(module, TEXT("TOOLPAN"));
@@ -2051,7 +1642,22 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2051 S32 update_height; 1642 S32 update_height;
2052 1643
2053 case WM_TIMER: 1644 case WM_TIMER:
2054 window_imp->updateJoystick( ); 1645 window_imp->mCallbacks->handleTimerEvent(window_imp);
1646 break;
1647
1648 case WM_DEVICECHANGE:
1649 if (gDebugWindowProc)
1650 {
1651 llinfos << " WM_DEVICECHANGE: wParam=" << w_param
1652 << "; lParam=" << l_param << llendl;
1653 }
1654 if (w_param == DBT_DEVNODES_CHANGED || w_param == DBT_DEVICEARRIVAL)
1655 {
1656 if (window_imp->mCallbacks->handleDeviceChange(window_imp))
1657 {
1658 return 0;
1659 }
1660 }
2055 break; 1661 break;
2056 1662
2057 case WM_PAINT: 1663 case WM_PAINT:
@@ -2103,7 +1709,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2103 1709
2104 if (window_imp->mFullscreen) 1710 if (window_imp->mFullscreen)
2105 { 1711 {
2106 // When we run fullscreen, restoring or minimizing the app needs 1712 // When we run fullscreen, restoring or minimizing the app needs
2107 // to switch the screen resolution 1713 // to switch the screen resolution
2108 if (activating) 1714 if (activating)
2109 { 1715 {
@@ -2116,6 +1722,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2116 window_imp->resetDisplayResolution(); 1722 window_imp->resetDisplayResolution();
2117 } 1723 }
2118 } 1724 }
1725
1726 window_imp->mCallbacks->handleActivateApp(window_imp, activating);
1727
2119 break; 1728 break;
2120 } 1729 }
2121 1730
@@ -2131,13 +1740,13 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2131 window_imp->interruptLanguageTextInput(); 1740 window_imp->interruptLanguageTextInput();
2132 } 1741 }
2133 1742
2134 // JC - I'm not sure why, but if we don't report that we handled the 1743 // JC - I'm not sure why, but if we don't report that we handled the
2135 // WM_ACTIVATE message, the WM_ACTIVATEAPP messages don't work 1744 // WM_ACTIVATE message, the WM_ACTIVATEAPP messages don't work
2136 // properly when we run fullscreen. 1745 // properly when we run fullscreen.
2137 if (gDebugWindowProc) 1746 if (gDebugWindowProc)
2138 { 1747 {
2139 llinfos << "WINDOWPROC Activate " 1748 llinfos << "WINDOWPROC Activate "
2140 << " activating " << S32(activating) 1749 << " activating " << S32(activating)
2141 << " minimized " << S32(minimized) 1750 << " minimized " << S32(minimized)
2142 << llendl; 1751 << llendl;
2143 } 1752 }
@@ -2153,9 +1762,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2153 case WM_SYSCOMMAND: 1762 case WM_SYSCOMMAND:
2154 switch(w_param) 1763 switch(w_param)
2155 { 1764 {
2156 case SC_KEYMENU: 1765 case SC_KEYMENU:
2157 // Disallow the ALT key from triggering the default system menu. 1766 // Disallow the ALT key from triggering the default system menu.
2158 return 0; 1767 return 0;
2159 1768
2160 case SC_SCREENSAVE: 1769 case SC_SCREENSAVE:
2161 case SC_MONITORPOWER: 1770 case SC_MONITORPOWER:
@@ -2196,7 +1805,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2196 if (gDebugWindowProc) 1805 if (gDebugWindowProc)
2197 { 1806 {
2198 llinfos << "Debug WindowProc WM_KEYDOWN " 1807 llinfos << "Debug WindowProc WM_KEYDOWN "
2199 << " key " << S32(w_param) 1808 << " key " << S32(w_param)
2200 << llendl; 1809 << llendl;
2201 } 1810 }
2202 if(gKeyboard->handleKeyDown(w_param, mask) && eat_keystroke) 1811 if(gKeyboard->handleKeyDown(w_param, mask) && eat_keystroke)
@@ -2215,7 +1824,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2215 if (gDebugWindowProc) 1824 if (gDebugWindowProc)
2216 { 1825 {
2217 llinfos << "Debug WindowProc WM_KEYUP " 1826 llinfos << "Debug WindowProc WM_KEYUP "
2218 << " key " << S32(w_param) 1827 << " key " << S32(w_param)
2219 << llendl; 1828 << llendl;
2220 } 1829 }
2221 if (gKeyboard->handleKeyUp(w_param, mask) && eat_keystroke) 1830 if (gKeyboard->handleKeyUp(w_param, mask) && eat_keystroke)
@@ -2284,7 +1893,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2284 if (gDebugWindowProc) 1893 if (gDebugWindowProc)
2285 { 1894 {
2286 llinfos << "Debug WindowProc WM_CHAR " 1895 llinfos << "Debug WindowProc WM_CHAR "
2287 << " key " << S32(w_param) 1896 << " key " << S32(w_param)
2288 << llendl; 1897 << llendl;
2289 } 1898 }
2290 // Even if LLWindowCallbacks::handleUnicodeChar(llwchar, BOOL) returned FALSE, 1899 // Even if LLWindowCallbacks::handleUnicodeChar(llwchar, BOOL) returned FALSE,
@@ -2527,7 +2136,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2527 // track_mouse_event.dwFlags = TME_LEAVE; 2136 // track_mouse_event.dwFlags = TME_LEAVE;
2528 // track_mouse_event.hwndTrack = h_wnd; 2137 // track_mouse_event.hwndTrack = h_wnd;
2529 // track_mouse_event.dwHoverTime = HOVER_DEFAULT; 2138 // track_mouse_event.dwHoverTime = HOVER_DEFAULT;
2530 // TrackMouseEvent( &track_mouse_event ); 2139 // TrackMouseEvent( &track_mouse_event );
2531 return 0; 2140 return 0;
2532 } 2141 }
2533 */ 2142 */
@@ -2559,12 +2168,12 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2559 << llendl; 2168 << llendl;
2560 } 2169 }
2561 2170
2562 // There's an odd behavior with WM_SIZE that I would call a bug. If 2171 // There's an odd behavior with WM_SIZE that I would call a bug. If
2563 // the window is maximized, and you call MoveWindow() with a size smaller 2172 // the window is maximized, and you call MoveWindow() with a size smaller
2564 // than a maximized window, it ends up sending WM_SIZE with w_param set 2173 // than a maximized window, it ends up sending WM_SIZE with w_param set
2565 // to SIZE_MAXIMIZED -- which isn't true. So the logic below doesn't work. 2174 // to SIZE_MAXIMIZED -- which isn't true. So the logic below doesn't work.
2566 // (SL-44655). Fixed it by calling ShowWindow(SW_RESTORE) first (see 2175 // (SL-44655). Fixed it by calling ShowWindow(SW_RESTORE) first (see
2567 // LLWindowWin32::moveWindow in this file). 2176 // LLWindowWin32::moveWindow in this file).
2568 2177
2569 // If we are now restored, but we weren't before, this 2178 // If we are now restored, but we weren't before, this
2570 // means that the window was un-minimized. 2179 // means that the window was un-minimized.
@@ -2589,8 +2198,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2589 if (w_param != SIZE_MINIMIZED) 2198 if (w_param != SIZE_MINIMIZED)
2590 { 2199 {
2591 // Ignore updates for minimizing and minimized "windows" 2200 // Ignore updates for minimizing and minimized "windows"
2592 window_imp->mCallbacks->handleResize( window_imp, 2201 window_imp->mCallbacks->handleResize( window_imp,
2593 LOWORD(l_param), 2202 LOWORD(l_param),
2594 HIWORD(l_param) ); 2203 HIWORD(l_param) );
2595 } 2204 }
2596 2205
@@ -2619,7 +2228,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2619 // received a URL 2228 // received a URL
2620 PCOPYDATASTRUCT myCDS = (PCOPYDATASTRUCT) l_param; 2229 PCOPYDATASTRUCT myCDS = (PCOPYDATASTRUCT) l_param;
2621 window_imp->mCallbacks->handleDataCopy(window_imp, myCDS->dwData, myCDS->lpData); 2230 window_imp->mCallbacks->handleDataCopy(window_imp, myCDS->dwData, myCDS->lpData);
2622 return 0; 2231 return 0;
2623 } 2232 }
2624 } 2233 }
2625 2234
@@ -2667,7 +2276,7 @@ BOOL LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordGL* to)
2667} 2276}
2668 2277
2669BOOL LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordWindow* to) 2278BOOL LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordWindow* to)
2670{ 2279{
2671 POINT mouse_point; 2280 POINT mouse_point;
2672 2281
2673 mouse_point.x = from.mX; 2282 mouse_point.x = from.mX;
@@ -2778,7 +2387,7 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr)
2778 const size_t size_utf16 = (out_utf16.length() + 1) * sizeof(WCHAR); 2387 const size_t size_utf16 = (out_utf16.length() + 1) * sizeof(WCHAR);
2779 2388
2780 // Memory is allocated and then ownership of it is transfered to the system. 2389 // Memory is allocated and then ownership of it is transfered to the system.
2781 HGLOBAL hglobal_copy_utf16 = GlobalAlloc(GMEM_MOVEABLE, size_utf16); 2390 HGLOBAL hglobal_copy_utf16 = GlobalAlloc(GMEM_MOVEABLE, size_utf16);
2782 if (hglobal_copy_utf16) 2391 if (hglobal_copy_utf16)
2783 { 2392 {
2784 WCHAR* copy_utf16 = (WCHAR*) GlobalLock(hglobal_copy_utf16); 2393 WCHAR* copy_utf16 = (WCHAR*) GlobalLock(hglobal_copy_utf16);
@@ -2841,12 +2450,12 @@ BOOL LLWindowWin32::getClientRectInScreenSpace( RECT* rectp )
2841 POINT top_left; 2450 POINT top_left;
2842 top_left.x = client_rect.left; 2451 top_left.x = client_rect.left;
2843 top_left.y = client_rect.top; 2452 top_left.y = client_rect.top;
2844 ClientToScreen(mWindowHandle, &top_left); 2453 ClientToScreen(mWindowHandle, &top_left);
2845 2454
2846 POINT bottom_right; 2455 POINT bottom_right;
2847 bottom_right.x = client_rect.right; 2456 bottom_right.x = client_rect.right;
2848 bottom_right.y = client_rect.bottom; 2457 bottom_right.y = client_rect.bottom;
2849 ClientToScreen(mWindowHandle, &bottom_right); 2458 ClientToScreen(mWindowHandle, &bottom_right);
2850 2459
2851 SetRect( rectp, 2460 SetRect( rectp,
2852 top_left.x, 2461 top_left.x,
@@ -2977,14 +2586,24 @@ BOOL LLWindowWin32::setGamma(const F32 gamma)
2977 if ( value > 0xffff ) 2586 if ( value > 0xffff )
2978 value = 0xffff; 2587 value = 0xffff;
2979 2588
2980 mCurrentGammaRamp [ 0 * 256 + i ] = 2589 mCurrentGammaRamp [ 0 * 256 + i ] =
2981 mCurrentGammaRamp [ 1 * 256 + i ] = 2590 mCurrentGammaRamp [ 1 * 256 + i ] =
2982 mCurrentGammaRamp [ 2 * 256 + i ] = ( WORD )value; 2591 mCurrentGammaRamp [ 2 * 256 + i ] = ( WORD )value;
2983 }; 2592 };
2984 2593
2985 return SetDeviceGammaRamp ( mhDC, mCurrentGammaRamp ); 2594 return SetDeviceGammaRamp ( mhDC, mCurrentGammaRamp );
2986} 2595}
2987 2596
2597void LLWindowWin32::setFSAASamples(const U32 fsaa_samples)
2598{
2599 mFSAASamples = fsaa_samples;
2600}
2601
2602U32 LLWindowWin32::getFSAASamples()
2603{
2604 return mFSAASamples;
2605}
2606
2988LLWindow::LLWindowResolution* LLWindowWin32::getSupportedResolutions(S32 &num_resolutions) 2607LLWindow::LLWindowResolution* LLWindowWin32::getSupportedResolutions(S32 &num_resolutions)
2989{ 2608{
2990 if (!mSupportedResolutions) 2609 if (!mSupportedResolutions)
@@ -3142,81 +2761,6 @@ void LLWindowWin32::swapBuffers()
3142} 2761}
3143 2762
3144 2763
3145BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance,
3146 VOID* pContext )
3147{
3148 HRESULT hr;
3149
3150 // Obtain an interface to the enumerated joystick.
3151 hr = g_pDI->CreateDevice( pdidInstance->guidInstance, &g_pJoystick, NULL );
3152
3153 // If it failed, then we can't use this joystick. (Maybe the user unplugged
3154 // it while we were in the middle of enumerating it.)
3155 if( FAILED(hr) )
3156 return DIENUM_CONTINUE;
3157
3158 // Stop enumeration. Note: we're just taking the first joystick we get. You
3159 // could store all the enumerated joysticks and let the user pick.
3160 return DIENUM_STOP;
3161}
3162
3163BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi,
3164 VOID* pContext )
3165{
3166 if( pdidoi->dwType & DIDFT_AXIS )
3167 {
3168 DIPROPRANGE diprg;
3169 diprg.diph.dwSize = sizeof(DIPROPRANGE);
3170 diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER);
3171 diprg.diph.dwHow = DIPH_BYID;
3172 diprg.diph.dwObj = pdidoi->dwType; // Specify the enumerated axis
3173 diprg.lMin = -1000;
3174 diprg.lMax = +1000;
3175
3176 // Set the range for the axis
3177 if( FAILED( g_pJoystick->SetProperty( DIPROP_RANGE, &diprg.diph ) ) )
3178 return DIENUM_STOP;
3179
3180 }
3181 return DIENUM_CONTINUE;
3182}
3183
3184void LLWindowWin32::updateJoystick( )
3185{
3186 HRESULT hr;
3187 DIJOYSTATE js; // DInput joystick state
3188
3189 if (!g_pJoystick)
3190 return;
3191 hr = g_pJoystick->Poll();
3192 if ( hr == DIERR_INPUTLOST )
3193 {
3194 hr = g_pJoystick->Acquire();
3195 return;
3196 }
3197 else if ( FAILED(hr) )
3198 return;
3199
3200 // Get the input's device state
3201 if( FAILED( hr = g_pJoystick->GetDeviceState( sizeof(DIJOYSTATE), &js ) ) )
3202 return; // The device should have been acquired during the Poll()
3203
3204 mJoyAxis[0] = js.lX/1000.f;
3205 mJoyAxis[1] = js.lY/1000.f;
3206 mJoyAxis[2] = js.lZ/1000.f;
3207 mJoyAxis[3] = js.lRx/1000.f;
3208 mJoyAxis[4] = js.lRy/1000.f;
3209 mJoyAxis[5] = js.lRz/1000.f;
3210 mJoyAxis[6] = js.rglSlider[0]/1000.f;
3211 mJoyAxis[7] = js.rglSlider[1]/1000.f;
3212
3213 for (U32 i = 0; i < 16; i++)
3214 {
3215 mJoyButtonState[i] = js.rgbButtons[i];
3216 }
3217}
3218
3219
3220// 2764//
3221// LLSplashScreenImp 2765// LLSplashScreenImp
3222// 2766//
@@ -3234,10 +2778,10 @@ void LLSplashScreenWin32::showImpl()
3234 // This appears to work. ??? 2778 // This appears to work. ???
3235 HINSTANCE hinst = GetModuleHandle(NULL); 2779 HINSTANCE hinst = GetModuleHandle(NULL);
3236 2780
3237 mWindow = CreateDialog(hinst, 2781 mWindow = CreateDialog(hinst,
3238 TEXT("SPLASHSCREEN"), 2782 TEXT("SPLASHSCREEN"),
3239 NULL, // no parent 2783 NULL, // no parent
3240 (DLGPROC) LLSplashScreenWin32::windowProc); 2784 (DLGPROC) LLSplashScreenWin32::windowProc);
3241 ShowWindow(mWindow, SW_SHOW); 2785 ShowWindow(mWindow, SW_SHOW);
3242} 2786}
3243 2787
@@ -3262,7 +2806,7 @@ void LLSplashScreenWin32::hideImpl()
3262 if (mWindow) 2806 if (mWindow)
3263 { 2807 {
3264 DestroyWindow(mWindow); 2808 DestroyWindow(mWindow);
3265 mWindow = NULL; 2809 mWindow = NULL;
3266 } 2810 }
3267} 2811}
3268 2812
@@ -3364,77 +2908,79 @@ void spawn_web_browser(const char* escaped_url )
3364 sei.lpFile = url_utf16.c_str(); 2908 sei.lpFile = url_utf16.c_str();
3365 ShellExecuteEx( &sei ); 2909 ShellExecuteEx( &sei );
3366 2910
3367 ////// TODO: LEAVING OLD CODE HERE SO I DON'T BONE OTHER MERGES 2911 //// TODO: LEAVING OLD CODE HERE SO I DON'T BONE OTHER MERGES
3368 ////// DELETE THIS ONCE THE MERGES ARE DONE 2912 //// DELETE THIS ONCE THE MERGES ARE DONE
3369 2913
3370 //// Figure out the user's default web browser 2914 // Figure out the user's default web browser
3371 //// HKEY_CLASSES_ROOT\http\shell\open\command 2915 // HKEY_CLASSES_ROOT\http\shell\open\command
3372 //char reg_path_str[256]; /* Flawfinder: ignore */ 2916 /*
3373 //snprintf(reg_path_str, sizeof(reg_path_str), "%s\\shell\\open\\command", gURLProtocolWhitelistHandler[i]); /* Flawfinder: ignore */ 2917 char reg_path_str[256]; // Flawfinder: ignore
3374 //WCHAR reg_path_wstr[256]; 2918 snprintf(reg_path_str, sizeof(reg_path_str), "%s\\shell\\open\\command", gURLProtocolWhitelistHandler[i]); // Flawfinder: ignore
3375 //mbstowcs(reg_path_wstr, reg_path_str, sizeof(reg_path_wstr)/sizeof(reg_path_wstr[0])); 2919 WCHAR reg_path_wstr[256];
3376 2920 mbstowcs(reg_path_wstr, reg_path_str, sizeof(reg_path_wstr)/sizeof(reg_path_wstr[0]));
3377 //HKEY key; 2921
3378 //WCHAR browser_open_wstr[1024]; 2922 HKEY key;
3379 //DWORD buffer_length = 1024; 2923 WCHAR browser_open_wstr[1024];
3380 //RegOpenKeyEx(HKEY_CLASSES_ROOT, reg_path_wstr, 0, KEY_QUERY_VALUE, &key); 2924 DWORD buffer_length = 1024;
3381 //RegQueryValueEx(key, NULL, NULL, NULL, (LPBYTE)browser_open_wstr, &buffer_length); 2925 RegOpenKeyEx(HKEY_CLASSES_ROOT, reg_path_wstr, 0, KEY_QUERY_VALUE, &key);
3382 //RegCloseKey(key); 2926 RegQueryValueEx(key, NULL, NULL, NULL, (LPBYTE)browser_open_wstr, &buffer_length);
3383 2927 RegCloseKey(key);
3384 //// Convert to STL string 2928
3385 //LLWString browser_open_wstring = utf16str_to_wstring(browser_open_wstr); 2929 // Convert to STL string
3386 2930 LLWString browser_open_wstring = utf16str_to_wstring(browser_open_wstr);
3387 //if (browser_open_wstring.length() < 2) 2931
3388 //{ 2932 if (browser_open_wstring.length() < 2)
3389 // llwarns << "Invalid browser executable in registry " << browser_open_wstring << llendl; 2933 {
3390 // return; 2934 llwarns << "Invalid browser executable in registry " << browser_open_wstring << llendl;
3391 //} 2935 return;
3392 2936 }
3393 //// Extract the process that's supposed to be launched 2937
3394 //LLWString browser_executable; 2938 // Extract the process that's supposed to be launched
3395 //if (browser_open_wstring[0] == '"') 2939 LLWString browser_executable;
3396 //{ 2940 if (browser_open_wstring[0] == '"')
3397 // // executable is quoted, find the matching quote 2941 {
3398 // size_t quote_pos = browser_open_wstring.find('"', 1); 2942 // executable is quoted, find the matching quote
3399 // // copy out the string including both quotes 2943 size_t quote_pos = browser_open_wstring.find('"', 1);
3400 // browser_executable = browser_open_wstring.substr(0, quote_pos+1); 2944 // copy out the string including both quotes
3401 //} 2945 browser_executable = browser_open_wstring.substr(0, quote_pos+1);
3402 //else 2946 }
3403 //{ 2947 else
3404 // // executable not quoted, find a space 2948 {
3405 // size_t space_pos = browser_open_wstring.find(' ', 1); 2949 // executable not quoted, find a space
3406 // browser_executable = browser_open_wstring.substr(0, space_pos); 2950 size_t space_pos = browser_open_wstring.find(' ', 1);
3407 //} 2951 browser_executable = browser_open_wstring.substr(0, space_pos);
3408 2952 }
3409 //llinfos << "Browser reg key: " << wstring_to_utf8str(browser_open_wstring) << llendl; 2953
3410 //llinfos << "Browser executable: " << wstring_to_utf8str(browser_executable) << llendl; 2954 llinfos << "Browser reg key: " << wstring_to_utf8str(browser_open_wstring) << llendl;
3411 2955 llinfos << "Browser executable: " << wstring_to_utf8str(browser_executable) << llendl;
3412 //// Convert URL to wide string for Windows API 2956
3413 //// Assume URL is UTF8, as can come from scripts 2957 // Convert URL to wide string for Windows API
3414 //LLWString url_wstring = utf8str_to_wstring(escaped_url); 2958 // Assume URL is UTF8, as can come from scripts
3415 //llutf16string url_utf16 = wstring_to_utf16str(url_wstring); 2959 LLWString url_wstring = utf8str_to_wstring(escaped_url);
3416 2960 llutf16string url_utf16 = wstring_to_utf16str(url_wstring);
3417 //// Convert executable and path to wide string for Windows API 2961
3418 //llutf16string browser_exec_utf16 = wstring_to_utf16str(browser_executable); 2962 // Convert executable and path to wide string for Windows API
3419 2963 llutf16string browser_exec_utf16 = wstring_to_utf16str(browser_executable);
3420 //// ShellExecute returns HINSTANCE for backwards compatiblity. 2964
3421 //// MS docs say to cast to int and compare to 32. 2965 // ShellExecute returns HINSTANCE for backwards compatiblity.
3422 //HWND our_window = NULL; 2966 // MS docs say to cast to int and compare to 32.
3423 //LPCWSTR directory_wstr = NULL; 2967 HWND our_window = NULL;
3424 //int retval = (int) ShellExecute(our_window, /* Flawfinder: ignore */ 2968 LPCWSTR directory_wstr = NULL;
3425 // L"open", 2969 int retval = (int) ShellExecute(our_window, // Flawfinder: ignore
3426 // browser_exec_utf16.c_str(), 2970 L"open",
3427 // url_utf16.c_str(), 2971 browser_exec_utf16.c_str(),
3428 // directory_wstr, 2972 url_utf16.c_str(),
3429 // SW_SHOWNORMAL); 2973 directory_wstr,
3430 //if (retval > 32) 2974 SW_SHOWNORMAL);
3431 //{ 2975 if (retval > 32)
3432 // llinfos << "load_url success with " << retval << llendl; 2976 {
3433 //} 2977 llinfos << "load_url success with " << retval << llendl;
3434 //else 2978 }
3435 //{ 2979 else
3436 // llinfos << "load_url failure with " << retval << llendl; 2980 {
3437 //} 2981 llinfos << "load_url failure with " << retval << llendl;
2982 }
2983 */
3438} 2984}
3439 2985
3440 2986
@@ -3448,13 +2994,13 @@ BOOL LLWindowWin32::dialog_color_picker ( F32 *r, F32 *g, F32 *b )
3448 cc.hwndOwner = mWindowHandle; 2994 cc.hwndOwner = mWindowHandle;
3449 cc.hInstance = NULL; 2995 cc.hInstance = NULL;
3450 cc.rgbResult = RGB ((*r * 255.f),(*g *255.f),(*b * 255.f)); 2996 cc.rgbResult = RGB ((*r * 255.f),(*g *255.f),(*b * 255.f));
3451 //cc.rgbResult = RGB (0x80,0x80,0x80); 2997 //cc.rgbResult = RGB (0x80,0x80,0x80);
3452 cc.lpCustColors = crCustColors; 2998 cc.lpCustColors = crCustColors;
3453 cc.Flags = CC_RGBINIT | CC_FULLOPEN; 2999 cc.Flags = CC_RGBINIT | CC_FULLOPEN;
3454 cc.lCustData = 0; 3000 cc.lCustData = 0;
3455 cc.lpfnHook = NULL; 3001 cc.lpfnHook = NULL;
3456 cc.lpTemplateName = NULL; 3002 cc.lpTemplateName = NULL;
3457 3003
3458 // This call is modal, so pause agent 3004 // This call is modal, so pause agent
3459 //send_agent_pause(); // this is in newview and we don't want to set up a dependency 3005 //send_agent_pause(); // this is in newview and we don't want to set up a dependency
3460 { 3006 {
@@ -3465,7 +3011,7 @@ BOOL LLWindowWin32::dialog_color_picker ( F32 *r, F32 *g, F32 *b )
3465 *b = ((F32)((cc.rgbResult >> 16) & 0xff)) / 255.f; 3011 *b = ((F32)((cc.rgbResult >> 16) & 0xff)) / 255.f;
3466 3012
3467 *g = ((F32)((cc.rgbResult >> 8) & 0xff)) / 255.f; 3013 *g = ((F32)((cc.rgbResult >> 8) & 0xff)) / 255.f;
3468 3014
3469 *r = ((F32)(cc.rgbResult & 0xff)) / 255.f; 3015 *r = ((F32)(cc.rgbResult & 0xff)) / 255.f;
3470 3016
3471 return (retval); 3017 return (retval);
@@ -3519,8 +3065,8 @@ void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
3519 3065
3520 if ( sLanguageTextInputAllowed ) 3066 if ( sLanguageTextInputAllowed )
3521 { 3067 {
3522 // Allowing: Restore the previous IME status, so that the user has a feeling that the previous 3068 // Allowing: Restore the previous IME status, so that the user has a feeling that the previous
3523 // text input continues naturally. Be careful, however, the IME status is meaningful only during the user keeps 3069 // text input continues naturally. Be careful, however, the IME status is meaningful only during the user keeps
3524 // using same Input Locale (aka Keyboard Layout). 3070 // using same Input Locale (aka Keyboard Layout).
3525 if (sWinIMEOpened && GetKeyboardLayout(0) == sWinInputLocale) 3071 if (sWinIMEOpened && GetKeyboardLayout(0) == sWinInputLocale)
3526 { 3072 {
@@ -3545,7 +3091,7 @@ void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
3545 { 3091 {
3546 LLWinImm::getConversionStatus(himc, &sWinIMEConversionMode, &sWinIMESentenceMode); 3092 LLWinImm::getConversionStatus(himc, &sWinIMEConversionMode, &sWinIMESentenceMode);
3547 3093
3548 // We need both ImmSetConversionStatus and ImmSetOpenStatus here to surely disable IME's 3094 // We need both ImmSetConversionStatus and ImmSetOpenStatus here to surely disable IME's
3549 // keyboard hooking, because Some IME reacts only on the former and some other on the latter... 3095 // keyboard hooking, because Some IME reacts only on the former and some other on the latter...
3550 LLWinImm::setConversionStatus(himc, IME_CMODE_NOCONVERSION, sWinIMESentenceMode); 3096 LLWinImm::setConversionStatus(himc, IME_CMODE_NOCONVERSION, sWinIMESentenceMode);
3551 LLWinImm::setOpenStatus(himc, FALSE); 3097 LLWinImm::setOpenStatus(himc, FALSE);
@@ -3555,7 +3101,7 @@ void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
3555 } 3101 }
3556} 3102}
3557 3103
3558void LLWindowWin32::fillCandidateForm(const LLCoordGL& caret, const LLRect& bounds, 3104void LLWindowWin32::fillCandidateForm(const LLCoordGL& caret, const LLRect& bounds,
3559 CANDIDATEFORM *form) 3105 CANDIDATEFORM *form)
3560{ 3106{
3561 LLCoordWindow caret_coord, top_left, bottom_right; 3107 LLCoordWindow caret_coord, top_left, bottom_right;
@@ -3584,7 +3130,7 @@ void LLWindowWin32::setLanguageTextInput( const LLCoordGL & position )
3584 LLCoordWindow win_pos; 3130 LLCoordWindow win_pos;
3585 convertCoords( position, &win_pos ); 3131 convertCoords( position, &win_pos );
3586 3132
3587 if ( win_pos.mX >= 0 && win_pos.mY >= 0 && 3133 if ( win_pos.mX >= 0 && win_pos.mY >= 0 &&
3588 (win_pos.mX != sWinIMEWindowPosition.mX) || (win_pos.mY != sWinIMEWindowPosition.mY) ) 3134 (win_pos.mX != sWinIMEWindowPosition.mX) || (win_pos.mY != sWinIMEWindowPosition.mY) )
3589 { 3135 {
3590 COMPOSITIONFORM ime_form; 3136 COMPOSITIONFORM ime_form;
@@ -3649,13 +3195,13 @@ void LLWindowWin32::fillCompositionLogfont(LOGFONT *logfont)
3649 default: 3195 default:
3650 logfont->lfCharSet = CHINESEBIG5_CHARSET; 3196 logfont->lfCharSet = CHINESEBIG5_CHARSET;
3651 lstrcpy(logfont->lfFaceName, TEXT("MingLiU")); 3197 lstrcpy(logfont->lfFaceName, TEXT("MingLiU"));
3652 break; 3198 break;
3653 } 3199 }
3654 break; 3200 break;
3655 case LANG_JAPANESE: 3201 case LANG_JAPANESE:
3656 logfont->lfCharSet = SHIFTJIS_CHARSET; 3202 logfont->lfCharSet = SHIFTJIS_CHARSET;
3657 lstrcpy(logfont->lfFaceName, TEXT("MS Gothic")); 3203 lstrcpy(logfont->lfFaceName, TEXT("MS Gothic"));
3658 break; 3204 break;
3659 case LANG_KOREAN: 3205 case LANG_KOREAN:
3660 logfont->lfCharSet = HANGUL_CHARSET; 3206 logfont->lfCharSet = HANGUL_CHARSET;
3661 lstrcpy(logfont->lfFaceName, TEXT("Gulim")); 3207 lstrcpy(logfont->lfFaceName, TEXT("Gulim"));
@@ -3665,10 +3211,10 @@ void LLWindowWin32::fillCompositionLogfont(LOGFONT *logfont)
3665 lstrcpy(logfont->lfFaceName, TEXT("Tahoma")); 3211 lstrcpy(logfont->lfFaceName, TEXT("Tahoma"));
3666 break; 3212 break;
3667 } 3213 }
3668 3214
3669 logfont->lfHeight = mPreeditor->getPreeditFontSize(); 3215 logfont->lfHeight = mPreeditor->getPreeditFontSize();
3670 logfont->lfWeight = FW_NORMAL; 3216 logfont->lfWeight = FW_NORMAL;
3671} 3217}
3672 3218
3673U32 LLWindowWin32::fillReconvertString(const LLWString &text, 3219U32 LLWindowWin32::fillReconvertString(const LLWString &text,
3674 S32 focus, S32 focus_length, RECONVERTSTRING *reconvert_string) 3220 S32 focus, S32 focus_length, RECONVERTSTRING *reconvert_string)
@@ -3782,7 +3328,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes)
3782 needs_update = TRUE; 3328 needs_update = TRUE;
3783 } 3329 }
3784 } 3330 }
3785 3331
3786 if (indexes & GCS_COMPSTR) 3332 if (indexes & GCS_COMPSTR)
3787 { 3333 {
3788 LONG size = LLWinImm::getCompositionString(himc, GCS_COMPSTR, NULL, 0); 3334 LONG size = LLWinImm::getCompositionString(himc, GCS_COMPSTR, NULL, 0);
@@ -3877,7 +3423,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes)
3877 { 3423 {
3878 for (LLWString::const_iterator i = result_string.begin(); i != result_string.end(); i++) 3424 for (LLWString::const_iterator i = result_string.begin(); i != result_string.end(); i++)
3879 { 3425 {
3880 mPreeditor->handleUnicodeCharHere(*i, FALSE); 3426 mPreeditor->handleUnicodeCharHere(*i);
3881 } 3427 }
3882 } 3428 }
3883 3429
@@ -3948,7 +3494,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
3948 LLCoordGL caret_coord; 3494 LLCoordGL caret_coord;
3949 LLRect preedit_bounds; 3495 LLRect preedit_bounds;
3950 mPreeditor->getPreeditLocation(-1, &caret_coord, &preedit_bounds, NULL); 3496 mPreeditor->getPreeditLocation(-1, &caret_coord, &preedit_bounds, NULL);
3951 3497
3952 CANDIDATEFORM *const form = (CANDIDATEFORM *)param; 3498 CANDIDATEFORM *const form = (CANDIDATEFORM *)param;
3953 DWORD const dwIndex = form->dwIndex; 3499 DWORD const dwIndex = form->dwIndex;
3954 fillCandidateForm(caret_coord, preedit_bounds, form); 3500 fillCandidateForm(caret_coord, preedit_bounds, form);
@@ -3963,7 +3509,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
3963 3509
3964 // char_position->dwCharPos counts in number of 3510 // char_position->dwCharPos counts in number of
3965 // WCHARs, i.e., UTF-16 encoding units, so we can't simply pass the 3511 // WCHARs, i.e., UTF-16 encoding units, so we can't simply pass the
3966 // number to getPreeditLocation. 3512 // number to getPreeditLocation.
3967 3513
3968 const LLWString & wtext = mPreeditor->getWText(); 3514 const LLWString & wtext = mPreeditor->getWText();
3969 S32 preedit, preedit_length; 3515 S32 preedit, preedit_length;
@@ -4037,7 +3583,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
4037 const LLWString & wtext = mPreeditor->getWText(); 3583 const LLWString & wtext = mPreeditor->getWText();
4038 S32 preedit, preedit_length; 3584 S32 preedit, preedit_length;
4039 mPreeditor->getPreeditRange(&preedit, &preedit_length); 3585 mPreeditor->getPreeditRange(&preedit, &preedit_length);
4040 3586
4041 S32 context_offset; 3587 S32 context_offset;
4042 LLWString context = find_context(wtext, preedit, preedit_length, &context_offset); 3588 LLWString context = find_context(wtext, preedit, preedit_length, &context_offset);
4043 preedit -= context_offset; 3589 preedit -= context_offset;
@@ -4048,7 +3594,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
4048 // Otherwise, some IME are confused. 3594 // Otherwise, some IME are confused.
4049 context.erase(preedit, preedit_length); 3595 context.erase(preedit, preedit_length);
4050 } 3596 }
4051 3597
4052 RECONVERTSTRING *reconvert_string = (RECONVERTSTRING *)param; 3598 RECONVERTSTRING *reconvert_string = (RECONVERTSTRING *)param;
4053 *result = fillReconvertString(context, preedit, 0, reconvert_string); 3599 *result = fillReconvertString(context, preedit, 0, reconvert_string);
4054 return TRUE; 3600 return TRUE;
diff --git a/linden/indra/llwindow/llwindowwin32.h b/linden/indra/llwindow/llwindowwin32.h
index f159d30..5535af4 100644
--- a/linden/indra/llwindow/llwindowwin32.h
+++ b/linden/indra/llwindow/llwindowwin32.h
@@ -59,7 +59,7 @@ public:
59 /*virtual*/ BOOL getSize(LLCoordWindow *size); 59 /*virtual*/ BOOL getSize(LLCoordWindow *size);
60 /*virtual*/ BOOL setPosition(LLCoordScreen position); 60 /*virtual*/ BOOL setPosition(LLCoordScreen position);
61 /*virtual*/ BOOL setSize(LLCoordScreen size); 61 /*virtual*/ BOOL setSize(LLCoordScreen size);
62 /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync); 62 /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
63 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position); 63 /*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
64 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position); 64 /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
65 /*virtual*/ void showCursor(); 65 /*virtual*/ void showCursor();
@@ -78,6 +78,8 @@ public:
78 /*virtual*/ void flashIcon(F32 seconds); 78 /*virtual*/ void flashIcon(F32 seconds);
79 /*virtual*/ F32 getGamma(); 79 /*virtual*/ F32 getGamma();
80 /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma 80 /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
81 /*virtual*/ void setFSAASamples(const U32 fsaa_samples);
82 /*virtual*/ U32 getFSAASamples();
81 /*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma) 83 /*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
82 /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; } 84 /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
83 /*virtual*/ void gatherInput(); 85 /*virtual*/ void gatherInput();
@@ -118,7 +120,7 @@ protected:
118 LLWindowWin32( 120 LLWindowWin32(
119 char *title, char *name, int x, int y, int width, int height, U32 flags, 121 char *title, char *name, int x, int y, int width, int height, U32 flags,
120 BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, 122 BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
121 BOOL ignore_pixel_depth); 123 BOOL ignore_pixel_depth, U32 fsaa_samples);
122 ~LLWindowWin32(); 124 ~LLWindowWin32();
123 125
124 void initCursors(); 126 void initCursors();
@@ -184,6 +186,7 @@ protected:
184 static BOOL sIsClassRegistered; // has the window class been registered? 186 static BOOL sIsClassRegistered; // has the window class been registered?
185 187
186 F32 mCurrentGamma; 188 F32 mCurrentGamma;
189 U32 mFSAASamples;
187 WORD mPrevGammaRamp[256*3]; 190 WORD mPrevGammaRamp[256*3];
188 WORD mCurrentGammaRamp[256*3]; 191 WORD mCurrentGammaRamp[256*3];
189 192