Quickdraw removal: option removed from configure, all Qd code removed from sources. Also took this opportunity to sort the ifdef clauses so that USE_X11 shows first. Also added error pragma to enforce proper target checking, thus make even less assumptions.
if(p->type()>=FL_WINDOW)break;// don't do the unmap
}
#ifdef __APPLE_QD__
MacUnmapWindow(this,fl_xid(this));
#if defined(USE_X11) || defined(WIN32)
XUnmapWindow(fl_display,fl_xid(this));
#elif defined(__APPLE_QUARTZ__)
MacUnmapWindow(this,fl_xid(this));
#else
XUnmapWindow(fl_display,fl_xid(this));
#endif// __APPLE__
# error platform unsupported
#endif
}
break;
}
@ -1418,24 +1411,21 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
@@ -1418,24 +1411,21 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
if(wi->damage()){
// if we already have damage we must merge with existing region:
@ -374,7 +279,18 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
@@ -374,7 +279,18 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
@ -385,20 +301,6 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
@@ -385,20 +301,6 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
@ -408,15 +310,7 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
@@ -408,15 +310,7 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
@ -482,56 +482,8 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
@@ -482,56 +482,8 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
// Composite image with alpha manually each time...
alpha_blend(this,X,Y,W,H,cx,cy);
}
#elif defined(__APPLE_QUARTZ__)
if(id&&fl_gc){
CGRectrect={{X,Y},{W,H}};
Fl_X::q_begin_image(rect,cx,cy,w(),h());
CGContextDrawImage(fl_gc,rect,(CGImageRef)id);
Fl_X::q_end_image();
}
#else
#if defined(USE_X11)
if(id){
if(mask){
// I can't figure out how to combine a mask with existing region,
@ -557,6 +509,30 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
@@ -557,6 +509,30 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
// Composite image with alpha manually each time...
@ -118,45 +118,8 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
@@ -118,45 +118,8 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
// I can't figure out how to combine a mask with existing region,
// so cut the image down to a clipped rectangle:
@ -175,6 +138,23 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
@@ -175,6 +138,23 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
@ -164,7 +164,12 @@ Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
@@ -164,7 +164,12 @@ Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
fl_color(fl_contrast(FL_BLACK,color()));
#if defined(WIN32) || defined(__APPLE_QD__)
#if defined(USE_X11) || defined(__APPLE_QUARTZ__)
fl_line_style(FL_DOT);
fl_rect(X+Fl::box_dx(B),Y+Fl::box_dy(B),
W-Fl::box_dw(B)-1,H-Fl::box_dh(B)-1);
fl_line_style(FL_SOLID);
#elif defined(WIN32)
// Windows 95/98/ME do not implement the dotted line style, so draw
// every other pixel around the focus area...
//
@ -183,10 +188,7 @@ Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
@@ -183,10 +188,7 @@ Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
@ -56,117 +56,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
@@ -56,117 +56,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
{
if(!linedelta)linedelta=W*delta;
#ifdef __APPLE_QD__
// theoretically, if the current GPort permits, we could write
// directly into it, avoiding the temporary GWorld. For now I
// great. We were able to write the pixels directly into memory, so we can return now.
if(direct)
return;
// following the very save (and very slow) way to write the image into the give port
if(cb)
{
uchar*tmpBuf=newuchar[W*3];
for(inti=0;i<H;i++)
{
uchar*src=tmpBuf;
cb(userdata,0,i,W,tmpBuf);
for(intj=0;j<W;j++)
{
if(mono)
{fl_color(src[0],src[0],src[0]);src++;}
else
{fl_color(src[0],src[1],src[2]);src+=3;}
MoveTo(X+j,Y+i);
Line(0,0);
}
}
delete[]tmpBuf;
}
else
{
for(inti=0;i<H;i++)
{
constuchar*src=buf+i*linedelta;
for(intj=0;j<W;j++)
{
if(mono)
fl_color(src[0],src[0],src[0]);
else
fl_color(src[0],src[1],src[2]);
MoveTo(X+j,Y+i);
Line(0,0);
src+=delta;
}
}
}
#elif defined(__APPLE_QUARTZ__)
#if defined(__APPLE_QUARTZ__)
constvoid*array=buf;
uchar*tmpBuf=0;
if(cb){
@ -245,7 +135,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
@@ -245,7 +135,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
}
CGContextSetShouldAntialias(fl_gc,true);
#else
# error : you must defined __APPLE_QD__ or __APPLE_QUARTZ__
@ -180,12 +171,12 @@ void fl_xyline(int x, int y, int x1, int y2, int x3) {
@@ -180,12 +171,12 @@ void fl_xyline(int x, int y, int x1, int y2, int x3) {
@ -264,15 +250,14 @@ void fl_yxline(int x, int y, int y1, int x2, int y3) {
@@ -264,15 +250,14 @@ void fl_yxline(int x, int y, int y1, int x2, int y3) {
Drawalinefromx,ytox1,y1
*/
voidfl_line(intx,inty,intx1,inty1){
#ifdef WIN32
#if defined(USE_X11)
XDrawLine(fl_display,fl_window,fl_gc,x,y,x1,y1);
#elif defined(WIN32)
MoveToEx(fl_gc,x,y,0L);
LineTo(fl_gc,x1,y1);
// Draw the last point *again* because the GDI line drawing
// functions will not draw the last point ("it's a feature!"...)
@ -307,11 +294,7 @@ void fl_line(int x, int y, int x1, int y1, int x2, int y2) {
@@ -307,11 +294,7 @@ void fl_line(int x, int y, int x1, int y1, int x2, int y2) {
@ -319,16 +302,18 @@ void fl_line(int x, int y, int x1, int y1, int x2, int y2) {
@@ -319,16 +302,18 @@ void fl_line(int x, int y, int x1, int y1, int x2, int y2) {
Outlinea3-sidedpolygonwithlines
*/
voidfl_loop(intx,inty,intx1,inty1,intx2,inty2){
#ifdef WIN32
#if defined(USE_X11)
XPointp[4];
p[0].x=x;p[0].y=y;
p[1].x=x1;p[1].y=y1;
p[2].x=x2;p[2].y=y2;
p[3].x=x;p[3].y=y;
XDrawLines(fl_display,fl_window,fl_gc,p,4,0);
#elif defined(WIN32)
MoveToEx(fl_gc,x,y,0L);
LineTo(fl_gc,x1,y1);
LineTo(fl_gc,x2,y2);
LineTo(fl_gc,x,y);
#elif defined(__APPLE_QD__)
MoveTo(x,y);
LineTo(x1,y1);
LineTo(x2,y2);
LineTo(x,y);
#elif defined(__APPLE_QUARTZ__)
CGContextMoveToPoint(fl_gc,x,y);
CGContextAddLineToPoint(fl_gc,x1,y1);
@ -336,12 +321,7 @@ void fl_loop(int x, int y, int x1, int y1, int x2, int y2) {
@@ -336,12 +321,7 @@ void fl_loop(int x, int y, int x1, int y1, int x2, int y2) {
CGContextClosePath(fl_gc);
CGContextStrokePath(fl_gc);
#else
XPointp[4];
p[0].x=x;p[0].y=y;
p[1].x=x1;p[1].y=y1;
p[2].x=x2;p[2].y=y2;
p[3].x=x;p[3].y=y;
XDrawLines(fl_display,fl_window,fl_gc,p,4,0);
# error unsupported platform
#endif
}
@ -349,18 +329,20 @@ void fl_loop(int x, int y, int x1, int y1, int x2, int y2) {
@@ -349,18 +329,20 @@ void fl_loop(int x, int y, int x1, int y1, int x2, int y2) {
@ -369,13 +351,7 @@ void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
@@ -369,13 +351,7 @@ void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
CGContextClosePath(fl_gc);
CGContextStrokePath(fl_gc);
#else
XPointp[5];
p[0].x=x;p[0].y=y;
p[1].x=x1;p[1].y=y1;
p[2].x=x2;p[2].y=y2;
p[3].x=x3;p[3].y=y3;
p[4].x=x;p[4].y=y;
XDrawLines(fl_display,fl_window,fl_gc,p,5,0);
# error unsupported platform
#endif
}
@ -387,19 +363,13 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) {
@@ -387,19 +363,13 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) {
@ -407,9 +377,7 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) {
@@ -407,9 +377,7 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) {
@ -422,20 +390,13 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
@@ -422,20 +390,13 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
@ -444,9 +405,7 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
@@ -444,9 +405,7 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
@ -454,10 +413,10 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
@@ -454,10 +413,10 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
@ -489,51 +448,22 @@ Fl_Region XRectangleRegion(int x, int y, int w, int h) {
@@ -489,51 +448,22 @@ Fl_Region XRectangleRegion(int x, int y, int w, int h) {
}
#endif
#ifdef __APPLE_QD__
externFl_Regionfl_window_region;
#elif defined(__APPLE_QUARTZ__)
#if defined(__APPLE_QUARTZ__)
// warning: the Quartz implementation currently uses Quickdraw calls to achieve
// clipping. A future version should instead use 'CGContectClipToRect'
// and friends.
externFl_Regionfl_window_region;
#endif
// undo any clobbering of clip done by your program:
/** Undoes any clobbering of clip done by your program */
voidfl_restore_clip(){
fl_clip_state_number++;
Fl_Regionr=rstack[rstackptr];
#ifdef WIN32
#if defined(USE_X11)
if(r)XSetRegion(fl_display,fl_gc,r);
elseXSetClipMask(fl_display,fl_gc,0);
#elif defined(WIN32)
SelectClipRgn(fl_gc,r);//if r is NULL, clip is automatically cleared
#elif defined(__APPLE_QD__)
# if 1
// This code is required to allow true subwindows to work on Mac.
// During regular operation however, this seems overkill.
// See also: Fl_Window::make_current()
if(fl_window){
GrafPtrport=GetWindowPort(fl_window);
if(port){// port will be NULL if we are using a GWorld (and fl_window_region is invalid)
@ -703,7 +628,26 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
@@ -703,7 +628,26 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
X=x;Y=y;W=w;H=h;
Fl_Regionr=rstack[rstackptr];
if(!r)return0;
#ifdef WIN32
#if defined(USE_X11)
switch(XRectInRegion(r,x,y,w,h)){
case0:// completely outside
W=H=0;
return2;
case1:// completely inside:
return0;
default:// partial:
break;
}
Fl_Regionrr=XRectangleRegion(x,y,w,h);
Fl_Regiontemp=XCreateRegion();
XIntersectRegion(r,rr,temp);
XRectanglerect;
XClipBox(temp,&rect);
X=rect.x;Y=rect.y;W=rect.width;H=rect.height;
XDestroyRegion(temp);
XDestroyRegion(rr);
return1;
#elif defined(WIN32)
// The win32 API makes no distinction between partial and complete
// intersection, so we have to check for partial intersection ourselves.
// However, given that the regions may be composite, we have to do
@ -725,19 +669,6 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
@@ -725,19 +669,6 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
DeleteObject(temp);
DeleteObject(rr);
returnret;
#elif defined(__APPLE_QD__)
RgnHandlerr=NewRgn();
SetRectRgn(rr,x,y,x+w,y+h);
SectRgn(r,rr,rr);
Rectrp;GetRegionBounds(rr,&rp);
X=rp.left;
Y=rp.top;
W=rp.right-X;
H=rp.bottom-Y;
DisposeRgn(rr);
if(H==0)return2;
if(h==H&&w==W)return0;
return0;
#elif defined(__APPLE_QUARTZ__)
RgnHandlerr=NewRgn();
SetRectRgn(rr,x,y,x+w,y+h);
@ -752,24 +683,7 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
@@ -752,24 +683,7 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
@ -72,7 +72,20 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
@@ -72,7 +72,20 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
clip_y=Y+src_h;
clip_h=H-src_h;
}
#ifdef WIN32
#if defined(USE_X11)
XCopyArea(fl_display,fl_window,fl_window,fl_gc,
src_x,src_y,src_w,src_h,dest_x,dest_y);
// we have to sync the display and get the GraphicsExpose events! (sigh)
@ -126,13 +139,6 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
@@ -126,13 +139,6 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
// Great, we can do an accelerated scroll insteasd of re-rendering
// warning: there does not seem to be an equivalent to this function in Quartz
// ScrollWindowRect is a QuickDraw function and won't work here.
@ -145,17 +151,7 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
@@ -145,17 +151,7 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
@ -64,17 +64,16 @@ Fl_Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.cxx
@@ -64,17 +64,16 @@ Fl_Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.cxx