diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2002-06-27 04:29:39 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2002-06-27 04:29:39 +0000 |
| commit | 9c29ecde90d6c415ed842c5139937e73ebd2f274 (patch) | |
| tree | fe2094302ea5027b4d33a2c269050e824172145b /src | |
| parent | 0d352d96eaa8c5a7115acceabf80a993a5f623f1 (diff) | |
MacOS:
Pixmap Draw fix: pixmap would always draw from 0, 0
gl_font implemented
FL_FOCUS fix: would not send FL_FOCUS when window activated
window classes fixed: modal() and non_modal() should work much better
glut fix: uninitialised 'display' callback made glpuzzle crash
Please send bug reports
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2323 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Pixmap.cxx | 12 | ||||
| -rw-r--r-- | src/Fl_mac.cxx | 50 | ||||
| -rw-r--r-- | src/fl_draw_image_mac.cxx | 7 | ||||
| -rw-r--r-- | src/fl_font_mac.cxx | 6 | ||||
| -rw-r--r-- | src/gl_draw.cxx | 10 |
5 files changed, 54 insertions, 31 deletions
diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx index 4444d5ae3..176d5293e 100644 --- a/src/Fl_Pixmap.cxx +++ b/src/Fl_Pixmap.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.17 2002/04/26 11:32:37 easysw Exp $" +// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.18 2002/06/27 04:29:39 matthiaswm Exp $" // // Pixmap drawing code for the Fast Light Tool Kit (FLTK). // @@ -107,10 +107,10 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) { #elif defined(__APPLE__) if (mask) { Rect src, dst; - src.left = 0; src.right = w(); - src.top = 0; src.bottom = h(); - dst.left = X; dst.right = X+w(); - dst.top = Y; dst.bottom = Y+h(); + src.left = cx; src.right = cx+W; + src.top = cy; src.bottom = cy+H; + dst.left = X; dst.right = X+W; + dst.top = Y; dst.bottom = Y+H; RGBColor rgb; rgb.red = 0xffff; rgb.green = 0xffff; rgb.blue = 0xffff; RGBBackColor(&rgb); @@ -465,5 +465,5 @@ void Fl_Pixmap::desaturate() { } // -// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.17 2002/04/26 11:32:37 easysw Exp $". +// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.18 2002/06/27 04:29:39 matthiaswm Exp $". // diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index 7c8f4812c..3101d908b 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_mac.cxx,v 1.1.2.26 2002/06/11 18:44:07 easysw Exp $" +// "$Id: Fl_mac.cxx,v 1.1.2.27 2002/06/27 04:29:39 matthiaswm Exp $" // // MacOS specific code for the Fast Light Tool Kit (FLTK). // @@ -409,7 +409,15 @@ static pascal OSStatus carbonWindowHandler( EventHandlerCallRef nextHandler, Eve } break; } case kEventWindowShown: - if ( !window->parent() ) Fl::handle( FL_SHOW, window); + if ( !window->parent() ) + { + GetWindowClass( fl_xid( window ), &winClass ); + if ( winClass != kHelpWindowClass ) { // help windows can't get the focus! + Fl::handle( FL_FOCUS, window); + activeWindow = window; + } + Fl::handle( FL_SHOW, window); + } break; case kEventWindowHidden: if ( !window->parent() ) Fl::handle( FL_HIDE, window); @@ -547,7 +555,7 @@ static pascal OSStatus carbonMouseHandler( EventHandlerCallRef nextHandler, Even // fall through case kEventMouseDragged: if ( !sendEvent ) { - sendEvent = FL_DRAG; + sendEvent = FL_MOVE; // Fl::handle will convert into FL_DRAG if (abs(pos.h-px)>5 || abs(pos.v-py)>5) Fl::e_is_click = 0; } @@ -1087,16 +1095,13 @@ void Fl_X::make(Fl_Window* w) Fl_Group::current(0); fl_open_display(); int winclass = kDocumentWindowClass; - int winattr = kWindowCloseBoxAttribute - | kWindowCollapseBoxAttribute - | kWindowStandardHandlerAttribute - ; + int winattr = kWindowStandardHandlerAttribute | kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute; int xp = w->x(); int yp = w->y(); int wp = w->w(); int hp = w->h(); if (w->size_range_set) { - winattr |= kWindowFullZoomAttribute | kWindowResizableAttribute; + winattr |= kWindowFullZoomAttribute | kWindowResizableAttribute | kWindowLiveResizeAttribute; } else { if (w->resizable()) { Fl_Widget *o = w->resizable(); @@ -1111,16 +1116,14 @@ void Fl_X::make(Fl_Window* w) int xwm = xp, ywm = yp, bt, bx, by; if (!fake_X_wm(w, xwm, ywm, bt, bx, by)) { winclass = kHelpWindowClass; winattr = 0; } // menu windows and tooltips - else if (w->modal()) - winclass = kFloatingWindowClass; // basically fine, but not modal! The modal window however does not show - else if (w->non_modal()) - winclass = kFloatingWindowClass; // we need to call 'InitFloatingWindows for OS 8, 9 + else if (w->modal()) + winclass = kMovableModalWindowClass; if (by+bt) { wp += 2*bx; hp += 2*by+bt; } 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()); // use the Carbon functions below for default window positioning xyPos += 25; if (xyPos>200) xyPos = 25; } else { @@ -1135,7 +1138,7 @@ void Fl_X::make(Fl_Window* w) if (w->non_modal() && Fl_X::first && !fl_disable_transient_for) { // find some other window to be "transient for": Fl_Window* w = Fl_X::first->w; - while (w->parent()) w = w->window(); + while (w->parent()) w = w->window(); // todo: this code does not make any sense! (w!=w??) } Rect wRect; @@ -1156,8 +1159,23 @@ void Fl_X::make(Fl_Window* w) x->cursor = fl_default_cursor; x->xidChildren = 0; x->xidNext = 0; + + winattr &= GetAvailableWindowAttributes( winclass ); // make sure that the window will open CreateNewWindow( winclass, winattr, &wRect, &(x->xid) ); SetWTitle(x->xid, pTitle); + MoveWindow(x->xid, wRect.left, wRect.top, 1); // avoid Carbon Bug on old OS + if (w->non_modal() && !w->modal()) + SetWindowClass(x->xid, kFloatingWindowClass ); // Major kludge: this is to have the regular look, but stay above the document windows + if (!(w->flags() & Fl_Window::FL_FORCE_POSITION)) + { + WindowRef pw = Fl_X::first ? Fl_X::first->xid : 0 ; + if ( w->modal() ) + RepositionWindow( x->xid, pw, kWindowAlertPositionOnParentWindowScreen ); + else if ( w->non_modal() ) + RepositionWindow( x->xid, pw, kWindowCenterOnParentWindowScreen ); + else + RepositionWindow( x->xid, pw, kWindowCascadeOnParentWindowScreen ); + } x->w = w; w->i = x; x->wait_for_expose = 1; x->next = Fl_X::first; @@ -1329,7 +1347,7 @@ void Fl_Window::make_current() fl_window = i->xid; current_ = this; - SetPort( GetWindowPort(i->xid) ); // \todo check for the handling of doublebuffered winows + SetPort( GetWindowPort(i->xid) ); // \todo check for the handling of doublebuffered windows int xp = 0, yp = 0; Fl_Window *win = this; @@ -1432,6 +1450,6 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) { // -// End of "$Id: Fl_mac.cxx,v 1.1.2.26 2002/06/11 18:44:07 easysw Exp $". +// End of "$Id: Fl_mac.cxx,v 1.1.2.27 2002/06/27 04:29:39 matthiaswm Exp $". // diff --git a/src/fl_draw_image_mac.cxx b/src/fl_draw_image_mac.cxx index eaaf9bd74..867367dac 100644 --- a/src/fl_draw_image_mac.cxx +++ b/src/fl_draw_image_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_draw_image_mac.cxx,v 1.1.2.3 2002/01/03 08:08:21 matthiaswm Exp $" +// "$Id: fl_draw_image_mac.cxx,v 1.1.2.4 2002/06/27 04:29:39 matthiaswm Exp $" // // MacOS image drawing code for the Fast Light Tool Kit (FLTK). // @@ -45,7 +45,7 @@ * buf: pointer to first byte in image source * x, y: position in buffer * w: width (in bytes?) - * dst: destinaation buffer + * dst: destination buffer * userdata: ? */ static void innards(const uchar *buf, int X, int Y, int W, int H, @@ -122,6 +122,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H, DisposeGWorld( gw ); } + // great. We were able to write the pixels directly into memory, so we can return now. if ( direct ) return; @@ -274,5 +275,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.3 2002/01/03 08:08:21 matthiaswm Exp $". +// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.4 2002/06/27 04:29:39 matthiaswm Exp $". // diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx index 8188e6ec5..87a397d81 100644 --- a/src/fl_font_mac.cxx +++ b/src/fl_font_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_font_mac.cxx,v 1.1.2.8 2002/06/08 15:37:11 easysw Exp $" +// "$Id: fl_font_mac.cxx,v 1.1.2.9 2002/06/27 04:29:39 matthiaswm Exp $" // // MacOS font selection routines for the Fast Light Tool Kit (FLTK). // @@ -56,6 +56,7 @@ Fl_FontSize* fl_fontsize = 0L; Fl_FontSize::~Fl_FontSize() { /* #if HAVE_GL + // ++ todo: remove OpenGL font alocations // Delete list created by gl_draw(). This is not done by this code // as it will link in GL unnecessarily. There should be some kind // of "free" routine pointer, or a subclass? @@ -147,6 +148,7 @@ double fl_width(const char* c, int n) { return (double)TextWidth( c, 0, n ); } +// todo : fl_width returns wrong results for OS X double fl_width(uchar c) { return (double)TextWidth( &c, 0, 1 ); } @@ -157,5 +159,5 @@ void fl_draw(const char* str, int n, int x, int y) { } // -// End of "$Id: fl_font_mac.cxx,v 1.1.2.8 2002/06/08 15:37:11 easysw Exp $". +// End of "$Id: fl_font_mac.cxx,v 1.1.2.9 2002/06/27 04:29:39 matthiaswm Exp $". // diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx index e7ca43080..5d8fa6d5c 100644 --- a/src/gl_draw.cxx +++ b/src/gl_draw.cxx @@ -1,5 +1,5 @@ // -// "$Id: gl_draw.cxx,v 1.7.2.5.2.7 2002/05/25 13:38:25 easysw Exp $" +// "$Id: gl_draw.cxx,v 1.7.2.5.2.8 2002/06/27 04:29:39 matthiaswm Exp $" // // OpenGL drawing support routines for the Fast Light Tool Kit (FLTK). // @@ -53,8 +53,10 @@ void gl_font(int fontid, int size) { wglUseFontBitmaps(fl_gc, base, size, fl_fontsize->listbase+base); SelectObject(fl_gc, oldFid); #elif defined(__APPLE__) - // \todo Mac : Insert MacOS/AGL font handling here (aglUseFont) - // aglUseFont( context, fontID/GetFNum(), Style[norma, bold, italic], size, first, count, base ); + // undefined characters automatically receive an empty GL LIst in aglUseFont + fl_fontsize->listbase = glGenLists(256); + aglUseFont(aglGetCurrentContext(), fl_fontsize->font, fl_fontsize->face, + fl_fontsize->size, 0, 256, fl_fontsize->listbase); #else int base = fl_xfont->min_char_or_byte2; int size = fl_xfont->max_char_or_byte2-base+1; @@ -157,5 +159,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.7 2002/05/25 13:38:25 easysw Exp $". +// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.8 2002/06/27 04:29:39 matthiaswm Exp $". // |
