From 870dcca7871a1903d688c3f6a8f2b30d7cf62b7e Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi <emutavchi@productengine.com> Date: Fri, 5 Mar 2010 21:36:41 +0200 Subject: Working on major bug EXT-4820([NUX] Viewer dimensions on first-run) - implemented LLWindowMacOSX::maximize() method --HG-- branch : product-engine --- indra/llwindow/llwindowmacosx-objc.h | 2 +- indra/llwindow/llwindowmacosx-objc.mm | 10 ++++++++++ indra/llwindow/llwindowmacosx.cpp | 28 +++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 2 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 66851300d4..ed8c874dcb 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -41,4 +41,4 @@ CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY); OSErr releaseImageCursor(CursorRef ref); OSErr setImageCursor(CursorRef ref); void getScreenSize(int* width, int* height); - +void getVisibleScreen(int *x, int *y, int* width, int* height); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 6eca24ec1d..5cab2619fd 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -125,3 +125,13 @@ void getScreenSize(int* width, int* height) [pool release]; } +void getVisibleScreen(int *x, int *y, int* width, int* height) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSRect visible_rect = [[NSScreen mainScreen] visibleFrame]; + if (width) *width = (int)(visible_rect.size.width); + if (height) *height = (int)(visible_rect.size.height); + if (x) *x = (int)(visible_rect.origin.x); + if (y) *y = (int)(visible_rect.origin.y); + [pool release]; +} diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 5b21e06fe2..924acaf148 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1122,7 +1122,33 @@ BOOL LLWindowMacOSX::getMaximized() BOOL LLWindowMacOSX::maximize() { - // TODO + if (mWindow) + { + // *HACK: Because Mac OSX doesn't have a concept of a "maximized" window, we just + // stretch it out to the visible screen size. + Rect win_rect; + + int visible_x; + int visible_y; + int visible_width; + int visible_height; + int screen_width; + int screen_height; + + getScreenSize(&screen_width, &screen_height); + getVisibleScreen(&visible_x, &visible_y, &visible_width, &visible_height); + + int mac_os_menu_bar_height = screen_height - (visible_height + visible_y); + ::SetRect(&win_rect, + visible_x, + mac_os_menu_bar_height, + visible_width + visible_x, + visible_height + mac_os_menu_bar_height); + + ::SetWindowBounds(mWindow, kWindowStructureRgn, &win_rect); + + return TRUE; + } return FALSE; } -- cgit v1.2.3 From 92025836edd66992fecd6b25c3fd3880bba9be67 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi <emutavchi@productengine.com> Date: Fri, 5 Mar 2010 21:36:41 +0200 Subject: Working on major bug EXT-4820([NUX] Viewer dimensions on first-run) - implemented LLWindowSDL::maximize() method --HG-- branch : product-engine --- indra/llwindow/llwindowsdl.cpp | 161 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 159 insertions(+), 2 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index fe0ada5b09..cb4e04511c 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -950,7 +950,68 @@ BOOL LLWindowSDL::getMaximized() if (mWindow) { - // TODO +#if LL_X11 + if (mSDL_Display) + { + maybe_lock_display(); + + // Return data in the specified format, XA_ATOM. + U8* prop; + // Actual format of the property. + int format; + // Actual number of items stored in the prop return data. + unsigned long nitems; + // Number of bytes remaining to be read in the property if a partial read was performed. + unsigned long bytes_after; + // Atom identifier that defines the actual type of the property. + Atom type; + + // Atom used to obtain list of hints describing the window state. + Atom wm_state = XInternAtom(mSDL_Display, "_NET_WM_STATE", False); + + // Atoms indicates that the window is vertically/horizontally maximized. + Atom max_vert = XInternAtom(mSDL_Display, "_NET_WM_STATE_MAXIMIZED_VERT", False); + Atom max_horz = XInternAtom(mSDL_Display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); + + // How many atoms in which we interested are present in list of hints. + U32 pass = 0; + + do + { + nitems = 0; + bytes_after = 0; + type = None; + if ( (XGetWindowProperty (mSDL_Display, + mSDL_XWindowID, + wm_state, + 0, UINT_MAX, + False, XA_ATOM, + &type, &format, + &nitems, &bytes_after, + &prop) == Success) + && type != None ) + { + Atom *atoms = (Atom *)prop; + for (unsigned long i=0; i<nitems; ++i) + { + if (atoms[i] == max_horz) + ++pass; + else if (atoms[i] == max_vert) + ++pass; + } + XFree (atoms); + } + else + { + break; + } + } while (bytes_after > 0); + + result = (pass == 2); + + maybe_unlock_display(); + } +#endif // LL_X11 } return(result); @@ -958,7 +1019,103 @@ BOOL LLWindowSDL::getMaximized() BOOL LLWindowSDL::maximize() { - // TODO +#if LL_X11 + if (mSDL_Display && !mFullscreen) + { + maybe_lock_display(); + + BOOL is_maximize_allowed = FALSE; + + // Check if maximize is allowed + { + // Return data in the specified format, XA_ATOM. + U8* prop; + // Actual format of the property. + int format; + // Actual number of items stored in the prop return data. + unsigned long nitems; + // Number of bytes remaining to be read in the property if a partial read was performed. + unsigned long bytes_after; + // Atom identifier that defines the actual type of the property. + Atom type; + + // Atom used to obtain a list of atoms indicating user operations that the Window Manager supports for this window. + Atom allowed_act = XInternAtom(mSDL_Display, "_NET_WM_ALLOWED_ACTIONS", False); + + // Atoms that indicates that the window may be vertically/horizontally maximized. + Atom max_vert_act = XInternAtom(mSDL_Display, "_NET_WM_ACTION_MAXIMIZE_HORZ", False); + Atom max_horz_act = XInternAtom(mSDL_Display, "_NET_WM_ACTION_MAXIMIZE_VERT", False); + + // How many atoms in which we interested are present in list of hints. + U32 pass = 0; + + do + { + nitems = 0; + bytes_after = 0; + type = None; + if ( (XGetWindowProperty (mSDL_Display, + mSDL_XWindowID, + allowed_act, + 0, UINT_MAX, + False, XA_ATOM, + &type, &format, + &nitems, &bytes_after, + &prop) == Success) + && type != None ) + { + Atom *atoms = (Atom *)prop; + for (unsigned long i=0; i<nitems; ++i) + { + if (atoms[i] == max_vert_act) + ++pass; + else if (atoms[i] == max_horz_act) + ++pass; + } + XFree (atoms); + } + else + { + break; + } + } while (bytes_after > 0); + + is_maximize_allowed = (pass == 2); + } + + // Send maximize event to X11 system + if (is_maximize_allowed) + { + XEvent xev; + + // Atom describing the window state. + Atom wm_state = XInternAtom(mSDL_Display, "_NET_WM_STATE", False); + + // Atoms indicates that the window is vertically/horizontally maximized. + Atom max_vert = XInternAtom(mSDL_Display, "_NET_WM_STATE_MAXIMIZED_VERT", False); + Atom max_horz = XInternAtom(mSDL_Display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); + + memset(&xev, 0, sizeof(xev)); + xev.type = ClientMessage; + xev.xclient.window = mSDL_XWindowID; + xev.xclient.message_type = wm_state; + xev.xclient.format = 32; + xev.xclient.data.l[0] = 1; // add/set property + xev.xclient.data.l[1] = max_vert; + xev.xclient.data.l[2] = max_horz; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; + + XSendEvent(mSDL_Display, + DefaultRootWindow(mSDL_Display), + False, + SubstructureNotifyMask, &xev); + } + + maybe_unlock_display(); + return is_maximize_allowed; + } +#endif // LL_X11 return FALSE; } -- cgit v1.2.3 From 48fd4c8d14172ab9780d88bf204d1e4e56f2004e Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi <emutavchi@productengine.com> Date: Fri, 5 Mar 2010 21:36:41 +0200 Subject: Working on major bug EXT-4820([NUX] Viewer dimensions on first-run) - moved LLDisplayInfo to llwindow, implemented getting the width/height of screen for mac os and linux. --HG-- branch : product-engine --- indra/llwindow/llwindow.cpp | 27 +++++++++++++++++++++++ indra/llwindow/llwindow.h | 15 +++++++++++++ indra/llwindow/llwindowmacosx-objc.h | 1 + indra/llwindow/llwindowmacosx-objc.mm | 9 ++++++++ indra/llwindow/llwindowmacosx.cpp | 20 +++++++++++++++++ indra/llwindow/llwindowmacosx.h | 2 ++ indra/llwindow/llwindowsdl.cpp | 41 +++++++++++++++++++++++++++++++++++ indra/llwindow/llwindowsdl.h | 3 +++ indra/llwindow/llwindowwin32.cpp | 11 ++++++++++ indra/llwindow/llwindowwin32.h | 3 +++ 10 files changed, 132 insertions(+) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 1c6c9e6e9d..b77deb003f 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -407,3 +407,30 @@ BOOL LLWindowManager::isWindowValid(LLWindow *window) { return sWindowList.find(window) != sWindowList.end(); } + +S32 LLDisplayInfo::getDisplayWidth() const +{ +#if LL_WINDOWS + return LLWindowWin32::getDisplayWidth(); +#elif LL_DARWIN + return LLWindowMacOSX::getDisplayWidth(); +#elif LL_SDL + return LLWindowSDL::getDisplayWidth(); +#else + return 1024; //*FIXME +#endif +} + +S32 LLDisplayInfo::getDisplayHeight() const +{ +#if LL_WINDOWS + return LLWindowWin32::getDisplayHeight(); +#elif LL_DARWIN + return LLWindowMacOSX::getDisplayHeight(); +#elif LL_SDL + return LLWindowSDL::getDisplayHeight(); +#else + return 768; //*FIXME +#endif +} + diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 55b221e716..b769f5071b 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -281,4 +281,19 @@ extern const std::string gURLProtocolWhitelistHandler[]; void simpleEscapeString ( std::string& stringIn ); +//============================================================================= +// +// CLASS LLDisplayInfo +class LLDisplayInfo + +/*! @brief Class to query the information about some display settings +*/ +{ +public: + LLDisplayInfo(){}; ///< Default constructor + + S32 getDisplayWidth() const; ///< display width + S32 getDisplayHeight() const; ///< display height +}; + #endif // _LL_window_h_ diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index ed5d7b1e74..66851300d4 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -40,4 +40,5 @@ void setupCocoa(); CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY); OSErr releaseImageCursor(CursorRef ref); OSErr setImageCursor(CursorRef ref); +void getScreenSize(int* width, int* height); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 59b25e1726..6eca24ec1d 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -116,3 +116,12 @@ OSErr setImageCursor(CursorRef ref) return noErr; } +void getScreenSize(int* width, int* height) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSRect screen_rect = [[NSScreen mainScreen] frame]; + if (width) *width = (int)(screen_rect.size.width); + if (height) *height = (int)(screen_rect.size.height); + [pool release]; +} + diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index ad97bc45fc..5b21e06fe2 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -3464,6 +3464,26 @@ MASK LLWindowMacOSX::modifiersToMask(SInt16 modifiers) return mask; } +// static +S32 LLWindowMacOSX::getDisplayWidth() +{ + S32 width = 1024; + // Need to invoke cocoa before use getScreenSize() + setupCocoa(); + getScreenSize(&width, NULL); + return width; +} + +// static +S32 LLWindowMacOSX::getDisplayHeight() +{ + S32 height = 768; + // Need to invoke cocoa before use getScreenSize() + setupCocoa(); + getScreenSize(NULL, &height); + return height; +} + #if LL_OS_DRAGDROP_ENABLED OSErr LLWindowMacOSX::dragTrackingHandler(DragTrackingMessage message, WindowRef theWindow, diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 7c6b324029..86036a261c 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -123,6 +123,8 @@ public: // Provide native key event data /*virtual*/ LLSD getNativeKeyData(); + static S32 getDisplayWidth(); + static S32 getDisplayHeight(); protected: LLWindowMacOSX(LLWindowCallbacks* callbacks, diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 1f705f9e60..fe0ada5b09 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -187,6 +187,47 @@ Display* LLWindowSDL::get_SDL_Display(void) } #endif // LL_X11 +// static +S32 LLWindowSDL::getDisplayWidth() +{ +#if LL_GTK + if (LLWindowSDL::ll_try_gtk_init()) + { + return gdk_screen_width(); + } +#endif // LL_GTK + +#if LL_X11 + Display *display = XOpenDisplay(NULL); + int screen_num = DefaultScreen(display); + S32 width = DisplayWidth(display, screen_num); + XCloseDisplay(display); + return width; +#endif //LL_X11 + + return 1024; +} + +// static +S32 LLWindowSDL::getDisplayHeight() +{ +#if LL_GTK + if (LLWindowSDL::ll_try_gtk_init()) + { + return gdk_screen_height(); + } +#endif // LL_GTK + +#if LL_X11 + Display *display = XOpenDisplay(NULL); + int screen_num = DefaultScreen(display); + S32 height = DisplayHeight(display, screen_num); + XCloseDisplay(display); + return height; +#endif //LL_X11 + + return 768; +} LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, const std::string& title, S32 x, S32 y, S32 width, diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index e6bdd46a77..2311a361fa 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -148,6 +148,9 @@ public: static Display* get_SDL_Display(void); #endif // LL_X11 + static S32 getDisplayWidth(); + static S32 getDisplayHeight(); + protected: LLWindowSDL(LLWindowCallbacks* callbacks, const std::string& title, int x, int y, int width, int height, U32 flags, diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index c80392ad45..4be5d06c2b 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -3714,5 +3714,16 @@ std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList() return std::vector<std::string>(); } +// static +S32 LLWindowWin32::getDisplayWidth() +{ + return ::GetSystemMetrics(SM_CXVIRTUALSCREEN); +} + +// static +S32 LLWindowWin32::getDisplayHeight() +{ + return ::GetSystemMetrics(SM_CYVIRTUALSCREEN); +} #endif // LL_WINDOWS diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 9d57735772..c221ec0192 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -120,6 +120,9 @@ public: static std::vector<std::string> getDynamicFallbackFontList(); + static S32 getDisplayWidth(); + static S32 getDisplayHeight(); + protected: LLWindowWin32(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags, -- cgit v1.2.3 From dcf279d663e701700cd1227825f3cff39554f82a Mon Sep 17 00:00:00 2001 From: Richard Linden <none@none> Date: Fri, 5 Mar 2010 18:34:36 -0800 Subject: EXT-2418 added open/sit/buy mouse cursors --- indra/llwindow/llwindowmacosx.cpp | 9 +++++++++ indra/llwindow/llwindowwin32.cpp | 3 +++ 2 files changed, 12 insertions(+) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index ad97bc45fc..a083de78b7 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -2781,6 +2781,9 @@ const char* cursorIDToName(int id) case UI_CURSOR_TOOLPAUSE: return "UI_CURSOR_TOOLPAUSE"; case UI_CURSOR_TOOLMEDIAOPEN: return "UI_CURSOR_TOOLMEDIAOPEN"; case UI_CURSOR_PIPETTE: return "UI_CURSOR_PIPETTE"; + case UI_CURSOR_TOOLSIT: return "UI_CURSOR_TOOLSIT"; + case UI_CURSOR_TOOLBUY: return "UI_CURSOR_TOOLBUY"; + case UI_CURSOR_TOOLOPEN: return "UI_CURSOR_TOOLOPEN"; } llerrs << "cursorIDToName: unknown cursor id" << id << llendl; @@ -2883,6 +2886,9 @@ void LLWindowMacOSX::setCursor(ECursorType cursor) case UI_CURSOR_TOOLPLAY: case UI_CURSOR_TOOLPAUSE: case UI_CURSOR_TOOLMEDIAOPEN: + case UI_CURSOR_TOOLSIT: + case UI_CURSOR_TOOLBUY: + case UI_CURSOR_TOOLOPEN: result = setImageCursor(gCursors[cursor]); break; @@ -2924,6 +2930,9 @@ void LLWindowMacOSX::initCursors() initPixmapCursor(UI_CURSOR_TOOLPLAY, 1, 1); initPixmapCursor(UI_CURSOR_TOOLPAUSE, 1, 1); initPixmapCursor(UI_CURSOR_TOOLMEDIAOPEN, 1, 1); + initPixmapCursor(UI_CURSOR_TOOLSIT, 5, 1); + initPixmapCursor(UI_CURSOR_TOOLBUY, 5, 1); + initPixmapCursor(UI_CURSOR_TOOLOPEN, 5, 1); initPixmapCursor(UI_CURSOR_SIZENWSE, 10, 10); initPixmapCursor(UI_CURSOR_SIZENESW, 10, 10); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index c80392ad45..e965a17346 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1545,6 +1545,9 @@ void LLWindowWin32::initCursors() mCursor[ UI_CURSOR_PIPETTE ] = LoadCursor(module, TEXT("TOOLPIPETTE")); // Color cursors + mCursor[UI_CURSOR_TOOLSIT] = loadColorCursor(TEXT("TOOLSIT")); + mCursor[UI_CURSOR_TOOLBUY] = loadColorCursor(TEXT("TOOLBUY")); + mCursor[UI_CURSOR_TOOLOPEN] = loadColorCursor(TEXT("TOOLOPEN")); mCursor[UI_CURSOR_TOOLPLAY] = loadColorCursor(TEXT("TOOLPLAY")); mCursor[UI_CURSOR_TOOLPAUSE] = loadColorCursor(TEXT("TOOLPAUSE")); mCursor[UI_CURSOR_TOOLMEDIAOPEN] = loadColorCursor(TEXT("TOOLMEDIAOPEN")); -- cgit v1.2.3 From 2240ece438880d6d3b72e9fbd3e7dc06295eea79 Mon Sep 17 00:00:00 2001 From: Richard Linden <none@none> Date: Tue, 9 Mar 2010 16:21:52 -0800 Subject: EXT-2418 - improved cursors for sit/open/buy --- indra/llwindow/llwindowmacosx.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index f5c49b819a..224314a490 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -2956,9 +2956,9 @@ void LLWindowMacOSX::initCursors() initPixmapCursor(UI_CURSOR_TOOLPLAY, 1, 1); initPixmapCursor(UI_CURSOR_TOOLPAUSE, 1, 1); initPixmapCursor(UI_CURSOR_TOOLMEDIAOPEN, 1, 1); - initPixmapCursor(UI_CURSOR_TOOLSIT, 5, 1); - initPixmapCursor(UI_CURSOR_TOOLBUY, 5, 1); - initPixmapCursor(UI_CURSOR_TOOLOPEN, 5, 1); + initPixmapCursor(UI_CURSOR_TOOLSIT, 20, 15); + initPixmapCursor(UI_CURSOR_TOOLBUY, 20, 15); + initPixmapCursor(UI_CURSOR_TOOLOPEN, 20, 15); initPixmapCursor(UI_CURSOR_SIZENWSE, 10, 10); initPixmapCursor(UI_CURSOR_SIZENESW, 10, 10); -- cgit v1.2.3 From f6754b9fd09754c7ec9e3d8082631c4fa8151aa7 Mon Sep 17 00:00:00 2001 From: Richard Linden <none@none> Date: Tue, 9 Mar 2010 19:12:43 -0800 Subject: improved mouse cursors (32-bit) --- indra/llwindow/llwindowwin32.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 8a0f8c0514..5f778d6208 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -46,6 +46,7 @@ #include "llerror.h" #include "llgl.h" #include "llstring.h" +#include "lldir.h" // System includes #include <commdlg.h> @@ -1545,9 +1546,11 @@ void LLWindowWin32::initCursors() mCursor[ UI_CURSOR_PIPETTE ] = LoadCursor(module, TEXT("TOOLPIPETTE")); // Color cursors - mCursor[UI_CURSOR_TOOLSIT] = loadColorCursor(TEXT("TOOLSIT")); - mCursor[UI_CURSOR_TOOLBUY] = loadColorCursor(TEXT("TOOLBUY")); - mCursor[UI_CURSOR_TOOLOPEN] = loadColorCursor(TEXT("TOOLOPEN")); + gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "res", "toolbuy.cur"); + + mCursor[UI_CURSOR_TOOLSIT] = LoadCursorFromFile(utf8str_to_utf16str(gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + "res" + gDirUtilp->getDirDelimiter() + "toolsit.cur").c_str()); + mCursor[UI_CURSOR_TOOLBUY] = LoadCursorFromFile(utf8str_to_utf16str(gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + "res" + gDirUtilp->getDirDelimiter() + "toolbuy.cur").c_str()); + mCursor[UI_CURSOR_TOOLOPEN] = LoadCursorFromFile(utf8str_to_utf16str(gDirUtilp->getWorkingDir() + gDirUtilp->getDirDelimiter() + "res" + gDirUtilp->getDirDelimiter() + "toolopen.cur").c_str()); mCursor[UI_CURSOR_TOOLPLAY] = loadColorCursor(TEXT("TOOLPLAY")); mCursor[UI_CURSOR_TOOLPAUSE] = loadColorCursor(TEXT("TOOLPAUSE")); mCursor[UI_CURSOR_TOOLMEDIAOPEN] = loadColorCursor(TEXT("TOOLMEDIAOPEN")); -- cgit v1.2.3 From 9229f09928a6604e7e1646be582e8322fdcca4e9 Mon Sep 17 00:00:00 2001 From: Igor Borovkov <iborovkov@productengine.com> Date: Thu, 18 Mar 2010 16:28:54 +0200 Subject: Backed out changeset a95c1f4dcf02 EXT-4820([NUX] Viewer dimensions on first-run) by which "implemented LLWindowMacOSX::maximize() method" --HG-- branch : product-engine --- indra/llwindow/llwindowmacosx-objc.h | 2 +- indra/llwindow/llwindowmacosx-objc.mm | 10 ---------- indra/llwindow/llwindowmacosx.cpp | 28 +--------------------------- 3 files changed, 2 insertions(+), 38 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index ed8c874dcb..66851300d4 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -41,4 +41,4 @@ CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY); OSErr releaseImageCursor(CursorRef ref); OSErr setImageCursor(CursorRef ref); void getScreenSize(int* width, int* height); -void getVisibleScreen(int *x, int *y, int* width, int* height); + diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 5cab2619fd..6eca24ec1d 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -125,13 +125,3 @@ void getScreenSize(int* width, int* height) [pool release]; } -void getVisibleScreen(int *x, int *y, int* width, int* height) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSRect visible_rect = [[NSScreen mainScreen] visibleFrame]; - if (width) *width = (int)(visible_rect.size.width); - if (height) *height = (int)(visible_rect.size.height); - if (x) *x = (int)(visible_rect.origin.x); - if (y) *y = (int)(visible_rect.origin.y); - [pool release]; -} diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 924acaf148..5b21e06fe2 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1122,33 +1122,7 @@ BOOL LLWindowMacOSX::getMaximized() BOOL LLWindowMacOSX::maximize() { - if (mWindow) - { - // *HACK: Because Mac OSX doesn't have a concept of a "maximized" window, we just - // stretch it out to the visible screen size. - Rect win_rect; - - int visible_x; - int visible_y; - int visible_width; - int visible_height; - int screen_width; - int screen_height; - - getScreenSize(&screen_width, &screen_height); - getVisibleScreen(&visible_x, &visible_y, &visible_width, &visible_height); - - int mac_os_menu_bar_height = screen_height - (visible_height + visible_y); - ::SetRect(&win_rect, - visible_x, - mac_os_menu_bar_height, - visible_width + visible_x, - visible_height + mac_os_menu_bar_height); - - ::SetWindowBounds(mWindow, kWindowStructureRgn, &win_rect); - - return TRUE; - } + // TODO return FALSE; } -- cgit v1.2.3 From 51b69a33aae66ee5880e761694b5ae23d4afc067 Mon Sep 17 00:00:00 2001 From: Igor Borovkov <iborovkov@productengine.com> Date: Thu, 18 Mar 2010 16:30:06 +0200 Subject: Backed out changeset 03b83d14ed74 EXT-4820([NUX] Viewer dimensions on first-run) by which "implemented LLWindowSDL::maximize() method" --HG-- branch : product-engine --- indra/llwindow/llwindowsdl.cpp | 161 +---------------------------------------- 1 file changed, 2 insertions(+), 159 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index cb4e04511c..fe0ada5b09 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -950,68 +950,7 @@ BOOL LLWindowSDL::getMaximized() if (mWindow) { -#if LL_X11 - if (mSDL_Display) - { - maybe_lock_display(); - - // Return data in the specified format, XA_ATOM. - U8* prop; - // Actual format of the property. - int format; - // Actual number of items stored in the prop return data. - unsigned long nitems; - // Number of bytes remaining to be read in the property if a partial read was performed. - unsigned long bytes_after; - // Atom identifier that defines the actual type of the property. - Atom type; - - // Atom used to obtain list of hints describing the window state. - Atom wm_state = XInternAtom(mSDL_Display, "_NET_WM_STATE", False); - - // Atoms indicates that the window is vertically/horizontally maximized. - Atom max_vert = XInternAtom(mSDL_Display, "_NET_WM_STATE_MAXIMIZED_VERT", False); - Atom max_horz = XInternAtom(mSDL_Display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); - - // How many atoms in which we interested are present in list of hints. - U32 pass = 0; - - do - { - nitems = 0; - bytes_after = 0; - type = None; - if ( (XGetWindowProperty (mSDL_Display, - mSDL_XWindowID, - wm_state, - 0, UINT_MAX, - False, XA_ATOM, - &type, &format, - &nitems, &bytes_after, - &prop) == Success) - && type != None ) - { - Atom *atoms = (Atom *)prop; - for (unsigned long i=0; i<nitems; ++i) - { - if (atoms[i] == max_horz) - ++pass; - else if (atoms[i] == max_vert) - ++pass; - } - XFree (atoms); - } - else - { - break; - } - } while (bytes_after > 0); - - result = (pass == 2); - - maybe_unlock_display(); - } -#endif // LL_X11 + // TODO } return(result); @@ -1019,103 +958,7 @@ BOOL LLWindowSDL::getMaximized() BOOL LLWindowSDL::maximize() { -#if LL_X11 - if (mSDL_Display && !mFullscreen) - { - maybe_lock_display(); - - BOOL is_maximize_allowed = FALSE; - - // Check if maximize is allowed - { - // Return data in the specified format, XA_ATOM. - U8* prop; - // Actual format of the property. - int format; - // Actual number of items stored in the prop return data. - unsigned long nitems; - // Number of bytes remaining to be read in the property if a partial read was performed. - unsigned long bytes_after; - // Atom identifier that defines the actual type of the property. - Atom type; - - // Atom used to obtain a list of atoms indicating user operations that the Window Manager supports for this window. - Atom allowed_act = XInternAtom(mSDL_Display, "_NET_WM_ALLOWED_ACTIONS", False); - - // Atoms that indicates that the window may be vertically/horizontally maximized. - Atom max_vert_act = XInternAtom(mSDL_Display, "_NET_WM_ACTION_MAXIMIZE_HORZ", False); - Atom max_horz_act = XInternAtom(mSDL_Display, "_NET_WM_ACTION_MAXIMIZE_VERT", False); - - // How many atoms in which we interested are present in list of hints. - U32 pass = 0; - - do - { - nitems = 0; - bytes_after = 0; - type = None; - if ( (XGetWindowProperty (mSDL_Display, - mSDL_XWindowID, - allowed_act, - 0, UINT_MAX, - False, XA_ATOM, - &type, &format, - &nitems, &bytes_after, - &prop) == Success) - && type != None ) - { - Atom *atoms = (Atom *)prop; - for (unsigned long i=0; i<nitems; ++i) - { - if (atoms[i] == max_vert_act) - ++pass; - else if (atoms[i] == max_horz_act) - ++pass; - } - XFree (atoms); - } - else - { - break; - } - } while (bytes_after > 0); - - is_maximize_allowed = (pass == 2); - } - - // Send maximize event to X11 system - if (is_maximize_allowed) - { - XEvent xev; - - // Atom describing the window state. - Atom wm_state = XInternAtom(mSDL_Display, "_NET_WM_STATE", False); - - // Atoms indicates that the window is vertically/horizontally maximized. - Atom max_vert = XInternAtom(mSDL_Display, "_NET_WM_STATE_MAXIMIZED_VERT", False); - Atom max_horz = XInternAtom(mSDL_Display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); - - memset(&xev, 0, sizeof(xev)); - xev.type = ClientMessage; - xev.xclient.window = mSDL_XWindowID; - xev.xclient.message_type = wm_state; - xev.xclient.format = 32; - xev.xclient.data.l[0] = 1; // add/set property - xev.xclient.data.l[1] = max_vert; - xev.xclient.data.l[2] = max_horz; - xev.xclient.data.l[3] = 0; - xev.xclient.data.l[4] = 0; - - XSendEvent(mSDL_Display, - DefaultRootWindow(mSDL_Display), - False, - SubstructureNotifyMask, &xev); - } - - maybe_unlock_display(); - return is_maximize_allowed; - } -#endif // LL_X11 + // TODO return FALSE; } -- cgit v1.2.3 From c67bc96278ea76372d896fb82fc6f3557feac446 Mon Sep 17 00:00:00 2001 From: Igor Borovkov <iborovkov@productengine.com> Date: Thu, 18 Mar 2010 16:31:09 +0200 Subject: Backed out changeset f4c0761897c6 EXT-4820([NUX] Viewer dimensions on first-run) by which "moved LLDisplayInfo to llwindow, implemented getting the width/height of screen for mac os and linux." --HG-- branch : product-engine --- indra/llwindow/llwindow.cpp | 27 ----------------------- indra/llwindow/llwindow.h | 15 ------------- indra/llwindow/llwindowmacosx-objc.h | 1 - indra/llwindow/llwindowmacosx-objc.mm | 9 -------- indra/llwindow/llwindowmacosx.cpp | 20 ----------------- indra/llwindow/llwindowmacosx.h | 2 -- indra/llwindow/llwindowsdl.cpp | 41 ----------------------------------- indra/llwindow/llwindowsdl.h | 3 --- indra/llwindow/llwindowwin32.cpp | 11 ---------- indra/llwindow/llwindowwin32.h | 3 --- 10 files changed, 132 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index b77deb003f..1c6c9e6e9d 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -407,30 +407,3 @@ BOOL LLWindowManager::isWindowValid(LLWindow *window) { return sWindowList.find(window) != sWindowList.end(); } - -S32 LLDisplayInfo::getDisplayWidth() const -{ -#if LL_WINDOWS - return LLWindowWin32::getDisplayWidth(); -#elif LL_DARWIN - return LLWindowMacOSX::getDisplayWidth(); -#elif LL_SDL - return LLWindowSDL::getDisplayWidth(); -#else - return 1024; //*FIXME -#endif -} - -S32 LLDisplayInfo::getDisplayHeight() const -{ -#if LL_WINDOWS - return LLWindowWin32::getDisplayHeight(); -#elif LL_DARWIN - return LLWindowMacOSX::getDisplayHeight(); -#elif LL_SDL - return LLWindowSDL::getDisplayHeight(); -#else - return 768; //*FIXME -#endif -} - diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index b769f5071b..55b221e716 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -281,19 +281,4 @@ extern const std::string gURLProtocolWhitelistHandler[]; void simpleEscapeString ( std::string& stringIn ); -//============================================================================= -// -// CLASS LLDisplayInfo -class LLDisplayInfo - -/*! @brief Class to query the information about some display settings -*/ -{ -public: - LLDisplayInfo(){}; ///< Default constructor - - S32 getDisplayWidth() const; ///< display width - S32 getDisplayHeight() const; ///< display height -}; - #endif // _LL_window_h_ diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 66851300d4..ed5d7b1e74 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -40,5 +40,4 @@ void setupCocoa(); CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY); OSErr releaseImageCursor(CursorRef ref); OSErr setImageCursor(CursorRef ref); -void getScreenSize(int* width, int* height); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 6eca24ec1d..59b25e1726 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -116,12 +116,3 @@ OSErr setImageCursor(CursorRef ref) return noErr; } -void getScreenSize(int* width, int* height) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSRect screen_rect = [[NSScreen mainScreen] frame]; - if (width) *width = (int)(screen_rect.size.width); - if (height) *height = (int)(screen_rect.size.height); - [pool release]; -} - diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 5b21e06fe2..ad97bc45fc 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -3464,26 +3464,6 @@ MASK LLWindowMacOSX::modifiersToMask(SInt16 modifiers) return mask; } -// static -S32 LLWindowMacOSX::getDisplayWidth() -{ - S32 width = 1024; - // Need to invoke cocoa before use getScreenSize() - setupCocoa(); - getScreenSize(&width, NULL); - return width; -} - -// static -S32 LLWindowMacOSX::getDisplayHeight() -{ - S32 height = 768; - // Need to invoke cocoa before use getScreenSize() - setupCocoa(); - getScreenSize(NULL, &height); - return height; -} - #if LL_OS_DRAGDROP_ENABLED OSErr LLWindowMacOSX::dragTrackingHandler(DragTrackingMessage message, WindowRef theWindow, diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 86036a261c..7c6b324029 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -123,8 +123,6 @@ public: // Provide native key event data /*virtual*/ LLSD getNativeKeyData(); - static S32 getDisplayWidth(); - static S32 getDisplayHeight(); protected: LLWindowMacOSX(LLWindowCallbacks* callbacks, diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index fe0ada5b09..1f705f9e60 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -187,47 +187,6 @@ Display* LLWindowSDL::get_SDL_Display(void) } #endif // LL_X11 -// static -S32 LLWindowSDL::getDisplayWidth() -{ -#if LL_GTK - if (LLWindowSDL::ll_try_gtk_init()) - { - return gdk_screen_width(); - } -#endif // LL_GTK - -#if LL_X11 - Display *display = XOpenDisplay(NULL); - int screen_num = DefaultScreen(display); - S32 width = DisplayWidth(display, screen_num); - XCloseDisplay(display); - return width; -#endif //LL_X11 - - return 1024; -} - -// static -S32 LLWindowSDL::getDisplayHeight() -{ -#if LL_GTK - if (LLWindowSDL::ll_try_gtk_init()) - { - return gdk_screen_height(); - } -#endif // LL_GTK - -#if LL_X11 - Display *display = XOpenDisplay(NULL); - int screen_num = DefaultScreen(display); - S32 height = DisplayHeight(display, screen_num); - XCloseDisplay(display); - return height; -#endif //LL_X11 - - return 768; -} LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, const std::string& title, S32 x, S32 y, S32 width, diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 2311a361fa..e6bdd46a77 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -148,9 +148,6 @@ public: static Display* get_SDL_Display(void); #endif // LL_X11 - static S32 getDisplayWidth(); - static S32 getDisplayHeight(); - protected: LLWindowSDL(LLWindowCallbacks* callbacks, const std::string& title, int x, int y, int width, int height, U32 flags, diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 4be5d06c2b..c80392ad45 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -3714,16 +3714,5 @@ std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList() return std::vector<std::string>(); } -// static -S32 LLWindowWin32::getDisplayWidth() -{ - return ::GetSystemMetrics(SM_CXVIRTUALSCREEN); -} - -// static -S32 LLWindowWin32::getDisplayHeight() -{ - return ::GetSystemMetrics(SM_CYVIRTUALSCREEN); -} #endif // LL_WINDOWS diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index c221ec0192..9d57735772 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -120,9 +120,6 @@ public: static std::vector<std::string> getDynamicFallbackFontList(); - static S32 getDisplayWidth(); - static S32 getDisplayHeight(); - protected: LLWindowWin32(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags, -- cgit v1.2.3