Re: [gtk-list] Re: Bug in gtk 1.2?



On 4 Apr 1999, Owen Taylor wrote:

> Sounds like things are getting highly confused ... I don't
> think this has anything thing with the gtk_main_iteration()
> stuff.

But it does. This program also makes the button over-sensitive, but it
doesn't redirect events like my program did. I am compelled to believe
that these bugs are somehow related, though.

Code follows....
#include <gtk/gtk.h>

void destroy(GtkWidget *widget, gpointer data)
{
  gtk_main_quit();
}

void callback(GtkWidget *widget, gpointer data)
{
  g_print("Pressed\n");
  gtk_main_iteration();
}

int main(int argc, char **argv)
{
  GtkWidget *window;
  GtkWidget *button;
  GtkWidget *vbox;
  GtkWidget *label;

  gtk_init(&argc,&argv);

  window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
  button=gtk_button_new_with_label("Test");
  label=gtk_label_new("Label");
  vbox=gtk_vbox_new(FALSE,0);
  
  gtk_box_pack_start(GTK_BOX(vbox),label,TRUE,TRUE,0);
  gtk_box_pack_start(GTK_BOX(vbox),button,TRUE,TRUE,0);
  gtk_container_add(GTK_CONTAINER(window),vbox);

  gtk_signal_connect(GTK_OBJECT(button),"button_press_event",
		     GTK_SIGNAL_FUNC(callback),NULL);
  gtk_signal_connect(GTK_OBJECT(button),"destroy",
		     GTK_SIGNAL_FUNC(destroy),NULL);
  
  gtk_widget_show(button);
  gtk_widget_show(label);
  gtk_widget_show(vbox);
  gtk_widget_show(window);

  gtk_main();

  return 1;
}

Ketil Froyn
--
He who Laughs, Lasts.

http://www.ifi.uio.no/~ketilf/       
mailto:ketilf@ifi.uio.no



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