Fix for issue #123 - macOS platform

This commit is contained in:
ManoloFLTK 2020-11-27 17:49:35 +01:00
parent d851106f47
commit 4291e9497b
1 changed files with 6 additions and 6 deletions

View File

@ -1892,8 +1892,8 @@ static int fake_X_wm(Fl_Window* w,int &X,int &Y, int &bt,int &bx, int &by) {
dx = 2*bx; dx = 2*bx;
dy = 2*by + bt; dy = 2*by + bt;
float s = Fl::screen_driver()->scale(0); float s = Fl::screen_driver()->scale(0);
X = w->x()*s-xoff; X = round(w->x()*s)-xoff;
Y = w->y()*s-yoff; Y = round(w->y()*s)-yoff;
W = w->w()*s+dx; W = w->w()*s+dx;
H = w->h()*s+dy; H = w->h()*s+dy;
@ -3007,8 +3007,8 @@ Fl_X* Fl_Cocoa_Window_Driver::makeWindow()
winlevel = NSStatusWindowLevel; winlevel = NSStatusWindowLevel;
} }
float s = Fl::screen_driver()->scale(0); float s = Fl::screen_driver()->scale(0);
crect.origin.x = int(s * w->x()); // correct origin set later for subwindows crect.origin.x = round(s * w->x()); // correct origin set later for subwindows
crect.origin.y = main_screen_height - int(s * (w->y() + w->h())); crect.origin.y = main_screen_height - round(s * (w->y() + w->h()));
crect.size.width = int(s * w->w()); crect.size.width = int(s * w->w());
crect.size.height = int(s * w->h()); crect.size.height = int(s * w->h());
FLWindow *cw = [[FLWindow alloc] initWithFl_W:w FLWindow *cw = [[FLWindow alloc] initWithFl_W:w
@ -3076,8 +3076,8 @@ Fl_X* Fl_Cocoa_Window_Driver::makeWindow()
delta = [cw cascadeTopLeftFromPoint:delta]; delta = [cw cascadeTopLeftFromPoint:delta];
} }
crect = [cw frame]; // synchronize FLTK's and the system's window coordinates crect = [cw frame]; // synchronize FLTK's and the system's window coordinates
this->x(int(crect.origin.x/s)); this->x(round(crect.origin.x/s));
this->y( main_screen_height/s - (crect.origin.y/s + w->h()) ); this->y( round((main_screen_height - crect.origin.y)/s) - w->h() );
} }
if(w->menu_window()) { // make menu windows slightly transparent if(w->menu_window()) { // make menu windows slightly transparent
[cw setAlphaValue:0.97]; [cw setAlphaValue:0.97];