Created attachment 55193 [details] Screenshot of HandBrake Version: unspecified (using KDE 4.4.6) OS: Linux The title selector combo in HandBrake's Gtk2 GUI is not rendered correctly. Looks as if only the part with the arrow is actually drawn. Reproducible: Always Steps to Reproduce: Start the application!
Can reproduce. Will have a look. Likely some custom painting that conflicts with ours. mmmm
Looking into the code. This is because this particular combobox, unlike others has its property "has-frame" set to false. We can either 1/ use a special rendering for such comboboxes (basically: also render the arrow as flat, with highlight on hover 2/ force the has-frame property to true. Ruslan ? Cedric ? Opinion ? "From the book", one should use 1/ Besides, I'm not sure 2/ is actually doable, though I will give it a shot.
> 1/ use a special rendering for such comboboxes (basically: also render the arrow as flat, with highlight on hover I like this idea. In fact, we could make highlight and pressed state look like no-relief/toolbar button highlight&press, i.e. slit and hole, instead of usual slab.
@Ruslan I like the idea too, (and in fact, Qt has a similar feature), but that wont be possible (I think). Basically, setting "has-frame" to false on the GtkComboBox results in the GtkFrame (that we use for painting about the GtkCellView) is not created at all. Since we can't paint anything ourselves in the GtkCellView, this means that there can be no feeback at all on the text part of the combobox. This leaves the arrow. We can either render it as you suggest (like in a toolbar), but I believe it might look strange (since it would also glow on hover), or like a "scrollbar-like" type of arrows: no frame, glow on hover. I would rather vote for the second, but am open for discussion. What do you think ?
Hmm... that's bad that we can't draw the text part... but i would then suggest drawing the arrow button as a no-relief button. Other way, we could force has-frame property, but still draw the combobox as is intended by the app creator, i.e. as i suggested before.
I tried to force the has-frame, using g_object_set_property(...) but without success so far. Meaning: the property is set but nothing happens: apparently this only works if has-frame is set before the widget is realized. Truth is: everything flat (which I tested locally), does not look really good. I wonder why the app set that flag in the first place; which QtCurve does not honour anyway, without problem, since appears-as-list is not used by GtkComboBox. I'll send screenshot.
Created attachment 55211 [details] "flat" GtkComboBox The "no title" and arrow correspond to the flat combobox.
Anyway, drawing it flat seems to be the only really correct solution. The fact that this doesn't look too good should be directed upstream (if most themes don't honor this flag, why set it?).
Agreed. Will do as you suggest. Use flat-like button.
commit 08ab484991419835d7a8b489f52c1f1eb227b930 branch 1.0 Author: Hugo Pereira Da Costa <hugo@oxygen-icons.org> Date: Fri Dec 24 16:03:55 2010 +0100 Added gtk_combobox_has_frame utility function. CCBUG: 261101 diff --git a/src/oxygengtkutils.cpp b/src/oxygengtkutils.cpp index a49f653..a59003d 100644 --- a/src/oxygengtkutils.cpp +++ b/src/oxygengtkutils.cpp @@ -372,6 +372,17 @@ namespace Oxygen } //________________________________________________________ + bool Gtk::gtk_combobox_has_frame( GtkWidget* widget ) + { + + GValue val = { 0, }; + g_value_init(&val, G_TYPE_BOOLEAN); + g_object_get_property( G_OBJECT( widget ), "has-frame", &val ); + return (bool) g_value_get_boolean( &val ); + + } + + //________________________________________________________ bool Gtk::gtk_combobox_is_tree_view( GtkWidget* widget ) { // check types diff --git a/src/oxygengtkutils.h b/src/oxygengtkutils.h index 7f2ae81..ea04bb7 100644 --- a/src/oxygengtkutils.h +++ b/src/oxygengtkutils.h @@ -148,6 +148,9 @@ namespace Oxygen //!@name combobox utilities //@{ + //! returns true if combobox has frame + bool gtk_combobox_has_frame( GtkWidget* ); + //! true if widget is the treeview of a combobox bool gtk_combobox_is_tree_view( GtkWidget* );
commit b071eec8f25014fafacdcabffb02a2305ff78507 branch 1.0 Author: Hugo Pereira Da Costa <hugo@oxygen-icons.org> Date: Fri Dec 24 18:12:45 2010 +0100 Render arrow of flat (has_frame == false) combobox as toolbutton. CCBUG: 261101 diff --git a/src/oxygenstylewrapper.cpp b/src/oxygenstylewrapper.cpp index 57e2584..917c944 100644 --- a/src/oxygenstylewrapper.cpp +++ b/src/oxygenstylewrapper.cpp @@ -619,11 +619,22 @@ namespace Oxygen Style::instance().animations().comboBoxEngine().initializeCellLayout( parent ); Style::instance().animations().comboBoxEngine().setButton( parent, widget ); Style::instance().animations().comboBoxEngine().setButtonFocus( parent, options & Focus ); - if( Style::instance().animations().comboBoxEngine().hovered( parent ) ) options |= Hover; - TileSet::Tiles tiles( TileSet::Ring ); - tiles &= ~TileSet::Left; - Style::instance().renderButtonSlab( window, clipRect, x-7, y, w+7, h, options, tiles ); + if( Gtk::gtk_combobox_has_frame( parent ) ) + { + if( Style::instance().animations().comboBoxEngine().hovered( parent ) ) options |= Hover; + + TileSet::Tiles tiles( TileSet::Ring ); + tiles &= ~TileSet::Left; + Style::instance().renderButtonSlab( window, clipRect, x-7, y, w+7, h, options, tiles ); + + } else { + + options |= Flat; + if( Style::instance().animations().comboBoxEngine().hovered( parent ) ) options |= Hover; + Style::instance().renderButtonSlab( window, clipRect, x-1, y, w, h, options ); + + } #if GTK_CHECK_VERSION(2, 20, 0) } else if( GTK_IS_TOOL_ITEM_GROUP( widget ) ) { @@ -1585,6 +1596,7 @@ namespace Oxygen // Arrows which are active are painted as hovered if( state == GTK_STATE_ACTIVE ) options |= Hover; + GtkWidget* parent( 0L ); if( d.isTearOffMenuItem() ) { if( widget && gtk_widget_get_state( widget ) != GTK_STATE_PRELIGHT && GTK_IS_MENU( gtk_widget_get_parent( widget ) ) && GTK_MENU( gtk_widget_get_parent( widget ) )->torn_off ) @@ -1634,7 +1646,7 @@ namespace Oxygen if( state != GTK_STATE_INSENSITIVE ) options &= ~Contrast; - } else if( Gtk::gtk_parent_combobox( widget ) ) { + } else if( ( parent = Gtk::gtk_parent_combobox( widget ) ) ) { options &= ~( Focus|Hover ); y+= 1;
Closing. Decided to render the arrow as a toolbutton. Not much more we can do. Use of a flat combobox is IMO not justified here, but that should be fixed by the application in HandBrake/gtk/src/ghb.ui: 750d749 < <property name="has_frame">False</property>