]> source.dussan.org Git - tigervnc.git/commitdiff
Release all pressed keys when we lose focus. This is how we've always done it
authorPierre Ossman <ossman@cendio.se>
Thu, 14 Apr 2011 14:10:57 +0000 (14:10 +0000)
committerPierre Ossman <ossman@cendio.se>
Thu, 14 Apr 2011 14:10:57 +0000 (14:10 +0000)
and it has been the most sane approach.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4369 3789f03b-4d11-0410-bbf8-ca57d06f2519

vncviewer/DesktopWindow.cxx

index 4c1775fc5de004e119284e16c8ed98a563d6d5cb..189b5210c9e68f5414dc337142f78ab3e01a3b99 100644 (file)
@@ -185,6 +185,7 @@ void DesktopWindow::draw()
 int DesktopWindow::handle(int event)
 {
   int buttonMask, wheelMask;
+  DownMap::const_iterator iter;
 
   switch (event) {
   case FL_PUSH:
@@ -219,6 +220,14 @@ int DesktopWindow::handle(int event)
     // Yes, we would like some focus please!
     return 1;
 
+  case FL_UNFOCUS:
+    // Release all keys that were pressed as that generally makes most
+    // sense (e.g. Alt+Tab where we only see the Alt press)
+    for (iter = downKeySym.begin();iter != downKeySym.end();++iter)
+      cc->writer()->keyEvent(iter->second, false);
+    downKeySym.clear();
+    return 1;
+
   case FL_KEYDOWN:
     handleKeyEvent(Fl::event_key(), Fl::event_compose_symbol(), true);
     return 1;