Browse Source

Rename MonitorArrangement to Fl_Monitor_Arrangement

Follow upstream FLTK naming to more clearly indicate that this is a
general widget and not TigerVNC specific.
pull/1529/head
Pierre Ossman 1 year ago
parent
commit
65c820867d

+ 1
- 1
vncviewer/CMakeLists.txt View File

include_directories(${CMAKE_SOURCE_DIR}/common) include_directories(${CMAKE_SOURCE_DIR}/common)


add_executable(vncviewer add_executable(vncviewer
fltk/MonitorArrangement.cxx
fltk/Fl_Monitor_Arrangement.cxx
fltk/theme.cxx fltk/theme.cxx
menukey.cxx menukey.cxx
BaseTouchHandler.cxx BaseTouchHandler.cxx

+ 2
- 2
vncviewer/OptionsDialog.cxx View File



#include "fltk/layout.h" #include "fltk/layout.h"
#include "fltk/util.h" #include "fltk/util.h"
#include "fltk/MonitorArrangement.h"
#include "fltk/Fl_Monitor_Arrangement.h"


#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Tabs.H> #include <FL/Fl_Tabs.H>
selectedMonitorsButton->callback(handleFullScreenMode, this); selectedMonitorsButton->callback(handleFullScreenMode, this);
ty += RADIO_HEIGHT + TIGHT_MARGIN; ty += RADIO_HEIGHT + TIGHT_MARGIN;


monitorArrangement = new MonitorArrangement(
monitorArrangement = new Fl_Monitor_Arrangement(
tx + INDENT, ty, tx + INDENT, ty,
width - INDENT, 150); width - INDENT, 150);
ty += 150 + TIGHT_MARGIN; ty += 150 + TIGHT_MARGIN;

+ 2
- 2
vncviewer/OptionsDialog.h View File

class Fl_Input; class Fl_Input;
class Fl_Int_Input; class Fl_Int_Input;
class Fl_Choice; class Fl_Choice;
class MonitorArrangement;
class Fl_Monitor_Arrangement;


typedef void (OptionsCallback)(void*); typedef void (OptionsCallback)(void*);


Fl_Round_Button *currentMonitorButton; Fl_Round_Button *currentMonitorButton;
Fl_Round_Button *allMonitorsButton; Fl_Round_Button *allMonitorsButton;
Fl_Round_Button *selectedMonitorsButton; Fl_Round_Button *selectedMonitorsButton;
MonitorArrangement *monitorArrangement;
Fl_Monitor_Arrangement *monitorArrangement;


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

vncviewer/fltk/MonitorArrangement.cxx → vncviewer/fltk/Fl_Monitor_Arrangement.cxx View File

#include <IOKit/hidsystem/IOHIDParameter.h> #include <IOKit/hidsystem/IOHIDParameter.h>
#endif #endif


#include "MonitorArrangement.h"
#include "Fl_Monitor_Arrangement.h"


static std::set<MonitorArrangement *> instances;
static std::set<Fl_Monitor_Arrangement *> instances;
static const Fl_Boxtype FL_CHECKERED_BOX = FL_FREE_BOXTYPE; static const Fl_Boxtype FL_CHECKERED_BOX = FL_FREE_BOXTYPE;


MonitorArrangement::MonitorArrangement(
Fl_Monitor_Arrangement::Fl_Monitor_Arrangement(
int x, int y, int w, int h) int x, int y, int w, int h)
: Fl_Group(x, y, w, h), : Fl_Group(x, y, w, h),
SELECTION_COLOR(fl_lighter(FL_BLUE)), SELECTION_COLOR(fl_lighter(FL_BLUE)),
end(); end();
} }


MonitorArrangement::~MonitorArrangement()
Fl_Monitor_Arrangement::~Fl_Monitor_Arrangement()
{ {
instances.erase(this); instances.erase(this);


Fl::remove_handler(fltk_event_handler); Fl::remove_handler(fltk_event_handler);
} }


std::set<int> MonitorArrangement::get()
std::set<int> Fl_Monitor_Arrangement::get()
{ {
std::set<int> indices; std::set<int> indices;
MonitorMap::const_iterator iter; MonitorMap::const_iterator iter;
return indices; return indices;
} }


void MonitorArrangement::set(std::set<int> indices)
void Fl_Monitor_Arrangement::set(std::set<int> indices)
{ {
MonitorMap::const_iterator iter; MonitorMap::const_iterator iter;


} }
} }


void MonitorArrangement::draw()
void Fl_Monitor_Arrangement::draw()
{ {
MonitorMap::const_iterator iter; MonitorMap::const_iterator iter;


Fl_Group::draw(); Fl_Group::draw();
} }


void MonitorArrangement::layout()
void Fl_Monitor_Arrangement::layout()
{ {
int x, y, w, h; int x, y, w, h;
double scale = this->scale(); double scale = this->scale();
} }
} }


void MonitorArrangement::refresh()
void Fl_Monitor_Arrangement::refresh()
{ {
// The selection state is only saved persistently when "OK" is // The selection state is only saved persistently when "OK" is
// pressed. We need to manually restore the current selection // pressed. We need to manually restore the current selection
redraw(); redraw();
} }


bool MonitorArrangement::is_required(int m)
bool Fl_Monitor_Arrangement::is_required(int m)
{ {
// A selected monitor is never required. // A selected monitor is never required.
if (monitors[m]->value() == 1) if (monitors[m]->value() == 1)
return true; return true;
} }


double MonitorArrangement::scale()
double Fl_Monitor_Arrangement::scale()
{ {
const int MARGIN = 20; const int MARGIN = 20;
std::pair<int, int> size = this->size(); std::pair<int, int> size = this->size();
return s_w; return s_w;
} }


std::pair<int, int> MonitorArrangement::size()
std::pair<int, int> Fl_Monitor_Arrangement::size()
{ {
int x, y, w, h; int x, y, w, h;
int top, bottom, left, right; int top, bottom, left, right;
return std::make_pair(x_max - x_min, y_max - y_min); return std::make_pair(x_max - x_min, y_max - y_min);
} }


std::pair<int, int> MonitorArrangement::offset()
std::pair<int, int> Fl_Monitor_Arrangement::offset()
{ {
double scale = this->scale(); double scale = this->scale();
std::pair<int, int> size = this->size(); std::pair<int, int> size = this->size();
return std::make_pair(offset_x + abs(origin.first)*scale, offset_y + abs(origin.second)*scale); return std::make_pair(offset_x + abs(origin.first)*scale, offset_y + abs(origin.second)*scale);
} }


std::pair<int, int> MonitorArrangement::origin()
std::pair<int, int> Fl_Monitor_Arrangement::origin()
{ {
int x, y, w, h, ox, oy; int x, y, w, h, ox, oy;
ox = oy = 0; ox = oy = 0;
return std::make_pair(ox, oy); return std::make_pair(ox, oy);
} }


std::string MonitorArrangement::description(int m)
std::string Fl_Monitor_Arrangement::description(int m)
{ {
std::string name; std::string name;
int x, y, w, h; int x, y, w, h;
} }
#endif #endif


std::string MonitorArrangement::get_monitor_name(int m)
std::string Fl_Monitor_Arrangement::get_monitor_name(int m)
{ {
#if defined(WIN32) #if defined(WIN32)
std::set<HMONITOR> sys_monitors; std::set<HMONITOR> sys_monitors;
#endif #endif
} }


int MonitorArrangement::fltk_event_handler(int event)
int Fl_Monitor_Arrangement::fltk_event_handler(int event)
{ {
std::set<MonitorArrangement *>::iterator it;
std::set<Fl_Monitor_Arrangement *>::iterator it;


if (event != FL_SCREEN_CONFIGURATION_CHANGED) if (event != FL_SCREEN_CONFIGURATION_CHANGED)
return 0; return 0;
return 0; return 0;
} }


void MonitorArrangement::monitor_pressed(Fl_Widget *widget, void *user_data)
void Fl_Monitor_Arrangement::monitor_pressed(Fl_Widget *widget, void *user_data)
{ {
MonitorArrangement *self = (MonitorArrangement *) user_data;
Fl_Monitor_Arrangement *self = (Fl_Monitor_Arrangement *) user_data;


// When a monitor is selected, FLTK changes the state of it for us. // When a monitor is selected, FLTK changes the state of it for us.
// However, selecting a monitor might implicitly change the state of // However, selecting a monitor might implicitly change the state of
self->redraw(); self->redraw();
} }


void MonitorArrangement::checkered_pattern_draw(
void Fl_Monitor_Arrangement::checkered_pattern_draw(
int x, int y, int width, int height, Fl_Color color) int x, int y, int width, int height, Fl_Color color)
{ {
bool draw_checker = false; bool draw_checker = false;

vncviewer/fltk/MonitorArrangement.h → vncviewer/fltk/Fl_Monitor_Arrangement.h View File

* SOFTWARE. * SOFTWARE.
*/ */


#ifndef __MONITOR_ARRANGEMENT_H__
#define __MONITOR_ARRANGEMENT_H__
#ifndef __FL_MONITOR_ARRANGEMENT_H__
#define __FL_MONITOR_ARRANGEMENT_H__


#include <string> #include <string>
#include <map> #include <map>


class Fl_Button; class Fl_Button;


class MonitorArrangement: public Fl_Group {
class Fl_Monitor_Arrangement: public Fl_Group {
public: public:
MonitorArrangement(int x, int y, int w, int h);
~MonitorArrangement();
Fl_Monitor_Arrangement(int x, int y, int w, int h);
~Fl_Monitor_Arrangement();


// Get selected indices. // Get selected indices.
std::set<int> get(); std::set<int> get();

Loading…
Cancel
Save