Image of dialog stays in drawing area



I've encountered a problem as a byproduct of the way I'm handling getting
input from the user using gtk 1.2.  I set up a drawing area, then set up a
gnome dialog with a gtkentry, then get the user input from that.  The
problem is that the image of the dialog stays behind in the drawing area
and corrupts the drawing, even though the routine closes the dialog and
then clears the window to black.  Here's a snippet of the code:

=== begin included code ===

/* =============================================================== */

gint prompt_user_input (glong type)
{
   gchar *buffer;
   gchar ptr[] = "Hello";

   [snip]

   input_dialog = gnome_dialog_new (
                     ptr,
                     GNOME_STOCK_BUTTON_OK,
                     NULL);
   gnomeentry = gnome_entry_new (NULL);
   gtkentry = gnome_entry_gtk_entry (gnomeentry);
   gtk_entry_set_text (gtkentry, "BLAH");
   gtk_box_pack_start (input_dialog->vbox, gnomeentry, TRUE, TRUE, 2);
   gnome_dialog_editable_enters (input_dialog, gtkentry);
   gtk_widget_show_all (input_dialog);
   button = gnome_dialog_run (input_dialog);
   buffer = g_malloc0 (256);
   buffer = gtk_editable_get_chars(gtkentry, 0, -1);
   gnome_dialog_close (input_dialog);
   g_free (buffer);
   return button;
}

/* =============================================================== */

void
on_doit_activate                   (GtkMenuItem     *menuitem,
                                    gpointer         user_data)
{

   [snip]

   button = prompt_user_input (TYPE);
   gdk_gc_get_values (drawing_area->style->fg_gc[drawing_area->state],
                      (GdkGCValues *) &values_local);
   gdk_gc_set_background (drawing_area->style->fg_gc[drawing_area->state],
                          (GdkColor *) &colortable[BLACK]);
   gdk_draw_rectangle (pixmap,
                       drawing_area->style->fg_gc[drawing_area->state],
                       TRUE,
                       0, 0,
                       WWIDTH, WHEIGHT);
   gdk_draw_pixmap (drawing_area->window,
                    drawing_area->style->fg_gc[drawing_area->state],
                    pixmap,
                     0,  0,
                     0,  0,
                    WWIDTH, WHEIGHT);
   gdk_gc_set_background (drawing_area->style->fg_gc[drawing_area->state],
                          &(values_local.background));
}

=== end included code ===

I get the user input, then clear the pixmap and drawing area to black.
Well, the afterimage of the dialog stays in the drawing area, even though
the dialog is closed before the pixmap is cleared to black.  I do see that
my expose_event routine is being called, which may be where the afterimage
is coming from, but why would it be there after I manually clear the
pixmap to black?

What am I doing wrong?  How do I fix this?

Thanks,

Bryan


*---------------------------------------------------------------
* Bryan Brown      <*>              bbrown radix net
* http://www.radix.net/~bbrown
*---------------------------------------------------------------





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]