After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 734213 - GtkSwitch showing up with "mixed" state when setting it active before showing
GtkSwitch showing up with "mixed" state when setting it active before showing
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.13.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-08-04 00:10 UTC by Volker Sobek (weld)
Modified: 2014-08-04 12:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Button with mixed state (3.68 KB, image/png)
2014-08-04 00:10 UTC, Volker Sobek (weld)
Details

Description Volker Sobek (weld) 2014-08-04 00:10:56 UTC
Created attachment 282420 [details]
Button with mixed state

It seems that since the commit introducing animation, switches show up incorrectly when they are activated before they are shown. See attached test.c and screen shot. The first button is activated and the second button is deactivated before the window is shown. The second one shows up correctly, the first one not.
Comment 1 Volker Sobek (weld) 2014-08-04 00:11:33 UTC
/* gcc `pkg-config --cflags gtk+-3.0` -o test test.c `pkg-config --libs gtk+-3.0` */
#include <gtk/gtk.h>

int
main (int argc, gchar *argv[])
{
  gtk_init (&argc, &argv);

  GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  GtkWidget *box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);

  GtkWidget *switch_off = gtk_switch_new ();
  GtkWidget *switch_on = gtk_switch_new ();

  gtk_switch_set_active (GTK_SWITCH (switch_off), FALSE);
  gtk_switch_set_active (GTK_SWITCH (switch_on), TRUE);

  gtk_box_pack_start (GTK_BOX (box), switch_on, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (box), switch_off, FALSE, FALSE, 0);

  gtk_container_add (GTK_CONTAINER (window), box);

  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);

  gtk_widget_show_all (window);

  gtk_main ();

  return 0;
}
Comment 2 Matthias Clasen 2014-08-04 07:26:26 UTC
The same problem will probably occur if you call set_active after showing it as well, no ?