Dear Tigervnc-developers,

I would like to know if it would be possible to integrate the functionality
provided by the attached patch (I know it is a hack, so it would need to be
done correctly) to a future stock tigervnc-release.

It assigns the grab_keyboard() function directly on the key "CONTROL_R" or
"META_L" for fast access.
This function is so much needed for me and my colleagues that I can not
imagine that it is not useful for others.
If you use a window manager like awesome then you need it....

Thanks a lot,

Michael
--- tigervnc-1.3.0/vncviewer/DesktopWindow.cxx	2013-07-01 14:42:06.000000000 +0200
+++ ../tigervnc-1.3.0/vncviewer/DesktopWindow.cxx	2013-11-02 04:51:44.447096532 +0100
@@ -59,6 +59,9 @@ DesktopWindow::DesktopWindow(int w, int
   : Fl_Window(w, h), cc(cc_), firstUpdate(true),
     delayedFullscreen(false), delayedDesktopSize(false)
 {
+  
+  grab_keyboard_state = 0;
+
   scroll = new Fl_Scroll(0, 0, w, h);
   scroll->color(FL_BLACK);
 
@@ -449,8 +452,10 @@ int DesktopWindow::fltkHandle(int event,
       //        a) Fl::grab(0) on X11 will release the keyboard grab for us.
       //        b) Gaining focus on the system level causes FLTK to switch
       //           window level on OS X.
-      if (dw->fullscreen_active())
+      if (dw->fullscreen_active()) {
         dw->grabKeyboard();
+	dw->grab_keyboard_state = 1;
+      }
       break;
 
     case FL_UNFOCUS:
@@ -458,6 +463,7 @@ int DesktopWindow::fltkHandle(int event,
       //        focus as it is very tied to this specific window on some
       //        platforms and we want to be able to open subwindows.
       dw->ungrabKeyboard();
+      dw->grab_keyboard_state = 0;
       break;
     }
   }
--- tigervnc-1.3.0/vncviewer/DesktopWindow.h	2013-07-01 14:42:05.000000000 +0200
+++ ../tigervnc-1.3.0/vncviewer/DesktopWindow.h	2013-11-02 04:53:30.975097085 +0100
@@ -81,12 +81,15 @@ public:
 
   void fullscreen_on();
 
-private:
-  static int fltkHandle(int event, Fl_Window *win);
+  int grab_keyboard_state;
 
   void grabKeyboard();
   void ungrabKeyboard();
 
+private:
+  static int fltkHandle(int event, Fl_Window *win);
+
+
   static void handleGrab(void *data);
 
   void maximizeWindow();
@@ -113,6 +116,9 @@ private:
   bool firstUpdate;
   bool delayedFullscreen;
   bool delayedDesktopSize;
+
+
+
 };
 
 #endif
--- tigervnc-1.3.0/vncviewer/Viewport.cxx	2013-07-01 14:42:05.000000000 +0200
+++ ../tigervnc-1.3.0/vncviewer/Viewport.cxx	2013-11-02 04:56:05.376802328 +0100
@@ -356,6 +356,8 @@ int Viewport::handle(int event)
   int buttonMask, wheelMask;
   DownMap::const_iterator iter;
 
+  DesktopWindow *dw = dynamic_cast<DesktopWindow*>(window());
+
   switch (event) {
   case FL_PASTE:
     buffer = new char[Fl::event_length() + 1];
@@ -434,9 +436,27 @@ int Viewport::handle(int event)
     while (!downKeySym.empty())
       handleKeyEvent(downKeySym.begin()->first, downKeySym.begin()->first,
                      "", false);
+    dw->ungrabKeyboard();
+    dw->fullscreen_off();
+
     return 1;
 
   case FL_KEYDOWN:
+    // Code to use Control_R as a grabKeyboard shortcut, as in remmina
+    if (menuKeyCode && (Fl::event_key() == (hostKeyMetaL ? FL_Meta_L : FL_Control_R)  ) ) {
+      if(dw->grab_keyboard_state == 0) {
+	dw->grab_keyboard_state = 1;
+	dw->grabKeyboard();
+      } 
+      else  {
+	dw->grab_keyboard_state = 0;
+	dw->fullscreen_off();
+	dw->ungrabKeyboard();
+      }
+      //window()->fullscreen_off();
+      vlog.debug("keyboard_grab key (ctrl-right) hit, keyboard grab state: %d\n", dw->grab_keyboard_state);
+    }
+    
     if (menuKeyCode && (Fl::event_key() == menuKeyCode)) {
       popupContextMenu();
       return 1;
--- tigervnc-1.3.0/vncviewer/parameters.cxx	2013-07-01 16:00:00.000000000 +0200
+++ ../tigervnc-1.3.0/vncviewer/parameters.cxx	2013-11-02 04:57:22.692802730 +0100
@@ -127,6 +127,10 @@ BoolParameter sendPrimary("SendPrimary",
                           "Send the primary selection and cut buffer to the "
                           "server as well as the clipboard selection",
                           true);
+BoolParameter hostKeyMetaL("HostKeyMetaL",
+			   "Use the MetaL (Windows-Key) instead of "
+			   "Control_R as the host key (grabKeyboard shortcut)",
+			   false);
 
 StringParameter menuKey("MenuKey", "The key which brings up the popup menu",
                         "F8");
@@ -171,6 +175,7 @@ VoidParameter* parameterArray[] = {
   &acceptClipboard,
   &sendClipboard,
   &sendPrimary,
+  &hostKeyMetaL,
   &menuKey,
   &fullscreenSystemKeys
 };
--- tigervnc-1.3.0/vncviewer/parameters.h	2013-07-01 14:42:06.000000000 +0200
+++ ../tigervnc-1.3.0/vncviewer/parameters.h	2013-11-02 04:57:48.371802864 +0100
@@ -58,6 +58,8 @@ extern rfb::BoolParameter acceptClipboar
 extern rfb::BoolParameter sendClipboard;
 extern rfb::BoolParameter sendPrimary;
 
+extern rfb::BoolParameter hostKeyMetaL;
+
 extern rfb::StringParameter menuKey;
 
 extern rfb::BoolParameter fullscreenSystemKeys;
------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

Reply via email to