Skip to content

Commit

Permalink
MacOS:
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Matthias Melcher committed Jun 27, 2002
1 parent 0d352d9 commit 9c29ecd
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 44 deletions.
3 changes: 3 additions & 0 deletions CHANGES
@@ -1,5 +1,8 @@
CHANGES IN FLTK 1.1.0

- MacOS: Pixmap draw fix, gl_font implemented
FL_FOCUS fix, window type fix for modal and nonmodal
windows, glut uninitialised 'display' proc fix
- Now support FLTK_1_0_COMPAT symbol to define
compatibility macros for the old FLTK 1.0.x function
names to the 1.1.x names.
Expand Down
5 changes: 2 additions & 3 deletions README.mac
Expand Up @@ -90,12 +90,11 @@ KNOWN MacFLTK BUGS
- File handles (Fl::add_fd) are not implemented.
- Line styles are not fully implemented.
- Sub-sub-subwindow not tested.
- Image transparency is not implemented.
- Image transparency is implemented as "screen-door" only
- The 'shiny' demo needs work (flush/aglFlush).
- Threads are not implemented.
- OpenGL subwindow during window resize changes position
- OpenGL text and font support
- fl_measure returns wrong width (about 10% short)
- fl_measure returns wrong width (wrong current font?)


TEST SUITE STATUS
Expand Down
12 changes: 6 additions & 6 deletions 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).
//
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 $".
//
50 changes: 34 additions & 16 deletions 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).
//
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand All @@ -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 {
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 $".
//

7 changes: 4 additions & 3 deletions 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).
//
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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 $".
//
6 changes: 4 additions & 2 deletions 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).
//
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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 );
}
Expand All @@ -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 $".
//
10 changes: 6 additions & 4 deletions 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).
//
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 $".
//
6 changes: 3 additions & 3 deletions test/help.cxx
@@ -1,5 +1,5 @@
//
// "$Id: help.cxx,v 1.1.2.4 2002/01/01 15:11:33 easysw Exp $"
// "$Id: help.cxx,v 1.1.2.5 2002/06/27 04:29:39 matthiaswm Exp $"
//
// Fl_Help_Dialog test program.
//
Expand Down Expand Up @@ -48,7 +48,7 @@ main(int argc, // I - Number of command-line arguments
help = new Fl_Help_Dialog;

if (argc < 2)
help->load("../documentation/index.html");
help->load("../../documentation/index.html");
else
help->load(argv[1]);

Expand All @@ -63,5 +63,5 @@ main(int argc, // I - Number of command-line arguments


//
// End of "$Id: help.cxx,v 1.1.2.4 2002/01/01 15:11:33 easysw Exp $".
// End of "$Id: help.cxx,v 1.1.2.5 2002/06/27 04:29:39 matthiaswm Exp $".
//
10 changes: 3 additions & 7 deletions test/preferences.fl
@@ -1,10 +1,7 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0100
header_name {.h}
code_name {.cxx}
gridx 5
gridy 5
snap 3
code_name {.cxx}
decl {\#include <FL/Fl_Preferences.H>} {public
}

Expand All @@ -13,8 +10,7 @@ decl {\#include <stdio.h>} {public

decl {\#include <stdlib.h>} {}

decl {\#include <FL/filename.H>} {selected
}
decl {\#include <FL/filename.H>} {}

decl {void readPrefs();} {public
}
Expand Down Expand Up @@ -175,7 +171,7 @@ Function {} {open return_type int
xywh {175 185 70 20} type Horizontal align 8 minimum 2 maximum 6 value 3.1
}
Fl_Input wPaper {
label {Newspaper:}
label {Newspaper:} selected
xywh {165 225 105 20} align 5
}
}
Expand Down

0 comments on commit 9c29ecd

Please sign in to comment.