OS X: some changes to support Apples ProjectBuilder.

OS X: FLTK now queries the true windows position from the
window manager after creating a new window. This fixes the
problem with popup menues showing up at the wrong position.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3067 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher
2003-08-02 05:54:43 +00:00
parent 111cbdb0b0
commit c2e8891693
5 changed files with 45 additions and 11 deletions
+5
View File
@@ -1,5 +1,10 @@
CHANGES IN FLTK 1.1.4rc2 CHANGES IN FLTK 1.1.4rc2
- OS X: some changes to make ProjectBuilder compiles
possible. I'll add the PB project files later.
- OS X: FLTK would not know where a window was positioned
by the OS. As a result, popup menus could open at
wrong positions.
- Fl_Window::show(argc,argv) incorrectly opened the - Fl_Window::show(argc,argv) incorrectly opened the
display prior to parsing the arguments; this prevented display prior to parsing the arguments; this prevented
the "-display foo" option from working (STR #111) the "-display foo" option from working (STR #111)
+12 -2
View File
@@ -1,5 +1,5 @@
/* /*
* "$Id: filename.H,v 1.11.2.4.2.12 2003/01/30 21:40:42 easysw Exp $" * "$Id: filename.H,v 1.11.2.4.2.13 2003/08/02 05:54:43 matthiaswm Exp $"
* *
* Filename header file for the Fast Light Tool Kit (FLTK). * Filename header file for the Fast Light Tool Kit (FLTK).
* *
@@ -55,6 +55,16 @@ inline int fl_filename_relative(char *to, const char *from) { return fl_filename
struct dirent {char d_name[1];}; struct dirent {char d_name[1];};
# elif defined(__APPLE__) && defined(__PROJECTBUILDER__)
// Apple's ProjectBuilder has the nasty habit of including recursively
// down the file tree. To avoid re-including <FL/dirent.h> we must
// directly include the systems math file. (Plus, I could not find a
// predefined macro for ProjectBuilder builds, so we have to define it
// in the project)
# include <sys/types.h>
# include "/usr/include/dirent.h"
# else # else
/* /*
* WARNING: on some systems (very few nowadays?) <dirent.h> may not exist. * WARNING: on some systems (very few nowadays?) <dirent.h> may not exist.
@@ -117,5 +127,5 @@ FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l,
#endif /* FL_FILENAME_H */ #endif /* FL_FILENAME_H */
/* /*
* End of "$Id: filename.H,v 1.11.2.4.2.12 2003/01/30 21:40:42 easysw Exp $". * End of "$Id: filename.H,v 1.11.2.4.2.13 2003/08/02 05:54:43 matthiaswm Exp $".
*/ */
+12 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: math.h,v 1.4.2.4.2.8 2003/01/30 21:40:55 easysw Exp $" // "$Id: math.h,v 1.4.2.4.2.9 2003/08/02 05:54:43 matthiaswm Exp $"
// //
// Math header file for the Fast Light Tool Kit (FLTK). // Math header file for the Fast Light Tool Kit (FLTK).
// //
@@ -26,7 +26,16 @@
#ifndef fl_math_h #ifndef fl_math_h
# define fl_math_h # define fl_math_h
# include <math.h> // Apple's ProjectBuilder has the nasty habit of including recursively
// down the file tree. To avoid re-including <FL/math.h> we must
// directly include the systems math file. (Plus, I could not find a
// predefined macro for ProjectBuilder builds, so we have to define it
// in the project)
# if defined(__APPLE__) && defined(__PROJECTBUILDER__)
# include "/usr/include/math.h"
# else
# include <math.h>
# endif
# ifndef M_PI # ifndef M_PI
@@ -57,5 +66,5 @@ inline double copysign(double a, double b) {return b<0 ? -a : a;}
// //
// End of "$Id: math.h,v 1.4.2.4.2.8 2003/01/30 21:40:55 easysw Exp $". // End of "$Id: math.h,v 1.4.2.4.2.9 2003/08/02 05:54:43 matthiaswm Exp $".
// //
+3 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fluid.cxx,v 1.15.2.13.2.40 2003/07/29 02:12:36 easysw Exp $" // "$Id: fluid.cxx,v 1.15.2.13.2.41 2003/08/02 05:54:43 matthiaswm Exp $"
// //
// FLUID main entry for the Fast Light Tool Kit (FLTK). // FLUID main entry for the Fast Light Tool Kit (FLTK).
// //
@@ -650,7 +650,7 @@ void update_history(const char *flname) {
} }
// Shell command support... // Shell command support...
#if !defined(WIN32) || defined(__CYGWIN__) #if ( !defined(WIN32) || defined(__CYGWIN__) ) && ( !defined(__MWERKS__) && !defined(__APPLE__) )
// Support the full piped shell command... // Support the full piped shell command...
static FILE *shell_pipe = 0; static FILE *shell_pipe = 0;
@@ -886,5 +886,5 @@ int main(int argc,char **argv) {
} }
// //
// End of "$Id: fluid.cxx,v 1.15.2.13.2.40 2003/07/29 02:12:36 easysw Exp $". // End of "$Id: fluid.cxx,v 1.15.2.13.2.41 2003/08/02 05:54:43 matthiaswm Exp $".
// //
+13 -3
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_mac.cxx,v 1.1.2.50 2003/07/21 05:38:16 matthiaswm Exp $" // "$Id: Fl_mac.cxx,v 1.1.2.51 2003/08/02 05:54:43 matthiaswm Exp $"
// //
// MacOS specific code for the Fast Light Tool Kit (FLTK). // MacOS specific code for the Fast Light Tool Kit (FLTK).
// //
@@ -666,6 +666,10 @@ static pascal OSStatus carbonWindowHandler( EventHandlerCallRef nextHandler, Eve
switch ( kind ) switch ( kind )
{ {
case kEventWindowBoundsChanging:
GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &currentBounds );
GetEventParameter( event, kEventParamOriginalBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &originalBounds );
break;
case kEventWindowDrawContent: case kEventWindowDrawContent:
handleUpdateEvent( fl_xid( window ) ); handleUpdateEvent( fl_xid( window ) );
ret = noErr; ret = noErr;
@@ -1615,8 +1619,9 @@ void Fl_X::make(Fl_Window* w)
{ kEventClassWindow, kEventWindowActivated }, { kEventClassWindow, kEventWindowActivated },
{ kEventClassWindow, kEventWindowDeactivated }, { kEventClassWindow, kEventWindowDeactivated },
{ kEventClassWindow, kEventWindowClose }, { kEventClassWindow, kEventWindowClose },
{ kEventClassWindow, kEventWindowBoundsChanging },
{ kEventClassWindow, kEventWindowBoundsChanged } }; { kEventClassWindow, kEventWindowBoundsChanged } };
ret = InstallWindowEventHandler( x->xid, windowHandler, 7, windowEvents, w, 0L ); ret = InstallWindowEventHandler( x->xid, windowHandler, 8, windowEvents, w, 0L );
ret = InstallTrackingHandler( dndTrackingHandler, x->xid, w ); ret = InstallTrackingHandler( dndTrackingHandler, x->xid, w );
ret = InstallReceiveHandler( dndReceiveHandler, x->xid, w ); ret = InstallReceiveHandler( dndReceiveHandler, x->xid, w );
} }
@@ -1637,6 +1642,11 @@ void Fl_X::make(Fl_Window* w)
ShowWindow(x->xid); ShowWindow(x->xid);
Rect rect;
GetWindowBounds(x->xid, kWindowContentRgn, &rect);
w->x(rect.left); w->y(rect.top);
w->w(rect.right-rect.left); w->h(rect.bottom-rect.top);
w->handle(FL_SHOW); w->handle(FL_SHOW);
w->redraw(); // force draw to happen w->redraw(); // force draw to happen
w->set_visible(); w->set_visible();
@@ -1867,6 +1877,6 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) {
// //
// End of "$Id: Fl_mac.cxx,v 1.1.2.50 2003/07/21 05:38:16 matthiaswm Exp $". // End of "$Id: Fl_mac.cxx,v 1.1.2.51 2003/08/02 05:54:43 matthiaswm Exp $".
// //