FLTK logo

[master] 4291e94 - Fix for issue #123 - macOS platform

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 4291e94 - Fix for issue #123 - macOS platform "ManoloFLTK" Nov 27, 2020  
 
commit 4291e9497bb5b0e83abd4e8ea4a15febaef0616a
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Fri Nov 27 17:49:35 2020 +0100
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Fri Nov 27 17:49:49 2020 +0100

    Fix for issue #123 - macOS platform

 src/Fl_cocoa.mm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git src/Fl_cocoa.mm src/Fl_cocoa.mm
index 6fe035c..e67e964 100644
--- src/Fl_cocoa.mm
+++ src/Fl_cocoa.mm
@@ -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;
   dy = 2*by + bt;
   float s = Fl::screen_driver()->scale(0);
-  X = w->x()*s-xoff;
-  Y = w->y()*s-yoff;
+  X = round(w->x()*s)-xoff;
+  Y = round(w->y()*s)-yoff;
   W = w->w()*s+dx;
   H = w->h()*s+dy;
 
@@ -3007,8 +3007,8 @@ Fl_X* Fl_Cocoa_Window_Driver::makeWindow()
     winlevel = NSStatusWindowLevel;
   }
   float s = Fl::screen_driver()->scale(0);
-  crect.origin.x = int(s * w->x()); // correct origin set later for subwindows
-  crect.origin.y = main_screen_height - int(s * (w->y() + w->h()));
+  crect.origin.x = round(s * w->x()); // correct origin set later for subwindows
+  crect.origin.y = main_screen_height - round(s * (w->y() + w->h()));
   crect.size.width = int(s * w->w());
   crect.size.height = int(s * w->h());
   FLWindow *cw = [[FLWindow alloc] initWithFl_W:w
@@ -3076,8 +3076,8 @@ Fl_X* Fl_Cocoa_Window_Driver::makeWindow()
       delta = [cw cascadeTopLeftFromPoint:delta];
     }
     crect = [cw frame]; // synchronize FLTK's and the system's window coordinates
-    this->x(int(crect.origin.x/s));
-    this->y( main_screen_height/s - (crect.origin.y/s + w->h()) );
+    this->x(round(crect.origin.x/s));
+    this->y( round((main_screen_height - crect.origin.y)/s) - w->h() );
   }
   if(w->menu_window()) { // make menu windows slightly transparent
     [cw setAlphaValue:0.97];
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.