mirror of https://github.com/fltk/fltk
macOS: prevent changing window border while window is fullscreen
This commit is contained in:
parent
0cab095b3c
commit
0ac1379985
|
@ -3403,6 +3403,17 @@ void Fl_Cocoa_Window_Driver::use_border() {
|
|||
if (!shown() || pWindow->parent()) return;
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||
if (fl_mac_os_version >= 100600) {
|
||||
if (pWindow->fullscreen_active()) {
|
||||
// prevent changing border while window is fullscreen
|
||||
static bool active = false;
|
||||
if (!active) {
|
||||
active = true;
|
||||
bool b = !border();
|
||||
pWindow->border(b);
|
||||
active = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
[fl_xid(pWindow) setStyleMask:calc_win_style(pWindow)]; // 10.6
|
||||
if (border()) restore_window_title_and_icon(pWindow, icon_image);
|
||||
pWindow->redraw();
|
||||
|
|
|
@ -174,10 +174,12 @@ void double_cb(Fl_Widget *o, void *p) {
|
|||
void double_cb(Fl_Widget *, void *) {}
|
||||
#endif
|
||||
|
||||
void border_cb(Fl_Widget *o, void *p) {
|
||||
Fl_Window *w = (Fl_Window *)p;
|
||||
int d = ((Fl_Button *)o)->value();
|
||||
|
||||
void border_cb(Fl_Button *b, Fl_Window *w) {
|
||||
int d = b->value();
|
||||
w->border(d);
|
||||
// border change may have been refused (e.g. with fullscreen window)
|
||||
if (w->border() != d) b->value(w->border());
|
||||
}
|
||||
|
||||
|
||||
|
@ -337,7 +339,7 @@ int main(int argc, char **argv) {
|
|||
y+=30;
|
||||
|
||||
Fl_Toggle_Light_Button b2(50,y,window.w()-60,30,"Border");
|
||||
b2.callback(border_cb,w);
|
||||
b2.callback((Fl_Callback*)border_cb,w);
|
||||
b2.set();
|
||||
border_button = &b2;
|
||||
y+=30;
|
||||
|
|
Loading…
Reference in New Issue