Workaround for Alt behaviour on OS X.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4587 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 019d99e..2d197fc 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -539,6 +539,23 @@
     }
   }
 
+#ifdef __APPLE__
+  // Alt on OS X behaves more like AltGr on other systems, and to get
+  // sane behaviour we should translate things in that manner for the
+  // remote VNC server. However that means we lose the ability to use
+  // Alt as a shortcut modifier. Do what RealVNC does and hijack the
+  // left command key as an Alt replacement.
+  switch (keyCode) {
+  case FL_Meta_L:
+    return XK_Alt_L;
+  case FL_Meta_R:
+    return XK_Super_L;
+  case FL_Alt_L:
+  case FL_Alt_R:
+    return XK_ISO_Level3_Shift;
+  }
+#endif
+
   // Then other special keys
   switch (keyCode) {
   case FL_BackSpace: