diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 4fa3cfa..6a6e983 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -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);
