Divide virtual Fl_Screen_Driver::open_display() in a platform-specific part followed by a platform-independent part.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12245 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
3a390bfb5f
commit
90efebb97e
@ -155,8 +155,10 @@ public:
|
||||
// optional methods to enable/disable input methods for complex scripts
|
||||
virtual void enable_im() {}
|
||||
virtual void disable_im() {}
|
||||
// calls open_display_platform() and then does platform-independent work
|
||||
void open_display();
|
||||
// implement to open access to the display
|
||||
virtual void open_display() {}
|
||||
virtual void open_display_platform() {}
|
||||
// optional method to close display access
|
||||
virtual void close_display() {}
|
||||
// compute dimensions of an Fl_Offscreen
|
||||
|
||||
13
src/Fl.cxx
13
src/Fl.cxx
@ -1978,19 +1978,6 @@ void Fl::disable_im()
|
||||
void fl_open_display()
|
||||
{
|
||||
Fl::screen_driver()->open_display();
|
||||
static bool been_here = false;
|
||||
if (!been_here) {
|
||||
been_here = true;
|
||||
Fl_Screen_Driver *dr = Fl::screen_driver();
|
||||
if (dr->rescalable()) {
|
||||
float factor = dr->default_scale_factor();
|
||||
for (int i = 0; i < dr->screen_count(); i++) dr->scale(i, factor);
|
||||
#if defined(FLTK_HIDPI_SUPPORT) || !(defined(WIN32) || defined(__APPLE__))
|
||||
Fl::add_handler(Fl_Screen_Driver::scale_handler);
|
||||
#endif
|
||||
Fl_Graphics_Driver::default_driver().scale(factor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fl_close_display()
|
||||
|
||||
@ -502,6 +502,23 @@ float Fl_Screen_Driver::default_scale_factor()
|
||||
}
|
||||
|
||||
|
||||
void Fl_Screen_Driver::open_display()
|
||||
{
|
||||
open_display_platform();
|
||||
static bool been_here = false;
|
||||
if (!been_here) {
|
||||
been_here = true;
|
||||
if (rescalable()) {
|
||||
float factor = default_scale_factor();
|
||||
for (int i = 0; i < screen_count(); i++) scale(i, factor);
|
||||
#if defined(FLTK_HIDPI_SUPPORT) || !(defined(WIN32) || defined(__APPLE__))
|
||||
Fl::add_handler(Fl_Screen_Driver::scale_handler);
|
||||
#endif
|
||||
Fl_Graphics_Driver::default_driver().scale(factor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
||||
@ -1703,7 +1703,7 @@ void Fl_Darwin_System_Driver::open_callback(void (*cb)(const char *)) {
|
||||
}
|
||||
*/
|
||||
|
||||
void Fl_Cocoa_Screen_Driver::open_display() {
|
||||
void Fl_Cocoa_Screen_Driver::open_display_platform() {
|
||||
static char beenHereDoneThat = 0;
|
||||
if ( !beenHereDoneThat ) {
|
||||
beenHereDoneThat = 1;
|
||||
|
||||
@ -492,7 +492,7 @@ int Fl_WinAPI_Screen_Driver::ready() {
|
||||
|
||||
//FILE *LOG=fopen("log.log","w");
|
||||
|
||||
void Fl_WinAPI_Screen_Driver::open_display() {
|
||||
void Fl_WinAPI_Screen_Driver::open_display_platform() {
|
||||
static char beenHereDoneThat = 0;
|
||||
|
||||
if (beenHereDoneThat)
|
||||
|
||||
@ -601,7 +601,7 @@ void Fl_X11_Screen_Driver::disable_im() {
|
||||
fl_xim_deactivate();
|
||||
}
|
||||
|
||||
void Fl_X11_Screen_Driver::open_display() {
|
||||
void Fl_X11_Screen_Driver::open_display_platform() {
|
||||
if (fl_display) return;
|
||||
|
||||
setlocale(LC_CTYPE, "");
|
||||
|
||||
@ -93,7 +93,7 @@ public:
|
||||
virtual void get_mouse(int &x, int &y);
|
||||
virtual void enable_im();
|
||||
virtual void disable_im();
|
||||
virtual void open_display();
|
||||
virtual void open_display_platform();
|
||||
// --- compute dimensions of an Fl_Offscreen
|
||||
virtual void offscreen_size(Fl_Offscreen o, int &width, int &height);
|
||||
};
|
||||
|
||||
@ -76,7 +76,7 @@ public:
|
||||
virtual void get_mouse(int &x, int &y);
|
||||
virtual void enable_im();
|
||||
virtual void disable_im();
|
||||
virtual void open_display();
|
||||
virtual void open_display_platform();
|
||||
virtual void offscreen_size(Fl_Offscreen off, int &width, int &height);
|
||||
|
||||
virtual APP_SCALING_CAPABILITY rescalable() { return SYSTEMWIDE_APP_SCALING; }
|
||||
|
||||
@ -99,7 +99,7 @@ public:
|
||||
virtual void get_mouse(int &x, int &y);
|
||||
virtual void enable_im();
|
||||
virtual void disable_im();
|
||||
virtual void open_display();
|
||||
virtual void open_display_platform();
|
||||
virtual void close_display();
|
||||
// --- compute dimensions of an Fl_Offscreen
|
||||
virtual void offscreen_size(Fl_Offscreen o, int &width, int &height);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user