diff options
Diffstat (limited to 'vcl/unx/gtk')
-rw-r--r-- | vcl/unx/gtk/a11y/atkutil.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtkdata.cxx | 9 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtkinst.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 84 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtkframe.cxx | 64 |
5 files changed, 78 insertions, 88 deletions
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index 13492f3d4a5c..076e36291ae6 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 @@ -92,7 +91,7 @@ atk_wrapper_focus_idle_handler (gpointer data) // also emit state-changed:focused event under the same condition. { AtkObjectWrapper* wrapper_obj = ATK_OBJECT_WRAPPER (atk_obj); - if( !wrapper_obj->mpText && wrapper_obj->mpContext ) + if( wrapper_obj && !wrapper_obj->mpText && wrapper_obj->mpContext ) { uno::Any any = wrapper_obj->mpContext->queryInterface( accessibility::XAccessibleText::static_type(NULL) ); if ( typelib_TypeClass_INTERFACE == any.pType->eTypeClass && 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..447a970f6bcd 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() * @@ -1102,8 +1047,9 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, GtkRequisition aReq; gtk_widget_size_request( widget, &aReq ); Rectangle aEditRect = rControlRegion; + long nHeight = (aEditRect.GetHeight() > aReq.height+1) ? aEditRect.GetHeight() : aReq.height+1; aEditRect = Rectangle( aEditRect.TopLeft(), - Size( aEditRect.GetWidth(), aReq.height+1 ) ); + Size( aEditRect.GetWidth(), nHeight ) ); rNativeBoundingRegion = aEditRect; rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; @@ -1378,7 +1324,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 +1340,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 +2238,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 +2257,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 +2271,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 +2480,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 +2538,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 +2607,7 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar( stateType, shadowType, &clipRect, - pButtonWidget, pButtonDetail, x, y, w, h ); + pButtonWidget, "button", x, y, w, h ); } } } diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index c6ff16f8395b..e8b55ebfa895 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -1452,12 +1452,6 @@ void GtkSalFrame::setMinMaxSize() aHints |= GDK_HINT_MAX_SIZE; } } - if( m_bFullscreen ) - { - aGeo.max_width = m_aMaxSize.Width(); - aGeo.max_height = m_aMaxSize.Height(); - aHints |= GDK_HINT_MAX_SIZE; - } if( aHints ) gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow), NULL, @@ -1832,7 +1826,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) // workaround different legacy version window managers have different opinions about // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin) if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + { + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) ); + } if( bVisible ) Show( TRUE ); } @@ -1863,11 +1861,8 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) { if( bFullScreen ) { - if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) - { - if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); - } + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); gtk_window_fullscreen( GTK_WINDOW(m_pWindow) ); moveToScreen( nScreen ); Size aScreenSize = pDisp->GetScreenSize( m_nScreen ); @@ -1879,11 +1874,8 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) else { gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) ); - if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) - { - if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE ); - } + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE ); moveToScreen( nScreen ); } } @@ -2849,12 +2841,52 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f return FALSE; } +IMPL_LINK( GtkSalFrame, ImplDelayedFullScreenHdl, void*, EMPTYARG ) +{ + Atom nStateAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE); + Atom nFSAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE_FULLSCREEN ); + if( nStateAtom && nFSAtom ) + { + /* #i110881# workaround a gtk issue (see https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8) + gtk_window_fullscreen can fail due to a race condition, request an additional status change + to fullscreen to be safe + */ + XEvent aEvent; + aEvent.type = ClientMessage; + aEvent.xclient.display = getDisplay()->GetDisplay(); + aEvent.xclient.window = GDK_WINDOW_XWINDOW(m_pWindow->window); + aEvent.xclient.message_type = nStateAtom; + aEvent.xclient.format = 32; + aEvent.xclient.data.l[0] = 1; + aEvent.xclient.data.l[1] = nFSAtom; + aEvent.xclient.data.l[2] = 0; + aEvent.xclient.data.l[3] = 0; + aEvent.xclient.data.l[4] = 0; + XSendEvent( getDisplay()->GetDisplay(), + getDisplay()->GetRootWindow( m_nScreen ), + False, + SubstructureNotifyMask | SubstructureRedirectMask, + &aEvent + ); + } + + return 0; +} + gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame ) { GtkSalFrame* pThis = (GtkSalFrame*)frame; GTK_YIELD_GRAB(); + if( pThis->m_bFullscreen ) + { + /* #i110881# workaorund a gtk issue (see https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8) + gtk_window_fullscreen can run into a race condition with the window's showstate + */ + Application::PostUserEvent( LINK( pThis, GtkSalFrame, ImplDelayedFullScreenHdl ) ); + } + bool bSetFocus = pThis->m_bSetFocusOnMap; pThis->m_bSetFocusOnMap = false; if( ImplGetSVData()->mbIsTestTool ) |