summaryrefslogtreecommitdiff
path: root/src/Fl_win32.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2017-06-19 17:30:03 +0000
committerManolo Gouy <Manolo>2017-06-19 17:30:03 +0000
commitfa3d8c6259c0326df980f0347a23b68d0620ea92 (patch)
tree79b22579bc305118471b1af54b6d588a9340df5a /src/Fl_win32.cxx
parentcd1fd95f056c726cfd6417f29d5bce00c43b8253 (diff)
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
Diffstat (limited to 'src/Fl_win32.cxx')
-rw-r--r--src/Fl_win32.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index d54504c03..1c62c56ad 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -1676,22 +1676,22 @@ void Fl_WinAPI_Window_Driver::resize(int X,int Y,int W,int H) {
if (resize_from_program && shown()) {
if (!pWindow->resizable()) pWindow->size_range(w(), h(), w(), h());
int dummy_x, dummy_y, bt, bx, by;
- //Ignore window managing when resizing, so that windows (and more
+ // compute window position and size in scaled units
float s = Fl::screen_driver()->scale(screen_num());
- X *= s; Y *= s; W *= s; H *= s;
+ int scaledX = ceil(X*s), scaledY= ceil(Y*s), scaledW = ceil(W*s), scaledH = ceil(H*s);
+ //Ignore window managing when resizing, so that windows (and more
//specifically menus) can be moved offscreen.
if (fake_X_wm(dummy_x, dummy_y, bt, bx, by)) {
- X -= bx;
- Y -= by+bt;
- W += 2*bx;
- H += 2*by+bt;
+ scaledX -= bx;
+ scaledY -= by+bt;
+ scaledW += 2*bx;
+ scaledH += 2*by+bt;
}
// avoid zero size windows. A zero sized window on Win32
// will cause continouly new redraw events.
- if (W<=0) W = 1;
- if (H<=0) H = 1;
- SetWindowPos(fl_xid(pWindow), 0, X, Y, W, H, flags);
-//fprintf(LOG,"parent=%p bt=%d X=%d W=%d H=%d s=%f\n",pWindow->parent(),bt,int(X),int(W),int(H),s);fflush(LOG);
+ if (scaledW<=0) scaledW = 1;
+ if (scaledH<=0) scaledH = 1;
+ SetWindowPos(fl_xid(pWindow), 0, scaledX, scaledY, scaledW, scaledH, flags);
}
}