Force redraw of Gtk_Pixmap?





I am working on an embedded application using gtk+ 1.2.3 and Gtk-- 1.0.2.
There is no mouse or keyboard.  Button press events come from custom hardware
through a shared memory ipc.  I am changing what pixmaps are displayed when
a button is pressed.  Following is a code fragment from the app.

The problem is that the Gtk_Pixmap.set() is not seen immediately.  I'm
adding debug text to the Gtk_Text and when the Gtk_Text scrolls the new pixmap
is seen.

How can I force a redraw of the Gtk_Pixmap?

I have forced a redraw with an artificial expose event like this:
  right_vbox->expose_event( &exp );
This approach might be reasonable if the expose area matched the Gtk_Pixmap.

How can I find the expose area to cover sk_1_pm or sk_2_pm?


  Gtk_Text keypad_text;
  Gtk_VBox * right_vbox;
  Gtk_Pixmap sk_1_pm;
  Gtk_Pixmap sk_2_pm;
  Gdk_Colormap system_colormap;
  Gdk_Bitmap my_bitmap;
  Gdk_Pixmap light_1_pm;
  Gdk_Pixmap  dark_1_pm;
  Gdk_Pixmap light_2_pm;
  Gdk_Pixmap  dark_2_pm;

  right_vbox = new Gtk_VBox( true, 0 );

  system_colormap = Gdk_Colormap::get_system();
  Gdk_Color tmp_color;

  light_1_pm.create_colormap_from_xpm_d (0,
					 system_colormap,
					 my_bitmap,
					 tmp_color,
					 light_1_xpm
					 );
  dark_1_pm.create_colormap_from_xpm_d (0,
					 system_colormap,
					 my_bitmap,
					 tmp_color,
					 dark_1_xpm
					 );
  light_2_pm.create_colormap_from_xpm_d (0,
					 system_colormap,
					 my_bitmap,
					 tmp_color,
					 light_2_xpm
					 );
  dark_2_pm.create_colormap_from_xpm_d (0,
					 system_colormap,
					 my_bitmap,
					 tmp_color,
					 dark_2_xpm
					 );
  sk_1_pm.set(dark_1_pm,my_bitmap);
  sk_2_pm.set(dark_2_pm,my_bitmap);

  right_vbox->pack_start(sk_1_pm,
			 true,
			 true,
			 0);
  right_vbox->pack_start(sk_2_pm,
			 true,
			 true,
			 0);


Handler
  sk_1_pm.set(dark_1_pm,my_bitmap);
  sk_2_pm.set(dark_2_pm,my_bitmap);
  if (1 is active)
    sk_1_pm.set(light_1_pm,my_bitmap);
  else
    sk_2_pm.set(light_2_pm,my_bitmap);



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