diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2006-08-29 11:03:05 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2006-08-29 11:03:05 +0000 |
| commit | 7ae0ff02404e602e0929e82fb11364a4a684ee10 (patch) | |
| tree | 948388e97d98417addb4c5e1338388a7509d97fc /src/Fl_mac.cxx | |
| parent | 00ec9da8f5cf0f37f3c64e0a45b4046f86153765 (diff) | |
Updated OSX subwindow simulation code to better add and remove from the clipping list
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5379 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_mac.cxx')
| -rw-r--r-- | src/Fl_mac.cxx | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index 001c58794..8bc32f085 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -2321,7 +2321,67 @@ void Fl::remove_timeout(Fl_Timeout_Handler cb, void* data) } } +int MacUnlinkWindow(Fl_X *ip, Fl_X *start) { + if (!ip) return 0; + if (start) { + Fl_X *pc = start; + while (pc) { + if (pc->xidNext == ip) { + pc->xidNext = ip->xidNext; + return 1; + } + if (pc->xidChildren) { + if (pc->xidChildren == ip) { + pc->xidChildren = ip->xidNext; + return 1; + } + if (MacUnlinkWindow(ip, pc->xidChildren)) + return 1; + } + pc = pc->xidNext; + } + } else { + for ( Fl_X *pc = Fl_X::first; pc; pc = pc->next ) { + if (MacUnlinkWindow(ip, pc)) + return 1; + } + } + return 0; +} + +static void MacRelinkWindow(Fl_X *x, Fl_X *p) { + if (!x || !p) return; + // first, check if 'x' is already registered as a child of 'p' + for (Fl_X *i = p->xidChildren; i; i=i->xidNext) { + if (i == x) return; + } + // now add 'x' as the first child of 'p' + x->xidNext = p->xidChildren; + p->xidChildren = x; +} + +void MacDestroyWindow(Fl_Window *w, WindowPtr p) { + MacUnmapWindow(w, p); + if (w && !w->parent() && p) + DisposeWindow(p); +} +void MacMapWindow(Fl_Window *w, WindowPtr p) { + if (w && p) + ShowWindow(p); + //+ link to window list + if (w && w->parent()) { + MacRelinkWindow(Fl_X::i(w), Fl_X::i(w->window())); + w->redraw(); + } +} + +void MacUnmapWindow(Fl_Window *w, WindowPtr p) { + if (w && !w->parent() && p) + HideWindow(p); + if (w && Fl_X::i(w)) + MacUnlinkWindow(Fl_X::i(w)); +} // // End of "$Id$". |
