From 60a1ae17865309b13c96080631678448e4880287 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Mon, 15 Apr 2002 20:30:06 +0000 Subject: [PATCH] Make sure that hotspotted windows stay on the screen under MacOS X. Hide any tooltip when showing a window under MacOS (window manager strangeness...) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2086 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Window_hotspot.cxx | 11 ++++------- src/Fl_mac.cxx | 25 +++++++++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Fl_Window_hotspot.cxx b/src/Fl_Window_hotspot.cxx index 373860004..5afcacb3b 100644 --- a/src/Fl_Window_hotspot.cxx +++ b/src/Fl_Window_hotspot.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Window_hotspot.cxx,v 1.7.2.3.2.2 2002/01/01 15:11:31 easysw Exp $" +// "$Id: Fl_Window_hotspot.cxx,v 1.7.2.3.2.3 2002/04/15 20:30:06 easysw Exp $" // // Common hotspot routines for the Fast Light Tool Kit (FLTK). // @@ -25,10 +25,7 @@ #include #include - -#ifdef WIN32 -# include -#endif +#include void Fl_Window::hotspot(int X, int Y, int offscreen) { int mx,my; @@ -40,7 +37,7 @@ void Fl_Window::hotspot(int X, int Y, int offscreen) { // If offscreen is 0 (the default), make sure that the window // stays on the screen, if possible. if (!offscreen) { -#ifdef WIN32 +#if defined(WIN32) || defined(__APPLE__) // These will be used by reference, so we must passed different variables int bt,bx,by; x(X);y(Y); @@ -83,5 +80,5 @@ void Fl_Window::hotspot(const Fl_Widget *o, int offscreen) { // -// End of "$Id: Fl_Window_hotspot.cxx,v 1.7.2.3.2.2 2002/01/01 15:11:31 easysw Exp $". +// End of "$Id: Fl_Window_hotspot.cxx,v 1.7.2.3.2.3 2002/04/15 20:30:06 easysw Exp $". // diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index 55e9854c2..9f5f280bd 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_mac.cxx,v 1.1.2.20 2002/04/13 20:28:51 easysw Exp $" +// "$Id: Fl_mac.cxx,v 1.1.2.21 2002/04/15 20:30:06 easysw Exp $" // // MacOS specific code for the Fast Light Tool Kit (FLTK). // @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -983,7 +984,7 @@ OSErr dndReceiveHandler( WindowPtr w, void *userData, DragReference dragRef ) */ void Fl_X::make(Fl_Window* w) { - static int xyPos = 24; + static int xyPos = 50; if ( w->parent() ) // create a subwindow { Fl_Group::current(0); @@ -1020,7 +1021,6 @@ void Fl_X::make(Fl_Window* w) int winclass = kDocumentWindowClass; int winattr = kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute - | kWindowLiveResizeAttribute | kWindowStandardHandlerAttribute ; int xp = w->x(); @@ -1035,7 +1035,7 @@ void Fl_X::make(Fl_Window* w) int minw = o->w(); if (minw > 100) minw = 100; int minh = o->h(); if (minh > 100) minh = 100; w->size_range(w->w() - o->w() + minw, w->h() - o->h() + minh, 0, 0); - winattr |= kWindowFullZoomAttribute | kWindowResizableAttribute; + winattr |= kWindowFullZoomAttribute | kWindowResizableAttribute | kWindowLiveResizeAttribute; } else { w->size_range(w->w(), w->h(), w->w(), w->h()); } @@ -1053,8 +1053,8 @@ void Fl_X::make(Fl_Window* w) } if (!(w->flags() & Fl_Window::FL_FORCE_POSITION)) { w->x(xyPos+Fl::x()); w->y(xyPos+Fl::y()); // \todo use the Carbon function for default window positioning - xyPos += 24; - if (xyPos>200) xyPos = 24; + xyPos += 25; + if (xyPos>200) xyPos = 25; } else { if (!Fl::grab()) { xp = xwm; yp = ywm; @@ -1137,11 +1137,14 @@ void Fl_X::make(Fl_Window* w) if ( err==noErr ) SetFrontProcess( &psn ); } - if ( fl_show_iconic ) { + if (fl_show_iconic) { fl_show_iconic = 0; CollapseWindow( x->xid, true ); // \todo Mac ; untested + } else if (winclass != kHelpWindowClass) { + Fl_Tooltip::enter(0); } - ShowWindow( x->xid ); + + ShowWindow(x->xid); w->handle(FL_SHOW); w->redraw(); // force draw to happen @@ -1214,8 +1217,10 @@ void Fl_Window::show() { if ( !parent() ) { if ( IsWindowCollapsed( i->xid ) ) CollapseWindow( i->xid, false ); - if (!fl_capture) + if (!fl_capture) { BringToFront(i->xid); + SelectWindow(i->xid); + } } } } @@ -1359,6 +1364,6 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) { // -// End of "$Id: Fl_mac.cxx,v 1.1.2.20 2002/04/13 20:28:51 easysw Exp $". +// End of "$Id: Fl_mac.cxx,v 1.1.2.21 2002/04/15 20:30:06 easysw Exp $". //