From fa3d8c6259c0326df980f0347a23b68d0620ea92 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 19 Jun 2017 17:30:03 +0000 Subject: HiDPI support under WIN32: fix bugs with tile demo and with fullscreen demo. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12268 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index 14a66be1f..9eb7705bc 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -29,6 +29,7 @@ #include "Fl_WinAPI_Window_Driver.H" #include "Fl_WinAPI_Screen_Driver.H" #include +#include // for ceil() #if USE_COLORMAP extern HPALETTE fl_select_palette(void); // in fl_color_win32.cxx @@ -561,16 +562,19 @@ void Fl_WinAPI_Window_Driver::fullscreen_off(int X, int Y, int W, int H) { break; } Fl_X::i(pWindow)->xid = xid; + // compute window position and size in scaled units + float s = Fl::screen_driver()->scale(screen_num()); + int scaledX = ceil(X*s), scaledY= ceil(Y*s), scaledW = ceil(W*s), scaledH = ceil(H*s); // Adjust for decorations (but not if that puts the decorations // outside the screen) if ((X != x()) || (Y != y())) { - X -= bx; - Y -= by+bt; + scaledX -= bx; + scaledY -= by+bt; } - W += bx*2; - H += by*2+bt; + scaledW += bx*2; + scaledH += by*2+bt; SetWindowLong(fl_xid(pWindow), GWL_STYLE, style); - SetWindowPos(fl_xid(pWindow), 0, X, Y, W, H, + SetWindowPos(fl_xid(pWindow), 0, scaledX, scaledY, scaledW, scaledH, SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED); Fl::handle(FL_FULLSCREEN, pWindow); } -- cgit v1.2.3