diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llwindow/llwindowsdl.cpp | 288 |
1 files changed, 173 insertions, 115 deletions
diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp index c375e32..f7b4071 100644 --- a/linden/indra/llwindow/llwindowsdl.cpp +++ b/linden/indra/llwindow/llwindowsdl.cpp | |||
@@ -1,6 +1,6 @@ | |||
1 | /** | 1 | /** |
2 | * @file llwindowsdl.cpp | 2 | * @file llwindowsdl.cpp |
3 | * @brief Platform-dependent implementation of llwindow | 3 | * @brief SDL implementation of LLWindow class |
4 | * | 4 | * |
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | 5 | * Copyright (c) 2001-2007, Linden Research, Inc. |
6 | * | 6 | * |
@@ -55,12 +55,6 @@ | |||
55 | 55 | ||
56 | extern BOOL gDebugWindowProc; | 56 | extern BOOL gDebugWindowProc; |
57 | 57 | ||
58 | // culled from winuser.h | ||
59 | //const S32 WHEEL_DELTA = 120; /* Value for rolling one detent */ | ||
60 | // On the Mac, the scroll wheel reports a delta of 1 for each detent. | ||
61 | // There's also acceleration for faster scrolling, based on a slider in the system preferences. | ||
62 | const S32 WHEEL_DELTA = 1; /* Value for rolling one detent */ | ||
63 | const S32 BITS_PER_PIXEL = 32; | ||
64 | const S32 MAX_NUM_RESOLUTIONS = 32; | 58 | const S32 MAX_NUM_RESOLUTIONS = 32; |
65 | 59 | ||
66 | // | 60 | // |
@@ -74,37 +68,11 @@ const S32 MAX_NUM_RESOLUTIONS = 32; | |||
74 | // TOFU HACK -- (*exactly* the same hack as LLWindowMacOSX for a similar | 68 | // TOFU HACK -- (*exactly* the same hack as LLWindowMacOSX for a similar |
75 | // set of reasons): Stash a pointer to the LLWindowSDL object here and | 69 | // set of reasons): Stash a pointer to the LLWindowSDL object here and |
76 | // maintain in the constructor and destructor. This assumes that there will | 70 | // maintain in the constructor and destructor. This assumes that there will |
77 | // be only one object of this class at any time. Hopefully this is true. | 71 | // be only one object of this class at any time. Currently this is true. |
78 | static LLWindowSDL *gWindowImplementation = NULL; | 72 | static LLWindowSDL *gWindowImplementation = NULL; |
79 | 73 | ||
80 | static BOOL was_fullscreen = FALSE; | 74 | static BOOL was_fullscreen = FALSE; |
81 | 75 | ||
82 | // Cross-platform bits: | ||
83 | |||
84 | void show_window_creation_error(const char* title) | ||
85 | { | ||
86 | llwarns << title << llendl; | ||
87 | shell_open( "help/window_creation_error.html"); | ||
88 | /* | ||
89 | OSMessageBox( | ||
90 | "Second Life is unable to run because it can't set up your display.\n" | ||
91 | "We need to be able to make a 32-bit color window at 1024x768, with\n" | ||
92 | "an 8 bit alpha channel.\n" | ||
93 | "\n" | ||
94 | "First, be sure your monitor is set to True Color (32-bit) in\n" | ||
95 | "Start -> Control Panels -> Display -> Settings.\n" | ||
96 | "\n" | ||
97 | "Otherwise, this may be due to video card driver issues.\n" | ||
98 | "Please make sure you have the latest video card drivers installed.\n" | ||
99 | "ATI drivers are available at http://www.ati.com/\n" | ||
100 | "nVidia drivers are available at http://www.nvidia.com/\n" | ||
101 | "\n" | ||
102 | "If you continue to receive this message, contact customer service.", | ||
103 | title, | ||
104 | OSMB_OK); | ||
105 | */ | ||
106 | } | ||
107 | |||
108 | 76 | ||
109 | void maybe_lock_display(void) | 77 | void maybe_lock_display(void) |
110 | { | 78 | { |
@@ -275,7 +243,7 @@ LLWindowSDL::LLWindowSDL(char *title, S32 x, S32 y, S32 width, | |||
275 | #endif // LL_GTK | 243 | #endif // LL_GTK |
276 | 244 | ||
277 | // Get the original aspect ratio of the main device. | 245 | // Get the original aspect ratio of the main device. |
278 | mOriginalAspectRatio = 1024.0 / 768.0; // !!! FIXME //(double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay); | 246 | mOriginalAspectRatio = 1024.0 / 768.0; // !!! *FIX: ? //(double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay); |
279 | 247 | ||
280 | if (!title) | 248 | if (!title) |
281 | title = "SDL Window"; // *FIX: (???) | 249 | title = "SDL Window"; // *FIX: (???) |
@@ -325,6 +293,105 @@ static SDL_Surface *Load_BMP_Resource(const char *basename) | |||
325 | return SDL_LoadBMP(path_buffer); | 293 | return SDL_LoadBMP(path_buffer); |
326 | } | 294 | } |
327 | 295 | ||
296 | #if LL_X11 | ||
297 | // This is an XFree86/XOrg-specific hack for detecting the amount of Video RAM | ||
298 | // on this machine. It works by searching /var/log/var/log/Xorg.?.log or | ||
299 | // /var/log/XFree86.?.log for a ': VideoRAM: (%d+) kB' regex, where '?' is | ||
300 | // the X11 display number derived from $DISPLAY | ||
301 | static int x11_detect_VRAM_kb_fp(FILE *fp) | ||
302 | { | ||
303 | const int line_buf_size = 1000; | ||
304 | char line_buf[line_buf_size]; | ||
305 | while (fgets(line_buf, line_buf_size, fp)) | ||
306 | { | ||
307 | //lldebugs << "XLOG: " << line_buf << llendl; | ||
308 | |||
309 | // Why the ad-hoc parser instead of using a regex? Our | ||
310 | // favourite regex implementation - libboost_regex - is | ||
311 | // quite a heavy and troublesome dependency for the client, so | ||
312 | // it seems a shame to introduce it for such a simple task. | ||
313 | const char part1_template[] = ": VideoRAM: "; | ||
314 | const char part2_template[] = " kB"; | ||
315 | char *part1 = strstr(line_buf, part1_template); | ||
316 | if (part1) // found start of matching line | ||
317 | { | ||
318 | part1 = &part1[strlen(part1_template)]; // -> after | ||
319 | char *part2 = strstr(part1, part2_template); | ||
320 | if (part2) // found end of matching line | ||
321 | { | ||
322 | // now everything between part1 and part2 is | ||
323 | // supposed to be numeric, describing the | ||
324 | // number of kB of Video RAM supported | ||
325 | int rtn = 0; | ||
326 | for (; part1 < part2; ++part1) | ||
327 | { | ||
328 | //lldebugs << "kB" << *part1 << llendl; | ||
329 | if (*part1 < '0' || *part1 > '9') | ||
330 | { | ||
331 | // unexpected char, abort parse | ||
332 | rtn = 0; | ||
333 | break; | ||
334 | } | ||
335 | rtn *= 10; | ||
336 | rtn += (*part1) - '0'; | ||
337 | } | ||
338 | if (rtn > 0) | ||
339 | { | ||
340 | // got the kB number. return it now. | ||
341 | return rtn; | ||
342 | } | ||
343 | } | ||
344 | } | ||
345 | } | ||
346 | return 0; // 'could not detect' | ||
347 | } | ||
348 | static int x11_detect_VRAM_kb() | ||
349 | { | ||
350 | std::string x_log_location("/var/log/"); | ||
351 | std::string fname; | ||
352 | int rtn = 0; // 'could not detect' | ||
353 | int display_num = 0; | ||
354 | FILE *fp; | ||
355 | char *display_env = getenv("DISPLAY"); // e.g. :0 or :0.0 or :1.0 etc | ||
356 | // parse DISPLAY number so we can go grab the right log file | ||
357 | if (display_env[0] == ':' && | ||
358 | display_env[1] >= '0' && display_env[1] <= '9') | ||
359 | { | ||
360 | display_num = display_env[1] - '0'; | ||
361 | } | ||
362 | |||
363 | // *TODO: we could be smarter and see which of Xorg/XFree86 has the | ||
364 | // freshest time-stamp. | ||
365 | |||
366 | // Try XOrg log first | ||
367 | fname = x_log_location; | ||
368 | fname += "Xorg."; | ||
369 | fname += ('0' + display_num); | ||
370 | fname += ".log"; | ||
371 | fp = fopen(fname.c_str(), "r"); | ||
372 | if (fp) | ||
373 | { | ||
374 | rtn = x11_detect_VRAM_kb_fp(fp); | ||
375 | fclose(fp); | ||
376 | } | ||
377 | // Try old XFree86 log otherwise | ||
378 | if (rtn == 0) | ||
379 | { | ||
380 | fname = x_log_location; | ||
381 | fname += "XFree86."; | ||
382 | fname += ('0' + display_num); | ||
383 | fname += ".log"; | ||
384 | fp = fopen(fname.c_str(), "r"); | ||
385 | if (fp) | ||
386 | { | ||
387 | rtn = x11_detect_VRAM_kb_fp(fp); | ||
388 | fclose(fp); | ||
389 | } | ||
390 | } | ||
391 | return rtn; | ||
392 | } | ||
393 | #endif // LL_X11 | ||
394 | |||
328 | BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync) | 395 | BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync) |
329 | { | 396 | { |
330 | //bool glneedsinit = false; | 397 | //bool glneedsinit = false; |
@@ -511,67 +578,40 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B | |||
511 | { | 578 | { |
512 | llinfos << "createContext: SKIPPING - !fullscreen, but +mWindow " << width << "x" << height << "x" << bits << llendl; | 579 | llinfos << "createContext: SKIPPING - !fullscreen, but +mWindow " << width << "x" << height << "x" << bits << llendl; |
513 | } | 580 | } |
514 | 581 | ||
515 | /*if (!load_all_glsyms(gllibname)) | 582 | // Detect video memory size. |
516 | { | 583 | # if LL_X11 |
517 | SDL_QuitSubSystem(SDL_INIT_VIDEO); | 584 | gGLManager.mVRAM = x11_detect_VRAM_kb() / 1024; |
518 | return FALSE; | ||
519 | }*/ | ||
520 | |||
521 | gGLManager.mVRAM = videoInfo->video_mem / 1024; | ||
522 | if (gGLManager.mVRAM != 0) | 585 | if (gGLManager.mVRAM != 0) |
523 | { | 586 | { |
524 | llinfos << "Detected " << gGLManager.mVRAM << "MB VRAM." << llendl; | 587 | llinfos << "X11 log-parser detected " << gGLManager.mVRAM << "MB VRAM." << llendl; |
525 | } | 588 | } else |
526 | // If VRAM is not detected, that is handled later | 589 | # endif // LL_X11 |
527 | 590 | { | |
528 | #if 0 // *FIX: all video cards suck under Linux. :) | 591 | // fallback to letting SDL detect VRAM. |
529 | // Since we just created the context, it needs to be set up. | 592 | // note: I've not seen SDL's detection ever actually find |
530 | glNeedsInit = TRUE; | 593 | // VRAM != 0, but if SDL *does* detect it then that's a bonus. |
531 | if(glNeedsInit) | 594 | gGLManager.mVRAM = videoInfo->video_mem / 1024; |
532 | { | 595 | if (gGLManager.mVRAM != 0) |
533 | // Check for some explicitly unsupported cards. | ||
534 | const char* RENDERER = (const char*) glGetString(GL_RENDERER); | ||
535 | |||
536 | const char* CARD_LIST[] = | ||
537 | { "RAGE 128", | ||
538 | "RIVA TNT2", | ||
539 | "Intel 810", | ||
540 | "3Dfx/Voodoo3", | ||
541 | "Radeon 7000", | ||
542 | "Radeon 7200", | ||
543 | "Radeon 7500", | ||
544 | "Radeon DDR", | ||
545 | "Radeon VE", | ||
546 | "GDI Generic" }; | ||
547 | const S32 CARD_COUNT = sizeof(CARD_LIST)/sizeof(char*); | ||
548 | |||
549 | // Future candidates: | ||
550 | // ProSavage/Twister | ||
551 | // SuperSavage | ||
552 | |||
553 | S32 i; | ||
554 | for (i = 0; i < CARD_COUNT; i++) | ||
555 | { | 596 | { |
556 | if (check_for_card(RENDERER, CARD_LIST[i])) | 597 | llinfos << "SDL detected " << gGLManager.mVRAM << "MB VRAM." << llendl; |
557 | { | ||
558 | close(); | ||
559 | shell_open( "help/unsupported_card.html" ); | ||
560 | return FALSE; | ||
561 | } | ||
562 | } | 598 | } |
563 | } | 599 | } |
564 | #endif | 600 | // If VRAM is not detected, that is handled later |
565 | 601 | ||
566 | GLint depthBits, stencilBits, redBits, greenBits, blueBits, alphaBits; | 602 | // *TODO: Now would be an appropriate time to check for some |
603 | // explicitly unsupported cards. | ||
604 | //const char* RENDERER = (const char*) glGetString(GL_RENDERER); | ||
567 | 605 | ||
568 | glGetIntegerv(GL_RED_BITS, &redBits); | 606 | GLint depthBits, stencilBits, redBits, greenBits, blueBits, alphaBits; |
569 | glGetIntegerv(GL_GREEN_BITS, &greenBits); | ||
570 | glGetIntegerv(GL_BLUE_BITS, &blueBits); | ||
571 | glGetIntegerv(GL_ALPHA_BITS, &alphaBits); | ||
572 | glGetIntegerv(GL_DEPTH_BITS, &depthBits); | ||
573 | glGetIntegerv(GL_STENCIL_BITS, &stencilBits); | ||
574 | 607 | ||
608 | glGetIntegerv(GL_RED_BITS, &redBits); | ||
609 | glGetIntegerv(GL_GREEN_BITS, &greenBits); | ||
610 | glGetIntegerv(GL_BLUE_BITS, &blueBits); | ||
611 | glGetIntegerv(GL_ALPHA_BITS, &alphaBits); | ||
612 | glGetIntegerv(GL_DEPTH_BITS, &depthBits); | ||
613 | glGetIntegerv(GL_STENCIL_BITS, &stencilBits); | ||
614 | |||
575 | llinfos << "GL buffer:" << llendl | 615 | llinfos << "GL buffer:" << llendl |
576 | llinfos << " Red Bits " << S32(redBits) << llendl | 616 | llinfos << " Red Bits " << S32(redBits) << llendl |
577 | llinfos << " Green Bits " << S32(greenBits) << llendl | 617 | llinfos << " Green Bits " << S32(greenBits) << llendl |
@@ -1022,7 +1062,9 @@ void LLWindowSDL::beforeDialog() | |||
1022 | { | 1062 | { |
1023 | // Everything that we/SDL asked for should happen before we | 1063 | // Everything that we/SDL asked for should happen before we |
1024 | // potentially hand control over to GTK. | 1064 | // potentially hand control over to GTK. |
1065 | maybe_lock_display(); | ||
1025 | XSync(mSDL_Display, False); | 1066 | XSync(mSDL_Display, False); |
1067 | maybe_unlock_display(); | ||
1026 | } | 1068 | } |
1027 | #endif // LL_X11 | 1069 | #endif // LL_X11 |
1028 | 1070 | ||
@@ -1066,6 +1108,7 @@ void LLWindowSDL::x11_set_urgent(BOOL urgent) | |||
1066 | 1108 | ||
1067 | llinfos << "X11 hint for urgency, " << urgent << llendl; | 1109 | llinfos << "X11 hint for urgency, " << urgent << llendl; |
1068 | 1110 | ||
1111 | maybe_lock_display(); | ||
1069 | wm_hints = XGetWMHints(mSDL_Display, mSDL_XWindowID); | 1112 | wm_hints = XGetWMHints(mSDL_Display, mSDL_XWindowID); |
1070 | if (!wm_hints) | 1113 | if (!wm_hints) |
1071 | wm_hints = XAllocWMHints(); | 1114 | wm_hints = XAllocWMHints(); |
@@ -1078,6 +1121,7 @@ void LLWindowSDL::x11_set_urgent(BOOL urgent) | |||
1078 | XSetWMHints(mSDL_Display, mSDL_XWindowID, wm_hints); | 1121 | XSetWMHints(mSDL_Display, mSDL_XWindowID, wm_hints); |
1079 | XFree(wm_hints); | 1122 | XFree(wm_hints); |
1080 | XSync(mSDL_Display, False); | 1123 | XSync(mSDL_Display, False); |
1124 | maybe_unlock_display(); | ||
1081 | } | 1125 | } |
1082 | } | 1126 | } |
1083 | #endif // LL_X11 | 1127 | #endif // LL_X11 |
@@ -1782,10 +1826,12 @@ BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) | |||
1782 | { | 1826 | { |
1783 | //llinfos << "X11 POINTER GRABBY" << llendl; | 1827 | //llinfos << "X11 POINTER GRABBY" << llendl; |
1784 | //newmode = SDL_WM_GrabInput(wantmode); | 1828 | //newmode = SDL_WM_GrabInput(wantmode); |
1829 | maybe_lock_display(); | ||
1785 | result = XGrabPointer(mSDL_Display, mSDL_XWindowID, | 1830 | result = XGrabPointer(mSDL_Display, mSDL_XWindowID, |
1786 | True, 0, GrabModeAsync, | 1831 | True, 0, GrabModeAsync, |
1787 | GrabModeAsync, | 1832 | GrabModeAsync, |
1788 | None, None, CurrentTime); | 1833 | None, None, CurrentTime); |
1834 | maybe_unlock_display(); | ||
1789 | if (GrabSuccess == result) | 1835 | if (GrabSuccess == result) |
1790 | newmode = SDL_GRAB_ON; | 1836 | newmode = SDL_GRAB_ON; |
1791 | else | 1837 | else |
@@ -1795,10 +1841,12 @@ BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) | |||
1795 | //llinfos << "X11 POINTER UNGRABBY" << llendl; | 1841 | //llinfos << "X11 POINTER UNGRABBY" << llendl; |
1796 | newmode = SDL_GRAB_OFF; | 1842 | newmode = SDL_GRAB_OFF; |
1797 | //newmode = SDL_WM_GrabInput(SDL_GRAB_OFF); | 1843 | //newmode = SDL_WM_GrabInput(SDL_GRAB_OFF); |
1798 | 1844 | ||
1845 | maybe_lock_display(); | ||
1799 | XUngrabPointer(mSDL_Display, CurrentTime); | 1846 | XUngrabPointer(mSDL_Display, CurrentTime); |
1800 | // Make sure the ungrab happens RIGHT NOW. | 1847 | // Make sure the ungrab happens RIGHT NOW. |
1801 | XSync(mSDL_Display, False); | 1848 | XSync(mSDL_Display, False); |
1849 | maybe_unlock_display(); | ||
1802 | } else | 1850 | } else |
1803 | { | 1851 | { |
1804 | newmode = SDL_GRAB_QUERY; // neutral | 1852 | newmode = SDL_GRAB_QUERY; // neutral |
@@ -1875,7 +1923,7 @@ void LLWindowSDL::gatherInput() | |||
1875 | std::string saved_locale = setlocale(LC_ALL, NULL); | 1923 | std::string saved_locale = setlocale(LC_ALL, NULL); |
1876 | 1924 | ||
1877 | // Do a limited number of pumps so SL doesn't starve! | 1925 | // Do a limited number of pumps so SL doesn't starve! |
1878 | // FIXME - this should ideally be time-limited, not count-limited. | 1926 | // *TODO: this should ideally be time-limited, not count-limited. |
1879 | gtk_main_iteration_do(0); // Always do one non-blocking pump | 1927 | gtk_main_iteration_do(0); // Always do one non-blocking pump |
1880 | for (int iter=0; iter<10; ++iter) | 1928 | for (int iter=0; iter<10; ++iter) |
1881 | if (gtk_events_pending()) | 1929 | if (gtk_events_pending()) |
@@ -2101,8 +2149,8 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty | |||
2101 | if (bmpsurface && bmpsurface->w%8==0) | 2149 | if (bmpsurface && bmpsurface->w%8==0) |
2102 | { | 2150 | { |
2103 | SDL_Surface *cursurface; | 2151 | SDL_Surface *cursurface; |
2104 | llinfos << "Loaded cursor file " << filename << " " | 2152 | lldebugs << "Loaded cursor file " << filename << " " |
2105 | << bmpsurface->w << "x" << bmpsurface->h << llendl; | 2153 | << bmpsurface->w << "x" << bmpsurface->h << llendl; |
2106 | cursurface = SDL_CreateRGBSurface (SDL_SWSURFACE, | 2154 | cursurface = SDL_CreateRGBSurface (SDL_SWSURFACE, |
2107 | bmpsurface->w, | 2155 | bmpsurface->w, |
2108 | bmpsurface->h, | 2156 | bmpsurface->h, |
@@ -2282,14 +2330,14 @@ void LLWindowSDL::hideCursor() | |||
2282 | { | 2330 | { |
2283 | if(!mCursorHidden) | 2331 | if(!mCursorHidden) |
2284 | { | 2332 | { |
2285 | // llinfos << "hideCursor: hiding" << llendl; | 2333 | // llinfos << "hideCursor: hiding" << llendl; |
2286 | mCursorHidden = TRUE; | 2334 | mCursorHidden = TRUE; |
2287 | mHideCursorPermanent = TRUE; | 2335 | mHideCursorPermanent = TRUE; |
2288 | SDL_ShowCursor(0); | 2336 | SDL_ShowCursor(0); |
2289 | } | 2337 | } |
2290 | else | 2338 | else |
2291 | { | 2339 | { |
2292 | // llinfos << "hideCursor: already hidden" << llendl; | 2340 | // llinfos << "hideCursor: already hidden" << llendl; |
2293 | } | 2341 | } |
2294 | 2342 | ||
2295 | adjustCursorDecouple(); | 2343 | adjustCursorDecouple(); |
@@ -2299,14 +2347,14 @@ void LLWindowSDL::showCursor() | |||
2299 | { | 2347 | { |
2300 | if(mCursorHidden) | 2348 | if(mCursorHidden) |
2301 | { | 2349 | { |
2302 | // llinfos << "showCursor: showing" << llendl; | 2350 | // llinfos << "showCursor: showing" << llendl; |
2303 | mCursorHidden = FALSE; | 2351 | mCursorHidden = FALSE; |
2304 | mHideCursorPermanent = FALSE; | 2352 | mHideCursorPermanent = FALSE; |
2305 | SDL_ShowCursor(1); | 2353 | SDL_ShowCursor(1); |
2306 | } | 2354 | } |
2307 | else | 2355 | else |
2308 | { | 2356 | { |
2309 | // llinfos << "showCursor: already visible" << llendl; | 2357 | // llinfos << "showCursor: already visible" << llendl; |
2310 | } | 2358 | } |
2311 | 2359 | ||
2312 | adjustCursorDecouple(); | 2360 | adjustCursorDecouple(); |
@@ -2332,7 +2380,8 @@ void LLWindowSDL::hideCursorUntilMouseMove() | |||
2332 | 2380 | ||
2333 | 2381 | ||
2334 | // | 2382 | // |
2335 | // LLSplashScreenSDL | 2383 | // LLSplashScreenSDL - I don't think we'll bother to implement this; it's |
2384 | // fairly obsolete at this point. | ||
2336 | // | 2385 | // |
2337 | LLSplashScreenSDL::LLSplashScreenSDL() | 2386 | LLSplashScreenSDL::LLSplashScreenSDL() |
2338 | { | 2387 | { |
@@ -2350,7 +2399,6 @@ void LLSplashScreenSDL::updateImpl(const char* mesg) | |||
2350 | { | 2399 | { |
2351 | } | 2400 | } |
2352 | 2401 | ||
2353 | |||
2354 | void LLSplashScreenSDL::hideImpl() | 2402 | void LLSplashScreenSDL::hideImpl() |
2355 | { | 2403 | { |
2356 | } | 2404 | } |
@@ -2438,7 +2486,7 @@ S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type) | |||
2438 | G_CALLBACK (response_callback), | 2486 | G_CALLBACK (response_callback), |
2439 | &response); | 2487 | &response); |
2440 | 2488 | ||
2441 | // we should be able to us a gtk_dialog_run(), but it's | 2489 | // we should be able to use a gtk_dialog_run(), but it's |
2442 | // apparently not written to exist in a world without a higher | 2490 | // apparently not written to exist in a world without a higher |
2443 | // gtk_main(), so we manage its signal/destruction outselves. | 2491 | // gtk_main(), so we manage its signal/destruction outselves. |
2444 | gtk_widget_show_all (win); | 2492 | gtk_widget_show_all (win); |
@@ -2460,7 +2508,7 @@ S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type) | |||
2460 | } | 2508 | } |
2461 | else | 2509 | else |
2462 | { | 2510 | { |
2463 | fprintf(stderr, "MSGBOX: %s: %s\n", caption, text); | 2511 | llinfos << "MSGBOX: " << caption << ": " << text << llendl; |
2464 | llinfos << "Skipping dialog because we're in fullscreen mode or GTK is not happy." << llendl; | 2512 | llinfos << "Skipping dialog because we're in fullscreen mode or GTK is not happy." << llendl; |
2465 | rtn = OSBTN_OK; | 2513 | rtn = OSBTN_OK; |
2466 | } | 2514 | } |
@@ -2556,7 +2604,7 @@ BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b) | |||
2556 | #else | 2604 | #else |
2557 | S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type) | 2605 | S32 OSMessageBoxSDL(const char* text, const char* caption, U32 type) |
2558 | { | 2606 | { |
2559 | fprintf(stderr, "MSGBOX: %s: %s\n", caption, text); | 2607 | llinfos << "MSGBOX: " << caption << ": " << text << llendl; |
2560 | return 0; | 2608 | return 0; |
2561 | } | 2609 | } |
2562 | 2610 | ||
@@ -2573,11 +2621,15 @@ void spawn_web_browser(const char* escaped_url) | |||
2573 | llinfos << "spawn_web_browser: " << escaped_url << llendl; | 2621 | llinfos << "spawn_web_browser: " << escaped_url << llendl; |
2574 | 2622 | ||
2575 | #if LL_LINUX | 2623 | #if LL_LINUX |
2576 | # if LL_X11 | 2624 | # if LL_X11 |
2577 | if (gWindowImplementation && | 2625 | if (gWindowImplementation && gWindowImplementation->mSDL_Display) |
2578 | gWindowImplementation->mSDL_Display) // Just in case - before forking. | 2626 | { |
2627 | maybe_lock_display(); | ||
2628 | // Just in case - before forking. | ||
2579 | XSync(gWindowImplementation->mSDL_Display, False); | 2629 | XSync(gWindowImplementation->mSDL_Display, False); |
2580 | # endif // LL_X11 | 2630 | maybe_unlock_display(); |
2631 | } | ||
2632 | # endif // LL_X11 | ||
2581 | 2633 | ||
2582 | std::string cmd; | 2634 | std::string cmd; |
2583 | cmd = gDirUtilp->getAppRODataDir().c_str(); | 2635 | cmd = gDirUtilp->getAppRODataDir().c_str(); |
@@ -2615,8 +2667,8 @@ void spawn_web_browser(const char* escaped_url) | |||
2615 | 2667 | ||
2616 | void shell_open( const char* file_path ) | 2668 | void shell_open( const char* file_path ) |
2617 | { | 2669 | { |
2618 | // *FIX: (???) | 2670 | // *TODO: This function is deprecated and should probably go away. |
2619 | fprintf(stderr, "shell_open: %s\n", file_path); | 2671 | llwarns << "Deprecated shell_open(): " << file_path << llendl; |
2620 | } | 2672 | } |
2621 | 2673 | ||
2622 | void *LLWindowSDL::getPlatformWindow() | 2674 | void *LLWindowSDL::getPlatformWindow() |
@@ -2624,18 +2676,14 @@ void *LLWindowSDL::getPlatformWindow() | |||
2624 | #if LL_GTK && LL_LIBXUL_ENABLED | 2676 | #if LL_GTK && LL_LIBXUL_ENABLED |
2625 | if (ll_try_gtk_init()) | 2677 | if (ll_try_gtk_init()) |
2626 | { | 2678 | { |
2679 | maybe_lock_display(); | ||
2627 | GtkWidget *win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 2680 | GtkWidget *win = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
2628 | 2681 | ||
2629 | // These hacks were attempts to get Gecko to see the keyboard, | ||
2630 | // but I think they're doomed to fail. | ||
2631 | //GdkWindow *gdkwin = gdk_window_foreign_new(SDL_XWindowID); | ||
2632 | //GTK_WIDGET(win)->window = gdkwin; | ||
2633 | //gtk_widget_set_parent_window(win, gdkwin); | ||
2634 | |||
2635 | // show the hidden-widget while debugging (needs mozlib change) | 2682 | // show the hidden-widget while debugging (needs mozlib change) |
2636 | //gtk_widget_show_all(GTK_WIDGET(win)); | 2683 | //gtk_widget_show_all(GTK_WIDGET(win)); |
2637 | 2684 | ||
2638 | gtk_widget_realize(GTK_WIDGET(win)); | 2685 | gtk_widget_realize(GTK_WIDGET(win)); |
2686 | maybe_unlock_display(); | ||
2639 | return win; | 2687 | return win; |
2640 | } | 2688 | } |
2641 | #endif // LL_GTK && LL_LIBXUL_ENABLED | 2689 | #endif // LL_GTK && LL_LIBXUL_ENABLED |
@@ -2645,8 +2693,18 @@ void *LLWindowSDL::getPlatformWindow() | |||
2645 | 2693 | ||
2646 | void LLWindowSDL::bringToFront() | 2694 | void LLWindowSDL::bringToFront() |
2647 | { | 2695 | { |
2648 | // *FIX: (???) | 2696 | // This is currently used when we are 'launched' to a specific |
2649 | fprintf(stderr, "bringToFront\n"); | 2697 | // map position externally. |
2698 | llinfos << "bringToFront" << llendl; | ||
2699 | #if LL_X11 | ||
2700 | if (mSDL_Display && !mFullscreen) | ||
2701 | { | ||
2702 | maybe_lock_display(); | ||
2703 | XRaiseWindow(mSDL_Display, mSDL_XWindowID); | ||
2704 | XSync(mSDL_Display, False); | ||
2705 | maybe_unlock_display(); | ||
2706 | } | ||
2707 | #endif // LL_X11 | ||
2650 | } | 2708 | } |
2651 | 2709 | ||
2652 | #endif // LL_SDL | 2710 | #endif // LL_SDL |