A bug in GtkEntry?



If you run the following code, you'll see the following:

1. Type something into the entry.  The "bar" cursor disappears and the
   text appears in the entry.
   Next, you click on the button.  The entry is insensitive and grayed
   out.

2. Type something into the entry.  The "bar" cursor disappears and the
   text appears in the entry.
   Next, press Enter.  The default widget (the button is activated).
   However, pass the mouse over the Entry.  You'll notice the mouse is
   permanently "vanished" from the Entry (unless you make it sensitive
   again).

Is this a bug, or intended?  I was quite surprised when I observed
this, wondering where one earth my mouse had gone!

It looks like this is dependent on the focus state (or mouse hiding
tricks) of the Entry when you make it insensitive.


Regards,
Roger


This is the testcase:

#include <gtk/gtk.h>

GtkWidget *entry;

void
on_button_clicked(GtkWidget *widget,
		  gpointer data)
{
  gtk_widget_set_sensitive(entry, FALSE);
}

int main(int argc, char *argv[])
{
  GtkWidget *window;
  GtkWidget *vbox;
  GtkWidget *button;
  gtk_init(&argc, &argv);
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  vbox = gtk_vbox_new(FALSE, 5);
  entry = gtk_entry_new();
  button = gtk_button_new_with_mnemonic("_Click Me");
  gtk_container_add(GTK_CONTAINER(window), vbox);
  gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
  GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
  gtk_widget_grab_default(button);
  g_signal_connect(G_OBJECT(window), "destroy", gtk_main_quit, NULL);
  gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
  g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(on_button_clicked), NULL);
  gtk_widget_show_all(window);
  gtk_main();
  return 0;
}



-- 
Roger Leigh

                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.



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