summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx/gtk')
-rw-r--r--vcl/unx/gtk/a11y/atkbridge.cxx4
-rw-r--r--vcl/unx/gtk/a11y/atkutil.cxx8
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx6
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx210
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx18
5 files changed, 224 insertions, 22 deletions
diff --git a/vcl/unx/gtk/a11y/atkbridge.cxx b/vcl/unx/gtk/a11y/atkbridge.cxx
index 9498c4570ae0..47efde7d3dfd 100644
--- a/vcl/unx/gtk/a11y/atkbridge.cxx
+++ b/vcl/unx/gtk/a11y/atkbridge.cxx
@@ -41,7 +41,7 @@ bool InitAtkBridge(void)
const char* pVersion = atk_get_toolkit_version();
if( ! pVersion )
{
- g_warning( "unable to get gail version number" );
+ // g_warning( "unable to get gail version number" );
return false;
}
@@ -50,7 +50,7 @@ bool InitAtkBridge(void)
/* check gail minimum version requirements */
if( sscanf( pVersion, "%u.%u.%u", &major, &minor, &micro) < 3 )
{
- g_warning( "unable to parse gail version number" );
+ // g_warning( "unable to parse gail version number" );
return false;
}
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index 6ed99d0cf3a3..13492f3d4a5c 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -500,6 +500,7 @@ static void handle_toolbox_buttonchange(VclWindowEvent const *pEvent)
/*****************************************************************************/
+/* currently not needed anymore...
static void create_wrapper_for_children(Window *pWindow)
{
if( pWindow && pWindow->IsReallyVisible() )
@@ -517,6 +518,7 @@ static void create_wrapper_for_children(Window *pWindow)
}
}
}
+*/
/*****************************************************************************/
@@ -695,7 +697,11 @@ long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent)
break;
case VCLEVENT_COMBOBOX_SETTEXT:
- create_wrapper_for_children(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
+ // MT 2010/02: This looks quite strange to me. Stumbled over this when fixing #i104290#.
+ // This kicked in when leaving the combobox in the toolbar, after that the events worked.
+ // I guess this was a try to work around missing combobox events, which didn't do the full job, and shouldn't be necessary anymore.
+ // Fix for #i104290# was done in toolkit/source/awt/vclxaccessiblecomponent, FOCUSED state for compound controls in general.
+ // create_wrapper_for_children(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
break;
default:
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index b1529e060270..d1e5c5954352 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -221,8 +221,7 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen )
{
GdkRectangle dest;
gdk_screen_get_monitor_geometry(pScreen, i, &dest);
- m_aXineramaScreens.push_back( Rectangle( Point(dest.x,
- dest.y ), Size( dest.width, dest.height ) ) );
+ addXineramaScreenUnique( dest.x, dest.y, dest.width, dest.height );
}
m_bXinerama = m_aXineramaScreens.size() > 1;
if( ! m_aFrames.empty() )
@@ -663,7 +662,8 @@ void GtkXLib::Init()
if( pScreen )
{
g_signal_connect( G_OBJECT(pScreen), "size-changed", G_CALLBACK(signalScreenSizeChanged), m_pGtkSalDisplay );
- g_signal_connect( G_OBJECT(pScreen), "monitors-changed", G_CALLBACK(signalMonitorsChanged), m_pGtkSalDisplay );
+ if( ! gtk_check_version( 2, 14, 0 ) ) // monitors-changed came in with 2.14, avoid an assertion
+ g_signal_connect( G_OBJECT(pScreen), "monitors-changed", G_CALLBACK(signalMonitorsChanged), m_pGtkSalDisplay );
}
}
}
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 869189fb1415..de4d55b0230a 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -99,6 +99,8 @@ struct NWFWidgetData
GtkWidget * gTooltipPopup;
GtkWidget * gProgressBar;
GtkWidget * gTreeView;
+ GtkWidget * gHScale;
+ GtkWidget * gVScale;
NWPixmapCacheList* gNWPixmapCacheList;
NWPixmapCache* gCacheTabItems;
@@ -131,10 +133,12 @@ struct NWFWidgetData
gMenuItemMenuWidget( NULL ),
gMenuItemCheckMenuWidget( NULL ),
gMenuItemRadioMenuWidget( NULL ),
- gImageMenuItem( NULL ),
+ gImageMenuItem( NULL ),
gTooltipPopup( NULL ),
gProgressBar( NULL ),
gTreeView( NULL ),
+ gHScale( NULL ),
+ gVScale( NULL ),
gNWPixmapCacheList( NULL ),
gCacheTabItems( NULL ),
gCacheTabPages( NULL )
@@ -172,6 +176,7 @@ static void NWEnsureGTKMenu ( int nScreen );
static void NWEnsureGTKTooltip ( int nScreen );
static void NWEnsureGTKProgressBar ( int nScreen );
static void NWEnsureGTKTreeView ( int nScreen );
+static void NWEnsureGTKSlider ( int nScreen );
static void NWConvertVCLStateToGTKState( ControlState nVCLState, GtkStateType* nGTKState, GtkShadowType* nGTKShadow );
static void NWAddWidgetToCacheWindow( GtkWidget* widget, int nScreen );
@@ -589,8 +594,13 @@ BOOL GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
) ||
((nType == CTRL_LISTNODE || nType == CTRL_LISTNET) &&
( (nPart == PART_ENTIRE_CONTROL) )
+ ) ||
+ ((nType == CTRL_SLIDER) &&
+ ( (nPart == PART_TRACK_HORZ_AREA)
+ || (nPart == PART_TRACK_VERT_AREA)
)
)
+ )
return( TRUE );
return( FALSE );
@@ -875,6 +885,10 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
// don't actually draw anything; gtk treeviews do not draw lines
returnVal = true;
}
+ else if( (nType == CTRL_SLIDER) )
+ {
+ returnVal = NWPaintGTKSlider( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption );
+ }
if( pixmap )
{
@@ -1103,6 +1117,30 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
rNativeContentRegion = rNativeBoundingRegion;
returnVal = TRUE;
}
+ if( (nType == CTRL_SLIDER) && (nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT) )
+ {
+ NWEnsureGTKSlider( m_nScreen );
+ GtkWidget* widget = (nPart == PART_THUMB_HORZ) ? gWidgetData[m_nScreen].gHScale : gWidgetData[m_nScreen].gVScale;
+ gint slider_length = 10;
+ gint slider_width = 10;
+ gtk_widget_style_get( widget,
+ "slider-width", &slider_width,
+ "slider-length", &slider_length,
+ (char *)NULL);
+ Rectangle aRect( rControlRegion.GetBoundRect() );
+ if( nPart == PART_THUMB_HORZ )
+ {
+ aRect.Right() = aRect.Left() + slider_length - 1;
+ aRect.Bottom() = aRect.Top() + slider_width - 1;
+ }
+ else
+ {
+ aRect.Bottom() = aRect.Top() + slider_length - 1;
+ aRect.Right() = aRect.Left() + slider_width - 1;
+ }
+ rNativeBoundingRegion = rNativeContentRegion = Region( aRect );
+ returnVal = TRUE;
+ }
return( returnVal );
}
@@ -3012,6 +3050,133 @@ BOOL GtkSalGraphics::NWPaintGTKProgress(
return bRet;
}
+BOOL GtkSalGraphics::NWPaintGTKSlider(
+ GdkDrawable*,
+ ControlType, ControlPart nPart,
+ const Rectangle& rControlRectangle,
+ const clipList&,
+ ControlState nState, const ImplControlValue& rValue,
+ SalControlHandle&, const OUString& )
+{
+ NWEnsureGTKSlider( m_nScreen );
+
+ gint w, h;
+ w = rControlRectangle.GetWidth();
+ h = rControlRectangle.GetHeight();
+
+ SliderValue* pVal = (SliderValue*)rValue.getOptionalVal();
+
+ GdkPixmap* pixmap = NWGetPixmapFromScreen( rControlRectangle );
+ if( ! pixmap )
+ return FALSE;
+
+ (void)pVal;
+
+ GdkDrawable* const &pixDrawable = GDK_DRAWABLE( pixmap );
+ GtkWidget* pWidget = (nPart == PART_TRACK_HORZ_AREA)
+ ? GTK_WIDGET(gWidgetData[m_nScreen].gHScale)
+ : GTK_WIDGET(gWidgetData[m_nScreen].gVScale);
+ const gchar* pDetail = (nPart == PART_TRACK_HORZ_AREA) ? "hscale" : "vscale";
+ GtkOrientation eOri = (nPart == PART_TRACK_HORZ_AREA) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
+ GtkStateType eState = (nState & CTRL_STATE_ENABLED) ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE;
+ gint slider_width = 10;
+ gint slider_length = 10;
+ gint trough_border = 0;
+ gtk_widget_style_get( pWidget,
+ "slider-width", &slider_width,
+ "slider-length", &slider_length,
+ "trough-border", &trough_border,
+ NULL);
+
+ eState = (nState & CTRL_STATE_ENABLED) ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE;
+ if( nPart == PART_TRACK_HORZ_AREA )
+ {
+ gtk_paint_box( pWidget->style,
+ pixDrawable,
+ eState,
+ GTK_SHADOW_IN,
+ NULL,
+ pWidget,
+ "trough",
+ 0, (h-slider_width-2*trough_border)/2, w, slider_width + 2*trough_border);
+ gint x = (w - slider_length + 1) * (pVal->mnCur - pVal->mnMin) / (pVal->mnMax - pVal->mnMin);
+ gtk_paint_slider( pWidget->style,
+ pixDrawable,
+ eState,
+ GTK_SHADOW_OUT,
+ NULL,
+ pWidget,
+ pDetail,
+ x, (h-slider_width)/2,
+ slider_length, slider_width,
+ eOri );
+ }
+ else
+ {
+ gtk_paint_box( pWidget->style,
+ pixDrawable,
+ eState,
+ GTK_SHADOW_IN,
+ NULL,
+ pWidget,
+ "trough",
+ (w-slider_width-2*trough_border)/2, 0, slider_width + 2*trough_border, h);
+ gint y = (h - slider_length + 1) * (pVal->mnCur - pVal->mnMin) / (pVal->mnMax - pVal->mnMin);
+ gtk_paint_slider( pWidget->style,
+ pixDrawable,
+ eState,
+ GTK_SHADOW_OUT,
+ NULL,
+ pWidget,
+ pDetail,
+ (w-slider_width)/2, y,
+ slider_width, slider_length,
+ eOri );
+ }
+ #if 0
+ // paint background
+ gtk_paint_flat_box( gWidgetData[m_nScreen].gProgressBar->style,
+ pixDrawable,
+ GTK_STATE_NORMAL,
+ GTK_SHADOW_NONE,
+ NULL,
+ gWidgetData[m_nScreen].gProgressBar,
+ "trough",
+ 0, 0, w, h );
+ if( nProgressWidth > 0 )
+ {
+ // paint progress
+ if( Application::GetSettings().GetLayoutRTL() )
+ {
+ gtk_paint_box( gWidgetData[m_nScreen].gProgressBar->style,
+ pixDrawable,
+ GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
+ NULL,
+ gWidgetData[m_nScreen].gProgressBar,
+ "bar",
+ w-nProgressWidth, 0, nProgressWidth, h
+ );
+ }
+ else
+ {
+ gtk_paint_box( gWidgetData[m_nScreen].gProgressBar->style,
+ pixDrawable,
+ GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
+ NULL,
+ gWidgetData[m_nScreen].gProgressBar,
+ "bar",
+ 0, 0, nProgressWidth, h
+ );
+ }
+ }
+ #endif
+
+ BOOL bRet = NWRenderPixmapToScreen( pixmap, rControlRectangle );
+ g_object_unref( pixmap );
+
+ return bRet;
+}
+
//----
static Rectangle NWGetListBoxButtonRect( int nScreen,
@@ -3271,20 +3436,23 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetHighlightColor( aHighlightColor );
aStyleSet.SetHighlightTextColor( aHighlightTextColor );
- // hyperlink colors
- GdkColor *link_color = NULL;
- gtk_widget_style_get (m_pWindow, "link-color", &link_color, NULL);
- if (link_color)
- {
- aStyleSet.SetLinkColor(getColor(*link_color));
- gdk_color_free (link_color);
- link_color = NULL;
- }
- gtk_widget_style_get (m_pWindow, "visited-link-color", &link_color, NULL);
- if (link_color)
+ if( ! gtk_check_version( 2, 10, 0 ) ) // link colors came in with 2.10, avoid an assertion
{
- aStyleSet.SetVisitedLinkColor(getColor(*link_color));
- gdk_color_free (link_color);
+ // hyperlink colors
+ GdkColor *link_color = NULL;
+ gtk_widget_style_get (m_pWindow, "link-color", &link_color, NULL);
+ if (link_color)
+ {
+ aStyleSet.SetLinkColor(getColor(*link_color));
+ gdk_color_free (link_color);
+ link_color = NULL;
+ }
+ gtk_widget_style_get (m_pWindow, "visited-link-color", &link_color, NULL);
+ if (link_color)
+ {
+ aStyleSet.SetVisitedLinkColor(getColor(*link_color));
+ gdk_color_free (link_color);
+ }
}
// Tab colors
@@ -3962,3 +4130,17 @@ static void NWEnsureGTKTreeView( int nScreen )
NWAddWidgetToCacheWindow( gWidgetData[nScreen].gTreeView, nScreen );
}
}
+
+static void NWEnsureGTKSlider( int nScreen )
+{
+ if( !gWidgetData[nScreen].gHScale )
+ {
+ gWidgetData[nScreen].gHScale = gtk_hscale_new_with_range(0, 10, 1);
+ NWAddWidgetToCacheWindow( gWidgetData[nScreen].gHScale, nScreen );
+ }
+ if( !gWidgetData[nScreen].gVScale )
+ {
+ gWidgetData[nScreen].gVScale = gtk_vscale_new_with_range(0, 10, 1);
+ NWAddWidgetToCacheWindow( gWidgetData[nScreen].gVScale, nScreen );
+ }
+}
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index ba42cfc5ae82..ef356eb57aa9 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -806,8 +806,15 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
/* #i100116# metacity has a peculiar behavior regarding WM_HINT accept focus and _NET_WM_USER_TIME
at some point that may be fixed in metacity and we will have to revisit this
*/
- bool bMetaCityToolWindowHack = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") &&
- (nStyle & SAL_FRAME_STYLE_TOOLWINDOW );
+
+ // MT/PL 2010/02: #i102694# and #i102803# have been introduced by this hack
+ // Nowadays the original issue referenced above doesn't seem to exist anymore, tested different szenarious described in the issues
+ // If some older versions of MetaCity are still in use somewhere, they need to be updated, instead of using strange hacks in OOo.
+ // As a work around for such old systems, people might consider to not use the GTK plugin.
+
+ bool bMetaCityToolWindowHack = false;
+ // bMetaCityToolWindowHack = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") && (nStyle & SAL_FRAME_STYLE_TOOLWINDOW );
+
if( bDecoHandling )
{
bool bNoDecor = ! (nStyle & (SAL_FRAME_STYLE_MOVEABLE | SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_CLOSEABLE ) );
@@ -2081,7 +2088,14 @@ void GtkSalFrame::ToTop( USHORT nFlags )
* is set to false.
*/
if( (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE)) )
+ {
+ // sad but true: this can cause an XError, we need to catch that
+ // to do this we need to synchronize with the XServer
+ getDisplay()->GetXLib()->PushXErrorLevel( true );
XSetInputFocus( getDisplay()->GetDisplay(), GDK_WINDOW_XWINDOW( m_pWindow->window ), RevertToParent, CurrentTime );
+ XSync( getDisplay()->GetDisplay(), False );
+ getDisplay()->GetXLib()->PopXErrorLevel();
+ }
}
else
{