summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/CMakeLists.txt168
-rw-r--r--indra/llwindow/GL/glh_extensions.h207
-rw-r--r--indra/llwindow/GL/glh_genext.h1671
-rw-r--r--indra/llwindow/lldragdropwin32.cpp365
-rw-r--r--indra/llwindow/lldragdropwin32.h74
-rw-r--r--indra/llwindow/lldxhardware.cpp128
-rw-r--r--indra/llwindow/lldxhardware.h44
-rw-r--r--indra/llwindow/llkeyboard.cpp140
-rw-r--r--indra/llwindow/llkeyboard.h56
-rw-r--r--indra/llwindow/llkeyboardmacosx.cpp37
-rw-r--r--indra/llwindow/llkeyboardmacosx.h35
-rw-r--r--indra/llwindow/llkeyboardsdl.cpp37
-rw-r--r--indra/llwindow/llkeyboardsdl.h35
-rw-r--r--indra/llwindow/llkeyboardwin32.cpp49
-rw-r--r--indra/llwindow/llkeyboardwin32.h35
-rw-r--r--indra/llwindow/llmousehandler.cpp58
-rw-r--r--indra/llwindow/llmousehandler.h72
-rw-r--r--indra/llwindow/llpreeditor.h39
-rw-r--r--indra/llwindow/llwindow.cpp318
-rw-r--r--indra/llwindow/llwindow.h207
-rw-r--r--indra/llwindow/llwindowcallbacks.cpp200
-rw-r--r--indra/llwindow/llwindowcallbacks.h94
-rw-r--r--indra/llwindow/llwindowheadless.cpp41
-rw-r--r--indra/llwindow/llwindowheadless.h58
-rw-r--r--indra/llwindow/llwindowmacosx-objc.h35
-rw-r--r--indra/llwindow/llwindowmacosx-objc.mm50
-rw-r--r--indra/llwindow/llwindowmacosx.cpp655
-rw-r--r--indra/llwindow/llwindowmacosx.h106
-rw-r--r--indra/llwindow/llwindowmesaheadless.cpp45
-rw-r--r--indra/llwindow/llwindowmesaheadless.h52
-rw-r--r--indra/llwindow/llwindowsdl.cpp1375
-rw-r--r--indra/llwindow/llwindowsdl.h127
-rw-r--r--indra/llwindow/llwindowwin32.cpp1407
-rw-r--r--indra/llwindow/llwindowwin32.h78
34 files changed, 5257 insertions, 2841 deletions
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt
new file mode 100644
index 0000000000..bf3233f386
--- /dev/null
+++ b/indra/llwindow/CMakeLists.txt
@@ -0,0 +1,168 @@
+# -*- cmake -*-
+#
+# Compared to other libraries, compiling this one is a mess. The
+# reason is that we have several source files that have two different
+# sets of behaviour, depending on whether they're intended to be part
+# of the viewer or the map server.
+#
+# Unfortunately, the affected code is a rat's nest of #ifdefs, so it's
+# easier to play compilation tricks than to actually fix the problem.
+
+project(llwindow)
+
+include(00-Common)
+include(DirectX)
+include(DragDrop)
+include(LLCommon)
+include(LLImage)
+include(LLMath)
+include(LLRender)
+include(LLVFS)
+include(LLWindow)
+include(LLXML)
+include(UI)
+
+include_directories(
+ ${LLCOMMON_INCLUDE_DIRS}
+ ${LLIMAGE_INCLUDE_DIRS}
+ ${LLMATH_INCLUDE_DIRS}
+ ${LLRENDER_INCLUDE_DIRS}
+ ${LLVFS_INCLUDE_DIRS}
+ ${LLWINDOW_INCLUDE_DIRS}
+ ${LLXML_INCLUDE_DIRS}
+ )
+
+set(llwindow_SOURCE_FILES
+ llkeyboard.cpp
+ llwindowheadless.cpp
+ llwindowcallbacks.cpp
+ )
+
+set(llwindow_HEADER_FILES
+ CMakeLists.txt
+
+ llkeyboard.h
+ llwindowheadless.h
+ llwindowcallbacks.h
+ )
+
+set(viewer_SOURCE_FILES
+ llwindow.cpp
+ llmousehandler.cpp
+ )
+
+set(viewer_HEADER_FILES
+ llwindow.h
+ llpreeditor.h
+ llmousehandler.h
+ )
+
+# Libraries on which this library depends, needed for Linux builds
+# Sort by high-level to low-level
+if (NOT LINUX OR VIEWER)
+ set(llwindow_LINK_LIBRARIES
+ ${UI_LIBRARIES} # for GTK
+ ${SDL_LIBRARY}
+ )
+endif (NOT LINUX OR VIEWER)
+
+if (DARWIN)
+ list(APPEND llwindow_SOURCE_FILES
+ llkeyboardmacosx.cpp
+ llwindowmacosx.cpp
+ llwindowmacosx-objc.mm
+ )
+ list(APPEND llwindow_HEADER_FILES
+ llkeyboardmacosx.h
+ llwindowmacosx.h
+ llwindowmacosx-objc.h
+ )
+
+ # We use a bunch of deprecated system APIs.
+ set_source_files_properties(
+ llkeyboardmacosx.cpp
+ llwindowmacosx.cpp
+ PROPERTIES
+ COMPILE_FLAGS "-Wno-deprecated-declarations -fpascal-strings"
+ )
+endif (DARWIN)
+
+if (LINUX AND VIEWER)
+ list(APPEND viewer_SOURCE_FILES
+ llkeyboardsdl.cpp
+ llwindowsdl.cpp
+ )
+ list(APPEND viewer_HEADER_FILES
+ llkeyboardsdl.h
+ llwindowsdl.h
+ )
+endif (LINUX AND VIEWER)
+
+if (WINDOWS)
+ list(APPEND llwindow_SOURCE_FILES
+ llwindowwin32.cpp
+ lldxhardware.cpp
+ llkeyboardwin32.cpp
+ lldragdropwin32.cpp
+ )
+ list(APPEND llwindow_HEADER_FILES
+ llwindowwin32.h
+ lldxhardware.h
+ llkeyboardwin32.h
+ lldragdropwin32.h
+ )
+ list(APPEND llwindow_LINK_LIBRARIES
+ comdlg32 # Common Dialogs for ChooseColor
+ ole32
+ )
+endif (WINDOWS)
+
+if (SOLARIS)
+ list(APPEND llwindow_SOURCE_FILES
+ llwindowsolaris.cpp
+ )
+ list(APPEND llwindow_HEADER_FILES
+ llwindowsolaris.h
+ )
+endif (SOLARIS)
+
+set_source_files_properties(${llwindow_HEADER_FILES}
+ PROPERTIES HEADER_FILE_ONLY TRUE)
+
+if (SERVER AND NOT WINDOWS AND NOT DARWIN)
+ set(server_SOURCE_FILES
+ llwindowmesaheadless.cpp
+ )
+ set(server_HEADER_FILES
+ llwindowmesaheadless.h
+ )
+ copy_server_sources(
+ llwindow
+ )
+
+
+ set_source_files_properties(
+ ${server_SOURCE_FILES}
+ PROPERTIES
+ COMPILE_FLAGS "-DLL_MESA=1 -DLL_MESA_HEADLESS=1"
+ )
+ add_library (llwindowheadless
+ ${llwindow_SOURCE_FILES}
+ ${server_SOURCE_FILES}
+ )
+ target_link_libraries (llwindowheadless ${llwindow_LINK_LIBRARIES})
+endif (SERVER AND NOT WINDOWS AND NOT DARWIN)
+
+if (llwindow_HEADER_FILES)
+ list(APPEND llwindow_SOURCE_FILES ${llwindow_HEADER_FILES})
+endif (llwindow_HEADER_FILES)
+ list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES})
+
+if (VIEWER)
+ add_library (llwindow
+ ${llwindow_SOURCE_FILES}
+ ${viewer_SOURCE_FILES}
+ )
+ target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES})
+endif (VIEWER)
+
diff --git a/indra/llwindow/GL/glh_extensions.h b/indra/llwindow/GL/glh_extensions.h
new file mode 100644
index 0000000000..b936b5d307
--- /dev/null
+++ b/indra/llwindow/GL/glh_extensions.h
@@ -0,0 +1,207 @@
+/*
+ * glh_extensions.h
+ * From nVidia Corporation, downloaded 2006-12-18 from:
+ * http://developer.nvidia.com/attach/8196
+ * ("NVParse Library with Source (.zip) (2390 KB)")
+ *
+ * License (quoted from license_info.txt in aforementioned file):
+ * "The files bison.exe, bison.simple, and flex.exe are covered by
+ * the GPL. All other files in this distribution can be used however
+ * you want."
+ */
+
+#ifndef GLH_EXTENSIONS
+#define GLH_EXTENSIONS
+
+#include <string.h>
+#include <stdio.h>
+
+#ifdef _WIN32
+# include <windows.h>
+#endif
+
+#ifndef __APPLE__
+#include <GL/gl.h>
+#endif
+
+#ifdef _WIN32
+# include "GL/wglext.h"
+#endif
+
+#define CHECK_MEMORY(ptr) \
+ if (NULL == ptr) { \
+ printf("Error allocating memory in file %s, line %d\n", __FILE__, __LINE__); \
+ exit(-1); \
+ }
+
+#ifdef GLH_EXT_SINGLE_FILE
+# define GLH_EXTENSIONS_SINGLE_FILE // have to do this because glh_genext.h unsets GLH_EXT_SINGLE_FILE
+#endif
+
+#include "glh_genext.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef GLH_EXTENSIONS_SINGLE_FILE
+
+class GLHExts
+{
+public:
+ GLHExts()
+ {
+ mSysExts = NULL;
+// mUnsupportedExts = NULL;
+ }
+ ~GLHExts()
+ {
+ if (mSysExts)
+ {
+ free(mSysExts);
+ }
+// if (mUnsupportedExts)
+// {
+// free(mUnsupportedExts);
+// }
+ }
+ char *mSysExts;
+// char *mUnsupportedExts;
+};
+
+GLHExts gGLHExts;
+
+static int ExtensionExists(const char* extName, const char* sysExts)
+{
+ char *padExtName = (char*)malloc(strlen(extName) + 2);
+ strcat(strcpy(padExtName, extName), " ");
+
+ if (0 == strcmp(extName, "GL_VERSION_1_2")) {
+ const char *version = (const char*)glGetString(GL_VERSION);
+ if (strstr(version, "1.0") == version || strstr(version, "1.1") == version) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+ }
+ if (strstr(sysExts, padExtName)) {
+ free(padExtName);
+ return TRUE;
+ } else {
+ free(padExtName);
+ return FALSE;
+ }
+}
+
+static const char* EatWhiteSpace(const char *str)
+{
+ for (; *str && (' ' == *str || '\t' == *str || '\n' == *str); str++);
+ return str;
+}
+
+static const char* EatNonWhiteSpace(const char *str)
+{
+ for (; *str && (' ' != *str && '\t' != *str && '\n' != *str); str++);
+ return str;
+}
+
+
+int glh_init_extensions(const char *origReqExts)
+{
+ // Length of requested extensions string
+ unsigned reqExtsLen;
+ char *reqExts;
+ // Ptr for individual extensions within reqExts
+ char *reqExt;
+ int success = TRUE;
+
+ // build space-padded extension string
+ if (NULL == gGLHExts.mSysExts) {
+ const char *extensions = (const char*)glGetString(GL_EXTENSIONS);
+ int sysExtsLen = (int)strlen(extensions);
+ const char *winsys_extensions = 0;
+ int winsysExtsLen = 0;
+#ifdef _WIN32
+ {
+ PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = 0;
+ wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
+ if(wglGetExtensionsStringARB)
+ {
+ winsys_extensions = wglGetExtensionsStringARB(wglGetCurrentDC());
+ winsysExtsLen = (S32)strlen(winsys_extensions);
+ }
+ }
+#endif
+ // Add 2 bytes, one for padding space, one for terminating NULL
+ gGLHExts.mSysExts = (char*)malloc(sysExtsLen + winsysExtsLen + 3);
+ CHECK_MEMORY(gGLHExts.mSysExts);
+ strcpy(gGLHExts.mSysExts, extensions);
+ gGLHExts.mSysExts[sysExtsLen] = ' ';
+ gGLHExts.mSysExts[sysExtsLen + 1] = 0;
+ if (winsysExtsLen)
+ {
+ strcat(gGLHExts.mSysExts, winsys_extensions);
+ }
+ gGLHExts.mSysExts[sysExtsLen + 1 + winsysExtsLen] = ' ';
+ gGLHExts.mSysExts[sysExtsLen + 1 + winsysExtsLen + 1] = 0;
+ }
+
+ if (NULL == origReqExts)
+ {
+ return TRUE;
+ }
+ reqExts = strdup(origReqExts);
+ reqExtsLen = (S32)strlen(reqExts);
+ /*
+ if (NULL == gGLHExts.mUnsupportedExts)
+ {
+ gGLHExts.mUnsupportedExts = (char*)malloc(reqExtsLen + 1);
+ }
+ else if (reqExtsLen > strlen(gGLHExts.mUnsupportedExts))
+ {
+ gGLHExts.mUnsupportedExts = (char*)realloc(gGLHExts.mUnsupportedExts, reqExtsLen + 1);
+ }
+ CHECK_MEMORY(gGLHExts.mUnsupportedExts);
+ *gGLHExts.mUnsupportedExts = 0;
+ */
+
+ // Parse requested extension list
+ for (reqExt = reqExts;
+ (reqExt = (char*)EatWhiteSpace(reqExt)) && *reqExt;
+ reqExt = (char*)EatNonWhiteSpace(reqExt))
+ {
+ char *extEnd = (char*)EatNonWhiteSpace(reqExt);
+ char saveChar = *extEnd;
+ *extEnd = (char)0;
+
+ if (!ExtensionExists(reqExt, gGLHExts.mSysExts) ||
+ !glh_init_extension(reqExt)) {
+ /*
+ // add reqExt to end of unsupportedExts
+ strcat(gGLHExts.mUnsupportedExts, reqExt);
+ strcat(gGLHExts.mUnsupportedExts, " ");
+ */
+ success = FALSE;
+ }
+ *extEnd = saveChar;
+ }
+ free(reqExts);
+ return success;
+}
+
+const char* glh_get_unsupported_extensions()
+{
+ return "";
+// return (const char*)gGLHExts.mUnsupportedExts;
+}
+
+#else
+int glh_init_extensions(const char *origReqExts);
+const char* glh_get_unsupported_extensions();
+#endif /* GLH_EXT_SINGLE_FILE */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GLH_EXTENSIONS */
diff --git a/indra/llwindow/GL/glh_genext.h b/indra/llwindow/GL/glh_genext.h
new file mode 100644
index 0000000000..8d42025198
--- /dev/null
+++ b/indra/llwindow/GL/glh_genext.h
@@ -0,0 +1,1671 @@
+/*
+ * glh_genext.h
+ * From nVidia Corporation, downloaded 2006-12-18 from:
+ * http://developer.nvidia.com/attach/8196
+ * ("NVParse Library with Source (.zip) (2390 KB)")
+ *
+ * License (quoted from license_info.txt in aforementioned file):
+ * "The files bison.exe, bison.simple, and flex.exe are covered by
+ * the GPL. All other files in this distribution can be used however
+ * you want."
+ */
+
+/* File generated by extgen.cpp -- do not modify */
+#ifndef GLH_GENEXT_H
+#define GLH_GENEXT_H
+
+// MBW -- None of this is necessary on Mac OS.
+#ifndef __APPLE__
+
+#include <GL/gl.h>
+#include <GL/glext.h>
+
+#ifdef _WIN32 /* supports windows, x -- need to generalize */
+# include <GL/wglext.h>
+# define GLH_EXT_GET_PROC_ADDRESS(p) wglGetProcAddress(p)
+#else if GLX_VERSION_1_3
+# include <GL/glxext.h>
+# define GLH_EXT_GET_PROC_ADDRESS(p) glXGetProcAddressARB(p)
+#endif
+
+#ifdef GLH_EXT_SINGLE_FILE
+ #define GLH_EXTERN
+ #define GLH_INITIALIZER = 0
+#else
+ #define GLH_EXTERN extern
+ #define GLH_INITIALIZER
+#endif
+
+#define GLH__PREPROCESSOR_GYMNASTICS2(a,b) a##b
+#define GLH__PREPROCESSOR_GYMNASTICS(a,b) GLH__PREPROCESSOR_GYMNASTICS2(a,b)
+
+#ifndef GLH_EXT_PREFIX
+# define GLH_EXT_NAME(a) a
+#else
+# define GLH_EXT_NAME(a) GLH__PREPROCESSOR_GYMNASTICS(GLH_EXT_PREFIX,a)
+#endif
+
+#ifndef _WIN32
+# ifndef GLH_CORE_1_2_PREFIX
+# define GLH_CORE_1_2_PREFIX _
+# endif
+#endif
+
+#ifndef GLH_CORE_1_2_PREFIX
+# define GLH_CORE_1_2_NAME(a) a
+#else
+# define GLH_CORE_1_2_NAME(a) GLH__PREPROCESSOR_GYMNASTICS(GLH_CORE_1_2_PREFIX,a)
+#endif
+
+#ifdef GL_ARB_multitexture
+ GLH_EXTERN PFNGLMULTITEXCOORD1DARBPROC GLH_EXT_NAME(glMultiTexCoord1dARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD1DVARBPROC GLH_EXT_NAME(glMultiTexCoord1dvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD1FARBPROC GLH_EXT_NAME(glMultiTexCoord1fARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD1FVARBPROC GLH_EXT_NAME(glMultiTexCoord1fvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD1IARBPROC GLH_EXT_NAME(glMultiTexCoord1iARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD1IVARBPROC GLH_EXT_NAME(glMultiTexCoord1ivARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD1SARBPROC GLH_EXT_NAME(glMultiTexCoord1sARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD1SVARBPROC GLH_EXT_NAME(glMultiTexCoord1svARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD2DARBPROC GLH_EXT_NAME(glMultiTexCoord2dARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD2DVARBPROC GLH_EXT_NAME(glMultiTexCoord2dvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD2FARBPROC GLH_EXT_NAME(glMultiTexCoord2fARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD2FVARBPROC GLH_EXT_NAME(glMultiTexCoord2fvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD2IARBPROC GLH_EXT_NAME(glMultiTexCoord2iARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD2IVARBPROC GLH_EXT_NAME(glMultiTexCoord2ivARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD2SARBPROC GLH_EXT_NAME(glMultiTexCoord2sARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD2SVARBPROC GLH_EXT_NAME(glMultiTexCoord2svARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD3DARBPROC GLH_EXT_NAME(glMultiTexCoord3dARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD3DVARBPROC GLH_EXT_NAME(glMultiTexCoord3dvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD3FARBPROC GLH_EXT_NAME(glMultiTexCoord3fARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD3FVARBPROC GLH_EXT_NAME(glMultiTexCoord3fvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD3IARBPROC GLH_EXT_NAME(glMultiTexCoord3iARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD3IVARBPROC GLH_EXT_NAME(glMultiTexCoord3ivARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD3SARBPROC GLH_EXT_NAME(glMultiTexCoord3sARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD3SVARBPROC GLH_EXT_NAME(glMultiTexCoord3svARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD4DARBPROC GLH_EXT_NAME(glMultiTexCoord4dARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD4DVARBPROC GLH_EXT_NAME(glMultiTexCoord4dvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD4FARBPROC GLH_EXT_NAME(glMultiTexCoord4fARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD4FVARBPROC GLH_EXT_NAME(glMultiTexCoord4fvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD4IARBPROC GLH_EXT_NAME(glMultiTexCoord4iARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD4IVARBPROC GLH_EXT_NAME(glMultiTexCoord4ivARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD4SARBPROC GLH_EXT_NAME(glMultiTexCoord4sARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTITEXCOORD4SVARBPROC GLH_EXT_NAME(glMultiTexCoord4svARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLACTIVETEXTUREARBPROC GLH_EXT_NAME(glActiveTextureARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCLIENTACTIVETEXTUREARBPROC GLH_EXT_NAME(glClientActiveTextureARB) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_ARB_texture_border_clamp
+#endif
+
+#ifdef GL_ARB_texture_compression
+ GLH_EXTERN PFNGLCOMPRESSEDTEXIMAGE3DARBPROC GLH_EXT_NAME(glCompressedTexImage3DARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOMPRESSEDTEXIMAGE2DARBPROC GLH_EXT_NAME(glCompressedTexImage2DARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOMPRESSEDTEXIMAGE1DARBPROC GLH_EXT_NAME(glCompressedTexImage1DARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC GLH_EXT_NAME(glCompressedTexSubImage3DARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC GLH_EXT_NAME(glCompressedTexSubImage2DARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC GLH_EXT_NAME(glCompressedTexSubImage1DARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETCOMPRESSEDTEXIMAGEARBPROC GLH_EXT_NAME(glGetCompressedTexImageARB) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_ARB_texture_cube_map
+#endif
+
+#ifdef GL_ARB_transpose_matrix
+ GLH_EXTERN PFNGLLOADTRANSPOSEMATRIXFARBPROC GLH_EXT_NAME(glLoadTransposeMatrixfARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLLOADTRANSPOSEMATRIXDARBPROC GLH_EXT_NAME(glLoadTransposeMatrixdARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTTRANSPOSEMATRIXFARBPROC GLH_EXT_NAME(glMultTransposeMatrixfARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMULTTRANSPOSEMATRIXDARBPROC GLH_EXT_NAME(glMultTransposeMatrixdARB) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_ARB_vertex_program
+ GLH_EXTERN PFNGLVERTEXATTRIB1SARBPROC GLH_EXT_NAME(glVertexAttrib1sARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB1FARBPROC GLH_EXT_NAME(glVertexAttrib1fARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB1DARBPROC GLH_EXT_NAME(glVertexAttrib1dARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB2SARBPROC GLH_EXT_NAME(glVertexAttrib2sARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB2FARBPROC GLH_EXT_NAME(glVertexAttrib2fARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB2DARBPROC GLH_EXT_NAME(glVertexAttrib2dARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB3SARBPROC GLH_EXT_NAME(glVertexAttrib3sARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB3FARBPROC GLH_EXT_NAME(glVertexAttrib3fARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB3DARBPROC GLH_EXT_NAME(glVertexAttrib3dARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4SARBPROC GLH_EXT_NAME(glVertexAttrib4sARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4FARBPROC GLH_EXT_NAME(glVertexAttrib4fARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4DARBPROC GLH_EXT_NAME(glVertexAttrib4dARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4NUBARBPROC GLH_EXT_NAME(glVertexAttrib4NubARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB1SVARBPROC GLH_EXT_NAME(glVertexAttrib1svARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB1FVARBPROC GLH_EXT_NAME(glVertexAttrib1fvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB1DVARBPROC GLH_EXT_NAME(glVertexAttrib1dvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB2SVARBPROC GLH_EXT_NAME(glVertexAttrib2svARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB2FVARBPROC GLH_EXT_NAME(glVertexAttrib2fvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB2DVARBPROC GLH_EXT_NAME(glVertexAttrib2dvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB3SVARBPROC GLH_EXT_NAME(glVertexAttrib3svARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB3FVARBPROC GLH_EXT_NAME(glVertexAttrib3fvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB3DVARBPROC GLH_EXT_NAME(glVertexAttrib3dvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4BVARBPROC GLH_EXT_NAME(glVertexAttrib4bvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4SVARBPROC GLH_EXT_NAME(glVertexAttrib4svARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4IVARBPROC GLH_EXT_NAME(glVertexAttrib4ivARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4UBVARBPROC GLH_EXT_NAME(glVertexAttrib4ubvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4USVARBPROC GLH_EXT_NAME(glVertexAttrib4usvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4UIVARBPROC GLH_EXT_NAME(glVertexAttrib4uivARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4FVARBPROC GLH_EXT_NAME(glVertexAttrib4fvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4DVARBPROC GLH_EXT_NAME(glVertexAttrib4dvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4NBVARBPROC GLH_EXT_NAME(glVertexAttrib4NbvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4NSVARBPROC GLH_EXT_NAME(glVertexAttrib4NsvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4NIVARBPROC GLH_EXT_NAME(glVertexAttrib4NivARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4NUBVARBPROC GLH_EXT_NAME(glVertexAttrib4NubvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4NUSVARBPROC GLH_EXT_NAME(glVertexAttrib4NusvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4NUIVARBPROC GLH_EXT_NAME(glVertexAttrib4NuivARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBPOINTERARBPROC GLH_EXT_NAME(glVertexAttribPointerARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLENABLEVERTEXATTRIBARRAYARBPROC GLH_EXT_NAME(glEnableVertexAttribArrayARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLDISABLEVERTEXATTRIBARRAYARBPROC GLH_EXT_NAME(glDisableVertexAttribArrayARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMSTRINGARBPROC GLH_EXT_NAME(glProgramStringARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLBINDPROGRAMARBPROC GLH_EXT_NAME(glBindProgramARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLDELETEPROGRAMSARBPROC GLH_EXT_NAME(glDeleteProgramsARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGENPROGRAMSARBPROC GLH_EXT_NAME(glGenProgramsARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMENVPARAMETER4DARBPROC GLH_EXT_NAME(glProgramEnvParameter4dARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMENVPARAMETER4DVARBPROC GLH_EXT_NAME(glProgramEnvParameter4dvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMENVPARAMETER4FARBPROC GLH_EXT_NAME(glProgramEnvParameter4fARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMENVPARAMETER4FVARBPROC GLH_EXT_NAME(glProgramEnvParameter4fvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMLOCALPARAMETER4DARBPROC GLH_EXT_NAME(glProgramLocalParameter4dARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMLOCALPARAMETER4DVARBPROC GLH_EXT_NAME(glProgramLocalParameter4dvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMLOCALPARAMETER4FARBPROC GLH_EXT_NAME(glProgramLocalParameter4fARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMLOCALPARAMETER4FVARBPROC GLH_EXT_NAME(glProgramLocalParameter4fvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETPROGRAMENVPARAMETERDVARBPROC GLH_EXT_NAME(glGetProgramEnvParameterdvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETPROGRAMENVPARAMETERFVARBPROC GLH_EXT_NAME(glGetProgramEnvParameterfvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC GLH_EXT_NAME(glGetProgramLocalParameterdvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC GLH_EXT_NAME(glGetProgramLocalParameterfvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETPROGRAMIVARBPROC GLH_EXT_NAME(glGetProgramivARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETPROGRAMSTRINGARBPROC GLH_EXT_NAME(glGetProgramStringARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETVERTEXATTRIBDVARBPROC GLH_EXT_NAME(glGetVertexAttribdvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETVERTEXATTRIBFVARBPROC GLH_EXT_NAME(glGetVertexAttribfvARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETVERTEXATTRIBIVARBPROC GLH_EXT_NAME(glGetVertexAttribivARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETVERTEXATTRIBPOINTERVARBPROC GLH_EXT_NAME(glGetVertexAttribPointervARB) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLISPROGRAMARBPROC GLH_EXT_NAME(glIsProgramARB) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_EXT_abgr
+#endif
+
+#ifdef GL_EXT_bgra
+#endif
+
+#ifdef GL_EXT_blend_color
+ GLH_EXTERN PFNGLBLENDCOLOREXTPROC GLH_EXT_NAME(glBlendColorEXT) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_EXT_blend_minmax
+ GLH_EXTERN PFNGLBLENDEQUATIONEXTPROC GLH_EXT_NAME(glBlendEquationEXT) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_EXT_blend_subtract
+#endif
+
+#ifdef GL_EXT_compiled_vertex_array
+ GLH_EXTERN PFNGLLOCKARRAYSEXTPROC GLH_EXT_NAME(glLockArraysEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLUNLOCKARRAYSEXTPROC GLH_EXT_NAME(glUnlockArraysEXT) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_EXT_fog_coord
+ GLH_EXTERN PFNGLFOGCOORDDEXTPROC GLH_EXT_NAME(glFogCoorddEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLFOGCOORDDVEXTPROC GLH_EXT_NAME(glFogCoorddvEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLFOGCOORDFEXTPROC GLH_EXT_NAME(glFogCoordfEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLFOGCOORDFVEXTPROC GLH_EXT_NAME(glFogCoordfvEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLFOGCOORDPOINTEREXTPROC GLH_EXT_NAME(glFogCoordPointerEXT) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_EXT_light_max_exponent
+#endif
+
+#ifdef GL_EXT_packed_pixels
+#endif
+
+#ifdef GL_EXT_paletted_texture
+ GLH_EXTERN PFNGLCOLORSUBTABLEEXTPROC GLH_EXT_NAME(glColorSubTableEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOLORTABLEEXTPROC GLH_EXT_NAME(glColorTableEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETCOLORTABLEEXTPROC GLH_EXT_NAME(glGetColorTableEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETCOLORTABLEPARAMETERFVEXTPROC GLH_EXT_NAME(glGetColorTableParameterfvEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETCOLORTABLEPARAMETERIVEXTPROC GLH_EXT_NAME(glGetColorTableParameterivEXT) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_EXT_point_parameters
+ GLH_EXTERN PFNGLPOINTPARAMETERFEXTPROC GLH_EXT_NAME(glPointParameterfEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPOINTPARAMETERFVEXTPROC GLH_EXT_NAME(glPointParameterfvEXT) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_EXT_rescale_normal
+#endif
+
+#ifdef GL_EXT_secondary_color
+ GLH_EXTERN PFNGLSECONDARYCOLOR3BEXTPROC GLH_EXT_NAME(glSecondaryColor3bEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3BVEXTPROC GLH_EXT_NAME(glSecondaryColor3bvEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3DEXTPROC GLH_EXT_NAME(glSecondaryColor3dEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3DVEXTPROC GLH_EXT_NAME(glSecondaryColor3dvEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3FEXTPROC GLH_EXT_NAME(glSecondaryColor3fEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3FVEXTPROC GLH_EXT_NAME(glSecondaryColor3fvEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3IEXTPROC GLH_EXT_NAME(glSecondaryColor3iEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3IVEXTPROC GLH_EXT_NAME(glSecondaryColor3ivEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3SEXTPROC GLH_EXT_NAME(glSecondaryColor3sEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3SVEXTPROC GLH_EXT_NAME(glSecondaryColor3svEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3UBEXTPROC GLH_EXT_NAME(glSecondaryColor3ubEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3UBVEXTPROC GLH_EXT_NAME(glSecondaryColor3ubvEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3UIEXTPROC GLH_EXT_NAME(glSecondaryColor3uiEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3UIVEXTPROC GLH_EXT_NAME(glSecondaryColor3uivEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3USEXTPROC GLH_EXT_NAME(glSecondaryColor3usEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLOR3USVEXTPROC GLH_EXT_NAME(glSecondaryColor3usvEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSECONDARYCOLORPOINTEREXTPROC GLH_EXT_NAME(glSecondaryColorPointerEXT) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_EXT_separate_specular_color
+#endif
+
+#ifdef GL_EXT_shared_texture_palette
+#endif
+
+#ifdef GL_EXT_stencil_wrap
+#endif
+
+#ifdef GL_EXT_texture_compression_s3tc
+#endif
+
+#ifdef GL_EXT_texture_cube_map
+#endif
+
+#ifdef GL_EXT_texture_edge_clamp
+#endif
+
+#ifdef GL_EXT_texture_env_add
+#endif
+
+#ifdef GL_EXT_texture_env_combine
+#endif
+
+#ifdef GL_EXT_texture_filter_anisotropic
+#endif
+
+#ifdef GL_EXT_texture_lod_bias
+#endif
+
+#ifdef GL_EXT_texture_object
+ GLH_EXTERN PFNGLARETEXTURESRESIDENTEXTPROC GLH_EXT_NAME(glAreTexturesResidentEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLBINDTEXTUREEXTPROC GLH_EXT_NAME(glBindTextureEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLDELETETEXTURESEXTPROC GLH_EXT_NAME(glDeleteTexturesEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGENTEXTURESEXTPROC GLH_EXT_NAME(glGenTexturesEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLISTEXTUREEXTPROC GLH_EXT_NAME(glIsTextureEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPRIORITIZETEXTURESEXTPROC GLH_EXT_NAME(glPrioritizeTexturesEXT) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_EXT_texture3D
+ GLH_EXTERN PFNGLTEXIMAGE3DEXTPROC GLH_EXT_NAME(glTexImage3DEXT) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_EXT_vertex_array
+ GLH_EXTERN PFNGLARRAYELEMENTEXTPROC GLH_EXT_NAME(glArrayElementEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOLORPOINTEREXTPROC GLH_EXT_NAME(glColorPointerEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLEDGEFLAGPOINTEREXTPROC GLH_EXT_NAME(glEdgeFlagPointerEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETPOINTERVEXTPROC GLH_EXT_NAME(glGetPointervEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLINDEXPOINTEREXTPROC GLH_EXT_NAME(glIndexPointerEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLNORMALPOINTEREXTPROC GLH_EXT_NAME(glNormalPointerEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLTEXCOORDPOINTEREXTPROC GLH_EXT_NAME(glTexCoordPointerEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXPOINTEREXTPROC GLH_EXT_NAME(glVertexPointerEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLDRAWARRAYSEXTPROC GLH_EXT_NAME(glDrawArraysEXT) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_EXT_vertex_weighting
+ GLH_EXTERN PFNGLVERTEXWEIGHTFEXTPROC GLH_EXT_NAME(glVertexWeightfEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXWEIGHTFVEXTPROC GLH_EXT_NAME(glVertexWeightfvEXT) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXWEIGHTPOINTEREXTPROC GLH_EXT_NAME(glVertexWeightPointerEXT) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_NV_blend_square
+#endif
+
+#ifdef GL_NV_evaluators
+ GLH_EXTERN PFNGLMAPCONTROLPOINTSNVPROC GLH_EXT_NAME(glMapControlPointsNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMAPPARAMETERIVNVPROC GLH_EXT_NAME(glMapParameterivNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLMAPPARAMETERFVNVPROC GLH_EXT_NAME(glMapParameterfvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETMAPCONTROLPOINTSNVPROC GLH_EXT_NAME(glGetMapControlPointsNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETMAPPARAMETERIVNVPROC GLH_EXT_NAME(glGetMapParameterivNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETMAPPARAMETERFVNVPROC GLH_EXT_NAME(glGetMapParameterfvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETMAPATTRIBPARAMETERIVNVPROC GLH_EXT_NAME(glGetMapAttribParameterivNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETMAPATTRIBPARAMETERFVNVPROC GLH_EXT_NAME(glGetMapAttribParameterfvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLEVALMAPSNVPROC GLH_EXT_NAME(glEvalMapsNV) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_NV_fence
+ GLH_EXTERN PFNGLGENFENCESNVPROC GLH_EXT_NAME(glGenFencesNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLDELETEFENCESNVPROC GLH_EXT_NAME(glDeleteFencesNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLSETFENCENVPROC GLH_EXT_NAME(glSetFenceNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLTESTFENCENVPROC GLH_EXT_NAME(glTestFenceNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLFINISHFENCENVPROC GLH_EXT_NAME(glFinishFenceNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLISFENCENVPROC GLH_EXT_NAME(glIsFenceNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETFENCEIVNVPROC GLH_EXT_NAME(glGetFenceivNV) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_NV_fog_distance
+#endif
+
+#ifdef GL_NV_packed_depth_stencil
+#endif
+
+#ifdef GL_NV_register_combiners
+ GLH_EXTERN PFNGLCOMBINERPARAMETERFVNVPROC GLH_EXT_NAME(glCombinerParameterfvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOMBINERPARAMETERFNVPROC GLH_EXT_NAME(glCombinerParameterfNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOMBINERPARAMETERIVNVPROC GLH_EXT_NAME(glCombinerParameterivNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOMBINERPARAMETERINVPROC GLH_EXT_NAME(glCombinerParameteriNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOMBINERINPUTNVPROC GLH_EXT_NAME(glCombinerInputNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOMBINEROUTPUTNVPROC GLH_EXT_NAME(glCombinerOutputNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLFINALCOMBINERINPUTNVPROC GLH_EXT_NAME(glFinalCombinerInputNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC GLH_EXT_NAME(glGetCombinerInputParameterfvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC GLH_EXT_NAME(glGetCombinerInputParameterivNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC GLH_EXT_NAME(glGetCombinerOutputParameterfvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC GLH_EXT_NAME(glGetCombinerOutputParameterivNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC GLH_EXT_NAME(glGetFinalCombinerInputParameterfvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC GLH_EXT_NAME(glGetFinalCombinerInputParameterivNV) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_NV_register_combiners2
+ GLH_EXTERN PFNGLCOMBINERSTAGEPARAMETERFVNVPROC GLH_EXT_NAME(glCombinerStageParameterfvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC GLH_EXT_NAME(glGetCombinerStageParameterfvNV) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_NV_texgen_reflection
+#endif
+
+#ifdef GL_NV_texture_env_combine4
+#endif
+
+#ifdef GL_NV_texture_rectangle
+#endif
+
+#ifdef GL_NV_texture_shader
+#endif
+
+#ifdef GL_NV_vertex_array_range
+ GLH_EXTERN PFNGLFLUSHVERTEXARRAYRANGENVPROC GLH_EXT_NAME(glFlushVertexArrayRangeNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXARRAYRANGENVPROC GLH_EXT_NAME(glVertexArrayRangeNV) GLH_INITIALIZER;
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLALLOCATEMEMORYNVPROC GLH_EXT_NAME(wglAllocateMemoryNV) GLH_INITIALIZER;
+# endif
+# ifdef GLX_VERSION_1_3
+ GLH_EXTERN PFNGLXALLOCATEMEMORYNVPROC GLH_EXT_NAME(glXAllocateMemoryNV) GLH_INITIALIZER;
+# endif
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLFREEMEMORYNVPROC GLH_EXT_NAME(wglFreeMemoryNV) GLH_INITIALIZER;
+# endif
+# ifdef GLX_VERSION_1_3
+ GLH_EXTERN PFNGLXFREEMEMORYNVPROC GLH_EXT_NAME(glXFreeMemoryNV) GLH_INITIALIZER;
+# endif
+#endif
+
+#ifdef GL_NV_vertex_program
+ GLH_EXTERN PFNGLAREPROGRAMSRESIDENTNVPROC GLH_EXT_NAME(glAreProgramsResidentNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLBINDPROGRAMNVPROC GLH_EXT_NAME(glBindProgramNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLDELETEPROGRAMSNVPROC GLH_EXT_NAME(glDeleteProgramsNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLEXECUTEPROGRAMNVPROC GLH_EXT_NAME(glExecuteProgramNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGENPROGRAMSNVPROC GLH_EXT_NAME(glGenProgramsNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETPROGRAMPARAMETERDVNVPROC GLH_EXT_NAME(glGetProgramParameterdvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETPROGRAMPARAMETERFVNVPROC GLH_EXT_NAME(glGetProgramParameterfvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETPROGRAMIVNVPROC GLH_EXT_NAME(glGetProgramivNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETPROGRAMSTRINGNVPROC GLH_EXT_NAME(glGetProgramStringNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETTRACKMATRIXIVNVPROC GLH_EXT_NAME(glGetTrackMatrixivNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETVERTEXATTRIBDVNVPROC GLH_EXT_NAME(glGetVertexAttribdvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETVERTEXATTRIBFVNVPROC GLH_EXT_NAME(glGetVertexAttribfvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETVERTEXATTRIBIVNVPROC GLH_EXT_NAME(glGetVertexAttribivNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETVERTEXATTRIBPOINTERVNVPROC GLH_EXT_NAME(glGetVertexAttribPointervNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLISPROGRAMNVPROC GLH_EXT_NAME(glIsProgramNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLLOADPROGRAMNVPROC GLH_EXT_NAME(glLoadProgramNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMPARAMETER4DNVPROC GLH_EXT_NAME(glProgramParameter4dNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMPARAMETER4DVNVPROC GLH_EXT_NAME(glProgramParameter4dvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMPARAMETER4FNVPROC GLH_EXT_NAME(glProgramParameter4fNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMPARAMETER4FVNVPROC GLH_EXT_NAME(glProgramParameter4fvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMPARAMETERS4DVNVPROC GLH_EXT_NAME(glProgramParameters4dvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLPROGRAMPARAMETERS4FVNVPROC GLH_EXT_NAME(glProgramParameters4fvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLREQUESTRESIDENTPROGRAMSNVPROC GLH_EXT_NAME(glRequestResidentProgramsNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLTRACKMATRIXNVPROC GLH_EXT_NAME(glTrackMatrixNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBPOINTERNVPROC GLH_EXT_NAME(glVertexAttribPointerNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB1DNVPROC GLH_EXT_NAME(glVertexAttrib1dNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB1DVNVPROC GLH_EXT_NAME(glVertexAttrib1dvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB1FNVPROC GLH_EXT_NAME(glVertexAttrib1fNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB1FVNVPROC GLH_EXT_NAME(glVertexAttrib1fvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB1SNVPROC GLH_EXT_NAME(glVertexAttrib1sNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB1SVNVPROC GLH_EXT_NAME(glVertexAttrib1svNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB2DNVPROC GLH_EXT_NAME(glVertexAttrib2dNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB2DVNVPROC GLH_EXT_NAME(glVertexAttrib2dvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB2FNVPROC GLH_EXT_NAME(glVertexAttrib2fNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB2FVNVPROC GLH_EXT_NAME(glVertexAttrib2fvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB2SNVPROC GLH_EXT_NAME(glVertexAttrib2sNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB2SVNVPROC GLH_EXT_NAME(glVertexAttrib2svNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB3DNVPROC GLH_EXT_NAME(glVertexAttrib3dNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB3DVNVPROC GLH_EXT_NAME(glVertexAttrib3dvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB3FNVPROC GLH_EXT_NAME(glVertexAttrib3fNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB3FVNVPROC GLH_EXT_NAME(glVertexAttrib3fvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB3SNVPROC GLH_EXT_NAME(glVertexAttrib3sNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB3SVNVPROC GLH_EXT_NAME(glVertexAttrib3svNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4DNVPROC GLH_EXT_NAME(glVertexAttrib4dNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4DVNVPROC GLH_EXT_NAME(glVertexAttrib4dvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4FNVPROC GLH_EXT_NAME(glVertexAttrib4fNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4FVNVPROC GLH_EXT_NAME(glVertexAttrib4fvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4SNVPROC GLH_EXT_NAME(glVertexAttrib4sNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4SVNVPROC GLH_EXT_NAME(glVertexAttrib4svNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIB4UBVNVPROC GLH_EXT_NAME(glVertexAttrib4ubvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS1DVNVPROC GLH_EXT_NAME(glVertexAttribs1dvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS1FVNVPROC GLH_EXT_NAME(glVertexAttribs1fvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS1SVNVPROC GLH_EXT_NAME(glVertexAttribs1svNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS2DVNVPROC GLH_EXT_NAME(glVertexAttribs2dvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS2FVNVPROC GLH_EXT_NAME(glVertexAttribs2fvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS2SVNVPROC GLH_EXT_NAME(glVertexAttribs2svNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS3DVNVPROC GLH_EXT_NAME(glVertexAttribs3dvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS3FVNVPROC GLH_EXT_NAME(glVertexAttribs3fvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS3SVNVPROC GLH_EXT_NAME(glVertexAttribs3svNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS4DVNVPROC GLH_EXT_NAME(glVertexAttribs4dvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS4FVNVPROC GLH_EXT_NAME(glVertexAttribs4fvNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS4SVNVPROC GLH_EXT_NAME(glVertexAttribs4svNV) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLVERTEXATTRIBS4UBVNVPROC GLH_EXT_NAME(glVertexAttribs4ubvNV) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_SGIS_generate_mipmap
+#endif
+
+#ifdef GL_SGIS_texture_lod
+#endif
+
+#ifdef GL_SGIX_depth_texture
+#endif
+
+#ifdef GL_SGIX_shadow
+#endif
+
+#ifdef GL_VERSION_1_2
+ /* These routines are prefixed by the preprocessor constant
+ GLH_CORE_1_2_PREFIX to avoid colliding with the OpenGL 1.2 namespace. */
+ GLH_EXTERN PFNGLBLENDCOLORPROC GLH_CORE_1_2_NAME(glBlendColor) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLBLENDEQUATIONPROC GLH_CORE_1_2_NAME(glBlendEquation) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLDRAWRANGEELEMENTSPROC GLH_CORE_1_2_NAME(glDrawRangeElements) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOLORTABLEPROC GLH_CORE_1_2_NAME(glColorTable) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOLORTABLEPARAMETERFVPROC GLH_CORE_1_2_NAME(glColorTableParameterfv) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOLORTABLEPARAMETERIVPROC GLH_CORE_1_2_NAME(glColorTableParameteriv) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOPYCOLORTABLEPROC GLH_CORE_1_2_NAME(glCopyColorTable) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETCOLORTABLEPROC GLH_CORE_1_2_NAME(glGetColorTable) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETCOLORTABLEPARAMETERFVPROC GLH_CORE_1_2_NAME(glGetColorTableParameterfv) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLGETCOLORTABLEPARAMETERIVPROC GLH_CORE_1_2_NAME(glGetColorTableParameteriv) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLTEXIMAGE3DPROC GLH_CORE_1_2_NAME(glTexImage3D) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLTEXSUBIMAGE3DPROC GLH_CORE_1_2_NAME(glTexSubImage3D) GLH_INITIALIZER;
+ GLH_EXTERN PFNGLCOPYTEXSUBIMAGE3DPROC GLH_CORE_1_2_NAME(glCopyTexSubImage3D) GLH_INITIALIZER;
+#endif
+
+#ifdef GL_WIN_swap_hint
+ GLH_EXTERN PFNGLADDSWAPHINTRECTWINPROC GLH_EXT_NAME(glAddSwapHintRectWIN) GLH_INITIALIZER;
+#endif
+
+#ifdef WGL_ARB_pbuffer
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLCREATEPBUFFERARBPROC GLH_EXT_NAME(wglCreatePbufferARB) GLH_INITIALIZER;
+# endif
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLGETPBUFFERDCARBPROC GLH_EXT_NAME(wglGetPbufferDCARB) GLH_INITIALIZER;
+# endif
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLRELEASEPBUFFERDCARBPROC GLH_EXT_NAME(wglReleasePbufferDCARB) GLH_INITIALIZER;
+# endif
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLDESTROYPBUFFERARBPROC GLH_EXT_NAME(wglDestroyPbufferARB) GLH_INITIALIZER;
+# endif
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLQUERYPBUFFERARBPROC GLH_EXT_NAME(wglQueryPbufferARB) GLH_INITIALIZER;
+# endif
+#endif
+
+#ifdef WGL_ARB_render_texture
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLBINDTEXIMAGEARBPROC GLH_EXT_NAME(wglBindTexImageARB) GLH_INITIALIZER;
+# endif
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLRELEASETEXIMAGEARBPROC GLH_EXT_NAME(wglReleaseTexImageARB) GLH_INITIALIZER;
+# endif
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLSETPBUFFERATTRIBARBPROC GLH_EXT_NAME(wglSetPbufferAttribARB) GLH_INITIALIZER;
+# endif
+#endif
+
+#ifdef WGL_ARB_pixel_format
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLGETPIXELFORMATATTRIBIVARBPROC GLH_EXT_NAME(wglGetPixelFormatAttribivARB) GLH_INITIALIZER;
+# endif
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLGETPIXELFORMATATTRIBFVARBPROC GLH_EXT_NAME(wglGetPixelFormatAttribfvARB) GLH_INITIALIZER;
+# endif
+# ifdef _WIN32
+ GLH_EXTERN PFNWGLCHOOSEPIXELFORMATARBPROC GLH_EXT_NAME(wglChoosePixelFormatARB) GLH_INITIALIZER;
+# endif
+#endif
+
+
+#ifdef GLH_EXT_SINGLE_FILE
+
+int glh_init_extension(const char* extension)
+{
+ if (NULL == extension) {
+ return FALSE;
+#ifdef GL_ARB_multitexture
+ } else if (0 == strcmp(extension, "GL_ARB_multitexture")) {
+ GLH_EXT_NAME(glMultiTexCoord1dARB) = (PFNGLMULTITEXCOORD1DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1dARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord1dARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord1dvARB) = (PFNGLMULTITEXCOORD1DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1dvARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord1dvARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord1fARB) = (PFNGLMULTITEXCOORD1FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1fARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord1fARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord1fvARB) = (PFNGLMULTITEXCOORD1FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1fvARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord1fvARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord1iARB) = (PFNGLMULTITEXCOORD1IARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1iARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord1iARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord1ivARB) = (PFNGLMULTITEXCOORD1IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1ivARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord1ivARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord1sARB) = (PFNGLMULTITEXCOORD1SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1sARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord1sARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord1svARB) = (PFNGLMULTITEXCOORD1SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1svARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord1svARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord2dARB) = (PFNGLMULTITEXCOORD2DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2dARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord2dARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord2dvARB) = (PFNGLMULTITEXCOORD2DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2dvARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord2dvARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord2fARB) = (PFNGLMULTITEXCOORD2FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2fARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord2fARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord2fvARB) = (PFNGLMULTITEXCOORD2FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2fvARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord2fvARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord2iARB) = (PFNGLMULTITEXCOORD2IARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2iARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord2iARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord2ivARB) = (PFNGLMULTITEXCOORD2IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2ivARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord2ivARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord2sARB) = (PFNGLMULTITEXCOORD2SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2sARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord2sARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord2svARB) = (PFNGLMULTITEXCOORD2SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2svARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord2svARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord3dARB) = (PFNGLMULTITEXCOORD3DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3dARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord3dARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord3dvARB) = (PFNGLMULTITEXCOORD3DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3dvARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord3dvARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord3fARB) = (PFNGLMULTITEXCOORD3FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3fARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord3fARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord3fvARB) = (PFNGLMULTITEXCOORD3FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3fvARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord3fvARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord3iARB) = (PFNGLMULTITEXCOORD3IARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3iARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord3iARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord3ivARB) = (PFNGLMULTITEXCOORD3IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3ivARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord3ivARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord3sARB) = (PFNGLMULTITEXCOORD3SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3sARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord3sARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord3svARB) = (PFNGLMULTITEXCOORD3SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3svARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord3svARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord4dARB) = (PFNGLMULTITEXCOORD4DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4dARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord4dARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord4dvARB) = (PFNGLMULTITEXCOORD4DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4dvARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord4dvARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord4fARB) = (PFNGLMULTITEXCOORD4FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4fARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord4fARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord4fvARB) = (PFNGLMULTITEXCOORD4FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4fvARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord4fvARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord4iARB) = (PFNGLMULTITEXCOORD4IARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4iARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord4iARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord4ivARB) = (PFNGLMULTITEXCOORD4IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4ivARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord4ivARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord4sARB) = (PFNGLMULTITEXCOORD4SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4sARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord4sARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultiTexCoord4svARB) = (PFNGLMULTITEXCOORD4SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4svARB");
+ if (NULL == GLH_EXT_NAME(glMultiTexCoord4svARB))
+ return FALSE;
+ GLH_EXT_NAME(glActiveTextureARB) = (PFNGLACTIVETEXTUREARBPROC)GLH_EXT_GET_PROC_ADDRESS("glActiveTextureARB");
+ if (NULL == GLH_EXT_NAME(glActiveTextureARB))
+ return FALSE;
+ GLH_EXT_NAME(glClientActiveTextureARB) = (PFNGLCLIENTACTIVETEXTUREARBPROC)GLH_EXT_GET_PROC_ADDRESS("glClientActiveTextureARB");
+ if (NULL == GLH_EXT_NAME(glClientActiveTextureARB))
+ return FALSE;
+#endif
+
+#ifdef GL_ARB_texture_border_clamp
+ } else if (0 == strcmp(extension, "GL_ARB_texture_border_clamp")) {
+#endif
+
+#ifdef GL_ARB_texture_compression
+ } else if (0 == strcmp(extension, "GL_ARB_texture_compression")) {
+ GLH_EXT_NAME(glCompressedTexImage3DARB) = (PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexImage3DARB");
+ if (NULL == GLH_EXT_NAME(glCompressedTexImage3DARB))
+ return FALSE;
+ GLH_EXT_NAME(glCompressedTexImage2DARB) = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexImage2DARB");
+ if (NULL == GLH_EXT_NAME(glCompressedTexImage2DARB))
+ return FALSE;
+ GLH_EXT_NAME(glCompressedTexImage1DARB) = (PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexImage1DARB");
+ if (NULL == GLH_EXT_NAME(glCompressedTexImage1DARB))
+ return FALSE;
+ GLH_EXT_NAME(glCompressedTexSubImage3DARB) = (PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexSubImage3DARB");
+ if (NULL == GLH_EXT_NAME(glCompressedTexSubImage3DARB))
+ return FALSE;
+ GLH_EXT_NAME(glCompressedTexSubImage2DARB) = (PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexSubImage2DARB");
+ if (NULL == GLH_EXT_NAME(glCompressedTexSubImage2DARB))
+ return FALSE;
+ GLH_EXT_NAME(glCompressedTexSubImage1DARB) = (PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexSubImage1DARB");
+ if (NULL == GLH_EXT_NAME(glCompressedTexSubImage1DARB))
+ return FALSE;
+ GLH_EXT_NAME(glGetCompressedTexImageARB) = (PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCompressedTexImageARB");
+ if (NULL == GLH_EXT_NAME(glGetCompressedTexImageARB))
+ return FALSE;
+#endif
+
+#ifdef GL_ARB_texture_cube_map
+ } else if (0 == strcmp(extension, "GL_ARB_texture_cube_map")) {
+#endif
+
+#ifdef GL_ARB_transpose_matrix
+ } else if (0 == strcmp(extension, "GL_ARB_transpose_matrix")) {
+ GLH_EXT_NAME(glLoadTransposeMatrixfARB) = (PFNGLLOADTRANSPOSEMATRIXFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glLoadTransposeMatrixfARB");
+ if (NULL == GLH_EXT_NAME(glLoadTransposeMatrixfARB))
+ return FALSE;
+ GLH_EXT_NAME(glLoadTransposeMatrixdARB) = (PFNGLLOADTRANSPOSEMATRIXDARBPROC)GLH_EXT_GET_PROC_ADDRESS("glLoadTransposeMatrixdARB");
+ if (NULL == GLH_EXT_NAME(glLoadTransposeMatrixdARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultTransposeMatrixfARB) = (PFNGLMULTTRANSPOSEMATRIXFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultTransposeMatrixfARB");
+ if (NULL == GLH_EXT_NAME(glMultTransposeMatrixfARB))
+ return FALSE;
+ GLH_EXT_NAME(glMultTransposeMatrixdARB) = (PFNGLMULTTRANSPOSEMATRIXDARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultTransposeMatrixdARB");
+ if (NULL == GLH_EXT_NAME(glMultTransposeMatrixdARB))
+ return FALSE;
+#endif
+
+#ifdef GL_ARB_vertex_program
+ } else if (0 == strcmp(extension, "GL_ARB_vertex_program")) {
+ GLH_EXT_NAME(glVertexAttrib1sARB) = (PFNGLVERTEXATTRIB1SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1sARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib1sARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib1fARB) = (PFNGLVERTEXATTRIB1FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib1fARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib1dARB) = (PFNGLVERTEXATTRIB1DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib1dARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib2sARB) = (PFNGLVERTEXATTRIB2SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2sARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib2sARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib2fARB) = (PFNGLVERTEXATTRIB2FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib2fARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib2dARB) = (PFNGLVERTEXATTRIB2DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib2dARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib3sARB) = (PFNGLVERTEXATTRIB3SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3sARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib3sARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib3fARB) = (PFNGLVERTEXATTRIB3FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib3fARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib3dARB) = (PFNGLVERTEXATTRIB3DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib3dARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4sARB) = (PFNGLVERTEXATTRIB4SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4sARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4sARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4fARB) = (PFNGLVERTEXATTRIB4FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4fARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4dARB) = (PFNGLVERTEXATTRIB4DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4dARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4NubARB) = (PFNGLVERTEXATTRIB4NUBARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NubARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4NubARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib1svARB) = (PFNGLVERTEXATTRIB1SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1svARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib1svARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib1fvARB) = (PFNGLVERTEXATTRIB1FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib1fvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib1dvARB) = (PFNGLVERTEXATTRIB1DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib1dvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib2svARB) = (PFNGLVERTEXATTRIB2SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2svARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib2svARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib2fvARB) = (PFNGLVERTEXATTRIB2FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib2fvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib2dvARB) = (PFNGLVERTEXATTRIB2DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib2dvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib3svARB) = (PFNGLVERTEXATTRIB3SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3svARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib3svARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib3fvARB) = (PFNGLVERTEXATTRIB3FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib3fvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib3dvARB) = (PFNGLVERTEXATTRIB3DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib3dvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4bvARB) = (PFNGLVERTEXATTRIB4BVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4bvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4bvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4svARB) = (PFNGLVERTEXATTRIB4SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4svARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4svARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4ivARB) = (PFNGLVERTEXATTRIB4IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4ivARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4ivARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4ubvARB) = (PFNGLVERTEXATTRIB4UBVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4ubvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4ubvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4usvARB) = (PFNGLVERTEXATTRIB4USVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4usvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4usvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4uivARB) = (PFNGLVERTEXATTRIB4UIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4uivARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4uivARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4fvARB) = (PFNGLVERTEXATTRIB4FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4fvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4dvARB) = (PFNGLVERTEXATTRIB4DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4dvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4NbvARB) = (PFNGLVERTEXATTRIB4NBVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NbvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4NbvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4NsvARB) = (PFNGLVERTEXATTRIB4NSVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NsvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4NsvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4NivARB) = (PFNGLVERTEXATTRIB4NIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NivARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4NivARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4NubvARB) = (PFNGLVERTEXATTRIB4NUBVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NubvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4NubvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4NusvARB) = (PFNGLVERTEXATTRIB4NUSVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NusvARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4NusvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttrib4NuivARB) = (PFNGLVERTEXATTRIB4NUIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NuivARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4NuivARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glVertexAttribPointerARB) = (PFNGLVERTEXATTRIBPOINTERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribPointerARB");
+ if (NULL == GLH_EXT_NAME(glVertexAttribPointerARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glEnableVertexAttribArrayARB) = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glEnableVertexAttribArrayARB");
+ if (NULL == GLH_EXT_NAME(glEnableVertexAttribArrayARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glDisableVertexAttribArrayARB) = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDisableVertexAttribArrayARB");
+ if (NULL == GLH_EXT_NAME(glDisableVertexAttribArrayARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glProgramStringARB) = (PFNGLPROGRAMSTRINGARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramStringARB");
+ if (NULL == GLH_EXT_NAME(glProgramStringARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glBindProgramARB) = (PFNGLBINDPROGRAMARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBindProgramARB");
+ if (NULL == GLH_EXT_NAME(glBindProgramARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glDeleteProgramsARB) = (PFNGLDELETEPROGRAMSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteProgramsARB");
+ if (NULL == GLH_EXT_NAME(glDeleteProgramsARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glGenProgramsARB) = (PFNGLGENPROGRAMSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenProgramsARB");
+ if (NULL == GLH_EXT_NAME(glGenProgramsARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glProgramEnvParameter4dARB) = (PFNGLPROGRAMENVPARAMETER4DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4dARB");
+ if (NULL == GLH_EXT_NAME(glProgramEnvParameter4dARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glProgramEnvParameter4dvARB) = (PFNGLPROGRAMENVPARAMETER4DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4dvARB");
+ if (NULL == GLH_EXT_NAME(glProgramEnvParameter4dvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glProgramEnvParameter4fARB) = (PFNGLPROGRAMENVPARAMETER4FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4fARB");
+ if (NULL == GLH_EXT_NAME(glProgramEnvParameter4fARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glProgramEnvParameter4fvARB) = (PFNGLPROGRAMENVPARAMETER4FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4fvARB");
+ if (NULL == GLH_EXT_NAME(glProgramEnvParameter4fvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glProgramLocalParameter4dARB) = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4dARB");
+ if (NULL == GLH_EXT_NAME(glProgramLocalParameter4dARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glProgramLocalParameter4dvARB) = (PFNGLPROGRAMLOCALPARAMETER4DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4dvARB");
+ if (NULL == GLH_EXT_NAME(glProgramLocalParameter4dvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glProgramLocalParameter4fARB) = (PFNGLPROGRAMLOCALPARAMETER4FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4fARB");
+ if (NULL == GLH_EXT_NAME(glProgramLocalParameter4fARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glProgramLocalParameter4fvARB) = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4fvARB");
+ if (NULL == GLH_EXT_NAME(glProgramLocalParameter4fvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glGetProgramEnvParameterdvARB) = (PFNGLGETPROGRAMENVPARAMETERDVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramEnvParameterdvARB");
+ if (NULL == GLH_EXT_NAME(glGetProgramEnvParameterdvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glGetProgramEnvParameterfvARB) = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramEnvParameterfvARB");
+ if (NULL == GLH_EXT_NAME(glGetProgramEnvParameterfvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glGetProgramLocalParameterdvARB) = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramLocalParameterdvARB");
+ if (NULL == GLH_EXT_NAME(glGetProgramLocalParameterdvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glGetProgramLocalParameterfvARB) = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramLocalParameterfvARB");
+ if (NULL == GLH_EXT_NAME(glGetProgramLocalParameterfvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glGetProgramivARB) = (PFNGLGETPROGRAMIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramivARB");
+ if (NULL == GLH_EXT_NAME(glGetProgramivARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glGetProgramStringARB) = (PFNGLGETPROGRAMSTRINGARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramStringARB");
+ if (NULL == GLH_EXT_NAME(glGetProgramStringARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glGetVertexAttribdvARB) = (PFNGLGETVERTEXATTRIBDVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribdvARB");
+ if (NULL == GLH_EXT_NAME(glGetVertexAttribdvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glGetVertexAttribfvARB) = (PFNGLGETVERTEXATTRIBFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribfvARB");
+ if (NULL == GLH_EXT_NAME(glGetVertexAttribfvARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glGetVertexAttribivARB) = (PFNGLGETVERTEXATTRIBIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribivARB");
+ if (NULL == GLH_EXT_NAME(glGetVertexAttribivARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glGetVertexAttribPointervARB) = (PFNGLGETVERTEXATTRIBPOINTERVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribPointervARB");
+ if (NULL == GLH_EXT_NAME(glGetVertexAttribPointervARB))
+ return GL_FALSE;
+ GLH_EXT_NAME(glIsProgramARB) = (PFNGLISPROGRAMARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsProgramARB");
+ if (NULL == GLH_EXT_NAME(glIsProgramARB))
+ return GL_FALSE;
+#endif
+
+#ifdef GL_EXT_abgr
+ } else if (0 == strcmp(extension, "GL_EXT_abgr")) {
+#endif
+
+#ifdef GL_EXT_bgra
+ } else if (0 == strcmp(extension, "GL_EXT_bgra")) {
+#endif
+
+#ifdef GL_EXT_blend_color
+ } else if (0 == strcmp(extension, "GL_EXT_blend_color")) {
+ GLH_EXT_NAME(glBlendColorEXT) = (PFNGLBLENDCOLOREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glBlendColorEXT");
+ if (NULL == GLH_EXT_NAME(glBlendColorEXT))
+ return FALSE;
+#endif
+
+#ifdef GL_EXT_blend_minmax
+ } else if (0 == strcmp(extension, "GL_EXT_blend_minmax")) {
+ GLH_EXT_NAME(glBlendEquationEXT) = (PFNGLBLENDEQUATIONEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glBlendEquationEXT");
+ if (NULL == GLH_EXT_NAME(glBlendEquationEXT))
+ return FALSE;
+#endif
+
+#ifdef GL_EXT_blend_subtract
+ } else if (0 == strcmp(extension, "GL_EXT_blend_subtract")) {
+#endif
+
+#ifdef GL_EXT_compiled_vertex_array
+ } else if (0 == strcmp(extension, "GL_EXT_compiled_vertex_array")) {
+ GLH_EXT_NAME(glLockArraysEXT) = (PFNGLLOCKARRAYSEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glLockArraysEXT");
+ if (NULL == GLH_EXT_NAME(glLockArraysEXT))
+ return FALSE;
+ GLH_EXT_NAME(glUnlockArraysEXT) = (PFNGLUNLOCKARRAYSEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glUnlockArraysEXT");
+ if (NULL == GLH_EXT_NAME(glUnlockArraysEXT))
+ return FALSE;
+#endif
+
+#ifdef GL_EXT_fog_coord
+ } else if (0 == strcmp(extension, "GL_EXT_fog_coord")) {
+ GLH_EXT_NAME(glFogCoorddEXT) = (PFNGLFOGCOORDDEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoorddEXT");
+ if (NULL == GLH_EXT_NAME(glFogCoorddEXT))
+ return FALSE;
+ GLH_EXT_NAME(glFogCoorddvEXT) = (PFNGLFOGCOORDDVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoorddvEXT");
+ if (NULL == GLH_EXT_NAME(glFogCoorddvEXT))
+ return FALSE;
+ GLH_EXT_NAME(glFogCoordfEXT) = (PFNGLFOGCOORDFEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoordfEXT");
+ if (NULL == GLH_EXT_NAME(glFogCoordfEXT))
+ return FALSE;
+ GLH_EXT_NAME(glFogCoordfvEXT) = (PFNGLFOGCOORDFVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoordfvEXT");
+ if (NULL == GLH_EXT_NAME(glFogCoordfvEXT))
+ return FALSE;
+ GLH_EXT_NAME(glFogCoordPointerEXT) = (PFNGLFOGCOORDPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoordPointerEXT");
+ if (NULL == GLH_EXT_NAME(glFogCoordPointerEXT))
+ return FALSE;
+#endif
+
+#ifdef GL_EXT_light_max_exponent
+ } else if (0 == strcmp(extension, "GL_EXT_light_max_exponent")) {
+#endif
+
+#ifdef GL_EXT_packed_pixels
+ } else if (0 == strcmp(extension, "GL_EXT_packed_pixels")) {
+#endif
+
+#ifdef GL_EXT_paletted_texture
+ } else if (0 == strcmp(extension, "GL_EXT_paletted_texture")) {
+ GLH_EXT_NAME(glColorSubTableEXT) = (PFNGLCOLORSUBTABLEEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glColorSubTableEXT");
+ if (NULL == GLH_EXT_NAME(glColorSubTableEXT))
+ return FALSE;
+ GLH_EXT_NAME(glColorTableEXT) = (PFNGLCOLORTABLEEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTableEXT");
+ if (NULL == GLH_EXT_NAME(glColorTableEXT))
+ return FALSE;
+ GLH_EXT_NAME(glGetColorTableEXT) = (PFNGLGETCOLORTABLEEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableEXT");
+ if (NULL == GLH_EXT_NAME(glGetColorTableEXT))
+ return FALSE;
+ GLH_EXT_NAME(glGetColorTableParameterfvEXT) = (PFNGLGETCOLORTABLEPARAMETERFVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableParameterfvEXT");
+ if (NULL == GLH_EXT_NAME(glGetColorTableParameterfvEXT))
+ return FALSE;
+ GLH_EXT_NAME(glGetColorTableParameterivEXT) = (PFNGLGETCOLORTABLEPARAMETERIVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableParameterivEXT");
+ if (NULL == GLH_EXT_NAME(glGetColorTableParameterivEXT))
+ return FALSE;
+#endif
+
+#ifdef GL_EXT_point_parameters
+ } else if (0 == strcmp(extension, "GL_EXT_point_parameters")) {
+ GLH_EXT_NAME(glPointParameterfEXT) = (PFNGLPOINTPARAMETERFEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfEXT");
+ if (NULL == GLH_EXT_NAME(glPointParameterfEXT))
+ return FALSE;
+ GLH_EXT_NAME(glPointParameterfvEXT) = (PFNGLPOINTPARAMETERFVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfvEXT");
+ if (NULL == GLH_EXT_NAME(glPointParameterfvEXT))
+ return FALSE;
+#endif
+
+#ifdef GL_EXT_rescale_normal
+ } else if (0 == strcmp(extension, "GL_EXT_rescale_normal")) {
+#endif
+
+#ifdef GL_EXT_secondary_color
+ } else if (0 == strcmp(extension, "GL_EXT_secondary_color")) {
+ GLH_EXT_NAME(glSecondaryColor3bEXT) = (PFNGLSECONDARYCOLOR3BEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3bEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3bEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3bvEXT) = (PFNGLSECONDARYCOLOR3BVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3bvEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3bvEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3dEXT) = (PFNGLSECONDARYCOLOR3DEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3dEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3dEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3dvEXT) = (PFNGLSECONDARYCOLOR3DVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3dvEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3dvEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3fEXT) = (PFNGLSECONDARYCOLOR3FEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3fEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3fEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3fvEXT) = (PFNGLSECONDARYCOLOR3FVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3fvEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3fvEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3iEXT) = (PFNGLSECONDARYCOLOR3IEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3iEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3iEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3ivEXT) = (PFNGLSECONDARYCOLOR3IVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3ivEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3ivEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3sEXT) = (PFNGLSECONDARYCOLOR3SEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3sEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3sEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3svEXT) = (PFNGLSECONDARYCOLOR3SVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3svEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3svEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3ubEXT) = (PFNGLSECONDARYCOLOR3UBEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3ubEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3ubEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3ubvEXT) = (PFNGLSECONDARYCOLOR3UBVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3ubvEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3ubvEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3uiEXT) = (PFNGLSECONDARYCOLOR3UIEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3uiEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3uiEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3uivEXT) = (PFNGLSECONDARYCOLOR3UIVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3uivEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3uivEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3usEXT) = (PFNGLSECONDARYCOLOR3USEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3usEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3usEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColor3usvEXT) = (PFNGLSECONDARYCOLOR3USVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3usvEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColor3usvEXT))
+ return FALSE;
+ GLH_EXT_NAME(glSecondaryColorPointerEXT) = (PFNGLSECONDARYCOLORPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColorPointerEXT");
+ if (NULL == GLH_EXT_NAME(glSecondaryColorPointerEXT))
+ return FALSE;
+#endif
+
+#ifdef GL_EXT_separate_specular_color
+ } else if (0 == strcmp(extension, "GL_EXT_separate_specular_color")) {
+#endif
+
+#ifdef GL_EXT_shared_texture_palette
+ } else if (0 == strcmp(extension, "GL_EXT_shared_texture_palette")) {
+#endif
+
+#ifdef GL_EXT_stencil_wrap
+ } else if (0 == strcmp(extension, "GL_EXT_stencil_wrap")) {
+#endif
+
+#ifdef GL_EXT_texture_compression_s3tc
+ } else if (0 == strcmp(extension, "GL_EXT_texture_compression_s3tc")) {
+#endif
+
+#ifdef GL_EXT_texture_cube_map
+ } else if (0 == strcmp(extension, "GL_EXT_texture_cube_map")) {
+#endif
+
+#ifdef GL_EXT_texture_edge_clamp
+ } else if (0 == strcmp(extension, "GL_EXT_texture_edge_clamp")) {
+#endif
+
+#ifdef GL_EXT_texture_env_add
+ } else if (0 == strcmp(extension, "GL_EXT_texture_env_add")) {
+#endif
+
+#ifdef GL_EXT_texture_env_combine
+ } else if (0 == strcmp(extension, "GL_EXT_texture_env_combine")) {
+#endif
+
+#ifdef GL_EXT_texture_filter_anisotropic
+ } else if (0 == strcmp(extension, "GL_EXT_texture_filter_anisotropic")) {
+#endif
+
+#ifdef GL_EXT_texture_lod_bias
+ } else if (0 == strcmp(extension, "GL_EXT_texture_lod_bias")) {
+#endif
+
+#ifdef GL_EXT_texture_object
+ } else if (0 == strcmp(extension, "GL_EXT_texture_object")) {
+ GLH_EXT_NAME(glAreTexturesResidentEXT) = (PFNGLARETEXTURESRESIDENTEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glAreTexturesResidentEXT");
+ if (NULL == GLH_EXT_NAME(glAreTexturesResidentEXT))
+ return FALSE;
+ GLH_EXT_NAME(glBindTextureEXT) = (PFNGLBINDTEXTUREEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glBindTextureEXT");
+ if (NULL == GLH_EXT_NAME(glBindTextureEXT))
+ return FALSE;
+ GLH_EXT_NAME(glDeleteTexturesEXT) = (PFNGLDELETETEXTURESEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteTexturesEXT");
+ if (NULL == GLH_EXT_NAME(glDeleteTexturesEXT))
+ return FALSE;
+ GLH_EXT_NAME(glGenTexturesEXT) = (PFNGLGENTEXTURESEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGenTexturesEXT");
+ if (NULL == GLH_EXT_NAME(glGenTexturesEXT))
+ return FALSE;
+ GLH_EXT_NAME(glIsTextureEXT) = (PFNGLISTEXTUREEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glIsTextureEXT");
+ if (NULL == GLH_EXT_NAME(glIsTextureEXT))
+ return FALSE;
+ GLH_EXT_NAME(glPrioritizeTexturesEXT) = (PFNGLPRIORITIZETEXTURESEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glPrioritizeTexturesEXT");
+ if (NULL == GLH_EXT_NAME(glPrioritizeTexturesEXT))
+ return FALSE;
+#endif
+
+#ifdef GL_EXT_texture3D
+ } else if (0 == strcmp(extension, "GL_EXT_texture3D")) {
+ GLH_EXT_NAME(glTexImage3DEXT) = (PFNGLTEXIMAGE3DEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glTexImage3DEXT");
+ if (NULL == GLH_EXT_NAME(glTexImage3DEXT))
+ return FALSE;
+#endif
+
+#ifdef GL_EXT_vertex_array
+ } else if (0 == strcmp(extension, "GL_EXT_vertex_array")) {
+ GLH_EXT_NAME(glArrayElementEXT) = (PFNGLARRAYELEMENTEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glArrayElementEXT");
+ if (NULL == GLH_EXT_NAME(glArrayElementEXT))
+ return FALSE;
+ GLH_EXT_NAME(glColorPointerEXT) = (PFNGLCOLORPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glColorPointerEXT");
+ if (NULL == GLH_EXT_NAME(glColorPointerEXT))
+ return FALSE;
+ GLH_EXT_NAME(glEdgeFlagPointerEXT) = (PFNGLEDGEFLAGPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glEdgeFlagPointerEXT");
+ if (NULL == GLH_EXT_NAME(glEdgeFlagPointerEXT))
+ return FALSE;
+ GLH_EXT_NAME(glGetPointervEXT) = (PFNGLGETPOINTERVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGetPointervEXT");
+ if (NULL == GLH_EXT_NAME(glGetPointervEXT))
+ return FALSE;
+ GLH_EXT_NAME(glIndexPointerEXT) = (PFNGLINDEXPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glIndexPointerEXT");
+ if (NULL == GLH_EXT_NAME(glIndexPointerEXT))
+ return FALSE;
+ GLH_EXT_NAME(glNormalPointerEXT) = (PFNGLNORMALPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glNormalPointerEXT");
+ if (NULL == GLH_EXT_NAME(glNormalPointerEXT))
+ return FALSE;
+ GLH_EXT_NAME(glTexCoordPointerEXT) = (PFNGLTEXCOORDPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glTexCoordPointerEXT");
+ if (NULL == GLH_EXT_NAME(glTexCoordPointerEXT))
+ return FALSE;
+ GLH_EXT_NAME(glVertexPointerEXT) = (PFNGLVERTEXPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexPointerEXT");
+ if (NULL == GLH_EXT_NAME(glVertexPointerEXT))
+ return FALSE;
+ GLH_EXT_NAME(glDrawArraysEXT) = (PFNGLDRAWARRAYSEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawArraysEXT");
+ if (NULL == GLH_EXT_NAME(glDrawArraysEXT))
+ return FALSE;
+#endif
+
+#ifdef GL_EXT_vertex_weighting
+ } else if (0 == strcmp(extension, "GL_EXT_vertex_weighting")) {
+ GLH_EXT_NAME(glVertexWeightfEXT) = (PFNGLVERTEXWEIGHTFEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexWeightfEXT");
+ if (NULL == GLH_EXT_NAME(glVertexWeightfEXT))
+ return FALSE;
+ GLH_EXT_NAME(glVertexWeightfvEXT) = (PFNGLVERTEXWEIGHTFVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexWeightfvEXT");
+ if (NULL == GLH_EXT_NAME(glVertexWeightfvEXT))
+ return FALSE;
+ GLH_EXT_NAME(glVertexWeightPointerEXT) = (PFNGLVERTEXWEIGHTPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexWeightPointerEXT");
+ if (NULL == GLH_EXT_NAME(glVertexWeightPointerEXT))
+ return FALSE;
+#endif
+
+#ifdef GL_NV_blend_square
+ } else if (0 == strcmp(extension, "GL_NV_blend_square")) {
+#endif
+
+#ifdef GL_NV_evaluators
+ } else if (0 == strcmp(extension, "GL_NV_evaluators")) {
+ GLH_EXT_NAME(glMapControlPointsNV) = (PFNGLMAPCONTROLPOINTSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glMapControlPointsNV");
+ if (NULL == GLH_EXT_NAME(glMapControlPointsNV))
+ return FALSE;
+ GLH_EXT_NAME(glMapParameterivNV) = (PFNGLMAPPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glMapParameterivNV");
+ if (NULL == GLH_EXT_NAME(glMapParameterivNV))
+ return FALSE;
+ GLH_EXT_NAME(glMapParameterfvNV) = (PFNGLMAPPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glMapParameterfvNV");
+ if (NULL == GLH_EXT_NAME(glMapParameterfvNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetMapControlPointsNV) = (PFNGLGETMAPCONTROLPOINTSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapControlPointsNV");
+ if (NULL == GLH_EXT_NAME(glGetMapControlPointsNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetMapParameterivNV) = (PFNGLGETMAPPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapParameterivNV");
+ if (NULL == GLH_EXT_NAME(glGetMapParameterivNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetMapParameterfvNV) = (PFNGLGETMAPPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapParameterfvNV");
+ if (NULL == GLH_EXT_NAME(glGetMapParameterfvNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetMapAttribParameterivNV) = (PFNGLGETMAPATTRIBPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapAttribParameterivNV");
+ if (NULL == GLH_EXT_NAME(glGetMapAttribParameterivNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetMapAttribParameterfvNV) = (PFNGLGETMAPATTRIBPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapAttribParameterfvNV");
+ if (NULL == GLH_EXT_NAME(glGetMapAttribParameterfvNV))
+ return FALSE;
+ GLH_EXT_NAME(glEvalMapsNV) = (PFNGLEVALMAPSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glEvalMapsNV");
+ if (NULL == GLH_EXT_NAME(glEvalMapsNV))
+ return FALSE;
+#endif
+
+#ifdef GL_NV_fence
+ } else if (0 == strcmp(extension, "GL_NV_fence")) {
+ GLH_EXT_NAME(glGenFencesNV) = (PFNGLGENFENCESNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGenFencesNV");
+ if (NULL == GLH_EXT_NAME(glGenFencesNV))
+ return FALSE;
+ GLH_EXT_NAME(glDeleteFencesNV) = (PFNGLDELETEFENCESNVPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteFencesNV");
+ if (NULL == GLH_EXT_NAME(glDeleteFencesNV))
+ return FALSE;
+ GLH_EXT_NAME(glSetFenceNV) = (PFNGLSETFENCENVPROC)GLH_EXT_GET_PROC_ADDRESS("glSetFenceNV");
+ if (NULL == GLH_EXT_NAME(glSetFenceNV))
+ return FALSE;
+ GLH_EXT_NAME(glTestFenceNV) = (PFNGLTESTFENCENVPROC)GLH_EXT_GET_PROC_ADDRESS("glTestFenceNV");
+ if (NULL == GLH_EXT_NAME(glTestFenceNV))
+ return FALSE;
+ GLH_EXT_NAME(glFinishFenceNV) = (PFNGLFINISHFENCENVPROC)GLH_EXT_GET_PROC_ADDRESS("glFinishFenceNV");
+ if (NULL == GLH_EXT_NAME(glFinishFenceNV))
+ return FALSE;
+ GLH_EXT_NAME(glIsFenceNV) = (PFNGLISFENCENVPROC)GLH_EXT_GET_PROC_ADDRESS("glIsFenceNV");
+ if (NULL == GLH_EXT_NAME(glIsFenceNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetFenceivNV) = (PFNGLGETFENCEIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetFenceivNV");
+ if (NULL == GLH_EXT_NAME(glGetFenceivNV))
+ return FALSE;
+#endif
+
+#ifdef GL_NV_fog_distance
+ } else if (0 == strcmp(extension, "GL_NV_fog_distance")) {
+#endif
+
+#ifdef GL_NV_packed_depth_stencil
+ } else if (0 == strcmp(extension, "GL_NV_packed_depth_stencil")) {
+#endif
+
+#ifdef GL_NV_register_combiners
+ } else if (0 == strcmp(extension, "GL_NV_register_combiners")) {
+ GLH_EXT_NAME(glCombinerParameterfvNV) = (PFNGLCOMBINERPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerParameterfvNV");
+ if (NULL == GLH_EXT_NAME(glCombinerParameterfvNV))
+ return FALSE;
+ GLH_EXT_NAME(glCombinerParameterfNV) = (PFNGLCOMBINERPARAMETERFNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerParameterfNV");
+ if (NULL == GLH_EXT_NAME(glCombinerParameterfNV))
+ return FALSE;
+ GLH_EXT_NAME(glCombinerParameterivNV) = (PFNGLCOMBINERPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerParameterivNV");
+ if (NULL == GLH_EXT_NAME(glCombinerParameterivNV))
+ return FALSE;
+ GLH_EXT_NAME(glCombinerParameteriNV) = (PFNGLCOMBINERPARAMETERINVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerParameteriNV");
+ if (NULL == GLH_EXT_NAME(glCombinerParameteriNV))
+ return FALSE;
+ GLH_EXT_NAME(glCombinerInputNV) = (PFNGLCOMBINERINPUTNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerInputNV");
+ if (NULL == GLH_EXT_NAME(glCombinerInputNV))
+ return FALSE;
+ GLH_EXT_NAME(glCombinerOutputNV) = (PFNGLCOMBINEROUTPUTNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerOutputNV");
+ if (NULL == GLH_EXT_NAME(glCombinerOutputNV))
+ return FALSE;
+ GLH_EXT_NAME(glFinalCombinerInputNV) = (PFNGLFINALCOMBINERINPUTNVPROC)GLH_EXT_GET_PROC_ADDRESS("glFinalCombinerInputNV");
+ if (NULL == GLH_EXT_NAME(glFinalCombinerInputNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetCombinerInputParameterfvNV) = (PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerInputParameterfvNV");
+ if (NULL == GLH_EXT_NAME(glGetCombinerInputParameterfvNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetCombinerInputParameterivNV) = (PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerInputParameterivNV");
+ if (NULL == GLH_EXT_NAME(glGetCombinerInputParameterivNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetCombinerOutputParameterfvNV) = (PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerOutputParameterfvNV");
+ if (NULL == GLH_EXT_NAME(glGetCombinerOutputParameterfvNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetCombinerOutputParameterivNV) = (PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerOutputParameterivNV");
+ if (NULL == GLH_EXT_NAME(glGetCombinerOutputParameterivNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetFinalCombinerInputParameterfvNV) = (PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetFinalCombinerInputParameterfvNV");
+ if (NULL == GLH_EXT_NAME(glGetFinalCombinerInputParameterfvNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetFinalCombinerInputParameterivNV) = (PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetFinalCombinerInputParameterivNV");
+ if (NULL == GLH_EXT_NAME(glGetFinalCombinerInputParameterivNV))
+ return FALSE;
+#endif
+
+#ifdef GL_NV_register_combiners2
+ } else if (0 == strcmp(extension, "GL_NV_register_combiners2")) {
+ GLH_EXT_NAME(glCombinerStageParameterfvNV) = (PFNGLCOMBINERSTAGEPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerStageParameterfvNV");
+ if (NULL == GLH_EXT_NAME(glCombinerStageParameterfvNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetCombinerStageParameterfvNV) = (PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerStageParameterfvNV");
+ if (NULL == GLH_EXT_NAME(glGetCombinerStageParameterfvNV))
+ return FALSE;
+#endif
+
+#ifdef GL_NV_texgen_reflection
+ } else if (0 == strcmp(extension, "GL_NV_texgen_reflection")) {
+#endif
+
+#ifdef GL_NV_texture_env_combine4
+ } else if (0 == strcmp(extension, "GL_NV_texture_env_combine4")) {
+#endif
+
+#ifdef GL_NV_texture_rectangle
+ } else if (0 == strcmp(extension, "GL_NV_texture_rectangle")) {
+#endif
+
+#ifdef GL_NV_texture_shader
+ } else if (0 == strcmp(extension, "GL_NV_texture_shader")) {
+#endif
+
+#ifdef GL_NV_vertex_array_range
+ } else if (0 == strcmp(extension, "GL_NV_vertex_array_range")) {
+ GLH_EXT_NAME(glFlushVertexArrayRangeNV) = (PFNGLFLUSHVERTEXARRAYRANGENVPROC)GLH_EXT_GET_PROC_ADDRESS("glFlushVertexArrayRangeNV");
+ if (NULL == GLH_EXT_NAME(glFlushVertexArrayRangeNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexArrayRangeNV) = (PFNGLVERTEXARRAYRANGENVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexArrayRangeNV");
+ if (NULL == GLH_EXT_NAME(glVertexArrayRangeNV))
+ return FALSE;
+# ifdef _WIN32
+ GLH_EXT_NAME(wglAllocateMemoryNV) = (PFNWGLALLOCATEMEMORYNVPROC)GLH_EXT_GET_PROC_ADDRESS("wglAllocateMemoryNV");
+ if (NULL == GLH_EXT_NAME(wglAllocateMemoryNV))
+ return FALSE;
+# endif
+# ifdef GLX_VERSION_1_3
+ GLH_EXT_NAME(glXAllocateMemoryNV) = (PFNGLXALLOCATEMEMORYNVPROC)GLH_EXT_GET_PROC_ADDRESS("glXAllocateMemoryNV");
+ if (NULL == GLH_EXT_NAME(glXAllocateMemoryNV))
+ return FALSE;
+# endif
+# ifdef _WIN32
+ GLH_EXT_NAME(wglFreeMemoryNV) = (PFNWGLFREEMEMORYNVPROC)GLH_EXT_GET_PROC_ADDRESS("wglFreeMemoryNV");
+ if (NULL == GLH_EXT_NAME(wglFreeMemoryNV))
+ return FALSE;
+# endif
+# ifdef GLX_VERSION_1_3
+ GLH_EXT_NAME(glXFreeMemoryNV) = (PFNGLXFREEMEMORYNVPROC)GLH_EXT_GET_PROC_ADDRESS("glXFreeMemoryNV");
+ if (NULL == GLH_EXT_NAME(glXFreeMemoryNV))
+ return FALSE;
+# endif
+#endif
+
+#ifdef GL_NV_vertex_program
+ } else if (0 == strcmp(extension, "GL_NV_vertex_program")) {
+ GLH_EXT_NAME(glAreProgramsResidentNV) = (PFNGLAREPROGRAMSRESIDENTNVPROC)GLH_EXT_GET_PROC_ADDRESS("glAreProgramsResidentNV");
+ if (NULL == GLH_EXT_NAME(glAreProgramsResidentNV))
+ return FALSE;
+ GLH_EXT_NAME(glBindProgramNV) = (PFNGLBINDPROGRAMNVPROC)GLH_EXT_GET_PROC_ADDRESS("glBindProgramNV");
+ if (NULL == GLH_EXT_NAME(glBindProgramNV))
+ return FALSE;
+ GLH_EXT_NAME(glDeleteProgramsNV) = (PFNGLDELETEPROGRAMSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteProgramsNV");
+ if (NULL == GLH_EXT_NAME(glDeleteProgramsNV))
+ return FALSE;
+ GLH_EXT_NAME(glExecuteProgramNV) = (PFNGLEXECUTEPROGRAMNVPROC)GLH_EXT_GET_PROC_ADDRESS("glExecuteProgramNV");
+ if (NULL == GLH_EXT_NAME(glExecuteProgramNV))
+ return FALSE;
+ GLH_EXT_NAME(glGenProgramsNV) = (PFNGLGENPROGRAMSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGenProgramsNV");
+ if (NULL == GLH_EXT_NAME(glGenProgramsNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetProgramParameterdvNV) = (PFNGLGETPROGRAMPARAMETERDVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramParameterdvNV");
+ if (NULL == GLH_EXT_NAME(glGetProgramParameterdvNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetProgramParameterfvNV) = (PFNGLGETPROGRAMPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramParameterfvNV");
+ if (NULL == GLH_EXT_NAME(glGetProgramParameterfvNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetProgramivNV) = (PFNGLGETPROGRAMIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramivNV");
+ if (NULL == GLH_EXT_NAME(glGetProgramivNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetProgramStringNV) = (PFNGLGETPROGRAMSTRINGNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramStringNV");
+ if (NULL == GLH_EXT_NAME(glGetProgramStringNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetTrackMatrixivNV) = (PFNGLGETTRACKMATRIXIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetTrackMatrixivNV");
+ if (NULL == GLH_EXT_NAME(glGetTrackMatrixivNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetVertexAttribdvNV) = (PFNGLGETVERTEXATTRIBDVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribdvNV");
+ if (NULL == GLH_EXT_NAME(glGetVertexAttribdvNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetVertexAttribfvNV) = (PFNGLGETVERTEXATTRIBFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribfvNV");
+ if (NULL == GLH_EXT_NAME(glGetVertexAttribfvNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetVertexAttribivNV) = (PFNGLGETVERTEXATTRIBIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribivNV");
+ if (NULL == GLH_EXT_NAME(glGetVertexAttribivNV))
+ return FALSE;
+ GLH_EXT_NAME(glGetVertexAttribPointervNV) = (PFNGLGETVERTEXATTRIBPOINTERVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribPointervNV");
+ if (NULL == GLH_EXT_NAME(glGetVertexAttribPointervNV))
+ return FALSE;
+ GLH_EXT_NAME(glIsProgramNV) = (PFNGLISPROGRAMNVPROC)GLH_EXT_GET_PROC_ADDRESS("glIsProgramNV");
+ if (NULL == GLH_EXT_NAME(glIsProgramNV))
+ return FALSE;
+ GLH_EXT_NAME(glLoadProgramNV) = (PFNGLLOADPROGRAMNVPROC)GLH_EXT_GET_PROC_ADDRESS("glLoadProgramNV");
+ if (NULL == GLH_EXT_NAME(glLoadProgramNV))
+ return FALSE;
+ GLH_EXT_NAME(glProgramParameter4dNV) = (PFNGLPROGRAMPARAMETER4DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameter4dNV");
+ if (NULL == GLH_EXT_NAME(glProgramParameter4dNV))
+ return FALSE;
+ GLH_EXT_NAME(glProgramParameter4dvNV) = (PFNGLPROGRAMPARAMETER4DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameter4dvNV");
+ if (NULL == GLH_EXT_NAME(glProgramParameter4dvNV))
+ return FALSE;
+ GLH_EXT_NAME(glProgramParameter4fNV) = (PFNGLPROGRAMPARAMETER4FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameter4fNV");
+ if (NULL == GLH_EXT_NAME(glProgramParameter4fNV))
+ return FALSE;
+ GLH_EXT_NAME(glProgramParameter4fvNV) = (PFNGLPROGRAMPARAMETER4FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameter4fvNV");
+ if (NULL == GLH_EXT_NAME(glProgramParameter4fvNV))
+ return FALSE;
+ GLH_EXT_NAME(glProgramParameters4dvNV) = (PFNGLPROGRAMPARAMETERS4DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameters4dvNV");
+ if (NULL == GLH_EXT_NAME(glProgramParameters4dvNV))
+ return FALSE;
+ GLH_EXT_NAME(glProgramParameters4fvNV) = (PFNGLPROGRAMPARAMETERS4FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameters4fvNV");
+ if (NULL == GLH_EXT_NAME(glProgramParameters4fvNV))
+ return FALSE;
+ GLH_EXT_NAME(glRequestResidentProgramsNV) = (PFNGLREQUESTRESIDENTPROGRAMSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glRequestResidentProgramsNV");
+ if (NULL == GLH_EXT_NAME(glRequestResidentProgramsNV))
+ return FALSE;
+ GLH_EXT_NAME(glTrackMatrixNV) = (PFNGLTRACKMATRIXNVPROC)GLH_EXT_GET_PROC_ADDRESS("glTrackMatrixNV");
+ if (NULL == GLH_EXT_NAME(glTrackMatrixNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribPointerNV) = (PFNGLVERTEXATTRIBPOINTERNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribPointerNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribPointerNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib1dNV) = (PFNGLVERTEXATTRIB1DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib1dNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib1dvNV) = (PFNGLVERTEXATTRIB1DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib1dvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib1fNV) = (PFNGLVERTEXATTRIB1FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib1fNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib1fvNV) = (PFNGLVERTEXATTRIB1FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib1fvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib1sNV) = (PFNGLVERTEXATTRIB1SNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1sNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib1sNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib1svNV) = (PFNGLVERTEXATTRIB1SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1svNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib1svNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib2dNV) = (PFNGLVERTEXATTRIB2DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib2dNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib2dvNV) = (PFNGLVERTEXATTRIB2DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib2dvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib2fNV) = (PFNGLVERTEXATTRIB2FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib2fNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib2fvNV) = (PFNGLVERTEXATTRIB2FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib2fvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib2sNV) = (PFNGLVERTEXATTRIB2SNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2sNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib2sNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib2svNV) = (PFNGLVERTEXATTRIB2SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2svNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib2svNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib3dNV) = (PFNGLVERTEXATTRIB3DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib3dNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib3dvNV) = (PFNGLVERTEXATTRIB3DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib3dvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib3fNV) = (PFNGLVERTEXATTRIB3FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib3fNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib3fvNV) = (PFNGLVERTEXATTRIB3FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib3fvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib3sNV) = (PFNGLVERTEXATTRIB3SNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3sNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib3sNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib3svNV) = (PFNGLVERTEXATTRIB3SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3svNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib3svNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib4dNV) = (PFNGLVERTEXATTRIB4DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4dNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib4dvNV) = (PFNGLVERTEXATTRIB4DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4dvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib4fNV) = (PFNGLVERTEXATTRIB4FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4fNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib4fvNV) = (PFNGLVERTEXATTRIB4FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4fvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib4sNV) = (PFNGLVERTEXATTRIB4SNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4sNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4sNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib4svNV) = (PFNGLVERTEXATTRIB4SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4svNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4svNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttrib4ubvNV) = (PFNGLVERTEXATTRIB4UBVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4ubvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttrib4ubvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs1dvNV) = (PFNGLVERTEXATTRIBS1DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs1dvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs1dvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs1fvNV) = (PFNGLVERTEXATTRIBS1FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs1fvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs1fvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs1svNV) = (PFNGLVERTEXATTRIBS1SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs1svNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs1svNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs2dvNV) = (PFNGLVERTEXATTRIBS2DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs2dvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs2dvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs2fvNV) = (PFNGLVERTEXATTRIBS2FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs2fvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs2fvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs2svNV) = (PFNGLVERTEXATTRIBS2SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs2svNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs2svNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs3dvNV) = (PFNGLVERTEXATTRIBS3DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs3dvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs3dvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs3fvNV) = (PFNGLVERTEXATTRIBS3FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs3fvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs3fvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs3svNV) = (PFNGLVERTEXATTRIBS3SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs3svNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs3svNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs4dvNV) = (PFNGLVERTEXATTRIBS4DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs4dvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs4dvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs4fvNV) = (PFNGLVERTEXATTRIBS4FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs4fvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs4fvNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs4svNV) = (PFNGLVERTEXATTRIBS4SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs4svNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs4svNV))
+ return FALSE;
+ GLH_EXT_NAME(glVertexAttribs4ubvNV) = (PFNGLVERTEXATTRIBS4UBVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs4ubvNV");
+ if (NULL == GLH_EXT_NAME(glVertexAttribs4ubvNV))
+ return FALSE;
+#endif
+
+#ifdef GL_SGIS_generate_mipmap
+ } else if (0 == strcmp(extension, "GL_SGIS_generate_mipmap")) {
+#endif
+
+#ifdef GL_SGIS_texture_lod
+ } else if (0 == strcmp(extension, "GL_SGIS_texture_lod")) {
+#endif
+
+#ifdef GL_SGIX_depth_texture
+ } else if (0 == strcmp(extension, "GL_SGIX_depth_texture")) {
+#endif
+
+#ifdef GL_SGIX_shadow
+ } else if (0 == strcmp(extension, "GL_SGIX_shadow")) {
+#endif
+
+#ifdef GL_VERSION_1_2
+ } else if (0 == strcmp(extension, "GL_VERSION_1_2")) {
+ GLH_CORE_1_2_NAME(glBlendColor) = (PFNGLBLENDCOLORPROC)GLH_EXT_GET_PROC_ADDRESS("glBlendColor");
+ if (NULL == GLH_CORE_1_2_NAME(glBlendColor))
+ return FALSE;
+ GLH_CORE_1_2_NAME(glBlendEquation) = (PFNGLBLENDEQUATIONPROC)GLH_EXT_GET_PROC_ADDRESS("glBlendEquation");
+ if (NULL == GLH_CORE_1_2_NAME(glBlendEquation))
+ return FALSE;
+ GLH_CORE_1_2_NAME(glDrawRangeElements) = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements");
+ if (NULL == GLH_CORE_1_2_NAME(glDrawRangeElements))
+ return FALSE;
+ GLH_CORE_1_2_NAME(glColorTable) = (PFNGLCOLORTABLEPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTable");
+ if (NULL == GLH_CORE_1_2_NAME(glColorTable))
+ return FALSE;
+ GLH_CORE_1_2_NAME(glColorTableParameterfv) = (PFNGLCOLORTABLEPARAMETERFVPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTableParameterfv");
+ if (NULL == GLH_CORE_1_2_NAME(glColorTableParameterfv))
+ return FALSE;
+ GLH_CORE_1_2_NAME(glColorTableParameteriv) = (PFNGLCOLORTABLEPARAMETERIVPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTableParameteriv");
+ if (NULL == GLH_CORE_1_2_NAME(glColorTableParameteriv))
+ return FALSE;
+ GLH_CORE_1_2_NAME(glCopyColorTable) = (PFNGLCOPYCOLORTABLEPROC)GLH_EXT_GET_PROC_ADDRESS("glCopyColorTable");
+ if (NULL == GLH_CORE_1_2_NAME(glCopyColorTable))
+ return FALSE;
+ GLH_CORE_1_2_NAME(glGetColorTable) = (PFNGLGETCOLORTABLEPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTable");
+ if (NULL == GLH_CORE_1_2_NAME(glGetColorTable))
+ return FALSE;
+ GLH_CORE_1_2_NAME(glGetColorTableParameterfv) = (PFNGLGETCOLORTABLEPARAMETERFVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableParameterfv");
+ if (NULL == GLH_CORE_1_2_NAME(glGetColorTableParameterfv))
+ return FALSE;
+ GLH_CORE_1_2_NAME(glGetColorTableParameteriv) = (PFNGLGETCOLORTABLEPARAMETERIVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableParameteriv");
+ if (NULL == GLH_CORE_1_2_NAME(glGetColorTableParameteriv))
+ return FALSE;
+ GLH_CORE_1_2_NAME(glTexImage3D) = (PFNGLTEXIMAGE3DPROC)GLH_EXT_GET_PROC_ADDRESS("glTexImage3D");
+ if (NULL == GLH_CORE_1_2_NAME(glTexImage3D))
+ return FALSE;
+ GLH_CORE_1_2_NAME(glTexSubImage3D) = (PFNGLTEXSUBIMAGE3DPROC)GLH_EXT_GET_PROC_ADDRESS("glTexSubImage3D");
+ if (NULL == GLH_CORE_1_2_NAME(glTexSubImage3D))
+ return FALSE;
+ GLH_CORE_1_2_NAME(glCopyTexSubImage3D) = (PFNGLCOPYTEXSUBIMAGE3DPROC)GLH_EXT_GET_PROC_ADDRESS("glCopyTexSubImage3D");
+ if (NULL == GLH_CORE_1_2_NAME(glCopyTexSubImage3D))
+ return FALSE;
+#endif
+
+#ifdef GL_WIN_swap_hint
+ } else if (0 == strcmp(extension, "GL_WIN_swap_hint")) {
+ GLH_EXT_NAME(glAddSwapHintRectWIN) = (PFNGLADDSWAPHINTRECTWINPROC)GLH_EXT_GET_PROC_ADDRESS("glAddSwapHintRectWIN");
+ if (NULL == GLH_EXT_NAME(glAddSwapHintRectWIN))
+ return FALSE;
+#endif
+
+#ifdef WGL_ARB_pbuffer
+ } else if (0 == strcmp(extension, "WGL_ARB_pbuffer")) {
+# ifdef _WIN32
+ GLH_EXT_NAME(wglCreatePbufferARB) = (PFNWGLCREATEPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglCreatePbufferARB");
+ if (NULL == GLH_EXT_NAME(wglCreatePbufferARB))
+ return FALSE;
+# endif
+# ifdef _WIN32
+ GLH_EXT_NAME(wglGetPbufferDCARB) = (PFNWGLGETPBUFFERDCARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetPbufferDCARB");
+ if (NULL == GLH_EXT_NAME(wglGetPbufferDCARB))
+ return FALSE;
+# endif
+# ifdef _WIN32
+ GLH_EXT_NAME(wglReleasePbufferDCARB) = (PFNWGLRELEASEPBUFFERDCARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglReleasePbufferDCARB");
+ if (NULL == GLH_EXT_NAME(wglReleasePbufferDCARB))
+ return FALSE;
+# endif
+# ifdef _WIN32
+ GLH_EXT_NAME(wglDestroyPbufferARB) = (PFNWGLDESTROYPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglDestroyPbufferARB");
+ if (NULL == GLH_EXT_NAME(wglDestroyPbufferARB))
+ return FALSE;
+# endif
+# ifdef _WIN32
+ GLH_EXT_NAME(wglQueryPbufferARB) = (PFNWGLQUERYPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglQueryPbufferARB");
+ if (NULL == GLH_EXT_NAME(wglQueryPbufferARB))
+ return FALSE;
+# endif
+#endif
+
+#ifdef WGL_ARB_render_texture
+# ifdef _WIN32
+ GLH_EXT_NAME(wglBindTexImageARB) = (PFNWGLBINDTEXIMAGEARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglBindTexImageARB");
+ if (NULL == GLH_EXT_NAME(wglBindTexImageARB))
+ return FALSE;
+# endif
+# ifdef _WIN32
+ GLH_EXT_NAME(wglReleaseTexImageARB) = (PFNWGLRELEASETEXIMAGEARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglReleaseTexImageARB");
+ if (NULL == GLH_EXT_NAME(wglReleaseTexImageARB))
+ return FALSE;
+# endif
+# ifdef _WIN32
+ GLH_EXT_NAME(wglSetPbufferAttribARB) = (PFNWGLSETPBUFFERATTRIBARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglSetPbufferAttribARB");
+ if (NULL == GLH_EXT_NAME(wglSetPbufferAttribARB))
+ return FALSE;
+# endif
+#endif
+
+#ifdef WGL_ARB_pixel_format
+ } else if (0 == strcmp(extension, "WGL_ARB_pixel_format")) {
+# ifdef _WIN32
+ GLH_EXT_NAME(wglGetPixelFormatAttribivARB) = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetPixelFormatAttribivARB");
+ if (NULL == GLH_EXT_NAME(wglGetPixelFormatAttribivARB))
+ return FALSE;
+# endif
+# ifdef _WIN32
+ GLH_EXT_NAME(wglGetPixelFormatAttribfvARB) = (PFNWGLGETPIXELFORMATATTRIBFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetPixelFormatAttribfvARB");
+ if (NULL == GLH_EXT_NAME(wglGetPixelFormatAttribfvARB))
+ return FALSE;
+# endif
+# ifdef _WIN32
+ GLH_EXT_NAME(wglChoosePixelFormatARB) = (PFNWGLCHOOSEPIXELFORMATARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglChoosePixelFormatARB");
+ if (NULL == GLH_EXT_NAME(wglChoosePixelFormatARB))
+ return FALSE;
+# endif
+#endif
+
+ } else {
+ return FALSE;
+ }
+ return TRUE;
+}
+#endif
+
+#else // defined(__APPLE__)
+
+#ifdef GLH_EXT_SINGLE_FILE
+
+int glh_init_extension(const char* extension)
+{
+ // MBW -- XXX -- Should this check for extension availability?
+ return TRUE;
+}
+#endif // GLH_EXT_SINGLE_FILE
+
+#endif // defined(__APPLE__)
+
+#undef GLH_EXT_SINGLE_FILE
+
+#endif /* GLH_GENEXT_H */
diff --git a/indra/llwindow/lldragdropwin32.cpp b/indra/llwindow/lldragdropwin32.cpp
new file mode 100644
index 0000000000..d4d444eb28
--- /dev/null
+++ b/indra/llwindow/lldragdropwin32.cpp
@@ -0,0 +1,365 @@
+/**
+ * @file lldragdrop32.cpp
+ * @brief Handler for Windows specific drag and drop (OS to client) code
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#if LL_WINDOWS
+
+#if LL_OS_DRAGDROP_ENABLED
+
+#include "linden_common.h"
+
+#include "llwindowwin32.h"
+#include "llkeyboardwin32.h"
+#include "llwindowcallbacks.h"
+#include "lldragdropwin32.h"
+
+class LLDragDropWin32Target:
+ public IDropTarget
+{
+ public:
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ LLDragDropWin32Target( HWND hWnd ) :
+ mRefCount( 1 ),
+ mAppWindowHandle( hWnd ),
+ mAllowDrop(false),
+ mIsSlurl(false)
+ {
+ };
+
+ virtual ~LLDragDropWin32Target()
+ {
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ ULONG __stdcall AddRef( void )
+ {
+ return InterlockedIncrement( &mRefCount );
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ ULONG __stdcall Release( void )
+ {
+ LONG count = InterlockedDecrement( &mRefCount );
+
+ if ( count == 0 )
+ {
+ delete this;
+ return 0;
+ }
+ else
+ {
+ return count;
+ };
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ HRESULT __stdcall QueryInterface( REFIID iid, void** ppvObject )
+ {
+ if ( iid == IID_IUnknown || iid == IID_IDropTarget )
+ {
+ AddRef();
+ *ppvObject = this;
+ return S_OK;
+ }
+ else
+ {
+ *ppvObject = 0;
+ return E_NOINTERFACE;
+ };
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ HRESULT __stdcall DragEnter( IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect )
+ {
+ FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+
+ // support CF_TEXT using a HGLOBAL?
+ if ( S_OK == pDataObject->QueryGetData( &fmtetc ) )
+ {
+ mAllowDrop = true;
+ mDropUrl = std::string();
+ mIsSlurl = false;
+
+ STGMEDIUM stgmed;
+ if( S_OK == pDataObject->GetData( &fmtetc, &stgmed ) )
+ {
+ PVOID data = GlobalLock( stgmed.hGlobal );
+ mDropUrl = std::string( (char*)data );
+ // XXX MAJOR MAJOR HACK!
+ LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(mAppWindowHandle, GWL_USERDATA);
+ if (NULL != window_imp)
+ {
+ LLCoordGL gl_coord( 0, 0 );
+
+ POINT pt2;
+ pt2.x = pt.x;
+ pt2.y = pt.y;
+ ScreenToClient( mAppWindowHandle, &pt2 );
+
+ LLCoordWindow cursor_coord_window( pt2.x, pt2.y );
+ window_imp->convertCoords(cursor_coord_window, &gl_coord);
+ MASK mask = gKeyboard->currentMask(TRUE);
+
+ LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask,
+ LLWindowCallbacks::DNDA_START_TRACKING, mDropUrl );
+
+ switch (result)
+ {
+ case LLWindowCallbacks::DND_COPY:
+ *pdwEffect = DROPEFFECT_COPY;
+ break;
+ case LLWindowCallbacks::DND_LINK:
+ *pdwEffect = DROPEFFECT_LINK;
+ break;
+ case LLWindowCallbacks::DND_MOVE:
+ *pdwEffect = DROPEFFECT_MOVE;
+ break;
+ case LLWindowCallbacks::DND_NONE:
+ default:
+ *pdwEffect = DROPEFFECT_NONE;
+ break;
+ }
+ };
+
+ GlobalUnlock( stgmed.hGlobal );
+ ReleaseStgMedium( &stgmed );
+ };
+ SetFocus( mAppWindowHandle );
+ }
+ else
+ {
+ mAllowDrop = false;
+ *pdwEffect = DROPEFFECT_NONE;
+ };
+
+ return S_OK;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ HRESULT __stdcall DragOver( DWORD grfKeyState, POINTL pt, DWORD* pdwEffect )
+ {
+ if ( mAllowDrop )
+ {
+ // XXX MAJOR MAJOR HACK!
+ LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(mAppWindowHandle, GWL_USERDATA);
+ if (NULL != window_imp)
+ {
+ LLCoordGL gl_coord( 0, 0 );
+
+ POINT pt2;
+ pt2.x = pt.x;
+ pt2.y = pt.y;
+ ScreenToClient( mAppWindowHandle, &pt2 );
+
+ LLCoordWindow cursor_coord_window( pt2.x, pt2.y );
+ window_imp->convertCoords(cursor_coord_window, &gl_coord);
+ MASK mask = gKeyboard->currentMask(TRUE);
+
+ LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask,
+ LLWindowCallbacks::DNDA_TRACK, mDropUrl );
+
+ switch (result)
+ {
+ case LLWindowCallbacks::DND_COPY:
+ *pdwEffect = DROPEFFECT_COPY;
+ break;
+ case LLWindowCallbacks::DND_LINK:
+ *pdwEffect = DROPEFFECT_LINK;
+ break;
+ case LLWindowCallbacks::DND_MOVE:
+ *pdwEffect = DROPEFFECT_MOVE;
+ break;
+ case LLWindowCallbacks::DND_NONE:
+ default:
+ *pdwEffect = DROPEFFECT_NONE;
+ break;
+ }
+ };
+ }
+ else
+ {
+ *pdwEffect = DROPEFFECT_NONE;
+ };
+
+ return S_OK;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ HRESULT __stdcall DragLeave( void )
+ {
+ // XXX MAJOR MAJOR HACK!
+ LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(mAppWindowHandle, GWL_USERDATA);
+ if (NULL != window_imp)
+ {
+ LLCoordGL gl_coord( 0, 0 );
+ MASK mask = gKeyboard->currentMask(TRUE);
+ window_imp->completeDragNDropRequest( gl_coord, mask, LLWindowCallbacks::DNDA_STOP_TRACKING, mDropUrl );
+ };
+ return S_OK;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ HRESULT __stdcall Drop( IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect )
+ {
+ if ( mAllowDrop )
+ {
+ // window impl stored in Window data (neat!)
+ LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong( mAppWindowHandle, GWL_USERDATA );
+ if ( NULL != window_imp )
+ {
+ LLCoordGL gl_coord( 0, 0 );
+
+ POINT pt_client;
+ pt_client.x = pt.x;
+ pt_client.y = pt.y;
+ ScreenToClient( mAppWindowHandle, &pt_client );
+
+ LLCoordWindow cursor_coord_window( pt_client.x, pt_client.y );
+ window_imp->convertCoords(cursor_coord_window, &gl_coord);
+ llinfos << "### (Drop) URL is: " << mDropUrl << llendl;
+ llinfos << "### raw coords are: " << pt.x << " x " << pt.y << llendl;
+ llinfos << "### client coords are: " << pt_client.x << " x " << pt_client.y << llendl;
+ llinfos << "### GL coords are: " << gl_coord.mX << " x " << gl_coord.mY << llendl;
+ llinfos << llendl;
+
+ // no keyboard modifier option yet but we could one day
+ MASK mask = gKeyboard->currentMask( TRUE );
+
+ // actually do the drop
+ LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask,
+ LLWindowCallbacks::DNDA_DROPPED, mDropUrl );
+
+ switch (result)
+ {
+ case LLWindowCallbacks::DND_COPY:
+ *pdwEffect = DROPEFFECT_COPY;
+ break;
+ case LLWindowCallbacks::DND_LINK:
+ *pdwEffect = DROPEFFECT_LINK;
+ break;
+ case LLWindowCallbacks::DND_MOVE:
+ *pdwEffect = DROPEFFECT_MOVE;
+ break;
+ case LLWindowCallbacks::DND_NONE:
+ default:
+ *pdwEffect = DROPEFFECT_NONE;
+ break;
+ }
+ };
+ }
+ else
+ {
+ *pdwEffect = DROPEFFECT_NONE;
+ };
+
+ return S_OK;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ private:
+ LONG mRefCount;
+ HWND mAppWindowHandle;
+ bool mAllowDrop;
+ std::string mDropUrl;
+ bool mIsSlurl;
+ friend class LLWindowWin32;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+//
+LLDragDropWin32::LLDragDropWin32() :
+ mDropTarget( NULL ),
+ mDropWindowHandle( NULL )
+
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+LLDragDropWin32::~LLDragDropWin32()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+bool LLDragDropWin32::init( HWND hWnd )
+{
+ if ( NOERROR != OleInitialize( NULL ) )
+ return FALSE;
+
+ mDropTarget = new LLDragDropWin32Target( hWnd );
+ if ( mDropTarget )
+ {
+ HRESULT result = CoLockObjectExternal( mDropTarget, TRUE, FALSE );
+ if ( S_OK == result )
+ {
+ result = RegisterDragDrop( hWnd, mDropTarget );
+ if ( S_OK != result )
+ {
+ // RegisterDragDrop failed
+ return false;
+ };
+
+ // all ok
+ mDropWindowHandle = hWnd;
+ }
+ else
+ {
+ // Unable to lock OLE object
+ return false;
+ };
+ };
+
+ // success
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+void LLDragDropWin32::reset()
+{
+ if ( mDropTarget )
+ {
+ RevokeDragDrop( mDropWindowHandle );
+ CoLockObjectExternal( mDropTarget, FALSE, TRUE );
+ mDropTarget->Release();
+ };
+
+ OleUninitialize();
+}
+
+#endif // LL_OS_DRAGDROP_ENABLED
+
+#endif // LL_WINDOWS
+
diff --git a/indra/llwindow/lldragdropwin32.h b/indra/llwindow/lldragdropwin32.h
new file mode 100644
index 0000000000..929e7f9e37
--- /dev/null
+++ b/indra/llwindow/lldragdropwin32.h
@@ -0,0 +1,74 @@
+/**
+ * @file lldragdrop32.cpp
+ * @brief Handler for Windows specific drag and drop (OS to client) code
+ *
+ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#if LL_WINDOWS
+
+#if LL_OS_DRAGDROP_ENABLED
+
+#ifndef LL_LLDRAGDROP32_H
+#define LL_LLDRAGDROP32_H
+
+#include <windows.h>
+#include <ole2.h>
+
+class LLDragDropWin32
+{
+ public:
+ LLDragDropWin32();
+ ~LLDragDropWin32();
+
+ bool init( HWND hWnd );
+ void reset();
+
+ private:
+ IDropTarget* mDropTarget;
+ HWND mDropWindowHandle;
+};
+#endif // LL_LLDRAGDROP32_H
+
+#else // LL_OS_DRAGDROP_ENABLED
+
+#ifndef LL_LLDRAGDROP32_H
+#define LL_LLDRAGDROP32_H
+
+#include <windows.h>
+#include <ole2.h>
+
+// imposter class that does nothing
+class LLDragDropWin32
+{
+ public:
+ LLDragDropWin32() {};
+ ~LLDragDropWin32() {};
+
+ bool init( HWND hWnd ) { return false; };
+ void reset() { };
+};
+#endif // LL_LLDRAGDROP32_H
+
+#endif // LL_OS_DRAGDROP_ENABLED
+
+#endif // LL_WINDOWS
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp
index ab43e6d7d9..3579b5d42f 100644
--- a/indra/llwindow/lldxhardware.cpp
+++ b/indra/llwindow/lldxhardware.cpp
@@ -2,30 +2,25 @@
* @file lldxhardware.cpp
* @brief LLDXHardware implementation
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,6 +41,7 @@
#include "llstring.h"
#include "llstl.h"
+#include "lltimer.h"
void (*gWriteDebug)(const char* msg) = NULL;
LLDXHardware gDXHardware;
@@ -150,7 +146,7 @@ S32 LLVersion::getField(const S32 field_num)
}
}
-LLString LLDXDriverFile::dump()
+std::string LLDXDriverFile::dump()
{
if (gWriteDebug)
{
@@ -233,10 +229,11 @@ LLDXHardware::LLDXHardware()
void LLDXHardware::cleanup()
{
- for_each(mDevices.begin(), mDevices.end(), DeletePairedPointer());
+ // for_each(mDevices.begin(), mDevices.end(), DeletePairedPointer());
}
-LLString LLDXHardware::dumpDevices()
+/*
+std::string LLDXHardware::dumpDevices()
{
if (gWriteDebug)
{
@@ -284,6 +281,7 @@ LLDXDevice *LLDXHardware::findDevice(const std::string &vendor, const std::strin
return NULL;
}
+*/
BOOL LLDXHardware::getInfo(BOOL vram_only)
{
@@ -296,13 +294,13 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
IDxDiagProvider *dx_diag_providerp = NULL;
IDxDiagContainer *dx_diag_rootp = NULL;
IDxDiagContainer *devices_containerp = NULL;
- IDxDiagContainer *system_device_containerp= NULL;
+ // IDxDiagContainer *system_device_containerp= NULL;
IDxDiagContainer *device_containerp = NULL;
IDxDiagContainer *file_containerp = NULL;
IDxDiagContainer *driver_containerp = NULL;
// CoCreate a IDxDiagProvider*
- llinfos << "CoCreateInstance IID_IDxDiagProvider" << llendl;
+ LL_DEBUGS("AppInit") << "CoCreateInstance IID_IDxDiagProvider" << LL_ENDL;
hr = CoCreateInstance(CLSID_DxDiagProvider,
NULL,
CLSCTX_INPROC_SERVER,
@@ -311,7 +309,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
if (FAILED(hr))
{
- llwarns << "No DXDiag provider found! DirectX 9 not installed!" << llendl;
+ LL_WARNS("AppInit") << "No DXDiag provider found! DirectX 9 not installed!" << LL_ENDL;
gWriteDebug("No DXDiag provider found! DirectX 9 not installed!\n");
goto LCleanup;
}
@@ -329,14 +327,14 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
dx_diag_init_params.bAllowWHQLChecks = TRUE;
dx_diag_init_params.pReserved = NULL;
- llinfos << "dx_diag_providerp->Initialize" << llendl;
+ LL_DEBUGS("AppInit") << "dx_diag_providerp->Initialize" << LL_ENDL;
hr = dx_diag_providerp->Initialize(&dx_diag_init_params);
if(FAILED(hr))
{
goto LCleanup;
}
- llinfos << "dx_diag_providerp->GetRootContainer" << llendl;
+ LL_DEBUGS("AppInit") << "dx_diag_providerp->GetRootContainer" << LL_ENDL;
hr = dx_diag_providerp->GetRootContainer( &dx_diag_rootp );
if(FAILED(hr) || !dx_diag_rootp)
{
@@ -346,7 +344,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
HRESULT hr;
// Get display driver information
- llinfos << "dx_diag_rootp->GetChildContainer" << llendl;
+ LL_DEBUGS("AppInit") << "dx_diag_rootp->GetChildContainer" << LL_ENDL;
hr = dx_diag_rootp->GetChildContainer(L"DxDiag_DisplayDevices", &devices_containerp);
if(FAILED(hr) || !devices_containerp)
{
@@ -354,7 +352,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
}
// Get device 0
- llinfos << "devices_containerp->GetChildContainer" << llendl;
+ LL_DEBUGS("AppInit") << "devices_containerp->GetChildContainer" << LL_ENDL;
hr = devices_containerp->GetChildContainer(L"0", &device_containerp);
if(FAILED(hr) || !device_containerp)
{
@@ -362,28 +360,35 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
}
// Get the English VRAM string
- std::string ram_str = get_string(device_containerp, L"szDisplayMemoryEnglish");
+ {
+ std::string ram_str = get_string(device_containerp, L"szDisplayMemoryEnglish");
- // We don't need the device any more
- SAFE_RELEASE(device_containerp);
+ // We don't need the device any more
+ SAFE_RELEASE(device_containerp);
+
+ // Dump the string as an int into the structure
+ char *stopstring;
+ mVRAM = strtol(ram_str.c_str(), &stopstring, 10);
+ LL_INFOS("AppInit") << "VRAM Detected: " << mVRAM << " DX9 string: " << ram_str << LL_ENDL;
+ }
- // Dump the string as an int into the structure
- char *stopstring;
- mVRAM = strtol(ram_str.c_str(), &stopstring, 10);
- llinfos << "VRAM Detected: " << mVRAM << " DX9 string: " << ram_str << llendl;
-
if (vram_only)
{
ok = TRUE;
goto LCleanup;
}
+
+ /* for now, we ONLY do vram_only the rest of this
+ is commented out, to ensure no-one is tempted
+ to use it
+
// Now let's get device and driver information
// Get the IDxDiagContainer object called "DxDiag_SystemDevices".
// This call may take some time while dxdiag gathers the info.
DWORD num_devices = 0;
WCHAR wszContainer[256];
- llinfos << "dx_diag_rootp->GetChildContainer DxDiag_SystemDevices" << llendl;
+ LL_DEBUGS("AppInit") << "dx_diag_rootp->GetChildContainer DxDiag_SystemDevices" << LL_ENDL;
hr = dx_diag_rootp->GetChildContainer(L"DxDiag_SystemDevices", &system_device_containerp);
if (FAILED(hr))
{
@@ -396,7 +401,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
goto LCleanup;
}
- llinfos << "DX9 iterating over devices" << llendl;
+ LL_DEBUGS("AppInit") << "DX9 iterating over devices" << LL_ENDL;
S32 device_num = 0;
for (device_num = 0; device_num < (S32)num_devices; device_num++)
{
@@ -504,15 +509,16 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
}
SAFE_RELEASE(device_containerp);
}
+ */
}
- dumpDevices();
- ok = TRUE;
-
+ // dumpDevices();
+ ok = TRUE;
+
LCleanup:
if (!ok)
{
- llwarns << "DX9 probe failed" << llendl;
+ LL_WARNS("AppInit") << "DX9 probe failed" << LL_ENDL;
gWriteDebug("DX9 probe failed\n");
}
@@ -526,7 +532,7 @@ LCleanup:
CoUninitialize();
return ok;
-}
+ }
LLSD LLDXHardware::getDisplayInfo()
{
@@ -613,7 +619,37 @@ LLSD LLDXHardware::getDisplayInfo()
ret["DeviceName"] = device_name;
std::string device_driver= get_string(device_containerp, L"szDriverVersion");
ret["DriverVersion"] = device_driver;
- }
+
+ // ATI has a slightly different version string
+ if(device_name.length() >= 4 && device_name.substr(0,4) == "ATI ")
+ {
+ // get the key
+ HKEY hKey;
+ const DWORD RV_SIZE = 100;
+ WCHAR release_version[RV_SIZE];
+
+ // Hard coded registry entry. Using this since it's simpler for now.
+ // And using EnumDisplayDevices to get a registry key also requires
+ // a hard coded Query value.
+ if(ERROR_SUCCESS == RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\ATI Technologies\\CBT"), &hKey))
+ {
+ // get the value
+ DWORD dwType = REG_SZ;
+ DWORD dwSize = sizeof(WCHAR) * RV_SIZE;
+ if(ERROR_SUCCESS == RegQueryValueEx(hKey, TEXT("ReleaseVersion"),
+ NULL, &dwType, (LPBYTE)release_version, &dwSize))
+ {
+ // print the value
+ // windows doesn't guarantee to be null terminated
+ release_version[RV_SIZE - 1] = NULL;
+ ret["DriverVersion"] = utf16str_to_utf8str(release_version);
+
+ }
+ RegCloseKey(hKey);
+ }
+ }
+ }
+
LCleanup:
SAFE_RELEASE(file_containerp);
SAFE_RELEASE(driver_containerp);
diff --git a/indra/llwindow/lldxhardware.h b/indra/llwindow/lldxhardware.h
index e2a255da76..61a32bf0fb 100644
--- a/indra/llwindow/lldxhardware.h
+++ b/indra/llwindow/lldxhardware.h
@@ -2,30 +2,25 @@
* @file lldxhardware.h
* @brief LLDXHardware definition
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -53,7 +48,7 @@ protected:
class LLDXDriverFile
{
public:
- LLString dump();
+ std::string dump();
public:
std::string mFilepath;
@@ -85,6 +80,7 @@ class LLDXHardware
{
public:
LLDXHardware();
+
void setWriteDebugFunc(void (*func)(const char*));
void cleanup();
@@ -100,12 +96,12 @@ public:
// Empty strings indicate that you don't care.
// You can separate multiple devices with '|' chars to indicate you want
// ANY of them to match and return.
- LLDXDevice *findDevice(const std::string &vendor, const std::string &devices);
+ // LLDXDevice *findDevice(const std::string &vendor, const std::string &devices);
- LLString dumpDevices();
+ // std::string dumpDevices();
public:
typedef std::map<std::string, LLDXDevice *> device_map_t;
- device_map_t mDevices;
+ // device_map_t mDevices;
protected:
S32 mVRAM;
};
diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp
index 83abcce3c1..53cecf9d4a 100644
--- a/indra/llwindow/llkeyboard.cpp
+++ b/indra/llwindow/llkeyboard.cpp
@@ -2,30 +2,25 @@
* @file llkeyboard.cpp
* @brief Handler for assignable key bindings
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,8 +28,7 @@
#include "indra_constants.h"
#include "llkeyboard.h"
-#include "llwindow.h"
-
+#include "llwindowcallbacks.h"
//
// Globals
@@ -43,8 +37,10 @@
LLKeyboard *gKeyboard = NULL;
//static
-std::map<KEY,LLString> LLKeyboard::sKeysToNames;
-std::map<LLString,KEY> LLKeyboard::sNamesToKeys;
+std::map<KEY,std::string> LLKeyboard::sKeysToNames;
+std::map<std::string,KEY> LLKeyboard::sNamesToKeys;
+LLKeyStringTranslatorFunc* LLKeyboard::mStringTranslator = NULL; // Used for l10n + PC/Mac/Linux accelerator labeling
+
//
// Class Implementation
@@ -67,6 +63,7 @@ LLKeyboard::LLKeyboard() : mCallbacks(NULL), mNumpadDistinct(ND_NUMLOCK_OFF)
mInsertMode = LL_KIM_INSERT;
mCurTranslatedKey = KEY_NONE;
+ mCurScanKey = KEY_NONE;
addKeyName(' ', "Space" );
addKeyName(KEY_RETURN, "Enter" );
@@ -143,11 +140,11 @@ LLKeyboard::~LLKeyboard()
// nothing
}
-void LLKeyboard::addKeyName(KEY key, const LLString& name)
+void LLKeyboard::addKeyName(KEY key, const std::string& name)
{
sKeysToNames[key] = name;
- LLString nameuc = name;
- LLString::toUpper(nameuc);
+ std::string nameuc = name;
+ LLStringUtil::toUpper(nameuc);
sNamesToKeys[nameuc] = key;
}
@@ -293,9 +290,9 @@ S32 LLKeyboard::getKeyElapsedFrameCount(KEY key)
}
// static
-BOOL LLKeyboard::keyFromString(const LLString& str, KEY *key)
+BOOL LLKeyboard::keyFromString(const std::string& str, KEY *key)
{
- LLString instring(str);
+ std::string instring(str);
size_t length = instring.size();
if (length < 1)
@@ -317,7 +314,7 @@ BOOL LLKeyboard::keyFromString(const LLString& str, KEY *key)
}
}
- LLString::toUpper(instring);
+ LLStringUtil::toUpper(instring);
KEY res = get_if_there(sNamesToKeys, instring, (KEY)0);
if (res != 0)
{
@@ -330,25 +327,91 @@ BOOL LLKeyboard::keyFromString(const LLString& str, KEY *key)
// static
-LLString LLKeyboard::stringFromKey(KEY key)
+std::string LLKeyboard::stringFromKey(KEY key)
{
- LLString res = get_if_there(sKeysToNames, key, LLString::null);
+ std::string res = get_if_there(sKeysToNames, key, std::string());
if (res.empty())
{
char buffer[2]; /* Flawfinder: ignore */
buffer[0] = key;
buffer[1] = '\0';
- res = LLString(buffer);
+ res = std::string(buffer);
}
+
+ LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator;
+ if (trans != NULL)
+ {
+ res = trans(res.c_str());
+ }
+
return res;
}
+//static
+std::string LLKeyboard::stringFromAccelerator( MASK accel_mask, KEY key )
+{
+ std::string res;
+
+ // break early if this is a silly thing to do.
+ if( KEY_NONE == key )
+ {
+ return res;
+ }
+
+ LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator;
+
+ if( trans == NULL )
+ {
+ llerrs << "No mKeyStringTranslator" << llendl;
+ return res;
+ }
+
+ // Append any masks
+#ifdef LL_DARWIN
+ // Standard Mac names for modifier keys in menu equivalents
+ // We could use the symbol characters, but they only exist in certain fonts.
+ if( accel_mask & MASK_CONTROL )
+ {
+ if ( accel_mask & MASK_MAC_CONTROL )
+ {
+ res.append( trans("accel-mac-control") );
+ }
+ else
+ {
+ res.append( trans("accel-mac-command") ); // Symbol would be "\xE2\x8C\x98"
+ }
+ }
+ if( accel_mask & MASK_ALT )
+ res.append( trans("accel-mac-option") ); // Symbol would be "\xE2\x8C\xA5"
+ if( accel_mask & MASK_SHIFT )
+ res.append( trans("accel-mac-shift") ); // Symbol would be "\xE2\x8C\xA7"
+#else
+ if( accel_mask & MASK_CONTROL )
+ res.append( trans("accel-win-control") );
+ if( accel_mask & MASK_ALT )
+ res.append( trans("accel-win-alt") );
+ if( accel_mask & MASK_SHIFT )
+ res.append( trans("accel-win-shift") );
+#endif
+ std::string key_string = LLKeyboard::stringFromKey(key);
+ if ((accel_mask & MASK_NORMALKEYS) &&
+ (key_string[0] == '-' || key_string[0] == '=' || key_string[0] == '+'))
+ {
+ res.append( " " );
+ }
+
+ std::string keystr = stringFromKey( key );
+ res.append( keystr );
+
+ return res;
+}
+
//static
-BOOL LLKeyboard::maskFromString(const LLString& str, MASK *mask)
+BOOL LLKeyboard::maskFromString(const std::string& str, MASK *mask)
{
- LLString instring(str);
+ std::string instring(str);
if (instring == "NONE")
{
*mask = MASK_NONE;
@@ -394,3 +457,10 @@ BOOL LLKeyboard::maskFromString(const LLString& str, MASK *mask)
return FALSE;
}
}
+
+
+//static
+void LLKeyboard::setStringTranslatorFunc( LLKeyStringTranslatorFunc *trans_func )
+{
+ mStringTranslator = trans_func;
+}
diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h
index 55af6fed6f..be16f31abc 100644
--- a/indra/llwindow/llkeyboard.h
+++ b/indra/llwindow/llkeyboard.h
@@ -2,30 +2,25 @@
* @file llkeyboard.h
* @brief Handler for assignable key bindings
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -46,7 +41,8 @@ enum EKeystate
};
typedef void (*LLKeyFunc)(EKeystate keystate);
-
+typedef std::string (LLKeyStringTranslatorFunc)(const char *label);
+
enum EKeyboardInsertMode
{
LL_KIM_INSERT,
@@ -107,10 +103,10 @@ public:
EKeyboardInsertMode getInsertMode() { return mInsertMode; }
void toggleInsertMode();
- static BOOL maskFromString(const LLString& str, MASK *mask); // False on failure
- static BOOL keyFromString(const LLString& str, KEY *key); // False on failure
- static LLString stringFromKey(KEY key);
-
+ static BOOL maskFromString(const std::string& str, MASK *mask); // False on failure
+ static BOOL keyFromString(const std::string& str, KEY *key); // False on failure
+ static std::string stringFromKey(KEY key);
+ static std::string stringFromAccelerator( MASK accel_mask, KEY key );
e_numpad_distinct getNumpadDistinct() { return mNumpadDistinct; }
void setNumpadDistinct(e_numpad_distinct val) { mNumpadDistinct = val; }
@@ -118,8 +114,10 @@ public:
F32 getKeyElapsedTime( KEY key ); // Returns time in seconds since key was pressed.
S32 getKeyElapsedFrameCount( KEY key ); // Returns time in frames since key was pressed.
+ static void setStringTranslatorFunc( LLKeyStringTranslatorFunc *trans_func );
+
protected:
- void addKeyName(KEY key, const LLString& name);
+ void addKeyName(KEY key, const std::string& name);
protected:
std::map<U16, KEY> mTranslateKeyMap; // Map of translations from OS keys to Linden KEYs
@@ -135,12 +133,14 @@ protected:
KEY mCurTranslatedKey;
KEY mCurScanKey; // Used during the scanKeyboard()
+ static LLKeyStringTranslatorFunc* mStringTranslator; // Used for l10n + PC/Mac/Linux accelerator labeling
+
e_numpad_distinct mNumpadDistinct;
EKeyboardInsertMode mInsertMode;
- static std::map<KEY,LLString> sKeysToNames;
- static std::map<LLString,KEY> sNamesToKeys;
+ static std::map<KEY,std::string> sKeysToNames;
+ static std::map<std::string,KEY> sNamesToKeys;
};
extern LLKeyboard *gKeyboard;
diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp
index b415ba43c7..ecc2631669 100644
--- a/indra/llwindow/llkeyboardmacosx.cpp
+++ b/indra/llwindow/llkeyboardmacosx.cpp
@@ -2,30 +2,25 @@
* @file llkeyboardmacosx.cpp
* @brief Handler for assignable key bindings
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +28,7 @@
#include "linden_common.h"
#include "llkeyboardmacosx.h"
-#include "llwindow.h"
+#include "llwindowcallbacks.h"
#include <Carbon/Carbon.h>
diff --git a/indra/llwindow/llkeyboardmacosx.h b/indra/llwindow/llkeyboardmacosx.h
index d897faae6d..f09ff720ce 100644
--- a/indra/llwindow/llkeyboardmacosx.h
+++ b/indra/llwindow/llkeyboardmacosx.h
@@ -2,30 +2,25 @@
* @file llkeyboardmacosx.h
* @brief Handler for assignable key bindings
*
- * $LicenseInfo:firstyear=2004&license=viewergpl$
- *
- * Copyright (c) 2004-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/llwindow/llkeyboardsdl.cpp b/indra/llwindow/llkeyboardsdl.cpp
index d29d917def..4bb9603368 100644
--- a/indra/llwindow/llkeyboardsdl.cpp
+++ b/indra/llwindow/llkeyboardsdl.cpp
@@ -2,30 +2,25 @@
* @file llkeyboardsdl.cpp
* @brief Handler for assignable key bindings
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,7 +28,7 @@
#include "linden_common.h"
#include "llkeyboardsdl.h"
-#include "llwindow.h"
+#include "llwindowcallbacks.h"
#include "SDL/SDL.h"
LLKeyboardSDL::LLKeyboardSDL()
diff --git a/indra/llwindow/llkeyboardsdl.h b/indra/llwindow/llkeyboardsdl.h
index d3a08ed8e6..02a71425f1 100644
--- a/indra/llwindow/llkeyboardsdl.h
+++ b/indra/llwindow/llkeyboardsdl.h
@@ -2,30 +2,25 @@
* @file llkeyboardsdl.h
* @brief Handler for assignable key bindings
*
- * $LicenseInfo:firstyear=2004&license=viewergpl$
- *
- * Copyright (c) 2004-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp
index e8aaa658ca..df78816bd6 100644
--- a/indra/llwindow/llkeyboardwin32.cpp
+++ b/indra/llwindow/llkeyboardwin32.cpp
@@ -2,30 +2,25 @@
* @file llkeyboardwin32.cpp
* @brief Handler for assignable key bindings
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,14 +28,16 @@
#include "linden_common.h"
-#include "llkeyboardwin32.h"
-
-#include "llwindow.h"
-
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
+#include "llkeyboardwin32.h"
+
+#include "llwindowcallbacks.h"
+
+
+
LLKeyboardWin32::LLKeyboardWin32()
{
// Set up key mapping for windows - eventually can read this from a file?
@@ -62,7 +59,7 @@ LLKeyboardWin32::LLKeyboardWin32()
// numpad number keys
for (cur_char = 0x60; cur_char <= 0x69; cur_char++)
{
- mTranslateKeyMap[cur_char] = (KEY)('0' + (0x60 - cur_char));
+ mTranslateKeyMap[cur_char] = (KEY)('0' + (cur_char - 0x60));
}
@@ -77,7 +74,7 @@ LLKeyboardWin32::LLKeyboardWin32()
mTranslateKeyMap[VK_OEM_COMMA] = ',';
mTranslateKeyMap[VK_OEM_MINUS] = '-';
mTranslateKeyMap[VK_OEM_PERIOD] = '.';
- mTranslateKeyMap[VK_OEM_2] = KEY_PAD_DIVIDE;
+ mTranslateKeyMap[VK_OEM_2] = '/';//This used to be KEY_PAD_DIVIDE, but that breaks typing into text fields in media prims
mTranslateKeyMap[VK_OEM_3] = '`';
mTranslateKeyMap[VK_OEM_4] = '[';
mTranslateKeyMap[VK_OEM_5] = '\\';
diff --git a/indra/llwindow/llkeyboardwin32.h b/indra/llwindow/llkeyboardwin32.h
index 10eb4c1353..b7da450164 100644
--- a/indra/llwindow/llkeyboardwin32.h
+++ b/indra/llwindow/llkeyboardwin32.h
@@ -2,30 +2,25 @@
* @file llkeyboardwin32.h
* @brief Handler for assignable key bindings
*
- * $LicenseInfo:firstyear=2004&license=viewergpl$
- *
- * Copyright (c) 2004-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/llwindow/llmousehandler.cpp b/indra/llwindow/llmousehandler.cpp
new file mode 100644
index 0000000000..8695e92f77
--- /dev/null
+++ b/indra/llwindow/llmousehandler.cpp
@@ -0,0 +1,58 @@
+/**
+ * @file llmousehandler.cpp
+ * @brief LLMouseHandler class implementation
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llmousehandler.h"
+
+//virtual
+BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down)
+{
+ BOOL handled = FALSE;
+ if (down)
+ {
+ switch (clicktype)
+ {
+ case CLICK_LEFT: handled = handleMouseDown(x, y, mask); break;
+ case CLICK_RIGHT: handled = handleRightMouseDown(x, y, mask); break;
+ case CLICK_MIDDLE: handled = handleMiddleMouseDown(x, y, mask); break;
+ case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break;
+ default:
+ llwarns << "Unhandled enum." << llendl;
+ }
+ }
+ else
+ {
+ switch (clicktype)
+ {
+ case CLICK_LEFT: handled = handleMouseUp(x, y, mask); break;
+ case CLICK_RIGHT: handled = handleRightMouseUp(x, y, mask); break;
+ case CLICK_MIDDLE: handled = handleMiddleMouseUp(x, y, mask); break;
+ case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break;
+ default:
+ llwarns << "Unhandled enum." << llendl;
+ }
+ }
+ return handled;
+}
diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h
index e3ef37e4e7..bbbc3d4406 100644
--- a/indra/llwindow/llmousehandler.h
+++ b/indra/llwindow/llmousehandler.h
@@ -2,39 +2,35 @@
* @file llmousehandler.h
* @brief LLMouseHandler class definition
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_MOUSEHANDLER_H
#define LL_MOUSEHANDLER_H
-#include "llstring.h"
+#include "linden_common.h"
+#include "llrect.h"
-// Abstract interface.
+// Mostly-abstract interface.
// Intended for use via multiple inheritance.
// A class may have as many interfaces as it likes, but never needs to inherit one more than once.
@@ -43,21 +39,35 @@ class LLMouseHandler
public:
LLMouseHandler() {}
virtual ~LLMouseHandler() {}
-
+
+ typedef enum {
+ SHOW_NEVER,
+ SHOW_IF_NOT_BLOCKED,
+ SHOW_ALWAYS,
+ } EShowToolTip;
+
+ typedef enum {
+ CLICK_LEFT,
+ CLICK_MIDDLE,
+ CLICK_RIGHT,
+ CLICK_DOUBLELEFT
+ } EClickType;
+
+ virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down);
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0;
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0;
- virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0;
- virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0;
- virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0;
+ virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0;
+ virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) = 0;
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) = 0;
virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) = 0;
- virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) = 0;
- virtual const LLString& getName() const = 0;
+ virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0;
- virtual void onMouseCaptureLost() = 0;
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0;
+ virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0;
+ virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) = 0;
+ virtual std::string getName() const = 0;
- // Hack to support LLFocusMgr
- virtual BOOL isView() const = 0;
+ virtual void onMouseCaptureLost() = 0;
virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const = 0;
virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const = 0;
diff --git a/indra/llwindow/llpreeditor.h b/indra/llwindow/llpreeditor.h
index 388e3dd2ca..9802fd8606 100644
--- a/indra/llwindow/llpreeditor.h
+++ b/indra/llwindow/llpreeditor.h
@@ -4,30 +4,25 @@
* an "input method editor" to type Kanji.
* @author Open source patch, incorporated by Dave Simmons
*
- * $LicenseInfo:firstyear=2007&license=viewergpl$
- *
- * Copyright (c) 2007-2008, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -93,14 +88,14 @@ public:
// Get the contents of this preeditor as a LLWString. If there is an active preedit,
// the returned LLWString contains it.
- virtual const LLWString & getWText() const = 0;
+ virtual LLWString getPreeditString() const = 0;
// Handle a UTF-32 char on this preeditor, i.e., add the character
// to the contents.
// This is a back door of the method of same name of LLWindowCallback.
// called_from_parent should be set to FALSE if calling through LLPreeditor.
- virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) = 0;
+ virtual BOOL handleUnicodeCharHere(llwchar uni_char) = 0;
};
#endif
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 43f3081321..072f694c24 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -2,30 +2,25 @@
* @file llwindow.cpp
* @brief Basic graphical window class
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -40,158 +35,32 @@
#include "llwindowwin32.h"
#elif LL_DARWIN
#include "llwindowmacosx.h"
-#elif LL_LINUX
-#include "llwindowlinux.h" // currently just a dummy wrapper
#endif
#include "llerror.h"
#include "llkeyboard.h"
#include "linked_lists.h"
+#include "llwindowcallbacks.h"
-//static instance for default callbacks
-LLWindowCallbacks LLWindow::sDefaultCallbacks;
//
-// LLWindowCallbacks
+// Globals
//
-
LLSplashScreen *gSplashScreenp = NULL;
BOOL gDebugClicks = FALSE;
BOOL gDebugWindowProc = FALSE;
const S32 gURLProtocolWhitelistCount = 3;
-const char* gURLProtocolWhitelist[] = { "file", "http", "https" };
+const std::string gURLProtocolWhitelist[] = { "file:", "http:", "https:" };
// CP: added a handler list - this is what's used to open the protocol and is based on registry entry
// only meaningful difference currently is that file: protocols are opened using http:
// since no protocol handler exists in registry for file:
// Important - these lists should match - protocol to handler
-const char* gURLProtocolWhitelistHandler[] = { "http", "http", "https" };
-
-BOOL LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, BOOL repeated)
-{
- return FALSE;
-}
-
-
-BOOL LLWindowCallbacks::handleTranslatedKeyUp(const KEY key, const MASK mask)
-{
- return FALSE;
-}
-
-void LLWindowCallbacks::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level)
-{
-}
-
-BOOL LLWindowCallbacks::handleUnicodeChar(llwchar uni_char, MASK mask)
-{
- return FALSE;
-}
+const std::string gURLProtocolWhitelistHandler[] = { "http", "http", "https" };
-BOOL LLWindowCallbacks::handleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-void LLWindowCallbacks::handleMouseLeave(LLWindow *window)
-{
- return;
-}
-
-BOOL LLWindowCallbacks::handleCloseRequest(LLWindow *window)
-{
- //allow the window to close
- return TRUE;
-}
-
-void LLWindowCallbacks::handleQuit(LLWindow *window)
-{
- if(LLWindowManager::destroyWindow(window) == FALSE)
- {
- llerrs << "LLWindowCallbacks::handleQuit() : Couldn't destroy window" << llendl;
- }
-}
-
-BOOL LLWindowCallbacks::handleRightMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated)
-{
- return FALSE;
-}
-
-void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
-}
-
-void LLWindowCallbacks::handleScrollWheel(LLWindow *window, S32 clicks)
-{
-}
-
-void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height)
-{
-}
-
-void LLWindowCallbacks::handleFocus(LLWindow *window)
-{
-}
-
-void LLWindowCallbacks::handleFocusLost(LLWindow *window)
-{
-}
-
-void LLWindowCallbacks::handleMenuSelect(LLWindow *window, const S32 menu_item)
-{
-}
-
-BOOL LLWindowCallbacks::handlePaint(LLWindow *window, const S32 x, const S32 y,
- const S32 width, const S32 height)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleDoubleClick(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-void LLWindowCallbacks::handleWindowBlock(LLWindow *window)
-{
-}
-
-void LLWindowCallbacks::handleWindowUnblock(LLWindow *window)
-{
-}
-
-void LLWindowCallbacks::handleDataCopy(LLWindow *window, S32 data_type, void *data)
-{
-}
-
-
-S32 OSMessageBox(const char* text, const char* caption, U32 type)
+S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type)
{
// Properly hide the splash screen when displaying the message box
BOOL was_visible = FALSE;
@@ -228,8 +97,8 @@ S32 OSMessageBox(const char* text, const char* caption, U32 type)
// LLWindow
//
-LLWindow::LLWindow(BOOL fullscreen, U32 flags)
- : mCallbacks(&sDefaultCallbacks),
+LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags)
+ : mCallbacks(callbacks),
mPostQuit(TRUE),
mFullscreen(fullscreen),
mFullscreenWidth(0),
@@ -246,18 +115,23 @@ LLWindow::LLWindow(BOOL fullscreen, U32 flags)
mHideCursorPermanent(FALSE),
mFlags(flags),
mHighSurrogate(0)
+{ }
+
+LLWindow::~LLWindow()
+{ }
+
+//virtual
+BOOL LLWindow::isValid()
{
- for (U32 i = 0; i < 8; i++)
- {
- mJoyAxis[i] = 0;
- }
+ return TRUE;
+}
- for (U32 i = 0; i < 16; i++)
- {
- mJoyButtonState[i] = 0;
- }
+//virtual
+BOOL LLWindow::canDelete()
+{
+ return TRUE;
}
-
+
// virtual
void LLWindow::incBusyCount()
{
@@ -273,31 +147,70 @@ void LLWindow::decBusyCount()
}
}
-F32 LLWindow::getJoystickAxis(U32 axis)
+//virtual
+void LLWindow::resetBusyCount()
{
- if (axis < 8)
- {
- return mJoyAxis[axis];
- }
- return 0.f;
+ mBusyCount = 0;
}
-U8 LLWindow::getJoystickButton(U32 button)
+//virtual
+S32 LLWindow::getBusyCount() const
{
- if (button < 16)
- {
- return mJoyButtonState[button];
- }
- return 0;
+ return mBusyCount;
}
-void LLWindow::setCallbacks(LLWindowCallbacks *callbacks)
+//virtual
+ECursorType LLWindow::getCursor() const
{
- mCallbacks = callbacks;
- if (gKeyboard)
- {
- gKeyboard->setCallbacks(callbacks);
- }
+ return mCurrentCursor;
+}
+
+//virtual
+BOOL LLWindow::dialogColorPicker(F32 *r, F32 *g, F32 *b)
+{
+ return FALSE;
+}
+
+void *LLWindow::getMediaWindow()
+{
+ // Default to returning the platform window.
+ return getPlatformWindow();
+}
+
+//virtual
+void LLWindow::processMiscNativeEvents()
+{
+ // do nothing unless subclassed
+}
+
+//virtual
+BOOL LLWindow::isPrimaryTextAvailable()
+{
+ return FALSE; // no
+}
+//virtual
+BOOL LLWindow::pasteTextFromPrimary(LLWString &dst)
+{
+ return FALSE; // fail
+}
+// virtual
+BOOL LLWindow::copyTextToPrimary(const LLWString &src)
+{
+ return FALSE; // fail
+}
+
+// static
+std::vector<std::string> LLWindow::getDynamicFallbackFontList()
+{
+#if LL_WINDOWS
+ return LLWindowWin32::getDynamicFallbackFontList();
+#elif LL_DARWIN
+ return LLWindowMacOSX::getDynamicFallbackFontList();
+#elif LL_SDL
+ return LLWindowSDL::getDynamicFallbackFontList();
+#else
+ return std::vector<std::string>();
+#endif
}
#define UTF16_IS_HIGH_SURROGATE(U) ((U16)((U) - 0xD800) < 0x0400)
@@ -390,7 +303,7 @@ void LLSplashScreen::show()
}
//static
-void LLSplashScreen::update(const char* str)
+void LLSplashScreen::update(const std::string& str)
{
LLSplashScreen::show();
if (gSplashScreenp)
@@ -418,59 +331,40 @@ void LLSplashScreen::hide()
static std::set<LLWindow*> sWindowList;
LLWindow* LLWindowManager::createWindow(
- char *title,
- char *name,
- LLCoordScreen upper_left,
- LLCoordScreen size,
- U32 flags,
+ LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags,
BOOL fullscreen,
BOOL clearBg,
BOOL disable_vsync,
BOOL use_gl,
- BOOL ignore_pixel_depth)
-{
- return createWindow(
- title, name, upper_left.mX, upper_left.mY, size.mX, size.mY, flags,
- fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
-}
-
-LLWindow* LLWindowManager::createWindow(
- char *title, char *name, S32 x, S32 y, S32 width, S32 height, U32 flags,
- BOOL fullscreen,
- BOOL clearBg,
- BOOL disable_vsync,
- BOOL use_gl,
- BOOL ignore_pixel_depth)
+ BOOL ignore_pixel_depth,
+ U32 fsaa_samples)
{
LLWindow* new_window;
if (use_gl)
{
#if LL_MESA_HEADLESS
- new_window = new LLWindowMesaHeadless(
+ new_window = new LLWindowMesaHeadless(callbacks,
title, name, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
#elif LL_SDL
- new_window = new LLWindowSDL(
+ new_window = new LLWindowSDL(callbacks,
title, x, y, width, height, flags,
- fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
+ fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#elif LL_WINDOWS
- new_window = new LLWindowWin32(
+ new_window = new LLWindowWin32(callbacks,
title, name, x, y, width, height, flags,
- fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
+ fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#elif LL_DARWIN
- new_window = new LLWindowMacOSX(
- title, name, x, y, width, height, flags,
- fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
-#elif LL_LINUX
- new_window = new LLWindowLinux(
+ new_window = new LLWindowMacOSX(callbacks,
title, name, x, y, width, height, flags,
- fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
+ fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#endif
}
else
{
- new_window = new LLWindowHeadless(
+ new_window = new LLWindowHeadless(callbacks,
title, name, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
}
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index bc444ae811..e8a86a1880 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -2,123 +2,40 @@
* @file llwindow.h
* @brief Basic graphical window class
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLWINDOW_H
#define LL_LLWINDOW_H
-#include <sys/stat.h>
-
#include "llrect.h"
#include "llcoord.h"
#include "llstring.h"
-
-
-enum ECursorType {
- UI_CURSOR_ARROW,
- UI_CURSOR_WAIT,
- UI_CURSOR_HAND,
- UI_CURSOR_IBEAM,
- UI_CURSOR_CROSS,
- UI_CURSOR_SIZENWSE,
- UI_CURSOR_SIZENESW,
- UI_CURSOR_SIZEWE,
- UI_CURSOR_SIZENS,
- UI_CURSOR_NO,
- UI_CURSOR_WORKING,
- UI_CURSOR_TOOLGRAB,
- UI_CURSOR_TOOLLAND,
- UI_CURSOR_TOOLFOCUS,
- UI_CURSOR_TOOLCREATE,
- UI_CURSOR_ARROWDRAG,
- UI_CURSOR_ARROWCOPY, // drag with copy
- UI_CURSOR_ARROWDRAGMULTI,
- UI_CURSOR_ARROWCOPYMULTI, // drag with copy
- UI_CURSOR_NOLOCKED,
- UI_CURSOR_ARROWLOCKED,
- UI_CURSOR_GRABLOCKED,
- UI_CURSOR_TOOLTRANSLATE,
- UI_CURSOR_TOOLROTATE,
- UI_CURSOR_TOOLSCALE,
- UI_CURSOR_TOOLCAMERA,
- UI_CURSOR_TOOLPAN,
- UI_CURSOR_TOOLZOOMIN,
- UI_CURSOR_TOOLPICKOBJECT3,
- UI_CURSOR_TOOLSIT,
- UI_CURSOR_TOOLBUY,
- UI_CURSOR_TOOLPAY,
- UI_CURSOR_TOOLOPEN,
- UI_CURSOR_TOOLPLAY,
- UI_CURSOR_TOOLPAUSE,
- UI_CURSOR_TOOLMEDIAOPEN,
- UI_CURSOR_PIPETTE,
- UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor)
-};
+#include "llcursortypes.h"
+#include "llsd.h"
class LLSplashScreen;
-
-class LLWindow;
-
class LLPreeditor;
-
-class LLWindowCallbacks
-{
-public:
- virtual ~LLWindowCallbacks() {}
- virtual BOOL handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated);
- virtual BOOL handleTranslatedKeyUp(KEY key, MASK mask);
- virtual void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
- virtual BOOL handleUnicodeChar(llwchar uni_char, MASK mask);
-
- virtual BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual void handleMouseLeave(LLWindow *window);
- // return TRUE to allow window to close, which will then cause handleQuit to be called
- virtual BOOL handleCloseRequest(LLWindow *window);
- // window is about to be destroyed, clean up your business
- virtual void handleQuit(LLWindow *window);
- virtual BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual BOOL handleActivate(LLWindow *window, BOOL activated);
- virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual void handleScrollWheel(LLWindow *window, S32 clicks);
- virtual void handleResize(LLWindow *window, S32 width, S32 height);
- virtual void handleFocus(LLWindow *window);
- virtual void handleFocusLost(LLWindow *window);
- virtual void handleMenuSelect(LLWindow *window, S32 menu_item);
- virtual BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height);
- virtual BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); // double-click of left mouse button
- virtual void handleWindowBlock(LLWindow *window); // window is taking over CPU for a while
- virtual void handleWindowUnblock(LLWindow *window); // window coming back after taking over CPU for a while
- virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data);
-};
+class LLWindowCallbacks;
// Refer to llwindow_test in test/common/llwindow for usage example
@@ -148,13 +65,15 @@ public:
virtual BOOL getMinimized() = 0;
virtual BOOL getMaximized() = 0;
virtual BOOL maximize() = 0;
+ virtual void minimize() = 0;
+ virtual void restore() = 0;
BOOL getFullscreen() { return mFullscreen; };
virtual BOOL getPosition(LLCoordScreen *position) = 0;
virtual BOOL getSize(LLCoordScreen *size) = 0;
virtual BOOL getSize(LLCoordWindow *size) = 0;
virtual BOOL setPosition(LLCoordScreen position) = 0;
virtual BOOL setSize(LLCoordScreen size) = 0;
- virtual BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) = 0;
+ virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) = 0;
virtual BOOL setCursorPosition(LLCoordWindow position) = 0;
virtual BOOL getCursorPosition(LLCoordWindow *position) = 0;
virtual void showCursor() = 0;
@@ -168,34 +87,39 @@ public:
// arrow/hour if busycount > 0.
virtual void incBusyCount();
virtual void decBusyCount();
- virtual void resetBusyCount() { mBusyCount = 0; }
- virtual S32 getBusyCount() const { return mBusyCount; }
+ virtual void resetBusyCount();
+ virtual S32 getBusyCount() const;
// Sets cursor, may set to arrow+hourglass
virtual void setCursor(ECursorType cursor) = 0;
- virtual ECursorType getCursor() const { return mCurrentCursor; }
+ virtual ECursorType getCursor() const;
virtual void captureMouse() = 0;
virtual void releaseMouse() = 0;
virtual void setMouseClipping( BOOL b ) = 0;
+
virtual BOOL isClipboardTextAvailable() = 0;
virtual BOOL pasteTextFromClipboard(LLWString &dst) = 0;
virtual BOOL copyTextToClipboard(const LLWString &src) = 0;
+
+ virtual BOOL isPrimaryTextAvailable();
+ virtual BOOL pasteTextFromPrimary(LLWString &dst);
+ virtual BOOL copyTextToPrimary(const LLWString &src);
+
virtual void flashIcon(F32 seconds) = 0;
virtual F32 getGamma() = 0;
virtual BOOL setGamma(const F32 gamma) = 0; // Set the gamma
+ virtual void setFSAASamples(const U32 fsaa_samples) = 0; //set number of FSAA samples
+ virtual U32 getFSAASamples() = 0;
virtual BOOL restoreGamma() = 0; // Restore original gamma table (before updating gamma)
virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
+ virtual void processMiscNativeEvents();
virtual void gatherInput() = 0;
virtual void delayInputProcessing() = 0;
virtual void swapBuffers() = 0;
virtual void bringToFront() = 0;
virtual void focusClient() { }; // this may not have meaning or be required on other platforms, therefore, it's not abstract
- virtual S32 stat( const char* file_name, struct stat* stat_info ) = 0;
- virtual BOOL sendEmail(const char* address,const char* subject,const char* body_text, const char* attachment=NULL, const char* attachment_displayed_name=NULL ) = 0;
-
-
// handy coordinate space conversion routines
// NB: screen to window and vice verse won't work on width/height coordinate pairs,
// as the conversion must take into account left AND right border widths, etc.
@@ -212,33 +136,38 @@ public:
virtual F32 getPixelAspectRatio() = 0;
virtual void setNativeAspectRatio(F32 aspect) = 0;
- F32 getJoystickAxis(U32 axis);
- U8 getJoystickButton(U32 button);
-
- void setCallbacks(LLWindowCallbacks *callbacks);
-
virtual void beforeDialog() {}; // prepare to put up an OS dialog (if special measures are required, such as in fullscreen mode)
virtual void afterDialog() {}; // undo whatever was done in beforeDialog()
-// opens system default color picker
- virtual BOOL dialog_color_picker (F32 *r, F32 *g, F32 *b) { return FALSE; };
+ // opens system default color picker, modally
+ // Returns TRUE if valid color selected
+ virtual BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b);
-// return a platform-specific window reference (HWND on Windows, WindowRef on the Mac)
+// return a platform-specific window reference (HWND on Windows, WindowRef on the Mac, Gtk window on Linux)
virtual void *getPlatformWindow() = 0;
+
+// return the platform-specific window reference we use to initialize llmozlib (HWND on Windows, WindowRef on the Mac, Gtk window on Linux)
+ virtual void *getMediaWindow();
// control platform's Language Text Input mechanisms.
virtual void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) {}
virtual void setLanguageTextInput( const LLCoordGL & pos ) {};
virtual void updateLanguageTextInputArea() {}
virtual void interruptLanguageTextInput() {}
+ virtual void spawnWebBrowser(const std::string& escaped_url, bool async) {};
+
+ static std::vector<std::string> getDynamicFallbackFontList();
+
+ // Provide native key event data
+ virtual LLSD getNativeKeyData() { return LLSD::emptyMap(); }
protected:
- LLWindow(BOOL fullscreen, U32 flags);
- virtual ~LLWindow() {}
- virtual BOOL isValid() {return TRUE;}
- virtual BOOL canDelete() {return TRUE;}
-protected:
- static LLWindowCallbacks sDefaultCallbacks;
+ LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags);
+ virtual ~LLWindow();
+ // Defaults to true
+ virtual BOOL isValid();
+ // Defaults to true
+ virtual BOOL canDelete();
protected:
LLWindowCallbacks* mCallbacks;
@@ -258,8 +187,6 @@ protected:
ESwapMethod mSwapMethod;
BOOL mHideCursorPermanent;
U32 mFlags;
- F32 mJoyAxis[8];
- U8 mJoyButtonState[16];
U16 mHighSurrogate;
// Handle a UTF-16 encoding unit received from keyboard.
@@ -291,13 +218,13 @@ public:
static LLSplashScreen * create();
static void show();
static void hide();
- static void update(const char* string);
+ static void update(const std::string& string);
static bool isVisible();
protected:
// These are overridden by the platform implementation
virtual void showImpl() = 0;
- virtual void updateImpl(const char* string) = 0;
+ virtual void updateImpl(const std::string& string) = 0;
virtual void hideImpl() = 0;
static BOOL sVisible;
@@ -305,7 +232,7 @@ protected:
};
// Platform-neutral for accessing the platform specific message box
-S32 OSMessageBox(const char* text, const char* caption, U32 type);
+S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type);
const U32 OSMB_OK = 0;
const U32 OSMB_OKCANCEL = 1;
const U32 OSMB_YESNO = 2;
@@ -322,25 +249,16 @@ const S32 OSBTN_CANCEL = 3;
class LLWindowManager
{
public:
- static LLWindow* createWindow(
- char *title,
- char *name,
- LLCoordScreen upper_left = LLCoordScreen(10, 10),
- LLCoordScreen size = LLCoordScreen(320, 240),
- U32 flags = 0,
- BOOL fullscreen = FALSE,
- BOOL clearBg = FALSE,
- BOOL disable_vsync = TRUE,
- BOOL use_gl = TRUE,
- BOOL ignore_pixel_depth = FALSE);
static LLWindow *createWindow(
- char* title, char* name, S32 x, S32 y, S32 width, S32 height,
+ LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
U32 flags = 0,
BOOL fullscreen = FALSE,
BOOL clearBg = FALSE,
BOOL disable_vsync = TRUE,
BOOL use_gl = TRUE,
- BOOL ignore_pixel_depth = FALSE);
+ BOOL ignore_pixel_depth = FALSE,
+ U32 fsaa_samples = 0);
static BOOL destroyWindow(LLWindow* window);
static BOOL isWindowValid(LLWindow *window);
};
@@ -352,11 +270,8 @@ extern BOOL gDebugWindowProc;
// Protocols, like "http" and "https" we support in URLs
extern const S32 gURLProtocolWhitelistCount;
-extern const char* gURLProtocolWhitelist[];
-extern const char* gURLProtocolWhitelistHandler[];
-
-// Loads a URL with the user's default browser
-void spawn_web_browser(const char* escaped_url);
+extern const std::string gURLProtocolWhitelist[];
+extern const std::string gURLProtocolWhitelistHandler[];
void simpleEscapeString ( std::string& stringIn );
diff --git a/indra/llwindow/llwindowcallbacks.cpp b/indra/llwindow/llwindowcallbacks.cpp
new file mode 100644
index 0000000000..c2705bbf74
--- /dev/null
+++ b/indra/llwindow/llwindowcallbacks.cpp
@@ -0,0 +1,200 @@
+/**
+ * @file llwindowcallbacks.cpp
+ * @brief OS event callback class
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+#include "llwindowcallbacks.h"
+
+#include "llcoord.h"
+
+//
+// LLWindowCallbacks
+//
+
+BOOL LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, BOOL repeated)
+{
+ return FALSE;
+}
+
+
+BOOL LLWindowCallbacks::handleTranslatedKeyUp(const KEY key, const MASK mask)
+{
+ return FALSE;
+}
+
+void LLWindowCallbacks::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level)
+{
+}
+
+BOOL LLWindowCallbacks::handleUnicodeChar(llwchar uni_char, MASK mask)
+{
+ return FALSE;
+}
+
+
+BOOL LLWindowCallbacks::handleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+void LLWindowCallbacks::handleMouseLeave(LLWindow *window)
+{
+ return;
+}
+
+BOOL LLWindowCallbacks::handleCloseRequest(LLWindow *window)
+{
+ //allow the window to close
+ return TRUE;
+}
+
+void LLWindowCallbacks::handleQuit(LLWindow *window)
+{
+}
+
+BOOL LLWindowCallbacks::handleRightMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleActivateApp(LLWindow *window, BOOL activating)
+{
+ return FALSE;
+}
+
+void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+}
+
+void LLWindowCallbacks::handleScrollWheel(LLWindow *window, S32 clicks)
+{
+}
+
+void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height)
+{
+}
+
+void LLWindowCallbacks::handleFocus(LLWindow *window)
+{
+}
+
+void LLWindowCallbacks::handleFocusLost(LLWindow *window)
+{
+}
+
+void LLWindowCallbacks::handleMenuSelect(LLWindow *window, const S32 menu_item)
+{
+}
+
+BOOL LLWindowCallbacks::handlePaint(LLWindow *window, const S32 x, const S32 y,
+ const S32 width, const S32 height)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleDoubleClick(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+void LLWindowCallbacks::handleWindowBlock(LLWindow *window)
+{
+}
+
+void LLWindowCallbacks::handleWindowUnblock(LLWindow *window)
+{
+}
+
+void LLWindowCallbacks::handleDataCopy(LLWindow *window, S32 data_type, void *data)
+{
+}
+
+LLWindowCallbacks::DragNDropResult LLWindowCallbacks::handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, DragNDropAction action, std::string data )
+{
+ return LLWindowCallbacks::DND_NONE;
+}
+
+BOOL LLWindowCallbacks::handleTimerEvent(LLWindow *window)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleDeviceChange(LLWindow *window)
+{
+ return FALSE;
+}
+
+void LLWindowCallbacks::handlePingWatchdog(LLWindow *window, const char * msg)
+{
+
+}
+
+void LLWindowCallbacks::handlePauseWatchdog(LLWindow *window)
+{
+
+}
+
+void LLWindowCallbacks::handleResumeWatchdog(LLWindow *window)
+{
+
+}
+
+std::string LLWindowCallbacks::translateString(const char* tag)
+{
+ return std::string();
+}
+
+//virtual
+std::string LLWindowCallbacks::translateString(const char* tag,
+ const std::map<std::string, std::string>& args)
+{
+ return std::string();
+}
diff --git a/indra/llwindow/llwindowcallbacks.h b/indra/llwindow/llwindowcallbacks.h
new file mode 100644
index 0000000000..8572b442f1
--- /dev/null
+++ b/indra/llwindow/llwindowcallbacks.h
@@ -0,0 +1,94 @@
+/**
+ * @file llwindowcallbacks.h
+ * @brief OS event callback class
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+#ifndef LLWINDOWCALLBACKS_H
+#define LLWINDOWCALLBACKS_H
+
+class LLCoordGL;
+class LLWindow;
+
+class LLWindowCallbacks
+{
+public:
+ virtual ~LLWindowCallbacks() {}
+ virtual BOOL handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated);
+ virtual BOOL handleTranslatedKeyUp(KEY key, MASK mask);
+ virtual void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
+ virtual BOOL handleUnicodeChar(llwchar uni_char, MASK mask);
+
+ virtual BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual void handleMouseLeave(LLWindow *window);
+ // return TRUE to allow window to close, which will then cause handleQuit to be called
+ virtual BOOL handleCloseRequest(LLWindow *window);
+ // window is about to be destroyed, clean up your business
+ virtual void handleQuit(LLWindow *window);
+ virtual BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual BOOL handleActivate(LLWindow *window, BOOL activated);
+ virtual BOOL handleActivateApp(LLWindow *window, BOOL activating);
+ virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual void handleScrollWheel(LLWindow *window, S32 clicks);
+ virtual void handleResize(LLWindow *window, S32 width, S32 height);
+ virtual void handleFocus(LLWindow *window);
+ virtual void handleFocusLost(LLWindow *window);
+ virtual void handleMenuSelect(LLWindow *window, S32 menu_item);
+ virtual BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height);
+ virtual BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); // double-click of left mouse button
+ virtual void handleWindowBlock(LLWindow *window); // window is taking over CPU for a while
+ virtual void handleWindowUnblock(LLWindow *window); // window coming back after taking over CPU for a while
+ virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data);
+ virtual BOOL handleTimerEvent(LLWindow *window);
+ virtual BOOL handleDeviceChange(LLWindow *window);
+
+ enum DragNDropAction {
+ DNDA_START_TRACKING = 0,// Start tracking an incoming drag
+ DNDA_TRACK, // User is dragging an incoming drag around the window
+ DNDA_STOP_TRACKING, // User is no longer dragging an incoming drag around the window (may have either cancelled or dropped on the window)
+ DNDA_DROPPED // User dropped an incoming drag on the window (this is the "commit" event)
+ };
+
+ enum DragNDropResult {
+ DND_NONE = 0, // No drop allowed
+ DND_MOVE, // Drop accepted would result in a "move" operation
+ DND_COPY, // Drop accepted would result in a "copy" operation
+ DND_LINK // Drop accepted would result in a "link" operation
+ };
+ virtual DragNDropResult handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, DragNDropAction action, std::string data);
+
+ virtual void handlePingWatchdog(LLWindow *window, const char * msg);
+ virtual void handlePauseWatchdog(LLWindow *window);
+ virtual void handleResumeWatchdog(LLWindow *window);
+
+ // Look up a localized string, usually for an error message
+ virtual std::string translateString(const char* tag);
+ virtual std::string translateString(const char* tag,
+ const std::map<std::string, std::string>& args);
+};
+
+
+#endif
diff --git a/indra/llwindow/llwindowheadless.cpp b/indra/llwindow/llwindowheadless.cpp
index 1b55791467..35398f1c09 100644
--- a/indra/llwindow/llwindowheadless.cpp
+++ b/indra/llwindow/llwindowheadless.cpp
@@ -2,30 +2,25 @@
* @file llwindowheadless.cpp
* @brief Headless implementation of LLWindow class
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,10 +32,10 @@
//
// LLWindowHeadless
//
-LLWindowHeadless::LLWindowHeadless(char *title, char *name, S32 x, S32 y, S32 width, S32 height,
- U32 flags, BOOL fullscreen, BOOL clearBg,
+LLWindowHeadless::LLWindowHeadless(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
+ U32 flags, BOOL fullscreen, BOOL clear_background,
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth)
- : LLWindow(fullscreen, flags)
+ : LLWindow(callbacks, fullscreen, flags)
{
}
diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h
index 4962cf7bf7..ac53e6a86e 100644
--- a/indra/llwindow/llwindowheadless.h
+++ b/indra/llwindow/llwindowheadless.h
@@ -2,30 +2,25 @@
* @file llwindowheadless.h
* @brief Headless definition of LLWindow class
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -44,13 +39,15 @@ public:
/*virtual*/ BOOL getMinimized() {return FALSE;};
/*virtual*/ BOOL getMaximized() {return FALSE;};
/*virtual*/ BOOL maximize() {return FALSE;};
+ /*virtual*/ void minimize() {};
+ /*virtual*/ void restore() {};
/*virtual*/ BOOL getFullscreen() {return FALSE;};
/*virtual*/ BOOL getPosition(LLCoordScreen *position) {return FALSE;};
/*virtual*/ BOOL getSize(LLCoordScreen *size) {return FALSE;};
/*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;};
/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
/*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;};
- /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) {return FALSE;};
+ /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
/*virtual*/ void showCursor() {};
@@ -69,18 +66,14 @@ public:
/*virtual*/ void flashIcon(F32 seconds) {};
/*virtual*/ F32 getGamma() {return 1.0f; };
/*virtual*/ BOOL setGamma(const F32 gamma) {return FALSE; }; // Set the gamma
+ /*virtual*/ void setFSAASamples(const U32 fsaa_samples) { }
+ /*virtual*/ U32 getFSAASamples() { return 0; }
/*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma)
//virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
/*virtual*/ void gatherInput() {};
/*virtual*/ void delayInputProcessing() {};
/*virtual*/ void swapBuffers();
- /*virtual*/ LLString getTempFileName() {return LLString(""); };
- /*virtual*/ void deleteFile( const char* file_name ) {};
- /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info ) {return 0; };
- /*virtual*/ BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL) { return FALSE; };
-
-
// handy coordinate space conversion routines
/*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) { return FALSE; };
/*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) { return FALSE; };
@@ -97,9 +90,12 @@ public:
/*virtual*/ void *getPlatformWindow() { return 0; };
/*virtual*/ void bringToFront() {};
- LLWindowHeadless(char *title, char *name, S32 x, S32 y, S32 width, S32 height,
- U32 flags, BOOL fullscreen, BOOL clearBg,
- BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
+ LLWindowHeadless(LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name,
+ S32 x, S32 y,
+ S32 width, S32 height,
+ U32 flags, BOOL fullscreen, BOOL clear_background,
+ BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
virtual ~LLWindowHeadless();
private:
@@ -112,7 +108,7 @@ public:
virtual ~LLSplashScreenHeadless() {};
/*virtual*/ void showImpl() {};
- /*virtual*/ void updateImpl(const char* mesg) {};
+ /*virtual*/ void updateImpl(const std::string& mesg) {};
/*virtual*/ void hideImpl() {};
};
diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h
index a5c9e7ab49..7893dedda4 100644
--- a/indra/llwindow/llwindowmacosx-objc.h
+++ b/indra/llwindow/llwindowmacosx-objc.h
@@ -3,30 +3,25 @@
* @brief Prototypes for functions shared between llwindowmacosx.cpp
* and llwindowmacosx-objc.mm.
*
- * $LicenseInfo:firstyear=2006&license=viewergpl$
- *
- * Copyright (c) 2006-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm
index b68ea8ef8f..bebb537cd8 100644
--- a/indra/llwindow/llwindowmacosx-objc.mm
+++ b/indra/llwindow/llwindowmacosx-objc.mm
@@ -3,30 +3,25 @@
* @brief Definition of functions shared between llwindowmacosx.cpp
* and llwindowmacosx-objc.mm.
*
- * $LicenseInfo:firstyear=2006&license=viewergpl$
- *
- * Copyright (c) 2006-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,6 +42,13 @@ void setupCocoa()
if(!inited)
{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ // The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents.
+ // ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr'
+ // when init'ing the Cocoa App window.
+ [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"];
+
// This is a bit of voodoo taken from the Apple sample code "CarbonCocoa_PictureCursor":
// http://developer.apple.com/samplecode/CarbonCocoa_PictureCursor/index.html
@@ -55,6 +57,10 @@ void setupCocoa()
// Must first call [[[NSWindow alloc] init] release] to get the NSWindow machinery set up so that NSCursor can use a window to cache the cursor image
[[[NSWindow alloc] init] release];
+
+ [pool release];
+
+ inited = true;
}
}
@@ -82,8 +88,10 @@ OSErr releaseImageCursor(CursorRef ref)
{
if( ref != NULL )
{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSCursor *cursor = (NSCursor*)ref;
[cursor release];
+ [pool release];
}
else
{
@@ -97,8 +105,10 @@ OSErr setImageCursor(CursorRef ref)
{
if( ref != NULL )
{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSCursor *cursor = (NSCursor*)ref;
[cursor set];
+ [pool release];
}
else
{
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index a1d97429e1..affd7276cc 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -2,54 +2,45 @@
* @file llwindowmacosx.cpp
* @brief Platform-dependent implementation of llwindow
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-#if LL_DARWIN
-
#include "linden_common.h"
-#include <Carbon/Carbon.h>
-#include <OpenGL/OpenGL.h>
-
#include "llwindowmacosx.h"
+
#include "llkeyboardmacosx.h"
+#include "llwindowcallbacks.h"
+#include "llwindowmacosx-objc.h"
+#include "llpreeditor.h"
+
#include "llerror.h"
#include "llgl.h"
#include "llstring.h"
#include "lldir.h"
-#include "llviewercontrol.h"
-
-#include "llglheaders.h"
-
#include "indra_constants.h"
-#include "llwindowmacosx-objc.h"
-#include "llpreeditor.h"
+#include <Carbon/Carbon.h>
+#include <OpenGL/OpenGL.h>
extern BOOL gDebugWindowProc;
@@ -66,37 +57,16 @@ const S32 MAX_NUM_RESOLUTIONS = 32;
// LLWindowMacOSX
//
-// Cross-platform bits:
+BOOL LLWindowMacOSX::sUseMultGL = FALSE;
+WindowRef LLWindowMacOSX::sMediaWindow = NULL;
-void show_window_creation_error(const char* title)
-{
- llwarns << title << llendl;
- /*
- OSMessageBox(
- "Second Life is unable to run because it can't set up your display.\n"
- "We need to be able to make a 32-bit color window at 1024x768, with\n"
- "an 8 bit alpha channel.\n"
- "\n"
- "First, be sure your monitor is set to True Color (32-bit) in\n"
- "Start -> Control Panels -> Display -> Settings.\n"
- "\n"
- "Otherwise, this may be due to video card driver issues.\n"
- "Please make sure you have the latest video card drivers installed.\n"
- "ATI drivers are available at http://www.ati.com/\n"
- "nVidia drivers are available at http://www.nvidia.com/\n"
- "\n"
- "If you continue to receive this message, contact customer service.",
- title,
- OSMB_OK);
- */
-}
+// Cross-platform bits:
BOOL check_for_card(const char* RENDERER, const char* bad_card)
{
if (!strnicmp(RENDERER, bad_card, strlen(bad_card)))
{
- char buffer[1024];/* Flawfinder: ignore */
- snprintf(buffer, sizeof(buffer),
+ std::string buffer = llformat(
"Your video card appears to be a %s, which Second Life does not support.\n"
"\n"
"Second Life requires a video card with 32 Mb of memory or more, as well as\n"
@@ -110,7 +80,7 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card)
"You can try to run Second Life, but it will probably crash or run\n"
"very slowly. Try anyway?",
bad_card);
- S32 button = OSMessageBox(buffer, "Unsupported video card", OSMB_YESNO);
+ S32 button = OSMessageBox(buffer.c_str(), "Unsupported video card", OSMB_YESNO);
if (OSBTN_YES == button)
{
return FALSE;
@@ -124,8 +94,6 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card)
return FALSE;
}
-
-
// Switch to determine whether we capture all displays, or just the main one.
// We may want to base this on the setting of _DEBUG...
@@ -242,18 +210,27 @@ static LLWindowMacOSX *gWindowImplementation = NULL;
-LLWindowMacOSX::LLWindowMacOSX(char *title, char *name, S32 x, S32 y, S32 width,
+LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
- BOOL ignore_pixel_depth)
- : LLWindow(fullscreen, flags)
-{
+ BOOL ignore_pixel_depth,
+ U32 fsaa_samples)
+ : LLWindow(NULL, fullscreen, flags)
+{
+ // *HACK: During window construction we get lots of OS events for window
+ // reshape, activate, etc. that the viewer isn't ready to handle.
+ // Route them to a dummy callback structure until the end of constructor.
+ LLWindowCallbacks null_callbacks;
+ mCallbacks = &null_callbacks;
+
// Voodoo for calling cocoa from carbon (see llwindowmacosx-objc.mm).
setupCocoa();
// Initialize the keyboard
gKeyboard = new LLKeyboardMacOSX();
+ gKeyboard->setCallbacks(callbacks);
// Ignore use_gl for now, only used for drones on PC
mWindow = NULL;
@@ -277,6 +254,9 @@ LLWindowMacOSX::LLWindowMacOSX(char *title, char *name, S32 x, S32 y, S32 width,
mTSMScriptCode = 0;
mTSMLangCode = 0;
mPreeditor = NULL;
+ mRawKeyEvent = NULL;
+ mFSAASamples = fsaa_samples;
+ mForceRebuild = FALSE;
// For reasons that aren't clear to me, LLTimers seem to be created in the "started" state.
// 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.
@@ -286,12 +266,15 @@ LLWindowMacOSX::LLWindowMacOSX(char *title, char *name, S32 x, S32 y, S32 width,
mOriginalAspectRatio = (double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay);
// Stash the window title
- strcpy((char*)mWindowTitle + 1, title); /* Flawfinder: ignore */
- mWindowTitle[0] = strlen(title); /* Flawfinder: ignore */
+ strcpy((char*)mWindowTitle + 1, title.c_str()); /* Flawfinder: ignore */
+ mWindowTitle[0] = title.length();
mEventHandlerUPP = NewEventHandlerUPP(staticEventHandler);
+ mMoveEventCampartorUPP = NewEventComparatorUPP(staticMoveEventComparator);
mGlobalHandlerRef = NULL;
mWindowHandlerRef = NULL;
+
+ mDragOverrideCursor = -1;
// We're not clipping yet
SetRect( &mOldMouseClip, 0, 0, 0, 0 );
@@ -339,6 +322,7 @@ LLWindowMacOSX::LLWindowMacOSX(char *title, char *name, S32 x, S32 y, S32 width,
setCursor( UI_CURSOR_ARROW );
}
+ mCallbacks = callbacks;
stop_glerror();
}
@@ -356,7 +340,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
if (mFullscreen && (mOldDisplayMode == NULL))
{
- llinfos << "createContext: setting up fullscreen " << width << "x" << height << llendl;
+ LL_INFOS("Window") << "createContext: setting up fullscreen " << width << "x" << height << LL_ENDL;
// NOTE: The refresh rate will be REPORTED AS 0 for many DVI and notebook displays. Plan accordingly.
double refresh = getDictDouble (CGDisplayCurrentMode (mDisplay), kCGDisplayRefreshRate);
@@ -377,18 +361,18 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
U32 closestWidth = 0;
int i;
- llinfos << "createContext: searching for a display mode, original aspect is " << mOriginalAspectRatio << llendl;
+ LL_DEBUGS("Window") << "createContext: searching for a display mode, original aspect is " << mOriginalAspectRatio << LL_ENDL;
for(i=0; i < resolutionCount; i++)
{
F32 aspect = (F32)resolutionList[i].mWidth / (F32)resolutionList[i].mHeight;
- llinfos << "createContext: width " << resolutionList[i].mWidth << " height " << resolutionList[i].mHeight << " aspect " << aspect << llendl;
+ LL_DEBUGS("Window") << "createContext: width " << resolutionList[i].mWidth << " height " << resolutionList[i].mHeight << " aspect " << aspect << LL_ENDL;
if( (resolutionList[i].mHeight >= 700) && (resolutionList[i].mHeight <= 800) &&
(fabs(aspect - mOriginalAspectRatio) < fabs(closestAspect - mOriginalAspectRatio)))
{
- llinfos << " (new closest mode) " << llendl;
+ LL_DEBUGS("Window") << " (new closest mode) " << LL_ENDL;
// This is the closest mode we've seen yet.
closestWidth = resolutionList[i].mWidth;
@@ -434,7 +418,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
if (refDisplayMode)
{
- llinfos << "createContext: switching display resolution" << llendl;
+ LL_DEBUGS("Window") << "createContext: switching display resolution" << LL_ENDL;
mOldDisplayMode = CGDisplayCurrentMode (mDisplay);
CGDisplaySwitchToMode (mDisplay, refDisplayMode);
// CFRelease(refDisplayMode);
@@ -449,11 +433,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
mFullscreenBits = CGDisplayBitsPerPixel(mDisplay);
mFullscreenRefresh = llround(getDictDouble (CGDisplayCurrentMode (mDisplay), kCGDisplayRefreshRate));
- llinfos << "Running at " << mFullscreenWidth
+ LL_INFOS("Window") << "Running at " << mFullscreenWidth
<< "x" << mFullscreenHeight
<< "x" << mFullscreenBits
<< " @ " << mFullscreenRefresh
- << llendl;
+ << LL_ENDL;
}
else
{
@@ -464,8 +448,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
mFullscreenBits = -1;
mFullscreenRefresh = -1;
- char error[256]; /* Flawfinder: ignore */
- snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
+ std::string error= llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
OSMessageBox(error, "Error", OSMB_OK);
}
}
@@ -477,7 +460,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
//int displayHeight = CGDisplayPixelsHigh(mDisplay);
//const int menuBarPlusTitleBar = 44; // Ugly magic number.
- llinfos << "createContext: creating window" << llendl;
+ LL_DEBUGS("Window") << "createContext: creating window" << LL_ENDL;
window_rect.left = (long) x;
window_rect.right = (long) x + width;
@@ -513,8 +496,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
// Set up window event handlers (some window-related events ONLY go to window handlers.)
InstallStandardEventHandler(GetWindowEventTarget(mWindow));
- InstallWindowEventHandler (mWindow, mEventHandlerUPP, GetEventTypeCount (WindowHandlerEventList), WindowHandlerEventList, (void*)this, &mWindowHandlerRef); // add event handler
-
+ InstallWindowEventHandler(mWindow, mEventHandlerUPP, GetEventTypeCount (WindowHandlerEventList), WindowHandlerEventList, (void*)this, &mWindowHandlerRef); // add event handler
+#if LL_OS_DRAGDROP_ENABLED
+ InstallTrackingHandler( dragTrackingHandler, mWindow, (void*)this );
+ InstallReceiveHandler( dragReceiveHandler, mWindow, (void*)this );
+#endif // LL_OS_DRAGDROP_ENABLED
}
{
@@ -531,12 +517,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
err = NewTSMDocument(1, types, &mTSMDocument, 0);
if (err != noErr)
{
- llwarns << "createContext: couldn't create a TSMDocument (" << err << ")" << llendl;
+ LL_WARNS("Window") << "createContext: couldn't create a TSMDocument (" << err << ")" << LL_ENDL;
}
if (mTSMDocument)
{
ActivateTSMDocument(mTSMDocument);
- UseInputWindow(mTSMDocument, FALSE);
allowLanguageTextInput(NULL, FALSE);
}
}
@@ -558,6 +543,8 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
AGL_RGBA,
AGL_FULLSCREEN,
// AGL_NO_RECOVERY, // MBW -- XXX -- Not sure if we want this attribute
+ AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
+ AGL_SAMPLES_ARB, mFSAASamples,
AGL_DOUBLEBUFFER,
AGL_CLOSEST_POLICY,
AGL_ACCELERATED,
@@ -570,7 +557,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
AGL_NONE
};
- llinfos << "createContext: creating fullscreen pixelformat" << llendl;
+ LL_DEBUGS("Window") << "createContext: creating fullscreen pixelformat" << LL_ENDL;
GDHandle gdhDisplay = NULL;
err = DMGetGDeviceByDisplayID ((DisplayIDType)mDisplay, &gdhDisplay, false);
@@ -586,6 +573,8 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
AGL_DOUBLEBUFFER,
AGL_CLOSEST_POLICY,
AGL_ACCELERATED,
+ AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
+ AGL_SAMPLES_ARB, mFSAASamples,
AGL_RED_SIZE, 8,
AGL_GREEN_SIZE, 8,
AGL_BLUE_SIZE, 8,
@@ -595,7 +584,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
AGL_NONE
};
- llinfos << "createContext: creating windowed pixelformat" << llendl;
+ LL_DEBUGS("Window") << "createContext: creating windowed pixelformat" << LL_ENDL;
mPixelFormat = aglChoosePixelFormat(NULL, 0, windowedAttrib);
@@ -615,7 +604,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
if(mPixelFormat)
{
- llinfos << "createContext: creating GL context" << llendl;
+ LL_DEBUGS("Window") << "createContext: creating GL context" << LL_ENDL;
mContext = aglCreateContext(mPixelFormat, NULL);
}
@@ -663,7 +652,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
{
// We successfully captured the display. Use a fullscreen drawable
- llinfos << "createContext: attaching fullscreen drawable" << llendl;
+ LL_DEBUGS("Window") << "createContext: attaching fullscreen drawable" << LL_ENDL;
#if CAPTURE_ALL_DISPLAYS
// Capture all displays (may want to do this for final build)
@@ -681,7 +670,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
}
else if(!mFullscreen && (mWindow != NULL))
{
- llinfos << "createContext: attaching windowed drawable" << llendl;
+ LL_DEBUGS("Window") << "createContext: attaching windowed drawable" << LL_ENDL;
// We created a window. Use it as the drawable.
if(!aglSetDrawable(mContext, GetWindowPort (mWindow)))
@@ -698,7 +687,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
if(mContext != NULL)
{
- llinfos << "createContext: setting current context" << llendl;
+ LL_DEBUGS("Window") << "createContext: setting current context" << LL_ENDL;
if (!aglSetCurrentContext(mContext))
{
@@ -723,7 +712,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
"Radeon DDR",
"Radeon VE",
"GDI Generic" };
- const S32 CARD_COUNT = sizeof(CARD_LIST)/sizeof(char*);
+ const S32 CARD_COUNT = LL_ARRAY_SIZE(CARD_LIST);
// Future candidates:
// ProSavage/Twister
@@ -752,11 +741,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
return FALSE;
}
- llinfos << "GL buffer: Color Bits " << S32(colorBits)
+ LL_INFOS("GLInit") << "GL buffer: Color Bits " << S32(colorBits)
<< " Alpha Bits " << S32(alphaBits)
<< " Depth Bits " << S32(depthBits)
<< " Stencil Bits" << S32(stencilBits)
- << llendl;
+ << LL_ENDL;
if (colorBits < 32)
{
@@ -791,18 +780,18 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
GLint frames_per_swap = 0;
if (disable_vsync)
{
- llinfos << "Disabling vertical sync" << llendl;
+ LL_DEBUGS("GLInit") << "Disabling vertical sync" << LL_ENDL;
frames_per_swap = 0;
}
else
{
- llinfos << "Keeping vertical sync" << llendl;
+ LL_DEBUGS("GLinit") << "Keeping vertical sync" << LL_ENDL;
frames_per_swap = 1;
}
aglSetInteger(mContext, AGL_SWAP_INTERVAL, &frames_per_swap);
//enable multi-threaded OpenGL
- if (gSavedSettings.getBOOL("RenderAppleUseMultGL"))
+ if (sUseMultGL)
{
CGLError cgl_err;
CGLContextObj ctx = CGLGetCurrentContext();
@@ -811,11 +800,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
if (cgl_err != kCGLNoError )
{
- llinfos << "Multi-threaded OpenGL not available." << llendl;
+ LL_DEBUGS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL;
}
else
{
- llinfos << "Multi-threaded OpenGL enabled." << llendl;
+ LL_DEBUGS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL;
}
}
@@ -825,7 +814,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
// changing fullscreen resolution, or switching between windowed and fullscreen mode.
-BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync)
+BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
{
BOOL needsRebuild = FALSE;
BOOL result = true;
@@ -859,11 +848,11 @@ BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL dis
mFullscreenBits = CGDisplayBitsPerPixel(mDisplay);
mFullscreenRefresh = llround(getDictDouble (CGDisplayCurrentMode (mDisplay), kCGDisplayRefreshRate));
- llinfos << "Switched resolution to " << mFullscreenWidth
+ LL_INFOS("Window") << "Switched resolution to " << mFullscreenWidth
<< "x" << mFullscreenHeight
<< "x" << mFullscreenBits
<< " @ " << mFullscreenRefresh
- << llendl;
+ << LL_ENDL;
// Update the GL context to the new screen size
if (!aglUpdateContext(mContext))
@@ -897,8 +886,9 @@ BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL dis
}
stop_glerror();
- if(needsRebuild)
+ if(needsRebuild || mForceRebuild)
{
+ mForceRebuild = FALSE;
destroyContext();
result = createContext(0, 0, size.mX, size.mY, 0, fullscreen, disable_vsync);
if (result)
@@ -932,7 +922,7 @@ void LLWindowMacOSX::destroyContext()
// Unhook the GL context from any drawable it may have
if(mContext != NULL)
{
- llinfos << "destroyContext: unhooking drawable " << llendl;
+ LL_DEBUGS("Window") << "destroyContext: unhooking drawable " << LL_ENDL;
aglSetCurrentContext (NULL);
aglSetDrawable(mContext, NULL);
@@ -941,7 +931,7 @@ void LLWindowMacOSX::destroyContext()
// Make sure the display resolution gets restored
if(mOldDisplayMode != NULL)
{
- llinfos << "destroyContext: restoring display resolution " << llendl;
+ LL_DEBUGS("Window") << "destroyContext: restoring display resolution " << LL_ENDL;
CGDisplaySwitchToMode (mDisplay, mOldDisplayMode);
@@ -967,7 +957,7 @@ void LLWindowMacOSX::destroyContext()
// Clean up the pixel format
if(mPixelFormat != NULL)
{
- llinfos << "destroyContext: destroying pixel format " << llendl;
+ LL_DEBUGS("Window") << "destroyContext: destroying pixel format " << LL_ENDL;
aglDestroyPixelFormat(mPixelFormat);
mPixelFormat = NULL;
}
@@ -975,14 +965,14 @@ void LLWindowMacOSX::destroyContext()
// Remove any Carbon Event handlers we installed
if(mGlobalHandlerRef != NULL)
{
- llinfos << "destroyContext: removing global event handler" << llendl;
+ LL_DEBUGS("Window") << "destroyContext: removing global event handler" << LL_ENDL;
RemoveEventHandler(mGlobalHandlerRef);
mGlobalHandlerRef = NULL;
}
if(mWindowHandlerRef != NULL)
{
- llinfos << "destroyContext: removing window event handler" << llendl;
+ LL_DEBUGS("Window") << "destroyContext: removing window event handler" << LL_ENDL;
RemoveEventHandler(mWindowHandlerRef);
mWindowHandlerRef = NULL;
}
@@ -990,7 +980,7 @@ void LLWindowMacOSX::destroyContext()
// Cleanup any TSM document we created.
if(mTSMDocument != NULL)
{
- llinfos << "destroyContext: deleting TSM document" << llendl;
+ LL_DEBUGS("Window") << "destroyContext: deleting TSM document" << LL_ENDL;
DeactivateTSMDocument(mTSMDocument);
DeleteTSMDocument(mTSMDocument);
mTSMDocument = NULL;
@@ -999,7 +989,7 @@ void LLWindowMacOSX::destroyContext()
// Close the window
if(mWindow != NULL)
{
- llinfos << "destroyContext: disposing window" << llendl;
+ LL_DEBUGS("Window") << "destroyContext: disposing window" << LL_ENDL;
DisposeWindow(mWindow);
mWindow = NULL;
}
@@ -1007,7 +997,7 @@ void LLWindowMacOSX::destroyContext()
// Clean up the GL context
if(mContext != NULL)
{
- llinfos << "destroyContext: destroying GL context" << llendl;
+ LL_DEBUGS("Window") << "destroyContext: destroying GL context" << LL_ENDL;
aglDestroyContext(mContext);
mContext = NULL;
}
@@ -1043,6 +1033,7 @@ void LLWindowMacOSX::hide()
HideWindow(mWindow);
}
+//virtual
void LLWindowMacOSX::minimize()
{
setMouseClipping(FALSE);
@@ -1050,6 +1041,7 @@ void LLWindowMacOSX::minimize()
CollapseWindow(mWindow, true);
}
+//virtual
void LLWindowMacOSX::restore()
{
show();
@@ -1318,6 +1310,17 @@ F32 LLWindowMacOSX::getGamma()
return result;
}
+U32 LLWindowMacOSX::getFSAASamples()
+{
+ return mFSAASamples;
+}
+
+void LLWindowMacOSX::setFSAASamples(const U32 samples)
+{
+ mFSAASamples = samples;
+ mForceRebuild = TRUE;
+}
+
BOOL LLWindowMacOSX::restoreGamma()
{
CGDisplayRestoreColorSyncSettings();
@@ -1387,11 +1390,11 @@ void LLWindowMacOSX::setMouseClipping( BOOL b )
if(b)
{
- // llinfos << "setMouseClipping(TRUE)" << llendl
+ // llinfos << "setMouseClipping(TRUE)" << llendl;
}
else
{
- // llinfos << "setMouseClipping(FALSE)" << llendl
+ // llinfos << "setMouseClipping(FALSE)" << llendl;
}
adjustCursorDecouple();
@@ -1409,7 +1412,7 @@ BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position)
CGPoint newPosition;
- // llinfos << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << llendl
+ // llinfos << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << llendl;
newPosition.x = screen_pos.mX;
newPosition.y = screen_pos.mY;
@@ -1423,6 +1426,11 @@ BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position)
// Under certain circumstances, this will trigger us to decouple the cursor.
adjustCursorDecouple(true);
+ // trigger mouse move callback
+ LLCoordGL gl_pos;
+ convertCoords(position, &gl_pos);
+ mCallbacks->handleMouseMove(this, gl_pos, (MASK)0);
+
return result;
}
@@ -1435,7 +1443,7 @@ static void fixOrigin(void)
::GetPortBounds(port, &portrect);
if((portrect.left != 0) || (portrect.top != 0))
{
- // Mozilla sometimes changes our port origin. Fuckers.
+ // Mozilla sometimes changes our port origin.
::SetOrigin(0,0);
}
}
@@ -1493,6 +1501,7 @@ void LLWindowMacOSX::adjustCursorDecouple(bool warpingMouse)
// llinfos << "adjustCursorDecouple: decoupling cursor" << llendl;
CGAssociateMouseAndMouseCursorPosition(false);
mCursorDecoupled = true;
+ FlushSpecificEventsFromQueue(GetCurrentEventQueue(), mMoveEventCampartorUPP, NULL);
mCursorIgnoreNextDelta = TRUE;
}
}
@@ -1588,11 +1597,6 @@ void LLWindowMacOSX::afterDialog()
}
-S32 LLWindowMacOSX::stat(const char* file_name, struct stat* stat_info)
-{
- return ::stat( file_name, stat_info );
-}
-
void LLWindowMacOSX::flashIcon(F32 seconds)
{
// Don't do this if we're already started, since this would try to install the NMRec twice.
@@ -1722,15 +1726,6 @@ BOOL LLWindowMacOSX::copyTextToClipboard(const LLWString &s)
}
-BOOL LLWindowMacOSX::sendEmail(const char* address, const char* subject, const char* body_text,
- const char* attachment, const char* attachment_displayed_name )
-{
- // MBW -- XXX -- Um... yeah. I'll get to this later.
-
- return false;
-}
-
-
// protected
BOOL LLWindowMacOSX::resetDisplayResolution()
{
@@ -1927,13 +1922,30 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordGL from, LLCoordScreen *to)
-void LLWindowMacOSX::setupFailure(const char* text, const char* caption, U32 type)
+void LLWindowMacOSX::setupFailure(const std::string& text, const std::string& caption, U32 type)
{
destroyContext();
OSMessageBox(text, caption, type);
}
+pascal Boolean LLWindowMacOSX::staticMoveEventComparator( EventRef event, void* data)
+{
+ UInt32 evtClass = GetEventClass (event);
+ UInt32 evtKind = GetEventKind (event);
+
+ if ((evtClass == kEventClassMouse) && ((evtKind == kEventMouseDragged) || (evtKind == kEventMouseMoved)))
+ {
+ return true;
+ }
+
+ else
+ {
+ return false;
+ }
+}
+
+
pascal OSStatus LLWindowMacOSX::staticEventHandler(EventHandlerCallRef myHandler, EventRef event, void* userData)
{
LLWindowMacOSX *self = (LLWindowMacOSX*)userData;
@@ -2005,7 +2017,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
// Although the spec. is unclear, replace range should
// not present when there is an active preedit. We just
// ignore the case. markAsPreedit will detect the case and warn it.
- const LLWString & text = mPreeditor->getWText();
+ const LLWString & text = mPreeditor->getPreeditString();
const S32 location = wstring_wstring_length_from_utf16_length(text, 0, range.location);
const S32 length = wstring_wstring_length_from_utf16_length(text, location, range.length);
mPreeditor->markAsPreedit(location, length);
@@ -2031,7 +2043,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
{
for (LLWString::const_iterator i = fix_string.begin(); i != fix_string.end(); i++)
{
- mPreeditor->handleUnicodeCharHere(*i, FALSE);
+ mPreeditor->handleUnicodeCharHere(*i);
}
}
@@ -2123,10 +2135,11 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
{
UInt32 modifiers = 0;
+
// First, process the raw event.
{
- EventRef rawEvent;
-
+ EventRef rawEvent = NULL;
+
// Get the original event and extract the modifier keys, so we can ignore command-key events.
if (GetEventParameter(event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent) == noErr)
{
@@ -2135,6 +2148,9 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
// and call this function recursively to handle the raw key event.
eventHandler (myHandler, rawEvent);
+
+ // save the raw event until we're done processing the unicode input as well.
+ mRawKeyEvent = rawEvent;
}
}
@@ -2162,11 +2178,8 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
}
else
{
- MASK mask = 0;
- if(modifiers & shiftKey) { mask |= MASK_SHIFT; }
- if(modifiers & (cmdKey | controlKey)) { mask |= MASK_CONTROL; }
- if(modifiers & optionKey) { mask |= MASK_ALT; }
-
+ MASK mask = LLWindowMacOSX::modifiersToMask(modifiers);
+
llassert( actualType == typeUnicodeText );
// The result is a UTF16 buffer. Pass the characters in turn to handleUnicodeChar.
@@ -2188,6 +2201,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
delete[] buffer;
}
+ mRawKeyEvent = NULL;
result = err;
}
break;
@@ -2203,7 +2217,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
{
S32 preedit, preedit_length;
mPreeditor->getPreeditRange(&preedit, &preedit_length);
- const LLWString & text = mPreeditor->getWText();
+ const LLWString & text = mPreeditor->getPreeditString();
LLCoordGL caret_coord;
LLRect preedit_bounds;
@@ -2240,7 +2254,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
mPreeditor->getSelectionRange(&selection, &selection_length);
if (selection_length)
{
- const LLWString text = mPreeditor->getWText().substr(selection, selection_length);
+ const LLWString text = mPreeditor->getPreeditString().substr(selection, selection_length);
const llutf16string text_utf16 = wstring_to_utf16str(text);
result = SetEventParameter(event, kEventParamTextInputReplyText, typeUnicodeText,
text_utf16.length() * sizeof(U16), text_utf16.c_str());
@@ -2262,6 +2276,9 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
GetEventParameter (event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode);
GetEventParameter (event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
+ // save the raw event so getNativeKeyData can use it.
+ mRawKeyEvent = event;
+
// printf("key event, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n", keyCode, charCode, (char)charCode, modifiers);
// fflush(stdout);
@@ -2357,6 +2374,8 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
result = eventNotHandledErr;
break;
}
+
+ mRawKeyEvent = NULL;
}
break;
@@ -2527,19 +2546,33 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
}
mCallbacks->handleFocusLost(this);
break;
+
case kEventWindowBoundsChanging:
{
+ // This is where we would constrain move/resize to a particular screen
+
+ const S32 MIN_WIDTH = 320;
+ const S32 MIN_HEIGHT = 240;
+
Rect currentBounds;
Rect previousBounds;
GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &currentBounds);
GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &previousBounds);
- // This is where we would constrain move/resize to a particular screen
- if(0)
+
+ if ((currentBounds.right - currentBounds.left) < MIN_WIDTH)
+ {
+ currentBounds.right = currentBounds.left + MIN_WIDTH;
+ }
+
+ if ((currentBounds.bottom - currentBounds.top) < MIN_HEIGHT)
{
- SetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, sizeof(Rect), &currentBounds);
+ currentBounds.bottom = currentBounds.top + MIN_HEIGHT;
}
+
+ SetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, sizeof(Rect), &currentBounds);
+ result = noErr;
}
break;
@@ -2597,7 +2630,6 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
// BringToFront(mWindow);
// result = noErr;
break;
-
}
break;
@@ -2613,7 +2645,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
S32 preedit, preedit_length;
mPreeditor->getPreeditRange(&preedit, &preedit_length);
- const LLWString & text = mPreeditor->getWText();
+ const LLWString & text = mPreeditor->getPreeditString();
const CFIndex length = wstring_utf16_length(text, 0, preedit)
+ wstring_utf16_length(text, preedit + preedit_length, text.length());
result = SetEventParameter(event, kEventParamTSMDocAccessCharacterCount, typeCFIndex, sizeof(length), &length);
@@ -2630,7 +2662,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
S32 preedit, preedit_length;
mPreeditor->getPreeditRange(&preedit, &preedit_length);
- const LLWString & text = mPreeditor->getWText();
+ const LLWString & text = mPreeditor->getPreeditString();
CFRange range;
if (preedit_length)
@@ -2664,7 +2696,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
{
S32 preedit, preedit_length;
mPreeditor->getPreeditRange(&preedit, &preedit_length);
- const LLWString & text = mPreeditor->getWText();
+ const LLWString & text = mPreeditor->getPreeditString();
// The GetCharacters event of TSMDA has a fundamental flaw;
// An input method need to decide the starting offset and length
@@ -2739,14 +2771,13 @@ const char* cursorIDToName(int id)
case UI_CURSOR_TOOLPAN: return "UI_CURSOR_TOOLPAN";
case UI_CURSOR_TOOLZOOMIN: return "UI_CURSOR_TOOLZOOMIN";
case UI_CURSOR_TOOLPICKOBJECT3: return "UI_CURSOR_TOOLPICKOBJECT3";
- case UI_CURSOR_TOOLSIT: return "UI_CURSOR_TOOLSIT";
- case UI_CURSOR_TOOLBUY: return "UI_CURSOR_TOOLBUY";
- case UI_CURSOR_TOOLPAY: return "UI_CURSOR_TOOLPAY";
- case UI_CURSOR_TOOLOPEN: return "UI_CURSOR_TOOLOPEN";
case UI_CURSOR_TOOLPLAY: return "UI_CURSOR_TOOLPLAY";
case UI_CURSOR_TOOLPAUSE: return "UI_CURSOR_TOOLPAUSE";
case UI_CURSOR_TOOLMEDIAOPEN: return "UI_CURSOR_TOOLMEDIAOPEN";
case UI_CURSOR_PIPETTE: return "UI_CURSOR_PIPETTE";
+ case UI_CURSOR_TOOLSIT: return "UI_CURSOR_TOOLSIT";
+ case UI_CURSOR_TOOLBUY: return "UI_CURSOR_TOOLBUY";
+ case UI_CURSOR_TOOLOPEN: return "UI_CURSOR_TOOLOPEN";
}
llerrs << "cursorIDToName: unknown cursor id" << id << llendl;
@@ -2774,6 +2805,14 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
{
OSStatus result = noErr;
+ if (mDragOverrideCursor != -1)
+ {
+ // A drag is in progress...remember the requested cursor and we'll
+ // restore it when it is done
+ mCurrentCursor = cursor;
+ return;
+ }
+
if (cursor == UI_CURSOR_ARROW
&& mBusyCount > 0)
{
@@ -2838,13 +2877,12 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
case UI_CURSOR_TOOLPAN:
case UI_CURSOR_TOOLZOOMIN:
case UI_CURSOR_TOOLPICKOBJECT3:
- case UI_CURSOR_TOOLSIT:
- case UI_CURSOR_TOOLBUY:
- case UI_CURSOR_TOOLPAY:
- case UI_CURSOR_TOOLOPEN:
case UI_CURSOR_TOOLPLAY:
case UI_CURSOR_TOOLPAUSE:
case UI_CURSOR_TOOLMEDIAOPEN:
+ case UI_CURSOR_TOOLSIT:
+ case UI_CURSOR_TOOLBUY:
+ case UI_CURSOR_TOOLOPEN:
result = setImageCursor(gCursors[cursor]);
break;
@@ -2858,7 +2896,7 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
mCurrentCursor = cursor;
}
-ECursorType LLWindowMacOSX::getCursor()
+ECursorType LLWindowMacOSX::getCursor() const
{
return mCurrentCursor;
}
@@ -2883,13 +2921,12 @@ void LLWindowMacOSX::initCursors()
initPixmapCursor(UI_CURSOR_TOOLPAN, 7, 6);
initPixmapCursor(UI_CURSOR_TOOLZOOMIN, 7, 6);
initPixmapCursor(UI_CURSOR_TOOLPICKOBJECT3, 1, 1);
- initPixmapCursor(UI_CURSOR_TOOLSIT, 1, 1);
- initPixmapCursor(UI_CURSOR_TOOLBUY, 1, 1);
- initPixmapCursor(UI_CURSOR_TOOLPAY, 1, 1);
- initPixmapCursor(UI_CURSOR_TOOLOPEN, 1, 1);
initPixmapCursor(UI_CURSOR_TOOLPLAY, 1, 1);
initPixmapCursor(UI_CURSOR_TOOLPAUSE, 1, 1);
initPixmapCursor(UI_CURSOR_TOOLMEDIAOPEN, 1, 1);
+ initPixmapCursor(UI_CURSOR_TOOLSIT, 20, 15);
+ initPixmapCursor(UI_CURSOR_TOOLBUY, 20, 15);
+ initPixmapCursor(UI_CURSOR_TOOLOPEN, 20, 15);
initPixmapCursor(UI_CURSOR_SIZENWSE, 10, 10);
initPixmapCursor(UI_CURSOR_SIZENESW, 10, 10);
@@ -2998,20 +3035,13 @@ void LLSplashScreenMacOSX::showImpl()
#endif
}
-void LLSplashScreenMacOSX::updateImpl(const char* mesg)
+void LLSplashScreenMacOSX::updateImpl(const std::string& mesg)
{
if(mWindow != NULL)
{
CFStringRef string = NULL;
- if(mesg != NULL)
- {
- string = CFStringCreateWithCString(NULL, mesg, kCFStringEncodingUTF8);
- }
- else
- {
- string = CFStringCreateWithCString(NULL, "", kCFStringEncodingUTF8);
- }
+ string = CFStringCreateWithCString(NULL, mesg.c_str(), kCFStringEncodingUTF8);
if(string != NULL)
{
@@ -3046,7 +3076,7 @@ void LLSplashScreenMacOSX::hideImpl()
-S32 OSMessageBoxMacOSX(const char* text, const char* caption, U32 type)
+S32 OSMessageBoxMacOSX(const std::string& text, const std::string& caption, U32 type)
{
S32 result = OSBTN_CANCEL;
SInt16 retval_mac = 1;
@@ -3057,23 +3087,8 @@ S32 OSMessageBoxMacOSX(const char* text, const char* caption, U32 type)
AlertType alertType = kAlertCautionAlert;
OSStatus err;
- if(text != NULL)
- {
- explanationString = CFStringCreateWithCString(NULL, text, kCFStringEncodingUTF8);
- }
- else
- {
- explanationString = CFStringCreateWithCString(NULL, "", kCFStringEncodingUTF8);
- }
-
- if(caption != NULL)
- {
- errorString = CFStringCreateWithCString(NULL, caption, kCFStringEncodingUTF8);
- }
- else
- {
- errorString = CFStringCreateWithCString(NULL, "", kCFStringEncodingUTF8);
- }
+ explanationString = CFStringCreateWithCString(NULL, text.c_str(), kCFStringEncodingUTF8);
+ errorString = CFStringCreateWithCString(NULL, caption.c_str(), kCFStringEncodingUTF8);
params.version = kStdCFStringAlertVersionOne;
params.movable = false;
@@ -3157,15 +3172,13 @@ S32 OSMessageBoxMacOSX(const char* text, const char* caption, U32 type)
// Open a URL with the user's default web browser.
// Must begin with protocol identifier.
-void spawn_web_browser(const char* escaped_url)
+void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async)
{
bool found = false;
S32 i;
for (i = 0; i < gURLProtocolWhitelistCount; i++)
{
- S32 len = strlen(gURLProtocolWhitelist[i]); /* Flawfinder: ignore */
- if (!strncmp(escaped_url, gURLProtocolWhitelist[i], len)
- && escaped_url[len] == ':')
+ if (escaped_url.find(gURLProtocolWhitelist[i]) != std::string::npos)
{
found = true;
break;
@@ -3174,7 +3187,7 @@ void spawn_web_browser(const char* escaped_url)
if (!found)
{
- llwarns << "spawn_web_browser() called for url with protocol not on whitelist: " << escaped_url << llendl;
+ llwarns << "spawn_web_browser called for url with protocol not on whitelist: " << escaped_url << llendl;
return;
}
@@ -3183,7 +3196,7 @@ void spawn_web_browser(const char* escaped_url)
llinfos << "Opening URL " << escaped_url << llendl;
- CFStringRef stringRef = CFStringCreateWithCString(NULL, escaped_url, kCFStringEncodingUTF8);
+ CFStringRef stringRef = CFStringCreateWithCString(NULL, escaped_url.c_str(), kCFStringEncodingUTF8);
if (stringRef)
{
// This will succeed if the string is a full URL, including the http://
@@ -3212,8 +3225,62 @@ void spawn_web_browser(const char* escaped_url)
}
}
+LLSD LLWindowMacOSX::getNativeKeyData()
+{
+ LLSD result = LLSD::emptyMap();
+
+ if(mRawKeyEvent)
+ {
+ char char_code = 0;
+ UInt32 key_code = 0;
+ UInt32 modifiers = 0;
+ UInt32 keyboard_type = 0;
+
+ GetEventParameter (mRawKeyEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &char_code);
+ GetEventParameter (mRawKeyEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &key_code);
+ GetEventParameter (mRawKeyEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
+ GetEventParameter (mRawKeyEvent, kEventParamKeyboardType, typeUInt32, NULL, sizeof(UInt32), NULL, &keyboard_type);
+
+ result["char_code"] = (S32)char_code;
+ result["key_code"] = (S32)key_code;
+ result["modifiers"] = (S32)modifiers;
+ result["keyboard_type"] = (S32)keyboard_type;
+
+#if 0
+ // This causes trouble for control characters -- apparently character codes less than 32 (escape, control-A, etc)
+ // cause llsd serialization to create XML that the llsd deserializer won't parse!
+ std::string unicode;
+ OSStatus err = noErr;
+ EventParamType actualType = typeUTF8Text;
+ UInt32 actualSize = 0;
+ char *buffer = NULL;
+
+ err = GetEventParameter (mRawKeyEvent, kEventParamKeyUnicodes, typeUTF8Text, &actualType, 0, &actualSize, NULL);
+ if(err == noErr)
+ {
+ // allocate a buffer and get the actual data.
+ buffer = new char[actualSize];
+ err = GetEventParameter (mRawKeyEvent, kEventParamKeyUnicodes, typeUTF8Text, &actualType, actualSize, &actualSize, buffer);
+ if(err == noErr)
+ {
+ unicode.assign(buffer, actualSize);
+ }
+ delete[] buffer;
+ }
+
+ result["unicode"] = unicode;
+#endif
+
+ }
+
+
+ lldebugs << "native key data is: " << result << llendl;
+
+ return result;
+}
+
-BOOL LLWindowMacOSX::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
+BOOL LLWindowMacOSX::dialogColorPicker( F32 *r, F32 *g, F32 *b)
{
BOOL retval = FALSE;
OSErr error = noErr;
@@ -3246,25 +3313,34 @@ BOOL LLWindowMacOSX::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
return (retval);
}
-static WindowRef dummywindowref = NULL;
void *LLWindowMacOSX::getPlatformWindow()
{
- if(mWindow != NULL)
- return (void*)mWindow;
+ // NOTE: this will be NULL in fullscreen mode. Plan accordingly.
+ return (void*)mWindow;
+}
+
+void *LLWindowMacOSX::getMediaWindow()
+{
+ /*
+ Mozilla needs to be initialized with a WindowRef to function properly.
+ (There's no good reason for this, since it shouldn't be interacting with our window in any way, but that's another issue.)
+ If we're in windowed mode, we _could_ hand it our actual window pointer, but a subsequent switch to fullscreen will destroy that window,
+ which trips up Mozilla.
+ Instead of using our actual window, we create an invisible window which will persist for the lifetime of the application and pass that to Mozilla.
+ This satisfies its deep-seated need to latch onto a WindowRef and solves the issue with switching between fullscreen and windowed modes.
- // If we're in fullscreen mode, there's no window pointer available.
- // Since Mozilla needs one to function, create a dummy window here.
- // Note that we will never destroy it, but since only one will be created per run of the application, that's okay.
+ Note that we will never destroy this window (by design!), but since only one will ever be created per run of the application, that's okay.
+ */
- if(dummywindowref == NULL)
+ if(sMediaWindow == NULL)
{
Rect window_rect = {100, 100, 200, 200};
- dummywindowref = NewCWindow(
+ sMediaWindow = NewCWindow(
NULL,
&window_rect,
- "\p",
+ (ConstStr255Param) "\p",
false, // Create the window invisible.
zoomDocProc, // Window with a grow box and a zoom box
kLastWindowOfClass, // create it behind other windows
@@ -3272,7 +3348,7 @@ void *LLWindowMacOSX::getPlatformWindow()
0);
}
- return (void*)dummywindowref;
+ return (void*)sMediaWindow;
}
void LLWindowMacOSX::stopDockTileBounce()
@@ -3320,6 +3396,8 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
return;
}
+ UseInputWindow(mTSMDocument, !b);
+
// Take care of old and new preeditors.
if (preeditor != mPreeditor || !b)
{
@@ -3372,4 +3450,181 @@ void LLWindowMacOSX::interruptLanguageTextInput()
// Well, if Apple's TSM document is correct, we don't.
}
-#endif // LL_DARWIN
+//static
+std::vector<std::string> LLWindowMacOSX::getDynamicFallbackFontList()
+{
+ // Fonts previously in getFontListSans() have moved to fonts.xml.
+ return std::vector<std::string>();
+}
+
+// static
+MASK LLWindowMacOSX::modifiersToMask(SInt16 modifiers)
+{
+ MASK mask = 0;
+ if(modifiers & shiftKey) { mask |= MASK_SHIFT; }
+ if(modifiers & (cmdKey | controlKey)) { mask |= MASK_CONTROL; }
+ if(modifiers & optionKey) { mask |= MASK_ALT; }
+ return mask;
+}
+
+#if LL_OS_DRAGDROP_ENABLED
+
+OSErr LLWindowMacOSX::dragTrackingHandler(DragTrackingMessage message, WindowRef theWindow,
+ void * handlerRefCon, DragRef drag)
+{
+ OSErr result = noErr;
+ LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon;
+
+ lldebugs << "drag tracking handler, message = " << message << llendl;
+
+ switch(message)
+ {
+ case kDragTrackingInWindow:
+ result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_TRACK);
+ break;
+
+ case kDragTrackingEnterHandler:
+ result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_START_TRACKING);
+ break;
+
+ case kDragTrackingLeaveHandler:
+ result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_STOP_TRACKING);
+ break;
+
+ default:
+ break;
+ }
+
+ return result;
+}
+
+OSErr LLWindowMacOSX::dragReceiveHandler(WindowRef theWindow, void * handlerRefCon,
+ DragRef drag)
+{
+ LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon;
+ return self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_DROPPED);
+
+}
+
+OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDropAction action)
+{
+ OSErr result = dragNotAcceptedErr; // overall function result
+ OSErr err = noErr; // for local error handling
+
+ // Get the mouse position and modifiers of this drag.
+ SInt16 modifiers, mouseDownModifiers, mouseUpModifiers;
+ ::GetDragModifiers(drag, &modifiers, &mouseDownModifiers, &mouseUpModifiers);
+ MASK mask = LLWindowMacOSX::modifiersToMask(modifiers);
+
+ Point mouse_point;
+ // This will return the mouse point in global screen coords
+ ::GetDragMouse(drag, &mouse_point, NULL);
+ LLCoordScreen screen_coords(mouse_point.h, mouse_point.v);
+ LLCoordGL gl_pos;
+ convertCoords(screen_coords, &gl_pos);
+
+ // Look at the pasteboard and try to extract an URL from it
+ PasteboardRef pasteboard;
+ if(GetDragPasteboard(drag, &pasteboard) == noErr)
+ {
+ ItemCount num_items = 0;
+ // Treat an error here as an item count of 0
+ (void)PasteboardGetItemCount(pasteboard, &num_items);
+
+ // Only deal with single-item drags.
+ if(num_items == 1)
+ {
+ PasteboardItemID item_id = NULL;
+ CFArrayRef flavors = NULL;
+ CFDataRef data = NULL;
+
+ err = PasteboardGetItemIdentifier(pasteboard, 1, &item_id); // Yes, this really is 1-based.
+
+ // Try to extract an URL from the pasteboard
+ if(err == noErr)
+ {
+ err = PasteboardCopyItemFlavors( pasteboard, item_id, &flavors);
+ }
+
+ if(err == noErr)
+ {
+ if(CFArrayContainsValue(flavors, CFRangeMake(0, CFArrayGetCount(flavors)), kUTTypeURL))
+ {
+ // This is an URL.
+ err = PasteboardCopyItemFlavorData(pasteboard, item_id, kUTTypeURL, &data);
+ }
+ else if(CFArrayContainsValue(flavors, CFRangeMake(0, CFArrayGetCount(flavors)), kUTTypeUTF8PlainText))
+ {
+ // This is a string that might be an URL.
+ err = PasteboardCopyItemFlavorData(pasteboard, item_id, kUTTypeUTF8PlainText, &data);
+ }
+
+ }
+
+ if(flavors != NULL)
+ {
+ CFRelease(flavors);
+ }
+
+ if(data != NULL)
+ {
+ std::string url;
+ url.assign((char*)CFDataGetBytePtr(data), CFDataGetLength(data));
+ CFRelease(data);
+
+ if(!url.empty())
+ {
+ LLWindowCallbacks::DragNDropResult res =
+ mCallbacks->handleDragNDrop(this, gl_pos, mask, action, url);
+
+ switch (res) {
+ case LLWindowCallbacks::DND_NONE: // No drop allowed
+ if (action == LLWindowCallbacks::DNDA_TRACK)
+ {
+ mDragOverrideCursor = kThemeNotAllowedCursor;
+ }
+ else {
+ mDragOverrideCursor = -1;
+ }
+ break;
+ case LLWindowCallbacks::DND_MOVE: // Drop accepted would result in a "move" operation
+ mDragOverrideCursor = kThemePointingHandCursor;
+ result = noErr;
+ break;
+ case LLWindowCallbacks::DND_COPY: // Drop accepted would result in a "copy" operation
+ mDragOverrideCursor = kThemeCopyArrowCursor;
+ result = noErr;
+ break;
+ case LLWindowCallbacks::DND_LINK: // Drop accepted would result in a "link" operation:
+ mDragOverrideCursor = kThemeAliasArrowCursor;
+ result = noErr;
+ break;
+ default:
+ mDragOverrideCursor = -1;
+ break;
+ }
+ // This overrides the cursor being set by setCursor.
+ // This is a bit of a hack workaround because lots of areas
+ // within the viewer just blindly set the cursor.
+ if (mDragOverrideCursor == -1)
+ {
+ // Restore the cursor
+ ECursorType temp_cursor = mCurrentCursor;
+ // get around the "setting the same cursor" code in setCursor()
+ mCurrentCursor = UI_CURSOR_COUNT;
+ setCursor(temp_cursor);
+ }
+ else {
+ // Override the cursor
+ SetThemeCursor(mDragOverrideCursor);
+ }
+
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+#endif // LL_OS_DRAGDROP_ENABLED
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index 2fdf80ee82..6dc093b4be 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -2,30 +2,25 @@
* @file llwindowmacosx.h
* @brief Mac implementation of LLWindow class
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -33,6 +28,9 @@
#define LL_LLWINDOWMACOSX_H
#include "llwindow.h"
+#include "llwindowcallbacks.h"
+
+#include "lltimer.h"
#include <Carbon/Carbon.h>
#include <AGL/agl.h>
@@ -53,13 +51,15 @@ public:
/*virtual*/ BOOL getMinimized();
/*virtual*/ BOOL getMaximized();
/*virtual*/ BOOL maximize();
+ /*virtual*/ void minimize();
+ /*virtual*/ void restore();
/*virtual*/ BOOL getFullscreen();
/*virtual*/ BOOL getPosition(LLCoordScreen *position);
/*virtual*/ BOOL getSize(LLCoordScreen *size);
/*virtual*/ BOOL getSize(LLCoordWindow *size);
/*virtual*/ BOOL setPosition(LLCoordScreen position);
/*virtual*/ BOOL setSize(LLCoordScreen size);
- /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync);
+ /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
/*virtual*/ void showCursor();
@@ -68,7 +68,7 @@ public:
/*virtual*/ void hideCursorUntilMouseMove();
/*virtual*/ BOOL isCursorHidden();
/*virtual*/ void setCursor(ECursorType cursor);
- /*virtual*/ ECursorType getCursor();
+ /*virtual*/ ECursorType getCursor() const;
/*virtual*/ void captureMouse();
/*virtual*/ void releaseMouse();
/*virtual*/ void setMouseClipping( BOOL b );
@@ -78,18 +78,14 @@ public:
/*virtual*/ void flashIcon(F32 seconds);
/*virtual*/ F32 getGamma();
/*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
+ /*virtual*/ U32 getFSAASamples();
+ /*virtual*/ void setFSAASamples(const U32 fsaa_samples);
/*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
/*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
/*virtual*/ void gatherInput();
/*virtual*/ void delayInputProcessing() {};
/*virtual*/ void swapBuffers();
- /*virtual*/ LLString getTempFileName();
- /*virtual*/ void deleteFile( const char* file_name );
- /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info );
- /*virtual*/ BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL);
-
-
// handy coordinate space conversion routines
/*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to);
/*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to);
@@ -106,20 +102,28 @@ public:
/*virtual*/ void beforeDialog();
/*virtual*/ void afterDialog();
- /*virtual*/ BOOL dialog_color_picker(F32 *r, F32 *g, F32 *b);
+ /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b);
/*virtual*/ void *getPlatformWindow();
+ /*virtual*/ void *getMediaWindow();
/*virtual*/ void bringToFront() {};
/*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b);
- /*virtual*/ void updateLanguageTextInputArea(const LLCoordGL& caret, const LLRect& bounds);
/*virtual*/ void interruptLanguageTextInput();
+ /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
+
+ static std::vector<std::string> getDynamicFallbackFontList();
+
+ // Provide native key event data
+ /*virtual*/ LLSD getNativeKeyData();
+
protected:
- LLWindowMacOSX(
- char *title, char *name, int x, int y, int width, int height, U32 flags,
+ LLWindowMacOSX(LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
- BOOL ignore_pixel_depth);
+ BOOL ignore_pixel_depth,
+ U32 fsaa_samples);
~LLWindowMacOSX();
void initCursors();
@@ -136,9 +140,6 @@ protected:
// Restore the display resolution to its value before we ran the app.
BOOL resetDisplayResolution();
- void minimize();
- void restore();
-
BOOL shouldPostQuit() { return mPostQuit; }
@@ -150,14 +151,22 @@ protected:
// create or re-create the GL context/window. Called from the constructor and switchContext().
BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync);
void destroyContext();
- void setupFailure(const char* text, const char* caption, U32 type);
+ void setupFailure(const std::string& text, const std::string& caption, U32 type);
static pascal OSStatus staticEventHandler (EventHandlerCallRef myHandler, EventRef event, void* userData);
+ static pascal Boolean staticMoveEventComparator( EventRef event, void* data);
OSStatus eventHandler (EventHandlerCallRef myHandler, EventRef event);
void adjustCursorDecouple(bool warpingMouse = false);
void fixWindowSize(void);
void stopDockTileBounce();
-
-
+ static MASK modifiersToMask(SInt16 modifiers);
+
+#if LL_OS_DRAGDROP_ENABLED
+ static OSErr dragTrackingHandler(DragTrackingMessage message, WindowRef theWindow,
+ void * handlerRefCon, DragRef theDrag);
+ static OSErr dragReceiveHandler(WindowRef theWindow, void * handlerRefCon, DragRef theDrag);
+ OSErr handleDragNDrop(DragRef theDrag, LLWindowCallbacks::DragNDropAction action);
+#endif // LL_OS_DRAGDROP_ENABLED
+
//
// Platform specific variables
//
@@ -170,6 +179,8 @@ protected:
EventHandlerUPP mEventHandlerUPP;
EventHandlerRef mGlobalHandlerRef;
EventHandlerRef mWindowHandlerRef;
+ EventComparatorUPP mMoveEventCampartorUPP;
+
Rect mOldMouseClip; // Screen rect to which the mouse cursor was globally constrained before we changed it in clipMouse()
Str255 mWindowTitle;
double mOriginalAspectRatio;
@@ -185,19 +196,28 @@ protected:
LLCoordScreen mNeedsResizeSize;
F32 mOverrideAspectRatio;
BOOL mMinimized;
-
+ U32 mFSAASamples;
+ BOOL mForceRebuild;
+
+ S32 mDragOverrideCursor;
+
F32 mBounceTime;
NMRec mBounceRec;
LLTimer mBounceTimer;
- // Imput method management through Text Service Manager.
+ // Input method management through Text Service Manager.
TSMDocumentID mTSMDocument;
BOOL mLanguageTextInputAllowed;
ScriptCode mTSMScriptCode;
LangCode mTSMLangCode;
LLPreeditor* mPreeditor;
+
+ static BOOL sUseMultGL;
friend class LLWindowManager;
+ static WindowRef sMediaWindow;
+ EventRef mRawKeyEvent;
+
};
@@ -208,14 +228,14 @@ public:
virtual ~LLSplashScreenMacOSX();
/*virtual*/ void showImpl();
- /*virtual*/ void updateImpl(const char* mesg);
+ /*virtual*/ void updateImpl(const std::string& mesg);
/*virtual*/ void hideImpl();
private:
WindowRef mWindow;
};
-S32 OSMessageBoxMacOSX(const char* text, const char* caption, U32 type);
+S32 OSMessageBoxMacOSX(const std::string& text, const std::string& caption, U32 type);
void load_url_external(const char* url);
diff --git a/indra/llwindow/llwindowmesaheadless.cpp b/indra/llwindow/llwindowmesaheadless.cpp
index f32ca01888..11c22ac94e 100644
--- a/indra/llwindow/llwindowmesaheadless.cpp
+++ b/indra/llwindow/llwindowmesaheadless.cpp
@@ -2,41 +2,33 @@
* @file llwindowmesaheadless.cpp
* @brief Platform-dependent implementation of llwindow
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-#if LL_MESA_HEADLESS
-
#include "linden_common.h"
#include "indra_constants.h"
#include "llwindowmesaheadless.h"
#include "llgl.h"
-#include "llglheaders.h"
#define MESA_CHANNEL_TYPE GL_UNSIGNED_SHORT
#define MESA_CHANNEL_SIZE 2
@@ -46,10 +38,11 @@ U16 *gMesaBuffer = NULL;
//
// LLWindowMesaHeadless
//
-LLWindowMesaHeadless::LLWindowMesaHeadless(char *title, char *name, S32 x, S32 y, S32 width, S32 height,
+LLWindowMesaHeadless::LLWindowMesaHeadless(LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
U32 flags, BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth)
- : LLWindow(fullscreen, flags)
+ : LLWindow(callbacks, fullscreen, flags)
{
if (use_gl)
{
@@ -83,5 +76,3 @@ void LLWindowMesaHeadless::swapBuffers()
{
glFinish();
}
-
-#endif
diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h
index fe91a2d2a0..fd4bd635e2 100644
--- a/indra/llwindow/llwindowmesaheadless.h
+++ b/indra/llwindow/llwindowmesaheadless.h
@@ -2,30 +2,25 @@
* @file llwindowmesaheadless.h
* @brief Windows implementation of LLWindow class
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,13 +43,15 @@ public:
/*virtual*/ BOOL getMinimized() {return FALSE;};
/*virtual*/ BOOL getMaximized() {return FALSE;};
/*virtual*/ BOOL maximize() {return FALSE;};
+ /*virtual*/ void minimize() {};
+ /*virtual*/ void restore() {};
/*virtual*/ BOOL getFullscreen() {return FALSE;};
/*virtual*/ BOOL getPosition(LLCoordScreen *position) {return FALSE;};
/*virtual*/ BOOL getSize(LLCoordScreen *size) {return FALSE;};
/*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;};
/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
/*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;};
- /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) {return FALSE;};
+ /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
/*virtual*/ void showCursor() {};
@@ -74,17 +71,13 @@ public:
/*virtual*/ F32 getGamma() {return 1.0f; };
/*virtual*/ BOOL setGamma(const F32 gamma) {return FALSE; }; // Set the gamma
/*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma)
+ /*virtual*/ void setFSAASamples(const U32 fsaa_samples) { /* FSAA not supported yet on Mesa headless.*/ }
+ /*virtual*/ U32 getFSAASamples() { return 0; }
//virtual ESwapMethod getSwapMethod() { return mSwapMethod; }
/*virtual*/ void gatherInput() {};
/*virtual*/ void delayInputProcessing() {};
/*virtual*/ void swapBuffers();
- /*virtual*/ LLString getTempFileName() {return LLString(""); };
- /*virtual*/ void deleteFile( const char* file_name ) {};
- /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info ) {return 0; };
- /*virtual*/ BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL) { return FALSE; };
-
-
// handy coordinate space conversion routines
/*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) { return FALSE; };
/*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) { return FALSE; };
@@ -101,7 +94,8 @@ public:
/*virtual*/ void *getPlatformWindow() { return 0; };
/*virtual*/ void bringToFront() {};
- LLWindowMesaHeadless(char *title, char *name, S32 x, S32 y, S32 width, S32 height,
+ LLWindowMesaHeadless(LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
U32 flags, BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
~LLWindowMesaHeadless();
@@ -118,7 +112,7 @@ public:
virtual ~LLSplashScreenMesaHeadless() {};
/*virtual*/ void showImpl() {};
- /*virtual*/ void updateImpl(const char* mesg) {};
+ /*virtual*/ void updateImpl(const std::string& mesg) {};
/*virtual*/ void hideImpl() {};
};
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index 686be3385e..b65287715c 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -1,31 +1,27 @@
/**
* @file llwindowsdl.cpp
* @brief SDL implementation of LLWindow class
+ * @author This module has many fathers, and it shows.
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,22 +30,27 @@
#include "linden_common.h"
#include "llwindowsdl.h"
+
+#include "llwindowcallbacks.h"
#include "llkeyboardsdl.h"
+
#include "llerror.h"
#include "llgl.h"
#include "llstring.h"
#include "lldir.h"
-
-#include "llglheaders.h"
-
-#include "indra_constants.h"
+#include "llfindlocale.h"
#if LL_GTK
extern "C" {
# include "gtk/gtk.h"
}
+#include <locale.h>
#endif // LL_GTK
+extern "C" {
+# include "fontconfig/fontconfig.h"
+}
+
#if LL_LINUX || LL_SOLARIS
// not necessarily available on random SDL platforms, so #if LL_LINUX
// for execv(), waitpid(), fork()
@@ -60,7 +61,10 @@ extern "C" {
extern BOOL gDebugWindowProc;
-const S32 MAX_NUM_RESOLUTIONS = 32;
+const S32 MAX_NUM_RESOLUTIONS = 200;
+
+// static variable for ATI mouse cursor crash work-around:
+static bool ATIbug = false;
//
// LLWindowSDL
@@ -76,12 +80,10 @@ const S32 MAX_NUM_RESOLUTIONS = 32;
// be only one object of this class at any time. Currently this is true.
static LLWindowSDL *gWindowImplementation = NULL;
-static BOOL was_fullscreen = FALSE;
-
void maybe_lock_display(void)
{
- if (gWindowImplementation) {
+ if (gWindowImplementation && gWindowImplementation->Lock_Display) {
gWindowImplementation->Lock_Display();
}
}
@@ -89,7 +91,7 @@ void maybe_lock_display(void)
void maybe_unlock_display(void)
{
- if (gWindowImplementation) {
+ if (gWindowImplementation && gWindowImplementation->Unlock_Display) {
gWindowImplementation->Unlock_Display();
}
}
@@ -97,7 +99,8 @@ void maybe_unlock_display(void)
#if LL_GTK
// Lazily initialize and check the runtime GTK version for goodness.
-BOOL ll_try_gtk_init(void)
+// static
+bool LLWindowSDL::ll_try_gtk_init(void)
{
static BOOL done_gtk_diag = FALSE;
static BOOL gtk_is_good = FALSE;
@@ -116,9 +119,7 @@ BOOL ll_try_gtk_init(void)
if (!tried_gtk_init)
{
tried_gtk_init = TRUE;
-#if LL_GSTREAMER_ENABLED
if (!g_thread_supported ()) g_thread_init (NULL);
-#endif // LL_GSTREAMER_ENABLED
maybe_lock_display();
gtk_is_good = gtk_init_check(NULL, NULL);
maybe_unlock_display();
@@ -137,17 +138,19 @@ BOOL ll_try_gtk_init(void)
<< gtk_major_version << "."
<< gtk_minor_version << "."
<< gtk_micro_version << llendl;
- gchar *gtk_warning;
maybe_lock_display();
- gtk_warning = gtk_check_version(GTK_MAJOR_VERSION,
- GTK_MINOR_VERSION,
- GTK_MICRO_VERSION);
+ const gchar* gtk_warning = gtk_check_version(
+ GTK_MAJOR_VERSION,
+ GTK_MINOR_VERSION,
+ GTK_MICRO_VERSION);
maybe_unlock_display();
if (gtk_warning)
{
llwarns << "- GTK COMPATIBILITY WARNING: " <<
gtk_warning << llendl;
gtk_is_good = FALSE;
+ } else {
+ llinfos << "- GTK version is good." << llendl;
}
done_gtk_diag = TRUE;
@@ -159,7 +162,8 @@ BOOL ll_try_gtk_init(void)
#if LL_X11
-Window get_SDL_XWindowID(void)
+// static
+Window LLWindowSDL::get_SDL_XWindowID(void)
{
if (gWindowImplementation) {
return gWindowImplementation->mSDL_XWindowID;
@@ -167,7 +171,8 @@ Window get_SDL_XWindowID(void)
return None;
}
-Display* get_SDL_Display(void)
+//static
+Display* LLWindowSDL::get_SDL_Display(void)
{
if (gWindowImplementation) {
return gWindowImplementation->mSDL_Display;
@@ -177,65 +182,30 @@ Display* get_SDL_Display(void)
#endif // LL_X11
-BOOL check_for_card(const char* RENDERER, const char* bad_card)
-{
- if (!strncasecmp(RENDERER, bad_card, strlen(bad_card)))
- {
- char buffer[1024]; /* Flawfinder: ignore */
- snprintf(buffer, sizeof(buffer),
- "Your video card appears to be a %s, which Second Life does not support.\n"
- "\n"
- "Second Life requires a video card with 32 Mb of memory or more, as well as\n"
- "multitexture support. We explicitly support nVidia GeForce 2 or better, \n"
- "and ATI Radeon 8500 or better.\n"
- "\n"
- "If you own a supported card and continue to receive this message, try \n"
- "updating to the latest video card drivers. Otherwise look in the\n"
- "secondlife.com support section or e-mail technical support\n"
- "\n"
- "You can try to run Second Life, but it will probably crash or run\n"
- "very slowly. Try anyway?",
- bad_card);
- S32 button = OSMessageBox(buffer, "Unsupported video card", OSMB_YESNO);
- if (OSBTN_YES == button)
- {
- return FALSE;
- }
- else
- {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-
-
-
-LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width,
- S32 height, U32 flags,
- BOOL fullscreen, BOOL clearBg,
- BOOL disable_vsync, BOOL use_gl,
- BOOL ignore_pixel_depth)
- : LLWindow(fullscreen, flags), mGamma(1.0f)
+LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
+ const std::string& title, S32 x, S32 y, S32 width,
+ S32 height, U32 flags,
+ BOOL fullscreen, BOOL clearBg,
+ BOOL disable_vsync, BOOL use_gl,
+ BOOL ignore_pixel_depth, U32 fsaa_samples)
+ : LLWindow(callbacks, fullscreen, flags),
+ Lock_Display(NULL),
+ Unlock_Display(NULL), mGamma(1.0f)
{
// Initialize the keyboard
gKeyboard = new LLKeyboardSDL();
+ gKeyboard->setCallbacks(callbacks);
// Note that we can't set up key-repeat until after SDL has init'd video
// Ignore use_gl for now, only used for drones on PC
mWindow = NULL;
- mCursorDecoupled = FALSE;
- mCursorLastEventDeltaX = 0;
- mCursorLastEventDeltaY = 0;
- mCursorIgnoreNextDelta = FALSE;
mNeedsResize = FALSE;
mOverrideAspectRatio = 0.f;
mGrabbyKeyFlags = 0;
mReallyCapturedCount = 0;
mHaveInputFocus = -1;
mIsMinimized = -1;
+ mFSAASamples = fsaa_samples;
#if LL_X11
mSDL_XWindowID = None;
@@ -243,28 +213,20 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width,
#endif // LL_X11
#if LL_GTK
- // We MUST be the first to initialize GTK, i.e. we have to beat
- // our embedded Mozilla to the punch so that GTK doesn't get badly
+ // We MUST be the first to initialize GTK so that GTK doesn't get badly
// initialized with a non-C locale and cause lots of serious random
// weirdness.
ll_try_gtk_init();
#endif // LL_GTK
- // Get the original aspect ratio of the main device.
- mOriginalAspectRatio = 1024.0 / 768.0; // !!! *FIX: ? //(double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay);
+ // Assume 4:3 aspect ratio until we know better
+ mOriginalAspectRatio = 1024.0 / 768.0;
- if (!title)
- title = "SDL Window"; // *FIX: (???)
-
- // Stash the window title
- mWindowTitle = new char[strlen(title) + 1]; /* Flawfinder: ignore */
- if(mWindowTitle == NULL)
- {
- llerrs << "Memory allocation failure" << llendl;
- return;
- }
+ if (title.empty())
+ mWindowTitle = "SDL Window"; // *FIX: (???)
+ else
+ mWindowTitle = title;
- strcpy(mWindowTitle, title); /* Flawfinder: ignore */
// Create the GL context and set it up for windowed or fullscreen, as appropriate.
if(createContext(x, y, width, height, 32, fullscreen, disable_vsync))
{
@@ -283,6 +245,10 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width,
#if LL_X11
mFlashing = FALSE;
#endif // LL_X11
+
+ mKeyScanCode = 0;
+ mKeyVirtualKey = 0;
+ mKeyModifiers = KMOD_NONE;
}
static SDL_Surface *Load_BMP_Resource(const char *basename)
@@ -304,7 +270,7 @@ static SDL_Surface *Load_BMP_Resource(const char *basename)
#if LL_X11
// This is an XFree86/XOrg-specific hack for detecting the amount of Video RAM
// on this machine. It works by searching /var/log/var/log/Xorg.?.log or
-// /var/log/XFree86.?.log for a ': (VideoRAM|Memory): (%d+) kB' regex, where
+// /var/log/XFree86.?.log for a ': (VideoRAM ?|Memory): (%d+) kB' regex, where
// '?' is the X11 display number derived from $DISPLAY
static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str)
{
@@ -318,6 +284,8 @@ static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str)
// favourite regex implementation - libboost_regex - is
// quite a heavy and troublesome dependency for the client, so
// it seems a shame to introduce it for such a simple task.
+ // *FIXME: libboost_regex is a dependency now anyway, so we may
+ // as well use it instead of this hand-rolled nonsense.
const char *part1_template = prefix_str;
const char part2_template[] = " kB";
char *part1 = strstr(line_buf, part1_template);
@@ -355,8 +323,7 @@ static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str)
static int x11_detect_VRAM_kb()
{
-#if LL_SOLARIS
-#error Can this be done without an explicit architecture test, ie a test FOR xorg? Was followed by: && defined(__sparc)
+#if LL_SOLARIS && defined(__sparc)
// NOTE: there's no Xorg server on SPARC so just return 0
// and allow SDL to attempt to get the amount of VRAM
return(0);
@@ -395,8 +362,17 @@ static int x11_detect_VRAM_kb()
fp = fopen(fname.c_str(), "r");
if (fp)
{
- rtn = x11_detect_VRAM_kb_fp(fp, ": Memory: ");
+ rtn = x11_detect_VRAM_kb_fp(fp, ": Video RAM: ");
fclose(fp);
+ if (0 == rtn)
+ {
+ fp = fopen(fname.c_str(), "r");
+ if (fp)
+ {
+ rtn = x11_detect_VRAM_kb_fp(fp, ": Memory: ");
+ fclose(fp);
+ }
+ }
}
}
}
@@ -440,7 +416,6 @@ static int x11_detect_VRAM_kb()
BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync)
{
//bool glneedsinit = false;
-// const char *gllibname = null;
llinfos << "createContext, fullscreen=" << fullscreen <<
" size=" << width << "x" << height << llendl;
@@ -452,7 +427,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
llinfos << "sdl_init() failed! " << SDL_GetError() << llendl;
- setupFailure("window creation error", "error", OSMB_OK);
+ setupFailure("sdl_init() failure, window creation error", "error", OSMB_OK);
return false;
}
@@ -469,16 +444,22 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
<< int(r_sdl_version->minor) << "."
<< int(r_sdl_version->patch) << llendl;
- const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo( );
- if (!videoInfo)
+ const SDL_VideoInfo *video_info = SDL_GetVideoInfo( );
+ if (!video_info)
{
llinfos << "SDL_GetVideoInfo() failed! " << SDL_GetError() << llendl;
- setupFailure("Window creation error", "Error", OSMB_OK);
+ setupFailure("SDL_GetVideoInfo() failed, Window creation error", "Error", OSMB_OK);
return FALSE;
}
+ if (video_info->current_h > 0)
+ {
+ mOriginalAspectRatio = (float)video_info->current_w / (float)video_info->current_h;
+ llinfos << "Original aspect ratio was " << video_info->current_w << ":" << video_info->current_h << "=" << mOriginalAspectRatio << llendl;
+ }
+
SDL_EnableUNICODE(1);
- SDL_WM_SetCaption(mWindowTitle, mWindowTitle);
+ SDL_WM_SetCaption(mWindowTitle.c_str(), mWindowTitle.c_str());
// Set the application icon.
SDL_Surface *bmpsurface;
@@ -529,12 +510,17 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
// *FIX: try to toggle vsync here?
mFullscreen = fullscreen;
- was_fullscreen = fullscreen;
int sdlflags = SDL_OPENGL | SDL_RESIZABLE | SDL_ANYFORMAT;
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ if (mFSAASamples > 0)
+ {
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, mFSAASamples);
+ }
+
mSDLFlags = sdlflags;
if (mFullscreen)
@@ -599,7 +585,6 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
if (mWindow)
{
mFullscreen = TRUE;
- was_fullscreen = TRUE;
mFullscreenWidth = mWindow->w;
mFullscreenHeight = mWindow->h;
mFullscreenBits = mWindow->format->BitsPerPixel;
@@ -616,14 +601,12 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
llwarns << "createContext: fullscreen creation failure. SDL: " << SDL_GetError() << llendl;
// No fullscreen support
mFullscreen = FALSE;
- was_fullscreen = FALSE;
mFullscreenWidth = -1;
mFullscreenHeight = -1;
mFullscreenBits = -1;
mFullscreenRefresh = -1;
- char error[256]; /* Flawfinder: ignore */
- snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
+ std::string error = llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
OSMessageBox(error, "Error", OSMB_OK);
}
}
@@ -666,7 +649,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
// fallback to letting SDL detect VRAM.
// note: I've not seen SDL's detection ever actually find
// VRAM != 0, but if SDL *does* detect it then that's a bonus.
- gGLManager.mVRAM = videoInfo->video_mem / 1024;
+ gGLManager.mVRAM = video_info->video_mem / 1024;
if (gGLManager.mVRAM != 0)
{
llinfos << "SDL detected " << gGLManager.mVRAM << "MB VRAM." << llendl;
@@ -687,20 +670,20 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
glGetIntegerv(GL_DEPTH_BITS, &depthBits);
glGetIntegerv(GL_STENCIL_BITS, &stencilBits);
- llinfos << "GL buffer:" << llendl
- llinfos << " Red Bits " << S32(redBits) << llendl
- llinfos << " Green Bits " << S32(greenBits) << llendl
- llinfos << " Blue Bits " << S32(blueBits) << llendl
- llinfos << " Alpha Bits " << S32(alphaBits) << llendl
- llinfos << " Depth Bits " << S32(depthBits) << llendl
+ llinfos << "GL buffer:" << llendl;
+ llinfos << " Red Bits " << S32(redBits) << llendl;
+ llinfos << " Green Bits " << S32(greenBits) << llendl;
+ llinfos << " Blue Bits " << S32(blueBits) << llendl;
+ llinfos << " Alpha Bits " << S32(alphaBits) << llendl;
+ llinfos << " Depth Bits " << S32(depthBits) << llendl;
llinfos << " Stencil Bits " << S32(stencilBits) << llendl;
GLint colorBits = redBits + greenBits + blueBits + alphaBits;
// fixme: actually, it's REALLY important for picking that we get at
// least 8 bits each of red,green,blue. Alpha we can be a bit more
// relaxed about if we have to.
-#if LL_SOLARIS
-#error && defined(__sparc)
+#if LL_SOLARIS && defined(__sparc)
+// again the __sparc required because Xsun support, 32bit are very pricey on SPARC
if(colorBits < 24) //HACK: on SPARC allow 24-bit color
#else
if (colorBits < 32)
@@ -708,8 +691,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
{
close();
setupFailure(
-#if LL_SOLARIS
-#error && defined(__sparc)
+#if LL_SOLARIS && defined(__sparc)
"Second Life requires at least 24-bit color on SPARC to run in a window.\n"
"Please use fbconfig to set your default color depth to 24 bits.\n"
"You may also need to adjust the X11 setting in SMF. To do so use\n"
@@ -744,8 +726,35 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
#endif
#if LL_X11
- init_x11clipboard();
+ /* Grab the window manager specific information */
+ SDL_SysWMinfo info;
+ SDL_VERSION(&info.version);
+ if ( SDL_GetWMInfo(&info) )
+ {
+ /* Save the information for later use */
+ if ( info.subsystem == SDL_SYSWM_X11 )
+ {
+ mSDL_Display = info.info.x11.display;
+ mSDL_XWindowID = info.info.x11.wmwindow;
+ Lock_Display = info.info.x11.lock_func;
+ Unlock_Display = info.info.x11.unlock_func;
+ }
+ else
+ {
+ llwarns << "We're not running under X11? Wild."
+ << llendl;
+ }
+ }
+ else
+ {
+ llwarns << "We're not running under any known WM. Wild."
+ << llendl;
+ }
#endif // LL_X11
+
+
+ //make sure multisampling is disabled by default
+ glDisable(GL_MULTISAMPLE_ARB);
// We need to do this here, once video is init'd
if (-1 == SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,
@@ -758,7 +767,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
// changing fullscreen resolution, or switching between windowed and fullscreen mode.
-BOOL LLWindowSDL::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync)
+BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
{
const BOOL needsRebuild = TRUE; // Just nuke the context and start over.
BOOL result = true;
@@ -787,8 +796,12 @@ BOOL LLWindowSDL::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disabl
void LLWindowSDL::destroyContext()
{
llinfos << "destroyContext begins" << llendl;
+
#if LL_X11
- quit_x11clipboard();
+ mSDL_Display = NULL;
+ mSDL_XWindowID = None;
+ Lock_Display = NULL;
+ Unlock_Display = NULL;
#endif // LL_X11
// Clean up remaining GL state before blowing away window
@@ -796,7 +809,6 @@ void LLWindowSDL::destroyContext()
gGLManager.shutdownGL();
llinfos << "SDL_QuitSS/VID begins" << llendl;
SDL_QuitSubSystem(SDL_INIT_VIDEO); // *FIX: this might be risky...
- //unload_all_glsyms();
mWindow = NULL;
}
@@ -811,8 +823,6 @@ LLWindowSDL::~LLWindowSDL()
delete []mSupportedResolutions;
}
- delete[] mWindowTitle;
-
gWindowImplementation = NULL;
}
@@ -827,11 +837,13 @@ void LLWindowSDL::hide()
// *FIX: What to do with SDL?
}
+//virtual
void LLWindowSDL::minimize()
{
// *FIX: What to do with SDL?
}
+//virtual
void LLWindowSDL::restore()
{
// *FIX: What to do with SDL?
@@ -922,10 +934,9 @@ BOOL LLWindowSDL::getSize(LLCoordScreen *size)
{
size->mX = mWindow->w;
size->mY = mWindow->h;
- return (TRUE);
+ return (TRUE);
}
- llerrs << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl;
return (FALSE);
}
@@ -935,10 +946,9 @@ BOOL LLWindowSDL::getSize(LLCoordWindow *size)
{
size->mX = mWindow->w;
size->mY = mWindow->h;
- return (TRUE);
+ return (TRUE);
}
- llerrs << "LLWindowSDL::getPosition(): no window and not fullscreen!" << llendl;
return (FALSE);
}
@@ -957,11 +967,18 @@ BOOL LLWindowSDL::setSize(const LLCoordScreen size)
{
if(mWindow)
{
- // *FIX: (???)
- //SizeWindow(mWindow, size.mX, size.mY, true);
- }
+ // Push a resize event onto SDL's queue - we'll handle it
+ // when it comes out again.
+ SDL_Event event;
+ event.type = SDL_VIDEORESIZE;
+ event.resize.w = size.mX;
+ event.resize.h = size.mY;
+ SDL_PushEvent(&event); // copied into queue
- return TRUE;
+ return TRUE;
+ }
+
+ return FALSE;
}
void LLWindowSDL::swapBuffers()
@@ -970,6 +987,16 @@ void LLWindowSDL::swapBuffers()
SDL_GL_SwapBuffers();
}
+U32 LLWindowSDL::getFSAASamples()
+{
+ return mFSAASamples;
+}
+
+void LLWindowSDL::setFSAASamples(const U32 samples)
+{
+ mFSAASamples = samples;
+}
+
F32 LLWindowSDL::getGamma()
{
return 1/mGamma;
@@ -1001,11 +1028,7 @@ BOOL LLWindowSDL::isCursorHidden()
// Constrains the mouse to the window.
void LLWindowSDL::setMouseClipping( BOOL b )
{
- //llinfos << "LLWindowSDL::setMouseClipping " << b << llendl;
- // Just stash the requested state. We'll simulate this when the cursor is hidden by decoupling.
- mIsMouseClipping = b;
//SDL_WM_GrabInput(b ? SDL_GRAB_ON : SDL_GRAB_OFF);
- adjustCursorDecouple();
}
BOOL LLWindowSDL::setCursorPosition(const LLCoordWindow position)
@@ -1020,10 +1043,10 @@ BOOL LLWindowSDL::setCursorPosition(const LLCoordWindow position)
//llinfos << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << llendl;
- SDL_WarpMouse(screen_pos.mX, screen_pos.mY);
-
- // Under certain circumstances, this will trigger us to decouple the cursor.
- adjustCursorDecouple(true);
+ // do the actual forced cursor move.
+ SDL_WarpMouse(screen_pos.mX, screen_pos.mY);
+
+ //llinfos << llformat("llcw %d,%d -> scr %d,%d", position.mX, position.mY, screen_pos.mX, screen_pos.mY) << llendl;
return result;
}
@@ -1043,33 +1066,6 @@ BOOL LLWindowSDL::getCursorPosition(LLCoordWindow *position)
return convertCoords(screen_pos, position);
}
-void LLWindowSDL::adjustCursorDecouple(bool warpingMouse)
-{
- if(mIsMouseClipping && mCursorHidden)
- {
- if(warpingMouse)
- {
- // The cursor should be decoupled. Make sure it is.
- if(!mCursorDecoupled)
- {
- // llinfos << "adjustCursorDecouple: decoupling cursor" << llendl;
- //CGAssociateMouseAndMouseCursorPosition(false);
- mCursorDecoupled = true;
- mCursorIgnoreNextDelta = TRUE;
- }
- }
- }
- else
- {
- // The cursor should not be decoupled. Make sure it isn't.
- if(mCursorDecoupled)
- {
- // llinfos << "adjustCursorDecouple: recoupling cursor" << llendl;
- //CGAssociateMouseAndMouseCursorPosition(true);
- mCursorDecoupled = false;
- }
- }
-}
F32 LLWindowSDL::getNativeAspectRatio()
{
@@ -1116,32 +1112,38 @@ F32 LLWindowSDL::getPixelAspectRatio()
if (getFullscreen())
{
LLCoordScreen screen_size;
- getSize(&screen_size);
- pixel_aspect = getNativeAspectRatio() * (F32)screen_size.mY / (F32)screen_size.mX;
+ if (getSize(&screen_size))
+ {
+ pixel_aspect = getNativeAspectRatio() * (F32)screen_size.mY / (F32)screen_size.mX;
+ }
}
return pixel_aspect;
}
-// some of this stuff is to support 'temporarily windowed' mode so that
-// dialogs are still usable in fullscreen. HOWEVER! - it's not enabled/working
-// yet.
-static LLCoordScreen old_size;
-static BOOL old_fullscreen;
+// This is to support 'temporarily windowed' mode so that
+// dialogs are still usable in fullscreen.
void LLWindowSDL::beforeDialog()
{
+ bool running_x11 = false;
+#if LL_X11
+ running_x11 = (mSDL_XWindowID != None);
+#endif //LL_X11
+
llinfos << "LLWindowSDL::beforeDialog()" << llendl;
- if (SDLReallyCaptureInput(FALSE) // must ungrab input so popup works!
- && getSize(&old_size))
+ if (SDLReallyCaptureInput(FALSE)) // must ungrab input so popup works!
{
- old_fullscreen = was_fullscreen;
-
- if (old_fullscreen)
+ if (mFullscreen)
{
- // NOT YET WORKING
- //switchContext(FALSE, old_size, TRUE);
+ // need to temporarily go non-fullscreen; bless SDL
+ // for providing a SDL_WM_ToggleFullScreen() - though
+ // it only works in X11
+ if (running_x11 && mWindow)
+ {
+ SDL_WM_ToggleFullScreen(mWindow);
+ }
}
}
@@ -1167,25 +1169,27 @@ void LLWindowSDL::beforeDialog()
void LLWindowSDL::afterDialog()
{
+ bool running_x11 = false;
+#if LL_X11
+ running_x11 = (mSDL_XWindowID != None);
+#endif //LL_X11
+
llinfos << "LLWindowSDL::afterDialog()" << llendl;
maybe_unlock_display();
- if (old_fullscreen && !was_fullscreen)
+ if (mFullscreen)
{
- // *FIX: NOT YET WORKING (see below)
- //switchContext(TRUE, old_size, TRUE);
+ // need to restore fullscreen mode after dialog - only works
+ // in X11
+ if (running_x11 && mWindow)
+ {
+ SDL_WM_ToggleFullScreen(mWindow);
+ }
}
- // *FIX: we need to restore the GL context using
- // LLViewerWindow::restoreGL() - but how??
}
-S32 LLWindowSDL::stat(const char* file_name, struct stat* stat_info)
-{
- return ::stat( file_name, stat_info );
-}
-
#if LL_X11
// set/reset the XWMHints flag for 'urgency' that usually makes the icon flash
void LLWindowSDL::x11_set_urgent(BOOL urgent)
@@ -1232,532 +1236,126 @@ void LLWindowSDL::flashIcon(F32 seconds)
#endif // LL_X11
}
-#if LL_X11
-/* Lots of low-level X11 stuff to handle X11 copy-and-paste */
-
-/* Our X11 clipboard support is a bit bizarre in various
- organically-grown ways. Ideally it should be fixed to do
- real string-type negotiation (this would make pasting to
- xterm faster and pasting to UTF-8 emacs work properly), but
- right now it has the rare and desirable trait of being
- generally stable and working. */
-
-typedef Atom x11clipboard_type;
-
-/* PRIMARY and CLIPBOARD are the two main kinds of
- X11 clipboard. A third are the CUT_BUFFERs which an
- obsolete holdover from X10 days and use a quite orthogonal
- mechanism. CLIPBOARD is the type whose design most
- closely matches SL's own win32-alike explicit copy-and-paste
- paradigm.
-
- Pragmatically we support all three to varying degrees. When
- we paste into SL, it is strictly from CLIPBOARD. When we copy,
- we support (to as full an extent as the clipboard content type
- allows) CLIPBOARD, PRIMARY, and CUT_BUFFER0.
- */
-static x11clipboard_type get_x11_readwrite_clipboard_type(void)
-{
- return XInternAtom(get_SDL_Display(), "CLIPBOARD", False);
-}
-
-static x11clipboard_type get_x11_write_clipboard_type(void)
-{
- return XA_PRIMARY;
-}
-
-/* This is where our own private cutbuffer goes - we don't use
- a regular cutbuffer (XA_CUT_BUFFER0 etc) for intermediate
- storage because their use isn't really defined for holding UTF8. */
-static x11clipboard_type get_x11_cutbuffer_clipboard_type(void)
-{
- return XInternAtom(get_SDL_Display(), "SECONDLIFE_CUTBUFFER", False);
-}
-
-/* Some X11 atom-generators */
-static Atom get_x11_targets_atom(void)
-{
- return XInternAtom(get_SDL_Display(), "TARGETS", False);
-}
-static Atom get_x11_text_atom(void)
-{
- return XInternAtom(get_SDL_Display(), "TEXT", False);
-}
-
-/* These defines, and convert_data/convert_x11clipboard,
- mostly exist to support non-text or unusually-encoded
- clipboard data, which we don't really have a need for at
- the moment. */
-#define SDLCLIPTYPE(A, B, C, D) (int)(((A)<<24)|((B)<<16)|((C)<<8)|((D)<<0))
-#define FORMAT_PREFIX "SECONDLIFE_x11clipboard_0x"
-
-static
-x11clipboard_type convert_format(int type)
+#if LL_GTK
+BOOL LLWindowSDL::isClipboardTextAvailable()
{
- if (!gWindowImplementation)
- {
- llwarns << "!gWindowImplementation in convert_format()"
- << llendl;
- return XA_STRING;
- }
-
- switch (type)
- {
- case SDLCLIPTYPE('T', 'E', 'X', 'T'):
- // old-style X11 clipboard, strictly only ISO 8859-1 encoding
- return XA_STRING;
- case SDLCLIPTYPE('U', 'T', 'F', '8'):
- // newer de-facto UTF8 clipboard atom
- return XInternAtom(gWindowImplementation->mSDL_Display,
- "UTF8_STRING", False);
- default:
+ if (ll_try_gtk_init())
{
- /* completely arbitrary clipboard types... we don't actually use
- these right now, and support is skeletal. */
- char format[sizeof(FORMAT_PREFIX)+8+1]; /* Flawfinder: ignore */
-
- snprintf(format, sizeof(format), "%s%08lx", FORMAT_PREFIX, (unsigned long)type);
- return XInternAtom(gWindowImplementation->mSDL_Display,
- format, False);
+ GtkClipboard * const clipboard =
+ gtk_clipboard_get(GDK_NONE);
+ return gtk_clipboard_wait_is_text_available(clipboard) ?
+ TRUE : FALSE;
}
- }
+ return FALSE; // failure
}
-/* convert platform string to x11 clipboard format. for our
- purposes this is pretty trivial right now. */
-static int
-convert_data(int type, char *dst, const char *src, int srclen)
+BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &text)
{
- int dstlen;
-
- dstlen = 0;
- switch (type)
+ if (ll_try_gtk_init())
{
- case SDLCLIPTYPE('T', 'E', 'X', 'T'):
- case SDLCLIPTYPE('U', 'T', 'F', '8'):
- if (src == NULL)
+ GtkClipboard * const clipboard =
+ gtk_clipboard_get(GDK_NONE);
+ gchar * const data = gtk_clipboard_wait_for_text(clipboard);
+ if (data)
{
- break;
- }
- if ( srclen == 0 )
- srclen = strlen(src); /* Flawfinder: ignore */
-
- dstlen = srclen + 1;
-
- if ( dst ) // assume caller made it big enough by asking us
- {
- memcpy(dst, src, srclen); /* Flawfinder: ignore */
- dst[srclen] = '\0';
+ text = LLWString(utf8str_to_wstring(data));
+ g_free(data);
+ return TRUE;
}
- break;
-
- default:
- llwarns << "convert_data: Unknown medium type" << llendl;
- break;
}
- return(dstlen);
+ return FALSE; // failure
}
-/* Convert x11clipboard data to platform string. This too is
- pretty trivial for our needs right now, and just about identical
- to above. */
-static int
-convert_x11clipboard(int type, char *dst, const char *src, int srclen)
+BOOL LLWindowSDL::copyTextToClipboard(const LLWString &text)
{
- int dstlen;
-
- dstlen = 0;
- switch (type)
+ if (ll_try_gtk_init())
{
- case SDLCLIPTYPE('U', 'T', 'F', '8'):
- case SDLCLIPTYPE('T', 'E', 'X', 'T'):
- if (src == NULL)
- {
- break;
- }
- if ( srclen == 0 )
- srclen = strlen(src); /* Flawfinder: ignore */
-
- dstlen = srclen + 1;
-
- if ( dst ) // assume caller made it big enough by asking us
- {
- memcpy(dst, src, srclen); /* Flawfinder: ignore */
- dst[srclen] = '\0';
- }
- break;
-
- default:
- llwarns << "convert_x11clipboard: Unknown medium type" << llendl;
- break;
+ const std::string utf8 = wstring_to_utf8str(text);
+ GtkClipboard * const clipboard =
+ gtk_clipboard_get(GDK_NONE);
+ gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length());
+ return TRUE;
}
- return dstlen;
+ return FALSE; // failure
}
-int
-LLWindowSDL::is_empty_x11clipboard(void)
-{
- int retval;
-
- maybe_lock_display();
- retval = ( XGetSelectionOwner(mSDL_Display, get_x11_readwrite_clipboard_type()) == None );
- maybe_unlock_display();
-
- return(retval);
-}
-void
-LLWindowSDL::put_x11clipboard(int type, int srclen, const char *src)
+BOOL LLWindowSDL::isPrimaryTextAvailable()
{
- x11clipboard_type format;
- int dstlen;
- char *dst;
-
- format = convert_format(type);
- dstlen = convert_data(type, NULL, src, srclen);
-
- dst = (char *)malloc(dstlen);
- if ( dst != NULL )
+ if (ll_try_gtk_init())
{
- maybe_lock_display();
- Window root = DefaultRootWindow(mSDL_Display);
- convert_data(type, dst, src, srclen);
- // Cutbuffers are only allowed to have STRING atom types,
- // but Emacs puts UTF8 inside them anyway. We cautiously
- // don't.
- if (type == SDLCLIPTYPE('T','E','X','T'))
- {
- // dstlen-1 so we don't include the trailing \0
- llinfos << "X11: Populating cutbuffer." <<llendl;
- XChangeProperty(mSDL_Display, root,
- XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace,
- (unsigned char*)dst, dstlen-1);
- } else {
- // Should we clear the cutbuffer if we can't put the selection in
- // it because it's a UTF8 selection? Eh, no great reason I think.
- //XDeleteProperty(SDL_Display, root, XA_CUT_BUFFER0);
- }
- // Private cutbuffer of an appropriate type.
- XChangeProperty(mSDL_Display, root,
- get_x11_cutbuffer_clipboard_type(), format, 8, PropModeReplace,
- (unsigned char*)dst, dstlen-1);
- free(dst);
-
- /* Claim ownership of both PRIMARY and CLIPBOARD */
- XSetSelectionOwner(mSDL_Display, get_x11_readwrite_clipboard_type(),
- mSDL_XWindowID, CurrentTime);
- XSetSelectionOwner(mSDL_Display, get_x11_write_clipboard_type(),
- mSDL_XWindowID, CurrentTime);
-
- maybe_unlock_display();
+ GtkClipboard * const clipboard =
+ gtk_clipboard_get(GDK_SELECTION_PRIMARY);
+ return gtk_clipboard_wait_is_text_available(clipboard) ?
+ TRUE : FALSE;
}
+ return FALSE; // failure
}
-void
-LLWindowSDL::get_x11clipboard(int type, int *dstlen, char **dst)
+BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &text)
{
- x11clipboard_type format;
-
- *dstlen = 0;
- format = convert_format(type);
-
- Window owner;
- Atom selection;
- Atom seln_type;
- int seln_format;
- unsigned long nbytes;
- unsigned long overflow;
- char *src;
-
- maybe_lock_display();
- owner = XGetSelectionOwner(mSDL_Display, get_x11_readwrite_clipboard_type());
- maybe_unlock_display();
- if (owner == None)
- {
- // Fall right back to ancient X10 cut-buffers
- owner = DefaultRootWindow(mSDL_Display);
- selection = XA_CUT_BUFFER0;
- } else if (owner == mSDL_XWindowID)
- {
- // Use our own uncooked opaque string property
- owner = DefaultRootWindow(mSDL_Display);
- selection = get_x11_cutbuffer_clipboard_type();
- }
- else
- {
- // Use full-on X11-style clipboard negotiation with the owning app
- int selection_response = 0;
- SDL_Event event;
-
- owner = mSDL_XWindowID;
- maybe_lock_display();
- selection = XInternAtom(mSDL_Display, "SDL_SELECTION", False);
- XConvertSelection(mSDL_Display, get_x11_readwrite_clipboard_type(), format,
- selection, owner, CurrentTime);
- maybe_unlock_display();
- llinfos << "X11: Waiting for clipboard to arrive." <<llendl;
- while ( ! selection_response )
- {
- // Only look for SYSWMEVENTs, or we may lose keypresses
- // etc.
- SDL_PumpEvents();
- if (1 == SDL_PeepEvents(&event, 1, SDL_GETEVENT,
- SDL_SYSWMEVENTMASK) )
- {
- if ( event.type == SDL_SYSWMEVENT )
- {
- XEvent xevent =
- event.syswm.msg->event.xevent;
-
- if ( (xevent.type == SelectionNotify)&&
- (xevent.xselection.requestor == owner) )
- selection_response = 1;
- }
- } else {
- llinfos << "X11: Waiting for SYSWM event..." << llendl;
- }
- }
- llinfos << "X11: Clipboard arrived." <<llendl;
- }
-
- maybe_lock_display();
- if ( XGetWindowProperty(mSDL_Display, owner, selection, 0, INT_MAX/4,
- False, format, &seln_type, &seln_format,
- &nbytes, &overflow, (unsigned char **)&src) == Success )
+ if (ll_try_gtk_init())
{
- if ( seln_type == format )
- {
- *dstlen = convert_x11clipboard(type, NULL, src, nbytes);
- *dst = (char *)realloc(*dst, *dstlen);
- if ( *dst == NULL )
- *dstlen = 0;
- else
- convert_x11clipboard(type, *dst, src, nbytes);
- }
- XFree(src);
- }
- maybe_unlock_display();
-}
-
-int clipboard_filter_callback(const SDL_Event *event)
-{
- /* Post all non-window manager specific events */
- if ( event->type != SDL_SYSWMEVENT )
- {
- return(1);
- }
-
- /* Handle window-manager specific clipboard events */
- switch (event->syswm.msg->event.xevent.type) {
- /* Copy the selection from SECONDLIFE_CUTBUFFER to the requested property */
- case SelectionRequest: {
- XSelectionRequestEvent *req;
- XEvent sevent;
- int seln_format;
- unsigned long nbytes;
- unsigned long overflow;
- unsigned char *seln_data;
-
- req = &event->syswm.msg->event.xevent.xselectionrequest;
- sevent.xselection.type = SelectionNotify;
- sevent.xselection.display = req->display;
- sevent.xselection.selection = req->selection;
- sevent.xselection.target = None;
- sevent.xselection.property = None;
- sevent.xselection.requestor = req->requestor;
- sevent.xselection.time = req->time;
- if ( XGetWindowProperty(get_SDL_Display(), DefaultRootWindow(get_SDL_Display()),
- get_x11_cutbuffer_clipboard_type(), 0, INT_MAX/4, False, req->target,
- &sevent.xselection.target, &seln_format,
- &nbytes, &overflow, &seln_data) == Success )
+ GtkClipboard * const clipboard =
+ gtk_clipboard_get(GDK_SELECTION_PRIMARY);
+ gchar * const data = gtk_clipboard_wait_for_text(clipboard);
+ if (data)
{
- if ( sevent.xselection.target == req->target)
- {
- if ( sevent.xselection.target == XA_STRING ||
- sevent.xselection.target ==
- convert_format(SDLCLIPTYPE('U','T','F','8')) )
- {
- if ( seln_data[nbytes-1] == '\0' )
- --nbytes;
- }
- XChangeProperty(get_SDL_Display(), req->requestor, req->property,
- req->target, seln_format, PropModeReplace,
- seln_data, nbytes);
- sevent.xselection.property = req->property;
- } else if (get_x11_targets_atom() == req->target) {
- /* only advertise what we currently support */
- const int num_supported = 3;
- Atom supported[num_supported] = {
- XA_STRING, // will be over-written below
- get_x11_text_atom(),
- get_x11_targets_atom()
- };
- supported[0] = sevent.xselection.target;
- XChangeProperty(get_SDL_Display(), req->requestor,
- req->property, XA_ATOM, 32, PropModeReplace,
- (unsigned char*)supported,
- num_supported);
- sevent.xselection.property = req->property;
- llinfos << "Clipboard: An app asked us what selections format we offer." << llendl;
- } else {
- llinfos << "Clipboard: An app requested an unsupported selection format " << req->target << ", we have " << sevent.xselection.target << llendl;
- sevent.xselection.target = None;
- }
- XFree(seln_data);
+ text = LLWString(utf8str_to_wstring(data));
+ g_free(data);
+ return TRUE;
}
- int sendret =
- XSendEvent(get_SDL_Display(),req->requestor,False,0,&sevent);
- if ((sendret==BadValue) || (sendret==BadWindow))
- llwarns << "Clipboard SendEvent failed" << llendl;
- XSync(get_SDL_Display(), False);
- }
- break;
}
-
- /* Post the event for X11 clipboard reading above */
- return(1);
+ return FALSE; // failure
}
-int
-LLWindowSDL::init_x11clipboard(void)
+BOOL LLWindowSDL::copyTextToPrimary(const LLWString &text)
{
- SDL_SysWMinfo info;
- int retval;
-
- /* Grab the window manager specific information */
- retval = -1;
- SDL_SetError("SDL is not running on known window manager");
-
- SDL_VERSION(&info.version);
- if ( SDL_GetWMInfo(&info) )
+ if (ll_try_gtk_init())
{
- /* Save the information for later use */
- if ( info.subsystem == SDL_SYSWM_X11 )
- {
- mSDL_Display = info.info.x11.display;
- mSDL_XWindowID = info.info.x11.wmwindow;
- Lock_Display = info.info.x11.lock_func;
- Unlock_Display = info.info.x11.unlock_func;
-
- /* Enable the special window hook events */
- SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
- SDL_SetEventFilter(clipboard_filter_callback);
-
- retval = 0;
- }
- else
- {
- SDL_SetError("SDL is not running on X11");
- }
+ const std::string utf8 = wstring_to_utf8str(text);
+ GtkClipboard * const clipboard =
+ gtk_clipboard_get(GDK_SELECTION_PRIMARY);
+ gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length());
+ return TRUE;
}
- return(retval);
-}
-
-void
-LLWindowSDL::quit_x11clipboard(void)
-{
- mSDL_Display = NULL;
- mSDL_XWindowID = None;
- Lock_Display = NULL;
- Unlock_Display = NULL;
-
- SDL_SetEventFilter(NULL); // Stop custom event filtering
+ return FALSE; // failure
}
-/************************************************/
+#else
BOOL LLWindowSDL::isClipboardTextAvailable()
{
- return !is_empty_x11clipboard();
+ return FALSE; // unsupported
}
BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &dst)
{
- int cliplen; // seems 1 or 2 bytes longer than expected
- char *cliptext = NULL;
- get_x11clipboard(SDLCLIPTYPE('U','T','F','8'), &cliplen, &cliptext);
- if (cliptext)
- {
- llinfos << "X11: Got UTF8 clipboard text." << llendl;
- // at some future time we can use cliplen instead of relying on \0,
- // if we ever grok non-ascii, non-utf8 encodings on the clipboard.
- std::string clip_str(cliptext);
- // we can't necessarily trust the incoming text to be valid UTF-8,
- // but utf8str_to_wstring() seems to do an appropriate level of
- // validation for avoiding over-reads.
- dst = utf8str_to_wstring(clip_str);
- /*llinfos << "X11 pasteTextFromClipboard: cliplen=" << cliplen <<
- " strlen(cliptext)=" << strlen(cliptext) <<
- " clip_str.length()=" << clip_str.length() <<
- " dst.length()=" << dst.length() <<
- llendl;*/
- free(cliptext);
- return TRUE; // success
- }
- get_x11clipboard(SDLCLIPTYPE('T','E','X','T'), &cliplen, &cliptext);
- if (cliptext)
- {
- llinfos << "X11: Got ISO 8859-1 clipboard text." << llendl;
- std::string clip_str(cliptext);
- std::string utf8_str = rawstr_to_utf8(clip_str);
- dst = utf8str_to_wstring(utf8_str);
- free(cliptext);
- }
- return FALSE; // failure
+ return FALSE; // unsupported
}
BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s)
{
- std::string utf8text = wstring_to_utf8str(s);
- const char* cstr = utf8text.c_str();
- if (cstr == NULL)
- {
- return FALSE;
- }
- int cstrlen = strlen(cstr); /* Flawfinder: ignore */
- int i;
- for (i=0; i<cstrlen; ++i)
- {
- if (0x80 & (unsigned char)cstr[i])
- {
- // Found an 8-bit character; use new-style UTF8 clipboard
- llinfos << "X11: UTF8 copyTextToClipboard" << llendl;
- put_x11clipboard(SDLCLIPTYPE('U','T','F','8'), cstrlen, cstr);
- return TRUE;
- }
- }
- // Didn't find any 8-bit characters; use old-style ISO 8859-1 clipboard
- llinfos << "X11: ISO 8859-1 copyTextToClipboard" << llendl;
- put_x11clipboard(SDLCLIPTYPE('T','E','X','T'), cstrlen, cstr);
- return TRUE;
+ return FALSE; // unsupported
}
-#else
-BOOL LLWindowSDL::isClipboardTextAvailable()
+BOOL LLWindowSDL::isPrimaryTextAvailable()
{
return FALSE; // unsupported
}
-BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &dst)
+BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &dst)
{
return FALSE; // unsupported
}
-BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s)
+BOOL LLWindowSDL::copyTextToPrimary(const LLWString &s)
{
return FALSE; // unsupported
}
-#endif // LL_X11
-
-BOOL LLWindowSDL::sendEmail(const char* address, const char* subject, const char* body_text,
- const char* attachment, const char* attachment_displayed_name )
-{
- // MBW -- XXX -- Um... yeah. I'll get to this later.
-
- return FALSE;
-}
+#endif // LL_GTK
LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions)
{
@@ -1770,7 +1368,7 @@ LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_reso
if ( (modes != NULL) && (modes != ((SDL_Rect **) -1)) )
{
int count = 0;
- while (*modes) // they're sorted biggest to smallest, so find end...
+ while (*modes && count<MAX_NUM_RESOLUTIONS) // they're sorted biggest to smallest, so find end...
{
modes++;
count++;
@@ -1863,7 +1461,7 @@ BOOL LLWindowSDL::convertCoords(LLCoordGL from, LLCoordScreen *to)
-void LLWindowSDL::setupFailure(const char* text, const char* caption, U32 type)
+void LLWindowSDL::setupFailure(const std::string& text, const std::string& caption, U32 type)
{
destroyContext();
@@ -1957,7 +1555,7 @@ U32 LLWindowSDL::SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain)
/* part of the fix for SL-13243: Some popular window managers like
to totally eat alt-drag for the purposes of moving windows. We
spoil their day by acquiring the exclusive X11 mouse lock for as
- long as LALT is held down, so the window manager can't easily
+ long as ALT is held down, so the window manager can't easily
see what's happening. Tested successfully with Metacity.
And... do the same with CTRL, for other darn WMs. We don't
care about other metakeys as SL doesn't use them with dragging
@@ -1972,10 +1570,12 @@ U32 LLWindowSDL::SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain)
{
case SDLK_LALT:
mask = 1U << 0; break;
- case SDLK_LCTRL:
+ case SDLK_RALT:
mask = 1U << 1; break;
- case SDLK_RCTRL:
+ case SDLK_LCTRL:
mask = 1U << 2; break;
+ case SDLK_RCTRL:
+ mask = 1U << 3; break;
default:
break;
}
@@ -1991,35 +1591,124 @@ U32 LLWindowSDL::SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain)
return mGrabbyKeyFlags;
}
-void LLWindowSDL::gatherInput()
+
+void check_vm_bloat()
{
- const Uint32 CLICK_THRESHOLD = 300; // milliseconds
- static int leftClick = 0;
- static int rightClick = 0;
- static Uint32 lastLeftDown = 0;
- static Uint32 lastRightDown = 0;
- SDL_Event event;
+#if LL_LINUX
+ // watch our own VM and RSS sizes, warn if we bloated rapidly
+ FILE *fp = fopen("/proc/self/stat", "r");
+ if (fp)
+ {
+ static long long last_vm_size = 0;
+ static long long last_rss_size = 0;
+ const long long significant_vm_difference = 250 * 1024*1024;
+ const long long significant_rss_difference = 50 * 1024*1024;
-#if LL_GTK && LL_LLMOZLIB_ENABLED
- // Pump GTK events so embedded Gecko doesn't starve.
+ ssize_t res;
+ size_t dummy;
+ char *ptr;
+ for (int i=0; i<22; ++i) // parse past the values we don't want
+ {
+ ptr = NULL;
+ res = getdelim(&ptr, &dummy, ' ', fp);
+ free(ptr);
+ }
+ // 23rd space-delimited entry is vsize
+ ptr = NULL;
+ res = getdelim(&ptr, &dummy, ' ', fp);
+ llassert(ptr);
+ long long this_vm_size = atoll(ptr);
+ free(ptr);
+ // 24th space-delimited entry is RSS
+ ptr = NULL;
+ res = getdelim(&ptr, &dummy, ' ', fp);
+ llassert(ptr);
+ long long this_rss_size = getpagesize() * atoll(ptr);
+ free(ptr);
+
+ llinfos << "VM SIZE IS NOW " << (this_vm_size/(1024*1024)) << " MB, RSS SIZE IS NOW " << (this_rss_size/(1024*1024)) << " MB" << llendl;
+
+ if (llabs(last_vm_size - this_vm_size) >
+ significant_vm_difference)
+ {
+ if (this_vm_size > last_vm_size)
+ {
+ llwarns << "VM size grew by " << (this_vm_size - last_vm_size)/(1024*1024) << " MB in last frame" << llendl;
+ }
+ else
+ {
+ llinfos << "VM size shrank by " << (last_vm_size - this_vm_size)/(1024*1024) << " MB in last frame" << llendl;
+ }
+ }
+
+ if (llabs(last_rss_size - this_rss_size) >
+ significant_rss_difference)
+ {
+ if (this_rss_size > last_rss_size)
+ {
+ llwarns << "RSS size grew by " << (this_rss_size - last_rss_size)/(1024*1024) << " MB in last frame" << llendl;
+ }
+ else
+ {
+ llinfos << "RSS size shrank by " << (last_rss_size - this_rss_size)/(1024*1024) << " MB in last frame" << llendl;
+ }
+ }
+
+ last_rss_size = this_rss_size;
+ last_vm_size = this_vm_size;
+
+ fclose(fp);
+ }
+#endif // LL_LINUX
+}
+
+
+// virtual
+void LLWindowSDL::processMiscNativeEvents()
+{
+#if LL_GTK
+ // Pump GTK events to avoid starvation for:
+ // * DBUS servicing
+ // * Anything else which quietly hooks into the default glib/GTK loop
if (ll_try_gtk_init())
{
// Yuck, Mozilla's GTK callbacks play with the locale - push/pop
// the locale to protect it, as exotic/non-C locales
// causes our code lots of general critical weirdness
// and crashness. (SL-35450)
- std::string saved_locale = setlocale(LC_ALL, NULL);
-
- // Do a limited number of pumps so SL doesn't starve!
- // *TODO: this should ideally be time-limited, not count-limited.
- gtk_main_iteration_do(0); // Always do one non-blocking pump
- for (int iter=0; iter<10; ++iter)
- if (gtk_events_pending())
- gtk_main_iteration();
+ static std::string saved_locale;
+ saved_locale = ll_safe_string(setlocale(LC_ALL, NULL));
+
+ // Pump until we've nothing left to do or passed 1/15th of a
+ // second pumping for this frame.
+ static LLTimer pump_timer;
+ pump_timer.reset();
+ pump_timer.setTimerExpirySec(1.0f / 15.0f);
+ do {
+ // Always do at least one non-blocking pump
+ gtk_main_iteration_do(FALSE);
+ } while (gtk_events_pending() &&
+ !pump_timer.hasExpired());
setlocale(LC_ALL, saved_locale.c_str() );
}
-#endif // LL_GTK && LL_LLMOZLIB_ENABLED
+#endif // LL_GTK
+
+ // hack - doesn't belong here - but this is just for debugging
+ if (getenv("LL_DEBUG_BLOAT"))
+ {
+ check_vm_bloat();
+ }
+}
+
+void LLWindowSDL::gatherInput()
+{
+ const Uint32 CLICK_THRESHOLD = 300; // milliseconds
+ static int leftClick = 0;
+ static int rightClick = 0;
+ static Uint32 lastLeftDown = 0;
+ static Uint32 lastRightDown = 0;
+ SDL_Event event;
// Handle all outstanding SDL events
while (SDL_PollEvent(&event))
@@ -2037,24 +1726,32 @@ void LLWindowSDL::gatherInput()
}
case SDL_KEYDOWN:
- gKeyboard->handleKeyDown(event.key.keysym.sym, event.key.keysym.mod);
- // part of the fix for SL-13243
- if (SDLCheckGrabbyKeys(event.key.keysym.sym, TRUE) != 0)
- SDLReallyCaptureInput(TRUE);
-
- if (event.key.keysym.unicode)
- {
- handleUnicodeUTF16(event.key.keysym.unicode,
- gKeyboard->currentMask(FALSE));
- }
+ mKeyScanCode = event.key.keysym.scancode;
+ mKeyVirtualKey = event.key.keysym.unicode;
+ mKeyModifiers = event.key.keysym.mod;
+
+ gKeyboard->handleKeyDown(event.key.keysym.sym, event.key.keysym.mod);
+ // part of the fix for SL-13243
+ if (SDLCheckGrabbyKeys(event.key.keysym.sym, TRUE) != 0)
+ SDLReallyCaptureInput(TRUE);
+
+ if (event.key.keysym.unicode)
+ {
+ handleUnicodeUTF16(event.key.keysym.unicode,
+ gKeyboard->currentMask(FALSE));
+ }
break;
case SDL_KEYUP:
- if (SDLCheckGrabbyKeys(event.key.keysym.sym, FALSE) == 0)
- SDLReallyCaptureInput(FALSE); // part of the fix for SL-13243
+ mKeyScanCode = event.key.keysym.scancode;
+ mKeyVirtualKey = event.key.keysym.unicode;
+ mKeyModifiers = event.key.keysym.mod;
- gKeyboard->handleKeyUp(event.key.keysym.sym, event.key.keysym.mod);
- break;
+ if (SDLCheckGrabbyKeys(event.key.keysym.sym, FALSE) == 0)
+ SDLReallyCaptureInput(FALSE); // part of the fix for SL-13243
+
+ gKeyboard->handleKeyUp(event.key.keysym.sym, event.key.keysym.mod);
+ break;
case SDL_MOUSEBUTTONDOWN:
{
@@ -2103,10 +1800,9 @@ void LLWindowSDL::gatherInput()
mCallbacks->handleMouseDown(this, openGlCoord, mask);
}
- else if (event.button.button == SDL_BUTTON_RIGHT) // right ... yes, it's 3, not 2, in SDL...
+ else if (event.button.button == SDL_BUTTON_RIGHT) // right
{
- // right double click isn't handled right now in Second Life ... if (isDoubleClick)
- mCallbacks->handleRightMouseDown(this, openGlCoord, mask);
+ mCallbacks->handleRightMouseDown(this, openGlCoord, mask);
}
else if (event.button.button == SDL_BUTTON_MIDDLE) // middle
@@ -2129,13 +1825,11 @@ void LLWindowSDL::gatherInput()
MASK mask = gKeyboard->currentMask(TRUE);
if (event.button.button == SDL_BUTTON_LEFT) // left
- mCallbacks->handleMouseUp(this, openGlCoord, mask);
- else if (event.button.button == SDL_BUTTON_RIGHT) // right ... yes, it's 3, not 2, in SDL...
- mCallbacks->handleRightMouseUp(this, openGlCoord, mask);
+ mCallbacks->handleMouseUp(this, openGlCoord, mask);
+ else if (event.button.button == SDL_BUTTON_RIGHT) // right
+ mCallbacks->handleRightMouseUp(this, openGlCoord, mask);
else if (event.button.button == SDL_BUTTON_MIDDLE) // middle
- {
mCallbacks->handleMiddleMouseUp(this, openGlCoord, mask);
- }
// don't handle mousewheel here...
break;
@@ -2179,12 +1873,12 @@ void LLWindowSDL::gatherInput()
// which confuses the focus code [SL-24071].
if (event.active.gain != mHaveInputFocus)
{
- if (event.active.gain)
+ mHaveInputFocus = !!event.active.gain;
+
+ if (mHaveInputFocus)
mCallbacks->handleFocus(this);
else
mCallbacks->handleFocusLost(this);
-
- mHaveInputFocus = !!event.active.gain;
}
}
if (event.active.state & SDL_APPACTIVE)
@@ -2192,10 +1886,10 @@ void LLWindowSDL::gatherInput()
// Change in iconification/minimization state.
if ((!event.active.gain) != mIsMinimized)
{
- mCallbacks->handleActivate(this, !!event.active.gain);
- llinfos << "SDL deiconification state switched to " << BOOL(event.active.gain) << llendl;
-
mIsMinimized = (!event.active.gain);
+
+ mCallbacks->handleActivate(this, !mIsMinimized);
+ llinfos << "SDL deiconification state switched to " << BOOL(event.active.gain) << llendl;
}
else
{
@@ -2305,6 +1999,12 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty
void LLWindowSDL::setCursor(ECursorType cursor)
{
+ if (ATIbug) {
+ // cursor-updating is very flaky when this bug is
+ // present; do nothing.
+ return;
+ }
+
if (mCurrentCursor != cursor)
{
if (cursor < UI_CURSOR_COUNT)
@@ -2323,11 +2023,6 @@ void LLWindowSDL::setCursor(ECursorType cursor)
}
}
-ECursorType LLWindowSDL::getCursor()
-{
- return mCurrentCursor;
-}
-
void LLWindowSDL::initCursors()
{
int i;
@@ -2369,14 +2064,18 @@ void LLWindowSDL::initCursors()
mSDLCursors[UI_CURSOR_TOOLPAN] = makeSDLCursorFromBMP("lltoolpan.BMP",7,5);
mSDLCursors[UI_CURSOR_TOOLZOOMIN] = makeSDLCursorFromBMP("lltoolzoomin.BMP",7,5);
mSDLCursors[UI_CURSOR_TOOLPICKOBJECT3] = makeSDLCursorFromBMP("toolpickobject3.BMP",0,0);
- mSDLCursors[UI_CURSOR_TOOLSIT] = makeSDLCursorFromBMP("toolsit.BMP",0,0);
- mSDLCursors[UI_CURSOR_TOOLBUY] = makeSDLCursorFromBMP("toolbuy.BMP",0,0);
- mSDLCursors[UI_CURSOR_TOOLPAY] = makeSDLCursorFromBMP("toolpay.BMP",0,0);
- mSDLCursors[UI_CURSOR_TOOLOPEN] = makeSDLCursorFromBMP("toolopen.BMP",0,0);
mSDLCursors[UI_CURSOR_TOOLPLAY] = makeSDLCursorFromBMP("toolplay.BMP",0,0);
mSDLCursors[UI_CURSOR_TOOLPAUSE] = makeSDLCursorFromBMP("toolpause.BMP",0,0);
mSDLCursors[UI_CURSOR_TOOLMEDIAOPEN] = makeSDLCursorFromBMP("toolmediaopen.BMP",0,0);
mSDLCursors[UI_CURSOR_PIPETTE] = makeSDLCursorFromBMP("lltoolpipette.BMP",2,28);
+ mSDLCursors[UI_CURSOR_TOOLSIT] = makeSDLCursorFromBMP("toolsit.BMP",20,15);
+ mSDLCursors[UI_CURSOR_TOOLBUY] = makeSDLCursorFromBMP("toolbuy.BMP",20,15);
+ mSDLCursors[UI_CURSOR_TOOLOPEN] = makeSDLCursorFromBMP("toolopen.BMP",20,15);
+
+ if (getenv("LL_ATI_MOUSE_CURSOR_BUG") != NULL) {
+ llinfos << "Disabling cursor updating due to LL_ATI_MOUSE_CURSOR_BUG" << llendl;
+ ATIbug = true;
+ }
}
void LLWindowSDL::quitCursors()
@@ -2409,14 +2108,14 @@ void LLWindowSDL::captureMouse()
// window, and in a less obnoxious way than SDL_WM_GrabInput
// which would confine the cursor to the window too.
- //llinfos << "LLWindowSDL::captureMouse" << llendl;
+ lldebugs << "LLWindowSDL::captureMouse" << llendl;
}
void LLWindowSDL::releaseMouse()
{
// see LWindowSDL::captureMouse()
- //llinfos << "LLWindowSDL::releaseMouse" << llendl;
+ lldebugs << "LLWindowSDL::releaseMouse" << llendl;
}
void LLWindowSDL::hideCursor()
@@ -2432,8 +2131,6 @@ void LLWindowSDL::hideCursor()
{
// llinfos << "hideCursor: already hidden" << llendl;
}
-
- adjustCursorDecouple();
}
void LLWindowSDL::showCursor()
@@ -2449,8 +2146,6 @@ void LLWindowSDL::showCursor()
{
// llinfos << "showCursor: already visible" << llendl;
}
-
- adjustCursorDecouple();
}
void LLWindowSDL::showCursorFromMouseMove()
@@ -2488,7 +2183,7 @@ void LLSplashScreenSDL::showImpl()
{
}
-void LLSplashScreenSDL::updateImpl(const char* mesg)
+void LLSplashScreenSDL::updateImpl(const std::string& mesg)
{
}
@@ -2509,19 +2204,14 @@ static void response_callback (GtkDialog *dialog,
gtk_main_quit();
}
-S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type)
+S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type)
{
S32 rtn = OSBTN_CANCEL;
- ll_try_gtk_init();
-
if(gWindowImplementation != NULL)
gWindowImplementation->beforeDialog();
- if (ll_try_gtk_init()
- // We can NOT expect to combine GTK and SDL's aggressive fullscreen
- && ((NULL==gWindowImplementation) || (!was_fullscreen))
- )
+ if (LLWindowSDL::ll_try_gtk_init())
{
GtkWidget *win = NULL;
@@ -2546,9 +2236,8 @@ S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type)
buttons = GTK_BUTTONS_YES_NO;
break;
}
- win = gtk_message_dialog_new(NULL,
- flags, messagetype, buttons,
- text);
+ win = gtk_message_dialog_new(NULL, flags, messagetype, buttons, "%s",
+ text.c_str());
# if LL_X11
// Make GTK tell the window manager to associate this
@@ -2570,8 +2259,8 @@ S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type)
gtk_window_set_type_hint(GTK_WINDOW(win),
GDK_WINDOW_TYPE_HINT_DIALOG);
- if (caption)
- gtk_window_set_title(GTK_WINDOW(win), caption);
+ if (!caption.empty())
+ gtk_window_set_title(GTK_WINDOW(win), caption.c_str());
gint response = GTK_RESPONSE_NONE;
g_signal_connect (win,
@@ -2621,16 +2310,46 @@ static void color_changed_callback(GtkWidget *widget,
gtk_color_selection_get_current_color(colorsel, colorp);
}
-BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
+
+/*
+ Make the raw keyboard data available - used to poke through to LLQtWebKit so
+ that Qt/Webkit has access to the virtual keycodes etc. that it needs
+*/
+LLSD LLWindowSDL::getNativeKeyData()
+{
+ LLSD result = LLSD::emptyMap();
+
+ U32 modifiers = 0; // pretend-native modifiers... oh what a tangled web we weave!
+
+ // we go through so many levels of device abstraction that I can't really guess
+ // what a plugin under GDK under Qt under SL under SDL under X11 considers
+ // a 'native' modifier mask. this has been sort of reverse-engineered... they *appear*
+ // to match GDK consts, but that may be co-incidence.
+ modifiers |= (mKeyModifiers & KMOD_LSHIFT) ? 0x0001 : 0;
+ modifiers |= (mKeyModifiers & KMOD_RSHIFT) ? 0x0001 : 0;// munge these into the same shift
+ modifiers |= (mKeyModifiers & KMOD_CAPS) ? 0x0002 : 0;
+ modifiers |= (mKeyModifiers & KMOD_LCTRL) ? 0x0004 : 0;
+ modifiers |= (mKeyModifiers & KMOD_RCTRL) ? 0x0004 : 0;// munge these into the same ctrl
+ modifiers |= (mKeyModifiers & KMOD_LALT) ? 0x0008 : 0;// untested
+ modifiers |= (mKeyModifiers & KMOD_RALT) ? 0x0008 : 0;// untested
+ // *todo: test ALTs - I don't have a case for testing these. Do you?
+ // *todo: NUM? - I don't care enough right now (and it's not a GDK modifier).
+
+ result["scan_code"] = (S32)mKeyScanCode;
+ result["virtual_key"] = (S32)mKeyVirtualKey;
+ result["modifiers"] = (S32)modifiers;
+
+ return result;
+}
+
+
+BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)
{
BOOL rtn = FALSE;
beforeDialog();
- if (ll_try_gtk_init()
- // We can NOT expect to combine GTK and SDL's aggressive fullscreen
- && !was_fullscreen
- )
+ if (ll_try_gtk_init())
{
GtkWidget *win = NULL;
@@ -2652,6 +2371,7 @@ BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG(win)->colorsel);
GdkColor color, orig_color;
+ orig_color.pixel = 0;
orig_color.red = guint16(65535 * *r);
orig_color.green= guint16(65535 * *g);
orig_color.blue = guint16(65535 * *b);
@@ -2695,41 +2415,24 @@ BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
return rtn;
}
#else
-S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type)
+S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type)
{
llinfos << "MSGBOX: " << caption << ": " << text << llendl;
return 0;
}
-BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
+BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)
{
return (FALSE);
}
#endif // LL_GTK
-// Open a URL with the user's default web browser.
-// Must begin with protocol identifier.
-void spawn_web_browser(const char* escaped_url)
-{
- llinfos << "spawn_web_browser: " << escaped_url << llendl;
-
#if LL_LINUX || LL_SOLARIS
-# if LL_X11
- if (gWindowImplementation && gWindowImplementation->mSDL_Display)
- {
- maybe_lock_display();
- // Just in case - before forking.
- XSync(gWindowImplementation->mSDL_Display, False);
- maybe_unlock_display();
- }
-# endif // LL_X11
-
- std::string cmd;
- cmd = gDirUtilp->getAppRODataDir().c_str();
- cmd += gDirUtilp->getDirDelimiter().c_str();
- cmd += "launch_url.sh";
- char* const argv[] = {(char*)cmd.c_str(), (char*)escaped_url, NULL};
-
+// extracted from spawnWebBrowser for clarity and to eliminate
+// compiler confusion regarding close(int fd) vs. LLWindow::close()
+void exec_cmd(const std::string& cmd, const std::string& arg)
+{
+ char* const argv[] = {(char*)cmd.c_str(), (char*)arg.c_str(), NULL};
fflush(NULL);
pid_t pid = fork();
if (pid == 0)
@@ -2754,6 +2457,34 @@ void spawn_web_browser(const char* escaped_url)
llwarns << "fork failure." << llendl;
}
}
+}
+#endif
+
+// Open a URL with the user's default web browser.
+// Must begin with protocol identifier.
+void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)
+{
+ llinfos << "spawn_web_browser: " << escaped_url << llendl;
+
+#if LL_LINUX || LL_SOLARIS
+# if LL_X11
+ if (mSDL_Display)
+ {
+ maybe_lock_display();
+ // Just in case - before forking.
+ XSync(mSDL_Display, False);
+ maybe_unlock_display();
+ }
+# endif // LL_X11
+
+ std::string cmd, arg;
+ cmd = gDirUtilp->getAppRODataDir();
+ cmd += gDirUtilp->getDirDelimiter();
+ cmd += "etc";
+ cmd += gDirUtilp->getDirDelimiter();
+ cmd += "launch_url.sh";
+ arg = escaped_url;
+ exec_cmd(cmd, arg);
#endif // LL_LINUX || LL_SOLARIS
llinfos << "spawn_web_browser returning." << llendl;
@@ -2763,7 +2494,7 @@ void spawn_web_browser(const char* escaped_url)
void *LLWindowSDL::getPlatformWindow()
{
#if LL_GTK && LL_LLMOZLIB_ENABLED
- if (ll_try_gtk_init())
+ if (LLWindowSDL::ll_try_gtk_init())
{
maybe_lock_display();
@@ -2803,4 +2534,104 @@ void LLWindowSDL::bringToFront()
#endif // LL_X11
}
+//static
+std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
+{
+ // Use libfontconfig to find us a nice ordered list of fallback fonts
+ // specific to this system.
+ std::string final_fallback("/usr/share/fonts/truetype/kochi/kochi-gothic.ttf");
+ const int max_font_count_cutoff = 40; // fonts are expensive in the current system, don't enumerate an arbitrary number of them
+ // Our 'ideal' font properties which define the sorting results.
+ // slant=0 means Roman, index=0 means the first face in a font file
+ // (the one we actually use), weight=80 means medium weight,
+ // spacing=0 means proportional spacing.
+ std::string sort_order("slant=0:index=0:weight=80:spacing=0");
+ // elide_unicode_coverage removes fonts from the list whose unicode
+ // range is covered by fonts earlier in the list. This usually
+ // removes ~90% of the fonts as redundant (which is great because
+ // the font list can be huge), but might unnecessarily reduce the
+ // renderable range if for some reason our FreeType actually fails
+ // to use some of the fonts we want it to.
+ const bool elide_unicode_coverage = true;
+ std::vector<std::string> rtns;
+ FcFontSet *fs = NULL;
+ FcPattern *sortpat = NULL;
+
+ llinfos << "Getting system font list from FontConfig..." << llendl;
+
+ // If the user has a system-wide language preference, then favor
+ // fonts from that language group. This doesn't affect the types
+ // of languages that can be displayed, but ensures that their
+ // preferred language is rendered from a single consistent font where
+ // possible.
+ FL_Locale *locale = NULL;
+ FL_Success success = FL_FindLocale(&locale, FL_MESSAGES);
+ if (success != 0)
+ {
+ if (success >= 2 && locale->lang) // confident!
+ {
+ LL_INFOS("AppInit") << "Language " << locale->lang << LL_ENDL;
+ LL_INFOS("AppInit") << "Location " << locale->country << LL_ENDL;
+ LL_INFOS("AppInit") << "Variant " << locale->variant << LL_ENDL;
+
+ llinfos << "Preferring fonts of language: "
+ << locale->lang
+ << llendl;
+ sort_order = "lang=" + std::string(locale->lang) + ":"
+ + sort_order;
+ }
+ }
+ FL_FreeLocale(&locale);
+
+ if (!FcInit())
+ {
+ llwarns << "FontConfig failed to initialize." << llendl;
+ rtns.push_back(final_fallback);
+ return rtns;
+ }
+
+ sortpat = FcNameParse((FcChar8*) sort_order.c_str());
+ if (sortpat)
+ {
+ // Sort the list of system fonts from most-to-least-desirable.
+ fs = FcFontSort(NULL, sortpat, elide_unicode_coverage,
+ NULL, NULL);
+ FcPatternDestroy(sortpat);
+ }
+
+ int found_font_count = 0;
+ if (fs)
+ {
+ // Get the full pathnames to the fonts, where available,
+ // which is what we really want.
+ found_font_count = fs->nfont;
+ for (int i=0; i<fs->nfont; ++i)
+ {
+ FcChar8 *filename;
+ if (FcResultMatch == FcPatternGetString(fs->fonts[i],
+ FC_FILE, 0,
+ &filename)
+ && filename)
+ {
+ rtns.push_back(std::string((const char*)filename));
+ if (rtns.size() >= max_font_count_cutoff)
+ break; // hit limit
+ }
+ }
+ FcFontSetDestroy (fs);
+ }
+
+ lldebugs << "Using font list: " << llendl;
+ for (std::vector<std::string>::iterator it = rtns.begin();
+ it != rtns.end();
+ ++it)
+ {
+ lldebugs << " file: " << *it << llendl;
+ }
+ llinfos << "Using " << rtns.size() << "/" << found_font_count << " system fonts." << llendl;
+
+ rtns.push_back(final_fallback);
+ return rtns;
+}
+
#endif // LL_SDL
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index 2c411e03fd..fa544b16ce 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -2,30 +2,25 @@
* @file llwindowsdl.h
* @brief SDL implementation of LLWindow class
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,6 +30,7 @@
// Simple Directmedia Layer (http://libsdl.org/) implementation of LLWindow class
#include "llwindow.h"
+#include "lltimer.h"
#include "SDL/SDL.h"
#include "SDL/SDL_endian.h"
@@ -60,13 +56,15 @@ public:
/*virtual*/ BOOL getMinimized();
/*virtual*/ BOOL getMaximized();
/*virtual*/ BOOL maximize();
+ /*virtual*/ void minimize();
+ /*virtual*/ void restore();
/*virtual*/ BOOL getFullscreen();
/*virtual*/ BOOL getPosition(LLCoordScreen *position);
/*virtual*/ BOOL getSize(LLCoordScreen *size);
/*virtual*/ BOOL getSize(LLCoordWindow *size);
/*virtual*/ BOOL setPosition(LLCoordScreen position);
/*virtual*/ BOOL setSize(LLCoordScreen size);
- /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync);
+ /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
/*virtual*/ void showCursor();
@@ -75,27 +73,30 @@ public:
/*virtual*/ void hideCursorUntilMouseMove();
/*virtual*/ BOOL isCursorHidden();
/*virtual*/ void setCursor(ECursorType cursor);
- /*virtual*/ ECursorType getCursor();
/*virtual*/ void captureMouse();
/*virtual*/ void releaseMouse();
/*virtual*/ void setMouseClipping( BOOL b );
+
/*virtual*/ BOOL isClipboardTextAvailable();
/*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst);
/*virtual*/ BOOL copyTextToClipboard(const LLWString & src);
+
+ /*virtual*/ BOOL isPrimaryTextAvailable();
+ /*virtual*/ BOOL pasteTextFromPrimary(LLWString &dst);
+ /*virtual*/ BOOL copyTextToPrimary(const LLWString & src);
+
/*virtual*/ void flashIcon(F32 seconds);
/*virtual*/ F32 getGamma();
/*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
+ /*virtual*/ U32 getFSAASamples();
+ /*virtual*/ void setFSAASamples(const U32 samples);
/*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
/*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
+ /*virtual*/ void processMiscNativeEvents();
/*virtual*/ void gatherInput();
/*virtual*/ void swapBuffers();
- /*virtual*/ LLString getTempFileName();
- /*virtual*/ void deleteFile( const char* file_name );
- /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info );
- /*virtual*/ BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL);
-
- /*virtual*/ void delayInputProcessing() { };
+ /*virtual*/ void delayInputProcessing() { };
// handy coordinate space conversion routines
/*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to);
@@ -113,46 +114,56 @@ public:
/*virtual*/ void beforeDialog();
/*virtual*/ void afterDialog();
- /*virtual*/ BOOL dialog_color_picker(F32 *r, F32 *g, F32 *b);
+ /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b);
/*virtual*/ void *getPlatformWindow();
/*virtual*/ void bringToFront();
+ /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
+
+ static std::vector<std::string> getDynamicFallbackFontList();
+
// Not great that these are public, but they have to be accessible
// by non-class code and it's better than making them global.
#if LL_X11
- // These are set up by the X11 clipboard initialization code
Window mSDL_XWindowID;
Display *mSDL_Display;
#endif
void (*Lock_Display)(void);
void (*Unlock_Display)(void);
+#if LL_GTK
+ // Lazily initialize and check the runtime GTK version for goodness.
+ static bool ll_try_gtk_init(void);
+#endif // LL_GTK
+
+#if LL_X11
+ static Window get_SDL_XWindowID(void);
+ static Display* get_SDL_Display(void);
+#endif // LL_X11
+
protected:
- LLWindowSDL(
- char *title, int x, int y, int width, int height, U32 flags,
+ LLWindowSDL(LLWindowCallbacks* callbacks,
+ const std::string& title, int x, int y, int width, int height, U32 flags,
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
- BOOL ignore_pixel_depth);
+ BOOL ignore_pixel_depth, U32 fsaa_samples);
~LLWindowSDL();
+ /*virtual*/ BOOL isValid();
+ /*virtual*/ LLSD getNativeKeyData();
+
void initCursors();
void quitCursors();
- BOOL isValid();
void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
-
// Changes display resolution. Returns true if successful
BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh);
// Go back to last fullscreen display resolution.
BOOL setFullscreenResolution();
- void minimize();
- void restore();
-
BOOL shouldPostQuit() { return mPostQuit; }
-
protected:
//
// Platform specific methods
@@ -161,8 +172,7 @@ protected:
// create or re-create the GL context/window. Called from the constructor and switchContext().
BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync);
void destroyContext();
- void setupFailure(const char* text, const char* caption, U32 type);
- void adjustCursorDecouple(bool warpingMouse = false);
+ void setupFailure(const std::string& text, const std::string& caption, U32 type);
void fixWindowSize(void);
U32 SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain);
BOOL SDLReallyCaptureInput(BOOL capture);
@@ -173,16 +183,13 @@ protected:
U32 mGrabbyKeyFlags;
int mReallyCapturedCount;
SDL_Surface * mWindow;
- char * mWindowTitle;
+ std::string mWindowTitle;
double mOriginalAspectRatio;
- BOOL mCursorDecoupled;
- S32 mCursorLastEventDeltaX;
- S32 mCursorLastEventDeltaY;
- BOOL mCursorIgnoreNextDelta;
BOOL mNeedsResize; // Constructor figured out the window is too big, it needs a resize.
LLCoordScreen mNeedsResizeSize;
F32 mOverrideAspectRatio;
F32 mGamma;
+ U32 mFSAASamples;
int mSDLFlags;
@@ -192,20 +199,16 @@ protected:
friend class LLWindowManager;
-#if LL_X11
private:
- // more X11 clipboard stuff
- int init_x11clipboard(void);
- void quit_x11clipboard(void);
- int is_empty_x11clipboard(void);
- void put_x11clipboard(int type, int srclen, const char *src);
- void get_x11clipboard(int type, int *dstlen, char **dst);
+#if LL_X11
void x11_set_urgent(BOOL urgent);
BOOL mFlashing;
LLTimer mFlashTimer;
#endif //LL_X11
-
+ U32 mKeyScanCode;
+ U32 mKeyVirtualKey;
+ SDLMod mKeyModifiers;
};
@@ -216,22 +219,10 @@ public:
virtual ~LLSplashScreenSDL();
/*virtual*/ void showImpl();
- /*virtual*/ void updateImpl(const char* mesg);
+ /*virtual*/ void updateImpl(const std::string& mesg);
/*virtual*/ void hideImpl();
};
-S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type);
-
-void load_url_external(const char* url);
-
-#if LL_GTK
-// Lazily initialize and check the runtime GTK version for goodness.
-BOOL ll_try_gtk_init(void);
-#endif // LL_GTK
-
-#if LL_X11
-Window get_SDL_XWindowID(void);
-Display* get_SDL_Display(void);
-#endif // LL_X11
+S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type);
#endif //LL_LLWINDOWSDL_H
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index a5367aac8a..87075c7318 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -2,30 +2,25 @@
* @file llwindowwin32.cpp
* @brief Platform-dependent implementation of llwindow
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -35,31 +30,34 @@
#include "llwindowwin32.h"
+// LLWindow library includes
+#include "llkeyboardwin32.h"
+#include "lldragdropwin32.h"
+#include "llpreeditor.h"
+#include "llwindowcallbacks.h"
+
+// Linden library includes
+#include "llerror.h"
+#include "llgl.h"
+#include "llstring.h"
+#include "lldir.h"
+
+// System includes
#include <commdlg.h>
#include <WinUser.h>
#include <mapi.h>
#include <process.h> // for _spawn
#include <shellapi.h>
+#include <fstream>
#include <Imm.h>
// Require DirectInput version 8
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
+#include <Dbt.h.>
-
-#include "llkeyboardwin32.h"
-#include "llerror.h"
-#include "llgl.h"
-#include "llstring.h"
-#include "lldir.h"
-
-#include "llglheaders.h"
-
-#include "indra_constants.h"
-
-#include "llpreeditor.h"
-
+#include "llmemtype.h"
// culled from winuser.h
#ifndef WM_MOUSEWHEEL /* Added to be compatible with later SDK's */
const S32 WM_MOUSEWHEEL = 0x020A;
@@ -82,9 +80,9 @@ LLW32MsgCallback gAsyncMsgCallback = NULL;
// LLWindowWin32
//
-void show_window_creation_error(const char* title)
+void show_window_creation_error(const std::string& title)
{
- llwarns << title << llendl;
+ LL_WARNS("Window") << title << LL_ENDL;
}
//static
@@ -359,44 +357,44 @@ LLWinImm::~LLWinImm()
}
-LPDIRECTINPUT8 g_pDI = NULL;
-LPDIRECTINPUTDEVICE8 g_pJoystick = NULL;
-BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance,
- VOID* pContext );
-BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi,
- VOID* pContext );
-
-
-LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
+LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
- BOOL ignore_pixel_depth)
- : LLWindow(fullscreen, flags)
+ BOOL ignore_pixel_depth,
+ U32 fsaa_samples)
+ : LLWindow(callbacks, fullscreen, flags)
{
- S32 i = 0;
+ mFSAASamples = fsaa_samples;
mIconResource = gIconResource;
mOverrideAspectRatio = 0.f;
mNativeAspectRatio = 0.f;
mMousePositionModified = FALSE;
mInputProcessingPaused = FALSE;
mPreeditor = NULL;
+ mKeyCharCode = 0;
+ mKeyScanCode = 0;
+ mKeyVirtualKey = 0;
+ mhDC = NULL;
+ mhRC = NULL;
// Initialize the keyboard
gKeyboard = new LLKeyboardWin32();
+ gKeyboard->setCallbacks(callbacks);
+
+ // Initialize the Drag and Drop functionality
+ mDragDrop = new LLDragDropWin32;
// Initialize (boot strap) the Language text input management,
// based on the system's (user's) default settings.
allowLanguageTextInput(mPreeditor, FALSE);
- GLuint pixel_format;
WNDCLASS wc;
- DWORD dw_ex_style;
- DWORD dw_style;
RECT window_rect;
// Set the window title
- if (!title)
+ if (title.empty())
{
mWindowTitle = new WCHAR[50];
wsprintf(mWindowTitle, L"OpenGL Window");
@@ -404,12 +402,12 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
else
{
mWindowTitle = new WCHAR[256]; // Assume title length < 255 chars.
- mbstowcs(mWindowTitle, title, 255);
+ mbstowcs(mWindowTitle, title.c_str(), 255);
mWindowTitle[255] = 0;
}
// Set the window class name
- if (!name)
+ if (name.empty())
{
mWindowClassName = new WCHAR[50];
wsprintf(mWindowClassName, L"OpenGL Window");
@@ -417,7 +415,7 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
else
{
mWindowClassName = new WCHAR[256]; // Assume title length < 255 chars.
- mbstowcs(mWindowClassName, name, 255);
+ mbstowcs(mWindowClassName, name.c_str(), 255);
mWindowClassName[255] = 0;
}
@@ -429,7 +427,7 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
mhInstance = GetModuleHandle(NULL);
mWndProc = NULL;
- mSwapMethod = SWAP_METHOD_EXCHANGE;
+ mSwapMethod = SWAP_METHOD_UNDEFINED;
// No WPARAM yet.
mLastSizeWParam = 0;
@@ -490,7 +488,8 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
if (!RegisterClass(&wc))
{
- OSMessageBox("RegisterClass failed", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBRegClassFailed"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return;
}
sIsClassRegistered = TRUE;
@@ -544,7 +543,7 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
if (closest_refresh == 0)
{
- llwarns << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << llendl;
+ LL_WARNS("Window") << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << LL_ENDL;
success = FALSE;
}
@@ -567,11 +566,11 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
mFullscreenBits = dev_mode.dmBitsPerPel;
mFullscreenRefresh = dev_mode.dmDisplayFrequency;
- llinfos << "Running at " << dev_mode.dmPelsWidth
+ LL_INFOS("Window") << "Running at " << dev_mode.dmPelsWidth
<< "x" << dev_mode.dmPelsHeight
<< "x" << dev_mode.dmBitsPerPel
<< " @ " << dev_mode.dmDisplayFrequency
- << llendl;
+ << LL_ENDL;
}
else
{
@@ -581,54 +580,14 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
mFullscreenBits = -1;
mFullscreenRefresh = -1;
- char error[256]; /* Flawfinder: ignore */
- snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); /* Flawfinder: ignore */
- OSMessageBox(error, "Error", OSMB_OK);
+ std::map<std::string,std::string> args;
+ args["[WIDTH]"] = llformat("%d", width);
+ args["[HEIGHT]"] = llformat ("%d", height);
+ OSMessageBox(mCallbacks->translateString("MBFullScreenErr", args),
+ mCallbacks->translateString("MBError"), OSMB_OK);
}
}
- //-----------------------------------------------------------------------
- // Resize window to account for borders
- //-----------------------------------------------------------------------
- if (mFullscreen)
- {
- dw_ex_style = WS_EX_APPWINDOW;
- dw_style = WS_POPUP;
-
- // Move window borders out not to cover window contents
- AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
- }
- else
- {
- // Window with an edge
- dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
- dw_style = WS_OVERLAPPEDWINDOW;
- }
-
- //-----------------------------------------------------------------------
- // Create the window
- // Microsoft help indicates that GL windows must be created with
- // WS_CLIPSIBLINGS and WS_CLIPCHILDREN, but not CS_PARENTDC
- //-----------------------------------------------------------------------
- mWindowHandle = CreateWindowEx(dw_ex_style,
- mWindowClassName,
- mWindowTitle,
- WS_CLIPSIBLINGS | WS_CLIPCHILDREN | dw_style,
- x, // x pos
- y, // y pos
- window_rect.right - window_rect.left, // width
- window_rect.bottom - window_rect.top, // height
- NULL,
- NULL,
- mhInstance,
- NULL);
-
- if (!mWindowHandle)
- {
- OSMessageBox("Window creation error", "Error", OSMB_OK);
- return;
- }
-
// TODO: add this after resolving _WIN32_WINNT issue
// if (!fullscreen)
// {
@@ -641,376 +600,17 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
// }
-
- S32 pfdflags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER;
- if (use_gl)
- {
- pfdflags |= PFD_SUPPORT_OPENGL;
- }
-
//-----------------------------------------------------------------------
// Create GL drawing context
//-----------------------------------------------------------------------
- PIXELFORMATDESCRIPTOR pfd =
+ LLCoordScreen windowPos(x,y);
+ LLCoordScreen windowSize(window_rect.right - window_rect.left,
+ window_rect.bottom - window_rect.top);
+ if (!switchContext(mFullscreen, windowSize, TRUE, &windowPos))
{
- sizeof(PIXELFORMATDESCRIPTOR),
- 1,
- pfdflags,
- PFD_TYPE_RGBA,
- BITS_PER_PIXEL,
- 0, 0, 0, 0, 0, 0, // RGB bits and shift, unused
- 8, // alpha bits
- 0, // alpha shift
- 0, // accum bits
- 0, 0, 0, 0, // accum RGBA
- 24, // depth bits
- 8, // stencil bits, avi added for stencil test
- 0,
- PFD_MAIN_PLANE,
- 0,
- 0, 0, 0
- };
-
- if (!(mhDC = GetDC(mWindowHandle)))
- {
- close();
- OSMessageBox("Can't make GL device context", "Error", OSMB_OK);
return;
}
-
- if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd)))
- {
- close();
- OSMessageBox("Can't find suitable pixel format", "Error", OSMB_OK);
- return;
- }
-
- // Verify what pixel format we actually received.
- if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),
- &pfd))
- {
- close();
- OSMessageBox("Can't get pixel format description", "Error", OSMB_OK);
- return;
- }
-
- // sanity check pfd returned by Windows
- if (!ignore_pixel_depth && (pfd.cColorBits < 32))
- {
- close();
- OSMessageBox(
- "Second Life requires True Color (32-bit) to run in a window.\n"
- "Please go to Control Panels -> Display -> Settings and\n"
- "set the screen to 32-bit color.\n"
- "Alternately, if you choose to run fullscreen, Second Life\n"
- "will automatically adjust the screen each time it runs.",
- "Error",
- OSMB_OK);
- return;
- }
-
- if (!ignore_pixel_depth && (pfd.cAlphaBits < 8))
- {
- close();
- OSMessageBox(
- "Second Life is unable to run because it can't get an 8 bit alpha\n"
- "channel. Usually this is due to video card driver issues.\n"
- "Please make sure you have the latest video card drivers installed.\n"
- "Also be sure your monitor is set to True Color (32-bit) in\n"
- "Control Panels -> Display -> Settings.\n"
- "If you continue to receive this message, contact customer service.",
- "Error",
- OSMB_OK);
- return;
- }
-
- if (!SetPixelFormat(mhDC, pixel_format, &pfd))
- {
- close();
- OSMessageBox("Can't set pixel format", "Error", OSMB_OK);
- return;
- }
-
- if (use_gl)
- {
- if (!(mhRC = wglCreateContext(mhDC)))
- {
- close();
- OSMessageBox("Can't create GL rendering context", "Error", OSMB_OK);
- return;
- }
-
- if (!wglMakeCurrent(mhDC, mhRC))
- {
- close();
- OSMessageBox("Can't activate GL rendering context", "Error", OSMB_OK);
- return;
- }
-
- gGLManager.initWGL();
-
- if (gGLManager.mHasWGLARBPixelFormat && (wglChoosePixelFormatARB != NULL))
- {
- // OK, at this point, use the ARB wglChoosePixelFormatsARB function to see if we
- // can get exactly what we want.
- GLint attrib_list[256];
- S32 cur_attrib = 0;
-
- attrib_list[cur_attrib++] = WGL_DEPTH_BITS_ARB;
- attrib_list[cur_attrib++] = 24;
-
- attrib_list[cur_attrib++] = WGL_STENCIL_BITS_ARB;
- attrib_list[cur_attrib++] = 8;
-
- attrib_list[cur_attrib++] = WGL_DRAW_TO_WINDOW_ARB;
- attrib_list[cur_attrib++] = GL_TRUE;
-
- attrib_list[cur_attrib++] = WGL_ACCELERATION_ARB;
- attrib_list[cur_attrib++] = WGL_FULL_ACCELERATION_ARB;
-
- attrib_list[cur_attrib++] = WGL_SUPPORT_OPENGL_ARB;
- attrib_list[cur_attrib++] = GL_TRUE;
-
- attrib_list[cur_attrib++] = WGL_DOUBLE_BUFFER_ARB;
- attrib_list[cur_attrib++] = GL_TRUE;
-
- attrib_list[cur_attrib++] = WGL_COLOR_BITS_ARB;
- attrib_list[cur_attrib++] = 32;
-
- attrib_list[cur_attrib++] = WGL_RED_BITS_ARB;
- attrib_list[cur_attrib++] = 8;
-
- attrib_list[cur_attrib++] = WGL_GREEN_BITS_ARB;
- attrib_list[cur_attrib++] = 8;
-
- attrib_list[cur_attrib++] = WGL_BLUE_BITS_ARB;
- attrib_list[cur_attrib++] = 8;
-
- attrib_list[cur_attrib++] = WGL_ALPHA_BITS_ARB;
- attrib_list[cur_attrib++] = 8;
-
- // End the list
- attrib_list[cur_attrib++] = 0;
-
- GLint pixel_formats[256];
- U32 num_formats = 0;
-
- // First we try and get a 32 bit depth pixel format
- BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
- if (!result)
- {
- close();
- show_window_creation_error("Error after wglChoosePixelFormatARB 32-bit");
- return;
- }
-
- if (!num_formats)
- {
- llinfos << "No 32 bit z-buffer, trying 24 bits instead" << llendl;
- // Try 24-bit format
- attrib_list[1] = 24;
- BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
- if (!result)
- {
- close();
- show_window_creation_error("Error after wglChoosePixelFormatARB 24-bit");
- return;
- }
-
- if (!num_formats)
- {
- llwarns << "Couldn't get 24 bit z-buffer,trying 16 bits instead!" << llendl;
- attrib_list[1] = 16;
- BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
- if (!result || !num_formats)
- {
- close();
- show_window_creation_error("Error after wglChoosePixelFormatARB 16-bit");
- return;
- }
- }
-
- llinfos << "Choosing pixel formats: " << num_formats << " pixel formats returned" << llendl;
-
- pixel_format = pixel_formats[0];
- }
-
- DestroyWindow(mWindowHandle);
-
- mWindowHandle = CreateWindowEx(dw_ex_style,
- mWindowClassName,
- mWindowTitle,
- WS_CLIPSIBLINGS | WS_CLIPCHILDREN | dw_style,
- x, // x pos
- y, // y pos
- window_rect.right - window_rect.left, // width
- window_rect.bottom - window_rect.top, // height
- NULL,
- NULL,
- mhInstance,
- NULL);
-
- if (!(mhDC = GetDC(mWindowHandle)))
- {
- close();
- OSMessageBox("Can't make GL device context", "Error", OSMB_OK);
- return;
- }
-
- if (!SetPixelFormat(mhDC, pixel_format, &pfd))
- {
- close();
- OSMessageBox("Can't set pixel format", "Error", OSMB_OK);
- return;
- }
-
- int swap_method = 0;
- GLint swap_query = WGL_SWAP_METHOD_ARB;
-
- if (wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method))
- {
- switch (swap_method)
- {
- case WGL_SWAP_EXCHANGE_ARB:
- mSwapMethod = SWAP_METHOD_EXCHANGE;
- llinfos << "Swap Method: Exchange" << llendl;
- break;
- case WGL_SWAP_COPY_ARB:
- mSwapMethod = SWAP_METHOD_COPY;
- llinfos << "Swap Method: Copy" << llendl;
- break;
- case WGL_SWAP_UNDEFINED_ARB:
- mSwapMethod = SWAP_METHOD_UNDEFINED;
- llinfos << "Swap Method: Undefined" << llendl;
- break;
- default:
- mSwapMethod = SWAP_METHOD_UNDEFINED;
- llinfos << "Swap Method: Unknown" << llendl;
- break;
- }
- }
- }
- else
- {
- llwarns << "No wgl_ARB_pixel_format extension, using default ChoosePixelFormat!" << llendl;
- }
-
- // Verify what pixel format we actually received.
- if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),
- &pfd))
- {
- close();
- OSMessageBox("Can't get pixel format description", "Error", OSMB_OK);
- return;
- }
- llinfos << "GL buffer: Color Bits " << S32(pfd.cColorBits)
- << " Alpha Bits " << S32(pfd.cAlphaBits)
- << " Depth Bits " << S32(pfd.cDepthBits)
- << llendl;
-
- if (pfd.cColorBits < 32)
- {
- close();
- OSMessageBox(
- "Second Life requires True Color (32-bit) to run in a window.\n"
- "Please go to Control Panels -> Display -> Settings and\n"
- "set the screen to 32-bit color.\n"
- "Alternately, if you choose to run fullscreen, Second Life\n"
- "will automatically adjust the screen each time it runs.",
- "Error",
- OSMB_OK);
- return;
- }
-
- if (pfd.cAlphaBits < 8)
- {
- close();
- OSMessageBox(
- "Second Life is unable to run because it can't get an 8 bit alpha\n"
- "channel. Usually this is due to video card driver issues.\n"
- "Please make sure you have the latest video card drivers installed.\n"
- "Also be sure your monitor is set to True Color (32-bit) in\n"
- "Control Panels -> Display -> Settings.\n"
- "If you continue to receive this message, contact customer service.",
- "Error",
- OSMB_OK);
- return;
- }
-
- if (!(mhRC = wglCreateContext(mhDC)))
- {
- close();
- OSMessageBox("Can't create GL rendering context", "Error", OSMB_OK);
- return;
- }
-
- if (!wglMakeCurrent(mhDC, mhRC))
- {
- close();
- OSMessageBox("Can't activate GL rendering context", "Error", OSMB_OK);
- return;
- }
-
- if (!gGLManager.initGL())
- {
- close();
- OSMessageBox(
- "Second Life is unable to run because your video card drivers\n"
- "are out of date or unsupported. Please make sure you have\n"
- "the latest video card drivers installed.\n\n"
- "If you continue to receive this message, contact customer service.",
- "Error",
- OSMB_OK);
- return;
- }
-
- // Disable vertical sync for swap
- if (disable_vsync && wglSwapIntervalEXT)
- {
- llinfos << "Disabling vertical sync" << llendl;
- wglSwapIntervalEXT(0);
- }
- else
- {
- llinfos << "Keeping vertical sync" << llendl;
- }
-
-
- // OK, let's get the current gamma information and store it off.
- mCurrentGamma = 0.f; // Not set, default;
- if (!GetDeviceGammaRamp(mhDC, mPrevGammaRamp))
- {
- llwarns << "Unable to get device gamma ramp" << llendl;
- }
-
- // Calculate what the current gamma is. From a posting by Garrett T. Bass, Get/SetDeviceGammaRamp Demystified
- // http://apollo.iwt.uni-bielefeld.de/~ml_robot/OpenGL-04-2000/0058.html
-
- // We're going to assume that gamma's the same for all 3 channels, because I don't feel like doing it otherwise.
- // Using the red channel.
-
- F32 Csum = 0.0;
- S32 Ccount = 0;
- for (i = 0; i < 256; i++)
- {
- if (i != 0 && mPrevGammaRamp[i] != 0 && mPrevGammaRamp[i] != 65536)
- {
- F64 B = (i % 256) / 256.0;
- F64 A = mPrevGammaRamp[i] / 65536.0;
- F32 C = (F32) ( log(A) / log(B) );
- Csum += C;
- Ccount++;
- }
- }
- mCurrentGamma = Csum / Ccount;
-
- llinfos << "Previous gamma: " << mCurrentGamma << llendl;
- }
-
-
- //store this pointer for wndProc callback
- SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this);
-
+
//start with arrow cursor
initCursors();
setCursor( UI_CURSOR_ARROW );
@@ -1018,47 +618,13 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width,
// Initialize (boot strap) the Language text input management,
// based on the system's (or user's) default settings.
allowLanguageTextInput(NULL, FALSE);
-
- initInputDevices();
-}
-
-void LLWindowWin32::initInputDevices()
-{
- // Direct Input
- HRESULT hr;
-
- if( FAILED( hr = DirectInput8Create( GetModuleHandle(NULL), DIRECTINPUT_VERSION,
- IID_IDirectInput8, (VOID**)&g_pDI, NULL ) ) )
- {
- llwarns << "Direct8InputCreate failed!" << llendl;
- }
- else
- {
- while(1)
- {
- // Look for a simple joystick we can use for this sample program.
- if (FAILED( hr = g_pDI->EnumDevices( DI8DEVCLASS_GAMECTRL,
- EnumJoysticksCallback,
- NULL, DIEDFL_ATTACHEDONLY ) ) )
- break;
- if (!g_pJoystick)
- break;
- if( FAILED( hr = g_pJoystick->SetDataFormat( &c_dfDIJoystick ) ) )
- break;
- if( FAILED( hr = g_pJoystick->EnumObjects( EnumObjectsCallback,
- (VOID*)mWindowHandle, DIDFT_ALL ) ) )
- break;
- g_pJoystick->Acquire();
- break;
- }
- }
-
- SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer
}
LLWindowWin32::~LLWindowWin32()
{
+ delete mDragDrop;
+
delete [] mWindowTitle;
mWindowTitle = NULL;
@@ -1082,6 +648,7 @@ void LLWindowWin32::hide()
ShowWindow(mWindowHandle, SW_HIDE);
}
+//virtual
void LLWindowWin32::minimize()
{
setMouseClipping(FALSE);
@@ -1089,7 +656,7 @@ void LLWindowWin32::minimize()
ShowWindow(mWindowHandle, SW_MINIMIZE);
}
-
+//virtual
void LLWindowWin32::restore()
{
ShowWindow(mWindowHandle, SW_RESTORE);
@@ -1102,13 +669,15 @@ void LLWindowWin32::restore()
// Usually called from LLWindowManager::destroyWindow()
void LLWindowWin32::close()
{
- llinfos << "Closing LLWindowWin32" << llendl;
+ LL_DEBUGS("Window") << "Closing LLWindowWin32" << LL_ENDL;
// Is window is already closed?
if (!mWindowHandle)
{
return;
}
+ mDragDrop->reset();
+
// Make sure cursor is visible and we haven't mangled the clipping state.
setMouseClipping(FALSE);
showCursor();
@@ -1120,20 +689,20 @@ void LLWindowWin32::close()
}
// Clean up remaining GL state
- llinfos << "Shutting down GL" << llendl;
+ LL_DEBUGS("Window") << "Shutting down GL" << LL_ENDL;
gGLManager.shutdownGL();
- llinfos << "Releasing Context" << llendl;
+ LL_DEBUGS("Window") << "Releasing Context" << LL_ENDL;
if (mhRC)
{
if (!wglMakeCurrent(NULL, NULL))
{
- llwarns << "Release of DC and RC failed" << llendl;
+ LL_WARNS("Window") << "Release of DC and RC failed" << LL_ENDL;
}
if (!wglDeleteContext(mhRC))
{
- llwarns << "Release of rendering context failed" << llendl;
+ LL_WARNS("Window") << "Release of rendering context failed" << LL_ENDL;
}
mhRC = NULL;
@@ -1144,11 +713,11 @@ void LLWindowWin32::close()
if (mhDC && !ReleaseDC(mWindowHandle, mhDC))
{
- llwarns << "Release of ghDC failed" << llendl;
+ LL_WARNS("Window") << "Release of ghDC failed" << LL_ENDL;
mhDC = NULL;
}
- llinfos << "Destroying Window" << llendl;
+ LL_DEBUGS("Window") << "Destroying Window" << LL_ENDL;
// Don't process events in our mainWindowProc any longer.
SetWindowLong(mWindowHandle, GWL_USERDATA, NULL);
@@ -1159,7 +728,9 @@ void LLWindowWin32::close()
// This causes WM_DESTROY to be sent *immediately*
if (!DestroyWindow(mWindowHandle))
{
- OSMessageBox("DestroyWindow(mWindowHandle) failed", "Shutdown Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBDestroyWinFailed"),
+ mCallbacks->translateString("MBShutdownErr"),
+ OSMB_OK);
}
mWindowHandle = NULL;
@@ -1283,7 +854,7 @@ BOOL LLWindowWin32::setSize(const LLCoordScreen size)
}
// changing fullscreen resolution
-BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync)
+BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
{
GLuint pixel_format;
DEVMODE dev_mode;
@@ -1293,8 +864,13 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
RECT window_rect;
S32 width = size.mX;
S32 height = size.mY;
+ BOOL auto_show = FALSE;
- resetDisplayResolution();
+ if (mhRC)
+ {
+ auto_show = TRUE;
+ resetDisplayResolution();
+ }
if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode))
{
@@ -1311,12 +887,12 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
{
if (!wglMakeCurrent(NULL, NULL))
{
- llwarns << "Release of DC and RC failed" << llendl;
+ LL_WARNS("Window") << "Release of DC and RC failed" << LL_ENDL;
}
if (!wglDeleteContext(mhRC))
{
- llwarns << "Release of rendering context failed" << llendl;
+ LL_WARNS("Window") << "Release of rendering context failed" << LL_ENDL;
}
mhRC = NULL;
@@ -1350,7 +926,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
if (closest_refresh == 0)
{
- llwarns << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << llendl;
+ LL_WARNS("Window") << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << LL_ENDL;
return FALSE;
}
@@ -1372,11 +948,11 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
mFullscreenBits = dev_mode.dmBitsPerPel;
mFullscreenRefresh = dev_mode.dmDisplayFrequency;
- llinfos << "Running at " << dev_mode.dmPelsWidth
+ LL_INFOS("Window") << "Running at " << dev_mode.dmPelsWidth
<< "x" << dev_mode.dmPelsHeight
<< "x" << dev_mode.dmBitsPerPel
<< " @ " << dev_mode.dmDisplayFrequency
- << llendl;
+ << LL_ENDL;
window_rect.left = (long) 0;
window_rect.right = (long) width; // Windows GDI rects don't include rightmost pixel
@@ -1397,18 +973,17 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
mFullscreenBits = -1;
mFullscreenRefresh = -1;
- llinfos << "Unable to run fullscreen at " << width << "x" << height << llendl;
- llinfos << "Running in window." << llendl;
+ LL_INFOS("Window") << "Unable to run fullscreen at " << width << "x" << height << LL_ENDL;
return FALSE;
}
}
else
{
mFullscreen = FALSE;
- window_rect.left = (long) 0;
- window_rect.right = (long) width; // Windows GDI rects don't include rightmost pixel
- window_rect.top = (long) 0;
- window_rect.bottom = (long) height;
+ window_rect.left = (long) (posp ? posp->mX : 0);
+ window_rect.right = (long) width + window_rect.left; // Windows GDI rects don't include rightmost pixel
+ window_rect.top = (long) (posp ? posp->mY : 0);
+ window_rect.bottom = (long) height + window_rect.top;
// Window with an edge
dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
dw_style = WS_OVERLAPPEDWINDOW;
@@ -1458,14 +1033,16 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
if (!(mhDC = GetDC(mWindowHandle)))
{
close();
- OSMessageBox("Can't make GL device context", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBDevContextErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd)))
{
close();
- OSMessageBox("Can't find suitable pixel format", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
@@ -1474,57 +1051,48 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
&pfd))
{
close();
- OSMessageBox("Can't get pixel format description", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (pfd.cColorBits < 32)
{
close();
- OSMessageBox(
- "Second Life requires True Color (32-bit) to run in a window.\n"
- "Please go to Control Panels -> Display -> Settings and\n"
- "set the screen to 32-bit color.\n"
- "Alternately, if you choose to run fullscreen, Second Life\n"
- "will automatically adjust the screen each time it runs.",
- "Error",
- OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBTrueColorWindow"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (pfd.cAlphaBits < 8)
{
close();
- OSMessageBox(
- "Second Life is unable to run because it can't get an 8 bit alpha\n"
- "channel. Usually this is due to video card driver issues.\n"
- "Please make sure you have the latest video card drivers installed.\n"
- "Also be sure your monitor is set to True Color (32-bit) in\n"
- "Control Panels -> Display -> Settings.\n"
- "If you continue to receive this message, contact customer service.",
- "Error",
- OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBAlpha"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!SetPixelFormat(mhDC, pixel_format, &pfd))
{
close();
- OSMessageBox("Can't set pixel format", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!(mhRC = wglCreateContext(mhDC)))
{
close();
- OSMessageBox("Can't create GL rendering context", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBGLContextErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!wglMakeCurrent(mhDC, mhRC))
{
close();
- OSMessageBox("Can't activate GL rendering context", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBGLContextActErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
@@ -1558,17 +1126,19 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
attrib_list[cur_attrib++] = WGL_COLOR_BITS_ARB;
attrib_list[cur_attrib++] = 24;
- attrib_list[cur_attrib++] = WGL_RED_BITS_ARB;
- attrib_list[cur_attrib++] = 8;
-
- attrib_list[cur_attrib++] = WGL_GREEN_BITS_ARB;
+ attrib_list[cur_attrib++] = WGL_ALPHA_BITS_ARB;
attrib_list[cur_attrib++] = 8;
- attrib_list[cur_attrib++] = WGL_BLUE_BITS_ARB;
- attrib_list[cur_attrib++] = 8;
+ U32 end_attrib = 0;
+ if (mFSAASamples > 0)
+ {
+ end_attrib = cur_attrib;
+ attrib_list[cur_attrib++] = WGL_SAMPLE_BUFFERS_ARB;
+ attrib_list[cur_attrib++] = GL_TRUE;
- attrib_list[cur_attrib++] = WGL_ALPHA_BITS_ARB;
- attrib_list[cur_attrib++] = 8;
+ attrib_list[cur_attrib++] = WGL_SAMPLES_ARB;
+ attrib_list[cur_attrib++] = mFSAASamples;
+ }
// End the list
attrib_list[cur_attrib++] = 0;
@@ -1587,36 +1157,87 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
if (!num_formats)
{
- llinfos << "No 32 bit z-buffer, trying 24 bits instead" << llendl;
- // Try 24-bit format
- attrib_list[1] = 24;
- BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
- if (!result)
- {
- close();
- show_window_creation_error("Error after wglChoosePixelFormatARB 24-bit");
- return FALSE;
+ if (end_attrib > 0)
+ {
+ LL_INFOS("Window") << "No valid pixel format for " << mFSAASamples << "x anti-aliasing." << LL_ENDL;
+ attrib_list[end_attrib] = 0;
+
+ BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
+ if (!result)
+ {
+ close();
+ show_window_creation_error("Error after wglChoosePixelFormatARB 32-bit no AA");
+ return FALSE;
+ }
}
if (!num_formats)
{
- llwarns << "Couldn't get 24 bit z-buffer,trying 16 bits instead!" << llendl;
- attrib_list[1] = 16;
+ LL_INFOS("Window") << "No 32 bit z-buffer, trying 24 bits instead" << LL_ENDL;
+ // Try 24-bit format
+ attrib_list[1] = 24;
BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
- if (!result || !num_formats)
+ if (!result)
{
close();
- show_window_creation_error("Error after wglChoosePixelFormatARB 16-bit");
+ show_window_creation_error("Error after wglChoosePixelFormatARB 24-bit");
return FALSE;
}
+
+ if (!num_formats)
+ {
+ LL_WARNS("Window") << "Couldn't get 24 bit z-buffer,trying 16 bits instead!" << LL_ENDL;
+ attrib_list[1] = 16;
+ BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
+ if (!result || !num_formats)
+ {
+ close();
+ show_window_creation_error("Error after wglChoosePixelFormatARB 16-bit");
+ return FALSE;
+ }
+ }
}
- llinfos << "Choosing pixel formats: " << num_formats << " pixel formats returned" << llendl;
+ LL_INFOS("Window") << "Choosing pixel formats: " << num_formats << " pixel formats returned" << LL_ENDL;
+ }
+
+
+
+ S32 swap_method = 0;
+ S32 cur_format = num_formats-1;
+ GLint swap_query = WGL_SWAP_METHOD_ARB;
+
+ BOOL found_format = FALSE;
+
+ while (!found_format && wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method))
+ {
+ if (swap_method == WGL_SWAP_UNDEFINED_ARB || cur_format <= 0)
+ {
+ found_format = TRUE;
+ }
+ else
+ {
+ --cur_format;
+ }
+ }
+
+ pixel_format = pixel_formats[cur_format];
+
+ if (mhDC != 0) // Does The Window Have A Device Context?
+ {
+ wglMakeCurrent(mhDC, 0); // Set The Current Active Rendering Context To Zero
+ if (mhRC != 0) // Does The Window Have A Rendering Context?
+ {
+ wglDeleteContext (mhRC); // Release The Rendering Context
+ mhRC = 0; // Zero The Rendering Context
- pixel_format = pixel_formats[0];
+ }
+ ReleaseDC (mWindowHandle, mhDC); // Release The Device Context
+ mhDC = 0; // Zero The Device Context
}
+ DestroyWindow (mWindowHandle); // Destroy The Window
+
- DestroyWindow(mWindowHandle);
mWindowHandle = CreateWindowEx(dw_ex_style,
mWindowClassName,
mWindowTitle,
@@ -1633,46 +1254,44 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
if (!(mhDC = GetDC(mWindowHandle)))
{
close();
- OSMessageBox("Can't make GL device context", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBDevContextErr"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!SetPixelFormat(mhDC, pixel_format, &pfd))
{
close();
- OSMessageBox("Can't set pixel format", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
- int swap_method = 0;
- GLint swap_query = WGL_SWAP_METHOD_ARB;
-
if (wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method))
{
switch (swap_method)
{
case WGL_SWAP_EXCHANGE_ARB:
mSwapMethod = SWAP_METHOD_EXCHANGE;
- llinfos << "Swap Method: Exchange" << llendl;
+ LL_DEBUGS("Window") << "Swap Method: Exchange" << LL_ENDL;
break;
case WGL_SWAP_COPY_ARB:
mSwapMethod = SWAP_METHOD_COPY;
- llinfos << "Swap Method: Copy" << llendl;
+ LL_DEBUGS("Window") << "Swap Method: Copy" << LL_ENDL;
break;
case WGL_SWAP_UNDEFINED_ARB:
mSwapMethod = SWAP_METHOD_UNDEFINED;
- llinfos << "Swap Method: Undefined" << llendl;
+ LL_DEBUGS("Window") << "Swap Method: Undefined" << LL_ENDL;
break;
default:
mSwapMethod = SWAP_METHOD_UNDEFINED;
- llinfos << "Swap Method: Unknown" << llendl;
+ LL_DEBUGS("Window") << "Swap Method: Unknown" << LL_ENDL;
break;
}
}
}
else
{
- llwarns << "No wgl_ARB_pixel_format extension, using default ChoosePixelFormat!" << llendl;
+ LL_WARNS("Window") << "No wgl_ARB_pixel_format extension, using default ChoosePixelFormat!" << LL_ENDL;
}
// Verify what pixel format we actually received.
@@ -1680,89 +1299,83 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disa
&pfd))
{
close();
- OSMessageBox("Can't get pixel format description", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
- llinfos << "GL buffer: Color Bits " << S32(pfd.cColorBits)
+ LL_INFOS("Window") << "GL buffer: Color Bits " << S32(pfd.cColorBits)
<< " Alpha Bits " << S32(pfd.cAlphaBits)
<< " Depth Bits " << S32(pfd.cDepthBits)
- << llendl;
+ << LL_ENDL;
- if (pfd.cColorBits < 32)
+ // make sure we have 32 bits per pixel
+ if (pfd.cColorBits < 32 || GetDeviceCaps(mhDC, BITSPIXEL) < 32)
{
close();
- OSMessageBox(
- "Second Life requires True Color (32-bit) to run in a window.\n"
- "Please go to Control Panels -> Display -> Settings and\n"
- "set the screen to 32-bit color.\n"
- "Alternately, if you choose to run fullscreen, Second Life\n"
- "will automatically adjust the screen each time it runs.",
- "Error",
- OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBTrueColorWindow"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (pfd.cAlphaBits < 8)
{
close();
- OSMessageBox(
- "Second Life is unable to run because it can't get an 8 bit alpha\n"
- "channel. Usually this is due to video card driver issues.\n"
- "Please make sure you have the latest video card drivers installed.\n"
- "Also be sure your monitor is set to True Color (32-bit) in\n"
- "Control Panels -> Display -> Settings.\n"
- "If you continue to receive this message, contact customer service.",
- "Error",
- OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBAlpha"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!(mhRC = wglCreateContext(mhDC)))
{
close();
- OSMessageBox("Can't create GL rendering context", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!wglMakeCurrent(mhDC, mhRC))
{
close();
- OSMessageBox("Can't activate GL rendering context", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!gGLManager.initGL())
{
close();
- OSMessageBox(
- "Second Life is unable to run because your video card drivers\n"
- "are out of date or unsupported. Please make sure you have\n"
- "the latest video card drivers installed.\n\n"
- "If you continue to receive this message, contact customer service.",
- "Error",
- OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
// Disable vertical sync for swap
if (disable_vsync && wglSwapIntervalEXT)
{
- llinfos << "Disabling vertical sync" << llendl;
+ LL_DEBUGS("Window") << "Disabling vertical sync" << LL_ENDL;
wglSwapIntervalEXT(0);
}
else
{
- llinfos << "Keeping vertical sync" << llendl;
+ LL_DEBUGS("Window") << "Keeping vertical sync" << LL_ENDL;
}
SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this);
- show();
- initInputDevices();
+ // register this window as handling drag/drop events from the OS
+ DragAcceptFiles( mWindowHandle, TRUE );
+
+ mDragDrop->init( mWindowHandle );
+
+ //register joystick timer callback
+ SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer
// ok to post quit messages now
mPostQuit = TRUE;
+
+ if (auto_show)
+ {
+ show();
+ glClearColor(0.0f, 0.0f, 0.0f, 0.f);
+ glClear(GL_COLOR_BUFFER_BIT);
+ swapBuffers();
+ }
+
return TRUE;
}
@@ -1780,7 +1393,9 @@ void LLWindowWin32::moveWindow( const LLCoordScreen& position, const LLCoordScre
// if the window was already maximized, MoveWindow seems to still set the maximized flag even if
// the window is smaller than maximized.
// So we're going to do a restore first (which is a ShowWindow call) (SL-44655).
- ShowWindow(mWindowHandle, SW_RESTORE);
+
+ // THIS CAUSES DEV-15484 and DEV-15949
+ //ShowWindow(mWindowHandle, SW_RESTORE);
// NOW we can call MoveWindow
MoveWindow(mWindowHandle, position.mX, position.mY, size.mX, size.mY, TRUE);
}
@@ -1800,6 +1415,20 @@ BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position)
return FALSE;
}
+ // Inform the application of the new mouse position (needed for per-frame
+ // hover/picking to function).
+ LLCoordGL gl_pos;
+ convertCoords(position, &gl_pos);
+ mCallbacks->handleMouseMove(this, gl_pos, (MASK)0);
+
+ // DEV-18951 VWR-8524 Camera moves wildly when alt-clicking.
+ // Because we have preemptively notified the application of the new
+ // mouse position via handleMouseMove() above, we need to clear out
+ // any stale mouse move events. RN/JC
+ MSG msg;
+ while (PeekMessage(&msg, NULL, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE))
+ { }
+
return SetCursorPos(screen_pos.mX, screen_pos.mY);
}
@@ -1909,15 +1538,14 @@ void LLWindowWin32::initCursors()
mCursor[ UI_CURSOR_TOOLZOOMIN ] = LoadCursor(module, TEXT("TOOLZOOMIN"));
mCursor[ UI_CURSOR_TOOLPICKOBJECT3 ] = LoadCursor(module, TEXT("TOOLPICKOBJECT3"));
mCursor[ UI_CURSOR_PIPETTE ] = LoadCursor(module, TEXT("TOOLPIPETTE"));
+ mCursor[ UI_CURSOR_TOOLSIT ] = LoadCursor(module, TEXT("TOOLSIT"));
+ mCursor[ UI_CURSOR_TOOLBUY ] = LoadCursor(module, TEXT("TOOLBUY"));
+ mCursor[ UI_CURSOR_TOOLOPEN ] = LoadCursor(module, TEXT("TOOLOPEN"));
// Color cursors
- mCursor[UI_CURSOR_TOOLSIT] = loadColorCursor(TEXT("TOOLSIT"));
- mCursor[UI_CURSOR_TOOLBUY] = loadColorCursor(TEXT("TOOLBUY"));
- mCursor[UI_CURSOR_TOOLPAY] = loadColorCursor(TEXT("TOOLPAY"));
- mCursor[UI_CURSOR_TOOLOPEN] = loadColorCursor(TEXT("TOOLOPEN"));
- mCursor[UI_CURSOR_TOOLPLAY] = loadColorCursor(TEXT("TOOLPLAY"));
- mCursor[UI_CURSOR_TOOLPAUSE] = loadColorCursor(TEXT("TOOLPAUSE"));
- mCursor[UI_CURSOR_TOOLMEDIAOPEN] = loadColorCursor(TEXT("TOOLMEDIAOPEN"));
+ mCursor[ UI_CURSOR_TOOLPLAY ] = loadColorCursor(TEXT("TOOLPLAY"));
+ mCursor[ UI_CURSOR_TOOLPAUSE ] = loadColorCursor(TEXT("TOOLPAUSE"));
+ mCursor[ UI_CURSOR_TOOLMEDIAOPEN ] = loadColorCursor(TEXT("TOOLMEDIAOPEN"));
// Note: custom cursors that are not found make LoadCursor() return NULL.
for( S32 i = 0; i < UI_CURSOR_COUNT; i++ )
@@ -1958,7 +1586,13 @@ void LLWindowWin32::captureMouse()
void LLWindowWin32::releaseMouse()
{
+ // *NOTE:Mani ReleaseCapture will spawn new windows messages...
+ // which will in turn call our MainWindowProc. It therefore requires
+ // pausing *and more importantly resumption* of the mainlooptimeout...
+ // just like DispatchMessage below.
+ mCallbacks->handlePauseWatchdog(this);
ReleaseCapture();
+ mCallbacks->handleResumeWatchdog(this);
}
@@ -1972,10 +1606,17 @@ void LLWindowWin32::gatherInput()
MSG msg;
int msg_count = 0;
+ LLMemType m1(LLMemType::MTYPE_GATHER_INPUT);
+
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) && msg_count < MAX_MESSAGE_PER_UPDATE)
{
+ mCallbacks->handlePingWatchdog(this, "Main:TranslateGatherInput");
TranslateMessage(&msg);
+
+ // turn watchdog off in here to not fail if windows is doing something wacky
+ mCallbacks->handlePauseWatchdog(this);
DispatchMessage(&msg);
+ mCallbacks->handleResumeWatchdog(this);
msg_count++;
if ( mInputProcessingPaused )
@@ -2001,7 +1642,7 @@ void LLWindowWin32::gatherInput()
}
}
*/
-
+ mCallbacks->handlePingWatchdog(this, "Main:AsyncCallbackGatherInput");
// For async host by name support. Really hacky.
if (gAsyncMsgCallback && (LL_WM_HOST_RESOLVED == msg.message))
{
@@ -2016,12 +1657,18 @@ void LLWindowWin32::gatherInput()
mMousePositionModified = FALSE;
}
+static LLFastTimer::DeclareTimer FTM_KEYHANDLER("Handle Keyboard");
+static LLFastTimer::DeclareTimer FTM_MOUSEHANDLER("Handle Mouse");
+
LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_param, LPARAM l_param)
{
LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(h_wnd, GWL_USERDATA);
+
if (NULL != window_imp)
{
+ window_imp->mCallbacks->handleResumeWatchdog(window_imp);
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:StartWndProc");
// Has user provided their own window callback?
if (NULL != window_imp->mWndProc)
{
@@ -2032,6 +1679,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
}
}
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:PreSwitchWndProc");
+
// Juggle to make sure we can get negative positions for when
// mouse is outside window.
LLCoordWindow window_coord((S32)(S16)LOWORD(l_param), (S32)(S16)HIWORD(l_param));
@@ -2051,10 +1700,28 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
S32 update_height;
case WM_TIMER:
- window_imp->updateJoystick( );
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_TIMER");
+ window_imp->mCallbacks->handleTimerEvent(window_imp);
+ break;
+
+ case WM_DEVICECHANGE:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_DEVICECHANGE");
+ if (gDebugWindowProc)
+ {
+ llinfos << " WM_DEVICECHANGE: wParam=" << w_param
+ << "; lParam=" << l_param << llendl;
+ }
+ if (w_param == DBT_DEVNODES_CHANGED || w_param == DBT_DEVICEARRIVAL)
+ {
+ if (window_imp->mCallbacks->handleDeviceChange(window_imp))
+ {
+ return 0;
+ }
+ }
break;
case WM_PAINT:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_PAINT");
GetUpdateRect(window_imp->mWindowHandle, &update_rect, FALSE);
update_width = update_rect.right - update_rect.left + 1;
update_height = update_rect.bottom - update_rect.top + 1;
@@ -2062,6 +1729,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
update_width, update_height);
break;
case WM_PARENTNOTIFY:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_PARENTNOTIFY");
u_msg = u_msg;
break;
@@ -2071,6 +1739,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
// Only take control of cursor over client region of window
// This allows Windows(tm) to handle resize cursors, etc.
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SETCURSOR");
if (LOWORD(l_param) == HTCLIENT)
{
SetCursor(window_imp->mCursor[ window_imp->mCurrentCursor] );
@@ -2079,14 +1748,17 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
break;
case WM_ENTERMENULOOP:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_ENTERMENULOOP");
window_imp->mCallbacks->handleWindowBlock(window_imp);
break;
case WM_EXITMENULOOP:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_EXITMENULOOP");
window_imp->mCallbacks->handleWindowUnblock(window_imp);
break;
case WM_ACTIVATEAPP:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_ACTIVATEAPP");
{
// This message should be sent whenever the app gains or loses focus.
BOOL activating = (BOOL) w_param;
@@ -2094,11 +1766,11 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
if (gDebugWindowProc)
{
- llinfos << "WINDOWPROC ActivateApp "
+ LL_INFOS("Window") << "WINDOWPROC ActivateApp "
<< " activating " << S32(activating)
<< " minimized " << S32(minimized)
<< " fullscreen " << S32(window_imp->mFullscreen)
- << llendl;
+ << LL_ENDL;
}
if (window_imp->mFullscreen)
@@ -2116,10 +1788,14 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->resetDisplayResolution();
}
}
+
+ window_imp->mCallbacks->handleActivateApp(window_imp, activating);
+
break;
}
case WM_ACTIVATE:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_ACTIVATE");
{
// Can be one of WA_ACTIVE, WA_CLICKACTIVE, or WA_INACTIVE
BOOL activating = (LOWORD(w_param) != WA_INACTIVE);
@@ -2136,10 +1812,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
// properly when we run fullscreen.
if (gDebugWindowProc)
{
- llinfos << "WINDOWPROC Activate "
+ LL_INFOS("Window") << "WINDOWPROC Activate "
<< " activating " << S32(activating)
<< " minimized " << S32(minimized)
- << llendl;
+ << LL_ENDL;
}
// Don't handle this.
@@ -2151,6 +1827,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
break;
case WM_SYSCOMMAND:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SYSCOMMAND");
switch(w_param)
{
case SC_KEYMENU:
@@ -2165,6 +1842,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
break;
case WM_CLOSE:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_CLOSE");
// Will the app allow the window to close?
if (window_imp->mCallbacks->handleCloseRequest(window_imp))
{
@@ -2175,6 +1853,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
return 0;
case WM_DESTROY:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_DESTROY");
if (window_imp->shouldPostQuit())
{
PostQuitMessage(0); // Posts WM_QUIT with an exit code of 0
@@ -2182,6 +1861,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
return 0;
case WM_COMMAND:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_COMMAND");
if (!HIWORD(w_param)) // this message is from a menu
{
window_imp->mCallbacks->handleMenuSelect(window_imp, LOWORD(w_param));
@@ -2189,15 +1869,21 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
break;
case WM_SYSKEYDOWN:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SYSKEYDOWN");
// allow system keys, such as ALT-F4 to be processed by Windows
eat_keystroke = FALSE;
case WM_KEYDOWN:
+ window_imp->mKeyCharCode = 0; // don't know until wm_char comes in next
+ window_imp->mKeyScanCode = ( l_param >> 16 ) & 0xff;
+ window_imp->mKeyVirtualKey = w_param;
+
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYDOWN");
{
if (gDebugWindowProc)
{
- llinfos << "Debug WindowProc WM_KEYDOWN "
+ LL_INFOS("Window") << "Debug WindowProc WM_KEYDOWN "
<< " key " << S32(w_param)
- << llendl;
+ << LL_ENDL;
}
if(gKeyboard->handleKeyDown(w_param, mask) && eat_keystroke)
{
@@ -2210,13 +1896,17 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
eat_keystroke = FALSE;
case WM_KEYUP:
{
- LLFastTimer t2(LLFastTimer::FTM_KEYHANDLER);
+ window_imp->mKeyScanCode = ( l_param >> 16 ) & 0xff;
+ window_imp->mKeyVirtualKey = w_param;
+
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYUP");
+ LLFastTimer t2(FTM_KEYHANDLER);
if (gDebugWindowProc)
{
- llinfos << "Debug WindowProc WM_KEYUP "
+ LL_INFOS("Window") << "Debug WindowProc WM_KEYUP "
<< " key " << S32(w_param)
- << llendl;
+ << LL_ENDL;
}
if (gKeyboard->handleKeyUp(w_param, mask) && eat_keystroke)
{
@@ -2227,6 +1917,11 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
break;
}
case WM_IME_SETCONTEXT:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_SETCONTEXT");
+ if (gDebugWindowProc)
+ {
+ llinfos << "WM_IME_SETCONTEXT" << llendl;
+ }
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
{
l_param &= ~ISC_SHOWUICOMPOSITIONWINDOW;
@@ -2235,6 +1930,11 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
break;
case WM_IME_STARTCOMPOSITION:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_STARTCOMPOSITION");
+ if (gDebugWindowProc)
+ {
+ llinfos << "WM_IME_STARTCOMPOSITION" << llendl;
+ }
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
{
window_imp->handleStartCompositionMessage();
@@ -2243,6 +1943,11 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
break;
case WM_IME_ENDCOMPOSITION:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_ENDCOMPOSITION");
+ if (gDebugWindowProc)
+ {
+ llinfos << "WM_IME_ENDCOMPOSITION" << llendl;
+ }
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
{
return 0;
@@ -2250,6 +1955,11 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
break;
case WM_IME_COMPOSITION:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_COMPOSITION");
+ if (gDebugWindowProc)
+ {
+ llinfos << "WM_IME_COMPOSITION" << llendl;
+ }
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
{
window_imp->handleCompositionMessage(l_param);
@@ -2258,6 +1968,11 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
break;
case WM_IME_REQUEST:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_REQUEST");
+ if (gDebugWindowProc)
+ {
+ llinfos << "WM_IME_REQUEST" << llendl;
+ }
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
{
LRESULT result = 0;
@@ -2269,6 +1984,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
break;
case WM_CHAR:
+ window_imp->mKeyCharCode = w_param;
+
// Should really use WM_UNICHAR eventually, but it requires a specific Windows version and I need
// to figure out how that works. - Doug
//
@@ -2279,13 +1996,12 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
// it is worth trying. The good old WM_CHAR works just fine even for supplementary
// characters. We just need to take care of surrogate pairs sent as two WM_CHAR's
// by ourselves. It is not that tough. -- Alissa Sabre @ SL
- //
- // llinfos << "WM_CHAR: " << w_param << llendl;
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_CHAR");
if (gDebugWindowProc)
{
- llinfos << "Debug WindowProc WM_CHAR "
+ LL_INFOS("Window") << "Debug WindowProc WM_CHAR "
<< " key " << S32(w_param)
- << llendl;
+ << LL_ENDL;
}
// Even if LLWindowCallbacks::handleUnicodeChar(llwchar, BOOL) returned FALSE,
// we *did* processed the event, so I believe we should not pass it to DefWindowProc...
@@ -2294,7 +2010,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
case WM_LBUTTONDOWN:
{
- LLFastTimer t2(LLFastTimer::FTM_MOUSEHANDLER);
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONDOWN");
+ LLFastTimer t2(FTM_MOUSEHANDLER);
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
{
window_imp->interruptLanguageTextInput();
@@ -2316,6 +2033,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleMouseDown(window_imp, gl_coord, mask))
{
return 0;
@@ -2327,6 +2046,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
//RN: ignore right button double clicks for now
//case WM_RBUTTONDBLCLK:
{
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONDBLCLK");
// Because we move the cursor position in the app, we need to query
// to find out where the cursor at the time the event is handled.
// If we don't do this, many clicks could get buffered up, and if the
@@ -2343,6 +2063,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleDoubleClick(window_imp, gl_coord, mask) )
{
return 0;
@@ -2352,10 +2074,11 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
case WM_LBUTTONUP:
{
- LLFastTimer t2(LLFastTimer::FTM_MOUSEHANDLER);
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONUP");
+ LLFastTimer t2(FTM_MOUSEHANDLER);
//if (gDebugClicks)
//{
- // llinfos << "WndProc left button up" << llendl;
+ // LL_INFOS("Window") << "WndProc left button up" << LL_ENDL;
//}
// Because we move the cursor position in the app, we need to query
// to find out where the cursor at the time the event is handled.
@@ -2373,6 +2096,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleMouseUp(window_imp, gl_coord, mask))
{
return 0;
@@ -2383,13 +2108,14 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
{
- LLFastTimer t2(LLFastTimer::FTM_MOUSEHANDLER);
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_RBUTTONDOWN");
+ LLFastTimer t2(FTM_MOUSEHANDLER);
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
{
window_imp->interruptLanguageTextInput();
}
- // Because we move the cursor position in tllviewerhe app, we need to query
+ // Because we move the cursor position in the llviewerapp, we need to query
// to find out where the cursor at the time the event is handled.
// If we don't do this, many clicks could get buffered up, and if the
// first click changes the cursor position, all subsequent clicks
@@ -2405,6 +2131,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleRightMouseDown(window_imp, gl_coord, mask))
{
return 0;
@@ -2414,7 +2142,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
case WM_RBUTTONUP:
{
- LLFastTimer t2(LLFastTimer::FTM_MOUSEHANDLER);
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_RBUTTONUP");
+ LLFastTimer t2(FTM_MOUSEHANDLER);
// Because we move the cursor position in the app, we need to query
// to find out where the cursor at the time the event is handled.
// If we don't do this, many clicks could get buffered up, and if the
@@ -2431,6 +2160,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleRightMouseUp(window_imp, gl_coord, mask))
{
return 0;
@@ -2441,7 +2172,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
case WM_MBUTTONDOWN:
// case WM_MBUTTONDBLCLK:
{
- LLFastTimer t2(LLFastTimer::FTM_MOUSEHANDLER);
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONDOWN");
+ LLFastTimer t2(FTM_MOUSEHANDLER);
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
{
window_imp->interruptLanguageTextInput();
@@ -2463,6 +2195,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleMiddleMouseDown(window_imp, gl_coord, mask))
{
return 0;
@@ -2472,8 +2206,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
case WM_MBUTTONUP:
{
- LLFastTimer t2(LLFastTimer::FTM_MOUSEHANDLER);
- // Because we move the cursor position in tllviewerhe app, we need to query
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONUP");
+ LLFastTimer t2(FTM_MOUSEHANDLER);
+ // Because we move the cursor position in the llviewer app, we need to query
// to find out where the cursor at the time the event is handled.
// If we don't do this, many clicks could get buffered up, and if the
// first click changes the cursor position, all subsequent clicks
@@ -2489,6 +2224,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleMiddleMouseUp(window_imp, gl_coord, mask))
{
return 0;
@@ -2498,9 +2235,30 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
case WM_MOUSEWHEEL:
{
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEWHEEL");
static short z_delta = 0;
- z_delta += HIWORD(w_param);
+ RECT client_rect;
+
+ // eat scroll events that occur outside our window, since we use mouse position to direct scroll
+ // instead of keyboard focus
+ // NOTE: mouse_coord is in *window* coordinates for scroll events
+ POINT mouse_coord = {(S32)(S16)LOWORD(l_param), (S32)(S16)HIWORD(l_param)};
+
+ if (ScreenToClient(window_imp->mWindowHandle, &mouse_coord)
+ && GetClientRect(window_imp->mWindowHandle, &client_rect))
+ {
+ // we have a valid mouse point and client rect
+ if (mouse_coord.x < client_rect.left || client_rect.right < mouse_coord.x
+ || mouse_coord.y < client_rect.top || client_rect.bottom < mouse_coord.y)
+ {
+ // mouse is outside of client rect, so don't do anything
+ return 0;
+ }
+ }
+
+ S16 incoming_z_delta = HIWORD(w_param);
+ z_delta += incoming_z_delta;
// cout << "z_delta " << z_delta << endl;
// current mouse wheels report changes in increments of zDelta (+120, -120)
@@ -2534,6 +2292,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
// Handle mouse movement within the window
case WM_MOUSEMOVE:
{
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEMOVE");
window_imp->convertCoords(window_coord, &gl_coord);
MASK mask = gKeyboard->currentMask(TRUE);
window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
@@ -2542,6 +2301,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
case WM_SIZE:
{
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SIZE");
S32 width = S32( LOWORD(l_param) );
S32 height = S32( HIWORD(l_param) );
@@ -2551,12 +2311,12 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
BOOL restored = ( w_param == SIZE_RESTORED );
BOOL minimized = ( w_param == SIZE_MINIMIZED );
- llinfos << "WINDOWPROC Size "
+ LL_INFOS("Window") << "WINDOWPROC Size "
<< width << "x" << height
<< " max " << S32(maximized)
<< " min " << S32(minimized)
<< " rest " << S32(restored)
- << llendl;
+ << LL_ENDL;
}
// There's an odd behavior with WM_SIZE that I would call a bug. If
@@ -2600,29 +2360,39 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
}
case WM_SETFOCUS:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SETFOCUS");
if (gDebugWindowProc)
{
- llinfos << "WINDOWPROC SetFocus" << llendl;
+ LL_INFOS("Window") << "WINDOWPROC SetFocus" << LL_ENDL;
}
window_imp->mCallbacks->handleFocus(window_imp);
return 0;
case WM_KILLFOCUS:
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KILLFOCUS");
if (gDebugWindowProc)
{
- llinfos << "WINDOWPROC KillFocus" << llendl;
+ LL_INFOS("Window") << "WINDOWPROC KillFocus" << LL_ENDL;
}
window_imp->mCallbacks->handleFocusLost(window_imp);
return 0;
case WM_COPYDATA:
- // received a URL
- PCOPYDATASTRUCT myCDS = (PCOPYDATASTRUCT) l_param;
- window_imp->mCallbacks->handleDataCopy(window_imp, myCDS->dwData, myCDS->lpData);
+ {
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_COPYDATA");
+ // received a URL
+ PCOPYDATASTRUCT myCDS = (PCOPYDATASTRUCT) l_param;
+ window_imp->mCallbacks->handleDataCopy(window_imp, myCDS->dwData, myCDS->lpData);
+ };
return 0;
+
+ break;
}
+
+ window_imp->mCallbacks->handlePauseWatchdog(window_imp);
}
+
// pass unhandled messages down to Windows
return DefWindowProc(h_wnd, u_msg, w_param, l_param);
}
@@ -2750,7 +2520,7 @@ BOOL LLWindowWin32::pasteTextFromClipboard(LLWString &dst)
if (utf16str)
{
dst = utf16str_to_wstring(utf16str);
- LLWString::removeCRLF(dst);
+ LLWStringUtil::removeCRLF(dst);
GlobalUnlock(h_data);
success = TRUE;
}
@@ -2773,7 +2543,7 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr)
// Provide a copy of the data in Unicode format.
LLWString sanitized_string(wstr);
- LLWString::addCRLF(sanitized_string);
+ LLWStringUtil::addCRLF(sanitized_string);
llutf16string out_utf16 = wstring_to_utf16str(sanitized_string);
const size_t size_utf16 = (out_utf16.length() + 1) * sizeof(WCHAR);
@@ -2860,86 +2630,6 @@ BOOL LLWindowWin32::getClientRectInScreenSpace( RECT* rectp )
return success;
}
-
-BOOL LLWindowWin32::sendEmail(const char* address, const char* subject, const char* body_text,
- const char* attachment, const char* attachment_displayed_name )
-{
- // Based on "A SendMail() DLL" by Greg Turner, Windows Developer Magazine, Nov. 1997.
- // See article for use of GetProcAddress
- // No restrictions on use.
-
- enum SendResult
- {
- LL_EMAIL_SUCCESS,
- LL_EMAIL_MAPI_NOT_INSTALLED, // No MAPI Server (eg Microsoft Exchange) installed
- LL_EMAIL_MAPILOAD_FAILED, // Load of MAPI32.DLL failed
- LL_EMAIL_SEND_FAILED // The message send itself failed
- };
-
- SendResult result = LL_EMAIL_SUCCESS;
-
- U32 mapi_installed = GetProfileInt(L"Mail", L"MAPI", 0);
- if( !mapi_installed)
- {
- result = LL_EMAIL_MAPI_NOT_INSTALLED;
- }
- else
- {
- HINSTANCE hMAPIInst = LoadLibrary(L"MAPI32.DLL"); /* Flawfinder: ignore */
- if(!hMAPIInst)
- {
- result = LL_EMAIL_MAPILOAD_FAILED;
- }
- else
- {
- LPMAPISENDMAIL pMAPISendMail = (LPMAPISENDMAIL) GetProcAddress(hMAPIInst, "MAPISendMail");
-
- // Send the message
- MapiRecipDesc recipients[1];
- recipients[0].ulReserved = 0;
- recipients[0].ulRecipClass = MAPI_TO;
- recipients[0].lpszName = (char*)address;
- recipients[0].lpszAddress = (char*)address;
- recipients[0].ulEIDSize = 0;
- recipients[0].lpEntryID = 0;
-
- MapiFileDesc files[1];
- files[0].ulReserved = 0;
- files[0].flFlags = 0; // non-OLE file
- files[0].nPosition = -1; // Leave file location in email unspecified.
- files[0].lpszPathName = (char*)attachment; // Must be fully qualified name, including drive letter.
- files[0].lpszFileName = (char*)attachment_displayed_name; // If NULL, uses attachment as displayed name.
- files[0].lpFileType = NULL; // Recipient will have to figure out what kind of file this is.
-
- MapiMessage msg;
- memset(&msg, 0, sizeof(msg));
- msg.lpszSubject = (char*)subject; // may be NULL
- msg.lpszNoteText = (char*)body_text;
- msg.nRecipCount = address ? 1 : 0;
- msg.lpRecips = address ? recipients : NULL;
- msg.nFileCount = attachment ? 1 : 0;
- msg.lpFiles = attachment ? files : NULL;
-
- U32 success = pMAPISendMail(0, (U32) mWindowHandle, &msg, MAPI_DIALOG|MAPI_LOGON_UI|MAPI_NEW_SESSION, 0);
- if(success != SUCCESS_SUCCESS)
- {
- result = LL_EMAIL_SEND_FAILED;
- }
-
- FreeLibrary(hMAPIInst);
- }
- }
-
- return result == LL_EMAIL_SUCCESS;
-}
-
-
-S32 LLWindowWin32::stat(const char* file_name, struct stat* stat_info)
-{
- llassert( sizeof(struct stat) == sizeof(struct _stat) ); // They are defined identically in sys/stat.h, but I'm paranoid.
- return LLFile::stat( file_name, (struct _stat*) stat_info );
-}
-
void LLWindowWin32::flashIcon(F32 seconds)
{
FLASHWINFO flash_info;
@@ -2966,7 +2656,7 @@ BOOL LLWindowWin32::setGamma(const F32 gamma)
{
mCurrentGamma = gamma;
- llinfos << "Setting gamma to " << gamma << llendl;
+ LL_DEBUGS("Window") << "Setting gamma to " << gamma << LL_ENDL;
for ( int i = 0; i < 256; ++i )
{
@@ -2985,6 +2675,16 @@ BOOL LLWindowWin32::setGamma(const F32 gamma)
return SetDeviceGammaRamp ( mhDC, mCurrentGammaRamp );
}
+void LLWindowWin32::setFSAASamples(const U32 fsaa_samples)
+{
+ mFSAASamples = fsaa_samples;
+}
+
+U32 LLWindowWin32::getFSAASamples()
+{
+ return mFSAASamples;
+}
+
LLWindow::LLWindowResolution* LLWindowWin32::getSupportedResolutions(S32 &num_resolutions)
{
if (!mSupportedResolutions)
@@ -3097,8 +2797,8 @@ BOOL LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 bits, S32 re
if (!success)
{
- llwarns << "setDisplayResolution failed, "
- << width << "x" << height << "x" << bits << " @ " << refresh << llendl;
+ LL_WARNS("Window") << "setDisplayResolution failed, "
+ << width << "x" << height << "x" << bits << " @ " << refresh << LL_ENDL;
}
return success;
@@ -3120,7 +2820,7 @@ BOOL LLWindowWin32::setFullscreenResolution()
// protected
BOOL LLWindowWin32::resetDisplayResolution()
{
- llinfos << "resetDisplayResolution START" << llendl;
+ LL_DEBUGS("Window") << "resetDisplayResolution START" << LL_ENDL;
LONG cds_result = ChangeDisplaySettings(NULL, 0);
@@ -3128,10 +2828,10 @@ BOOL LLWindowWin32::resetDisplayResolution()
if (!success)
{
- llwarns << "resetDisplayResolution failed" << llendl;
+ LL_WARNS("Window") << "resetDisplayResolution failed" << LL_ENDL;
}
- llinfos << "resetDisplayResolution END" << llendl;
+ LL_DEBUGS("Window") << "resetDisplayResolution END" << LL_ENDL;
return success;
}
@@ -3142,81 +2842,6 @@ void LLWindowWin32::swapBuffers()
}
-BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance,
- VOID* pContext )
-{
- HRESULT hr;
-
- // Obtain an interface to the enumerated joystick.
- hr = g_pDI->CreateDevice( pdidInstance->guidInstance, &g_pJoystick, NULL );
-
- // If it failed, then we can't use this joystick. (Maybe the user unplugged
- // it while we were in the middle of enumerating it.)
- if( FAILED(hr) )
- return DIENUM_CONTINUE;
-
- // Stop enumeration. Note: we're just taking the first joystick we get. You
- // could store all the enumerated joysticks and let the user pick.
- return DIENUM_STOP;
-}
-
-BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi,
- VOID* pContext )
-{
- if( pdidoi->dwType & DIDFT_AXIS )
- {
- DIPROPRANGE diprg;
- diprg.diph.dwSize = sizeof(DIPROPRANGE);
- diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER);
- diprg.diph.dwHow = DIPH_BYID;
- diprg.diph.dwObj = pdidoi->dwType; // Specify the enumerated axis
- diprg.lMin = -1000;
- diprg.lMax = +1000;
-
- // Set the range for the axis
- if( FAILED( g_pJoystick->SetProperty( DIPROP_RANGE, &diprg.diph ) ) )
- return DIENUM_STOP;
-
- }
- return DIENUM_CONTINUE;
-}
-
-void LLWindowWin32::updateJoystick( )
-{
- HRESULT hr;
- DIJOYSTATE js; // DInput joystick state
-
- if (!g_pJoystick)
- return;
- hr = g_pJoystick->Poll();
- if ( hr == DIERR_INPUTLOST )
- {
- hr = g_pJoystick->Acquire();
- return;
- }
- else if ( FAILED(hr) )
- return;
-
- // Get the input's device state
- if( FAILED( hr = g_pJoystick->GetDeviceState( sizeof(DIJOYSTATE), &js ) ) )
- return; // The device should have been acquired during the Poll()
-
- mJoyAxis[0] = js.lX/1000.f;
- mJoyAxis[1] = js.lY/1000.f;
- mJoyAxis[2] = js.lZ/1000.f;
- mJoyAxis[3] = js.lRx/1000.f;
- mJoyAxis[4] = js.lRy/1000.f;
- mJoyAxis[5] = js.lRz/1000.f;
- mJoyAxis[6] = js.rglSlider[0]/1000.f;
- mJoyAxis[7] = js.rglSlider[1]/1000.f;
-
- for (U32 i = 0; i < 16; i++)
- {
- mJoyButtonState[i] = js.rgbButtons[i];
- }
-}
-
-
//
// LLSplashScreenImp
//
@@ -3242,12 +2867,20 @@ void LLSplashScreenWin32::showImpl()
}
-void LLSplashScreenWin32::updateImpl(const char *mesg)
+void LLSplashScreenWin32::updateImpl(const std::string& mesg)
{
if (!mWindow) return;
- WCHAR w_mesg[1024];
- mbstowcs(w_mesg, mesg, 1024);
+ int output_str_len = MultiByteToWideChar(CP_UTF8, 0, mesg.c_str(), mesg.length(), NULL, 0);
+ if( output_str_len>1024 )
+ return;
+
+ WCHAR w_mesg[1025];//big enought to keep null terminatos
+
+ MultiByteToWideChar (CP_UTF8, 0, mesg.c_str(), mesg.length(), w_mesg, output_str_len);
+
+ //looks like MultiByteToWideChar didn't add null terminator to converted string, see EXT-4858
+ w_mesg[output_str_len] = 0;
SendDlgItemMessage(mWindow,
666, // HACK: text id
@@ -3279,7 +2912,7 @@ LRESULT CALLBACK LLSplashScreenWin32::windowProc(HWND h_wnd, UINT u_msg,
// Helper Funcs
//
-S32 OSMessageBoxWin32(const char* text, const char* caption, U32 type)
+S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 type)
{
UINT uType;
@@ -3300,7 +2933,7 @@ S32 OSMessageBoxWin32(const char* text, const char* caption, U32 type)
}
// HACK! Doesn't properly handle wide strings!
- int retval_win = MessageBoxA(NULL, text, caption, uType);
+ int retval_win = MessageBoxA(NULL, text.c_str(), caption.c_str(), uType);
S32 retval;
switch(retval_win)
@@ -3326,15 +2959,13 @@ S32 OSMessageBoxWin32(const char* text, const char* caption, U32 type)
}
-void spawn_web_browser(const char* escaped_url )
+void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url, bool async)
{
bool found = false;
S32 i;
for (i = 0; i < gURLProtocolWhitelistCount; i++)
{
- S32 len = strlen(gURLProtocolWhitelist[i]); /* Flawfinder: ignore */
- if (!strncmp(escaped_url, gURLProtocolWhitelist[i], len)
- && escaped_url[len] == ':')
+ if (escaped_url.find(gURLProtocolWhitelist[i]) == 0)
{
found = true;
break;
@@ -3343,84 +2974,48 @@ void spawn_web_browser(const char* escaped_url )
if (!found)
{
- llwarns << "spawn_web_browser() called for url with protocol not on whitelist: " << escaped_url << llendl;
+ LL_WARNS("Window") << "spawn_web_browser() called for url with protocol not on whitelist: " << escaped_url << LL_ENDL;
return;
}
- llinfos << "Opening URL " << escaped_url << llendl;
+ LL_INFOS("Window") << "Opening URL " << escaped_url << LL_ENDL;
- // Figure out the user's default web browser
- // HKEY_CLASSES_ROOT\http\shell\open\command
- char reg_path_str[256]; /* Flawfinder: ignore */
- snprintf(reg_path_str, sizeof(reg_path_str), "%s\\shell\\open\\command", gURLProtocolWhitelistHandler[i]); /* Flawfinder: ignore */
- WCHAR reg_path_wstr[256];
- mbstowcs(reg_path_wstr, reg_path_str, sizeof(reg_path_wstr)/sizeof(reg_path_wstr[0]));
+ // replaced ShellExecute code with ShellExecuteEx since ShellExecute doesn't work
+ // reliablly on Vista.
- HKEY key;
- WCHAR browser_open_wstr[1024];
- DWORD buffer_length = 1024;
- RegOpenKeyEx(HKEY_CLASSES_ROOT, reg_path_wstr, 0, KEY_QUERY_VALUE, &key);
- RegQueryValueEx(key, NULL, NULL, NULL, (LPBYTE)browser_open_wstr, &buffer_length);
- RegCloseKey(key);
+ // this is madness.. no, this is..
+ LLWString url_wstring = utf8str_to_wstring( escaped_url );
+ llutf16string url_utf16 = wstring_to_utf16str( url_wstring );
- // Convert to STL string
- LLWString browser_open_wstring = utf16str_to_wstring(browser_open_wstr);
-
- if (browser_open_wstring.length() < 2)
+ // let the OS decide what to use to open the URL
+ SHELLEXECUTEINFO sei = { sizeof( sei ) };
+ // NOTE: this assumes that SL will stick around long enough to complete the DDE message exchange
+ // necessary for ShellExecuteEx to complete
+ if (async)
{
- llwarns << "Invalid browser executable in registry " << browser_open_wstring << llendl;
- return;
+ sei.fMask = SEE_MASK_ASYNCOK;
}
+ sei.nShow = SW_SHOWNORMAL;
+ sei.lpVerb = L"open";
+ sei.lpFile = url_utf16.c_str();
+ ShellExecuteEx( &sei );
+}
- // Extract the process that's supposed to be launched
- LLWString browser_executable;
- if (browser_open_wstring[0] == '"')
- {
- // executable is quoted, find the matching quote
- size_t quote_pos = browser_open_wstring.find('"', 1);
- // copy out the string including both quotes
- browser_executable = browser_open_wstring.substr(0, quote_pos+1);
- }
- else
- {
- // executable not quoted, find a space
- size_t space_pos = browser_open_wstring.find(' ', 1);
- browser_executable = browser_open_wstring.substr(0, space_pos);
- }
-
- llinfos << "Browser reg key: " << wstring_to_utf8str(browser_open_wstring) << llendl;
- llinfos << "Browser executable: " << wstring_to_utf8str(browser_executable) << llendl;
-
- // Convert URL to wide string for Windows API
- // Assume URL is UTF8, as can come from scripts
- LLWString url_wstring = utf8str_to_wstring(escaped_url);
- llutf16string url_utf16 = wstring_to_utf16str(url_wstring);
+/*
+ Make the raw keyboard data available - used to poke through to LLQtWebKit so
+ that Qt/Webkit has access to the virtual keycodes etc. that it needs
+*/
+LLSD LLWindowWin32::getNativeKeyData()
+{
+ LLSD result = LLSD::emptyMap();
- // Convert executable and path to wide string for Windows API
- llutf16string browser_exec_utf16 = wstring_to_utf16str(browser_executable);
+ result["scan_code"] = (S32)mKeyScanCode;
+ result["virtual_key"] = (S32)mKeyVirtualKey;
- // ShellExecute returns HINSTANCE for backwards compatiblity.
- // MS docs say to cast to int and compare to 32.
- HWND our_window = NULL;
- LPCWSTR directory_wstr = NULL;
- int retval = (int) ShellExecute(our_window, /* Flawfinder: ignore */
- L"open",
- browser_exec_utf16.c_str(),
- url_utf16.c_str(),
- directory_wstr,
- SW_SHOWNORMAL);
- if (retval > 32)
- {
- llinfos << "load_url success with " << retval << llendl;
- }
- else
- {
- llinfos << "load_url failure with " << retval << llendl;
- }
+ return result;
}
-
-BOOL LLWindowWin32::dialog_color_picker ( F32 *r, F32 *g, F32 *b )
+BOOL LLWindowWin32::dialogColorPicker( F32 *r, F32 *g, F32 *b )
{
BOOL retval = FALSE;
@@ -3859,7 +3454,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes)
{
for (LLWString::const_iterator i = result_string.begin(); i != result_string.end(); i++)
{
- mPreeditor->handleUnicodeCharHere(*i, FALSE);
+ mPreeditor->handleUnicodeCharHere(*i);
}
}
@@ -3914,6 +3509,13 @@ static LLWString find_context(const LLWString & wtext, S32 focus, S32 focus_leng
return wtext.substr(start, end - start);
}
+// final stage of handling drop requests - both from WM_DROPFILES message
+// for files and via IDropTarget interface requests.
+LLWindowCallbacks::DragNDropResult LLWindowWin32::completeDragNDropRequest( const LLCoordGL gl_coord, const MASK mask, LLWindowCallbacks::DragNDropAction action, const std::string url )
+{
+ return mCallbacks->handleDragNDrop( this, gl_coord, mask, action, url );
+}
+
// Handle WM_IME_REQUEST message.
// If it handled the message, returns TRUE. Otherwise, FALSE.
// When it handled the message, the value to be returned from
@@ -3947,7 +3549,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
// WCHARs, i.e., UTF-16 encoding units, so we can't simply pass the
// number to getPreeditLocation.
- const LLWString & wtext = mPreeditor->getWText();
+ const LLWString & wtext = mPreeditor->getPreeditString();
S32 preedit, preedit_length;
mPreeditor->getPreeditRange(&preedit, &preedit_length);
LLCoordGL caret_coord;
@@ -3956,7 +3558,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
if (!mPreeditor->getPreeditLocation(position, &caret_coord, &preedit_bounds, &text_control))
{
- llwarns << "*** IMR_QUERYCHARPOSITON called but getPreeditLocation failed." << llendl;
+ LL_WARNS("Window") << "*** IMR_QUERYCHARPOSITON called but getPreeditLocation failed." << LL_ENDL;
return FALSE;
}
fillCharPosition(caret_coord, preedit_bounds, text_control, char_position);
@@ -3974,7 +3576,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
case IMR_RECONVERTSTRING:
{
mPreeditor->resetPreedit();
- const LLWString & wtext = mPreeditor->getWText();
+ const LLWString & wtext = mPreeditor->getPreeditString();
S32 select, select_length;
mPreeditor->getSelectionRange(&select, &select_length);
@@ -4016,7 +3618,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
}
case IMR_DOCUMENTFEED:
{
- const LLWString & wtext = mPreeditor->getWText();
+ const LLWString & wtext = mPreeditor->getPreeditString();
S32 preedit, preedit_length;
mPreeditor->getPreeditRange(&preedit, &preedit_length);
@@ -4043,5 +3645,12 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
return FALSE;
}
+//static
+std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList()
+{
+ // Fonts previously in getFontListSans() have moved to fonts.xml.
+ return std::vector<std::string>();
+}
+
#endif // LL_WINDOWS
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index b21df8981e..387e4cbdb6 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -2,30 +2,25 @@
* @file llwindowwin32.h
* @brief Windows implementation of LLWindow class
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,6 +33,8 @@
#include <windows.h>
#include "llwindow.h"
+#include "llwindowcallbacks.h"
+#include "lldragdropwin32.h"
// Hack for async host by name
#define LL_WM_HOST_RESOLVED (WM_APP + 1)
@@ -53,13 +50,15 @@ public:
/*virtual*/ BOOL getMinimized();
/*virtual*/ BOOL getMaximized();
/*virtual*/ BOOL maximize();
+ /*virtual*/ void minimize();
+ /*virtual*/ void restore();
/*virtual*/ BOOL getFullscreen();
/*virtual*/ BOOL getPosition(LLCoordScreen *position);
/*virtual*/ BOOL getSize(LLCoordScreen *size);
/*virtual*/ BOOL getSize(LLCoordWindow *size);
/*virtual*/ BOOL setPosition(LLCoordScreen position);
/*virtual*/ BOOL setSize(LLCoordScreen size);
- /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync);
+ /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
/*virtual*/ void showCursor();
@@ -78,18 +77,14 @@ public:
/*virtual*/ void flashIcon(F32 seconds);
/*virtual*/ F32 getGamma();
/*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
+ /*virtual*/ void setFSAASamples(const U32 fsaa_samples);
+ /*virtual*/ U32 getFSAASamples();
/*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
/*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
/*virtual*/ void gatherInput();
/*virtual*/ void delayInputProcessing();
/*virtual*/ void swapBuffers();
- /*virtual*/ LLString getTempFileName();
- /*virtual*/ void deleteFile( const char* file_name );
- /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info );
- /*virtual*/ BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL);
-
-
// handy coordinate space conversion routines
/*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to);
/*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to);
@@ -103,7 +98,7 @@ public:
/*virtual*/ F32 getPixelAspectRatio();
/*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; }
- /*virtual*/ BOOL dialog_color_picker (F32 *r, F32 *g, F32 *b );
+ /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b );
/*virtual*/ void *getPlatformWindow();
/*virtual*/ void bringToFront();
@@ -113,12 +108,17 @@ public:
/*virtual*/ void setLanguageTextInput( const LLCoordGL & pos );
/*virtual*/ void updateLanguageTextInputArea();
/*virtual*/ void interruptLanguageTextInput();
+ /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
+
+ LLWindowCallbacks::DragNDropResult completeDragNDropRequest( const LLCoordGL gl_coord, const MASK mask, LLWindowCallbacks::DragNDropAction action, const std::string url );
+
+ static std::vector<std::string> getDynamicFallbackFontList();
protected:
- LLWindowWin32(
- char *title, char *name, int x, int y, int width, int height, U32 flags,
+ LLWindowWin32(LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
- BOOL ignore_pixel_depth);
+ BOOL ignore_pixel_depth, U32 fsaa_samples);
~LLWindowWin32();
void initCursors();
@@ -126,7 +126,7 @@ protected:
HCURSOR loadColorCursor(LPCTSTR name);
BOOL isValid();
void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
-
+ LLSD getNativeKeyData();
// Changes display resolution. Returns true if successful
BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh);
@@ -137,9 +137,6 @@ protected:
// Restore the display resolution to its value before we ran the app.
BOOL resetDisplayResolution();
- void minimize();
- void restore();
-
BOOL shouldPostQuit() { return mPostQuit; }
void fillCompositionForm(const LLRect& bounds, COMPOSITIONFORM *form);
@@ -184,6 +181,7 @@ protected:
static BOOL sIsClassRegistered; // has the window class been registered?
F32 mCurrentGamma;
+ U32 mFSAASamples;
WORD mPrevGammaRamp[256*3];
WORD mCurrentGammaRamp[256*3];
@@ -205,6 +203,12 @@ protected:
LLPreeditor *mPreeditor;
+ LLDragDropWin32* mDragDrop;
+
+ U32 mKeyCharCode;
+ U32 mKeyScanCode;
+ U32 mKeyVirtualKey;
+
friend class LLWindowManager;
};
@@ -215,7 +219,7 @@ public:
virtual ~LLSplashScreenWin32();
/*virtual*/ void showImpl();
- /*virtual*/ void updateImpl(const char* mesg);
+ /*virtual*/ void updateImpl(const std::string& mesg);
/*virtual*/ void hideImpl();
#if LL_WINDOWS
@@ -234,6 +238,6 @@ extern LPWSTR gIconResource;
static void handleMessage( const MSG& msg );
-S32 OSMessageBoxWin32(const char* text, const char* caption, U32 type);
+S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 type);
#endif //LL_LLWINDOWWIN32_H