[PATCH] GTK theme toolbar button rendering

David Tardon dtardon at redhat.com
Mon May 28 00:08:57 PDT 2012


On Sat, May 26, 2012 at 09:40:49PM +0400, Ruslan Kabatsayev wrote:
> Hello,
> 
> Current GTK theming plugin renders toolbar buttons as non-flat
> unconditionally. But some themes, e.g. oxygen-gtk expect toolbuttons
> to be flat, and the desktop integration fails.
> I'm attaching a patch to fix this. The patch has been tested with
> oxygen-gtk(current master), QtCurve-GTK, Glossy and Simple themes.

Hi,

> @@ -1155,8 +1155,31 @@ sal_Bool GtkSalGraphics::NWPaintGTKButtonReal(
>  
> NWEnsureGTKButton( m_nXScreen );
> NWEnsureGTKToolbar( m_nXScreen );
> -    NWConvertVCLStateToGTKState( nState, &stateType,
> &shadowType );
> -    NWSetWidgetState(
> gWidgetData[m_nXScreen].gBtnWidget, nState,
> stateType );
> +
> +    // Flat toolbutton has a bit bigger variety of
> states than normal buttons, so handle it
> differently
> +    if(GTK_IS_TOGGLE_BUTTON(button))
> +    {
> +       if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))

This is equivalent to "if(nState & CTRL_STATE_PRESSED)", is it not?

> +           shadowType=GTK_SHADOW_IN;
> +       else
> +           shadowType=GTK_SHADOW_OUT;
> +
> +       if(nState & CTRL_STATE_ROLLOVER)
> +           stateType=GTK_STATE_PRELIGHT;
> +       else
> +           stateType=GTK_STATE_NORMAL;
> +
> +       if(nState & CTRL_STATE_PRESSED)
> +       {
> +           stateType=GTK_STATE_ACTIVE;
> +           shadowType=GTK_SHADOW_IN;
> +       }
> +    }

It seems to me that this code could be used in
NWConvertVCLStateToGTKState (with the above modification), so there
would be no need for toggle button-specific code branch. Or am I missing
something?

D.


More information about the LibreOffice mailing list