Browse Source

Merge pull request #1405 from TigerVNC/monitorArrangementSync

Update MonitorArrangement widget to match parameter settings after screen configuration change
tags/v1.12.90
Samuel Mannehed 2 years ago
parent
commit
eee6638e77
No account linked to committer's email address
2 changed files with 41 additions and 1 deletions
  1. 37
    1
      vncviewer/OptionsDialog.cxx
  2. 4
    0
      vncviewer/OptionsDialog.h

+ 37
- 1
vncviewer/OptionsDialog.cxx View File

#include <config.h> #include <config.h>
#endif #endif


#include <assert.h>
#include <stdlib.h> #include <stdlib.h>

#include <list> #include <list>


#include <rdr/types.h> #include <rdr/types.h>
#include "parameters.h" #include "parameters.h"
#include "MonitorArrangement.h" #include "MonitorArrangement.h"


#include <FL/Fl.H>
#include <FL/Fl_Tabs.H> #include <FL/Fl_Tabs.H>
#include <FL/Fl_Button.H> #include <FL/Fl_Button.H>
#include <FL/Fl_Check_Button.H> #include <FL/Fl_Check_Button.H>


std::map<OptionsCallback*, void*> OptionsDialog::callbacks; std::map<OptionsCallback*, void*> OptionsDialog::callbacks;


static std::set<OptionsDialog *> instances;

OptionsDialog::OptionsDialog() OptionsDialog::OptionsDialog()
: Fl_Window(450, 460, _("VNC Viewer: Connection Options")) : Fl_Window(450, 460, _("VNC Viewer: Connection Options"))
{ {
callback(this->handleCancel, this); callback(this->handleCancel, this);


set_modal(); set_modal();

if (instances.size() == 0)
Fl::add_handler(fltk_event_handler);
instances.insert(this);
} }




OptionsDialog::~OptionsDialog() OptionsDialog::~OptionsDialog()
{ {
instances.erase(this);

if (instances.size() == 0)
Fl::remove_handler(fltk_event_handler);
} }






dialog->storeOptions(); dialog->storeOptions();
} }

int OptionsDialog::fltk_event_handler(int event)
{
std::set<OptionsDialog *>::iterator iter;

if (event != FL_SCREEN_CONFIGURATION_CHANGED)
return 0;

// Refresh monitor arrangement widget to match the parameter settings after
// screen configuration has changed. The MonitorArrangement index doesn't work
// the same way as the FLTK screen index.
for (iter = instances.begin(); iter != instances.end(); iter++)
Fl::add_timeout(0, handleScreenConfigTimeout, (*iter));

return 0;
}

void OptionsDialog::handleScreenConfigTimeout(void *data)
{
OptionsDialog *self = (OptionsDialog *)data;

assert(self);

self->monitorArrangement->set(fullScreenSelectedMonitors.getParam());
}

+ 4
- 0
vncviewer/OptionsDialog.h View File

/* Misc. */ /* Misc. */
Fl_Check_Button *sharedCheckbox; Fl_Check_Button *sharedCheckbox;
Fl_Check_Button *reconnectCheckbox; Fl_Check_Button *reconnectCheckbox;

private:
static int fltk_event_handler(int event);
static void handleScreenConfigTimeout(void *data);
}; };


#endif #endif

Loading…
Cancel
Save