aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llwindow
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llwindow/llwindow.cpp10
-rw-r--r--linden/indra/llwindow/llwindow.h2
-rw-r--r--linden/indra/llwindow/llwindowmacosx.cpp16
-rw-r--r--linden/indra/llwindow/llwindowmesaheadless.h1
-rw-r--r--linden/indra/llwindow/llwindowsdl.cpp58
-rw-r--r--linden/indra/llwindow/llwindowwin32.cpp49
6 files changed, 121 insertions, 15 deletions
diff --git a/linden/indra/llwindow/llwindow.cpp b/linden/indra/llwindow/llwindow.cpp
index 134e606..cad1dc4 100644
--- a/linden/indra/llwindow/llwindow.cpp
+++ b/linden/indra/llwindow/llwindow.cpp
@@ -125,6 +125,16 @@ BOOL LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos
125 return FALSE; 125 return FALSE;
126} 126}
127 127
128BOOL LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
129{
130 return FALSE;
131}
132
133BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
134{
135 return FALSE;
136}
137
128BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated) 138BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated)
129{ 139{
130 return FALSE; 140 return FALSE;
diff --git a/linden/indra/llwindow/llwindow.h b/linden/indra/llwindow/llwindow.h
index a52aff6..2bb49e9 100644
--- a/linden/indra/llwindow/llwindow.h
+++ b/linden/indra/llwindow/llwindow.h
@@ -96,6 +96,8 @@ public:
96 virtual void handleQuit(LLWindow *window); 96 virtual void handleQuit(LLWindow *window);
97 virtual BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); 97 virtual BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
98 virtual BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); 98 virtual BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
99 virtual BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
100 virtual BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
99 virtual BOOL handleActivate(LLWindow *window, BOOL activated); 101 virtual BOOL handleActivate(LLWindow *window, BOOL activated);
100 virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask); 102 virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
101 virtual void handleScrollWheel(LLWindow *window, S32 clicks); 103 virtual void handleScrollWheel(LLWindow *window, S32 clicks);
diff --git a/linden/indra/llwindow/llwindowmacosx.cpp b/linden/indra/llwindow/llwindowmacosx.cpp
index b2a1ccf..0c5d6ed 100644
--- a/linden/indra/llwindow/llwindowmacosx.cpp
+++ b/linden/indra/llwindow/llwindowmacosx.cpp
@@ -2177,6 +2177,10 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
2177 case kEventMouseButtonSecondary: 2177 case kEventMouseButtonSecondary:
2178 mCallbacks->handleRightMouseDown(this, outCoords, mask); 2178 mCallbacks->handleRightMouseDown(this, outCoords, mask);
2179 break; 2179 break;
2180
2181 case kEventMouseButtonTertiary:
2182 mCallbacks->handleMiddleMouseDown(this, outCoords, mask);
2183 break;
2180 } 2184 }
2181 result = noErr; 2185 result = noErr;
2182 break; 2186 break;
@@ -2199,6 +2203,10 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
2199 case kEventMouseButtonSecondary: 2203 case kEventMouseButtonSecondary:
2200 mCallbacks->handleRightMouseUp(this, outCoords, mask); 2204 mCallbacks->handleRightMouseUp(this, outCoords, mask);
2201 break; 2205 break;
2206
2207 case kEventMouseButtonTertiary:
2208 mCallbacks->handleMiddleMouseUp(this, outCoords, mask);
2209 break;
2202 } 2210 }
2203 result = noErr; 2211 result = noErr;
2204 break; 2212 break;
@@ -2231,7 +2239,13 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
2231 2239
2232 case kEventClassWindow: 2240 case kEventClassWindow:
2233 switch(evtKind) 2241 switch(evtKind)
2234 { 2242 {
2243 case kEventWindowActivated:
2244 mCallbacks->handleFocus(this);
2245 break;
2246 case kEventWindowDeactivated:
2247 mCallbacks->handleFocusLost(this);
2248 break;
2235 case kEventWindowBoundsChanging: 2249 case kEventWindowBoundsChanging:
2236 { 2250 {
2237 Rect currentBounds; 2251 Rect currentBounds;
diff --git a/linden/indra/llwindow/llwindowmesaheadless.h b/linden/indra/llwindow/llwindowmesaheadless.h
index 599db72..f0ad50e 100644
--- a/linden/indra/llwindow/llwindowmesaheadless.h
+++ b/linden/indra/llwindow/llwindowmesaheadless.h
@@ -32,6 +32,7 @@
32#if LL_MESA_HEADLESS 32#if LL_MESA_HEADLESS
33 33
34#include "llwindow.h" 34#include "llwindow.h"
35#include "GL/glu.h"
35#include "GL/osmesa.h" 36#include "GL/osmesa.h"
36 37
37class LLWindowMesaHeadless : public LLWindow 38class LLWindowMesaHeadless : public LLWindow
diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp
index f7b4071..a1cdeb3 100644
--- a/linden/indra/llwindow/llwindowsdl.cpp
+++ b/linden/indra/llwindow/llwindowsdl.cpp
@@ -296,9 +296,9 @@ static SDL_Surface *Load_BMP_Resource(const char *basename)
296#if LL_X11 296#if LL_X11
297// This is an XFree86/XOrg-specific hack for detecting the amount of Video RAM 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 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 299// /var/log/XFree86.?.log for a ': (VideoRAM|Memory): (%d+) kB' regex, where
300// the X11 display number derived from $DISPLAY 300// '?' is the X11 display number derived from $DISPLAY
301static int x11_detect_VRAM_kb_fp(FILE *fp) 301static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str)
302{ 302{
303 const int line_buf_size = 1000; 303 const int line_buf_size = 1000;
304 char line_buf[line_buf_size]; 304 char line_buf[line_buf_size];
@@ -310,7 +310,7 @@ static int x11_detect_VRAM_kb_fp(FILE *fp)
310 // favourite regex implementation - libboost_regex - is 310 // favourite regex implementation - libboost_regex - is
311 // quite a heavy and troublesome dependency for the client, so 311 // quite a heavy and troublesome dependency for the client, so
312 // it seems a shame to introduce it for such a simple task. 312 // it seems a shame to introduce it for such a simple task.
313 const char part1_template[] = ": VideoRAM: "; 313 const char *part1_template = prefix_str;
314 const char part2_template[] = " kB"; 314 const char part2_template[] = " kB";
315 char *part1 = strstr(line_buf, part1_template); 315 char *part1 = strstr(line_buf, part1_template);
316 if (part1) // found start of matching line 316 if (part1) // found start of matching line
@@ -325,7 +325,6 @@ static int x11_detect_VRAM_kb_fp(FILE *fp)
325 int rtn = 0; 325 int rtn = 0;
326 for (; part1 < part2; ++part1) 326 for (; part1 < part2; ++part1)
327 { 327 {
328 //lldebugs << "kB" << *part1 << llendl;
329 if (*part1 < '0' || *part1 > '9') 328 if (*part1 < '0' || *part1 > '9')
330 { 329 {
331 // unexpected char, abort parse 330 // unexpected char, abort parse
@@ -345,6 +344,7 @@ static int x11_detect_VRAM_kb_fp(FILE *fp)
345 } 344 }
346 return 0; // 'could not detect' 345 return 0; // 'could not detect'
347} 346}
347
348static int x11_detect_VRAM_kb() 348static int x11_detect_VRAM_kb()
349{ 349{
350 std::string x_log_location("/var/log/"); 350 std::string x_log_location("/var/log/");
@@ -363,7 +363,7 @@ static int x11_detect_VRAM_kb()
363 // *TODO: we could be smarter and see which of Xorg/XFree86 has the 363 // *TODO: we could be smarter and see which of Xorg/XFree86 has the
364 // freshest time-stamp. 364 // freshest time-stamp.
365 365
366 // Try XOrg log first 366 // Try Xorg log first
367 fname = x_log_location; 367 fname = x_log_location;
368 fname += "Xorg."; 368 fname += "Xorg.";
369 fname += ('0' + display_num); 369 fname += ('0' + display_num);
@@ -371,12 +371,25 @@ static int x11_detect_VRAM_kb()
371 fp = fopen(fname.c_str(), "r"); 371 fp = fopen(fname.c_str(), "r");
372 if (fp) 372 if (fp)
373 { 373 {
374 rtn = x11_detect_VRAM_kb_fp(fp); 374 llinfos << "Looking in " << fname
375 << " for VRAM info..." << llendl;
376 rtn = x11_detect_VRAM_kb_fp(fp, ": VideoRAM: ");
375 fclose(fp); 377 fclose(fp);
378 if (0 == rtn)
379 {
380 fp = fopen(fname.c_str(), "r");
381 if (fp)
382 {
383 rtn = x11_detect_VRAM_kb_fp(fp, ": Memory: ");
384 fclose(fp);
385 }
386 }
376 } 387 }
377 // Try old XFree86 log otherwise 388 else
378 if (rtn == 0)
379 { 389 {
390 llinfos << "Could not open " << fname
391 << " - skipped." << llendl;
392 // Try old XFree86 log otherwise
380 fname = x_log_location; 393 fname = x_log_location;
381 fname += "XFree86."; 394 fname += "XFree86.";
382 fname += ('0' + display_num); 395 fname += ('0' + display_num);
@@ -384,8 +397,24 @@ static int x11_detect_VRAM_kb()
384 fp = fopen(fname.c_str(), "r"); 397 fp = fopen(fname.c_str(), "r");
385 if (fp) 398 if (fp)
386 { 399 {
387 rtn = x11_detect_VRAM_kb_fp(fp); 400 llinfos << "Looking in " << fname
401 << " for VRAM info..." << llendl;
402 rtn = x11_detect_VRAM_kb_fp(fp, ": VideoRAM: ");
388 fclose(fp); 403 fclose(fp);
404 if (0 == rtn)
405 {
406 fp = fopen(fname.c_str(), "r");
407 if (fp)
408 {
409 rtn = x11_detect_VRAM_kb_fp(fp, ": Memory: ");
410 fclose(fp);
411 }
412 }
413 }
414 else
415 {
416 llinfos << "Could not open " << fname
417 << " - skipped." << llendl;
389 } 418 }
390 } 419 }
391 return rtn; 420 return rtn;
@@ -2023,7 +2052,9 @@ void LLWindowSDL::gatherInput()
2023 } 2052 }
2024 2053
2025 else if (event.button.button == SDL_BUTTON_MIDDLE) // middle 2054 else if (event.button.button == SDL_BUTTON_MIDDLE) // middle
2026 ; // Middle mouse isn't handled right now in Second Life ... mCallbacks->handleMiddleMouseDown(this, openGlCoord, mask); 2055 {
2056 mCallbacks->handleMiddleMouseDown(this, openGlCoord, mask);
2057 }
2027 else if (event.button.button == 4) // mousewheel up...thanks to X11 for making SDL consider these "buttons". 2058 else if (event.button.button == 4) // mousewheel up...thanks to X11 for making SDL consider these "buttons".
2028 mCallbacks->handleScrollWheel(this, -1); 2059 mCallbacks->handleScrollWheel(this, -1);
2029 else if (event.button.button == 5) // mousewheel down...thanks to X11 for making SDL consider these "buttons". 2060 else if (event.button.button == 5) // mousewheel down...thanks to X11 for making SDL consider these "buttons".
@@ -2044,8 +2075,9 @@ void LLWindowSDL::gatherInput()
2044 else if (event.button.button == SDL_BUTTON_RIGHT) // right ... yes, it's 3, not 2, in SDL... 2075 else if (event.button.button == SDL_BUTTON_RIGHT) // right ... yes, it's 3, not 2, in SDL...
2045 mCallbacks->handleRightMouseUp(this, openGlCoord, mask); 2076 mCallbacks->handleRightMouseUp(this, openGlCoord, mask);
2046 else if (event.button.button == SDL_BUTTON_MIDDLE) // middle 2077 else if (event.button.button == SDL_BUTTON_MIDDLE) // middle
2047 ; // UNUSED IN SECOND LIFE RIGHT NOW mCallbacks->handleMiddleMouseUp(this, openGlCoord, mask); 2078 {
2048 2079 mCallbacks->handleMiddleMouseUp(this, openGlCoord, mask);
2080 }
2049 // don't handle mousewheel here... 2081 // don't handle mousewheel here...
2050 2082
2051 break; 2083 break;
diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp
index 3c2e730..2cd1353 100644
--- a/linden/indra/llwindow/llwindowwin32.cpp
+++ b/linden/indra/llwindow/llwindowwin32.cpp
@@ -2072,7 +2072,54 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
2072 break; 2072 break;
2073 2073
2074 case WM_MBUTTONDOWN: 2074 case WM_MBUTTONDOWN:
2075 // Handle middle button click 2075// case WM_MBUTTONDBLCLK:
2076 {
2077 // Because we move the cursor position in tllviewerhe app, we need to query
2078 // to find out where the cursor at the time the event is handled.
2079 // If we don't do this, many clicks could get buffered up, and if the
2080 // first click changes the cursor position, all subsequent clicks
2081 // will occur at the wrong location. JC
2082 LLCoordWindow cursor_coord_window;
2083 if (window_imp->mMousePositionModified)
2084 {
2085 window_imp->getCursorPosition(&cursor_coord_window);
2086 window_imp->convertCoords(cursor_coord_window, &gl_coord);
2087 }
2088 else
2089 {
2090 window_imp->convertCoords(window_coord, &gl_coord);
2091 }
2092 MASK mask = gKeyboard->currentMask(TRUE);
2093 if (window_imp->mCallbacks->handleMiddleMouseDown(window_imp, gl_coord, mask))
2094 {
2095 return 0;
2096 }
2097 }
2098 break;
2099
2100 case WM_MBUTTONUP:
2101 {
2102 // Because we move the cursor position in tllviewerhe app, we need to query
2103 // to find out where the cursor at the time the event is handled.
2104 // If we don't do this, many clicks could get buffered up, and if the
2105 // first click changes the cursor position, all subsequent clicks
2106 // will occur at the wrong location. JC
2107 LLCoordWindow cursor_coord_window;
2108 if (window_imp->mMousePositionModified)
2109 {
2110 window_imp->getCursorPosition(&cursor_coord_window);
2111 window_imp->convertCoords(cursor_coord_window, &gl_coord);
2112 }
2113 else
2114 {
2115 window_imp->convertCoords(window_coord, &gl_coord);
2116 }
2117 MASK mask = gKeyboard->currentMask(TRUE);
2118 if (window_imp->mCallbacks->handleMiddleMouseUp(window_imp, gl_coord, mask))
2119 {
2120 return 0;
2121 }
2122 }
2076 break; 2123 break;
2077 2124
2078 case WM_MOUSEWHEEL: 2125 case WM_MOUSEWHEEL: