summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx/gtk')
-rw-r--r--vcl/unx/gtk/a11y/atkutil.cxx5
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx9
-rw-r--r--vcl/unx/gtk/app/gtkinst.cxx2
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx81
4 files changed, 27 insertions, 70 deletions
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index 13492f3d4a5c..ad33cdf67de6 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -77,11 +77,10 @@ atk_wrapper_focus_idle_handler (gpointer data)
uno::Reference< accessibility::XAccessible > xAccessible = xNextFocusObject;
if( xAccessible.get() == reinterpret_cast < accessibility::XAccessible * > (data) )
{
+ AtkObject *atk_obj = xAccessible.is() ? atk_object_wrapper_ref( xAccessible ) : NULL;
// Gail does not notify focus changes to NULL, so do we ..
- if( xAccessible.is() )
+ if( atk_obj )
{
- AtkObject *atk_obj = atk_object_wrapper_ref( xAccessible );
-
#ifdef ENABLE_TRACING
fprintf(stderr, "notifying focus event for %p\n", atk_obj);
#endif
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 1f1c469bf9a1..322530b881cc 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -489,6 +489,7 @@ class GtkXLib : public SalXLib
GSource *m_pUserEvent;
oslMutex m_aDispatchMutex;
oslCondition m_aDispatchCondition;
+ XIOErrorHandler m_aOrigGTKXIOErrorHandler;
public:
static gboolean timeoutFn(gpointer data);
@@ -522,6 +523,7 @@ GtkXLib::GtkXLib()
m_pUserEvent = NULL;
m_aDispatchCondition = osl_createCondition();
m_aDispatchMutex = osl_createMutex();
+ m_aOrigGTKXIOErrorHandler = NULL;
}
GtkXLib::~GtkXLib()
@@ -535,6 +537,9 @@ GtkXLib::~GtkXLib()
osl_setCondition( m_aDispatchCondition );
osl_destroyCondition( m_aDispatchCondition );
osl_destroyMutex( m_aDispatchMutex );
+
+ PopXErrorLevel();
+ XSetIOErrorHandler (m_aOrigGTKXIOErrorHandler);
}
void GtkXLib::Init()
@@ -596,6 +601,10 @@ void GtkXLib::Init()
// init gtk/gdk
gtk_init_check( &nParams, &pCmdLineAry );
+ //gtk_init_check sets XError/XIOError handlers, we want our own one
+ m_aOrigGTKXIOErrorHandler = XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
+ PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) );
+
for (i = 0; i < nParams; i++ )
g_free( pCmdLineAry[i] );
delete [] pCmdLineAry;
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 68617c8c16be..faedc7e5e600 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -76,7 +76,7 @@ void GtkHookedYieldMutex::ThreadsLeave()
#if OSL_DEBUG_LEVEL > 1
if( mnThreadId &&
- mnThreadId != NAMESPACE_VOS(OThread)::getCurrentIdentifier())
+ mnThreadId != vos::OThread::getCurrentIdentifier())
fprintf( stderr, "\n\n--- A different thread owns the mutex ...---\n\n\n");
#endif
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 9d3ce6b137cd..b8a3ac773a8f 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -732,12 +732,6 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
const ImplControlValue& aValue,
const OUString& rCaption )
{
- if( (nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL) &&
- aValue.getTristateVal() == BUTTONVALUE_MIXED )
- {
- return drawNativeMixedStateCheck( nType, nPart, rControlRegion, nState, aValue, rCaption );
- }
-
BOOL returnVal = FALSE;
// get a GC with current clipping region set
SelectFont();
@@ -895,55 +889,6 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
return( returnVal );
}
-BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType,
- ControlPart nPart,
- const Rectangle& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- const OUString& rCaption )
-{
- // need to emulate something for mixed state
-
- // do this via pixmap since some themes don't care for regions
- bool bOldNeedPixmapPaint = bNeedPixmapPaint;
- bNeedPixmapPaint = true;
-
- Rectangle aCtrlRect = rControlRegion;
- BOOL returnVal = FALSE;
- SelectFont();
-
- // draw upper half in off state
- const_cast<ImplControlValue&>(aValue).setTristateVal( BUTTONVALUE_OFF );
- XLIB_Region aRegion = XCreateRegion();
- XRectangle aXRect = { aCtrlRect.Left(), aCtrlRect.Top(), aCtrlRect.GetWidth(), aCtrlRect.GetHeight() };
- const unsigned short nH = aXRect.height/2;
- aXRect.height -= nH;
- XUnionRectWithRegion( &aXRect, aRegion, aRegion );
- SetClipRegion( pFontGC_, aRegion );
- XDestroyRegion( aRegion );
-
- returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption );
-
- if( returnVal )
- {
- // draw lower half in on state
- const_cast<ImplControlValue&>(aValue).setTristateVal( BUTTONVALUE_ON );
- aXRect.y += nH;
- aRegion = XCreateRegion();
- XUnionRectWithRegion( &aXRect, aRegion, aRegion );
- SetClipRegion( pFontGC_, aRegion );
- XDestroyRegion( aRegion );
- returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption );
- }
-
- // clean up
- bNeedPixmapPaint = bOldNeedPixmapPaint;
- const_cast<ImplControlValue&>(aValue).setTristateVal( BUTTONVALUE_MIXED );
- SetClipRegion( pFontGC_ );
- return returnVal;
-}
-
-
/*
* DrawNativeControlText()
*
@@ -1378,7 +1323,8 @@ BOOL GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable,
{
GtkStateType stateType;
GtkShadowType shadowType;
- BOOL isChecked = (aValue.getTristateVal()==BUTTONVALUE_ON) ? TRUE : FALSE;
+ bool isChecked = (aValue.getTristateVal() == BUTTONVALUE_ON);
+ bool isInconsistent = (aValue.getTristateVal() == BUTTONVALUE_MIXED);
GdkRectangle clipRect;
gint x,y;
@@ -1393,7 +1339,7 @@ BOOL GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable,
y = rControlRectangle.Top() + (rControlRectangle.GetHeight()-indicator_size)/2;
// Set the shadow based on if checked or not so we get a checkmark.
- shadowType = isChecked ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
+ shadowType = isChecked ? GTK_SHADOW_IN : isInconsistent ? GTK_SHADOW_ETCHED_IN : GTK_SHADOW_OUT;
NWSetWidgetState( gWidgetData[m_nScreen].gCheckWidget, nState, stateType );
GTK_TOGGLE_BUTTON(gWidgetData[m_nScreen].gCheckWidget)->active = isChecked;
@@ -2291,11 +2237,10 @@ BOOL GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
const ImplControlValue& aValue,
const OUString& )
{
- OSL_ASSERT( aValue.getType() == CTRL_TAB_ITEM );
+ OSL_ASSERT( nType != CTRL_TAB_ITEM || aValue.getType() == CTRL_TAB_ITEM );
GdkPixmap * pixmap;
Rectangle pixmapRect;
Rectangle tabRect;
- const TabitemValue * pTabitemValue = static_cast<const TabitemValue *>(&aValue);
GtkStateType stateType;
GtkShadowType shadowType;
if( ! gWidgetData[ m_nScreen ].gCacheTabItems )
@@ -2311,9 +2256,8 @@ BOOL GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
if( !aCachePage.GetSize() )
aCachePage.SetSize( 1 );
- if ( !pTabitemValue && (nType==CTRL_TAB_ITEM) )
+ if ( (nType == CTRL_TAB_ITEM) && (aValue.getType() != CTRL_TAB_ITEM) )
{
- std::fprintf( stderr, "NWPaintGTKTabItem() received a NULL TabitemValue. Cannot draw native tab\n" );
return( false );
}
@@ -2326,6 +2270,7 @@ BOOL GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
pixmapRect = rControlRectangle;
if ( nType == CTRL_TAB_ITEM )
{
+ const TabitemValue * pTabitemValue = static_cast<const TabitemValue *>(&aValue);
if ( !pTabitemValue->isFirst() )
{
// GTK+ tabs overlap on the right edge (the top tab obscures the
@@ -2534,7 +2479,6 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar(
gint g_x=0, g_y=0, g_w=10, g_h=10;
bool bPaintButton = true;
GtkWidget* pButtonWidget = gWidgetData[m_nScreen].gToolbarButtonWidget;
- const gchar* pButtonDetail = "button";
GdkRectangle clipRect;
NWEnsureGTKToolbar( m_nScreen );
@@ -2593,13 +2537,18 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar(
{
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_PRESSED|CTRL_STATE_ROLLOVER)) )
- stateType = GTK_STATE_ACTIVE;
- pButtonDetail = "togglebutton";
+ if( (nState & (CTRL_STATE_ROLLOVER|CTRL_STATE_PRESSED)) )
+ {
+ stateType = GTK_STATE_PRELIGHT;
+ shadowType = GTK_SHADOW_OUT;
+ }
bPaintButton = true;
}
+ else
+ stateType = GTK_STATE_PRELIGHT; // only for bPaintButton = true, in which case always rollver is meant
NWSetWidgetState( pButtonWidget, nState, stateType );
gtk_widget_ensure_style( pButtonWidget );
@@ -2657,7 +2606,7 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar(
stateType,
shadowType,
&clipRect,
- pButtonWidget, pButtonDetail, x, y, w, h );
+ pButtonWidget, "button", x, y, w, h );
}
}
}