From 225c3d6da316838aba9432a319bbdd33da97a001 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Tue, 25 Jul 2017 10:57:24 +0000 Subject: Rewrite Fl_Window_Driver::resize_after_scale_change() removing calls to Fl_Window::hide() and Fl_Window::show(). Windows are now rescaled with a call to Fl_Window::resize() which has been slightly modified. Static member variable bool Fl_Window_Driver::in_resize_after_scale_change is created, and is true if and only if Fl_Window::resize() is called by Fl_Window_Driver::resize_after_scale_change(). This new flag allows Fl_Window::resize() to perform correctly the rescaling of the window. Fl_Gl_Window::resize() and Fl_Double_Window::resize() also consult the value of the Fl_Window_Driver::in_resize_after_scale_change flag. The platform-specific Fl_WinAPI_Window_Driver::resize() and Fl_X11_Window_Driver::resize() also use the Fl_Window_Driver::in_resize_after_scale_change flag. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12349 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Window_Driver.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/Fl_Window_Driver.cxx') diff --git a/src/Fl_Window_Driver.cxx b/src/Fl_Window_Driver.cxx index 07fbef967..f294a50cb 100644 --- a/src/Fl_Window_Driver.cxx +++ b/src/Fl_Window_Driver.cxx @@ -260,21 +260,21 @@ int Fl_Window_Driver::screen_num() { return Fl::screen_num(x(), y(), w(), h()); } +bool Fl_Window_Driver::in_resize_after_scale_change = false; + void Fl_Window_Driver::resize_after_scale_change(int ns, float old_f, float new_f) { - int oldx = pWindow->x(), oldy = pWindow->y(); - fl_uintptr_t current = current_cursor(); - pWindow->hide(); screen_num(ns); - pWindow->position(oldx*old_f/new_f, oldy*old_f/new_f); - force_position(1); + Fl_Graphics_Driver::default_driver().scale(new_f); + int W, H; if (pWindow->fullscreen_active()) { - pWindow->size(pWindow->w() * old_f/new_f, pWindow->h() * old_f/new_f); + W = pWindow->w() * old_f/new_f; H = pWindow->h() * old_f/new_f; + } else { + W = pWindow->w(); H = pWindow->h(); } - Fl_Graphics_Driver::default_driver().scale(new_f); - pWindow->show(); - reuse_cursor(current); - reuse_icons(); -//extern FILE*LOG;fprintf(LOG,"ns=%d old_f%.2f new_f=%.2f\n",ns,old_f,new_f);fflush(LOG); + in_resize_after_scale_change = true; + pWindow->resize(pWindow->x()*old_f/new_f, pWindow->y()*old_f/new_f, W, H); + size_range(); + in_resize_after_scale_change = false; } // -- cgit v1.2.3