cleaned up src/Fl_mac.cxx, fixed Fl::wait(0.0), fixed Cmd-Q handling

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1905 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2002-01-03 08:08:21 +00:00
parent 2283309d03
commit 1775984dbe
15 changed files with 175 additions and 889 deletions

View File

@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.0b9
- MacOS: cleaned up src/Fl_mac.cxx
- MacOS: fixed Fl::wait(0.0), fixed Cmd-Q handling
- Update CygWin support for Fl::add_fd().
- Update the plastic scheme to not override the default
colors - move the color code to the MacOS-specific

View File

@ -1,5 +1,5 @@
//
// "$Id: mac.H,v 1.1.2.4 2002/01/01 15:11:28 easysw Exp $"
// "$Id: mac.H,v 1.1.2.5 2002/01/03 08:08:21 matthiaswm Exp $"
//
// Mac header file for the Fast Light Tool Kit (FLTK).
//
@ -63,23 +63,19 @@ inline void XDestroyRegion(Fl_Region r) {
class Fl_X
{
public:
Window xid; // Mac WindowPtr
GWorldPtr other_xid; // pointer for offscreen bitmaps (doublebuffer)
Fl_Window *w; // FLTK window for
Window xid; // Mac WindowPtr
GWorldPtr other_xid; // pointer for offscreen bitmaps (doublebuffer)
Fl_Window *w; // FLTK window for
Fl_Region region;
Fl_Region subRegion; // region for this specific subwindow
Fl_X *next;
Fl_X *xidChildren, *xidNext;
Fl_Region subRegion; // region for this specific subwindow
Fl_X *next; // linked tree to support subwindows
Fl_X *xidChildren, *xidNext; // more subwindow tree
int wait_for_expose;
//+ int backbuffer_bad;
CursHandle cursor;
static Fl_X* first;
static Fl_X* i(const Fl_Window* w) {return w->i;}
static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&);
static void make(Fl_Window*);
static void MacGrowWindow(WindowPtr xid, const EventRecord &macevent);
static void MacDragWindow(WindowPtr xid, const EventRecord &macevent);
static int MacModifiers(const EventRecord &macevent, unsigned short prev);
void flush();
};
@ -120,6 +116,6 @@ extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)
#endif // !FL_MAC_H
//
// End of "$Id: mac.H,v 1.1.2.4 2002/01/01 15:11:28 easysw Exp $".
// End of "$Id: mac.H,v 1.1.2.5 2002/01/03 08:08:21 matthiaswm Exp $".
//

View File

@ -93,6 +93,7 @@ KNOWN MacFLTK BUGS
- Image transparency is not implemented.
- The 'shiny' demo needs work (flush/aglFlush).
- Threads are not implemented.
- OpenGL subwindow during window resize changes position
TEST SUITE STATUS
@ -127,14 +128,14 @@ OTHER STUFF
Under MacOS X, all windows are double-buffered. Using
Fl_Window has the same effect as using Fl_Double_Window on
other operating systems. However Fl_Overlay_Window uses one
other operating systems. Fl_Overlay_Window however uses one
additional buffer for the overlay plane.
FLTK 1.0.X FOR MAC
FLTK 1.0.6 for MacOS 8.x and OS 9.x is in beta stage and can
be downloaded from http://www.matthiasm.com/fltk/mac.shtml.
be downloaded from http://www.matthiasm.com/flMac.html .
The archive contains build files for Metrowerks CodeWarrior
5 and 6.

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.7 2002/01/01 15:11:30 easysw Exp $"
// "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.8 2002/01/03 08:08:21 matthiaswm Exp $"
//
// OpenGL visual selection code for the Fast Light Tool Kit (FLTK).
//
@ -271,7 +271,7 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) {
aglSetInteger( context, AGL_BUFFER_RECT, rect );
aglEnable( context, AGL_BUFFER_RECT );
}
aglSetDrawable(context, GetWindowPort( fl_xid(w) ) ); //++ Matt: this probably belongs only in create_gl_context
aglSetDrawable(context, GetWindowPort( fl_xid(w) ) );
aglSetCurrentContext(context);
#else
glXMakeCurrent(fl_display, fl_xid(w), context);
@ -309,5 +309,5 @@ void fl_delete_gl_context(GLContext context) {
#endif
//
// End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.7 2002/01/01 15:11:30 easysw Exp $".
// End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.8 2002/01/03 08:08:21 matthiaswm Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.8 2002/01/01 15:11:30 easysw Exp $"
// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.9 2002/01/03 08:08:21 matthiaswm Exp $"
//
// OpenGL window code for the Fast Light Tool Kit (FLTK).
//
@ -172,8 +172,8 @@ void Fl_Gl_Window::flush() {
uchar save_valid = valid_;
#ifdef __APPLE__
// matt: I have no idea hw expensive the following code is, but we need to reset the buffer rect after
// every window-reconfiguration, especially after window resizes.
// \todo Mac : matt: I have no idea how expensive the following code is, but we need to reset the buffer rect after
// every window-reconfiguration, especially after window resizes. aglUpdateContext(ctxt) may help here!
if ( parent() ) { //: resize our GL buffer rectangle
Rect wrect; GetWindowPortBounds( fl_xid(this), &wrect );
GLint rect[] = { x(), wrect.bottom-h()-y(), w(), h() };
@ -313,7 +313,7 @@ void Fl_Gl_Window::resize(int X,int Y,int W,int H) {
if (W != w() || H != h()) {
valid(0);
#ifdef __APPLE__
if ( parent() ) { //: resize our GL buffer rectangle
if ( parent() ) { //: resize our GL buffer rectangle (see aglUpdateContext()
Rect wrect; GetWindowPortBounds( fl_xid(this), &wrect );
GLint rect[] = { X, wrect.bottom-h()-y(), W, H };
aglSetInteger( context_, AGL_BUFFER_RECT, rect );
@ -368,5 +368,5 @@ void Fl_Gl_Window::draw_overlay() {}
#endif
//
// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.8 2002/01/01 15:11:30 easysw Exp $".
// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.9 2002/01/03 08:08:21 matthiaswm Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Image.cxx,v 1.5.2.3.2.13 2002/01/01 15:11:30 easysw Exp $"
// "$Id: Fl_Image.cxx,v 1.5.2.3.2.14 2002/01/03 08:08:21 matthiaswm Exp $"
//
// Image drawing code for the Fast Light Tool Kit (FLTK).
//
@ -345,7 +345,7 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
fl_copy_offscreen(X, Y, W, H, id, cx, cy);
}
#elif defined(__APPLE__)
//+ Need to implement masking/alpha blend!!!
// \todo Mac : alpha blending not yet implemented
fl_copy_offscreen(X, Y, W, H, id, cx, cy);
#else
if (mask) {
@ -378,5 +378,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) {
//
// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.13 2002/01/01 15:11:30 easysw Exp $".
// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.14 2002/01/03 08:08:21 matthiaswm Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Window_fullscreen.cxx,v 1.5.2.3.2.3 2002/01/01 15:11:31 easysw Exp $"
// "$Id: Fl_Window_fullscreen.cxx,v 1.5.2.3.2.4 2002/01/03 08:08:21 matthiaswm Exp $"
//
// Fullscreen window support for the Fast Light Tool Kit (FLTK).
//
@ -48,7 +48,7 @@ void Fl_Window::border(int b) {
// not yet implemented, but it's possible
// for full fullscreen we have to make the window topmost as well
#elif defined(__APPLE__)
//++ Matt: I have not looked into this yet
// \todo Mac : not yet implemeted
#else
if (shown()) Fl_X::i(this)->sendxjunk();
#endif
@ -73,5 +73,5 @@ void Fl_Window::fullscreen_off(int X,int Y,int W,int H) {
}
//
// End of "$Id: Fl_Window_fullscreen.cxx,v 1.5.2.3.2.3 2002/01/01 15:11:31 easysw Exp $".
// End of "$Id: Fl_Window_fullscreen.cxx,v 1.5.2.3.2.4 2002/01/03 08:08:21 matthiaswm Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_get_key_mac.cxx,v 1.1.2.3 2002/01/01 15:11:31 easysw Exp $"
// "$Id: Fl_get_key_mac.cxx,v 1.1.2.4 2002/01/03 08:08:21 matthiaswm Exp $"
//
// MacOS keyboard state routines for the Fast Light Tool Kit (FLTK).
//
@ -77,8 +77,7 @@ static int fltk2mac(int fltk) {
//: returns true, if that key was pressed during the last event
int Fl::event_key(int k) {
//++ return GetKeyState(fltk2mac(k))&~1;
return get_key(k); //++ find a faster way?!
return get_key(k);
}
#include <stdio.h>
@ -100,5 +99,5 @@ int Fl::get_key(int k) {
}
//
// End of "$Id: Fl_get_key_mac.cxx,v 1.1.2.3 2002/01/01 15:11:31 easysw Exp $".
// End of "$Id: Fl_get_key_mac.cxx,v 1.1.2.4 2002/01/03 08:08:21 matthiaswm Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_grab.cxx,v 1.1.2.4.2.5 2002/01/01 15:11:31 easysw Exp $"
// "$Id: Fl_grab.cxx,v 1.1.2.4.2.6 2002/01/03 08:08:21 matthiaswm Exp $"
//
// Grab/release code for the Fast Light Tool Kit (FLTK).
//
@ -56,7 +56,6 @@ void Fl::grab(Fl_Window* w) {
SetActiveWindow(fl_capture = fl_xid(first_window()));
SetCapture(fl_capture);
#elif defined(__APPLE__)
// BeginAppModalStateForWindow( fl_xid(first_window()) ); //+ please check if we need this (sample app?)
fl_capture = fl_xid( first_window() );
SetUserFocusWindow( fl_capture );
#else
@ -85,7 +84,6 @@ void Fl::grab(Fl_Window* w) {
fl_capture = 0;
ReleaseCapture();
#elif defined(__APPLE__)
// EndAppModalStateForWindow( fl_xid(first_window()) ); //+ Please check if we need this
fl_capture = 0;
SetUserFocusWindow( (WindowRef)kUserFocusAuto );
#else
@ -102,5 +100,5 @@ void Fl::grab(Fl_Window* w) {
}
//
// End of "$Id: Fl_grab.cxx,v 1.1.2.4.2.5 2002/01/01 15:11:31 easysw Exp $".
// End of "$Id: Fl_grab.cxx,v 1.1.2.4.2.6 2002/01/03 08:08:21 matthiaswm Exp $".
//

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_visual.cxx,v 1.7.2.4.2.3 2002/01/01 15:11:31 easysw Exp $"
// "$Id: Fl_visual.cxx,v 1.7.2.4.2.4 2002/01/03 08:08:21 matthiaswm Exp $"
//
// Visual support for the Fast Light Tool Kit (FLTK).
//
@ -40,7 +40,7 @@ int Fl::visual(int flags) {
}
#elif defined(__APPLE__)
//++ Matt: add support for visual flags
// \todo Mac : need to implement Visual flags
int Fl::visual(int flags) {
(void)flags;
return 1;
@ -115,5 +115,5 @@ int Fl::visual(int flags) {
#endif
//
// End of "$Id: Fl_visual.cxx,v 1.7.2.4.2.3 2002/01/01 15:11:31 easysw Exp $".
// End of "$Id: Fl_visual.cxx,v 1.7.2.4.2.4 2002/01/03 08:08:21 matthiaswm Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_draw_image_mac.cxx,v 1.1.2.2 2002/01/01 15:11:32 easysw Exp $"
// "$Id: fl_draw_image_mac.cxx,v 1.1.2.3 2002/01/03 08:08:21 matthiaswm Exp $"
//
// MacOS image drawing code for the Fast Light Tool Kit (FLTK).
//
@ -163,9 +163,9 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
}
}
#ifdef __APPLE__
//++ the above function does not support subregions yet
// \todo Mac : the above function does not support subregions yet
#ifdef later_we_do_this
// \todo Mac : the following code is taken from fl_draw_image_win32 and needs to be modified for Mac Carbon
// if (!linedelta) linedelta = W*delta;
int x, y, w, h;
@ -251,92 +251,6 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
// );
}
#endif
#else
if (!linedelta) linedelta = W*delta;
int x, y, w, h;
fl_clip_box(X,Y,W,H,x,y,w,h);
if (w<=0 || h<=0) return;
if (buf) buf += (x-X)*delta + (y-Y)*linedelta;
static U32 bmibuffer[256+12];
BITMAPINFO &bmi = *((BITMAPINFO*)bmibuffer);
if (!bmi.bmiHeader.biSize) {
bmi.bmiHeader.biSize = sizeof(bmi)-4; // does it use this to determine type?
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biXPelsPerMeter = 0;
bmi.bmiHeader.biYPelsPerMeter = 0;
bmi.bmiHeader.biClrUsed = 0;
bmi.bmiHeader.biClrImportant = 0;
}
if (mono) {
for (int i=0; i<256; i++) {
bmi.bmiColors[i].rgbBlue = i;
bmi.bmiColors[i].rgbGreen = i;
bmi.bmiColors[i].rgbRed = i;
bmi.bmiColors[i].rgbReserved = i;
}
}
bmi.bmiHeader.biWidth = w;
bmi.bmiHeader.biBitCount = mono ? 8 : 24;
int pixelsize = mono ? 1 : 3;
int linesize = (pixelsize*w+3)&~3;
static U32* buffer;
int blocking = h;
{int size = linesize*h;
if (size > MAXBUFFER) {
size = MAXBUFFER;
blocking = MAXBUFFER/linesize;
}
static long buffer_size;
if (size > buffer_size) {
delete[] buffer;
buffer_size = size;
buffer = new U32[(size+3)/4];
}}
bmi.bmiHeader.biHeight = blocking;
static U32* line_buffer;
if (!buf) {
int size = W*delta;
static int line_buf_size;
if (size > line_buf_size) {
delete[] line_buffer;
line_buf_size = size;
line_buffer = new U32[(size+3)/4];
}
}
for (int j=0; j<h; ) {
int k;
for (k = 0; j<h && k<blocking; k++, j++) {
const uchar* from;
if (!buf) { // run the converter:
cb(userdata, x-X, y-Y+j, w, (uchar*)line_buffer);
from = (uchar*)line_buffer;
} else {
from = buf;
buf += linedelta;
}
uchar *to = (uchar*)buffer+(blocking-k-1)*linesize;
if (mono) {
for (int i=w; i--; from += delta) *to++ = *from;
} else {
for (int i=w; i--; from += delta, to += 3) {
uchar r = from[0];
to[0] = from[2];
to[1] = from[1];
to[2] = r;
}
}
}
SetDIBitsToDevice(fl_gc, x, y+j-k, w, k, 0, 0, 0, k,
(LPSTR)((uchar*)buffer+(blocking-k)*linesize),
&bmi,
DIB_RGB_COLORS
);
}
#endif
}
void fl_draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
@ -360,5 +274,5 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
}
//
// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.2 2002/01/01 15:11:32 easysw Exp $".
// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.3 2002/01/03 08:08:21 matthiaswm Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_shortcut.cxx,v 1.4.2.9.2.3 2002/01/01 15:11:32 easysw Exp $"
// "$Id: fl_shortcut.cxx,v 1.4.2.9.2.4 2002/01/03 08:08:21 matthiaswm Exp $"
//
// Shortcut support routines for the Fast Light Tool Kit (FLTK).
//
@ -116,7 +116,7 @@ const char * fl_shortcut_label(int shortcut) {
char *p = buf;
if (!shortcut) {*p = 0; return buf;}
#ifdef __APPLE__
//++ we might want to change the symbols for mAc users
// \todo Mac : we might want to change the symbols for Mac users
if (shortcut & FL_SHIFT) {strcpy(p,"shift+"); p += 6;} //: Mac hollow up arrow
if (shortcut & FL_META) {strcpy(p,"ctrl+"); p += 5;} //: Mac 'cotrol'
if (shortcut & FL_ALT) {strcpy(p,"option+"); p += 7;} //: Mac 'Option' or fancy switch symbol
@ -200,5 +200,5 @@ int Fl_Widget::test_shortcut() {
}
//
// End of "$Id: fl_shortcut.cxx,v 1.4.2.9.2.3 2002/01/01 15:11:32 easysw Exp $".
// End of "$Id: fl_shortcut.cxx,v 1.4.2.9.2.4 2002/01/03 08:08:21 matthiaswm Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: gl_draw.cxx,v 1.7.2.5.2.4 2002/01/01 15:11:32 easysw Exp $"
// "$Id: gl_draw.cxx,v 1.7.2.5.2.5 2002/01/03 08:08:21 matthiaswm Exp $"
//
// OpenGL drawing support routines for the Fast Light Tool Kit (FLTK).
//
@ -54,7 +54,8 @@ void gl_font(int fontid, int size) {
wglUseFontBitmaps(fl_gc, base, size, fl_fontsize->listbase+base);
SelectObject(fl_gc, oldFid);
#elif defined(__APPLE__)
//++ Matt: Insert MacOS/AGL font handling here
// \todo Mac : Insert MacOS/AGL font handling here (aglUseFont)
// aglUseFont( context, fontID/GetFNum(), Style[norma, bold, italic], size, first, count, base );
#else
int base = fl_xfont->min_char_or_byte2;
int size = fl_xfont->max_char_or_byte2-base+1;
@ -157,5 +158,5 @@ void gl_draw_image(const uchar* b, int x, int y, int w, int h, int d, int ld) {
#endif
//
// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.4 2002/01/01 15:11:32 easysw Exp $".
// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.5 2002/01/03 08:08:21 matthiaswm Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: gl_start.cxx,v 1.6.2.5.2.6 2002/01/01 15:11:32 easysw Exp $"
// "$Id: gl_start.cxx,v 1.6.2.5.2.7 2002/01/03 08:08:21 matthiaswm Exp $"
//
// OpenGL context routines for the Fast Light Tool Kit (FLTK).
//
@ -66,7 +66,7 @@ void gl_start() {
if (!gl_choice) Fl::gl_visual(0);
context = fl_create_gl_context(Fl_Window::current(), gl_choice);
#elif defined(__APPLE__)
//++ Matt: We need to check the code and verify it with Apple Sample code. 'shiny' give some output...
// \todo Mac : We need to check the code and verify it with Apple Sample code. The 'shiny'-test should at least work with the software OpenGL emulator
context = fl_create_gl_context(Fl_Window::current(), gl_choice);
#else
context = fl_create_gl_context(fl_visual);
@ -122,5 +122,5 @@ int Fl::gl_visual(int mode, int *alist) {
#endif
//
// End of "$Id: gl_start.cxx,v 1.6.2.5.2.6 2002/01/01 15:11:32 easysw Exp $".
// End of "$Id: gl_start.cxx,v 1.6.2.5.2.7 2002/01/03 08:08:21 matthiaswm Exp $".
//