Hi,
Here are some patchs to solve problems in GTK integration:
- Fix separators, they weren't properly aligned, and they didn't use
gtk_paint_box when needed some gtk themes/engine draw lines with box ^^
(for 3d appearance for instance)
- Fix pressed toolbar buttons state: it wasn't drawn correctly (it must
have been caused by some change in the DrawNativeControl calls)
- Fix toolbar buttons background: window background was paint, but the
background was the toolbar, so, now, the background of the toolbar is
paint
- Use gtk_paint_box instead of gtk_paint_flat_box for buttondefault, it
wasn't correct and caused some weird things in the corners of selected
buttons, see the options dialog, "ok" button for example.
- Code cleanup: remove a function call which set the widgets flags, it
is useless (and could cause some segfaults) since we must specify widget
state and shadow in gtk_paint_(flat_)box.
- Code cleanup: remove duplicated code, toolbar button are now drawn
using the same function as normal buttons.
They belong to libs-gui, module vcl.
By chance, the second one could be pushed to the 3.4 branch? I'm not
sure if it is still possible, but it causes a really bad glitch for the
toolbar buttons (and it is a regression, 3.3 didn't have this problem).
The separator thing is also a bit annoying, since I think separators are
also in 3.4 changelog.
And since most of this patch only impacts the toolbar, I don't think
there could be any problem with it.
Lucas Baudin
From b6be3f744939316a1684531c7d48f211a7e006cb Mon Sep 17 00:00:00 2001
From: Lucas Baudin <xapantu@gmail.com>
Date: Sat, 21 May 2011 16:21:13 +0200
Subject: [PATCH 1/2] Replace tabs by space in salnativewidgets-gtk.cxx
---
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 522 +++++++++++++++---------------
1 files changed, 261 insertions(+), 261 deletions(-)
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 5c562a1..127c5f0 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -69,23 +69,23 @@ class NWPixmapCacheList;
class NWPixmapCache;
struct NWFWidgetData
{
- GtkWidget * gCacheWindow;
- GtkWidget * gDumbContainer;
-
- GtkWidget * gBtnWidget;
- GtkWidget * gRadioWidget;
- GtkWidget * gRadioWidgetSibling;
- GtkWidget * gCheckWidget;
- GtkWidget * gScrollHorizWidget;
- GtkWidget * gScrollVertWidget;
- GtkWidget * gArrowWidget;
- GtkWidget * gDropdownWidget;
- GtkWidget * gEditBoxWidget;
- GtkWidget * gSpinButtonWidget;
- GtkWidget * gNotebookWidget;
- GtkWidget * gOptionMenuWidget;
- GtkWidget * gComboWidget;
- GtkWidget * gScrolledWindowWidget;
+ GtkWidget * gCacheWindow;
+ GtkWidget * gDumbContainer;
+
+ GtkWidget * gBtnWidget;
+ GtkWidget * gRadioWidget;
+ GtkWidget * gRadioWidgetSibling;
+ GtkWidget * gCheckWidget;
+ GtkWidget * gScrollHorizWidget;
+ GtkWidget * gScrollVertWidget;
+ GtkWidget * gArrowWidget;
+ GtkWidget * gDropdownWidget;
+ GtkWidget * gEditBoxWidget;
+ GtkWidget * gSpinButtonWidget;
+ GtkWidget * gNotebookWidget;
+ GtkWidget * gOptionMenuWidget;
+ GtkWidget * gComboWidget;
+ GtkWidget * gScrolledWindowWidget;
GtkWidget * gToolbarWidget;
GtkWidget * gToolbarButtonWidget;
GtkWidget * gToolbarToggleWidget;
@@ -153,29 +153,29 @@ struct NWFWidgetData
// Keep a hash table of Widgets->default flags so that we can
// easily and quickly reset each to a default state before using
// them
-static boost::unordered_map<long, guint> gWidgetDefaultFlags;
+static boost::unordered_map<long, guint> gWidgetDefaultFlags;
static std::vector<NWFWidgetData> gWidgetData;
-static const GtkBorder aDefDefBorder = { 1, 1, 1, 1 };
+static const GtkBorder aDefDefBorder = { 1, 1, 1, 1 };
// Some GTK defaults
-#define MIN_ARROW_SIZE 11
-#define BTN_CHILD_SPACING 1
-#define MIN_SPIN_ARROW_WIDTH 6
-
-
-static void NWEnsureGTKRadio ( int nScreen );
-static void NWEnsureGTKButton ( int nScreen );
-static void NWEnsureGTKCheck ( int nScreen );
-static void NWEnsureGTKScrollbars ( int nScreen );
-static void NWEnsureGTKArrow ( int nScreen );
-static void NWEnsureGTKEditBox ( int nScreen );
-static void NWEnsureGTKSpinButton ( int nScreen );
-static void NWEnsureGTKNotebook ( int nScreen );
-static void NWEnsureGTKOptionMenu ( int nScreen );
-static void NWEnsureGTKCombo ( int nScreen );
-static void NWEnsureGTKScrolledWindow ( int nScreen );
-static void NWEnsureGTKToolbar ( int nScreen );
+#define MIN_ARROW_SIZE 11
+#define BTN_CHILD_SPACING 1
+#define MIN_SPIN_ARROW_WIDTH 6
+
+
+static void NWEnsureGTKRadio ( int nScreen );
+static void NWEnsureGTKButton ( int nScreen );
+static void NWEnsureGTKCheck ( int nScreen );
+static void NWEnsureGTKScrollbars ( int nScreen );
+static void NWEnsureGTKArrow ( int nScreen );
+static void NWEnsureGTKEditBox ( int nScreen );
+static void NWEnsureGTKSpinButton ( int nScreen );
+static void NWEnsureGTKNotebook ( int nScreen );
+static void NWEnsureGTKOptionMenu ( int nScreen );
+static void NWEnsureGTKCombo ( int nScreen );
+static void NWEnsureGTKScrolledWindow ( int nScreen );
+static void NWEnsureGTKToolbar ( int nScreen );
static void NWEnsureGTKMenubar ( int nScreen );
static void NWEnsureGTKMenu ( int nScreen );
static void NWEnsureGTKTooltip ( int nScreen );
@@ -234,7 +234,7 @@ static Rectangle NWGetToolbarRect( int nScreen,
const OUString& rCaption );
//---
-static Rectangle NWGetScrollButtonRect( int nScreen, ControlPart nPart, Rectangle aAreaRect
);
+static Rectangle NWGetScrollButtonRect( int nScreen, ControlPart nPart, Rectangle aAreaRect );
//---
/*********************************************************
@@ -387,10 +387,10 @@ void NWPixmapCacheList::ThemeChanged( )
*********************************************************/
inline void NW_gtk_border_set_from_border( GtkBorder& aDst, const GtkBorder * pSrc )
{
- aDst.left = pSrc->left;
- aDst.top = pSrc->top;
- aDst.right = pSrc->right;
- aDst.bottom = pSrc->bottom;
+ aDst.left = pSrc->left;
+ aDst.top = pSrc->top;
+ aDst.right = pSrc->right;
+ aDst.bottom = pSrc->bottom;
}
@@ -531,40 +531,40 @@ void GtkSalGraphics::copyBits( const SalTwoRect* pPosAry,
sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart )
{
if (
- ((nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL)) ||
- ((nType==CTRL_RADIOBUTTON) && (nPart==PART_ENTIRE_CONTROL)) ||
- ((nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL)) ||
+ ((nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL)) ||
+ ((nType==CTRL_RADIOBUTTON) && (nPart==PART_ENTIRE_CONTROL)) ||
+ ((nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL)) ||
((nType==CTRL_SCROLLBAR) &&
( (nPart==PART_DRAW_BACKGROUND_HORZ)
|| (nPart==PART_DRAW_BACKGROUND_VERT)
|| (nPart==PART_ENTIRE_CONTROL)
- || (nPart==HAS_THREE_BUTTONS) ) ) ||
+ || (nPart==HAS_THREE_BUTTONS) ) ) ||
((nType==CTRL_EDITBOX) &&
( (nPart==PART_ENTIRE_CONTROL)
- || (nPart==HAS_BACKGROUND_TEXTURE) ) ) ||
+ || (nPart==HAS_BACKGROUND_TEXTURE) ) ) ||
((nType==CTRL_MULTILINE_EDITBOX) &&
( (nPart==PART_ENTIRE_CONTROL)
- || (nPart==HAS_BACKGROUND_TEXTURE) ) ) ||
+ || (nPart==HAS_BACKGROUND_TEXTURE) ) ) ||
((nType==CTRL_SPINBOX) &&
( (nPart==PART_ENTIRE_CONTROL)
|| (nPart==PART_ALL_BUTTONS)
- || (nPart==HAS_BACKGROUND_TEXTURE) ) ) ||
+ || (nPart==HAS_BACKGROUND_TEXTURE) ) ) ||
((nType==CTRL_SPINBUTTONS) &&
( (nPart==PART_ENTIRE_CONTROL)
- || (nPart==PART_ALL_BUTTONS) ) ) ||
+ || (nPart==PART_ALL_BUTTONS) ) ) ||
((nType==CTRL_COMBOBOX) &&
( (nPart==PART_ENTIRE_CONTROL)
- || (nPart==HAS_BACKGROUND_TEXTURE) ) ) ||
+ || (nPart==HAS_BACKGROUND_TEXTURE) ) ) ||
(((nType==CTRL_TAB_ITEM) || (nType==CTRL_TAB_PANE) ||
(nType==CTRL_TAB_BODY) || (nType==CTRL_FIXEDBORDER)) &&
( (nPart==PART_ENTIRE_CONTROL)
- || (nPart==PART_TABS_DRAW_RTL) ) ) ||
+ || (nPart==PART_TABS_DRAW_RTL) ) ) ||
((nType==CTRL_LISTBOX) &&
( (nPart==PART_ENTIRE_CONTROL)
|| (nPart==PART_WINDOW)
- || (nPart==HAS_BACKGROUND_TEXTURE) ) ) ||
+ || (nPart==HAS_BACKGROUND_TEXTURE) ) ) ||
((nType == CTRL_TOOLBAR) &&
- ( (nPart==PART_ENTIRE_CONTROL)
+ ( (nPart==PART_ENTIRE_CONTROL)
|| (nPart==PART_DRAW_BACKGROUND_HORZ)
|| (nPart==PART_DRAW_BACKGROUND_VERT)
|| (nPart==PART_THUMB_HORZ)
@@ -615,11 +615,11 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType,
ControlPar
*
* returns whether bIsInside was really set.
*/
-sal_Bool GtkSalGraphics::hitTestNativeControl( ControlType nType,
- ControlPart nPart,
- const Rectangle& rControlRegion,
- const Point& aPos,
- sal_Bool& rIsInside )
+sal_Bool GtkSalGraphics::hitTestNativeControl( ControlType nType,
+ ControlPart nPart,
+ const Rectangle& rControlRegion,
+ const Point& aPos,
+ sal_Bool& rIsInside )
{
if ( ( nType == CTRL_SCROLLBAR ) &&
( ( nPart == PART_BUTTON_UP ) ||
@@ -721,18 +721,18 @@ sal_Bool GtkSalGraphics::hitTestNativeControl( ControlType
nType,
*
* Draws the requested control described by nPart/nState.
*
- * rControlRegion: The bounding region of the complete control in VCL frame coordinates.
- * aValue: An optional value (tristate/numerical/string)
- * rCaption: A caption or title string (like button text etc)
+ * rControlRegion: The bounding region of the complete control in VCL frame coordinates.
+ * aValue: An optional value (tristate/numerical/string)
+ * rCaption: A caption or title string (like button text etc)
*/
-sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType,
+sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType,
ControlPart nPart,
const Rectangle& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
const OUString& rCaption )
{
- sal_Bool returnVal = sal_False;
+ sal_Bool returnVal = sal_False;
// get a GC with current clipping region set
GetFontGC();
@@ -897,11 +897,11 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType,
* OPTIONAL. Draws the requested text for the control described by nPart/nState.
* Used if text not drawn by DrawNativeControl().
*
- * rControlRegion: The bounding region of the complete control in VCL frame coordinates.
- * aValue: An optional value (tristate/numerical/string)
- * rCaption: A caption or title string (like button text etc)
+ * rControlRegion: The bounding region of the complete control in VCL frame coordinates.
+ * aValue: An optional value (tristate/numerical/string)
+ * rCaption: A caption or title string (like button text etc)
*/
-sal_Bool GtkSalGraphics::drawNativeControlText( ControlType,
+sal_Bool GtkSalGraphics::drawNativeControlText( ControlType,
ControlPart,
const Rectangle&,
ControlState,
@@ -921,9 +921,9 @@ sal_Bool GtkSalGraphics::drawNativeControlText( ControlType,
* within the control that can be safely drawn into without drawing over
* the borders of the control.
*
- * rControlRegion: The bounding region of the control in VCL frame coordinates.
- * aValue: An optional value (tristate/numerical/string)
- * rCaption: A caption or title string (like button text etc)
+ * rControlRegion: The bounding region of the control in VCL frame coordinates.
+ * aValue: An optional value (tristate/numerical/string)
+ * rCaption: A caption or title string (like button text etc)
*/
sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType,
ControlPart nPart,
@@ -972,9 +972,9 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType,
returnVal = sal_True;
}
if ( (nType==CTRL_TOOLBAR) &&
- ((nPart==PART_DRAW_BACKGROUND_HORZ) ||
- (nPart==PART_DRAW_BACKGROUND_VERT) ||
- (nPart==PART_THUMB_HORZ) ||
+ ((nPart==PART_DRAW_BACKGROUND_HORZ) ||
+ (nPart==PART_DRAW_BACKGROUND_VERT) ||
+ (nPart==PART_THUMB_HORZ) ||
(nPart==PART_THUMB_VERT) ||
(nPart==PART_BUTTON)
))
@@ -1137,16 +1137,16 @@ sal_Bool GtkSalGraphics::NWPaintGTKButton(
ControlState nState, const ImplControlValue&,
const OUString& )
{
- GtkStateType stateType;
- GtkShadowType shadowType;
- gboolean interiorFocus;
- gint focusWidth;
- gint focusPad;
- sal_Bool bDrawFocus = sal_True;
- gint x, y, w, h;
- GtkBorder aDefBorder;
- GtkBorder* pBorder;
- GdkRectangle clipRect;
+ GtkStateType stateType;
+ GtkShadowType shadowType;
+ gboolean interiorFocus;
+ gint focusWidth;
+ gint focusPad;
+ sal_Bool bDrawFocus = sal_True;
+ gint x, y, w, h;
+ GtkBorder aDefBorder;
+ GtkBorder* pBorder;
+ GdkRectangle clipRect;
NWEnsureGTKButton( m_nScreen );
NWConvertVCLStateToGTKState( nState, &stateType, &shadowType );
@@ -1157,10 +1157,10 @@ sal_Bool GtkSalGraphics::NWPaintGTKButton(
h = rControlRectangle.GetHeight();
// Grab some button style attributes
- gtk_widget_style_get( gWidgetData[m_nScreen].gBtnWidget, "focus-line-width", &focusWidth,
- "focus-padding", &focusPad,
- "interior_focus", &interiorFocus,
- "default_border", &pBorder,
+ gtk_widget_style_get( gWidgetData[m_nScreen].gBtnWidget, "focus-line-width", &focusWidth,
+ "focus-padding", &focusPad,
+ "interior_focus", &interiorFocus,
+ "default_border", &pBorder,
(char *)NULL );
// Make sure the border values exist, otherwise use some defaults
@@ -1227,21 +1227,21 @@ static Rectangle NWGetButtonArea( int nScreen,
ControlType, ControlPart, Rectangle aAreaRect, ControlState
nState,
const ImplControlValue&, const OUString& )
{
- gboolean interiorFocus;
- gint focusWidth;
- gint focusPad;
- GtkBorder aDefBorder;
- GtkBorder * pBorder;
- sal_Bool bDrawFocus = sal_True;
- Rectangle aRect;
- gint x, y, w, h;
+ gboolean interiorFocus;
+ gint focusWidth;
+ gint focusPad;
+ GtkBorder aDefBorder;
+ GtkBorder * pBorder;
+ sal_Bool bDrawFocus = sal_True;
+ Rectangle aRect;
+ gint x, y, w, h;
NWEnsureGTKButton( nScreen );
gtk_widget_style_get( gWidgetData[nScreen].gBtnWidget,
- "focus-line-width", &focusWidth,
- "focus-padding", &focusPad,
- "interior_focus", &interiorFocus,
- "default_border", &pBorder,
+ "focus-line-width", &focusWidth,
+ "focus-padding", &focusPad,
+ "interior_focus", &interiorFocus,
+ "default_border", &pBorder,
(char *)NULL );
// Make sure the border values exist, otherwise use some defaults
@@ -1284,11 +1284,11 @@ sal_Bool GtkSalGraphics::NWPaintGTKRadio( GdkDrawable* gdkDrawable,
const ImplControlValue& aValue,
const OUString& )
{
- GtkStateType stateType;
- GtkShadowType shadowType;
- sal_Bool isChecked = (aValue.getTristateVal()==BUTTONVALUE_ON);
+ GtkStateType stateType;
+ GtkShadowType shadowType;
+ sal_Bool isChecked = (aValue.getTristateVal()==BUTTONVALUE_ON);
gint x, y;
- GdkRectangle clipRect;
+ GdkRectangle clipRect;
NWEnsureGTKButton( m_nScreen );
NWEnsureGTKRadio( m_nScreen );
@@ -1342,12 +1342,12 @@ sal_Bool GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable,
const ImplControlValue& aValue,
const OUString& )
{
- GtkStateType stateType;
- GtkShadowType shadowType;
- bool isChecked = (aValue.getTristateVal() == BUTTONVALUE_ON);
+ GtkStateType stateType;
+ GtkShadowType shadowType;
+ bool isChecked = (aValue.getTristateVal() == BUTTONVALUE_ON);
bool isInconsistent = (aValue.getTristateVal() == BUTTONVALUE_MIXED);
- GdkRectangle clipRect;
- gint x,y;
+ GdkRectangle clipRect;
+ gint x,y;
NWEnsureGTKButton( m_nScreen );
NWEnsureGTKCheck( m_nScreen );
@@ -1402,32 +1402,32 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart
nPart,
OSL_ASSERT( aValue.getType() == CTRL_SCROLLBAR );
const ScrollbarValue* pScrollbarVal = static_cast<const ScrollbarValue *>(&aValue);
GdkPixmap* pixmap = NULL;
- Rectangle pixmapRect, scrollbarRect;
- GtkStateType stateType;
- GtkShadowType shadowType;
- GtkScrollbar * scrollbarWidget;
- GtkStyle * style;
+ Rectangle pixmapRect, scrollbarRect;
+ GtkStateType stateType;
+ GtkShadowType shadowType;
+ GtkScrollbar * scrollbarWidget;
+ GtkStyle * style;
GtkAdjustment* scrollbarValues = NULL;
- GtkOrientation scrollbarOrientation;
- Rectangle thumbRect = pScrollbarVal->maThumbRect;
- Rectangle button11BoundRect = pScrollbarVal->maButton1Rect; // backward
- Rectangle button22BoundRect = pScrollbarVal->maButton2Rect; // forward
- Rectangle button12BoundRect = pScrollbarVal->maButton1Rect; // secondary forward
- Rectangle button21BoundRect = pScrollbarVal->maButton2Rect; // secondary backward
- GtkArrowType button1Type; // backward
- GtkArrowType button2Type; // forward
- gchar * scrollbarTagH = (gchar *) "hscrollbar";
- gchar * scrollbarTagV = (gchar *) "vscrollbar";
- gchar * scrollbarTag = NULL;
- Rectangle arrowRect;
- gint slider_width = 0;
- gint stepper_size = 0;
- gint stepper_spacing = 0;
- gint trough_border = 0;
- gint min_slider_length = 0;
- gint vShim = 0;
- gint hShim = 0;
- gint x,y,w,h;
+ GtkOrientation scrollbarOrientation;
+ Rectangle thumbRect = pScrollbarVal->maThumbRect;
+ Rectangle button11BoundRect = pScrollbarVal->maButton1Rect; // backward
+ Rectangle button22BoundRect = pScrollbarVal->maButton2Rect; // forward
+ Rectangle button12BoundRect = pScrollbarVal->maButton1Rect; // secondary forward
+ Rectangle button21BoundRect = pScrollbarVal->maButton2Rect; // secondary backward
+ GtkArrowType button1Type; // backward
+ GtkArrowType button2Type; // forward
+ gchar * scrollbarTagH = (gchar *) "hscrollbar";
+ gchar * scrollbarTagV = (gchar *) "vscrollbar";
+ gchar * scrollbarTag = NULL;
+ Rectangle arrowRect;
+ gint slider_width = 0;
+ gint stepper_size = 0;
+ gint stepper_spacing = 0;
+ gint trough_border = 0;
+ gint min_slider_length = 0;
+ gint vShim = 0;
+ gint hShim = 0;
+ gint x,y,w,h;
// make controlvalue rectangles relative to area
thumbRect.Move( -rControlRectangle.Left(), -rControlRectangle.Top() );
@@ -1634,7 +1634,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
if ( has_backward )
{
NWConvertVCLStateToGTKState( pScrollbarVal->mnButton1State, &stateType, &shadowType );
- if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL;
+ if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL;
gtk_paint_box( style, gdkDrawable, stateType, shadowType,
gdkRect, GTK_WIDGET(scrollbarWidget), "stepper",
x+hShim+button11BoundRect.Left(), y+vShim+button11BoundRect.Top(),
@@ -1649,7 +1649,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
if ( has_forward2 )
{
NWConvertVCLStateToGTKState( pScrollbarVal->mnButton2State, &stateType, &shadowType );
- if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL;
+ if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL;
gtk_paint_box( style, gdkDrawable, stateType, shadowType,
gdkRect, GTK_WIDGET(scrollbarWidget), "stepper",
x+hShim+button12BoundRect.Left(), y+vShim+button12BoundRect.Top(),
@@ -1665,7 +1665,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
if ( has_backward2 )
{
NWConvertVCLStateToGTKState( pScrollbarVal->mnButton1State, &stateType, &shadowType );
- if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL;
+ if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL;
gtk_paint_box( style, gdkDrawable, stateType, shadowType, gdkRect,
GTK_WIDGET(scrollbarWidget), "stepper",
x+hShim+button21BoundRect.Left(), y+vShim+button21BoundRect.Top(),
@@ -1680,7 +1680,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
if ( has_forward )
{
NWConvertVCLStateToGTKState( pScrollbarVal->mnButton2State, &stateType, &shadowType );
- if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL;
+ if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL;
gtk_paint_box( style, gdkDrawable, stateType, shadowType, gdkRect,
GTK_WIDGET(scrollbarWidget), "stepper",
x+hShim+button22BoundRect.Left(), y+vShim+button22BoundRect.Top(),
@@ -1705,7 +1705,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
//---
-static Rectangle NWGetScrollButtonRect( int nScreen, ControlPart nPart, Rectangle aAreaRect
)
+static Rectangle NWGetScrollButtonRect( int nScreen, ControlPart nPart, Rectangle aAreaRect )
{
gint slider_width;
gint stepper_size;
@@ -1796,7 +1796,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable,
const ImplControlValue& aValue,
const OUString& rCaption )
{
- Rectangle pixmapRect;
+ Rectangle pixmapRect;
GdkRectangle clipRect;
// Find the overall bounding rect of the buttons's drawing area,
@@ -1829,16 +1829,16 @@ static Rectangle NWGetEditBoxPixmapRect(int nScreen,
const ImplControlValue&,
const OUString& )
{
- Rectangle pixmapRect = aAreaRect;
- gboolean interiorFocus;
- gint focusWidth;
+ Rectangle pixmapRect = aAreaRect;
+ gboolean interiorFocus;
+ gint focusWidth;
NWEnsureGTKEditBox( nScreen );
// Grab some entry style attributes
gtk_widget_style_get( gWidgetData[nScreen].gEditBoxWidget,
- "focus-line-width", &focusWidth,
- "interior-focus", &interiorFocus, (char *)NULL );
+ "focus-line-width", &focusWidth,
+ "interior-focus", &interiorFocus, (char *)NULL );
if ( !interiorFocus )
{
@@ -1855,18 +1855,18 @@ static Rectangle NWGetEditBoxPixmapRect(int nScreen,
* All coordinates should be local to the Pixmap, NOT
* screen/window coordinates.
*/
-static void NWPaintOneEditBox( int nScreen,
+static void NWPaintOneEditBox( int nScreen,
GdkDrawable * gdkDrawable,
- GdkRectangle * gdkRect,
- ControlType nType,
+ GdkRectangle * gdkRect,
+ ControlType nType,
ControlPart,
- Rectangle aEditBoxRect,
- ControlState nState,
+ Rectangle aEditBoxRect,
+ ControlState nState,
const ImplControlValue&,
const OUString& )
{
- GtkStateType stateType;
- GtkShadowType shadowType;
+ GtkStateType stateType;
+ GtkShadowType shadowType;
GtkWidget *widget;
NWEnsureGTKButton( nScreen );
@@ -1929,17 +1929,17 @@ sal_Bool GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart
nPart
const ImplControlValue& aValue,
const OUString& rCaption )
{
- GdkPixmap * pixmap;
- Rectangle pixmapRect;
- GtkStateType stateType;
- GtkShadowType shadowType;
- const SpinbuttonValue * pSpinVal = (aValue.getType() == CTRL_SPINBUTTONS) ?
static_cast<const SpinbuttonValue *>(&aValue) : NULL;
- Rectangle upBtnRect;
- ControlPart upBtnPart = PART_BUTTON_UP;
- ControlState upBtnState = CTRL_STATE_ENABLED;
- Rectangle downBtnRect;
- ControlPart downBtnPart = PART_BUTTON_DOWN;
- ControlState downBtnState = CTRL_STATE_ENABLED;
+ GdkPixmap * pixmap;
+ Rectangle pixmapRect;
+ GtkStateType stateType;
+ GtkShadowType shadowType;
+ const SpinbuttonValue * pSpinVal = (aValue.getType() == CTRL_SPINBUTTONS) ?
static_cast<const SpinbuttonValue *>(&aValue) : NULL;
+ Rectangle upBtnRect;
+ ControlPart upBtnPart = PART_BUTTON_UP;
+ ControlState upBtnState = CTRL_STATE_ENABLED;
+ Rectangle downBtnRect;
+ ControlPart downBtnPart = PART_BUTTON_DOWN;
+ ControlState downBtnState = CTRL_STATE_ENABLED;
NWEnsureGTKButton( m_nScreen );
NWEnsureGTKSpinButton( m_nScreen );
@@ -1994,7 +1994,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart
nPart
if ( shadowType != GTK_SHADOW_NONE )
{
- Rectangle shadowRect( upBtnRect );
+ Rectangle shadowRect( upBtnRect );
shadowRect.Union( downBtnRect );
gtk_paint_box( gWidgetData[m_nScreen].gSpinButtonWidget->style, pixmap, GTK_STATE_NORMAL,
shadowType, NULL,
@@ -2020,14 +2020,14 @@ sal_Bool GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart
nPart
static Rectangle NWGetSpinButtonRect( int nScreen,
ControlType,
- ControlPart nPart,
- Rectangle aAreaRect,
+ ControlPart nPart,
+ Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
const OUString& )
{
- gint buttonSize;
- Rectangle buttonRect;
+ gint buttonSize;
+ Rectangle buttonRect;
NWEnsureGTKSpinButton( nScreen );
@@ -2061,19 +2061,19 @@ static Rectangle NWGetSpinButtonRect( int nScreen,
//---
static void NWPaintOneSpinButton( int nScreen,
- GdkPixmap* pixmap,
- ControlType nType,
- ControlPart nPart,
- Rectangle aAreaRect,
- ControlState nState,
- const ImplControlValue& aValue,
- const OUString& rCaption )
+ GdkPixmap* pixmap,
+ ControlType nType,
+ ControlPart nPart,
+ Rectangle aAreaRect,
+ ControlState nState,
+ const ImplControlValue& aValue,
+ const OUString& rCaption )
{
- Rectangle buttonRect;
- GtkStateType stateType;
- GtkShadowType shadowType;
- Rectangle arrowRect;
- gint arrowSize;
+ Rectangle buttonRect;
+ GtkStateType stateType;
+ GtkShadowType shadowType;
+ Rectangle arrowRect;
+ gint arrowSize;
NWEnsureGTKSpinButton( nScreen );
NWConvertVCLStateToGTKState( nState, &stateType, &shadowType );
@@ -2112,13 +2112,13 @@ sal_Bool GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
const ImplControlValue& aValue,
const OUString& rCaption )
{
- Rectangle pixmapRect;
- Rectangle buttonRect;
- GtkStateType stateType;
- GtkShadowType shadowType;
- Rectangle arrowRect;
- gint x,y;
- GdkRectangle clipRect;
+ Rectangle pixmapRect;
+ Rectangle buttonRect;
+ GtkStateType stateType;
+ GtkShadowType shadowType;
+ Rectangle arrowRect;
+ gint x,y;
+ GdkRectangle clipRect;
NWEnsureGTKButton( m_nScreen );
NWEnsureGTKArrow( m_nScreen );
@@ -2139,10 +2139,10 @@ sal_Bool GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
if( nPart == PART_BUTTON_DOWN )
buttonRect.Left() += 1;
- Rectangle aEditBoxRect( pixmapRect );
+ Rectangle aEditBoxRect( pixmapRect );
aEditBoxRect.SetSize( Size( pixmapRect.GetWidth() - buttonRect.GetWidth(),
aEditBoxRect.GetHeight() ) );
- #define ARROW_EXTENT 0.7
+ #define ARROW_EXTENT 0.7
arrowRect.SetSize( Size( (gint)(MIN_ARROW_SIZE * ARROW_EXTENT),
(gint)(MIN_ARROW_SIZE * ARROW_EXTENT) ) );
arrowRect.SetPos( Point( buttonRect.Left() + (gint)((buttonRect.GetWidth() -
arrowRect.GetWidth()) / 2),
@@ -2185,23 +2185,23 @@ sal_Bool GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
static Rectangle NWGetComboBoxButtonRect( int nScreen,
ControlType,
ControlPart nPart,
- Rectangle aAreaRect,
+ Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
const OUString& )
{
- Rectangle aButtonRect;
- gint nArrowWidth;
+ Rectangle aButtonRect;
+ gint nArrowWidth;
gint nButtonWidth;
- gint nFocusWidth;
- gint nFocusPad;
+ gint nFocusWidth;
+ gint nFocusPad;
NWEnsureGTKArrow( nScreen );
// Grab some button style attributes
gtk_widget_style_get( gWidgetData[nScreen].gDropdownWidget,
- "focus-line-width", &nFocusWidth,
- "focus-padding", &nFocusPad, (char *)NULL );
+ "focus-line-width", &nFocusWidth,
+ "focus-padding", &nFocusPad, (char *)NULL );
nArrowWidth = MIN_ARROW_SIZE + (GTK_MISC(gWidgetData[nScreen].gArrowWidget)->xpad * 2);
nButtonWidth = nArrowWidth +
@@ -2245,11 +2245,11 @@ sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
const OUString& )
{
OSL_ASSERT( nType != CTRL_TAB_ITEM || aValue.getType() == CTRL_TAB_ITEM );
- GdkPixmap * pixmap;
- Rectangle pixmapRect;
- Rectangle tabRect;
- GtkStateType stateType;
- GtkShadowType shadowType;
+ GdkPixmap * pixmap;
+ Rectangle pixmapRect;
+ Rectangle tabRect;
+ GtkStateType stateType;
+ GtkShadowType shadowType;
if( ! gWidgetData[ m_nScreen ].gCacheTabItems )
{
gWidgetData[ m_nScreen ].gCacheTabItems = new NWPixmapCache( m_nScreen );
@@ -2277,7 +2277,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
pixmapRect = rControlRectangle;
if ( nType == CTRL_TAB_ITEM )
{
- const TabitemValue * pTabitemValue = static_cast<const TabitemValue *>(&aValue);
+ const TabitemValue * pTabitemValue = static_cast<const TabitemValue *>(&aValue);
if ( !pTabitemValue->isFirst() )
{
// GTK+ tabs overlap on the right edge (the top tab obscures the
@@ -2383,15 +2383,15 @@ sal_Bool GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable,
const ImplControlValue& aValue,
const OUString& rCaption )
{
- Rectangle pixmapRect;
- Rectangle widgetRect;
- Rectangle aIndicatorRect;
- GtkStateType stateType;
- GtkShadowType shadowType;
- gint bInteriorFocus;
- gint nFocusLineWidth;
- gint nFocusPadding;
- gint x,y;
+ Rectangle pixmapRect;
+ Rectangle widgetRect;
+ Rectangle aIndicatorRect;
+ GtkStateType stateType;
+ GtkShadowType shadowType;
+ gint bInteriorFocus;
+ gint nFocusLineWidth;
+ gint nFocusPadding;
+ gint x,y;
GdkRectangle clipRect;
NWEnsureGTKButton( m_nScreen );
@@ -2423,9 +2423,9 @@ sal_Bool GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable,
if ( nPart != PART_WINDOW )
{
gtk_widget_style_get( gWidgetData[m_nScreen].gOptionMenuWidget,
- "interior_focus", &bInteriorFocus,
- "focus_line_width", &nFocusLineWidth,
- "focus_padding", &nFocusPadding,
+ "interior_focus", &bInteriorFocus,
+ "focus_line_width", &nFocusLineWidth,
+ "focus_padding", &nFocusPadding,
(char *)NULL);
}
@@ -2477,13 +2477,13 @@ sal_Bool GtkSalGraphics::NWPaintGTKToolbar(
ControlState nState, const ImplControlValue& aValue,
const OUString& )
{
- GtkStateType stateType;
- GtkShadowType shadowType;
- gint x, y, w, h;
+ GtkStateType stateType;
+ GtkShadowType shadowType;
+ gint x, y, w, h;
gint g_x=0, g_y=0, g_w=10, g_h=10;
bool bPaintButton = true;
GtkWidget* pButtonWidget = gWidgetData[m_nScreen].gToolbarButtonWidget;
- GdkRectangle clipRect;
+ GdkRectangle clipRect;
NWEnsureGTKToolbar( m_nScreen );
if( nPart == PART_BUTTON ) // toolbar buttons cannot focus in gtk
@@ -2643,11 +2643,11 @@ sal_Bool GtkSalGraphics::NWPaintGTKMenubar(
ControlState nState, const ImplControlValue&,
const OUString& )
{
- GtkStateType stateType;
- GtkShadowType shadowType;
+ GtkStateType stateType;
+ GtkShadowType shadowType;
GtkShadowType selected_shadow_type = GTK_SHADOW_OUT;
- gint x, y, w, h;
- GdkRectangle clipRect;
+ gint x, y, w, h;
+ GdkRectangle clipRect;
NWEnsureGTKMenubar( m_nScreen );
NWConvertVCLStateToGTKState( nState, &stateType, &shadowType );
@@ -2735,11 +2735,11 @@ sal_Bool GtkSalGraphics::NWPaintGTKPopupMenu(
nPart == PART_MENU_ITEM && ! (nState & CTRL_STATE_ENABLED) )
return sal_True;
- GtkStateType stateType;
- GtkShadowType shadowType;
+ GtkStateType stateType;
+ GtkShadowType shadowType;
GtkShadowType selected_shadow_type = GTK_SHADOW_OUT;
- gint x, y, w, h;
- GdkRectangle clipRect;
+ gint x, y, w, h;
+ GdkRectangle clipRect;
NWEnsureGTKMenu( m_nScreen );
NWConvertVCLStateToGTKState( nState, &stateType, &shadowType );
@@ -2898,8 +2898,8 @@ sal_Bool GtkSalGraphics::NWPaintGTKTooltip(
{
NWEnsureGTKTooltip( m_nScreen );
- gint x, y, w, h;
- GdkRectangle clipRect;
+ gint x, y, w, h;
+ GdkRectangle clipRect;
x = rControlRectangle.Left();
y = rControlRectangle.Top();
@@ -2941,12 +2941,12 @@ sal_Bool GtkSalGraphics::NWPaintGTKListNode(
aRect.Right() += 2;
aRect.Top() -= 2;
aRect.Bottom() += 2;
- gint w, h;
+ gint w, h;
w = aRect.GetWidth();
h = aRect.GetHeight();
- GtkStateType stateType;
- GtkShadowType shadowType;
+ GtkStateType stateType;
+ GtkShadowType shadowType;
NWConvertVCLStateToGTKState( nState, &stateType, &shadowType );
ButtonValue aButtonValue = rValue.getTristateVal();
@@ -2990,7 +2990,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKProgress(
{
NWEnsureGTKProgressBar( m_nScreen );
- gint w, h;
+ gint w, h;
w = rControlRectangle.GetWidth();
h = rControlRectangle.GetHeight();
@@ -3055,7 +3055,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKSlider(
OSL_ASSERT( rValue.getType() == CTRL_SLIDER );
NWEnsureGTKSlider( m_nScreen );
- gint w, h;
+ gint w, h;
w = rControlRectangle.GetWidth();
h = rControlRectangle.GetHeight();
@@ -3147,15 +3147,15 @@ static Rectangle NWGetListBoxButtonRect( int nScreen,
Rectangle aPartRect;
GtkRequisition *pIndicatorSize = NULL;
GtkBorder *pIndicatorSpacing = NULL;
- gint width = 13; // GTK+ default
- gint right = 5; // GTK+ default
+ gint width = 13; // GTK+ default
+ gint right = 5; // GTK+ default
gint nButtonAreaWidth = 0;
gint xthickness = 0;
NWEnsureGTKOptionMenu( nScreen );
gtk_widget_style_get( gWidgetData[nScreen].gOptionMenuWidget,
- "indicator_size", &pIndicatorSize,
+ "indicator_size", &pIndicatorSize,
"indicator_spacing",&pIndicatorSpacing, (char *)NULL);
if ( pIndicatorSize )
@@ -3201,7 +3201,7 @@ static Rectangle NWGetListBoxButtonRect( int nScreen,
static Rectangle NWGetListBoxIndicatorRect( int nScreen,
ControlType,
ControlPart,
- Rectangle aAreaRect,
+ Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
const OUString& )
@@ -3209,14 +3209,14 @@ static Rectangle NWGetListBoxIndicatorRect( int nScreen,
Rectangle aIndicatorRect;
GtkRequisition *pIndicatorSize = NULL;
GtkBorder *pIndicatorSpacing = NULL;
- gint width = 13; // GTK+ default
- gint height = 13; // GTK+ default
- gint right = 5; // GTK+ default
+ gint width = 13; // GTK+ default
+ gint height = 13; // GTK+ default
+ gint right = 5; // GTK+ default
NWEnsureGTKOptionMenu( nScreen );
gtk_widget_style_get( gWidgetData[nScreen].gOptionMenuWidget,
- "indicator_size", &pIndicatorSize,
+ "indicator_size", &pIndicatorSize,
"indicator_spacing",&pIndicatorSpacing, (char *)NULL);
if ( pIndicatorSize )
@@ -3246,8 +3246,8 @@ static Rectangle NWGetListBoxIndicatorRect( int nScreen,
static Rectangle NWGetToolbarRect( int nScreen,
ControlType,
- ControlPart nPart,
- Rectangle aAreaRect,
+ ControlPart nPart,
+ Rectangle aAreaRect,
ControlState,
const ImplControlValue&,
const OUString& )
@@ -3455,10 +3455,10 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetMenuHighlightTextColor( aHighlightTextColor );
// UI font
- OString aFamily = pango_font_description_get_family( pStyle->font_desc );
- int nPangoHeight = pango_font_description_get_size( pStyle->font_desc );
- PangoStyle eStyle = pango_font_description_get_style( pStyle->font_desc );
- PangoWeight eWeight = pango_font_description_get_weight( pStyle->font_desc );
+ OString aFamily = pango_font_description_get_family( pStyle->font_desc );
+ int nPangoHeight = pango_font_description_get_size( pStyle->font_desc );
+ PangoStyle eStyle = pango_font_description_get_style( pStyle->font_desc );
+ PangoWeight eWeight = pango_font_description_get_weight( pStyle->font_desc );
PangoStretch eStretch = pango_font_description_get_stretch( pStyle->font_desc );
psp::FastPrintFontInfo aInfo;
@@ -3467,9 +3467,9 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
// set italic
switch( eStyle )
{
- case PANGO_STYLE_NORMAL: aInfo.m_eItalic = ITALIC_NONE;break;
- case PANGO_STYLE_ITALIC: aInfo.m_eItalic = ITALIC_NORMAL;break;
- case PANGO_STYLE_OBLIQUE: aInfo.m_eItalic = ITALIC_OBLIQUE;break;
+ case PANGO_STYLE_NORMAL: aInfo.m_eItalic = ITALIC_NONE;break;
+ case PANGO_STYLE_ITALIC: aInfo.m_eItalic = ITALIC_NORMAL;break;
+ case PANGO_STYLE_OBLIQUE: aInfo.m_eItalic = ITALIC_OBLIQUE;break;
}
// set weight
if( eWeight <= PANGO_WEIGHT_ULTRALIGHT )
@@ -3485,15 +3485,15 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
// set width
switch( eStretch )
{
- case PANGO_STRETCH_ULTRA_CONDENSED: aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED;break;
- case PANGO_STRETCH_EXTRA_CONDENSED: aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED;break;
- case PANGO_STRETCH_CONDENSED: aInfo.m_eWidth = WIDTH_CONDENSED;break;
- case PANGO_STRETCH_SEMI_CONDENSED: aInfo.m_eWidth = WIDTH_SEMI_CONDENSED;break;
- case PANGO_STRETCH_NORMAL: aInfo.m_eWidth = WIDTH_NORMAL;break;
- case PANGO_STRETCH_SEMI_EXPANDED: aInfo.m_eWidth = WIDTH_SEMI_EXPANDED;break;
- case PANGO_STRETCH_EXPANDED: aInfo.m_eWidth = WIDTH_EXPANDED;break;
- case PANGO_STRETCH_EXTRA_EXPANDED: aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED;break;
- case PANGO_STRETCH_ULTRA_EXPANDED: aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED;break;
+ case PANGO_STRETCH_ULTRA_CONDENSED: aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED;break;
+ case PANGO_STRETCH_EXTRA_CONDENSED: aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED;break;
+ case PANGO_STRETCH_CONDENSED: aInfo.m_eWidth = WIDTH_CONDENSED;break;
+ case PANGO_STRETCH_SEMI_CONDENSED: aInfo.m_eWidth = WIDTH_SEMI_CONDENSED;break;
+ case PANGO_STRETCH_NORMAL: aInfo.m_eWidth = WIDTH_NORMAL;break;
+ case PANGO_STRETCH_SEMI_EXPANDED: aInfo.m_eWidth = WIDTH_SEMI_EXPANDED;break;
+ case PANGO_STRETCH_EXPANDED: aInfo.m_eWidth = WIDTH_EXPANDED;break;
+ case PANGO_STRETCH_EXTRA_EXPANDED: aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED;break;
+ case PANGO_STRETCH_ULTRA_EXPANDED: aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED;break;
}
#if OSL_DEBUG_LEVEL > 1
@@ -3602,7 +3602,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetPreferredSymbolsStyleName( OUString::createFromAscii( pIconThemeName ) );
g_free( pIconThemeName );
- aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_LARGE );
+ aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_LARGE );
const cairo_font_options_t* pNewOptions = NULL;
#if !GTK_CHECK_VERSION(2,9,0)
@@ -3656,8 +3656,8 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
GdkPixmap* GtkSalGraphics::NWGetPixmapFromScreen( Rectangle srcRect )
{
// Create a new pixmap to hold the composite of the window background and the control
- GdkPixmap * pPixmap = gdk_pixmap_new( GDK_DRAWABLE(GetGdkWindow()),
srcRect.GetWidth(), srcRect.GetHeight(), -1 );
- GdkGC * pPixmapGC = gdk_gc_new( pPixmap );
+ GdkPixmap * pPixmap = gdk_pixmap_new( GDK_DRAWABLE(GetGdkWindow()), srcRect.GetWidth(),
srcRect.GetHeight(), -1 );
+ GdkGC * pPixmapGC = gdk_gc_new( pPixmap );
if( !pPixmap || !pPixmapGC )
{
--
1.7.4.1
From 7c9a40e232af94f3cecad883216b7fa182f9fd2e Mon Sep 17 00:00:00 2001
From: Lucas Baudin <xapantu@gmail.com>
Date: Sun, 22 May 2011 11:04:58 +0200
Subject: [PATCH 2/2] Fix some visual glitch with GTK+
- Fix separators, they weren't properly aligned, and they didn't use
gtk_paint_box when needed some gtk themes/engine draw lines with box ^^
(for 3d appearance for instance)
- Fix pressed toolbar buttons state: it wasn't drawn correctly
- Fix toolbar buttons background: window background was paint, but the
background was the toolbar, so, now, the background of the toolbar is paint
- Use gtk_paint_box instead of gtk_paint_flat_box for buttondefault, it wasn't
correct and caused some weird things in the corners
- Code cleanup: remove a function call which set the widgets flags, it is
useless (and could cause some segfaults) since we must specify widget state
and shadow in gtk_paint_(flat_)box).
- Code cleanup: remove duplicated code, toolbar button are now drawn using the
same function as normal buttons
---
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 228 +++++++++++++++++-------------
vcl/unx/inc/plugins/gtk/gtkgdi.hxx | 5 +
2 files changed, 135 insertions(+), 98 deletions(-)
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 127c5f0..d4d7702 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -1125,11 +1125,12 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType,
return( returnVal );
}
-
/************************************************************************
* Individual control drawing functions
************************************************************************/
-sal_Bool GtkSalGraphics::NWPaintGTKButton(
+
+sal_Bool GtkSalGraphics::NWPaintGTKButtonReal(
+ GtkWidget* button,
GdkDrawable* gdkDrawable,
ControlType, ControlPart,
const Rectangle& rControlRectangle,
@@ -1149,17 +1150,32 @@ sal_Bool GtkSalGraphics::NWPaintGTKButton(
GdkRectangle clipRect;
NWEnsureGTKButton( m_nScreen );
+ NWEnsureGTKToolbar( m_nScreen );
NWConvertVCLStateToGTKState( nState, &stateType, &shadowType );
+ NWSetWidgetState( gWidgetData[m_nScreen].gBtnWidget, nState, stateType );
x = rControlRectangle.Left();
y = rControlRectangle.Top();
w = rControlRectangle.GetWidth();
h = rControlRectangle.GetHeight();
+ gint internal_padding;
+ if(GTK_IS_TOOL_ITEM(button))
+ {
+ gtk_widget_style_get (GTK_WIDGET (gWidgetData[m_nScreen].gToolbarWidget),
+ "internal-padding", &internal_padding,
+ NULL);
+ x += internal_padding/2;
+ w -= internal_padding;
+ stateType = GTK_STATE_PRELIGHT;
+ }
+
// Grab some button style attributes
- gtk_widget_style_get( gWidgetData[m_nScreen].gBtnWidget, "focus-line-width", &focusWidth,
+ gtk_widget_style_get( button, "focus-line-width", &focusWidth,
"focus-padding", &focusPad,
"interior_focus", &interiorFocus,
+ (char *)NULL );
+ gtk_widget_style_get( gWidgetData[m_nScreen].gBtnWidget,
"default_border", &pBorder,
(char *)NULL );
@@ -1175,8 +1191,6 @@ sal_Bool GtkSalGraphics::NWPaintGTKButton(
if ( (w < 16) || (h < 16) )
bDrawFocus = sal_False;
- NWSetWidgetState( gWidgetData[m_nScreen].gBtnWidget, nState, stateType );
-
gint xi = x, yi = y, wi = w, hi = h;
if ( (nState & CTRL_STATE_DEFAULT) && bDrawFocus )
{
@@ -1193,7 +1207,6 @@ sal_Bool GtkSalGraphics::NWPaintGTKButton(
wi -= 2 * (focusWidth + focusPad);
hi -= 2 * (focusWidth + focusPad);
}
-
for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it)
{
clipRect.x = it->Left();
@@ -1202,27 +1215,50 @@ sal_Bool GtkSalGraphics::NWPaintGTKButton(
clipRect.height = it->GetHeight();
// Buttons must paint opaque since some themes have alpha-channel enabled buttons
- gtk_paint_flat_box( m_pWindow->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
- &clipRect, m_pWindow, "base", x, y, w, h );
-
- if ( (nState & CTRL_STATE_DEFAULT) &&
(GTK_BUTTON(gWidgetData[m_nScreen].gBtnWidget)->relief == GTK_RELIEF_NORMAL) )
+ if(button == gWidgetData[m_nScreen].gToolbarButtonWidget)
{
- gtk_paint_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable,
GTK_STATE_NORMAL, GTK_SHADOW_IN,
- &clipRect, gWidgetData[m_nScreen].gBtnWidget, "buttondefault", x, y, w,
h );
+ gtk_paint_box( gWidgetData[m_nScreen].gToolbarWidget->style, gdkDrawable,
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
+ &clipRect, gWidgetData[m_nScreen].gToolbarWidget, "toolbar", x, y,
w, h );
+ }
+ else
+ {
+ gtk_paint_box( m_pWindow->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
+ &clipRect, m_pWindow, "base", x, y, w, h );
}
- if ( (GTK_BUTTON(gWidgetData[m_nScreen].gBtnWidget)->relief != GTK_RELIEF_NONE)
- || (nState & CTRL_STATE_PRESSED)
- || (nState & CTRL_STATE_ROLLOVER) )
+ if ( (nState & CTRL_STATE_DEFAULT) && GTK_IS_BUTTON(button) )
{
- gtk_paint_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, stateType,
shadowType,
- &clipRect, gWidgetData[m_nScreen].gBtnWidget, "button", xi, yi, wi, hi
);
+ gtk_paint_box( button->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_IN,
+ &clipRect, button, "buttondefault", x, y, w, h );
}
+ /* don't draw "button", because it can be a tool_button, and
+ * it causes some weird things, so, the default button is
+ * just fine */
+ gtk_paint_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, stateType,
shadowType,
+ &clipRect, gWidgetData[m_nScreen].gBtnWidget, "button", xi, yi, wi, hi );
}
return( sal_True );
}
+sal_Bool GtkSalGraphics::NWPaintGTKButton(
+ GdkDrawable* gdkDrawable,
+ ControlType type, ControlPart part,
+ const Rectangle& rControlRectangle,
+ const clipList& rClipList,
+ ControlState nState, const ImplControlValue& value,
+ const OUString& string)
+{
+ return NWPaintGTKButtonReal(
+ gWidgetData[m_nScreen].gBtnWidget,
+ gdkDrawable,
+ type, part,
+ rControlRectangle,
+ rClipList,
+ nState, value,
+ string );
+}
+
static Rectangle NWGetButtonArea( int nScreen,
ControlType, ControlPart, Rectangle aAreaRect, ControlState
nState,
const ImplControlValue&, const OUString& )
@@ -1907,7 +1943,10 @@ static void NWPaintOneEditBox( int nScreen,
}
NWSetWidgetState( widget, nState, stateType );
- gtk_paint_box( pBGWidget->style, gdkDrawable, stateType, GTK_SHADOW_NONE,
+ /* This doesn't seem to be necessary, and it causes some weird glitch in
+ * murrine (with the elementary theme for instance) but it fixes some issue
+ * with Orta, so... */
+ gtk_paint_flat_box( pBGWidget->style, gdkDrawable, stateType, GTK_SHADOW_NONE,
gdkRect, pBGWidget, "entry_bg",
aEditBoxRect.Left(), aEditBoxRect.Top(),
aEditBoxRect.GetWidth(), aEditBoxRect.GetHeight() );
@@ -2475,7 +2514,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKToolbar(
const Rectangle& rControlRectangle,
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
- const OUString& )
+ const OUString& string)
{
GtkStateType stateType;
GtkShadowType shadowType;
@@ -2533,22 +2572,12 @@ sal_Bool GtkSalGraphics::NWPaintGTKToolbar(
// handle button
else if( nPart == PART_BUTTON )
{
- bPaintButton =
- (GTK_BUTTON(pButtonWidget)->relief != GTK_RELIEF_NONE)
- || (nState & CTRL_STATE_PRESSED)
+ bPaintButton = (nState & CTRL_STATE_PRESSED)
|| (nState & CTRL_STATE_ROLLOVER);
if( aValue.getTristateVal() == BUTTONVALUE_ON )
{
- pButtonWidget = gWidgetData[m_nScreen].gToolbarToggleWidget;
- shadowType = GTK_SHADOW_IN;
- stateType = GTK_STATE_ACTIVE;
- // special case stateType value for depressed toggle buttons
- // cf. gtk+/gtk/gtktogglebutton.c (gtk_toggle_button_update_state)
- if( (nState & (CTRL_STATE_ROLLOVER|CTRL_STATE_PRESSED)) )
- {
- stateType = GTK_STATE_PRELIGHT;
- shadowType = GTK_SHADOW_OUT;
- }
+ if(!(nState & CTRL_STATE_ROLLOVER))
+ nState |= CTRL_STATE_PRESSED;
bPaintButton = true;
}
else
@@ -2556,77 +2585,80 @@ sal_Bool GtkSalGraphics::NWPaintGTKToolbar(
NWSetWidgetState( pButtonWidget, nState, stateType );
gtk_widget_ensure_style( pButtonWidget );
+ if(bPaintButton)
+ NWPaintGTKButtonReal(pButtonWidget, gdkDrawable, 0, 0, rControlRectangle, rClipList,
nState, aValue, string);
}
- for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ if( nPart != PART_BUTTON )
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
-
- // draw toolbar
- if( nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT )
+ for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
{
- gtk_paint_flat_box( gWidgetData[m_nScreen].gToolbarWidget->style,
- gdkDrawable,
- (GtkStateType)GTK_STATE_NORMAL,
- GTK_SHADOW_NONE,
- &clipRect,
- gWidgetData[m_nScreen].gToolbarWidget,
- "base",
- x, y, w, h );
- gtk_paint_box( gWidgetData[m_nScreen].gToolbarWidget->style,
- gdkDrawable,
- stateType,
- shadowType,
- &clipRect,
- gWidgetData[m_nScreen].gToolbarWidget,
- "toolbar",
- x, y, w, h );
- }
- // draw grip
- else if( nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT )
- {
- gtk_paint_handle( gWidgetData[m_nScreen].gHandleBoxWidget->style,
- gdkDrawable,
- GTK_STATE_NORMAL,
- GTK_SHADOW_OUT,
- &clipRect,
- gWidgetData[m_nScreen].gHandleBoxWidget,
- "handlebox",
- g_x, g_y, g_w, g_h,
- nPart == PART_THUMB_HORZ ?
- GTK_ORIENTATION_HORIZONTAL :
- GTK_ORIENTATION_VERTICAL
- );
- }
- // draw button
- else if( nPart == PART_BUTTON )
- {
- if( bPaintButton )
+ clipRect.x = it->Left();
+ clipRect.y = it->Top();
+ clipRect.width = it->GetWidth();
+ clipRect.height = it->GetHeight();
+
+ // draw toolbar
+ if( nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT )
{
- gtk_paint_box( pButtonWidget->style, gdkDrawable,
+ gtk_paint_flat_box( gWidgetData[m_nScreen].gToolbarWidget->style,
+ gdkDrawable,
+ (GtkStateType)GTK_STATE_NORMAL,
+ GTK_SHADOW_NONE,
+ &clipRect,
+ gWidgetData[m_nScreen].gToolbarWidget,
+ "base",
+ x, y, w, h );
+ gtk_paint_box( gWidgetData[m_nScreen].gToolbarWidget->style,
+ gdkDrawable,
stateType,
shadowType,
&clipRect,
- pButtonWidget, "button", x, y, w, h );
+ gWidgetData[m_nScreen].gToolbarWidget,
+ "toolbar",
+ x, y, w, h );
+ }
+ // draw grip
+ else if( nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT )
+ {
+ gtk_paint_handle( gWidgetData[m_nScreen].gHandleBoxWidget->style,
+ gdkDrawable,
+ GTK_STATE_NORMAL,
+ GTK_SHADOW_OUT,
+ &clipRect,
+ gWidgetData[m_nScreen].gHandleBoxWidget,
+ "handlebox",
+ g_x, g_y, g_w, g_h,
+ nPart == PART_THUMB_HORZ ?
+ GTK_ORIENTATION_HORIZONTAL :
+ GTK_ORIENTATION_VERTICAL
+ );
+ }
+ else if(nPart == PART_SEPARATOR )
+ {
+ gint separator_height, separator_width, wide_separators;
+
+ gtk_widget_style_get (gWidgetData[m_nScreen].gVSeparator,
+ "wide-separators", &wide_separators,
+ "separator-width", &separator_width,
+ "separator-height", &separator_height,
+ NULL);
+ if (wide_separators)
+ gtk_paint_box (gWidgetData[m_nScreen].gVSeparator->style, gdkDrawable,
+ GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
+ &clipRect, gWidgetData[m_nScreen].gVSeparator, "vseparator",
+ x + (w - separator_width) / 2,
+ y + 7,
+ separator_width,
+ h - 14);
+ else
+ gtk_paint_vline (gWidgetData[m_nScreen].gVSeparator->style, gdkDrawable,
+ GTK_STATE_NORMAL,
+ &clipRect, gWidgetData[m_nScreen].gVSeparator, "vseparator",
+ y + 7,
+ y + h - 7,
+ x + w/2 - 1);
}
- }
- else if(nPart == PART_SEPARATOR )
- {
- gtk_paint_vline( gWidgetData[m_nScreen].gVSeparator->style,
- gdkDrawable,
- GTK_STATE_NORMAL,
- &clipRect,
- gWidgetData[m_nScreen].gVSeparator,
- "vseparator",
- y + 4, y + h - 8 /* -2 and -4 is a dirty
- * hack, to fit most gtk
- * style, but it must be
- * fixed, FIXME */,
- x
- );
}
}
@@ -3657,7 +3689,7 @@ GdkPixmap* GtkSalGraphics::NWGetPixmapFromScreen( Rectangle srcRect )
{
// Create a new pixmap to hold the composite of the window background and the control
GdkPixmap * pPixmap = gdk_pixmap_new( GDK_DRAWABLE(GetGdkWindow()), srcRect.GetWidth(),
srcRect.GetHeight(), -1 );
- GdkGC * pPixmapGC = gdk_gc_new( pPixmap );
+ GdkGC * pPixmapGC = gdk_gc_new( pPixmap );
if( !pPixmap || !pPixmapGC )
{
@@ -3956,9 +3988,9 @@ static void NWEnsureGTKToolbar( int nScreen )
{
gWidgetData[nScreen].gToolbarWidget = gtk_toolbar_new();
NWAddWidgetToCacheWindow( gWidgetData[nScreen].gToolbarWidget, nScreen );
- gWidgetData[nScreen].gToolbarButtonWidget = gtk_button_new();
- gWidgetData[nScreen].gToolbarToggleWidget = gtk_toggle_button_new();
- gWidgetData[nScreen].gVSeparator = gtk_vseparator_new();
+ gWidgetData[nScreen].gToolbarButtonWidget = GTK_WIDGET(gtk_button_new());
+ gWidgetData[nScreen].gToolbarToggleWidget = GTK_WIDGET(gtk_toggle_tool_button_new());
+ gWidgetData[nScreen].gVSeparator = GTK_WIDGET(gtk_separator_tool_item_new());
NWAddWidgetToCacheWindow( gWidgetData[nScreen].gVSeparator, nScreen );
GtkReliefStyle aRelief = GTK_RELIEF_NORMAL;
diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
index 2aaafc5..4e4091c 100644
--- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
@@ -95,6 +95,11 @@ protected:
GdkPixmap* NWGetPixmapFromScreen( Rectangle srcRect );
sal_Bool NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRect );
+ sal_Bool NWPaintGTKButtonReal( GtkWidget* button, GdkDrawable* gdkDrawable, ControlType nType,
ControlPart nPart,
+ const Rectangle& rControlRectangle,
+ const clipList& rClipList,
+ ControlState nState, const ImplControlValue& aValue,
+ const OUString& rCaption );
sal_Bool NWPaintGTKButton( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
--
1.7.4.1
Context
- [Libreoffice] [Patch] GTK+ integration · xapantu
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.