GNOME Bugzilla – Bug 681977
Hiding then showing window makes GtkEntry insensitive on Windows 7
Last modified: 2018-05-02 15:29:15 UTC
os : windows 7 gtk+2 here is mine code : void tray_activate(GObject *trayIcon, gpointer window) { gtk_widget_show(window); gtk_window_deiconify(window); } gboolean window_state_event_change(GtkWidget *widget, GdkEventWindowState *event, gpointer trayIcon) { if (event->changed_mask == GDK_WINDOW_STATE_ICONIFIED && (event->new_window_state == GDK_WINDOW_STATE_ICONIFIED || event->new_window_state == (GDK_WINDOW_STATE_ICONIFIED | GDK_WINDOW_STATE_MAXIMIZED))) { gtk_widget_hide(widget); gtk_status_icon_set_visible(GTK_STATUS_ICON(trayIcon), TRUE); } return FALSE; } int main(void) { GtkWidget *window; GtkWidget *text; GtkStatusIcon *trayIcon; gtk_init(NULL, NULL); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(window, "destroy", G_CALLBAK(gtk_main_quit), NULL); trayIcon = gtk_status_icon_from_file("e://hao.icon"); g_signal_connect(trayIcon, "activate", tray_activate, window); g_signal_connect(window, "window-state-event", G_CALLBACK(window_state_event_chagne), trayIcon); text = gtk_entry_new(); gtk_container_add(GTK_CONTAINER(window), text); gtk_widget_show(text); gtk_widget_show(window); gtk_main(); return 0; } these codes, in linux is good. but in my "windows 7 os", when call gtk_widget_show(window) again, then text will be disabled.
(In reply to zxjlwt from comment #0) > os : windows 7 > gtk+2 So don't tag it as GTK+ 3, please. GTK+ 3 does not seem to share this problem. > here is mine code : > these codes, in linux is good. I doubt that. It doesn't even compile. There's no G_CALLBAK, no gtk_status_icon_from_file(), no window_state_event_chagne(), etc. After fixing all that... > but in my "windows 7 os", when call gtk_widget_show(window) again, then text > will be disabled. This does seem to happen for me, too. Swapping the calls to show() and deiconify() works around it. => not "major" On exit, I get this: > (a.exe:1940): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed so maybe the program is doing something undefined and confusing GTK+. I didn't go over it with a fine-toothed comb yet.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/403.