Updated bundled fltk with latest set of patches for
following fltk str: 2660, 2636, 2599, 2641...
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4675 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/fltk/src/Fl_win32.cxx b/common/fltk/src/Fl_win32.cxx
index b36f307..7fc639e 100644
--- a/common/fltk/src/Fl_win32.cxx
+++ b/common/fltk/src/Fl_win32.cxx
@@ -1179,7 +1179,7 @@
// Pressing Ctrl wreaks havoc with the symbol lookup, so turn that off.
// But AltGr shows up as Ctrl+Alt in Windows, so keep Ctrl if Alt is
// active.
- if (!(keystate[VK_MENU] & (1<<31)))
+ if (!(keystate[VK_MENU] & 0x80))
keystate[VK_CONTROL] = keystate[VK_LCONTROL] = keystate[VK_RCONTROL] = 0;
// We cannot inspect or modify Windows' internal state of the keyboard
@@ -1776,6 +1776,7 @@
x->region = 0;
x->private_dc = 0;
x->cursor = LoadCursor(NULL, IDC_ARROW);
+ x->custom_cursor = 0;
if (!fl_codepage) fl_get_codepage();
WCHAR *lab = NULL;
@@ -2033,9 +2034,10 @@
int Fl_X::set_cursor(Fl_Cursor c) {
LPSTR n;
+ HCURSOR new_cursor;
if (c == FL_CURSOR_NONE)
- cursor = NULL;
+ new_cursor = NULL;
else {
switch (c) {
case FL_CURSOR_ARROW: n = IDC_ARROW; break;
@@ -2065,11 +2067,17 @@
return 0;
}
- cursor = LoadCursor(NULL, n);
- if (cursor == NULL)
+ new_cursor = LoadCursor(NULL, n);
+ if (new_cursor == NULL)
return 0;
}
+ if ((cursor != NULL) && custom_cursor)
+ DestroyIcon(cursor);
+
+ cursor = new_cursor;
+ custom_cursor = 0;
+
SetCursor(cursor);
return 1;
@@ -2079,6 +2087,7 @@
BITMAPV5HEADER bi;
HBITMAP bitmap, mask;
DWORD *bits;
+ HCURSOR new_cursor;
if ((hotx < 0) || (hotx >= image->w()))
return 0;
@@ -2089,7 +2098,7 @@
bi.bV5Size = sizeof(BITMAPV5HEADER);
bi.bV5Width = image->w();
- bi.bV5Height = image->h();
+ bi.bV5Height = -image->h(); // Negative for top-down
bi.bV5Planes = 1;
bi.bV5BitCount = 32;
bi.bV5Compression = BI_BITFIELDS;
@@ -2104,6 +2113,9 @@
bitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
ReleaseDC(NULL, hdc);
+ if (bits == NULL)
+ return 0;
+
const uchar *i = (const uchar*)*image->data();
for (int y = 0;y < image->h();y++) {
for (int x = 0;x < image->w();x++) {
@@ -2129,6 +2141,10 @@
// A mask bitmap is still needed even though it isn't used
mask = CreateBitmap(image->w(),image->h(),1,1,NULL);
+ if (mask == NULL) {
+ DeleteObject(bitmap);
+ return 0;
+ }
ICONINFO ii;
@@ -2138,11 +2154,20 @@
ii.hbmMask = mask;
ii.hbmColor = bitmap;
- cursor = CreateIconIndirect(&ii);
+ new_cursor = CreateIconIndirect(&ii);
DeleteObject(bitmap);
DeleteObject(mask);
+ if (new_cursor == NULL)
+ return 0;
+
+ if ((cursor != NULL) && custom_cursor)
+ DestroyIcon(cursor);
+
+ cursor = new_cursor;
+ custom_cursor = 1;
+
SetCursor(cursor);
return 1;