Pixmap corruption in gdk_pixmap_colormap_create_from_xpm_d



GTK+ folks--

Using GTK+ 2.2.4, I am seeing visual corruption in a
depressed toggle
button that has a pixmap.  The attached code provides a
reproduction
scenario.

When I create a GtkImage by making my own pixmap via the
function
gdk_pixmap_colormap_create_from_xpm_d, and attach that image
to a
toggle button, then the pixmap is not redrawn correctly when
it
receives an X Window expose event.  The corruption only
appears when
the button is in the depressed state.

When the same GtkImage is created via the
gtk_image_new_from_file
function, it works as expected.

To reproduce the problem:

  1. Compile the code below with #define SHOW_BUG, and run
the
     resulting executable.

  2. Click on the toggle button to depress it.

  3. Drag another window over the toggle button, so it is
obscured,
     and then move the other window, forcing an expose event
to be
     sent to the toggle button.  The toggle button is not
redrawn
     correctly.

When you undef SHOW_BUG, it works fine.

Any pointers?  Thanks for your help.

--Howdy

  =============================
  Howdy Pierce
  Managing Partner
  Cardinal Peak, LLC

  email: howdy cardinalpeak com
  work: (303) 665-3962
  cell: (303) 589-1645
  =============================



First, the file pc.c:
---------beginning of file---------
#include <gtk/gtk.h>

#define SHOW_BUG

#ifdef SHOW_BUG
#include "pause.xpm"
#endif


int
main(int argc, char **argv)
{
  gtk_init (&argc, &argv);

  GtkWidget *mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);


#ifdef SHOW_BUG
  GdkPixmap *_img_pixmap;
  GdkBitmap *_img_mask;
  GdkColormap *colormap;
  colormap = gtk_widget_get_colormap (mainwin);
  _img_pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL,
colormap,

&_img_mask,
                                                       NULL,
pause_xpm);
  GtkWidget *image = gtk_image_new_from_pixmap(_img_pixmap,
_img_mask);
#else
  GtkWidget *image = gtk_image_new_from_file("pause.xpm");
#endif

  GtkWidget *toggle = gtk_toggle_button_new();

  gtk_container_add(GTK_CONTAINER(toggle), image);
  gtk_container_add(GTK_CONTAINER(mainwin), toggle);
  gtk_widget_show_all (mainwin);

  gtk_main ();

  return 0;
}
---------end of file---------



The file pause.xpm:
---------beginning of file---------
/* XPM */
static char *pause_xpm[] = {
/* width height ncolors chars_per_pixel */
"32 32 3 1",
/* colors */
"  c #808080",
". c #F3D00C",
"o c None",
/* pixels */
"oooooooooooooooooooooooooooooooo",
"oooooooooooooooooooooooooooooooo",
"oooooooooooooooooooooooooooooooo",
"oooooooooooooooooooooooooooooooo",
"oooooooooooooooooooooooooooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo........ o........ ooooooo",
"oooooo         o         ooooooo",
"oooooooooooooooooooooooooooooooo",
"oooooooooooooooooooooooooooooooo",
"oooooooooooooooooooooooooooooooo",
"oooooooooooooooooooooooooooooooo",
"oooooooooooooooooooooooooooooooo",
"oooooooooooooooooooooooooooooooo"
};
---------end of file---------


I compile this with the following snippet:

#! /bin/sh
set -x

cflags=`pkg-config --cflags gtk+-2.0`
lflags=`pkg-config --libs gtk+-2.0`

gcc $cflags -g -c pc.c -o pc.o
gcc $lflags pc.o -o pc



My environment:

Red Hat 9.0 / XFree86 4.3.0
(also happens on Red Hat 8.0 and XFree86 4.2.0)
Gtk+ version 2.2.4 (also happens on 2.2.3)





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