Re: [gtk-list] Re: hidden GtkButton retains focus!



>>>>> "Havoc" == Havoc Pennington <hp@redhat.com> writes:

Havoc> On Fri, 16 Jul 1999, Ray Clouse wrote:
>>  I've tried using a gtk_widget_grab_focus to try to force the focus
>> away, but that didn't help.  It isn't a serious bug, just an
>> annoying one.  What's going on?
>> 

Havoc> Sounds like a bug - can you write a small test program or
Havoc> isolate the relevant part of your program and send that in? It
Havoc> would be very helpful in figuring out the problem.

Now you are officially "on the team", maybe you can have a look at
this one...  This is the third time I have reported this bug :-)

Just follow the instructions in the button labels.

- Dave

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#include <gtk/gtk.h>

static gint timer_id;

static void lock_gui_cb(GtkWidget *btn)
{
	gtk_widget_set_sensitive(btn, FALSE);
	gtk_label_set_text(GTK_LABEL(GTK_BIN(btn)->child),
			   "GUI is locked");
	gtk_timeout_remove(timer_id);
	timer_id = 0;
}

static void clicked_cb(GtkWidget *btn, gpointer user_data)
{
	if (timer_id == 0) {
		gtk_label_set_text(GTK_LABEL(GTK_BIN(btn)->child),
				   "Press and hold me down");
		timer_id = gtk_timeout_add(2000, (GtkFunction)lock_gui_cb,
					   btn);
	}
}

int main(int argc, char *argv[])
{
	GtkWidget *top;
	GtkWidget *box;
	GtkWidget *btn;

	gtk_init(&argc, &argv);

	top = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_widget_show(top);
	gtk_window_set_title(GTK_WINDOW(top), "Grab bug");
	gtk_window_set_policy(GTK_WINDOW(top), TRUE, TRUE, FALSE);
	gtk_signal_connect(GTK_OBJECT(top), "delete_event",
			   GTK_SIGNAL_FUNC(gtk_main_quit), NULL);

	box = gtk_vbox_new(FALSE, 10);
	gtk_container_border_width(GTK_CONTAINER(box), 10);
	gtk_container_add(GTK_CONTAINER(top), box);

	btn = gtk_button_new_with_label("Click Me");
	gtk_signal_connect(GTK_OBJECT(btn), "clicked",
			   GTK_SIGNAL_FUNC(clicked_cb), NULL);
	gtk_box_pack_start(GTK_BOX(box), btn, TRUE, FALSE, 0);

	gtk_box_pack_start(GTK_BOX(box),
			   gtk_button_new_with_label("Test Me"),
			   TRUE, FALSE, 0);

	gtk_widget_show_all(top);

	gtk_main();

	return 0;
}



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