aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer/Viewport.cxx
diff options
context:
space:
mode:
authorHenrik Andersson <henrik.andersson@cendio.com>2011-09-14 06:31:06 +0000
committerHenrik Andersson <henrik.andersson@cendio.com>2011-09-14 06:31:06 +0000
commitabd70ceddebe90a8c7fb3d7055eb771ed3a37f2f (patch)
tree2553e29a63481794bb8700aca063eb48fc525b0d /vncviewer/Viewport.cxx
parent9144ae00636348c4c504095203e92ea4b660ccb4 (diff)
downloadtigervnc-abd70ceddebe90a8c7fb3d7055eb771ed3a37f2f.tar.gz
tigervnc-abd70ceddebe90a8c7fb3d7055eb771ed3a37f2f.zip
- Changes behaviour of context menu to be reinitialize
before display with intial states. - Fixes for fullscreen contextmenu item to show the current fullscreen state as it was done in the old viewer. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4670 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer/Viewport.cxx')
-rw-r--r--vncviewer/Viewport.cxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 052b593b..5fd873cb 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -98,7 +98,6 @@ Viewport::Viewport(int w, int h, const rfb::PixelFormat& serverPF, CConn* cc_)
window()->add(contextMenu);
setMenuKey();
- initContextMenu();
OptionsDialog::addCallback(handleOptions, this);
}
@@ -843,11 +842,14 @@ void Viewport::initContextMenu()
contextMenu->add(_("Exit viewer"), 0, NULL, (void*)ID_EXIT, FL_MENU_DIVIDER);
#ifdef HAVE_FLTK_FULLSCREEN
- contextMenu->add(_("Full screen"), 0, NULL, (void*)ID_FULLSCREEN, FL_MENU_DIVIDER);
+ contextMenu->add(_("Full screen"), 0, NULL, (void*)ID_FULLSCREEN,
+ FL_MENU_TOGGLE | (window()->fullscreen_active()?FL_MENU_VALUE:0));
#endif
- contextMenu->add(_("Ctrl"), 0, NULL, (void*)ID_CTRL, FL_MENU_TOGGLE);
- contextMenu->add(_("Alt"), 0, NULL, (void*)ID_ALT, FL_MENU_TOGGLE);
+ contextMenu->add(_("Ctrl"), 0, NULL, (void*)ID_CTRL,
+ FL_MENU_TOGGLE | (menuCtrlKey?FL_MENU_VALUE:0));
+ contextMenu->add(_("Alt"), 0, NULL, (void*)ID_ALT,
+ FL_MENU_TOGGLE | (menuAltKey?FL_MENU_VALUE:0));
if (menuKeyCode) {
char sendMenuKey[64];
@@ -877,6 +879,9 @@ void Viewport::popupContextMenu()
// it will start up highlighting the previously selected entry.
contextMenu->value(-1);
+ // initialize context menu before display
+ initContextMenu();
+
m = contextMenu->popup();
if (m == NULL)
return;
@@ -898,9 +903,11 @@ void Viewport::popupContextMenu()
#endif
case ID_CTRL:
handleKeyEvent(FL_Control_L, FL_Control_L, "", m->value());
+ menuCtrlKey = !menuCtrlKey;
break;
case ID_ALT:
handleKeyEvent(FL_Alt_L, FL_Alt_L, "", m->value());
+ menuAltKey = !menuAltKey;
break;
case ID_MENUKEY:
handleKeyEvent(menuKeyCode, menuKeyCode, "", true);
@@ -940,10 +947,6 @@ void Viewport::popupContextMenu()
void Viewport::setMenuKey()
{
menuKeyCode = getMenuKeyCode();
-
- // Need to repopulate the context menu as it contains references to
- // the menu key
- initContextMenu();
}