A window needs is_resizable() true to obey fullscreen() or maximize()

This commit is contained in:
ManoloFLTK 2024-03-03 17:50:49 +01:00
parent d832ab742a
commit 130f5b6dc1
4 changed files with 10 additions and 7 deletions

View File

@ -503,7 +503,7 @@ int Fl_Screen_Driver::scale_handler(int event)
if (!top->parent() &&
(Fl_Window_Driver::driver(top)->screen_num() == screen ||
screen_dr->rescalable() == SYSTEMWIDE_APP_SCALING)) {
if (Fl_Window_Driver::driver(top)->is_resizable() && (top->fullscreen_active() || top->maximize_active())) return 0;
if (top->fullscreen_active() || top->maximize_active()) return 0;
}
top = Fl::next_window(top);
}

View File

@ -931,7 +931,7 @@ fl_uintptr_t Fl_Window::os_id() { return pWindowDriver->os_id();}
\see Fl_Window::un_maximize(), Fl_Window::maximize_active()
*/
void Fl_Window::maximize() {
if (!shown() || parent() || !resizable() || maximize_active()) return;
if (!shown() || parent() || !is_resizable() || maximize_active()) return;
set_flag(MAXIMIZED);
if (border()) pWindowDriver->maximize();
else pWindowDriver->Fl_Window_Driver::maximize();
@ -942,7 +942,7 @@ void Fl_Window::maximize() {
\see Fl_Window::maximize()
*/
void Fl_Window::un_maximize() {
if (!shown() || parent() || !resizable() || !maximize_active()) return;
if (!shown() || parent() || !is_resizable() || !maximize_active()) return;
clear_flag(MAXIMIZED);
if (border()) pWindowDriver->un_maximize();
else pWindowDriver->Fl_Window_Driver::un_maximize();

View File

@ -36,6 +36,7 @@ void Fl_Window::border(int b) {
borders should not be *visible*.
*/
void Fl_Window::fullscreen() {
if (!is_resizable()) return;
no_fullscreen_x = x();
no_fullscreen_y = y();
no_fullscreen_w = w();

View File

@ -1353,7 +1353,7 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
window->redraw();
}
#endif
if (!window->parent() && window->border()) {
if (!window->parent() && window->border() && Fl_Window_Driver::driver(window)->is_resizable()) {
Fl_Cocoa_Window_Driver::driver(window)->is_maximized([nsw isZoomed]);
}
fl_unlock_function();
@ -3215,7 +3215,7 @@ void Fl_Cocoa_Window_Driver::makeWindow()
void Fl_Cocoa_Window_Driver::fullscreen_on() {
pWindow->_set_fullscreen();
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
if (fl_mac_os_version >= 100700) {
if (fl_mac_os_version >= 100700 && pWindow->border()) {
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
FLWindow *nswin = fl_xid(pWindow);
[nswin toggleFullScreen:nil];
@ -3277,7 +3277,7 @@ static NSUInteger calc_win_style(Fl_Window *win) {
NSUInteger winstyle;
if (win->border() && !win->fullscreen_active()) {
winstyle = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable;
if (win->resizable()) winstyle |= NSWindowStyleMaskResizable;
if (Fl_Window_Driver::driver(win)->is_resizable()) winstyle |= NSWindowStyleMaskResizable;
if (!win->modal()) winstyle |= NSWindowStyleMaskMiniaturizable;
} else winstyle = NSWindowStyleMaskBorderless;
return winstyle;
@ -3301,10 +3301,12 @@ static void restore_window_title_and_icon(Fl_Window *pWindow, NSImage *icon) {
void Fl_Cocoa_Window_Driver::fullscreen_off(int X, int Y, int W, int H) {
pWindow->_clear_fullscreen();
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
if (fl_mac_os_version >= 100700) {
if (fl_mac_os_version >= 100700 && pWindow->border()) {
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
FLWindow *nswin = fl_xid(pWindow);
[nswin toggleFullScreen:nil];
[nswin setStyleMask:calc_win_style(pWindow)]; //10.6
pWindow->resize(*no_fullscreen_x(), *no_fullscreen_y(), *no_fullscreen_w(), *no_fullscreen_h());
# endif
} else if (fl_mac_os_version >= 100600) {
FLWindow *nswin = fl_xid(pWindow);