diff options
author | Jacek Antonelli | 2011-05-08 15:13:37 -0500 |
---|---|---|
committer | Jacek Antonelli | 2011-05-08 15:50:49 -0500 |
commit | 7278f0254a3944bd2bcbf1e855fb0d90c3086a27 (patch) | |
tree | 5d7ecb81ebf1a07482f0a7d3d13acd7f18360c0b /linden/indra/llwindow | |
parent | Imprudence 1.3.1 released. (diff) | |
parent | Changed version to Experimental 2011.04.19 (diff) | |
download | meta-impy-7278f0254a3944bd2bcbf1e855fb0d90c3086a27.zip meta-impy-7278f0254a3944bd2bcbf1e855fb0d90c3086a27.tar.gz meta-impy-7278f0254a3944bd2bcbf1e855fb0d90c3086a27.tar.bz2 meta-impy-7278f0254a3944bd2bcbf1e855fb0d90c3086a27.tar.xz |
Merged Experimental branch (exp) back into main line (next).
Git thought many files (almost 100) had merge conflicts. But, after
resolving the conflicts (which were mostly trivial), almost all the
files turned out to be the same as in the exp branch. So, the
conflicts are not listed here. Check the diff between commit 244ffe8
and this commit to see what really changed.
Diffstat (limited to 'linden/indra/llwindow')
-rw-r--r-- | linden/indra/llwindow/CMakeLists.txt | 22 | ||||
-rw-r--r-- | linden/indra/llwindow/GL/glh_extensions.h | 2 | ||||
-rw-r--r-- | linden/indra/llwindow/lldxhardware.cpp | 1 | ||||
-rw-r--r-- | linden/indra/llwindow/llmousehandler.cpp | 6 | ||||
-rw-r--r-- | linden/indra/llwindow/llmousehandler.h | 1 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindow.cpp | 4 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindow.h | 7 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowmacosx-objc.h | 13 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowmacosx-objc.mm | 67 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowmacosx.cpp | 163 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowmacosx.h | 18 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowsdl.cpp | 74 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowsdl.h | 11 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowwin32.cpp | 31 | ||||
-rw-r--r-- | linden/indra/llwindow/llwindowwin32.h | 8 |
15 files changed, 376 insertions, 52 deletions
diff --git a/linden/indra/llwindow/CMakeLists.txt b/linden/indra/llwindow/CMakeLists.txt index afce0c0..98da751 100644 --- a/linden/indra/llwindow/CMakeLists.txt +++ b/linden/indra/llwindow/CMakeLists.txt | |||
@@ -19,7 +19,6 @@ include(LLRender) | |||
19 | include(LLVFS) | 19 | include(LLVFS) |
20 | include(LLWindow) | 20 | include(LLWindow) |
21 | include(LLXML) | 21 | include(LLXML) |
22 | include(Mozlib) | ||
23 | include(UI) | 22 | include(UI) |
24 | 23 | ||
25 | include_directories( | 24 | include_directories( |
@@ -55,6 +54,21 @@ set(viewer_HEADER_FILES | |||
55 | llmousehandler.h | 54 | llmousehandler.h |
56 | ) | 55 | ) |
57 | 56 | ||
57 | # Libraries on which this library depends, needed for Linux builds | ||
58 | # Sort by high-level to low-level | ||
59 | if (LINUX) | ||
60 | set(llwindow_LINK_LIBRARIES | ||
61 | ${UI_LIBRARIES} # for GTK | ||
62 | ${SDL_LIBRARY} | ||
63 | fontconfig # For FCInit and other FC* functions. | ||
64 | ) | ||
65 | else (LINUX) | ||
66 | set(llwindow_LINK_LIBRARIES | ||
67 | ${UI_LIBRARIES} # for GTK | ||
68 | ${SDL_LIBRARY} | ||
69 | ) | ||
70 | endif (LINUX) | ||
71 | |||
58 | if (DARWIN) | 72 | if (DARWIN) |
59 | list(APPEND llwindow_SOURCE_FILES | 73 | list(APPEND llwindow_SOURCE_FILES |
60 | llkeyboardmacosx.cpp | 74 | llkeyboardmacosx.cpp |
@@ -98,6 +112,9 @@ if (WINDOWS) | |||
98 | lldxhardware.h | 112 | lldxhardware.h |
99 | llkeyboardwin32.h | 113 | llkeyboardwin32.h |
100 | ) | 114 | ) |
115 | list(APPEND llwindow_LINK_LIBRARIES | ||
116 | comdlg32 # Common Dialogs for ChooseColor | ||
117 | ) | ||
101 | endif (WINDOWS) | 118 | endif (WINDOWS) |
102 | 119 | ||
103 | if (SOLARIS) | 120 | if (SOLARIS) |
@@ -134,6 +151,7 @@ if (SERVER AND NOT WINDOWS AND NOT DARWIN) | |||
134 | ${server_SOURCE_FILES} | 151 | ${server_SOURCE_FILES} |
135 | ) | 152 | ) |
136 | endif (SERVER AND NOT WINDOWS AND NOT DARWIN) | 153 | endif (SERVER AND NOT WINDOWS AND NOT DARWIN) |
154 | # *TODO: This should probably have target_link_libraries | ||
137 | 155 | ||
138 | if (llwindow_HEADER_FILES) | 156 | if (llwindow_HEADER_FILES) |
139 | list(APPEND llwindow_SOURCE_FILES ${llwindow_HEADER_FILES}) | 157 | list(APPEND llwindow_SOURCE_FILES ${llwindow_HEADER_FILES}) |
@@ -145,4 +163,6 @@ if (VIEWER) | |||
145 | ${llwindow_SOURCE_FILES} | 163 | ${llwindow_SOURCE_FILES} |
146 | ${viewer_SOURCE_FILES} | 164 | ${viewer_SOURCE_FILES} |
147 | ) | 165 | ) |
166 | target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES}) | ||
148 | endif (VIEWER) | 167 | endif (VIEWER) |
168 | |||
diff --git a/linden/indra/llwindow/GL/glh_extensions.h b/linden/indra/llwindow/GL/glh_extensions.h index b936b5d..5b149c9 100644 --- a/linden/indra/llwindow/GL/glh_extensions.h +++ b/linden/indra/llwindow/GL/glh_extensions.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <stdio.h> | 17 | #include <stdio.h> |
18 | 18 | ||
19 | #ifdef _WIN32 | 19 | #ifdef _WIN32 |
20 | # define WIN32_LEAN_AND_MEAN | ||
21 | # include <winsock2.h> | ||
20 | # include <windows.h> | 22 | # include <windows.h> |
21 | #endif | 23 | #endif |
22 | 24 | ||
diff --git a/linden/indra/llwindow/lldxhardware.cpp b/linden/indra/llwindow/lldxhardware.cpp index e0cb82d..d8058ba 100644 --- a/linden/indra/llwindow/lldxhardware.cpp +++ b/linden/indra/llwindow/lldxhardware.cpp | |||
@@ -47,6 +47,7 @@ | |||
47 | 47 | ||
48 | #include "llstring.h" | 48 | #include "llstring.h" |
49 | #include "llstl.h" | 49 | #include "llstl.h" |
50 | #include "lltimer.h" | ||
50 | 51 | ||
51 | void (*gWriteDebug)(const char* msg) = NULL; | 52 | void (*gWriteDebug)(const char* msg) = NULL; |
52 | LLDXHardware gDXHardware; | 53 | LLDXHardware gDXHardware; |
diff --git a/linden/indra/llwindow/llmousehandler.cpp b/linden/indra/llwindow/llmousehandler.cpp index ae2f147..e3ea979 100644 --- a/linden/indra/llwindow/llmousehandler.cpp +++ b/linden/indra/llwindow/llmousehandler.cpp | |||
@@ -57,3 +57,9 @@ BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType cli | |||
57 | } | 57 | } |
58 | return handled; | 58 | return handled; |
59 | } | 59 | } |
60 | |||
61 | BOOL LLMouseHandler::handleHScrollWheel(S32 x, S32 y, S32 clicks) | ||
62 | { | ||
63 | BOOL handled = FALSE; | ||
64 | return handled; | ||
65 | } | ||
diff --git a/linden/indra/llwindow/llmousehandler.h b/linden/indra/llwindow/llmousehandler.h index 7bd0f2e..1a4ea65 100644 --- a/linden/indra/llwindow/llmousehandler.h +++ b/linden/indra/llwindow/llmousehandler.h | |||
@@ -67,6 +67,7 @@ public: | |||
67 | 67 | ||
68 | virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; | 68 | virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; |
69 | virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; | 69 | virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; |
70 | virtual BOOL handleHScrollWheel(S32 x, S32 y, S32 clicks); | ||
70 | virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0; | 71 | virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0; |
71 | virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; }; | 72 | virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; }; |
72 | virtual const std::string& getName() const = 0; | 73 | virtual const std::string& getName() const = 0; |
diff --git a/linden/indra/llwindow/llwindow.cpp b/linden/indra/llwindow/llwindow.cpp index 53ca68d..6ac42b2 100644 --- a/linden/indra/llwindow/llwindow.cpp +++ b/linden/indra/llwindow/llwindow.cpp | |||
@@ -155,6 +155,10 @@ void LLWindowCallbacks::handleScrollWheel(LLWindow *window, S32 clicks) | |||
155 | { | 155 | { |
156 | } | 156 | } |
157 | 157 | ||
158 | void LLWindowCallbacks::handleHScrollWheel(LLWindow *window, S32 clicks) | ||
159 | { | ||
160 | } | ||
161 | |||
158 | void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height) | 162 | void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height) |
159 | { | 163 | { |
160 | } | 164 | } |
diff --git a/linden/indra/llwindow/llwindow.h b/linden/indra/llwindow/llwindow.h index 14759cc..cbcfc5a 100644 --- a/linden/indra/llwindow/llwindow.h +++ b/linden/indra/llwindow/llwindow.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "llcoord.h" | 37 | #include "llcoord.h" |
38 | #include "llstring.h" | 38 | #include "llstring.h" |
39 | #include "llcursortypes.h" | 39 | #include "llcursortypes.h" |
40 | #include "llsd.h" | ||
40 | 41 | ||
41 | class LLSplashScreen; | 42 | class LLSplashScreen; |
42 | 43 | ||
@@ -68,6 +69,7 @@ public: | |||
68 | virtual BOOL handleActivateApp(LLWindow *window, BOOL activating); | 69 | virtual BOOL handleActivateApp(LLWindow *window, BOOL activating); |
69 | virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask); | 70 | virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask); |
70 | virtual void handleScrollWheel(LLWindow *window, S32 clicks); | 71 | virtual void handleScrollWheel(LLWindow *window, S32 clicks); |
72 | virtual void handleHScrollWheel(LLWindow *window, S32 clicks); | ||
71 | virtual void handleResize(LLWindow *window, S32 width, S32 height); | 73 | virtual void handleResize(LLWindow *window, S32 width, S32 height); |
72 | virtual void handleFocus(LLWindow *window); | 74 | virtual void handleFocus(LLWindow *window); |
73 | virtual void handleFocusLost(LLWindow *window); | 75 | virtual void handleFocusLost(LLWindow *window); |
@@ -195,7 +197,7 @@ public: | |||
195 | // return a platform-specific window reference (HWND on Windows, WindowRef on the Mac, Gtk window on Linux) | 197 | // return a platform-specific window reference (HWND on Windows, WindowRef on the Mac, Gtk window on Linux) |
196 | virtual void *getPlatformWindow() = 0; | 198 | virtual void *getPlatformWindow() = 0; |
197 | 199 | ||
198 | // return the platform-specific window reference we use to initialize llmozlib (HWND on Windows, WindowRef on the Mac, Gtk window on Linux) | 200 | // return the platform-specific window reference we use to initialize llqtwebkitlib (HWND on Windows, WindowRef on the Mac, Gtk window on Linux) |
199 | virtual void *getMediaWindow(); | 201 | virtual void *getMediaWindow(); |
200 | 202 | ||
201 | // control platform's Language Text Input mechanisms. | 203 | // control platform's Language Text Input mechanisms. |
@@ -208,6 +210,9 @@ public: | |||
208 | 210 | ||
209 | static std::vector<std::string> getDynamicFallbackFontList(); | 211 | static std::vector<std::string> getDynamicFallbackFontList(); |
210 | 212 | ||
213 | // Provide native key event data | ||
214 | virtual LLSD getNativeKeyData() { return LLSD::emptyMap(); } | ||
215 | |||
211 | protected: | 216 | protected: |
212 | LLWindow(BOOL fullscreen, U32 flags); | 217 | LLWindow(BOOL fullscreen, U32 flags); |
213 | virtual ~LLWindow() {} | 218 | virtual ~LLWindow() {} |
diff --git a/linden/indra/llwindow/llwindowmacosx-objc.h b/linden/indra/llwindow/llwindowmacosx-objc.h index ed5d7b1..9821698 100644 --- a/linden/indra/llwindow/llwindowmacosx-objc.h +++ b/linden/indra/llwindow/llwindowmacosx-objc.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * $LicenseInfo:firstyear=2006&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2006&license=viewergpl$ |
7 | * | 7 | * |
8 | * Copyright (c) 2006-2009, Linden Research, Inc. | 8 | * Copyright (c) 2006-2010, Linden Research, Inc. |
9 | * | 9 | * |
10 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
11 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -31,6 +31,14 @@ | |||
31 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "llimagej2c.h" | ||
35 | #include <Carbon/Carbon.h> | ||
36 | |||
37 | #ifdef __OBJC__ | ||
38 | #ifdef BOOL | ||
39 | #undef BOOL | ||
40 | #endif | ||
41 | #endif // __OBJC__ | ||
34 | 42 | ||
35 | // This will actually hold an NSCursor*, but that type is only available in objective C. | 43 | // This will actually hold an NSCursor*, but that type is only available in objective C. |
36 | typedef void *CursorRef; | 44 | typedef void *CursorRef; |
@@ -40,4 +48,5 @@ void setupCocoa(); | |||
40 | CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY); | 48 | CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY); |
41 | OSErr releaseImageCursor(CursorRef ref); | 49 | OSErr releaseImageCursor(CursorRef ref); |
42 | OSErr setImageCursor(CursorRef ref); | 50 | OSErr setImageCursor(CursorRef ref); |
43 | 51 | BOOL decodeImageQuartz(std::string filename, LLImageRaw *raw_image); | |
52 | BOOL decodeImageQuartz(const UInt8* data, int len, LLImageRaw *raw_image, std::string ext); | ||
diff --git a/linden/indra/llwindow/llwindowmacosx-objc.mm b/linden/indra/llwindow/llwindowmacosx-objc.mm index da01c2a..34ec445 100644 --- a/linden/indra/llwindow/llwindowmacosx-objc.mm +++ b/linden/indra/llwindow/llwindowmacosx-objc.mm | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * $LicenseInfo:firstyear=2006&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2006&license=viewergpl$ |
7 | * | 7 | * |
8 | * Copyright (c) 2006-2009, Linden Research, Inc. | 8 | * Copyright (c) 2006-2010, Linden Research, Inc. |
9 | * | 9 | * |
10 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
11 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -32,6 +32,8 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <AppKit/AppKit.h> | 34 | #include <AppKit/AppKit.h> |
35 | #include <Accelerate/Accelerate.h> | ||
36 | #include <Quartz/Quartz.h> | ||
35 | 37 | ||
36 | /* | 38 | /* |
37 | * These functions are broken out into a separate file because the | 39 | * These functions are broken out into a separate file because the |
@@ -41,6 +43,68 @@ | |||
41 | */ | 43 | */ |
42 | 44 | ||
43 | #include "llwindowmacosx-objc.h" | 45 | #include "llwindowmacosx-objc.h" |
46 | #include "lldir.h" | ||
47 | |||
48 | BOOL decodeImageQuartz(const UInt8* data, int len, LLImageRaw *raw_image, std::string ext) | ||
49 | { | ||
50 | CFDataRef theData = CFDataCreate(kCFAllocatorDefault, data, len); | ||
51 | |||
52 | CGImageSourceRef srcRef = CGImageSourceCreateWithData(theData, NULL); | ||
53 | CGImageRef image_ref = CGImageSourceCreateImageAtIndex(srcRef, 0, NULL); | ||
54 | CFRelease(srcRef); | ||
55 | |||
56 | size_t width = CGImageGetWidth(image_ref); | ||
57 | size_t height = CGImageGetHeight(image_ref); | ||
58 | size_t comps = CGImageGetBitsPerPixel(image_ref) / 8; | ||
59 | size_t bytes_per_row = CGImageGetBytesPerRow(image_ref); | ||
60 | CFDataRef result = CGDataProviderCopyData(CGImageGetDataProvider(image_ref)); | ||
61 | UInt8* bitmap = (UInt8*)CFDataGetBytePtr(result); | ||
62 | |||
63 | CGImageAlphaInfo format = CGImageGetAlphaInfo(image_ref); | ||
64 | if (comps == 4) | ||
65 | { | ||
66 | vImage_Buffer vb; | ||
67 | vb.data = bitmap; | ||
68 | vb.height = height; | ||
69 | vb.width = width; | ||
70 | vb.rowBytes = bytes_per_row; | ||
71 | |||
72 | if (format & kCGImageAlphaPremultipliedFirst) | ||
73 | { | ||
74 | // Ele: Skip unpremultiplication for PSD, PNG and TGA files | ||
75 | if (ext != std::string("psd") && ext != std::string("tga") && ext != std::string("png")) | ||
76 | vImageUnpremultiplyData_ARGB8888(&vb, &vb, 0); | ||
77 | } | ||
78 | else if (format & kCGImageAlphaPremultipliedLast) | ||
79 | { | ||
80 | // Ele: Photoshop Native Transparency needs unmultiplication | ||
81 | vImageUnpremultiplyData_RGBA8888(&vb, &vb, 0); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | raw_image->resize(width, height, comps); | ||
86 | memcpy(raw_image->getData(), bitmap, height * bytes_per_row); | ||
87 | raw_image->verticalFlip(); | ||
88 | |||
89 | CFRelease(theData); | ||
90 | CGImageRelease(image_ref); | ||
91 | CFRelease(result); | ||
92 | |||
93 | return TRUE; | ||
94 | } | ||
95 | |||
96 | BOOL decodeImageQuartz(std::string filename, LLImageRaw *raw_image) | ||
97 | { | ||
98 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | ||
99 | NSURL *url = [[NSURL alloc] initFileURLWithPath:[NSString stringWithCString:filename.c_str()]]; | ||
100 | NSData *data = [NSData dataWithContentsOfURL:url]; | ||
101 | |||
102 | std::string ext = gDirUtilp->getExtension(filename); | ||
103 | |||
104 | BOOL result = decodeImageQuartz((UInt8*)[data bytes], [data length], raw_image, ext); | ||
105 | [pool release]; | ||
106 | return result; | ||
107 | } | ||
44 | 108 | ||
45 | void setupCocoa() | 109 | void setupCocoa() |
46 | { | 110 | { |
@@ -116,4 +180,3 @@ OSErr setImageCursor(CursorRef ref) | |||
116 | 180 | ||
117 | return noErr; | 181 | return noErr; |
118 | } | 182 | } |
119 | |||
diff --git a/linden/indra/llwindow/llwindowmacosx.cpp b/linden/indra/llwindow/llwindowmacosx.cpp index 613d147..93bff99 100644 --- a/linden/indra/llwindow/llwindowmacosx.cpp +++ b/linden/indra/llwindow/llwindowmacosx.cpp | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2001-2009, Linden Research, Inc. | 7 | * Copyright (c) 2001-2010, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -250,6 +250,7 @@ LLWindowMacOSX::LLWindowMacOSX(const std::string& title, const std::string& name | |||
250 | mTSMScriptCode = 0; | 250 | mTSMScriptCode = 0; |
251 | mTSMLangCode = 0; | 251 | mTSMLangCode = 0; |
252 | mPreeditor = NULL; | 252 | mPreeditor = NULL; |
253 | mRawKeyEvent = NULL; | ||
253 | mFSAASamples = fsaa_samples; | 254 | mFSAASamples = fsaa_samples; |
254 | mForceRebuild = FALSE; | 255 | mForceRebuild = FALSE; |
255 | 256 | ||
@@ -1029,6 +1030,7 @@ void LLWindowMacOSX::hide() | |||
1029 | HideWindow(mWindow); | 1030 | HideWindow(mWindow); |
1030 | } | 1031 | } |
1031 | 1032 | ||
1033 | //virtual | ||
1032 | void LLWindowMacOSX::minimize() | 1034 | void LLWindowMacOSX::minimize() |
1033 | { | 1035 | { |
1034 | setMouseClipping(FALSE); | 1036 | setMouseClipping(FALSE); |
@@ -1036,6 +1038,7 @@ void LLWindowMacOSX::minimize() | |||
1036 | CollapseWindow(mWindow, true); | 1038 | CollapseWindow(mWindow, true); |
1037 | } | 1039 | } |
1038 | 1040 | ||
1041 | //virtual | ||
1039 | void LLWindowMacOSX::restore() | 1042 | void LLWindowMacOSX::restore() |
1040 | { | 1043 | { |
1041 | show(); | 1044 | show(); |
@@ -1153,16 +1156,15 @@ void LLWindowMacOSX::gatherInput() | |||
1153 | } | 1156 | } |
1154 | break; | 1157 | break; |
1155 | 1158 | ||
1156 | case kHighLevelEvent: | ||
1157 | AEProcessAppleEvent (&evt); | ||
1158 | break; | ||
1159 | |||
1160 | case updateEvt: | 1159 | case updateEvt: |
1161 | // We shouldn't be getting these regularly (since our window will be buffered), but we need to handle them correctly... | 1160 | // We shouldn't be getting these regularly (since our window will be buffered), but we need to handle them correctly... |
1162 | BeginUpdate((WindowRef)evt.message); | 1161 | BeginUpdate((WindowRef)evt.message); |
1163 | EndUpdate((WindowRef)evt.message); | 1162 | EndUpdate((WindowRef)evt.message); |
1164 | break; | 1163 | break; |
1165 | 1164 | ||
1165 | default: | ||
1166 | AEProcessAppleEvent (&evt); | ||
1167 | break; | ||
1166 | } | 1168 | } |
1167 | } | 1169 | } |
1168 | } | 1170 | } |
@@ -1384,11 +1386,11 @@ void LLWindowMacOSX::setMouseClipping( BOOL b ) | |||
1384 | 1386 | ||
1385 | if(b) | 1387 | if(b) |
1386 | { | 1388 | { |
1387 | // llinfos << "setMouseClipping(TRUE)" << llendl | 1389 | // llinfos << "setMouseClipping(TRUE)" << llendl; |
1388 | } | 1390 | } |
1389 | else | 1391 | else |
1390 | { | 1392 | { |
1391 | // llinfos << "setMouseClipping(FALSE)" << llendl | 1393 | // llinfos << "setMouseClipping(FALSE)" << llendl; |
1392 | } | 1394 | } |
1393 | 1395 | ||
1394 | adjustCursorDecouple(); | 1396 | adjustCursorDecouple(); |
@@ -1406,7 +1408,7 @@ BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) | |||
1406 | 1408 | ||
1407 | CGPoint newPosition; | 1409 | CGPoint newPosition; |
1408 | 1410 | ||
1409 | // llinfos << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << llendl | 1411 | // llinfos << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << llendl; |
1410 | 1412 | ||
1411 | newPosition.x = screen_pos.mX; | 1413 | newPosition.x = screen_pos.mX; |
1412 | newPosition.y = screen_pos.mY; | 1414 | newPosition.y = screen_pos.mY; |
@@ -1437,7 +1439,7 @@ static void fixOrigin(void) | |||
1437 | ::GetPortBounds(port, &portrect); | 1439 | ::GetPortBounds(port, &portrect); |
1438 | if((portrect.left != 0) || (portrect.top != 0)) | 1440 | if((portrect.left != 0) || (portrect.top != 0)) |
1439 | { | 1441 | { |
1440 | // Mozilla sometimes changes our port origin. Fuckers. | 1442 | // Mozilla sometimes changes our port origin. |
1441 | ::SetOrigin(0,0); | 1443 | ::SetOrigin(0,0); |
1442 | } | 1444 | } |
1443 | } | 1445 | } |
@@ -2129,10 +2131,11 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e | |||
2129 | { | 2131 | { |
2130 | UInt32 modifiers = 0; | 2132 | UInt32 modifiers = 0; |
2131 | 2133 | ||
2134 | |||
2132 | // First, process the raw event. | 2135 | // First, process the raw event. |
2133 | { | 2136 | { |
2134 | EventRef rawEvent; | 2137 | EventRef rawEvent = NULL; |
2135 | 2138 | ||
2136 | // Get the original event and extract the modifier keys, so we can ignore command-key events. | 2139 | // Get the original event and extract the modifier keys, so we can ignore command-key events. |
2137 | if (GetEventParameter(event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent) == noErr) | 2140 | if (GetEventParameter(event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent) == noErr) |
2138 | { | 2141 | { |
@@ -2141,6 +2144,9 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e | |||
2141 | 2144 | ||
2142 | // and call this function recursively to handle the raw key event. | 2145 | // and call this function recursively to handle the raw key event. |
2143 | eventHandler (myHandler, rawEvent); | 2146 | eventHandler (myHandler, rawEvent); |
2147 | |||
2148 | // save the raw event until we're done processing the unicode input as well. | ||
2149 | mRawKeyEvent = rawEvent; | ||
2144 | } | 2150 | } |
2145 | } | 2151 | } |
2146 | 2152 | ||
@@ -2168,11 +2174,8 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e | |||
2168 | } | 2174 | } |
2169 | else | 2175 | else |
2170 | { | 2176 | { |
2171 | MASK mask = 0; | 2177 | MASK mask = LLWindowMacOSX::modifiersToMask(modifiers); |
2172 | if(modifiers & shiftKey) { mask |= MASK_SHIFT; } | 2178 | |
2173 | if(modifiers & (cmdKey | controlKey)) { mask |= MASK_CONTROL; } | ||
2174 | if(modifiers & optionKey) { mask |= MASK_ALT; } | ||
2175 | |||
2176 | llassert( actualType == typeUnicodeText ); | 2179 | llassert( actualType == typeUnicodeText ); |
2177 | 2180 | ||
2178 | // The result is a UTF16 buffer. Pass the characters in turn to handleUnicodeChar. | 2181 | // The result is a UTF16 buffer. Pass the characters in turn to handleUnicodeChar. |
@@ -2194,6 +2197,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e | |||
2194 | delete[] buffer; | 2197 | delete[] buffer; |
2195 | } | 2198 | } |
2196 | 2199 | ||
2200 | mRawKeyEvent = NULL; | ||
2197 | result = err; | 2201 | result = err; |
2198 | } | 2202 | } |
2199 | break; | 2203 | break; |
@@ -2268,6 +2272,9 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e | |||
2268 | GetEventParameter (event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode); | 2272 | GetEventParameter (event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode); |
2269 | GetEventParameter (event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers); | 2273 | GetEventParameter (event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers); |
2270 | 2274 | ||
2275 | // save the raw event so getNativeKeyData can use it. | ||
2276 | mRawKeyEvent = event; | ||
2277 | |||
2271 | // printf("key event, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n", keyCode, charCode, (char)charCode, modifiers); | 2278 | // printf("key event, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n", keyCode, charCode, (char)charCode, modifiers); |
2272 | // fflush(stdout); | 2279 | // fflush(stdout); |
2273 | 2280 | ||
@@ -2363,6 +2370,8 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e | |||
2363 | result = eventNotHandledErr; | 2370 | result = eventNotHandledErr; |
2364 | break; | 2371 | break; |
2365 | } | 2372 | } |
2373 | |||
2374 | mRawKeyEvent = NULL; | ||
2366 | } | 2375 | } |
2367 | break; | 2376 | break; |
2368 | 2377 | ||
@@ -2375,6 +2384,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e | |||
2375 | HIPoint location = {0.0f, 0.0f}; | 2384 | HIPoint location = {0.0f, 0.0f}; |
2376 | UInt32 modifiers = 0; | 2385 | UInt32 modifiers = 0; |
2377 | UInt32 clickCount = 1; | 2386 | UInt32 clickCount = 1; |
2387 | EventMouseWheelAxis wheelAxis = kEventMouseWheelAxisX; | ||
2378 | long wheelDelta = 0; | 2388 | long wheelDelta = 0; |
2379 | LLCoordScreen inCoords; | 2389 | LLCoordScreen inCoords; |
2380 | LLCoordGL outCoords; | 2390 | LLCoordGL outCoords; |
@@ -2384,6 +2394,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e | |||
2384 | GetEventParameter(event, kEventParamMouseLocation, typeHIPoint, NULL, sizeof(location), NULL, &location); | 2394 | GetEventParameter(event, kEventParamMouseLocation, typeHIPoint, NULL, sizeof(location), NULL, &location); |
2385 | GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifiers), NULL, &modifiers); | 2395 | GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifiers), NULL, &modifiers); |
2386 | GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(wheelDelta), NULL, &wheelDelta); | 2396 | GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(wheelDelta), NULL, &wheelDelta); |
2397 | GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(wheelAxis), NULL, &wheelAxis); | ||
2387 | GetEventParameter(event, kEventParamClickCount, typeUInt32, NULL, sizeof(clickCount), NULL, &clickCount); | 2398 | GetEventParameter(event, kEventParamClickCount, typeUInt32, NULL, sizeof(clickCount), NULL, &clickCount); |
2388 | 2399 | ||
2389 | inCoords.mX = llround(location.x); | 2400 | inCoords.mX = llround(location.x); |
@@ -2492,14 +2503,31 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e | |||
2492 | 2503 | ||
2493 | case kEventMouseWheelMoved: | 2504 | case kEventMouseWheelMoved: |
2494 | { | 2505 | { |
2495 | static S32 z_delta = 0; | 2506 | switch (wheelAxis){ |
2507 | case kEventMouseWheelAxisX: | ||
2496 | 2508 | ||
2497 | z_delta += wheelDelta; | 2509 | static S32 wheel_x_delta = 0; |
2498 | 2510 | ||
2499 | if (z_delta <= -WHEEL_DELTA || WHEEL_DELTA <= z_delta) | 2511 | wheel_x_delta += wheelDelta; |
2500 | { | 2512 | |
2501 | mCallbacks->handleScrollWheel(this, -z_delta / WHEEL_DELTA); | 2513 | if (wheel_x_delta <= -WHEEL_DELTA || WHEEL_DELTA <= wheel_x_delta) |
2502 | z_delta = 0; | 2514 | { |
2515 | mCallbacks->handleHScrollWheel(this, wheel_x_delta / WHEEL_DELTA); | ||
2516 | wheel_x_delta = 0; | ||
2517 | } | ||
2518 | break; | ||
2519 | case kEventMouseWheelAxisY: | ||
2520 | |||
2521 | static S32 wheel_y_delta = 0; | ||
2522 | |||
2523 | wheel_y_delta += wheelDelta; | ||
2524 | |||
2525 | if (wheel_y_delta <= -WHEEL_DELTA || WHEEL_DELTA <= wheel_y_delta) | ||
2526 | { | ||
2527 | mCallbacks->handleScrollWheel(this, -wheel_y_delta / WHEEL_DELTA); | ||
2528 | wheel_y_delta = 0; | ||
2529 | } | ||
2530 | break; | ||
2503 | } | 2531 | } |
2504 | } | 2532 | } |
2505 | result = noErr; | 2533 | result = noErr; |
@@ -3194,8 +3222,87 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url) | |||
3194 | } | 3222 | } |
3195 | } | 3223 | } |
3196 | 3224 | ||
3225 | LLSD LLWindowMacOSX::getNativeKeyData() | ||
3226 | { | ||
3227 | LLSD result = LLSD::emptyMap(); | ||
3228 | |||
3229 | if(mRawKeyEvent) | ||
3230 | { | ||
3231 | char char_code = 0; | ||
3232 | UInt32 key_code = 0; | ||
3233 | UInt32 modifiers = 0; | ||
3234 | UInt32 keyboard_type = 0; | ||
3235 | |||
3236 | GetEventParameter (mRawKeyEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &char_code); | ||
3237 | GetEventParameter (mRawKeyEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &key_code); | ||
3238 | GetEventParameter (mRawKeyEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers); | ||
3239 | GetEventParameter (mRawKeyEvent, kEventParamKeyboardType, typeUInt32, NULL, sizeof(UInt32), NULL, &keyboard_type); | ||
3240 | |||
3241 | result["char_code"] = (S32)char_code; | ||
3242 | result["key_code"] = (S32)key_code; | ||
3243 | result["modifiers"] = (S32)modifiers; | ||
3244 | result["keyboard_type"] = (S32)keyboard_type; | ||
3245 | |||
3246 | #if 0 | ||
3247 | // This causes trouble for control characters -- apparently character codes less than 32 (escape, control-A, etc) | ||
3248 | // cause llsd serialization to create XML that the llsd deserializer won't parse! | ||
3249 | std::string unicode; | ||
3250 | OSStatus err = noErr; | ||
3251 | EventParamType actualType = typeUTF8Text; | ||
3252 | UInt32 actualSize = 0; | ||
3253 | char *buffer = NULL; | ||
3254 | |||
3255 | err = GetEventParameter (mRawKeyEvent, kEventParamKeyUnicodes, typeUTF8Text, &actualType, 0, &actualSize, NULL); | ||
3256 | if(err == noErr) | ||
3257 | { | ||
3258 | // allocate a buffer and get the actual data. | ||
3259 | buffer = new char[actualSize]; | ||
3260 | err = GetEventParameter (mRawKeyEvent, kEventParamKeyUnicodes, typeUTF8Text, &actualType, actualSize, &actualSize, buffer); | ||
3261 | if(err == noErr) | ||
3262 | { | ||
3263 | unicode.assign(buffer, actualSize); | ||
3264 | } | ||
3265 | delete[] buffer; | ||
3266 | } | ||
3267 | |||
3268 | result["unicode"] = unicode; | ||
3269 | #endif | ||
3270 | |||
3271 | } | ||
3272 | |||
3273 | |||
3274 | lldebugs << "native key data is: " << result << llendl; | ||
3275 | |||
3276 | return result; | ||
3277 | } | ||
3278 | |||
3279 | void LLWindowMacOSX::ShellEx(const std::string& command) | ||
3280 | { | ||
3281 | OSStatus result = noErr; | ||
3282 | CFURLRef urlRef = NULL; | ||
3283 | |||
3284 | CFStringRef stringRef = CFStringCreateWithCString(NULL, command.c_str(), kCFStringEncodingUTF8); | ||
3285 | if (stringRef) | ||
3286 | { | ||
3287 | urlRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, stringRef, kCFURLPOSIXPathStyle, false); | ||
3288 | CFRelease(stringRef); | ||
3289 | } | ||
3290 | |||
3291 | if (urlRef) | ||
3292 | { | ||
3293 | result = LSOpenCFURLRef(urlRef, NULL); | ||
3294 | if (result != noErr) | ||
3295 | llinfos << "Error " << result << " on open." << llendl; | ||
3197 | 3296 | ||
3198 | BOOL LLWindowMacOSX::dialog_color_picker ( F32 *r, F32 *g, F32 *b) | 3297 | CFRelease(urlRef); |
3298 | } | ||
3299 | else | ||
3300 | { | ||
3301 | llinfos << "Error: couldn't create URL." << llendl; | ||
3302 | } | ||
3303 | } | ||
3304 | |||
3305 | BOOL LLWindowMacOSX::dialog_color_picker( F32 *r, F32 *g, F32 *b) | ||
3199 | { | 3306 | { |
3200 | BOOL retval = FALSE; | 3307 | BOOL retval = FALSE; |
3201 | OSErr error = noErr; | 3308 | OSErr error = noErr; |
@@ -3370,3 +3477,13 @@ std::vector<std::string> LLWindowMacOSX::getDynamicFallbackFontList() | |||
3370 | return std::vector<std::string>(); | 3477 | return std::vector<std::string>(); |
3371 | } | 3478 | } |
3372 | 3479 | ||
3480 | // static | ||
3481 | MASK LLWindowMacOSX::modifiersToMask(SInt16 modifiers) | ||
3482 | { | ||
3483 | MASK mask = 0; | ||
3484 | if(modifiers & shiftKey) { mask |= MASK_SHIFT; } | ||
3485 | if(modifiers & (cmdKey | controlKey)) { mask |= MASK_CONTROL; } | ||
3486 | if(modifiers & optionKey) { mask |= MASK_ALT; } | ||
3487 | return mask; | ||
3488 | } | ||
3489 | |||
diff --git a/linden/indra/llwindow/llwindowmacosx.h b/linden/indra/llwindow/llwindowmacosx.h index bf5bfc0..8213b69 100644 --- a/linden/indra/llwindow/llwindowmacosx.h +++ b/linden/indra/llwindow/llwindowmacosx.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2001-2009, Linden Research, Inc. | 7 | * Copyright (c) 2001-2010, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -34,6 +34,7 @@ | |||
34 | #define LL_LLWINDOWMACOSX_H | 34 | #define LL_LLWINDOWMACOSX_H |
35 | 35 | ||
36 | #include "llwindow.h" | 36 | #include "llwindow.h" |
37 | #include "lltimer.h" | ||
37 | 38 | ||
38 | #include <Carbon/Carbon.h> | 39 | #include <Carbon/Carbon.h> |
39 | #include <AGL/agl.h> | 40 | #include <AGL/agl.h> |
@@ -55,6 +56,8 @@ public: | |||
55 | /*virtual*/ BOOL getMinimized(); | 56 | /*virtual*/ BOOL getMinimized(); |
56 | /*virtual*/ BOOL getMaximized(); | 57 | /*virtual*/ BOOL getMaximized(); |
57 | /*virtual*/ BOOL maximize(); | 58 | /*virtual*/ BOOL maximize(); |
59 | /*virtual*/ void minimize(); | ||
60 | /*virtual*/ void restore(); | ||
58 | /*virtual*/ BOOL getFullscreen(); | 61 | /*virtual*/ BOOL getFullscreen(); |
59 | /*virtual*/ BOOL getPosition(LLCoordScreen *position); | 62 | /*virtual*/ BOOL getPosition(LLCoordScreen *position); |
60 | /*virtual*/ BOOL getSize(LLCoordScreen *size); | 63 | /*virtual*/ BOOL getSize(LLCoordScreen *size); |
@@ -113,9 +116,14 @@ public: | |||
113 | /*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b); | 116 | /*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b); |
114 | /*virtual*/ void interruptLanguageTextInput(); | 117 | /*virtual*/ void interruptLanguageTextInput(); |
115 | /*virtual*/ void spawnWebBrowser(const std::string& escaped_url); | 118 | /*virtual*/ void spawnWebBrowser(const std::string& escaped_url); |
119 | /*virtual*/ void ShellEx(const std::string& command); | ||
116 | 120 | ||
117 | static std::vector<std::string> getDynamicFallbackFontList(); | 121 | static std::vector<std::string> getDynamicFallbackFontList(); |
118 | 122 | ||
123 | // Provide native key event data | ||
124 | /*virtual*/ LLSD getNativeKeyData(); | ||
125 | |||
126 | |||
119 | protected: | 127 | protected: |
120 | LLWindowMacOSX( | 128 | LLWindowMacOSX( |
121 | const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags, | 129 | const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags, |
@@ -138,9 +146,6 @@ protected: | |||
138 | // Restore the display resolution to its value before we ran the app. | 146 | // Restore the display resolution to its value before we ran the app. |
139 | BOOL resetDisplayResolution(); | 147 | BOOL resetDisplayResolution(); |
140 | 148 | ||
141 | void minimize(); | ||
142 | void restore(); | ||
143 | |||
144 | BOOL shouldPostQuit() { return mPostQuit; } | 149 | BOOL shouldPostQuit() { return mPostQuit; } |
145 | 150 | ||
146 | 151 | ||
@@ -159,8 +164,8 @@ protected: | |||
159 | void adjustCursorDecouple(bool warpingMouse = false); | 164 | void adjustCursorDecouple(bool warpingMouse = false); |
160 | void fixWindowSize(void); | 165 | void fixWindowSize(void); |
161 | void stopDockTileBounce(); | 166 | void stopDockTileBounce(); |
162 | 167 | static MASK modifiersToMask(SInt16 modifiers); | |
163 | 168 | ||
164 | // | 169 | // |
165 | // Platform specific variables | 170 | // Platform specific variables |
166 | // | 171 | // |
@@ -208,6 +213,7 @@ protected: | |||
208 | 213 | ||
209 | friend class LLWindowManager; | 214 | friend class LLWindowManager; |
210 | static WindowRef sMediaWindow; | 215 | static WindowRef sMediaWindow; |
216 | EventRef mRawKeyEvent; | ||
211 | 217 | ||
212 | }; | 218 | }; |
213 | 219 | ||
diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp index bf339f2..2f9de6b 100644 --- a/linden/indra/llwindow/llwindowsdl.cpp +++ b/linden/indra/llwindow/llwindowsdl.cpp | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "llstring.h" | 42 | #include "llstring.h" |
43 | #include "lldir.h" | 43 | #include "lldir.h" |
44 | #include "llfindlocale.h" | 44 | #include "llfindlocale.h" |
45 | #include "lltimer.h" | ||
45 | 46 | ||
46 | #include "indra_constants.h" | 47 | #include "indra_constants.h" |
47 | 48 | ||
@@ -250,6 +251,10 @@ LLWindowSDL::LLWindowSDL(const std::string& title, S32 x, S32 y, S32 width, | |||
250 | #if LL_X11 | 251 | #if LL_X11 |
251 | mFlashing = FALSE; | 252 | mFlashing = FALSE; |
252 | #endif // LL_X11 | 253 | #endif // LL_X11 |
254 | |||
255 | mKeyScanCode = 0; | ||
256 | mKeyVirtualKey = 0; | ||
257 | mKeyModifiers = KMOD_NONE; | ||
253 | } | 258 | } |
254 | 259 | ||
255 | static SDL_Surface *Load_BMP_Resource(const char *basename) | 260 | static SDL_Surface *Load_BMP_Resource(const char *basename) |
@@ -627,6 +632,15 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B | |||
627 | mWindow = SDL_SetVideoMode(width, height, bits, sdlflags); | 632 | mWindow = SDL_SetVideoMode(width, height, bits, sdlflags); |
628 | } | 633 | } |
629 | 634 | ||
635 | while (!mWindow && mFSAASamples > 0) | ||
636 | { | ||
637 | llwarns << "Window creating failed with " << mFSAASamples << "x FSAA."<<llendl; | ||
638 | mFSAASamples = mFSAASamples>>1; | ||
639 | SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, mFSAASamples ? 1 : 0); | ||
640 | SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, mFSAASamples); | ||
641 | mWindow = SDL_SetVideoMode(width, height, bits, sdlflags); | ||
642 | } | ||
643 | |||
630 | if (!mWindow) | 644 | if (!mWindow) |
631 | { | 645 | { |
632 | llwarns << "createContext: window creation failure. SDL: " << SDL_GetError() << llendl; | 646 | llwarns << "createContext: window creation failure. SDL: " << SDL_GetError() << llendl; |
@@ -671,12 +685,12 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B | |||
671 | glGetIntegerv(GL_DEPTH_BITS, &depthBits); | 685 | glGetIntegerv(GL_DEPTH_BITS, &depthBits); |
672 | glGetIntegerv(GL_STENCIL_BITS, &stencilBits); | 686 | glGetIntegerv(GL_STENCIL_BITS, &stencilBits); |
673 | 687 | ||
674 | llinfos << "GL buffer:" << llendl | 688 | llinfos << "GL buffer:" << llendl; |
675 | llinfos << " Red Bits " << S32(redBits) << llendl | 689 | llinfos << " Red Bits " << S32(redBits) << llendl; |
676 | llinfos << " Green Bits " << S32(greenBits) << llendl | 690 | llinfos << " Green Bits " << S32(greenBits) << llendl; |
677 | llinfos << " Blue Bits " << S32(blueBits) << llendl | 691 | llinfos << " Blue Bits " << S32(blueBits) << llendl; |
678 | llinfos << " Alpha Bits " << S32(alphaBits) << llendl | 692 | llinfos << " Alpha Bits " << S32(alphaBits) << llendl; |
679 | llinfos << " Depth Bits " << S32(depthBits) << llendl | 693 | llinfos << " Depth Bits " << S32(depthBits) << llendl; |
680 | llinfos << " Stencil Bits " << S32(stencilBits) << llendl; | 694 | llinfos << " Stencil Bits " << S32(stencilBits) << llendl; |
681 | 695 | ||
682 | GLint colorBits = redBits + greenBits + blueBits + alphaBits; | 696 | GLint colorBits = redBits + greenBits + blueBits + alphaBits; |
@@ -1602,6 +1616,7 @@ void LLWindowSDL::processMiscNativeEvents() | |||
1602 | // the locale to protect it, as exotic/non-C locales | 1616 | // the locale to protect it, as exotic/non-C locales |
1603 | // causes our code lots of general critical weirdness | 1617 | // causes our code lots of general critical weirdness |
1604 | // and crashness. (SL-35450) | 1618 | // and crashness. (SL-35450) |
1619 | // Note: It is unknown if this is still needed now that we use webkit. | ||
1605 | static std::string saved_locale; | 1620 | static std::string saved_locale; |
1606 | saved_locale = ll_safe_string(setlocale(LC_ALL, NULL)); | 1621 | saved_locale = ll_safe_string(setlocale(LC_ALL, NULL)); |
1607 | 1622 | ||
@@ -1725,7 +1740,10 @@ void LLWindowSDL::gatherInput() | |||
1725 | mCallbacks->handleScrollWheel(this, -1); | 1740 | mCallbacks->handleScrollWheel(this, -1); |
1726 | else if (event.button.button == 5) // mousewheel down...thanks to X11 for making SDL consider these "buttons". | 1741 | else if (event.button.button == 5) // mousewheel down...thanks to X11 for making SDL consider these "buttons". |
1727 | mCallbacks->handleScrollWheel(this, 1); | 1742 | mCallbacks->handleScrollWheel(this, 1); |
1728 | 1743 | else if (event.button.button == 6) | |
1744 | mCallbacks->handleHScrollWheel(this, -1); | ||
1745 | else if (event.button.button == 7) | ||
1746 | mCallbacks->handleHScrollWheel(this, 1); | ||
1729 | break; | 1747 | break; |
1730 | } | 1748 | } |
1731 | 1749 | ||
@@ -1935,11 +1953,6 @@ void LLWindowSDL::setCursor(ECursorType cursor) | |||
1935 | } | 1953 | } |
1936 | } | 1954 | } |
1937 | 1955 | ||
1938 | ECursorType LLWindowSDL::getCursor() | ||
1939 | { | ||
1940 | return mCurrentCursor; | ||
1941 | } | ||
1942 | |||
1943 | void LLWindowSDL::initCursors() | 1956 | void LLWindowSDL::initCursors() |
1944 | { | 1957 | { |
1945 | int i; | 1958 | int i; |
@@ -2227,7 +2240,40 @@ static void color_changed_callback(GtkWidget *widget, | |||
2227 | gtk_color_selection_get_current_color(colorsel, colorp); | 2240 | gtk_color_selection_get_current_color(colorsel, colorp); |
2228 | } | 2241 | } |
2229 | 2242 | ||
2230 | BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b) | 2243 | |
2244 | /* | ||
2245 | Make the raw keyboard data available - used to poke through to LLQtWebKit so | ||
2246 | that Qt/Webkit has access to the virtual keycodes etc. that it needs | ||
2247 | */ | ||
2248 | LLSD LLWindowSDL::getNativeKeyData() | ||
2249 | { | ||
2250 | LLSD result = LLSD::emptyMap(); | ||
2251 | |||
2252 | U32 modifiers = 0; // pretend-native modifiers... oh what a tangled web we weave! | ||
2253 | |||
2254 | // we go through so many levels of device abstraction that I can't really guess | ||
2255 | // what a plugin under GDK under Qt under SL under SDL under X11 considers | ||
2256 | // a 'native' modifier mask. this has been sort of reverse-engineered... they *appear* | ||
2257 | // to match GDK consts, but that may be co-incidence. | ||
2258 | modifiers |= (mKeyModifiers & KMOD_LSHIFT) ? 0x0001 : 0; | ||
2259 | modifiers |= (mKeyModifiers & KMOD_RSHIFT) ? 0x0001 : 0;// munge these into the same shift | ||
2260 | modifiers |= (mKeyModifiers & KMOD_CAPS) ? 0x0002 : 0; | ||
2261 | modifiers |= (mKeyModifiers & KMOD_LCTRL) ? 0x0004 : 0; | ||
2262 | modifiers |= (mKeyModifiers & KMOD_RCTRL) ? 0x0004 : 0;// munge these into the same ctrl | ||
2263 | modifiers |= (mKeyModifiers & KMOD_LALT) ? 0x0008 : 0;// untested | ||
2264 | modifiers |= (mKeyModifiers & KMOD_RALT) ? 0x0008 : 0;// untested | ||
2265 | // *todo: test ALTs - I don't have a case for testing these. Do you? | ||
2266 | // *todo: NUM? - I don't care enough right now (and it's not a GDK modifier). | ||
2267 | |||
2268 | result["scan_code"] = (S32)mKeyScanCode; | ||
2269 | result["virtual_key"] = (S32)mKeyVirtualKey; | ||
2270 | result["modifiers"] = (S32)modifiers; | ||
2271 | |||
2272 | return result; | ||
2273 | } | ||
2274 | |||
2275 | |||
2276 | BOOL LLWindowSDL::dialog_color_picker( F32 *r, F32 *g, F32 *b) | ||
2231 | { | 2277 | { |
2232 | BOOL rtn = FALSE; | 2278 | BOOL rtn = FALSE; |
2233 | 2279 | ||
@@ -2396,7 +2442,7 @@ void *LLWindowSDL::getPlatformWindow() | |||
2396 | return rtnw; | 2442 | return rtnw; |
2397 | } | 2443 | } |
2398 | #endif // LL_GTK && LL_LLMOZLIB_ENABLED | 2444 | #endif // LL_GTK && LL_LLMOZLIB_ENABLED |
2399 | // Unixoid mozilla really needs GTK. | 2445 | llassert(false); // Do we even GET here at all? Note that LL_LLMOZLIB_ENABLED is never defined! |
2400 | return NULL; | 2446 | return NULL; |
2401 | } | 2447 | } |
2402 | 2448 | ||
diff --git a/linden/indra/llwindow/llwindowsdl.h b/linden/indra/llwindow/llwindowsdl.h index 39a6007..e632dfe 100644 --- a/linden/indra/llwindow/llwindowsdl.h +++ b/linden/indra/llwindow/llwindowsdl.h | |||
@@ -36,6 +36,7 @@ | |||
36 | // Simple Directmedia Layer (http://libsdl.org/) implementation of LLWindow class | 36 | // Simple Directmedia Layer (http://libsdl.org/) implementation of LLWindow class |
37 | 37 | ||
38 | #include "llwindow.h" | 38 | #include "llwindow.h" |
39 | #include "lltimer.h" | ||
39 | 40 | ||
40 | #include "SDL/SDL.h" | 41 | #include "SDL/SDL.h" |
41 | #include "SDL/SDL_endian.h" | 42 | #include "SDL/SDL_endian.h" |
@@ -77,7 +78,6 @@ public: | |||
77 | /*virtual*/ void hideCursorUntilMouseMove(); | 78 | /*virtual*/ void hideCursorUntilMouseMove(); |
78 | /*virtual*/ BOOL isCursorHidden(); | 79 | /*virtual*/ BOOL isCursorHidden(); |
79 | /*virtual*/ void setCursor(ECursorType cursor); | 80 | /*virtual*/ void setCursor(ECursorType cursor); |
80 | /*virtual*/ ECursorType getCursor(); | ||
81 | /*virtual*/ void captureMouse(); | 81 | /*virtual*/ void captureMouse(); |
82 | /*virtual*/ void releaseMouse(); | 82 | /*virtual*/ void releaseMouse(); |
83 | /*virtual*/ void setMouseClipping( BOOL b ); | 83 | /*virtual*/ void setMouseClipping( BOOL b ); |
@@ -154,6 +154,8 @@ protected: | |||
154 | BOOL ignore_pixel_depth, U32 fsaa_samples); | 154 | BOOL ignore_pixel_depth, U32 fsaa_samples); |
155 | ~LLWindowSDL(); | 155 | ~LLWindowSDL(); |
156 | 156 | ||
157 | /*virtual*/ LLSD getNativeKeyData(); | ||
158 | |||
157 | void initCursors(); | 159 | void initCursors(); |
158 | void quitCursors(); | 160 | void quitCursors(); |
159 | BOOL isValid(); | 161 | BOOL isValid(); |
@@ -206,12 +208,17 @@ protected: | |||
206 | 208 | ||
207 | friend class LLWindowManager; | 209 | friend class LLWindowManager; |
208 | 210 | ||
209 | #if LL_X11 | 211 | |
210 | private: | 212 | private: |
213 | #if LL_X11 | ||
211 | void x11_set_urgent(BOOL urgent); | 214 | void x11_set_urgent(BOOL urgent); |
212 | BOOL mFlashing; | 215 | BOOL mFlashing; |
213 | LLTimer mFlashTimer; | 216 | LLTimer mFlashTimer; |
214 | #endif //LL_X11 | 217 | #endif //LL_X11 |
218 | U32 mKeyScanCode; | ||
219 | U32 mKeyVirtualKey; | ||
220 | SDLMod mKeyModifiers; | ||
221 | |||
215 | }; | 222 | }; |
216 | 223 | ||
217 | 224 | ||
diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp index e47cab4..dacee34 100644 --- a/linden/indra/llwindow/llwindowwin32.cpp +++ b/linden/indra/llwindow/llwindowwin32.cpp | |||
@@ -59,6 +59,8 @@ | |||
59 | 59 | ||
60 | #include "llpreeditor.h" | 60 | #include "llpreeditor.h" |
61 | 61 | ||
62 | #include "llfasttimer.h" | ||
63 | |||
62 | // culled from winuser.h | 64 | // culled from winuser.h |
63 | #ifndef WM_MOUSEWHEEL /* Added to be compatible with later SDK's */ | 65 | #ifndef WM_MOUSEWHEEL /* Added to be compatible with later SDK's */ |
64 | const S32 WM_MOUSEWHEEL = 0x020A; | 66 | const S32 WM_MOUSEWHEEL = 0x020A; |
@@ -2257,6 +2259,22 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ | |||
2257 | } | 2259 | } |
2258 | return 0; | 2260 | return 0; |
2259 | } | 2261 | } |
2262 | #ifdef WM_MOUSEHWHEEL | ||
2263 | case WM_MOUSEHWHEEL: | ||
2264 | { | ||
2265 | window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEHWHEEL"); | ||
2266 | static short z_delta = 0; | ||
2267 | |||
2268 | z_delta += HIWORD(w_param); | ||
2269 | |||
2270 | if (z_delta <= -WHEEL_DELTA || WHEEL_DELTA <= z_delta) | ||
2271 | { | ||
2272 | window_imp->mCallbacks->handleHScrollWheel(window_imp, z_delta / WHEEL_DELTA); | ||
2273 | z_delta = 0; | ||
2274 | } | ||
2275 | return 0; | ||
2276 | } | ||
2277 | #endif //WM_MOUSEHWHEEL | ||
2260 | /* | 2278 | /* |
2261 | // TODO: add this after resolving _WIN32_WINNT issue | 2279 | // TODO: add this after resolving _WIN32_WINNT issue |
2262 | case WM_MOUSELEAVE: | 2280 | case WM_MOUSELEAVE: |
@@ -3052,6 +3070,19 @@ void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url ) | |||
3052 | */ | 3070 | */ |
3053 | } | 3071 | } |
3054 | 3072 | ||
3073 | /* | ||
3074 | Make the raw keyboard data available - used to poke through to LLQtWebKit so | ||
3075 | that Qt/Webkit has access to the virtual keycodes etc. that it needs | ||
3076 | */ | ||
3077 | LLSD LLWindowWin32::getNativeKeyData() | ||
3078 | { | ||
3079 | LLSD result = LLSD::emptyMap(); | ||
3080 | |||
3081 | result["scan_code"] = (S32)mKeyScanCode; | ||
3082 | result["virtual_key"] = (S32)mKeyVirtualKey; | ||
3083 | |||
3084 | return result; | ||
3085 | } | ||
3055 | 3086 | ||
3056 | BOOL LLWindowWin32::dialog_color_picker ( F32 *r, F32 *g, F32 *b ) | 3087 | BOOL LLWindowWin32::dialog_color_picker ( F32 *r, F32 *g, F32 *b ) |
3057 | { | 3088 | { |
diff --git a/linden/indra/llwindow/llwindowwin32.h b/linden/indra/llwindow/llwindowwin32.h index cc95993..0e40115 100644 --- a/linden/indra/llwindow/llwindowwin32.h +++ b/linden/indra/llwindow/llwindowwin32.h | |||
@@ -128,7 +128,7 @@ protected: | |||
128 | HCURSOR loadColorCursor(LPCTSTR name); | 128 | HCURSOR loadColorCursor(LPCTSTR name); |
129 | BOOL isValid(); | 129 | BOOL isValid(); |
130 | void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size); | 130 | void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size); |
131 | 131 | LLSD getNativeKeyData(); | |
132 | 132 | ||
133 | // Changes display resolution. Returns true if successful | 133 | // Changes display resolution. Returns true if successful |
134 | BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); | 134 | BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); |
@@ -208,6 +208,12 @@ protected: | |||
208 | 208 | ||
209 | LLPreeditor *mPreeditor; | 209 | LLPreeditor *mPreeditor; |
210 | 210 | ||
211 | |||
212 | |||
213 | U32 mKeyCharCode; | ||
214 | U32 mKeyScanCode; | ||
215 | U32 mKeyVirtualKey; | ||
216 | |||
211 | friend class LLWindowManager; | 217 | friend class LLWindowManager; |
212 | }; | 218 | }; |
213 | 219 | ||