From 4dd2718cd075c1fc5319e892d509a2f72dc39977 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 28 May 2020 12:16:40 +0200 Subject: [PATCH] Restore macOS capacity to turn window fullscreen encompassing several screens. --- src/Fl_cocoa.mm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 4569e7195..28bd2e9e1 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -3090,8 +3090,25 @@ void Fl_Window::fullscreen_x() { [i->xid setStyleMask:NSBorderlessWindowMask]; //10.6 #endif [i->xid setLevel:NSStatusWindowLevel]; - int X,Y,W,H; - Fl::screen_xywh(X, Y, W, H, x(), y(), w(), h()); + int sx, sy, sw, sh, X, Y, W, H; + int top = fullscreen_screen_top; + int bottom = fullscreen_screen_bottom; + int left = fullscreen_screen_left; + int right = fullscreen_screen_right; + if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) { + top = Fl::screen_num(x(), y(), w(), h()); + bottom = top; + left = top; + right = top; + } + Fl::screen_xywh(sx, sy, sw, sh, top); + Y = sy; + Fl::screen_xywh(sx, sy, sw, sh, bottom); + H = sy + sh - Y; + Fl::screen_xywh(sx, sy, sw, sh, left); + X = sx; + Fl::screen_xywh(sx, sy, sw, sh, right); + W = sx + sw - X; resize(X, Y, W, H); } Fl::handle(FL_FULLSCREEN, this);