From 30f4aebe8af22faa6d399396856b640006ad272a Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sun, 16 Jul 2006 20:37:41 +0000 Subject: [PATCH] STR #1341: Fixed Fl_Window::visible() and shown() for OS X git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5257 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 2 ++ src/Fl.cxx | 2 -- src/Fl_mac.cxx | 30 +++++++++++++++++++----------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/CHANGES b/CHANGES index 781abd589..ec9fd44bd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,7 @@ CHANGES IN FLTK 1.1.8 + - Fixed Fl_Window::visible() and shown() for OS X + (STR #1341) - Fixed Fl_Window::copy_label() losing copy (STR #1332) - Documentation fixes (STR #1336, STR #1329, STR #1339, STR #1340) diff --git a/src/Fl.cxx b/src/Fl.cxx index d1a6ee812..922443c6d 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1023,10 +1023,8 @@ int Fl_Window::handle(int ev) } #ifdef __APPLE_QD__ hide(); - set_visible(); #elif defined(__APPLE_QUARTZ__) hide(); - set_visible(); #else XUnmapWindow(fl_display, fl_xid(this)); #endif // __APPLE__ diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index 5c102e32e..15d86f1f9 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -871,6 +871,12 @@ static pascal OSStatus carbonWindowHandler( EventHandlerCallRef nextHandler, Eve if (!Fl_X::first) QuitAppleEventHandler( 0, 0, 0 ); ret = noErr; // returning noErr tells Carbon to stop following up on this event break; + case kEventWindowCollapsed: + window->clear_visible(); + break; + case kEventWindowExpanded: + window->set_visible(); + break; } fl_unlock_function(); @@ -1715,7 +1721,6 @@ void Fl_X::make(Fl_Window* w) x->gc = 0; // stay 0 for Quickdraw; fill with CGContext for Quartz Fl_Window *win = w->window(); Fl_X *xo = Fl_X::i(win); - w->set_visible(); if (xo) { x->xidNext = xo->xidChildren; x->xidChildren = 0L; @@ -1842,7 +1847,6 @@ void Fl_X::make(Fl_Window* w) x->wait_for_expose = 1; x->next = Fl_X::first; Fl_X::first = x; - w->set_visible(); { // Install Carbon Event handlers OSStatus ret; EventHandlerUPP mousewheelHandler = NewEventHandlerUPP( carbonMousewheelHandler ); // will not be disposed by Carbon... @@ -1873,6 +1877,8 @@ void Fl_X::make(Fl_Window* w) { kEventClassWindow, kEventWindowActivated }, { kEventClassWindow, kEventWindowDeactivated }, { kEventClassWindow, kEventWindowClose }, + { kEventClassWindow, kEventWindowCollapsed }, + { kEventClassWindow, kEventWindowExpanded }, { kEventClassWindow, kEventWindowBoundsChanging }, { kEventClassWindow, kEventWindowBoundsChanged } }; ret = InstallWindowEventHandler( x->xid, windowHandler, 8, windowEvents, w, 0L ); @@ -1887,15 +1893,18 @@ void Fl_X::make(Fl_Window* w) if ( err==noErr ) SetFrontProcess( &psn ); } - if (fl_show_iconic) { - fl_show_iconic = 0; - CollapseWindow( x->xid, true ); // \todo Mac ; untested - } else if (winclass != kHelpWindowClass) { - Fl_Tooltip::enter(0); - } - if (w->size_range_set) w->size_range_(); - ShowWindow(x->xid); + + if (winclass != kHelpWindowClass) { + Fl_Tooltip::enter(0); + ShowWindow(x->xid); + if (fl_show_iconic) { + fl_show_iconic = 0; + CollapseWindow( x->xid, true ); // \todo Mac ; untested + } else { + w->set_visible(); + } + } Rect rect; GetWindowBounds(x->xid, kWindowContentRgn, &rect); @@ -1906,7 +1915,6 @@ void Fl_X::make(Fl_Window* w) w->handle(Fl::e_number = FL_SHOW); Fl::e_number = old_event; w->redraw(); // force draw to happen - w->set_visible(); if (w->modal()) { Fl::modal_ = w; fl_fix_focus(); } }