diff options
author | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
commit | 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch) | |
tree | bcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/llwindow/llwindowwin32.cpp | |
parent | Second Life viewer sources 1.13.3.2 (diff) | |
download | meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2 meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz |
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/llwindow/llwindowwin32.cpp')
-rw-r--r-- | linden/indra/llwindow/llwindowwin32.cpp | 117 |
1 files changed, 11 insertions, 106 deletions
diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp index 5929fb5..1d084d2 100644 --- a/linden/indra/llwindow/llwindowwin32.cpp +++ b/linden/indra/llwindow/llwindowwin32.cpp | |||
@@ -74,57 +74,6 @@ void show_window_creation_error(const char* title) | |||
74 | { | 74 | { |
75 | llwarns << title << llendl; | 75 | llwarns << title << llendl; |
76 | shell_open( "help/window_creation_error.html"); | 76 | shell_open( "help/window_creation_error.html"); |
77 | /* | ||
78 | OSMessageBox( | ||
79 | "Second Life is unable to run because it can't set up your display.\n" | ||
80 | "We need to be able to make a 32-bit color window at 1024x768, with\n" | ||
81 | "an 8 bit alpha channel.\n" | ||
82 | "\n" | ||
83 | "First, be sure your monitor is set to True Color (32-bit) in\n" | ||
84 | "Start -> Control Panels -> Display -> Settings.\n" | ||
85 | "\n" | ||
86 | "Otherwise, this may be due to video card driver issues.\n" | ||
87 | "Please make sure you have the latest video card drivers installed.\n" | ||
88 | "ATI drivers are available at http://www.ati.com/\n" | ||
89 | "nVidia drivers are available at http://www.nvidia.com/\n" | ||
90 | "\n" | ||
91 | "If you continue to receive this message, contact customer service.", | ||
92 | title, | ||
93 | OSMB_OK); | ||
94 | */ | ||
95 | } | ||
96 | |||
97 | BOOL check_for_card(const char* RENDERER, const char* bad_card) | ||
98 | { | ||
99 | if (!strnicmp(RENDERER, bad_card, strlen(bad_card))) | ||
100 | { | ||
101 | char buffer[1024]; | ||
102 | sprintf(buffer, | ||
103 | "Your video card appears to be a %s, which Second Life does not support.\n" | ||
104 | "\n" | ||
105 | "Second Life requires a video card with 32 Mb of memory or more, as well as\n" | ||
106 | "multitexture support. We explicitly support nVidia GeForce 2 or better, \n" | ||
107 | "and ATI Radeon 8500 or better.\n" | ||
108 | "\n" | ||
109 | "If you own a supported card and continue to receive this message, try \n" | ||
110 | "updating to the latest video card drivers. Otherwise look in the\n" | ||
111 | "secondlife.com support section or e-mail technical support\n" | ||
112 | "\n" | ||
113 | "You can try to run Second Life, but it will probably crash or run\n" | ||
114 | "very slowly. Try anyway?", | ||
115 | bad_card); | ||
116 | S32 button = OSMessageBox(buffer, "Unsupported video card", OSMB_YESNO); | ||
117 | if (OSBTN_YES == button) | ||
118 | { | ||
119 | return FALSE; | ||
120 | } | ||
121 | else | ||
122 | { | ||
123 | return TRUE; | ||
124 | } | ||
125 | } | ||
126 | |||
127 | return FALSE; | ||
128 | } | 77 | } |
129 | 78 | ||
130 | //static | 79 | //static |
@@ -147,6 +96,7 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width, | |||
147 | BOOL ignore_pixel_depth) | 96 | BOOL ignore_pixel_depth) |
148 | : LLWindow(fullscreen, flags) | 97 | : LLWindow(fullscreen, flags) |
149 | { | 98 | { |
99 | S32 i = 0; | ||
150 | mIconResource = gIconResource; | 100 | mIconResource = gIconResource; |
151 | mOverrideAspectRatio = 0.f; | 101 | mOverrideAspectRatio = 0.f; |
152 | mNativeAspectRatio = 0.f; | 102 | mNativeAspectRatio = 0.f; |
@@ -348,8 +298,8 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width, | |||
348 | mFullscreenBits = -1; | 298 | mFullscreenBits = -1; |
349 | mFullscreenRefresh = -1; | 299 | mFullscreenRefresh = -1; |
350 | 300 | ||
351 | char error[256]; | 301 | char error[256]; /* Flawfinder: ignore */ |
352 | sprintf(error, "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); | 302 | snprintf(error, sizeof(error), "Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); /* Flawfinder: ignore */ |
353 | OSMessageBox(error, "Error", OSMB_OK); | 303 | OSMessageBox(error, "Error", OSMB_OK); |
354 | } | 304 | } |
355 | } | 305 | } |
@@ -515,37 +465,6 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width, | |||
515 | return; | 465 | return; |
516 | } | 466 | } |
517 | 467 | ||
518 | // Check for some explicitly unsupported cards. | ||
519 | const char* RENDERER = (const char*) glGetString(GL_RENDERER); | ||
520 | |||
521 | const char* CARD_LIST[] = | ||
522 | { "RAGE 128", | ||
523 | "RIVA TNT2", | ||
524 | "Intel 810", | ||
525 | "3Dfx/Voodoo3", | ||
526 | "Radeon 7000", | ||
527 | "Radeon 7200", | ||
528 | "Radeon 7500", | ||
529 | "Radeon DDR", | ||
530 | "Radeon VE", | ||
531 | "GDI Generic" }; | ||
532 | const S32 CARD_COUNT = sizeof(CARD_LIST)/sizeof(char*); | ||
533 | |||
534 | // Future candidates: | ||
535 | // ProSavage/Twister | ||
536 | // SuperSavage | ||
537 | |||
538 | S32 i; | ||
539 | for (i = 0; i < CARD_COUNT; i++) | ||
540 | { | ||
541 | if (check_for_card(RENDERER, CARD_LIST[i])) | ||
542 | { | ||
543 | close(); | ||
544 | shell_open( "help/unsupported_card.html" ); | ||
545 | return; | ||
546 | } | ||
547 | } | ||
548 | |||
549 | gGLManager.initWGL(); | 468 | gGLManager.initWGL(); |
550 | 469 | ||
551 | if (gGLManager.mHasWGLARBPixelFormat && (wglChoosePixelFormatARB != NULL)) | 470 | if (gGLManager.mHasWGLARBPixelFormat && (wglChoosePixelFormatARB != NULL)) |
@@ -1976,20 +1895,6 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ | |||
1976 | << " key " << S32(w_param) | 1895 | << " key " << S32(w_param) |
1977 | << llendl; | 1896 | << llendl; |
1978 | } | 1897 | } |
1979 | // lower 15 bits hold key repeat count | ||
1980 | S32 key_repeat_count = l_param & 0x7fff; | ||
1981 | if (key_repeat_count > 1) | ||
1982 | { | ||
1983 | KEY translated_key; | ||
1984 | gKeyboard->translateKey(w_param, &translated_key); | ||
1985 | if (!gKeyboard->getKeyDown(translated_key)) | ||
1986 | { | ||
1987 | //RN: hack for handling key repeats when we no longer recognize the key as being down | ||
1988 | //This is necessary because we sometimes ignore the message queue and use getAsyncKeyState | ||
1989 | // to clear key level flags before we've processed all key repeat messages | ||
1990 | return 0; | ||
1991 | } | ||
1992 | } | ||
1993 | if(gKeyboard->handleKeyDown(w_param, mask) && eat_keystroke) | 1898 | if(gKeyboard->handleKeyDown(w_param, mask) && eat_keystroke) |
1994 | { | 1899 | { |
1995 | return 0; | 1900 | return 0; |
@@ -2469,7 +2374,7 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr) | |||
2469 | WCHAR* copy_utf16 = (WCHAR*) GlobalLock(hglobal_copy_utf16); | 2374 | WCHAR* copy_utf16 = (WCHAR*) GlobalLock(hglobal_copy_utf16); |
2470 | if (copy_utf16) | 2375 | if (copy_utf16) |
2471 | { | 2376 | { |
2472 | memcpy(copy_utf16, out_utf16.c_str(), size_utf16); | 2377 | memcpy(copy_utf16, out_utf16.c_str(), size_utf16); /* Flawfinder: ignore */ |
2473 | GlobalUnlock(hglobal_copy_utf16); | 2378 | GlobalUnlock(hglobal_copy_utf16); |
2474 | 2379 | ||
2475 | if (SetClipboardData(CF_UNICODETEXT, hglobal_copy_utf16)) | 2380 | if (SetClipboardData(CF_UNICODETEXT, hglobal_copy_utf16)) |
@@ -2493,7 +2398,7 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr) | |||
2493 | char* copy = (char*) GlobalLock(hglobal_copy); | 2398 | char* copy = (char*) GlobalLock(hglobal_copy); |
2494 | if( copy ) | 2399 | if( copy ) |
2495 | { | 2400 | { |
2496 | memcpy(copy, out_s.c_str(), size); | 2401 | memcpy(copy, out_s.c_str(), size); /* Flawfinder: ignore */ |
2497 | GlobalUnlock(hglobal_copy); | 2402 | GlobalUnlock(hglobal_copy); |
2498 | 2403 | ||
2499 | if (SetClipboardData(CF_TEXT, hglobal_copy)) | 2404 | if (SetClipboardData(CF_TEXT, hglobal_copy)) |
@@ -2594,7 +2499,7 @@ BOOL LLWindowWin32::sendEmail(const char* address, const char* subject, const ch | |||
2594 | } | 2499 | } |
2595 | else | 2500 | else |
2596 | { | 2501 | { |
2597 | HINSTANCE hMAPIInst = LoadLibrary(L"MAPI32.DLL"); | 2502 | HINSTANCE hMAPIInst = LoadLibrary(L"MAPI32.DLL"); /* Flawfinder: ignore */ |
2598 | if(!hMAPIInst) | 2503 | if(!hMAPIInst) |
2599 | { | 2504 | { |
2600 | result = LL_EMAIL_MAPILOAD_FAILED; | 2505 | result = LL_EMAIL_MAPILOAD_FAILED; |
@@ -3112,7 +3017,7 @@ void spawn_web_browser(const char* escaped_url ) | |||
3112 | S32 i; | 3017 | S32 i; |
3113 | for (i = 0; i < gURLProtocolWhitelistCount; i++) | 3018 | for (i = 0; i < gURLProtocolWhitelistCount; i++) |
3114 | { | 3019 | { |
3115 | S32 len = strlen(gURLProtocolWhitelist[i]); | 3020 | S32 len = strlen(gURLProtocolWhitelist[i]); /* Flawfinder: ignore */ |
3116 | if (!strncmp(escaped_url, gURLProtocolWhitelist[i], len) | 3021 | if (!strncmp(escaped_url, gURLProtocolWhitelist[i], len) |
3117 | && escaped_url[len] == ':') | 3022 | && escaped_url[len] == ':') |
3118 | { | 3023 | { |
@@ -3131,8 +3036,8 @@ void spawn_web_browser(const char* escaped_url ) | |||
3131 | 3036 | ||
3132 | // Figure out the user's default web browser | 3037 | // Figure out the user's default web browser |
3133 | // HKEY_CLASSES_ROOT\http\shell\open\command | 3038 | // HKEY_CLASSES_ROOT\http\shell\open\command |
3134 | char reg_path_str[256]; | 3039 | char reg_path_str[256]; /* Flawfinder: ignore */ |
3135 | sprintf(reg_path_str, "%s\\shell\\open\\command", gURLProtocolWhitelistHandler[i]); | 3040 | snprintf(reg_path_str, sizeof(reg_path_str), "%s\\shell\\open\\command", gURLProtocolWhitelistHandler[i]); /* Flawfinder: ignore */ |
3136 | WCHAR reg_path_wstr[256]; | 3041 | WCHAR reg_path_wstr[256]; |
3137 | mbstowcs(reg_path_wstr, reg_path_str, 1024); | 3042 | mbstowcs(reg_path_wstr, reg_path_str, 1024); |
3138 | 3043 | ||
@@ -3183,7 +3088,7 @@ void spawn_web_browser(const char* escaped_url ) | |||
3183 | // MS docs say to cast to int and compare to 32. | 3088 | // MS docs say to cast to int and compare to 32. |
3184 | HWND our_window = NULL; | 3089 | HWND our_window = NULL; |
3185 | LPCWSTR directory_wstr = NULL; | 3090 | LPCWSTR directory_wstr = NULL; |
3186 | int retval = (int) ShellExecute(our_window, | 3091 | int retval = (int) ShellExecute(our_window, /* Flawfinder: ignore */ |
3187 | L"open", | 3092 | L"open", |
3188 | browser_exec_utf16.c_str(), | 3093 | browser_exec_utf16.c_str(), |
3189 | url_utf16.c_str(), | 3094 | url_utf16.c_str(), |
@@ -3207,7 +3112,7 @@ void shell_open( const char* file_path ) | |||
3207 | mbstowcs(wstr, file_path, 1024); | 3112 | mbstowcs(wstr, file_path, 1024); |
3208 | 3113 | ||
3209 | HWND our_window = NULL; | 3114 | HWND our_window = NULL; |
3210 | int retval = (int) ShellExecute(our_window, L"open", wstr, NULL, NULL, SW_SHOWNORMAL); | 3115 | int retval = (int) ShellExecute(our_window, L"open", wstr, NULL, NULL, SW_SHOWNORMAL); /* Flawfinder: ignore */ |
3211 | if (retval > 32) | 3116 | if (retval > 32) |
3212 | { | 3117 | { |
3213 | llinfos << "ShellExecute success with " << retval << llendl; | 3118 | llinfos << "ShellExecute success with " << retval << llendl; |