[AD] GUI screen

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


The attached patch adds a way to change the default BITMAP surface for GUI 
drawing operations. The intended purpose is for use with double/page 
flipping where screen isn't nescessarily the correct bitmap to display.
Currently, people hack around this by just changing the screen pointer, 
which is a bad idea IMHO.
Of course one could argue that people should just use custom dialog objects 
that take care of this anyway, but I still feel that it's a good courtesy 
to have this functionality for Allegro's own GUI.
Untested and still needs documentation and possibly some examples.

Evert
Index: src/gui.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/gui.c,v
retrieving revision 1.71
diff -u -r1.71 gui.c
--- src/gui.c	4 Nov 2004 23:06:50 -0000	1.71
+++ src/gui.c	20 Dec 2004 14:06:15 -0000
@@ -47,6 +47,9 @@
 MENU *active_menu = NULL;
 
 
+BITMAP *gui_screen = NULL;
+
+
 /* list of currently active (initialized) dialog players */
 struct al_active_dialog_player {
    DIALOG_PLAYER *player;
@@ -772,8 +775,8 @@
    void *player;
    ASSERT(dialog);
 
-   if (!is_same_bitmap(_mouse_screen, screen))
-      show_mouse(screen);
+   if (!is_same_bitmap(_mouse_screen, get_gui_bitmap()))
+      show_mouse(get_gui_bitmap());
 
    player = init_dialog(dialog, focus_obj);
 
@@ -809,7 +812,7 @@
 
    if (bmp) {
       scare_mouse_area(dialog->x, dialog->y, dialog->w, dialog->h);
-      blit(screen, bmp, dialog->x, dialog->y, 0, 0, dialog->w, dialog->h);
+      blit(get_gui_bitmap(), bmp, dialog->x, dialog->y, 0, 0, dialog->w, dialog->h);
       unscare_mouse();
    }
    else
@@ -819,7 +822,7 @@
 
    if (bmp) {
       scare_mouse_area(dialog->x, dialog->y, dialog->w, dialog->h);
-      blit(bmp, screen, 0, 0, dialog->x, dialog->y, dialog->w, dialog->h);
+      blit(bmp, get_gui_bitmap(), 0, 0, dialog->x, dialog->y, dialog->w, dialog->h);
       unscare_mouse();
       destroy_bitmap(bmp);
    }
@@ -920,8 +923,8 @@
       gui_install_count++;
 
    /* initialise the dialog */
-   set_clip_rect(screen, 0, 0, SCREEN_W-1, SCREEN_H-1);
-   set_clip_state(screen, TRUE);
+   set_clip_rect(get_gui_bitmap(), 0, 0, SCREEN_W-1, SCREEN_H-1);
+   set_clip_state(get_gui_bitmap(), TRUE);
    player->res |= dialog_message(dialog, MSG_START, 0, &player->obj);
 
    player->mouse_obj = find_mouse_object(dialog);
@@ -948,6 +951,26 @@
 
 
 
+/* set_gui_bitmap:
+ *  Changes the target bitmap for GUI drawing operations
+ */
+void set_gui_bitmap(BITMAP *bmp)
+{
+   gui_screen = bmp;
+}
+
+
+
+/* get_gui_bitmap:
+ *  Returns the gui_screen, or the default surface if gui_screen is NULL
+ */
+BITMAP *get_gui_bitmap(void)
+{
+   return gui_screen?gui_screen:screen;
+}
+
+
+
 /* check_for_redraw:
  *  Checks whether any parts of the current dialog need to be redraw.
  */
Index: src/guiproc.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/guiproc.c,v
retrieving revision 1.26
diff -u -r1.26 guiproc.c
--- src/guiproc.c	27 Jul 2004 10:33:21 -0000	1.26
+++ src/guiproc.c	20 Dec 2004 14:06:17 -0000
@@ -118,13 +118,13 @@
 
    /* two loops to avoid bank switches */
    for (c=x1; c<=x2; c++)
-      putpixel(screen, c, y1, (((c+y1) & 1) == x) ? fg : bg);
+      putpixel(get_gui_bitmap(), c, y1, (((c+y1) & 1) == x) ? fg : bg);
    for (c=x1; c<=x2; c++)
-      putpixel(screen, c, y2, (((c+y2) & 1) == x) ? fg : bg);
+      putpixel(get_gui_bitmap(), c, y2, (((c+y2) & 1) == x) ? fg : bg);
 
    for (c=y1+1; c<y2; c++) {
-      putpixel(screen, x1, c, (((c+x1) & 1) == x) ? fg : bg);
-      putpixel(screen, x2, c, (((c+x2) & 1) == x) ? fg : bg);
+      putpixel(get_gui_bitmap(), x1, c, (((c+x1) & 1) == x) ? fg : bg);
+      putpixel(get_gui_bitmap(), x2, c, (((c+x2) & 1) == x) ? fg : bg);
    }
 }
 
@@ -159,9 +159,9 @@
 #endif
 
    if (msg == MSG_DRAW) {
-      set_clip_rect(screen, 0, 0, SCREEN_W-1, SCREEN_H-1);
-      set_clip_state(screen, TRUE);
-      clear_to_color(screen, d->bg);
+      set_clip_rect(get_gui_bitmap(), 0, 0, SCREEN_W-1, SCREEN_H-1);
+      set_clip_state(get_gui_bitmap(), TRUE);
+      clear_to_color(get_gui_bitmap(), d->bg);
    }
 
    return D_O_K;
@@ -177,8 +177,8 @@
    ASSERT(d);
    if (msg==MSG_DRAW) {
       int fg = (d->flags & D_DISABLED) ? gui_mg_color : d->fg;
-      rectfill(screen, d->x+1, d->y+1, d->x+d->w-2, d->y+d->h-2, d->bg);
-      rect(screen, d->x, d->y, d->x+d->w-1, d->y+d->h-1, fg);
+      rectfill(get_gui_bitmap(), d->x+1, d->y+1, d->x+d->w-2, d->y+d->h-2, d->bg);
+      rect(get_gui_bitmap(), d->x, d->y, d->x+d->w-1, d->y+d->h-1, fg);
    }
 
    return D_O_K;
@@ -195,10 +195,10 @@
    if (msg==MSG_DRAW) {
       int fg = (d->flags & D_DISABLED) ? gui_mg_color : d->fg;
       int black = makecol(0,0,0);
-      rectfill(screen, d->x+1, d->y+1, d->x+d->w-3, d->y+d->h-3, d->bg);
-      rect(screen, d->x, d->y, d->x+d->w-2, d->y+d->h-2, fg);
-      vline(screen, d->x+d->w-1, d->y+1, d->y+d->h-1, black);
-      hline(screen, d->x+1, d->y+d->h-1, d->x+d->w-1, black);
+      rectfill(get_gui_bitmap(), d->x+1, d->y+1, d->x+d->w-3, d->y+d->h-3, d->bg);
+      rect(get_gui_bitmap(), d->x, d->y, d->x+d->w-2, d->y+d->h-2, fg);
+      vline(get_gui_bitmap(), d->x+d->w-1, d->y+1, d->y+d->h-1, black);
+      hline(get_gui_bitmap(), d->x+1, d->y+d->h-1, d->x+d->w-1, black);
    }
 
    return D_O_K;
@@ -216,7 +216,7 @@
 
    b = (BITMAP *)d->dp;
    if (msg==MSG_DRAW)
-      blit(b, screen, 0, 0, d->x, d->y, d->w, d->h);
+      blit(b, get_gui_bitmap(), 0, 0, d->x, d->y, d->w, d->h);
 
    return D_O_K;
 }
@@ -236,7 +236,7 @@
       if (d->dp2)
 	 font = d->dp2;
 
-      gui_textout_ex(screen, d->dp, d->x, d->y, fg, d->bg, FALSE);
+      gui_textout_ex(get_gui_bitmap(), d->dp, d->x, d->y, fg, d->bg, FALSE);
 
       font = oldfont;
    }
@@ -260,7 +260,7 @@
       if (d->dp2)
 	 font = d->dp2;
 
-      gui_textout_ex(screen, d->dp, d->x + d->w/2, d->y, fg, d->bg, TRUE);
+      gui_textout_ex(get_gui_bitmap(), d->dp, d->x + d->w/2, d->y, fg, d->bg, TRUE);
 
       font = oldfont;
    }
@@ -284,7 +284,7 @@
       if (d->dp2)
 	 font = d->dp2;
 
-      gui_textout_ex(screen, d->dp, d->x + d->w - gui_strlen(d->dp), d->y, fg, d->bg, FALSE);
+      gui_textout_ex(get_gui_bitmap(), d->dp, d->x + d->w - gui_strlen(d->dp), d->y, fg, d->bg, FALSE);
 
       font = oldfont;
    }
@@ -322,18 +322,18 @@
 	    state2 = d->bg;
 	 }
 
-	 rectfill(screen, d->x+1+g, d->y+1+g, d->x+d->w-3+g, d->y+d->h-3+g, state2);
-	 rect(screen, d->x+g, d->y+g, d->x+d->w-2+g, d->y+d->h-2+g, state1);
-	 gui_textout_ex(screen, d->dp, d->x+d->w/2+g, d->y+d->h/2-text_height(font)/2+g, state1, -1, TRUE);
+	 rectfill(get_gui_bitmap(), d->x+1+g, d->y+1+g, d->x+d->w-3+g, d->y+d->h-3+g, state2);
+	 rect(get_gui_bitmap(), d->x+g, d->y+g, d->x+d->w-2+g, d->y+d->h-2+g, state1);
+	 gui_textout_ex(get_gui_bitmap(), d->dp, d->x+d->w/2+g, d->y+d->h/2-text_height(font)/2+g, state1, -1, TRUE);
 
 	 if (d->flags & D_SELECTED) {
-	    vline(screen, d->x, d->y, d->y+d->h-2, d->bg);
-	    hline(screen, d->x, d->y, d->x+d->w-2, d->bg);
+	    vline(get_gui_bitmap(), d->x, d->y, d->y+d->h-2, d->bg);
+	    hline(get_gui_bitmap(), d->x, d->y, d->x+d->w-2, d->bg);
 	 }
 	 else {
 	    black = makecol(0,0,0);
-	    vline(screen, d->x+d->w-1, d->y+1, d->y+d->h-2, black);
-	    hline(screen, d->x+1, d->y+d->h-1, d->x+d->w-1, black);
+	    vline(get_gui_bitmap(), d->x+d->w-1, d->y+1, d->y+d->h-2, black);
+	    hline(get_gui_bitmap(), d->x+1, d->y+d->h-1, d->x+d->w-1, black);
 	 }
 	 if ((d->flags & D_GOTFOCUS) && 
 	     (!(d->flags & D_SELECTED) || !(d->flags & D_EXIT)))
@@ -407,14 +407,14 @@
       fg = (d->flags & D_DISABLED) ? gui_mg_color : d->fg;
       bg = (d->bg < 0) ? gui_bg_color : d->bg;
 
-      x = d->x + ((d->d1) ? 0 : gui_textout_ex(screen, d->dp, d->x, d->y+(d->h-(text_height(font)-gui_font_baseline))/2, fg, d->bg, FALSE) + text_height(font)/2);
-      rectfill(screen, x+1, d->y+1, x+d->h-2, d->y+d->h-2, bg);
-      rect(screen, x, d->y, x+d->h-1, d->y+d->h-1, fg);
+      x = d->x + ((d->d1) ? 0 : gui_textout_ex(get_gui_bitmap(), d->dp, d->x, d->y+(d->h-(text_height(font)-gui_font_baseline))/2, fg, d->bg, FALSE) + text_height(font)/2);
+      rectfill(get_gui_bitmap(), x+1, d->y+1, x+d->h-2, d->y+d->h-2, bg);
+      rect(get_gui_bitmap(), x, d->y, x+d->h-1, d->y+d->h-1, fg);
       if (d->d1)
-	 gui_textout_ex(screen, d->dp, x+d->h-1+text_height(font)/2, d->y+(d->h-(text_height(font)-gui_font_baseline))/2, fg, d->bg, FALSE);
+	 gui_textout_ex(get_gui_bitmap(), d->dp, x+d->h-1+text_height(font)/2, d->y+(d->h-(text_height(font)-gui_font_baseline))/2, fg, d->bg, FALSE);
       if (d->flags & D_SELECTED) {
-	 line(screen, x, d->y, x+d->h-1, d->y+d->h-1, fg);
-	 line(screen, x, d->y+d->h-1, x+d->h-1, d->y, fg);
+	 line(get_gui_bitmap(), x, d->y, x+d->h-1, d->y+d->h-1, fg);
+	 line(get_gui_bitmap(), x, d->y+d->h-1, x+d->h-1, d->y, fg);
       }
       if (d->flags & D_GOTFOCUS)
 	 dotted_rect(x+1, d->y+1, x+d->h-2, d->y+d->h-2, fg, bg);
@@ -443,26 +443,26 @@
 	 fg = (d->flags & D_DISABLED) ? gui_mg_color : d->fg;
 	 bg = (d->bg < 0) ? gui_bg_color : d->bg;
 
-	 gui_textout_ex(screen, d->dp, d->x+d->h-1+text_height(font), d->y+(d->h-(text_height(font)-gui_font_baseline))/2, fg, d->bg, FALSE);
+	 gui_textout_ex(get_gui_bitmap(), d->dp, d->x+d->h-1+text_height(font), d->y+(d->h-(text_height(font)-gui_font_baseline))/2, fg, d->bg, FALSE);
 
 	 x = d->x;
 	 r = d->h/2;
 
 	 center = x+r;
-	 rectfill(screen, x, d->y, x+d->h-1, d->y+d->h-1, bg);
+	 rectfill(get_gui_bitmap(), x, d->y, x+d->h-1, d->y+d->h-1, bg);
 
 	 switch (d->d2) {
 
 	    case 1:
-	       rect(screen, x, d->y, x+d->h-1, d->y+d->h-1, fg);
+	       rect(get_gui_bitmap(), x, d->y, x+d->h-1, d->y+d->h-1, fg);
 	       if (d->flags & D_SELECTED)
-		  rectfill(screen, x+r/2, d->y+r/2, x+d->h-1-r/2, d->y+d->h-1-r/2, fg);
+		  rectfill(get_gui_bitmap(), x+r/2, d->y+r/2, x+d->h-1-r/2, d->y+d->h-1-r/2, fg);
 	       break;
 
 	    default:
-	       circle(screen, center, d->y+r, r, fg);
+	       circle(get_gui_bitmap(), center, d->y+r, r, fg);
 	       if (d->flags & D_SELECTED)
-		  circlefill(screen, center, d->y+r, r/2, fg);
+		  circlefill(get_gui_bitmap(), center, d->y+r, r/2, fg);
 	       break;
 	 }
 
@@ -550,26 +550,26 @@
       /* put the graphic on screen, scaled as needed */
       butx = butimage->w;
       buty = butimage->h;
-      stretch_blit(butimage, screen, 0, 0, butx-depth, buty-depth, 
+      stretch_blit(butimage, get_gui_bitmap(), 0, 0, butx-depth, buty-depth, 
 		   d->x+depth, d->y+depth, d->w-depth, d->h-depth);
 
       if ((d->flags & D_GOTFOCUS) &&
 	  (!(d->flags & D_SELECTED) || !(d->flags & D_EXIT))) {
 	 /* draw focus lines */
 	 for (index=indent; index<d->w-(indent+1); index+=2) {
-	    putpixel(screen, d->x+index+depth, d->y+indent+depth,d->fg);
-	    putpixel(screen, d->x+index+depth, d->y+d->h-(indent+1)+depth, d->fg);
+	    putpixel(get_gui_bitmap(), d->x+index+depth, d->y+indent+depth,d->fg);
+	    putpixel(get_gui_bitmap(), d->x+index+depth, d->y+d->h-(indent+1)+depth, d->fg);
 	 }
 	 for (index=indent; index<d->h-(indent+1); index+=2) {
-	    putpixel(screen, d->x+indent+depth, d->y+index+depth, d->fg);
-	    putpixel(screen, d->x+d->w-(indent+1)+depth, d->y+index+depth, d->fg);
+	    putpixel(get_gui_bitmap(), d->x+indent+depth, d->y+index+depth, d->fg);
+	    putpixel(get_gui_bitmap(), d->x+d->w-(indent+1)+depth, d->y+index+depth, d->fg);
 	 }
       }
 
       /* draw shadowing */
       for (index=0; index<depth; index++) {
-	  hline(screen, d->x, d->y+index, d->x+d->w-1, d->bg);
-	  vline(screen, d->x+index, d->y, d->y+d->h-1, d->bg);
+	  hline(get_gui_bitmap(), d->x, d->y+index, d->x+d->w-1, d->bg);
+	  vline(get_gui_bitmap(), d->x+index, d->y, d->y+d->h-1, d->bg);
       }
 
       return D_O_K;
@@ -689,11 +689,11 @@
 	    if (x+w > d->w)
 	       break;
 	    f = ((p == d->d2) && (d->flags & D_GOTFOCUS));
-	    textout_ex(screen, font, buf, d->x+x, d->y, (f) ? d->bg : fg, (f) ? fg : d->bg);
+	    textout_ex(get_gui_bitmap(), font, buf, d->x+x, d->y, (f) ? d->bg : fg, (f) ? fg : d->bg);
 	    x += w;
 	 }
 	 if (x < d->w)
-	    rectfill(screen, d->x+x, d->y, d->x+d->w-1, d->y+text_height(font)-1, d->bg);
+	    rectfill(get_gui_bitmap(), d->x+x, d->y, d->x+d->w-1, d->y+text_height(font)-1, d->bg);
 	 break;
 
       case MSG_CLICK:
@@ -981,11 +981,11 @@
    int xx, yy;
 
    /* draw frame */
-   rect(screen, d->x, d->y, d->x+d->w-1, d->y+d->h-1, fg_color);
+   rect(get_gui_bitmap(), d->x, d->y, d->x+d->w-1, d->y+d->h-1, fg_color);
 
    /* possibly draw scrollbar */
    if (listsize > height) {
-      vline(screen, d->x+d->w-13, d->y+1, d->y+d->h-2, fg_color);
+      vline(get_gui_bitmap(), d->x+d->w-13, d->y+1, d->y+d->h-2, fg_color);
 
       /* scrollbar with focus */ 
       if (d->flags & D_GOTFOCUS) {
@@ -993,8 +993,8 @@
 	 dotted_rect(d->x+d->w-12, d->y+1, d->x+d->w-2, d->y+d->h-2, fg_color, bg);
       }
       else {
-	 rect(screen, d->x+1, d->y+1, d->x+d->w-14, d->y+d->h-2, bg);
-	 rect(screen, d->x+d->w-12, d->y+1, d->x+d->w-2, d->y+d->h-2, bg);
+	 rect(get_gui_bitmap(), d->x+1, d->y+1, d->x+d->w-14, d->y+d->h-2, bg);
+	 rect(get_gui_bitmap(), d->x+d->w-12, d->y+1, d->x+d->w-2, d->y+d->h-2, bg);
       }
 
       /* create and draw the scrollbar */
@@ -1010,19 +1010,19 @@
 
       if (offset > 0) {
 	 len = (((d->h-5) * offset) + listsize/2) / listsize;
-	 rectfill(screen, xx, yy, xx+8, yy+len, bg);
+	 rectfill(get_gui_bitmap(), xx, yy, xx+8, yy+len, bg);
 	 yy += len;
       }
       if (yy+i < d->y+d->h-3) {
 	 drawing_mode(DRAW_MODE_COPY_PATTERN, pattern, 0, 0);
-	 rectfill(screen, xx, yy, xx+8, yy+i, 0);
+	 rectfill(get_gui_bitmap(), xx, yy, xx+8, yy+i, 0);
 	 solid_mode();
 	 yy += i+1;
-	 rectfill(screen, xx, yy, xx+8, d->y+d->h-3, bg);
+	 rectfill(get_gui_bitmap(), xx, yy, xx+8, d->y+d->h-3, bg);
       }
       else {
 	 drawing_mode(DRAW_MODE_COPY_PATTERN, pattern, 0, 0);
-	 rectfill(screen, xx, yy, xx+8, d->y+d->h-3, 0);
+	 rectfill(get_gui_bitmap(), xx, yy, xx+8, d->y+d->h-3, 0);
 	 solid_mode();
       }
       destroy_bitmap(pattern);
@@ -1032,7 +1032,7 @@
       if (d->flags & D_GOTFOCUS)
 	 dotted_rect(d->x+1, d->y+1, d->x+d->w-2, d->y+d->h-2, fg_color, bg);
       else
-	 rect(screen, d->x+1, d->y+1, d->x+d->w-2, d->y+d->h-2, bg);
+	 rect(get_gui_bitmap(), d->x+1, d->y+1, d->x+d->w-2, d->y+d->h-2, bg);
    }
 }
 
@@ -1072,26 +1072,26 @@
 	 ustrzcpy(s, sizeof(s), (*(getfuncptr)d->dp)(i+d->d2, NULL));
 	 x = d->x + 2;
 	 y = d->y + 2 + i*text_height(font);
-	 rectfill(screen, x, y, x+7, y+text_height(font)-1, bg);
+	 rectfill(get_gui_bitmap(), x, y, x+7, y+text_height(font)-1, bg);
 	 x += 8;
 	 len = ustrlen(s);
 	 while (text_length(font, s) >= MAX(d->w - 1 - (bar ? 22 : 10), 1)) {
 	    len--;
 	    usetat(s, len, 0);
 	 }
-	 textout_ex(screen, font, s, x, y, fg, bg);
+	 textout_ex(get_gui_bitmap(), font, s, x, y, fg, bg);
 	 x += text_length(font, s);
 	 if (x <= d->x+w) 
-	    rectfill(screen, x, y, d->x+w, y+text_height(font)-1, bg);
+	    rectfill(get_gui_bitmap(), x, y, d->x+w, y+text_height(font)-1, bg);
       }
       else {
-	 rectfill(screen, d->x+2,  d->y+2+i*text_height(font), 
+	 rectfill(get_gui_bitmap(), d->x+2,  d->y+2+i*text_height(font), 
 		  d->x+w, d->y+1+(i+1)*text_height(font), d->bg);
       }
    }
 
    if (d->y+2+i*text_height(font) <= d->y+d->h-3)
-      rectfill(screen, d->x+2, d->y+2+i*text_height(font), 
+      rectfill(get_gui_bitmap(), d->x+2, d->y+2+i*text_height(font), 
 				       d->x+w, d->y+d->h-3, d->bg);
 
    /* draw frame, maybe with scrollbar */
@@ -1385,7 +1385,7 @@
    /* do some drawing setup */
    if (draw) {
       /* initial start blanking at the top */
-      rectfill(screen, x+2, y+2, x+w-3, y1-1, deselect);
+      rectfill(get_gui_bitmap(), x+2, y+2, x+w-3, y1-1, deselect);
    }
 
    /* choose the text color */
@@ -1470,7 +1470,7 @@
 	 x1 = x+4;
 
 	 /* the initial blank bit */
-	 rectfill(screen, x+2, y1, x1-1, y1+text_height(font), deselect);
+	 rectfill(get_gui_bitmap(), x+2, y1, x1-1, y1+text_height(font), deselect);
 
 	 /* print up to the marked character */
 	 while (printed != scanned) {
@@ -1486,7 +1486,7 @@
 	       case '\t':
 		  for (i=0; i<tabsize; i++) {
 		     usetc(s+usetc(s, ' '), 0);
-		     textout_ex(screen, font, s, x1, y1, fg, deselect);
+		     textout_ex(get_gui_bitmap(), font, s, x1, y1, fg, deselect);
 		     x1 += text_length(font, s);
 		  }
 		  break;
@@ -1495,7 +1495,7 @@
 	       default:
 		  if (printed != ignore) {
 		     usetc(s+usetc(s, ugetc(printed)), 0);
-		     textout_ex(screen, font, s, x1, y1, fg, deselect);
+		     textout_ex(get_gui_bitmap(), font, s, x1, y1, fg, deselect);
 		     x1 += text_length(font, s);
 		  }
 	    }
@@ -1505,7 +1505,7 @@
 	 }
 	 /* the last blank bit */
 	 if (x1 <= x+w-3) 
-	    rectfill(screen, x1, y1, x+w-3, y1+text_height(font)-1, deselect);
+	    rectfill(get_gui_bitmap(), x1, y1, x+w-3, y1+text_height(font)-1, deselect);
 
 	 /* print the line end */
 	 y1 += text_height(font);
@@ -1519,7 +1519,7 @@
       if (!ugetc(printed)) {
 	 /* the under blank bit */
 	 if (draw)
-	    rectfill(screen, x+1, y1, x+w-3, y+h-1, deselect);
+	    rectfill(get_gui_bitmap(), x+1, y1, x+w-3, y+h-1, deselect);
 
 	 /* tell how many lines we found */
 	 *listsize = line;
@@ -1748,14 +1748,14 @@
 	 sfg = (d->flags & D_DISABLED) ? gui_mg_color : d->fg;
 
 	 if (vert) {
-	    rectfill(screen, d->x, d->y, d->x+d->w/2-2, d->y+d->h-1, d->bg);
-	    rectfill(screen, d->x+d->w/2-1, d->y, d->x+d->w/2+1, d->y+d->h-1, sfg);
-	    rectfill(screen, d->x+d->w/2+2, d->y, d->x+d->w-1, d->y+d->h-1, d->bg);
+	    rectfill(get_gui_bitmap(), d->x, d->y, d->x+d->w/2-2, d->y+d->h-1, d->bg);
+	    rectfill(get_gui_bitmap(), d->x+d->w/2-1, d->y, d->x+d->w/2+1, d->y+d->h-1, sfg);
+	    rectfill(get_gui_bitmap(), d->x+d->w/2+2, d->y, d->x+d->w-1, d->y+d->h-1, d->bg);
 	 }
 	 else {
-	    rectfill(screen, d->x, d->y, d->x+d->w-1, d->y+d->h/2-2, d->bg);
-	    rectfill(screen, d->x, d->y+d->h/2-1, d->x+d->w-1, d->y+d->h/2+1, sfg);
-	    rectfill(screen, d->x, d->y+d->h/2+2, d->x+d->w-1, d->y+d->h-1, d->bg);
+	    rectfill(get_gui_bitmap(), d->x, d->y, d->x+d->w-1, d->y+d->h/2-2, d->bg);
+	    rectfill(get_gui_bitmap(), d->x, d->y+d->h/2-1, d->x+d->w-1, d->y+d->h/2+1, sfg);
+	    rectfill(get_gui_bitmap(), d->x, d->y+d->h/2+2, d->x+d->w-1, d->y+d->h-1, d->bg);
 	 }
 
 	 /* okay, background and slot are drawn, now draw the handle */
@@ -1768,7 +1768,7 @@
 	       slx = d->x+slp;
 	       sly = d->y+(d->h/2)-(slhan->h/2);
 	    }
-	    draw_sprite(screen, slhan, slx, sly);
+	    draw_sprite(get_gui_bitmap(), slhan, slx, sly);
 	 } 
 	 else {
 	    /* draw default handle */
@@ -1785,14 +1785,14 @@
 	    }
 
 	    /* draw body */
-	    rectfill(screen, slx+2, sly, slx+(slw-2), sly+slh, sfg);
-	    vline(screen, slx+1, sly+1, sly+slh-1, sfg);
-	    vline(screen, slx+slw-1, sly+1, sly+slh-1, sfg);
-	    vline(screen, slx, sly+2, sly+slh-2, sfg);
-	    vline(screen, slx+slw, sly+2, sly+slh-2, sfg);
-	    vline(screen, slx+1, sly+2, sly+slh-2, d->bg);
-	    hline(screen, slx+2, sly+1, slx+slw-2, d->bg);
-	    putpixel(screen, slx+2, sly+2, d->bg);
+	    rectfill(get_gui_bitmap(), slx+2, sly, slx+(slw-2), sly+slh, sfg);
+	    vline(get_gui_bitmap(), slx+1, sly+1, sly+slh-1, sfg);
+	    vline(get_gui_bitmap(), slx+slw-1, sly+1, sly+slh-1, sfg);
+	    vline(get_gui_bitmap(), slx, sly+2, sly+slh-2, sfg);
+	    vline(get_gui_bitmap(), slx+slw, sly+2, sly+slh-2, sfg);
+	    vline(get_gui_bitmap(), slx+1, sly+2, sly+slh-2, d->bg);
+	    hline(get_gui_bitmap(), slx+2, sly+1, slx+slw-2, d->bg);
+	    putpixel(get_gui_bitmap(), slx+2, sly+2, d->bg);
 	 }
 
 	 if (d->flags & D_GOTFOCUS)
Index: include/allegro/gui.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/gui.h,v
retrieving revision 1.14
diff -u -r1.14 gui.h
--- include/allegro/gui.h	14 Jul 2004 02:04:34 -0000	1.14
+++ include/allegro/gui.h	20 Dec 2004 14:06:18 -0000
@@ -188,6 +188,8 @@
 
 AL_VAR(int, gui_font_baseline);
 
+AL_VAR(BITMAP *, gui_screen);
+
 AL_FUNCPTR(int, gui_mouse_x, (void));
 AL_FUNCPTR(int, gui_mouse_y, (void));
 AL_FUNCPTR(int, gui_mouse_z, (void));


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/