[GtkGLExt] Expose events not occurring from gdk_window_invalidate_rect



I sent this problem out a few days ago and never heard anything.  This
is a modified form of it plus I've attached a stripped down version of
the code which demonstrates the problem (at least on my platforms).

I'm having a problem with an application I am developing to display a 3D
object in a drawing area widget that uses OpenGL via the GtkGLExt
extension.  I've mainly developed the application under Linux.  I have
the drawing area setup to act on configure, expose, button press, button
release, and button motion signal/events. If the window is reconfigured
the drawing area widget expands.   If you press a mouse button and drag
the object is rotated as the mouse moves.  (After getting the  mouse
movement I call a gdk_window_invalidate_rect() so that an expose event
is created and the expose callback draws the object in the updated
state.  

This was working under Linux, then I was needing to create a Windows
version and discovered this problem under there.  The problem also
occurs under Linux now as I'll explain further down.

The problem I am having is that depending upon the size of the drawing
area window, the expose event handler (to redraw the scene) is not
called after I issue a gdk_window_invalidate_rect.  When I click and
drag mouse button 1 up and down, the object is supposed to rotate.  The
motion event handler is being called (added printf statements) which
issues a gdk_window_invalidate_rect.  But the expose event handler is
not called.  If I enlarge the window horizontally (not vertically), at
some point (size) the behavior starts to work correctly.  This is
occurring Linux, XP, and 2000, just that the size of the window where
things start to work correctly differs.  (After encountering this
problem under Windows, I shrank the initial size of the display window
under Linux and experienced similar problems.)

I've attached a really stripped down version of the code.  (The main
interface section was created by glade-2.)  I had at one point stripped
out all the widgets except the drawing area, but when I did that, I
didn't have a problem that I was aware of.  For simplicity, the object
that is drawn is just a line.  Dragging mouse 1 up and down is supposed
to rotate the line.  Dragging Mouse 2 up or down zooms.  The Reset View
button switches between red and green.  Depending upon the platform
these "effects" don't work until one stretchs the window beyond a
certain size.  On Linux I was using gtk+2.4.13-9.  On Windowx XP,
compiled using the MSYS environment along with the GTK+ 2.4.14 (Tor)
libraries.  Similar for the Win 2000 platform.  (You will need to
install the gtkglext package/libs for this code).

I'd appreciate if anyone can confirm this problem and know what the
cause is.  

-----------------------------------------------------------------



#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include <glib.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>

#include <gtk/gtkgl.h>

#ifdef G_OS_WIN32
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif

#include <GL/gl.h>
#include <GL/glu.h>

GtkWidget *InitializeDisplay();
void DisplayArea_realize_event(GtkWidget *widget, gpointer  data);
gboolean DisplayArea_configure_event(GtkWidget *widget,
           GdkEventConfigure *event, gpointer data);
gboolean DisplayArea_expose_event(GtkWidget *widget, GdkEventExpose *event,
           gpointer data);
gboolean DisplayArea_motion_notify_event (GtkWidget *widget,
           GdkEventMotion *event, gpointer data);
gboolean DisplayArea_button_press_event (GtkWidget *widget,
           GdkEventButton *event, gpointer  data);
gboolean DisplayArea_button_release_event (GtkWidget *widget,
           GdkEventButton *event, gpointer data);
gboolean DisplayArea_key_press_event (GtkWidget *widget, GdkEventKey *event,
           gpointer data);

void on_exit1_activate(GtkMenuItem *menuitem, gpointer user_data);
void gui_ResetViewButton_clicked (GtkButton *button, gpointer user_data);


GtkWidget* create_mainwin (void);

GtkWidget* lookup_widget (GtkWidget *widget, const gchar *widget_name);


/*
 * Standard gettext macros.
 */
#ifdef ENABLE_NLS
#  include <libintl.h>
#  undef _
#  define _(String) dgettext (PACKAGE, String)
#  ifdef gettext_noop
#    define N_(String) gettext_noop (String)
#  else
#    define N_(String) (String)
#  endif
#else
#  define textdomain(String) (String)
#  define gettext(String) (String)
#  define dgettext(Domain,Message) (Message)
#  define dcgettext(Domain,Message,Type) (Message)
#  define bindtextdomain(Domain,Directory) (Domain)
#  define _(String) (String)
#  define N_(String) (String)
#endif


GtkWidget *mainwin,*gldisplay;
float alpha=0.0;
float alpha_dif=0.0;

float view_quat_diff[4] = { 0.0, 0.0, 0.0, 1.0 };
float view_quat[4] = { 0.0, 0.0, 0.0, 1.0 };
float view_scale = 1.0;
float begin_x = 0.0;
float begin_y = 0.0;
float dx = 0.0;
float dy = 0.0;
guint idle_id = 0;
int   color=0;


int main (int argc, char *argv[])
  {

      gtk_init (&argc, &argv);
      gtk_gl_init (&argc, &argv);
      mainwin=InitializeDisplay();
      gtk_main();
    
      return;
  }

/******************************************************************************
*                                                                             *
*  InitializeDisplay                                                          *
*                                                                             *
*  Calls the necessary functions to display the main window and initializes   *
*  the OpenGL display widget and associates various callback functions for    *
*  actions that take place in this widget.                                    *
*                                                                             *
******************************************************************************/

GtkWidget *InitializeDisplay()
  {
      GtkWidget *mw;
      GdkGLConfig *glconfig;
   
      mw=create_mainwin();
      glconfig = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGB |
                   GDK_GL_MODE_DEPTH | GDK_GL_MODE_DOUBLE);

      gldisplay=lookup_widget(mw,"DisplayArea");
      gtk_widget_set_size_request (gldisplay, 200, 200);

      gtk_widget_set_gl_capability (gldisplay, glconfig, NULL, TRUE,
        GDK_GL_RGBA_TYPE);

      gtk_widget_add_events (gldisplay, GDK_BUTTON1_MOTION_MASK |
         GDK_BUTTON2_MOTION_MASK | GDK_BUTTON_PRESS_MASK |
         GDK_BUTTON_RELEASE_MASK | GDK_VISIBILITY_NOTIFY_MASK |
         GDK_KEY_PRESS_MASK | GDK_BUTTON3_MOTION_MASK |
         GDK_POINTER_MOTION_MASK);

/* Define certain signal callback functions for the OpenGL display. */

      g_signal_connect_after (G_OBJECT (gldisplay), "realize",
         G_CALLBACK (DisplayArea_realize_event), NULL);
      g_signal_connect (G_OBJECT (gldisplay), "configure_event",
         G_CALLBACK (DisplayArea_configure_event), NULL);
      g_signal_connect (G_OBJECT (gldisplay), "expose_event",
        G_CALLBACK (DisplayArea_expose_event), NULL);

      g_signal_connect (G_OBJECT (gldisplay), "button_press_event",
         G_CALLBACK (DisplayArea_button_press_event), NULL);
      g_signal_connect (G_OBJECT (gldisplay), "button_release_event",
         G_CALLBACK (DisplayArea_button_release_event), NULL);
      g_signal_connect (G_OBJECT (gldisplay), "motion_notify_event",
         G_CALLBACK (DisplayArea_motion_notify_event), NULL);

      g_signal_connect (G_OBJECT (gldisplay), "key_press_event",
         G_CALLBACK (DisplayArea_key_press_event), NULL);
/*
      g_signal_connect_after (G_OBJECT (gldisplay), "key_press_event",
         G_CALLBACK (DisplayArea_key_press_event), NULL);
*/

/* Display the main window. */

      gtk_widget_show (mw);

      return(mw);

  }

/******************************************************************************
*                                                                             *
*  DisplayArea_realize_event                                                  *
*                                                                             *
*  Define the actions for a realize event for the OpenGL display area.        *
*                                                                             *
******************************************************************************/

void DisplayArea_realize_event(GtkWidget *widget, gpointer  data)
  {

      GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
      GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);

      if(!gdk_gl_drawable_gl_begin(gldrawable, glcontext)) return;

      glClearColor (0.0, 0.0, 0.0, 1.0);
      glClearDepth (1.0);

      glFrontFace (GL_CW);
      glEnable (GL_AUTO_NORMAL);
      glEnable (GL_NORMALIZE);
      glEnable (GL_DEPTH_TEST);
      glDepthFunc (GL_LESS);

      gdk_gl_drawable_gl_end (gldrawable);

      return;
  }

/******************************************************************************
*                                                                             *
*  DisplayArea_configure_event                                                *
*                                                                             *
*  Define the actions for a configure event for the OpenGL display area.      *
*                                                                             *
******************************************************************************/

gboolean DisplayArea_configure_event(GtkWidget *widget,
           GdkEventConfigure *event, gpointer data)
  {
      GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
      GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);

      GLfloat w,h,aspect,dim;

      w = widget->allocation.width;
      h = widget->allocation.height;

      if(!gdk_gl_drawable_gl_begin(gldrawable, glcontext))return(FALSE);

      glViewport (0,0,w,h);

      glMatrixMode (GL_PROJECTION);
      glLoadIdentity ();

      aspect=w/h;
      dim=4.0*view_scale;
      if(aspect <= 1.0) {
        glOrtho (-dim, dim, -dim/aspect, dim/aspect, -10.0, 10.0); 
      } else {
        glOrtho (-aspect*dim,aspect*dim,-dim,dim, -10.0, 10.0); 
      }

      glMatrixMode (GL_MODELVIEW);

      gdk_gl_drawable_gl_end (gldrawable);

      return(TRUE);
  }

/******************************************************************************
*                                                                             *
*  DisplayArea_expose_event                                                   *
*                                                                             *
*  Define the actions for an expose event for the OpenGL display area.  This  *
*  routine is the one primarily responsible for displaying the object in the  *
*  scene.                                                                     *
*                                                                             *
******************************************************************************/

gboolean DisplayArea_expose_event(GtkWidget *widget, GdkEventExpose *event,
           gpointer data)
  {
      GdkGLContext *glcontext;
      GdkGLDrawable *gldrawable;

      GLfloat w,h,aspect,dim;

      w = widget->allocation.width;
      h = widget->allocation.height;

/* OpenGL BEGIN */

      if(widget != NULL) {
        glcontext = gtk_widget_get_gl_context (widget);
        gldrawable = gtk_widget_get_gl_drawable (widget);
        if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
          return FALSE;
      }
 
      printf("in expose %d  %d\n",widget->allocation.width,
        widget->allocation.height);
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

/* View transformation. */

      glMatrixMode (GL_MODELVIEW);
      glLoadIdentity ();
      gluLookAt(0.0,0.0,0.0,0.0,0.0,5.0,0.0,1.0,0.0);
      alpha_dif = dy*.5;
      alpha += alpha_dif;
      glRotatef(alpha,0.0,0.0,1.0);

      glMatrixMode (GL_PROJECTION);
      glLoadIdentity ();

      aspect=w/h;
      dim=4.0*view_scale;
      if(aspect <= 1.0) {
        glOrtho (-dim, dim, -dim/aspect, dim/aspect, -10.0, 10.0); 
      } else {
        glOrtho (-aspect*dim,aspect*dim,-dim,dim, -10.0, 10.0); 
      }


      glMatrixMode (GL_MODELVIEW);

/* Render shape */

      glBegin(GL_LINES);
      if(color == 1) {
        glColor3f(0.0,1.0,0.0);
      }
      else {
        glColor3f(1.0,0.0,0.0);
      }
      glVertex3f(-1.0,0.0,0.0);
      glVertex3f( 1.0,0.0,0.0);
      glEnd();

/* Swap buffers */

      if(gdk_gl_drawable_is_double_buffered (gldrawable)) {
        gdk_gl_drawable_swap_buffers (gldrawable);
      }
      glFlush ();

      gdk_gl_drawable_gl_end (gldrawable);

/* OpenGL END */

      return(TRUE);
  }

/******************************************************************************
*                                                                             *
*  DisplayArea_button_press_event                                             *
*                                                                             *
*  Define the actions for a button press event for the OpenGL display area.   *
*                                                                             *
******************************************************************************/

gboolean DisplayArea_button_press_event (GtkWidget *widget,
           GdkEventButton *event, gpointer  data)
  {

      alpha_dif=0.0;

      begin_x = event->x;
      begin_y = event->y;

      return(FALSE);
  }

/******************************************************************************
*                                                                             *
*  DisplayArea_button_release_event                                           *
*                                                                             *
*  Define the actions for a button release event for the OpenGL display area. *
*                                                                             *
******************************************************************************/

gboolean DisplayArea_button_release_event (GtkWidget *widget,
           GdkEventButton *event, gpointer data)
  {

      alpha_dif=0.0;

      dx=0.0;
      dy=0.0;

      return(FALSE);
  }

/******************************************************************************
*                                                                             *
*  DisplayArea_motion_notify_event                                            *
*                                                                             *
*  Define the actions for a motion notify event for the OpenGL display area.  *
*                                                                             *
******************************************************************************/

gboolean DisplayArea_motion_notify_event (GtkWidget *widget,
           GdkEventMotion *event, gpointer data)
  {
      gboolean redraw;
      float w,h,x,y,panfactor,dim,panfactorx,panfactory;
      GLuint viewport[4];

      redraw=FALSE;
      w=widget->allocation.width;
      h=widget->allocation.height;
      x=event->x;
      y=event->y;

/*
  Check to see if Button 1 is pressed during the motion.  If so, then find
  out how much it has moved and its direction and perform a rotation of the 
  object.
*/

      if(event->state & GDK_BUTTON1_MASK) {
        dx = x - begin_x;
        dy = y - begin_y;
        redraw = TRUE;
      }

/*
  Is Button 2 pressed during the motion.  If so, then find out how much it has
  moved and perform a scaling/zooming operation.
*/

      else if(event->state & GDK_BUTTON2_MASK) {
        view_scale = view_scale * (1.0 + (y - begin_y) / h);
        redraw = TRUE;
      }

      begin_x = x;
      begin_y = y;

/*
  If the redraw flag is true and we are not animating, then invalidate the
  display window which will cause an expose event to occur which will then
  cause the object to be redisplayed.
*/
      if(redraw ) {
        gdk_window_invalidate_rect(widget->window,&widget->allocation,FALSE);
        printf("in motion %d %d\n",widget->allocation.width,
          widget->allocation.height);
      }

      return(FALSE);
  }

/******************************************************************************
*                                                                             *
*  DisplayArea_key_press_event                                                *
*                                                                             *
*  Define the actions when a key press event occurs in the OpenGL display     *
*  area.  At present this function is used only for experimental purposes.    *
*                                                                             *
******************************************************************************/

gboolean DisplayArea_key_press_event (GtkWidget *widget, GdkEventKey *event,
           gpointer data)
  {
      alpha += 1.0;
      printf("in keypress\n");
      gdk_window_invalidate_rect(widget->window,&widget->allocation,FALSE);

      return(TRUE);
  }

/******************************************************************************
*                                                                             *
*  on_exit1_activate                                                          *
*                                                                             *
******************************************************************************/


void on_exit1_activate(GtkMenuItem *menuitem, gpointer user_data)
  {
      gtk_main_quit();
  }

/******************************************************************************
*                                                                             *
*  gui_ResetViewButton_clicked                                                *
*                                                                             *
******************************************************************************/

void gui_ResetViewButton_clicked (GtkButton *button, gpointer user_data)

  {
      color=!color;
      gdk_window_invalidate_rect(gldisplay->window,&gldisplay->allocation,FALSE);
      return;
  }




/*
 * DO NOT EDIT THIS FILE - it is generated by Glade.
 */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>

#define GLADE_HOOKUP_OBJECT(component,widget,name) \
  g_object_set_data_full (G_OBJECT (component), name, \
    gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)

#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
  g_object_set_data (G_OBJECT (component), name, widget)

GtkWidget*
create_mainwin (void)
{
  GtkWidget *mainwin;
  GtkWidget *vbox1;
  GtkWidget *menubar1;
  GtkWidget *file1;
  GtkWidget *file1_menu;
  GtkWidget *FileOpen;
  GtkWidget *MainMenu_File_Close;
  GtkWidget *exit1;
  GtkWidget *hbox1;
  GtkWidget *vbox2;
  GtkWidget *DisplayFrame;
  GtkWidget *alignment2;
  GtkWidget *vbox3;
  GtkWidget *hbox5;
  GtkWidget *DisplayMenu;
  GtkWidget *menu2;
  GtkWidget *menuitem1;
  GtkWidget *menuitem2;
  GtkWidget *ResetViewButton;
  GtkWidget *hbox2;
  GtkWidget *DisplayCheckButton;
  GtkWidget *DisplayMinLabel;
  GtkWidget *DisplayMinEntry;
  GtkWidget *DisplayMaxLabel;
  GtkWidget *DisplayMaxEntry;
  GtkWidget *DisplayFrameLabel;
  GtkWidget *DisplayArea;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (mainwin), _("PCV"));
  gtk_window_set_destroy_with_parent (GTK_WINDOW (mainwin), TRUE);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (mainwin), vbox1);

  menubar1 = gtk_menu_bar_new ();
  gtk_widget_show (menubar1);
  gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0);

  file1 = gtk_menu_item_new_with_mnemonic (_("_File"));
  gtk_widget_show (file1);
  gtk_container_add (GTK_CONTAINER (menubar1), file1);

  file1_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (file1), file1_menu);

  FileOpen = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group);
  gtk_widget_show (FileOpen);
  gtk_container_add (GTK_CONTAINER (file1_menu), FileOpen);

  MainMenu_File_Close = gtk_image_menu_item_new_from_stock ("gtk-close", accel_group);
  gtk_widget_show (MainMenu_File_Close);
  gtk_container_add (GTK_CONTAINER (file1_menu), MainMenu_File_Close);

  exit1 = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
  gtk_widget_show (exit1);
  gtk_container_add (GTK_CONTAINER (file1_menu), exit1);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0);

  vbox2 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox2);
  gtk_box_pack_start (GTK_BOX (hbox1), vbox2, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox2), 3);

  DisplayFrame = gtk_frame_new (NULL);
  gtk_widget_show (DisplayFrame);
  gtk_box_pack_start (GTK_BOX (vbox2), DisplayFrame, FALSE, FALSE, 1);
  gtk_container_set_border_width (GTK_CONTAINER (DisplayFrame), 1);

  alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment2);
  gtk_container_add (GTK_CONTAINER (DisplayFrame), alignment2);
//  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 0, 0, 12, 0);

  vbox3 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox3);
  gtk_container_add (GTK_CONTAINER (alignment2), vbox3);

  hbox5 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox5);
  gtk_box_pack_start (GTK_BOX (vbox3), hbox5, TRUE, TRUE, 0);

  DisplayMenu = gtk_option_menu_new ();
  gtk_widget_show (DisplayMenu);
  gtk_box_pack_start (GTK_BOX (hbox5), DisplayMenu, FALSE, FALSE, 0);

  menu2 = gtk_menu_new ();

  menuitem1 = gtk_menu_item_new_with_mnemonic (_("A"));
  gtk_widget_show (menuitem1);
  gtk_container_add (GTK_CONTAINER (menu2), menuitem1);

  menuitem2 = gtk_menu_item_new_with_mnemonic (_("B"));
  gtk_widget_show (menuitem2);
  gtk_container_add (GTK_CONTAINER (menu2), menuitem2);

  gtk_option_menu_set_menu (GTK_OPTION_MENU (DisplayMenu), menu2);

  ResetViewButton = gtk_button_new_with_mnemonic (_("Reset View"));
  gtk_widget_show (ResetViewButton);
  gtk_box_pack_start (GTK_BOX (hbox5), ResetViewButton, FALSE, FALSE, 0);

  hbox2 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox2);
  gtk_box_pack_start (GTK_BOX (vbox3), hbox2, TRUE, TRUE, 1);
  gtk_container_set_border_width (GTK_CONTAINER (hbox2), 2);

  DisplayCheckButton = gtk_check_button_new_with_mnemonic ("");
  gtk_widget_show (DisplayCheckButton);
  gtk_box_pack_start (GTK_BOX (hbox2), DisplayCheckButton, FALSE, FALSE, 0);
  GTK_WIDGET_UNSET_FLAGS (DisplayCheckButton, GTK_CAN_FOCUS);

  DisplayMinLabel = gtk_label_new (_("Min:"));
  gtk_widget_show (DisplayMinLabel);
  gtk_box_pack_start (GTK_BOX (hbox2), DisplayMinLabel, FALSE, FALSE, 0);

  DisplayMinEntry = gtk_entry_new ();
  gtk_widget_show (DisplayMinEntry);
  gtk_box_pack_start (GTK_BOX (hbox2), DisplayMinEntry, TRUE, TRUE, 0);
  gtk_entry_set_width_chars (GTK_ENTRY (DisplayMinEntry), 10);

  DisplayMaxLabel = gtk_label_new (_(" Max:"));
  gtk_widget_show (DisplayMaxLabel);
  gtk_box_pack_start (GTK_BOX (hbox2), DisplayMaxLabel, FALSE, FALSE, 0);

  DisplayMaxEntry = gtk_entry_new ();
  gtk_widget_show (DisplayMaxEntry);
  gtk_box_pack_start (GTK_BOX (hbox2), DisplayMaxEntry, TRUE, TRUE, 0);
  gtk_entry_set_width_chars (GTK_ENTRY (DisplayMaxEntry), 10);

  DisplayFrameLabel = gtk_label_new (_("Display"));
  gtk_widget_show (DisplayFrameLabel);
  gtk_frame_set_label_widget (GTK_FRAME (DisplayFrame), DisplayFrameLabel);
  gtk_label_set_use_markup (GTK_LABEL (DisplayFrameLabel), TRUE);

  DisplayArea = gtk_drawing_area_new ();
  gtk_widget_show (DisplayArea);
  gtk_box_pack_start (GTK_BOX (hbox1), DisplayArea, TRUE, TRUE, 0);
  gtk_widget_set_size_request (DisplayArea, 30, 30);
  GTK_WIDGET_SET_FLAGS (DisplayArea, GTK_CAN_FOCUS);

  g_signal_connect ((gpointer) mainwin, "destroy",
                    G_CALLBACK (gtk_main_quit),
                    NULL);
  g_signal_connect ((gpointer) exit1, "activate",
                    G_CALLBACK (on_exit1_activate),
                    NULL);
  g_signal_connect ((gpointer) ResetViewButton, "clicked",
                    G_CALLBACK (gui_ResetViewButton_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (mainwin, mainwin, "mainwin");
  GLADE_HOOKUP_OBJECT (mainwin, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (mainwin, menubar1, "menubar1");
  GLADE_HOOKUP_OBJECT (mainwin, file1, "file1");
  GLADE_HOOKUP_OBJECT (mainwin, file1_menu, "file1_menu");
  GLADE_HOOKUP_OBJECT (mainwin, FileOpen, "FileOpen");
  GLADE_HOOKUP_OBJECT (mainwin, MainMenu_File_Close, "MainMenu_File_Close");
  GLADE_HOOKUP_OBJECT (mainwin, exit1, "exit1");
  GLADE_HOOKUP_OBJECT (mainwin, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (mainwin, vbox2, "vbox2");
  GLADE_HOOKUP_OBJECT (mainwin, DisplayFrame, "DisplayFrame");
  GLADE_HOOKUP_OBJECT (mainwin, alignment2, "alignment2");
  GLADE_HOOKUP_OBJECT (mainwin, vbox3, "vbox3");
  GLADE_HOOKUP_OBJECT (mainwin, hbox5, "hbox5");
  GLADE_HOOKUP_OBJECT (mainwin, DisplayMenu, "DisplayMenu");
  GLADE_HOOKUP_OBJECT (mainwin, menu2, "menu2");
  GLADE_HOOKUP_OBJECT (mainwin, menuitem1, "menuitem1");
  GLADE_HOOKUP_OBJECT (mainwin, menuitem2, "menuitem2");
  GLADE_HOOKUP_OBJECT (mainwin, ResetViewButton, "ResetViewButton");
  GLADE_HOOKUP_OBJECT (mainwin, hbox2, "hbox2");
  GLADE_HOOKUP_OBJECT (mainwin, DisplayCheckButton, "DisplayCheckButton");
  GLADE_HOOKUP_OBJECT (mainwin, DisplayMinLabel, "DisplayMinLabel");
  GLADE_HOOKUP_OBJECT (mainwin, DisplayMinEntry, "DisplayMinEntry");
  GLADE_HOOKUP_OBJECT (mainwin, DisplayMaxLabel, "DisplayMaxLabel");
  GLADE_HOOKUP_OBJECT (mainwin, DisplayMaxEntry, "DisplayMaxEntry");
  GLADE_HOOKUP_OBJECT (mainwin, DisplayFrameLabel, "DisplayFrameLabel");
  GLADE_HOOKUP_OBJECT (mainwin, DisplayArea, "DisplayArea");

  gtk_window_add_accel_group (GTK_WINDOW (mainwin), accel_group);

  return mainwin;
}


/*
 * DO NOT EDIT THIS FILE - it is generated by Glade.
 */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

#include <gtk/gtk.h>


GtkWidget*
lookup_widget                          (GtkWidget       *widget,
                                        const gchar     *widget_name)
{
  GtkWidget *parent, *found_widget;

  for (;;)
    {
      if (GTK_IS_MENU (widget))
        parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
      else
        parent = widget->parent;
      if (!parent)
        parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
      if (parent == NULL)
        break;
      widget = parent;
    }

  found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
                                                 widget_name);
  if (!found_widget)
    g_warning ("Widget not found: %s", widget_name);
  return found_widget;
}



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