Skip to content

Commit

Permalink
Fix Fl_Cocoa_Screen_Driver::screen_work_area() when the GUI is scaled.
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12669 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Feb 16, 2018
1 parent 0cef82d commit 38b924e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Fl_cocoa.mm
Expand Up @@ -1937,23 +1937,25 @@ static void get_window_frame_sizes(int &bx, int &by, int &bt, Fl_Window *win) {
int Fl_Cocoa_Screen_Driver::y() {
open_display();
NSRect visible = [[[NSScreen screens] objectAtIndex:0] visibleFrame];
return int(main_screen_height - (visible.origin.y + visible.size.height));
return int(main_screen_height - (visible.origin.y + visible.size.height)) / scale(0);
}


/*
* width of work area of menubar-containing display
*/
int Fl_Cocoa_Screen_Driver::w() {
return int([[[NSScreen screens] objectAtIndex:0] visibleFrame].size.width);
open_display();
return int([[[NSScreen screens] objectAtIndex:0] visibleFrame].size.width) / scale(0);
}


/*
* height of work area of menubar-containing display
*/
int Fl_Cocoa_Screen_Driver::h() {
return int([[[NSScreen screens] objectAtIndex:0] visibleFrame].size.height);
open_display();
return int([[[NSScreen screens] objectAtIndex:0] visibleFrame].size.height) / scale(0);
}

// computes the work area of the nth screen (screen #0 has the menubar)
Expand All @@ -1963,10 +1965,10 @@ static void get_window_frame_sizes(int &bx, int &by, int &bt, Fl_Window *win) {
if (n < 0 || n >= num_screens) n = 0;
open_display();
NSRect r = [[[NSScreen screens] objectAtIndex:n] visibleFrame];
X = int(r.origin.x);
Y = main_screen_height - int(r.origin.y + r.size.height);
W = int(r.size.width);
H = int(r.size.height);
X = int(r.origin.x) / scale(0);
Y = (main_screen_height - int(r.origin.y + r.size.height)) / scale(0);
W = int(r.size.width) / scale(0);
H = int(r.size.height) / scale(0);
}

/*
Expand Down

0 comments on commit 38b924e

Please sign in to comment.