GNOME Bugzilla – Bug 475909
In GTK 2.10.x, scroll bar buttons are sized too large when GTK_CAN_FOCUS flag is set
Last modified: 2015-12-21 23:51:20 UTC
Please describe the problem: In the GTK 2.10.x stream, setting the GTK_CAN_FOCUS flag on a scrollbar causes the end buttons of the scrollbar to be sized taller then the scollbar itself. Steps to reproduce: Here is a code snippet that illustrates the problem: ============================================================= #include <gtk/gtk.h> // build with : // gcc scrollBar.c -o scrollBar `pkg-config --cflags --libs gtk+-2.0` int main (int argc, char** argv) { GtkWidget *shellHandle, *scrollBar; GtkObject *hAdjustment; gtk_init_check (&argc, &argv); shellHandle = gtk_window_new (GTK_WINDOW_TOPLEVEL); hAdjustment = gtk_adjustment_new (0, 0, 100, 1, 10, 10); scrollBar = gtk_hscrollbar_new (GTK_ADJUSTMENT(hAdjustment)); GTK_WIDGET_SET_FLAGS(scrollBar, GTK_CAN_FOCUS); gtk_container_add (GTK_CONTAINER (shellHandle), scrollBar); printf ("GTK version %i.%i.%i\n", gtk_major_version, gtk_minor_version, gtk_micro_version); g_signal_connect (G_OBJECT (shellHandle), "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect (G_OBJECT (shellHandle), "delete_event",G_CALLBACK (gtk_main_quit), NULL); gtk_window_set_default_size(GTK_WINDOW(shellHandle), 200, 200); gtk_window_move (GTK_WINDOW(shellHandle), 200, 200); gtk_widget_show_all (shellHandle); gtk_main(); } Actual results: When you run the above snippet, a window will pop up with a scrollbar in it. The scrollbar's end buttons will be badly sized if you are running against GTK 2.10.x (note that 2.8, 2.6 and 2.4 all work as expected with the above code). Note that if you comment out the GTK_WIDGET_SET_FLAGS line, everything works as expected. Expected results: I expect the buttons to be the same size as the scrollbar. Does this happen every time? Yes. Other information:
One more thing to add: this only affects horizontal scrollbars (ie. gtk_hscrollbar_new) - vertical scrollbars still work as expected.
Created attachment 239876 [details] test case updated for gtk3 Still an issue for GTK2. But less of one for GTK3 since high contrast and adwaita don't use stepper buttons by default. However, if you have a theme with steppers this is still present in 3.
time to close this. not going to fix this in gtk2 at this point