aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llwindow/llwindowwin32.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llwindow/llwindowwin32.cpp53
1 files changed, 6 insertions, 47 deletions
diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp
index 7c3ec01..3c2e730 100644
--- a/linden/indra/llwindow/llwindowwin32.cpp
+++ b/linden/indra/llwindow/llwindowwin32.cpp
@@ -54,8 +54,12 @@
54#include "indra_constants.h" 54#include "indra_constants.h"
55 55
56// culled from winuser.h 56// culled from winuser.h
57#ifndef WM_MOUSEWHEEL /* Added to be compatible with later SDK's */
57const S32 WM_MOUSEWHEEL = 0x020A; 58const S32 WM_MOUSEWHEEL = 0x020A;
59#endif
60#ifndef WHEEL_DELTA /* Added to be compatible with later SDK's */
58const S32 WHEEL_DELTA = 120; /* Value for rolling one detent */ 61const S32 WHEEL_DELTA = 120; /* Value for rolling one detent */
62#endif
59const S32 MAX_MESSAGE_PER_UPDATE = 20; 63const S32 MAX_MESSAGE_PER_UPDATE = 20;
60const S32 BITS_PER_PIXEL = 32; 64const S32 BITS_PER_PIXEL = 32;
61const S32 MAX_NUM_RESOLUTIONS = 32; 65const S32 MAX_NUM_RESOLUTIONS = 32;
@@ -1646,7 +1650,7 @@ void LLWindowWin32::setCursor(ECursorType cursor)
1646 } 1650 }
1647} 1651}
1648 1652
1649ECursorType LLWindowWin32::getCursor() 1653ECursorType LLWindowWin32::getCursor() const
1650{ 1654{
1651 return mCurrentCursor; 1655 return mCurrentCursor;
1652} 1656}
@@ -2299,7 +2303,7 @@ BOOL LLWindowWin32::convertCoords(LLCoordGL from, LLCoordScreen *to)
2299 2303
2300BOOL LLWindowWin32::isClipboardTextAvailable() 2304BOOL LLWindowWin32::isClipboardTextAvailable()
2301{ 2305{
2302 return IsClipboardFormatAvailable(CF_UNICODETEXT) || IsClipboardFormatAvailable( CF_TEXT ); 2306 return IsClipboardFormatAvailable(CF_UNICODETEXT);
2303} 2307}
2304 2308
2305 2309
@@ -2326,27 +2330,6 @@ BOOL LLWindowWin32::pasteTextFromClipboard(LLWString &dst)
2326 CloseClipboard(); 2330 CloseClipboard();
2327 } 2331 }
2328 } 2332 }
2329 else if (IsClipboardFormatAvailable(CF_TEXT))
2330 {
2331 // This must be an OLD OS. We don't do non-ASCII for old OSes
2332 if (OpenClipboard(mWindowHandle))
2333 {
2334 HGLOBAL h_data = GetClipboardData(CF_TEXT);
2335 if (h_data)
2336 {
2337 char* str = (char*) GlobalLock(h_data);
2338 if (str)
2339 {
2340 // Strip non-ASCII characters
2341 dst = utf8str_to_wstring(mbcsstring_makeASCII(str));
2342 LLWString::removeCRLF(dst);
2343 GlobalUnlock(h_data);
2344 success = TRUE;
2345 }
2346 }
2347 CloseClipboard();
2348 }
2349 }
2350 2333
2351 return success; 2334 return success;
2352} 2335}
@@ -2383,30 +2366,6 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr)
2383 } 2366 }
2384 } 2367 }
2385 2368
2386 // Also provide a copy as raw ASCII text.
2387 LLWString ascii_string(wstr);
2388 LLWString::_makeASCII(ascii_string);
2389 LLWString::addCRLF(ascii_string);
2390 std::string out_s = wstring_to_utf8str(ascii_string);
2391 const size_t size = (out_s.length() + 1) * sizeof(char);
2392
2393 // Memory is allocated and then ownership of it is transfered to the system.
2394 HGLOBAL hglobal_copy = GlobalAlloc(GMEM_MOVEABLE, size);
2395 if (hglobal_copy)
2396 {
2397 char* copy = (char*) GlobalLock(hglobal_copy);
2398 if( copy )
2399 {
2400 memcpy(copy, out_s.c_str(), size); /* Flawfinder: ignore */
2401 GlobalUnlock(hglobal_copy);
2402
2403 if (SetClipboardData(CF_TEXT, hglobal_copy))
2404 {
2405 success = TRUE;
2406 }
2407 }
2408 }
2409
2410 CloseClipboard(); 2369 CloseClipboard();
2411 } 2370 }
2412 2371