Revision: 4411
http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4411&view=rev
Author: ossman_
Date: 2011-05-13 12:47:54 +0000 (Fri, 13 May 2011)
Log Message:
-----------
The initial fix for FLTK to handle dead keys broke CJK input, so a new method
had to be devised. Adopt our code to the new version.
Modified Paths:
--------------
trunk/CMakeLists.txt
trunk/vncviewer/Viewport.cxx
Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt 2011-05-13 09:33:51 UTC (rev 4410)
+++ trunk/CMakeLists.txt 2011-05-13 12:47:54 UTC (rev 4411)
@@ -180,7 +180,7 @@
# FLTK STR #2599
set(CMAKE_REQUIRED_INCLUDES ${FLTK_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${FLTK_LIBRARIES})
- check_cxx_source_compiles("#include <FL/Fl.H>\nint main(int c, char** v) {
Fl::event_compose_symbol(); return 0; }" HAVE_FLTK_DEAD_KEYS)
+ check_cxx_source_compiles("#include <FL/Fl_Widget.H>\nint main(int c, char**
v) { void *foo = (void*)&Fl_Widget::set_simple_keyboard; return 0; }"
HAVE_FLTK_DEAD_KEYS)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
endif()
Modified: trunk/vncviewer/Viewport.cxx
===================================================================
--- trunk/vncviewer/Viewport.cxx 2011-05-13 09:33:51 UTC (rev 4410)
+++ trunk/vncviewer/Viewport.cxx 2011-05-13 12:47:54 UTC (rev 4411)
@@ -39,11 +39,6 @@
#include "parameters.h"
#include "keysym2ucs.h"
-// FLTK STR #2599 must be fixed for proper dead keys support
-#ifndef HAVE_FLTK_DEAD_KEYS
-#define event_compose_symbol event_text
-#endif
-
using namespace rfb;
#ifdef __APPLE__
@@ -64,6 +59,11 @@
: Fl_Widget(0, 0, w, h), cc(cc_), frameBuffer(NULL), pixelTrans(NULL),
lastPointerPos(0, 0), lastButtonMask(0)
{
+// FLTK STR #2599 must be fixed for proper dead keys support
+#ifdef HAVE_FLTK_DEAD_KEYS
+ set_simple_keyboard();
+#endif
+
frameBuffer = new ManagedPixelBuffer(getPreferredPF(), w, h);
assert(frameBuffer);
@@ -223,11 +223,11 @@
return 1;
}
- handleKeyEvent(Fl::event_key(), Fl::event_compose_symbol(), true);
+ handleKeyEvent(Fl::event_key(), Fl::event_text(), true);
return 1;
case FL_KEYUP:
- handleKeyEvent(Fl::event_key(), Fl::event_compose_symbol(), false);
+ handleKeyEvent(Fl::event_key(), Fl::event_text(), false);
return 1;
}
@@ -380,80 +380,6 @@
return XK_Multi_key;
}
- // Ctrl and Cmd tend to fudge input handling, so we need to cheat here
- if (Fl::event_state() & (FL_COMMAND | FL_CTRL)) {
-#ifdef WIN32
- BYTE keystate[256];
- WCHAR wbuf[8];
- int ret;
-
- static char buf[32];
-
- switch (fl_msg.message) {
- case WM_KEYDOWN:
- case WM_SYSKEYDOWN:
- // Most buttons end up here when Ctrl is pressed. Here we can pretend
- // that Ctrl isn't pressed, and do a character lookup.
- GetKeyboardState(keystate);
- keystate[VK_CONTROL] = keystate[VK_LCONTROL] = keystate[VK_RCONTROL] = 0;
-
- ret = ToUnicode(fl_msg.wParam, 0, keystate, wbuf,
sizeof(wbuf)/sizeof(wbuf[0]), 0);
- if (ret != 0) {
- // -1 means one dead character
- ret = abs(ret);
- wbuf[ret] = 0x0000;
-
- if (fl_utf8fromwc(buf, sizeof(buf), wbuf, ret) >= sizeof(buf)) {
- vlog.error(_("Out of buffer space whilst converting key event"));
- return XK_VoidSymbol;
- }
-
- keyText = buf;
- }
- break;
- case WM_CHAR:
- case WM_SYSCHAR:
- // Windows doesn't seem to have any sanity when it comes to control
- // characters. We assume that Ctrl-A through Ctrl-Z range maps to
- // the VK_A through VK_Z keys, and just let the rest fall through.
- if ((fl_msg.wParam < 0x01) || (fl_msg.wParam > 0x1a))
- break;
-
- // Pretend that Ctrl isn't pressed, and do a character lookup.
- GetKeyboardState(keystate);
- keystate[VK_CONTROL] = keystate[VK_LCONTROL] = keystate[VK_RCONTROL] = 0;
-
- // Ctrl-A is 0x01 and VK_A is 0x41, so add 0x40 for the conversion
- ret = ToUnicode(fl_msg.wParam + 0x40, 0, keystate, wbuf,
sizeof(wbuf)/sizeof(wbuf[0]), 0);
- if (ret != 0) {
- // -1 means one dead character
- ret = abs(ret);
- wbuf[ret] = 0x0000;
-
- if (fl_utf8fromwc(buf, sizeof(buf), wbuf, ret) >= sizeof(buf)) {
- vlog.error(_("Out of buffer space whilst converting key event"));
- return XK_VoidSymbol;
- }
-
- keyText = buf;
- }
- break;
- default:
- // Not sure how we ended up here. Do nothing...
- break;
- }
-#elif defined(__APPLE__)
- keyText = osx_event_string();
-#else
- char buf[16];
- KeySym sym;
-
- XLookupString((XKeyEvent*)fl_xevent, buf, sizeof(buf), &sym, NULL);
-
- return sym;
-#endif
- }
-
// Unknown special key?
if (keyText[0] == '\0') {
vlog.error(_("Unknown FLTK key code %d (0x%04x)"), keyCode, keyCode);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Tigervnc-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits