<Swing Dev> [PATCH] 6624717: Corrupted combo box, GTK L&F, Ubuntu 7.10

Thomas Fitzsimmons fitzsim at redhat.com
Thu Apr 10 17:47:26 UTC 2008


Damjan Jovanovic wrote:
> Hi
> 
> In http://www.mail-archive.com/swing-dev@openjdk.java.net/msg00092.html
> Kirill Kirichenko said that the problem with combo boxes is that the
> entry and the button are drawn separately, and they each need to be in
> a GtkComboBoxEntry so the theme engine draws them right, but since
> GtkComboBoxEntry now only supports GtkEntry subclasses as children (if
> you try to add a button to a GtkComboBoxEntry it doesn't actually get
> added), the button has to be drawn by us instead of GTK.
> 
> Well, from what I can see, we already draw the button correctly, and
> with my patch below the button colour and arrow are identical to GTK's
> own GtkComboBoxEntry under every theme that comes with Ubuntu
> (Clearlooks, Human, Mist, ...). By just not adding the button to a
> GtkComboBoxEntry, we get the right results.

Kirill already rejected a similar patch I proposed in November:

http://mail.openjdk.java.net/pipermail/swing-dev/2007-November/000103.html

His preferred solution is "[...] to find out how ArrowButtons are rendered in 
native gtk and do the same in our code."

Tom

> 
> Bye
> Damjan
> 
> diff -r 0f955581dc0b src/solaris/native/sun/awt/gtk2_interface.c
> --- a/src/solaris/native/sun/awt/gtk2_interface.c       Mon Mar 24
> 06:33:16 2008 -0700
> +++ b/src/solaris/native/sun/awt/gtk2_interface.c       Sat Apr 05
> 10:20:00 2008 +0200
> @@ -1410,13 +1410,12 @@ static GtkWidget *gtk2_get_widget(Widget
>              (*fp_gtk_menu_item_set_submenu)((GtkMenuItem*)root_menu, result);
>              (*fp_gtk_menu_shell_append)((GtkMenuShell *)menu_bar, root_menu);
>          }
> -        else if (widget_type == COMBO_BOX_ARROW_BUTTON ||
> -                 widget_type == COMBO_BOX_TEXT_FIELD)
> +        else if (widget_type == COMBO_BOX_TEXT_FIELD)
>          {
>              /*
> -             * We add a regular GtkButton/GtkEntry to a GtkComboBoxEntry
> +             * We add a regular GtkEntry to a GtkComboBoxEntry
>               * in order to trick engines into thinking it's a real combobox
> -             * arrow button/text field.
> +             * text field.
>               */
>              GtkWidget *combo = (*fp_gtk_combo_box_entry_new)();
>              (*fp_gtk_container_add)((GtkContainer *)combo, result);




More information about the swing-dev mailing list