diff options
author | Hugo Lundin <hugo@lundin.dev> | 2021-07-13 13:58:12 +0200 |
---|---|---|
committer | Hugo Lundin <hugo@lundin.dev> | 2021-07-16 16:09:45 +0200 |
commit | 0d43b96d1c2385fc8202462cf170d7ac7da5d2f7 (patch) | |
tree | 81c32fb5bf0c0e05918b32e53a36e58a03445ee0 /vncviewer/OptionsDialog.cxx | |
parent | c084e586927ff040014d6a8ea8c519b3a9a368d2 (diff) | |
download | tigervnc-0d43b96d1c2385fc8202462cf170d7ac7da5d2f7.tar.gz tigervnc-0d43b96d1c2385fc8202462cf170d7ac7da5d2f7.zip |
Add fullscreen mode for selected monitors
The user might not always want to use all monitors when in fullscreen
mode, but instead only a few. This commit adds support for configuring
selected monitors from command line, in the config file and graphically
in the options menu.
Because it might be hard to guarantee the consistency of monitor
identifiers coming from third-parties (for example FLTK), it has been
decided to use our own numerical identifier. This identifier is based on
the monitor's positions. The mapping between this identifier and the
indices used by FLTK is done by MonitorIndicesParameter.
Diffstat (limited to 'vncviewer/OptionsDialog.cxx')
-rw-r--r-- | vncviewer/OptionsDialog.cxx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx index cbf4571d..190d8aa3 100644 --- a/vncviewer/OptionsDialog.cxx +++ b/vncviewer/OptionsDialog.cxx @@ -38,6 +38,7 @@ #include "i18n.h" #include "menukey.h" #include "parameters.h" +#include "MonitorArrangement.h" #include <FL/Fl_Tabs.H> #include <FL/Fl_Button.H> @@ -300,11 +301,16 @@ void OptionsDialog::loadOptions(void) if (!strcasecmp(fullScreenMode, "all")) { allMonitorsButton->setonly(); + } else if (!strcasecmp(fullScreenMode, "selected")) { + selectedMonitorsButton->setonly(); } else { currentMonitorButton->setonly(); } + monitorArrangement->set(fullScreenSelectedMonitors.getParam()); + handleDesktopSize(desktopSizeCheckbox, this); + handleFullScreenMode(selectedMonitorsButton, this); /* Misc. */ sharedCheckbox->value(shared); @@ -415,10 +421,14 @@ void OptionsDialog::storeOptions(void) if (allMonitorsButton->value()) { fullScreenMode.setParam("All"); + } else if (selectedMonitorsButton->value()) { + fullScreenMode.setParam("Selected"); } else { fullScreenMode.setParam("Current"); } + fullScreenSelectedMonitors.setParam(monitorArrangement->get()); + /* Misc. */ shared.setParam(sharedCheckbox->value()); dotWhenNoCursor.setParam(dotCursorCheckbox->value()); @@ -812,6 +822,7 @@ void OptionsDialog::createScreenPage(int tx, int ty, int tw, int th) RADIO_HEIGHT, _("Use current monitor"))); currentMonitorButton->type(FL_RADIO_BUTTON); + currentMonitorButton->callback(handleFullScreenMode, this); ty += RADIO_HEIGHT + TIGHT_MARGIN; allMonitorsButton = new Fl_Round_Button(LBLRIGHT(tx, ty, @@ -819,7 +830,29 @@ void OptionsDialog::createScreenPage(int tx, int ty, int tw, int th) RADIO_HEIGHT, _("Use all monitors"))); allMonitorsButton->type(FL_RADIO_BUTTON); + allMonitorsButton->callback(handleFullScreenMode, this); + ty += RADIO_HEIGHT + TIGHT_MARGIN; + + selectedMonitorsButton = new Fl_Round_Button(LBLRIGHT(tx, ty, + RADIO_MIN_WIDTH, + RADIO_HEIGHT, + _("Use selected monitor(s)"))); + selectedMonitorsButton->type(FL_RADIO_BUTTON); + selectedMonitorsButton->callback(handleFullScreenMode, this); ty += RADIO_HEIGHT + TIGHT_MARGIN; + + int full_width = tw - OUTER_MARGIN * 2; + int margin_width = full_width - INDENT - INNER_MARGIN*2; + int full_height = th; + int margin_height = full_height - ty + INNER_MARGIN*3; + + monitorArrangement = new MonitorArrangement( + tx + INDENT, + ty, + margin_width, + margin_height); + + ty += CHECK_HEIGHT + margin_height; } fullScreenModeGroup->end(); @@ -933,6 +966,17 @@ void OptionsDialog::handleClipboard(Fl_Widget *widget, void *data) #endif } +void OptionsDialog::handleFullScreenMode(Fl_Widget *widget, void *data) +{ + OptionsDialog *dialog = (OptionsDialog*)data; + + if (dialog->selectedMonitorsButton->value()) { + dialog->monitorArrangement->activate(); + } else { + dialog->monitorArrangement->deactivate(); + } +} + void OptionsDialog::handleCancel(Fl_Widget *widget, void *data) { OptionsDialog *dialog = (OptionsDialog*)data; |