Browse Source

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
pull/168/head
Michael R Sweet 23 years ago
parent
commit
60a1ae1786
  1. 11
      src/Fl_Window_hotspot.cxx
  2. 21
      src/Fl_mac.cxx

11
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). // Common hotspot routines for the Fast Light Tool Kit (FLTK).
// //
@ -25,10 +25,7 @@
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>
#include <FL/x.H>
#ifdef WIN32
# include <FL/win32.H>
#endif
void Fl_Window::hotspot(int X, int Y, int offscreen) { void Fl_Window::hotspot(int X, int Y, int offscreen) {
int mx,my; 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 // If offscreen is 0 (the default), make sure that the window
// stays on the screen, if possible. // stays on the screen, if possible.
if (!offscreen) { if (!offscreen) {
#ifdef WIN32 #if defined(WIN32) || defined(__APPLE__)
// These will be used by reference, so we must passed different variables // These will be used by reference, so we must passed different variables
int bt,bx,by; int bt,bx,by;
x(X);y(Y); 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 $".
// //

21
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). // MacOS specific code for the Fast Light Tool Kit (FLTK).
// //
@ -45,6 +45,7 @@
#include <config.h> #include <config.h>
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/x.H> #include <FL/x.H>
#include <FL/Fl_Tooltip.H>
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>
#include <FL/Fl_Sys_Menu_Bar.H> #include <FL/Fl_Sys_Menu_Bar.H>
#include <ctype.h> #include <ctype.h>
@ -983,7 +984,7 @@ OSErr dndReceiveHandler( WindowPtr w, void *userData, DragReference dragRef )
*/ */
void Fl_X::make(Fl_Window* w) void Fl_X::make(Fl_Window* w)
{ {
static int xyPos = 24; static int xyPos = 50;
if ( w->parent() ) // create a subwindow if ( w->parent() ) // create a subwindow
{ {
Fl_Group::current(0); Fl_Group::current(0);
@ -1020,7 +1021,6 @@ void Fl_X::make(Fl_Window* w)
int winclass = kDocumentWindowClass; int winclass = kDocumentWindowClass;
int winattr = kWindowCloseBoxAttribute int winattr = kWindowCloseBoxAttribute
| kWindowCollapseBoxAttribute | kWindowCollapseBoxAttribute
| kWindowLiveResizeAttribute
| kWindowStandardHandlerAttribute | kWindowStandardHandlerAttribute
; ;
int xp = w->x(); 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 minw = o->w(); if (minw > 100) minw = 100;
int minh = o->h(); if (minh > 100) minh = 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); w->size_range(w->w() - o->w() + minw, w->h() - o->h() + minh, 0, 0);
winattr |= kWindowFullZoomAttribute | kWindowResizableAttribute; winattr |= kWindowFullZoomAttribute | kWindowResizableAttribute | kWindowLiveResizeAttribute;
} else { } else {
w->size_range(w->w(), w->h(), w->w(), w->h()); 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)) { 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 w->x(xyPos+Fl::x()); w->y(xyPos+Fl::y()); // \todo use the Carbon function for default window positioning
xyPos += 24; xyPos += 25;
if (xyPos>200) xyPos = 24; if (xyPos>200) xyPos = 25;
} else { } else {
if (!Fl::grab()) { if (!Fl::grab()) {
xp = xwm; yp = ywm; xp = xwm; yp = ywm;
@ -1140,7 +1140,10 @@ void Fl_X::make(Fl_Window* w)
if (fl_show_iconic) { if (fl_show_iconic) {
fl_show_iconic = 0; fl_show_iconic = 0;
CollapseWindow( x->xid, true ); // \todo Mac ; untested 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->handle(FL_SHOW);
@ -1214,8 +1217,10 @@ void Fl_Window::show() {
if ( !parent() ) if ( !parent() )
{ {
if ( IsWindowCollapsed( i->xid ) ) CollapseWindow( i->xid, false ); if ( IsWindowCollapsed( i->xid ) ) CollapseWindow( i->xid, false );
if (!fl_capture) if (!fl_capture) {
BringToFront(i->xid); 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 $".
// //

Loading…
Cancel
Save