summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx')
-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
-rw-r--r--vcl/unx/headless/svpframe.cxx27
-rw-r--r--vcl/unx/headless/svpinst.cxx26
-rw-r--r--vcl/unx/headless/svpinst.hxx3
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkgdi.hxx5
-rw-r--r--vcl/unx/inc/saldisp.hxx1
-rw-r--r--vcl/unx/kde4/KDESalGraphics.cxx483
-rw-r--r--vcl/unx/kde4/KDESalGraphics.hxx10
-rw-r--r--vcl/unx/source/app/saldisp.cxx58
-rw-r--r--vcl/unx/source/fontmanager/fontconfig.cxx7
-rw-r--r--vcl/unx/source/fontmanager/fontmanager.cxx8
-rw-r--r--vcl/unx/source/fontmanager/parseAFM.cxx254
-rw-r--r--vcl/unx/source/gdi/gcach_xpeer.cxx2
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx2
-rw-r--r--vcl/unx/source/gdi/xrender_peer.cxx22
-rw-r--r--vcl/unx/source/gdi/xrender_peer.hxx9
-rw-r--r--vcl/unx/source/printer/ppdparser.cxx87
21 files changed, 788 insertions, 462 deletions
diff --git a/vcl/unx/gtk/a11y/atkbridge.cxx b/vcl/unx/gtk/a11y/atkbridge.cxx
index 731a1e6b37..72b6313556 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 42b84d865e..1f0eca82ca 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 41f880433c..cf8f08a42a 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 e92a9ca9a3..39480c9c0b 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 0eb5a18270..5a0ee4ff4c 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
{
diff --git a/vcl/unx/headless/svpframe.cxx b/vcl/unx/headless/svpframe.cxx
index ad035af156..7f304178ce 100644
--- a/vcl/unx/headless/svpframe.cxx
+++ b/vcl/unx/headless/svpframe.cxx
@@ -82,6 +82,33 @@ SvpSalFrame::~SvpSalFrame()
(*it)->SetParent( m_pParent );
if( m_pParent )
m_pParent->m_aChildren.remove( this );
+
+ if( s_pFocusFrame == this )
+ {
+ s_pFocusFrame = NULL;
+ // call directly here, else an event for a destroyed frame would be dispatched
+ CallCallback( SALEVENT_LOSEFOCUS, NULL );
+ // if the handler has not set a new focus frame
+ // pass focus to another frame, preferably a document style window
+ if( s_pFocusFrame == NULL )
+ {
+ const std::list< SalFrame* >& rFrames( m_pInstance->getFrames() );
+ for( std::list< SalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it )
+ {
+ SvpSalFrame* pFrame = const_cast<SvpSalFrame*>(static_cast<const SvpSalFrame*>(*it));
+ if( pFrame->m_bVisible &&
+ pFrame->m_pParent == NULL &&
+ (pFrame->m_nStyle & (SAL_FRAME_STYLE_MOVEABLE |
+ SAL_FRAME_STYLE_SIZEABLE |
+ SAL_FRAME_STYLE_CLOSEABLE) ) != 0
+ )
+ {
+ pFrame->GetFocus();
+ break;
+ }
+ }
+ }
+ }
}
void SvpSalFrame::GetFocus()
diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx
index f4ccffa1a8..01e9a39bb1 100644
--- a/vcl/unx/headless/svpinst.cxx
+++ b/vcl/unx/headless/svpinst.cxx
@@ -55,6 +55,19 @@ extern "C"
}
}
+bool SvpSalInstance::isFrameAlive( const SalFrame* pFrame ) const
+{
+ for( std::list< SalFrame* >::const_iterator it = m_aFrames.begin();
+ it != m_aFrames.end(); ++it )
+ {
+ if( *it == pFrame )
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
SvpSalInstance* SvpSalInstance::s_pDefaultInstance = NULL;
SvpSalInstance::SvpSalInstance()
@@ -346,12 +359,15 @@ void SvpSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
for( std::list<SalUserEvent>::const_iterator it = aEvents.begin(); it != aEvents.end(); ++it )
{
- it->m_pFrame->CallCallback( it->m_nEvent, it->m_pData );
- if( it->m_nEvent == SALEVENT_RESIZE )
+ if ( isFrameAlive( it->m_pFrame ) )
{
- // this would be a good time to post a paint
- const SvpSalFrame* pSvpFrame = static_cast<const SvpSalFrame*>(it->m_pFrame);
- pSvpFrame->PostPaint();
+ it->m_pFrame->CallCallback( it->m_nEvent, it->m_pData );
+ if( it->m_nEvent == SALEVENT_RESIZE )
+ {
+ // this would be a good time to post a paint
+ const SvpSalFrame* pSvpFrame = static_cast<const SvpSalFrame*>(it->m_pFrame);
+ pSvpFrame->PostPaint();
+ }
}
}
}
diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx
index 085d5cfed8..c92ccb910c 100644
--- a/vcl/unx/headless/svpinst.hxx
+++ b/vcl/unx/headless/svpinst.hxx
@@ -108,6 +108,9 @@ class SvpSalInstance : public SalInstance
std::list< SalUserEvent > m_aUserEvents;
std::list< SalFrame* > m_aFrames;
+
+ bool isFrameAlive( const SalFrame* pFrame ) const;
+
public:
static SvpSalInstance* s_pDefaultInstance;
diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
index 75e0e76806..f907785c1e 100644
--- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
@@ -168,6 +168,11 @@ protected:
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
SalControlHandle& rControlHandle, const OUString& rCaption );
+ BOOL NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
+ const Rectangle& rControlRectangle,
+ const clipList& rClipList,
+ ControlState nState, const ImplControlValue& aValue,
+ SalControlHandle& rControlHandle, const OUString& rCaption );
BOOL NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
const Rectangle& rControlRectangle,
const clipList& rClipList,
diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx
index ae0e37f9be..7f01daa232 100644
--- a/vcl/unx/inc/saldisp.hxx
+++ b/vcl/unx/inc/saldisp.hxx
@@ -404,6 +404,7 @@ protected:
int processRandREvent( XEvent* );
void doDestruct();
+ void addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight );
public:
static SalDisplay *GetSalDisplay( Display* display );
static BOOL BestVisual( Display *pDisp,
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index e75a5b7adc..45feda1c22 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -88,8 +88,18 @@ QRect region2QRect( const Region& rControlRegion )
{
Rectangle aRect = rControlRegion.GetBoundRect();
- return QRect( QPoint( aRect.Left(), aRect.Top() ),
- QPoint( aRect.Right(), aRect.Bottom() ) );
+ return QRect(aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight());
+}
+
+KDESalGraphics::KDESalGraphics() :
+ m_image(0)
+{
+}
+
+KDESalGraphics::~KDESalGraphics()
+{
+ if (m_image)
+ delete m_image;
}
BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
@@ -133,6 +143,9 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par
if (type == CTRL_RADIOBUTTON) return true;
+ if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA) )
+ return true;
+
return false;
if ( (type == CTRL_TAB_ITEM) && (part == PART_ENTIRE_CONTROL) ) return true;
@@ -143,7 +156,6 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par
return false;
}
-
BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart,
const Region&, const Point&,
SalControlHandle&, BOOL& )
@@ -151,28 +163,59 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart,
return FALSE;
}
-void lcl_drawFrame( QRect& i_rRect, QPainter& i_rPainter, QStyle::PrimitiveElement i_nElement,
- ControlState i_nState, const ImplControlValue& i_rValue )
+/// helper drawing methods
+namespace
{
+ void draw( QStyle::ControlElement element, QStyleOption* option, QImage* image, QStyle::State state )
+ {
+ option->state |= state;
+ option->rect = image->rect();
+
+ QPainter painter(image);
+ kapp->style()->drawControl(element, option, &painter);
+ }
+
+ void draw( QStyle::PrimitiveElement element, QStyleOption* option, QImage* image, QStyle::State state, int nAdjust = 0 )
+ {
+ option->state |= state;
+ option->rect = image->rect();
+ if( nAdjust )
+ option->rect.adjust( nAdjust, nAdjust, -nAdjust, -nAdjust );
+
+ QPainter painter(image);
+ kapp->style()->drawPrimitive(element, option, &painter);
+ }
+
+ void draw( QStyle::ComplexControl element, QStyleOptionComplex* option, QImage* image, QStyle::State state )
+ {
+ option->state |= state;
+ option->rect = image->rect();
+
+ QPainter painter(image);
+ kapp->style()->drawComplexControl(element, option, &painter);
+ }
+
+ void lcl_drawFrame(QStyle::PrimitiveElement element, QImage* image, QStyle::State state)
+ {
#if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
- QStyleOptionFrameV3 styleOption;
- styleOption.frameShape = QFrame::StyledPanel;
+ QStyleOptionFrameV3 option;
+ option.frameShape = QFrame::StyledPanel;
+ option.state = QStyle::State_Sunken;
#else
- QStyleOptionFrame styleOption;
- QFrame aFrame( NULL );
- aFrame.setFrameRect( QRect(0, 0, i_rRect.width(), i_rRect.height()) );
- aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
- aFrame.ensurePolished();
- styleOption.initFrom( &aFrame );
- styleOption.lineWidth = aFrame.lineWidth();
- styleOption.midLineWidth = aFrame.midLineWidth();
- #endif
- styleOption.rect = QRect(0, 0, i_rRect.width(), i_rRect.height());
- styleOption.state = vclStateValue2StateFlag( i_nState, i_rValue );
- #if ( QT_VERSION < QT_VERSION_CHECK( 4, 5, 0 ) )
- styleOption.state |= QStyle::State_Sunken;
+ QStyleOptionFrame option;
+
+ QFrame aFrame( NULL );
+ aFrame.setFrameRect( QRect(0, 0, image->width(), image->height()) );
+ aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
+ aFrame.ensurePolished();
+
+ option.initFrom( &aFrame );
+ option.lineWidth = aFrame.lineWidth();
+ option.midLineWidth = aFrame.midLineWidth();
#endif
- kapp->style()->drawPrimitive(i_nElement, &styleOption, &i_rPainter);
+
+ draw(element, &option, image, state);
+ }
}
BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
@@ -188,10 +231,6 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
BOOL returnVal = true;
- Display* dpy = GetXDisplay();
- XLIB_Window drawable = GetDrawable();
- GC gc = SelectPen();
-
QRect widgetRect = region2QRect(rControlRegion);
if( type == CTRL_SPINBOX && part == PART_ALL_BUTTONS )
type = CTRL_SPINBUTTONS;
@@ -204,337 +243,287 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
aButtonRect.Right(), aButtonRect.Bottom() );
}
- //draw right onto the window
- QPixmap pixmap(widgetRect.width(), widgetRect.height());
-
- if (pixmap.isNull())
+ //if no image, or resized, make a new image
+ if (!m_image || m_image->size() != widgetRect.size())
{
- return false;
+ if (m_image)
+ delete m_image;
+
+ m_image = new QImage( widgetRect.width(),
+ widgetRect.height(),
+ QImage::Format_ARGB32 );
}
+ m_image->fill(KApplication::palette().color(QPalette::Window).rgb());
- QPainter painter(&pixmap);
- // painter.setBackgroundMode(Qt::OpaqueMode);
-
- //copy previous screen contents for proper blending
- #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
- QPixmap screen = QPixmap::fromX11Pixmap(drawable);
- painter.drawPixmap(0,0, screen, widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height());
- #else
- const QX11Info& rX11Info( pixmap.x11Info() );
- X11SalGraphics::CopyScreenArea( dpy,
- drawable, GetScreenNumber(), GetBitCount(),
- pixmap.handle(), rX11Info.screen(), rX11Info.depth(),
- GetDisplay()->GetCopyGC( GetScreenNumber() ),
- widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height(),
- 0, 0 );
- #endif
+ XLIB_Region pTempClipRegion = 0;
+
if (type == CTRL_PUSHBUTTON)
{
- QStyleOptionButton styleOption;
-
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state =vclStateValue2StateFlag( nControlState, value );
-
- kapp->style()->drawControl( QStyle::CE_PushButton, &styleOption, &painter);
+ QStyleOptionButton option;
+ draw( QStyle::CE_PushButton, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else if ( (type == CTRL_MENUBAR))
{
if (part == PART_MENU_ITEM)
{
- QStyleOptionMenuItem styleOption;
-
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
-
- kapp->style()->drawControl( QStyle::CE_MenuBarItem, &styleOption, &painter);
+ QStyleOptionMenuItem option;
+ draw( QStyle::CE_MenuBarItem, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
+ }
+ else if (part == PART_ENTIRE_CONTROL)
+ {
}
else
{
- pixmap.fill(KApplication::palette().color(QPalette::Window));
+ returnVal = false;
}
}
else if (type == CTRL_MENU_POPUP)
{
if (part == PART_MENU_ITEM)
{
- QStyleOptionMenuItem styleOption;
-
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
-
- kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter);
+ QStyleOptionMenuItem option;
+ draw( QStyle::CE_MenuItem, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
- else if (part == PART_MENU_ITEM_CHECK_MARK)
+ else if (part == PART_MENU_ITEM_CHECK_MARK && (nControlState & CTRL_STATE_PRESSED) )
{
- QStyleOptionButton styleOption;
-
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
-
- if (nControlState & CTRL_STATE_PRESSED)
- {
- kapp->style()->drawPrimitive( QStyle::PE_IndicatorMenuCheckMark, &styleOption, &painter);
- }
+ QStyleOptionButton option;
+ draw( QStyle::PE_IndicatorMenuCheckMark, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
- else if (part == PART_MENU_ITEM_RADIO_MARK)
+ else if (part == PART_MENU_ITEM_RADIO_MARK && (nControlState & CTRL_STATE_PRESSED) )
{
- QStyleOptionButton styleOption;
-
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
-
- if (nControlState & CTRL_STATE_PRESSED)
- {
- kapp->style()->drawPrimitive( QStyle::PE_IndicatorRadioButton, &styleOption, &painter);
- }
+ QStyleOptionButton option;
+ draw( QStyle::PE_IndicatorRadioButton, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else
{
- pixmap.fill(KApplication::palette().color(QPalette::Window));
-
#if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
- QStyleOptionFrameV3 styleOption;
+ QStyleOptionFrameV3 option;
+ option.frameShape = QFrame::StyledPanel;
#else
- QStyleOptionFrameV2 styleOption;
+ QStyleOptionFrameV2 option;
#endif
-
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
- #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
- styleOption.frameShape = QFrame::StyledPanel;
- #endif
-
- kapp->style()->drawPrimitive( QStyle::PE_FrameMenu, &styleOption, &painter);
+ draw( QStyle::PE_FrameMenu, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
}
else if ( (type == CTRL_TOOLBAR) && (part == PART_BUTTON) )
{
- QStyleOptionToolButton styleOption;
+ QStyleOptionToolButton option;
- styleOption.arrowType = Qt::NoArrow;
- styleOption.subControls = QStyle::SC_ToolButton;
+ option.arrowType = Qt::NoArrow;
+ option.subControls = QStyle::SC_ToolButton;
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
- styleOption.state |= QStyle::State_Raised | QStyle::State_Enabled | QStyle::State_AutoRaise;
+ option.state = vclStateValue2StateFlag( nControlState, value );
+ option.state |= QStyle::State_Raised | QStyle::State_Enabled | QStyle::State_AutoRaise;
- kapp->style()->drawComplexControl( QStyle::CC_ToolButton, &styleOption, &painter);
+ draw( QStyle::CC_ToolButton, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else if ( (type == CTRL_TOOLBAR) && (part == PART_ENTIRE_CONTROL) )
{
- QStyleOptionToolBar styleOption;
+ QStyleOptionToolBar option;
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
+ option.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ option.state = vclStateValue2StateFlag( nControlState, value );
- kapp->style()->drawControl( QStyle::CE_ToolBar, &styleOption, &painter);
+ draw( QStyle::CE_ToolBar, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else if ( (type == CTRL_TOOLBAR) && (part == PART_THUMB_VERT) )
{
- QStyleOption styleOption;
+ const int tw = widgetRect.width();
+ widgetRect.setWidth(kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent));
- int width = kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
+ QStyleOption option;
+ option.state = QStyle::State_Horizontal;
- styleOption.rect = QRect(0, 0, width, widgetRect.height());
- styleOption.state = QStyle::State_Horizontal;
+ draw( QStyle::PE_IndicatorToolBarHandle, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
- kapp->style()->drawPrimitive( QStyle::PE_IndicatorToolBarHandle, &styleOption, &painter);
+ widgetRect.setWidth(tw);
}
else if (type == CTRL_EDITBOX)
{
- pixmap.fill(KApplication::palette().color(QPalette::Window));
-
- //TODO hover?? OO does not seem to do this for line edits
+ QStyleOptionFrameV2 option;
+ draw( QStyle::PE_PanelLineEdit, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value), 2 );
- #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
- QStyleOptionFrameV3 styleOption;
- #else
- QStyleOptionFrameV2 styleOption;
- #endif
-
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
-
- //TODO...how does the line edit draw itself internally??
- styleOption.rect = QRect(2, 2, widgetRect.width()-4, widgetRect.height()-4);
- kapp->style()->drawPrimitive( QStyle::PE_PanelLineEdit, &styleOption, &painter);
-
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- kapp->style()->drawPrimitive( QStyle::PE_FrameLineEdit, &styleOption, &painter);
+ draw( QStyle::PE_FrameLineEdit, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value), 0 );
}
else if (type == CTRL_COMBOBOX)
{
- pixmap.fill(KApplication::palette().color(QPalette::Window));
-
- QStyleOptionComboBox styleOption;
+ QStyleOptionComboBox option;
+ option.editable = true;
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
-
- styleOption.editable = true;
-
- kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter);
+ draw( QStyle::CC_ComboBox, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else if (type == CTRL_LISTBOX)
{
if( part == PART_WINDOW )
{
- lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value );
+ lcl_drawFrame( QStyle::PE_Frame, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else
{
- QStyleOptionComboBox styleOption;
-
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
-
+ QStyleOptionComboBox option;
if (part == PART_SUB_EDIT)
{
- kapp->style()->drawControl(QStyle::CE_ComboBoxLabel, &styleOption, &painter);
+ draw( QStyle::CE_ComboBoxLabel, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else
{
- kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter);
+ draw( QStyle::CC_ComboBox, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
}
}
else if (type == CTRL_LISTNODE)
{
- QStyleOption styleOption;
-
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
-
- styleOption.state |= QStyle::State_Item;
- styleOption.state |= QStyle::State_Children;
+ QStyleOption option;
+ option.state = QStyle::State_Item | QStyle::State_Children;
if (nControlState & CTRL_STATE_PRESSED)
- {
- styleOption.state |= QStyle::State_Open;
- }
+ option.state |= QStyle::State_Open;
- kapp->style()->drawPrimitive(QStyle::PE_IndicatorBranch, &styleOption, &painter);
+ draw( QStyle::PE_IndicatorBranch, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else if (type == CTRL_CHECKBOX)
{
- QStyleOptionButton styleOption;
-
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
-
- kapp->style()->drawControl(QStyle::CE_CheckBox, &styleOption, &painter);
+ QStyleOptionButton option;
+ draw( QStyle::CE_CheckBox, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else if (type == CTRL_SCROLLBAR)
{
- pixmap.fill(KApplication::palette().color(QPalette::Window));
-
if ((part == PART_DRAW_BACKGROUND_VERT) || (part == PART_DRAW_BACKGROUND_HORZ))
{
+ QStyleOptionSlider option;
ScrollbarValue* sbVal = static_cast<ScrollbarValue *> ( value.getOptionalVal() );
- QStyleOptionSlider styleOption;
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-
//if the scroll bar is active (aka not degenrate...allow for hover events
if (sbVal->mnVisibleSize < sbVal->mnMax)
- {
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
- styleOption.state |= QStyle::State_MouseOver;
- }
+ option.state = QStyle::State_MouseOver;
//horizontal or vertical
if (part == PART_DRAW_BACKGROUND_VERT)
- {
- styleOption.orientation = Qt::Vertical;
- }
+ option.orientation = Qt::Vertical;
else
- {
- styleOption.state |= QStyle::State_Horizontal;
- }
+ option.state |= QStyle::State_Horizontal;
//setup parameters from the OO values
- styleOption.minimum = sbVal->mnMin;
- styleOption.maximum = sbVal->mnMax - sbVal->mnVisibleSize;
- styleOption.sliderValue = sbVal->mnCur;
- styleOption.sliderPosition = sbVal->mnCur;
- styleOption.pageStep = sbVal->mnVisibleSize;
+ option.minimum = sbVal->mnMin;
+ option.maximum = sbVal->mnMax - sbVal->mnVisibleSize;
+ option.sliderValue = sbVal->mnCur;
+ option.sliderPosition = sbVal->mnCur;
+ option.pageStep = sbVal->mnVisibleSize;
//setup the active control...always the slider
if (sbVal->mnThumbState & CTRL_STATE_ROLLOVER)
- {
- styleOption.activeSubControls = QStyle::SC_ScrollBarSlider;
- }
+ option.activeSubControls = QStyle::SC_ScrollBarSlider;
- kapp->style()->drawComplexControl(QStyle::CC_ScrollBar, &styleOption, &painter);
+ draw( QStyle::CC_ScrollBar, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
+ }
+ else
+ {
+ returnVal = false;
}
}
else if (type == CTRL_SPINBOX)
{
- pixmap.fill(KApplication::palette().color(QPalette::Window));
+ QStyleOptionSpinBox option;
- QStyleOptionSpinBox styleOption;
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
// determine active control
SpinbuttonValue* pSpinVal = (SpinbuttonValue *)(value.getOptionalVal());
if( pSpinVal )
{
if( (pSpinVal->mnUpperState & CTRL_STATE_PRESSED) )
- styleOption.activeSubControls |= QStyle::SC_SpinBoxUp;
+ option.activeSubControls |= QStyle::SC_SpinBoxUp;
if( (pSpinVal->mnLowerState & CTRL_STATE_PRESSED) )
- styleOption.activeSubControls |= QStyle::SC_SpinBoxDown;
+ option.activeSubControls |= QStyle::SC_SpinBoxDown;
}
- kapp->style()->drawComplexControl(QStyle::CC_SpinBox, &styleOption, &painter);
+ draw( QStyle::CC_SpinBox, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else if (type == CTRL_GROUPBOX)
{
- QStyleOptionGroupBox styleOption;
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
-
- kapp->style()->drawComplexControl(QStyle::CC_GroupBox, &styleOption, &painter);
+ QStyleOptionGroupBox option;
+ draw( QStyle::CC_GroupBox, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else if (type == CTRL_RADIOBUTTON)
{
- QStyleOptionButton styleOption;
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
-
- kapp->style()->drawControl(QStyle::CE_RadioButton, &styleOption, &painter);
+ QStyleOptionButton option;
+ draw( QStyle::CE_RadioButton, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else if (type == CTRL_TOOLTIP)
{
- QStyleOption styleOption;
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
-
- kapp->style()->drawPrimitive(QStyle::PE_PanelTipLabel, &styleOption, &painter);
+ QStyleOption option;
+ draw( QStyle::PE_PanelTipLabel, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else if (type == CTRL_FRAME)
{
- pixmap.fill(KApplication::palette().color(QPalette::Window));
- lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value );
+ lcl_drawFrame( QStyle::PE_Frame, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
+
+ int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
+ pTempClipRegion = XCreateRegion();
+ XRectangle xRect = { widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height() };
+ XUnionRectWithRegion( &xRect, pTempClipRegion, pTempClipRegion );
+ XLIB_Region pSubtract = XCreateRegion();
+ xRect.x += size;
+ xRect.y += size;
+ xRect.width -= 2* size;
+ xRect.height -= 2*size;
+ XUnionRectWithRegion( &xRect, pSubtract, pSubtract );
+ XSubtractRegion( pTempClipRegion, pSubtract, pTempClipRegion );
+ XDestroyRegion( pSubtract );
}
else if (type == CTRL_FIXEDBORDER)
{
- pixmap.fill(KApplication::palette().color(QPalette::Window));
- lcl_drawFrame( widgetRect, painter, QStyle::PE_FrameWindow, nControlState, value );
+ lcl_drawFrame( QStyle::PE_FrameWindow, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
}
else if (type == CTRL_WINDOW_BACKGROUND)
{
- pixmap.fill(KApplication::palette().color(QPalette::Window));
+ m_image->fill(KApplication::palette().color(QPalette::Window).rgb());
}
else if (type == CTRL_FIXEDLINE)
{
- QStyleOptionMenuItem styleOption;
-
- styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
- styleOption.state = vclStateValue2StateFlag( nControlState, value );
- styleOption.menuItemType = QStyleOptionMenuItem::Separator;
- styleOption.state |= QStyle::State_Item;
+ QStyleOptionMenuItem option;
+ option.menuItemType = QStyleOptionMenuItem::Separator;
+ option.state |= QStyle::State_Item;
- kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter);
+ draw( QStyle::CE_MenuItem, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
+ }
+ else if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA))
+ {
+ SliderValue* slVal = static_cast<SliderValue *> ( value.getOptionalVal() );
+ QStyleOptionSlider option;
+
+ option.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ option.state = vclStateValue2StateFlag( nControlState, value );
+ option.maximum = slVal->mnMax;
+ option.minimum = slVal->mnMin;
+ option.sliderPosition = option.sliderValue = slVal->mnCur;
+ option.orientation = (part == PART_TRACK_HORZ_AREA) ? Qt::Horizontal : Qt::Vertical;
+
+ draw( QStyle::CC_Slider, &option, m_image, vclStateValue2StateFlag(nControlState, value) );
}
else
{
@@ -543,11 +532,35 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
if (returnVal)
{
- X11SalGraphics::CopyScreenArea( dpy,
- pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(),
- drawable, GetScreenNumber(), GetVisual().GetDepth(), gc,
- 0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top() );
+ GC gc = SelectFont();
+
+ if( gc )
+ {
+ if( pTempClipRegion )
+ {
+ if( pClipRegion_ )
+ XIntersectRegion( pTempClipRegion, pClipRegion_, pTempClipRegion );
+ XSetRegion( GetXDisplay(), gc, pTempClipRegion );
+ }
+ QPixmap pixmap = QPixmap::fromImage(*m_image, Qt::ColorOnly | Qt::OrderedDither | Qt::OrderedAlphaDither);
+ X11SalGraphics::CopyScreenArea( GetXDisplay(),
+ pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(),
+ GetDrawable(), GetScreenNumber(), GetVisual().GetDepth(),
+ gc, 0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top());
+
+ if( pTempClipRegion )
+ {
+ if( pClipRegion_ )
+ XSetRegion( GetXDisplay(), gc, pClipRegion_ );
+ else
+ XSetClipMask( GetXDisplay(), gc, None );
+ }
+ }
+ else
+ returnVal = false;
}
+ if( pTempClipRegion )
+ XDestroyRegion( pTempClipRegion );
return returnVal;
}
@@ -759,6 +772,24 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
boundingRect = contentRect;
retVal = true;
+ break;
+ }
+ case CTRL_SLIDER:
+ {
+ const int w = kapp->style()->pixelMetric(QStyle::PM_SliderLength);
+ if( part == PART_THUMB_HORZ )
+ {
+ contentRect = QRect(boundingRect.left(), boundingRect.top(), w, boundingRect.height());
+ boundingRect = contentRect;
+ retVal = true;
+ }
+ else if( part == PART_THUMB_VERT )
+ {
+ contentRect = QRect(boundingRect.left(), boundingRect.top(), boundingRect.width(), w);
+ boundingRect = contentRect;
+ retVal = true;
+ }
+ break;
}
default:
break;
diff --git a/vcl/unx/kde4/KDESalGraphics.hxx b/vcl/unx/kde4/KDESalGraphics.hxx
index b8c43daad5..4305313646 100644
--- a/vcl/unx/kde4/KDESalGraphics.hxx
+++ b/vcl/unx/kde4/KDESalGraphics.hxx
@@ -31,12 +31,18 @@
#include <saldisp.hxx>
#include <salgdi.h>
+#define Region QtXRegion
+#include <QImage>
+#undef Region
+
/** handles graphics drawings requests and performs the needed drawing operations */
class KDESalGraphics : public X11SalGraphics
{
+ QImage* m_image;
+
public:
- KDESalGraphics() {}
- virtual ~KDESalGraphics() {}
+ KDESalGraphics();
+ virtual ~KDESalGraphics();
/**
What widgets can be drawn the native way.
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx
index fe62765388..9ba38c2550 100644
--- a/vcl/unx/source/app/saldisp.cxx
+++ b/vcl/unx/source/app/saldisp.cxx
@@ -2594,6 +2594,28 @@ void SalDisplay::PrintInfo() const
sal::static_int_cast< unsigned int >(GetVisual(m_nDefaultScreen).GetVisualId()) );
}
+void SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight )
+{
+ // see if any frame buffers are at the same coordinates
+ // this can happen with weird configuration e.g. on
+ // XFree86 and Clone displays
+ const size_t nScreens = m_aXineramaScreens.size();
+ for( size_t n = 0; n < nScreens; n++ )
+ {
+ if( m_aXineramaScreens[n].Left() == i_nX &&
+ m_aXineramaScreens[n].Top() == i_nY )
+ {
+ if( m_aXineramaScreens[n].GetWidth() < i_nWidth ||
+ m_aXineramaScreens[n].GetHeight() < i_nHeight )
+ {
+ m_aXineramaScreens[n].SetSize( Size( i_nWidth, i_nHeight ) );
+ }
+ return;
+ }
+ }
+ m_aXineramaScreens.push_back( Rectangle( Point( i_nX, i_nY ), Size( i_nWidth, i_nHeight ) ) );
+}
+
void SalDisplay::InitXinerama()
{
if( m_aScreens.size() > 1 )
@@ -2618,10 +2640,10 @@ void SalDisplay::InitXinerama()
m_bXinerama = true;
m_aXineramaScreens = std::vector<Rectangle>( nFramebuffers );
for( int i = 0; i < nFramebuffers; i++ )
- m_aXineramaScreens[i] = Rectangle( Point( pFramebuffers[i].x,
- pFramebuffers[i].y ),
- Size( pFramebuffers[i].width,
- pFramebuffers[i].height ) );
+ addXineramaScreenUnique( pFramebuffers[i].x,
+ pFramebuffers[i].y,
+ pFramebuffers[i].width,
+ pFramebuffers[i].height );
}
}
#elif defined(USE_XINERAMA_XORG)
@@ -2637,30 +2659,10 @@ if( XineramaIsActive( pDisp_ ) )
m_aXineramaScreens = std::vector<Rectangle>();
for( int i = 0; i < nFramebuffers; i++ )
{
- // see if any frame buffers are at the same coordinates
- // this can happen with weird configuration e.g. on
- // XFree86 and Clone displays
- bool bDuplicate = false;
- for( int n = 0; n < i; n++ )
- {
- if( m_aXineramaScreens[n].Left() == pScreens[i].x_org &&
- m_aXineramaScreens[n].Top() == pScreens[i].y_org )
- {
- bDuplicate = true;
- if( m_aXineramaScreens[n].GetWidth() < pScreens[i].width ||
- m_aXineramaScreens[n].GetHeight() < pScreens[i].height )
- {
- m_aXineramaScreens[n].SetSize( Size( pScreens[i].width,
- pScreens[i].height ) );
- }
- break;
- }
- }
- if( ! bDuplicate )
- m_aXineramaScreens.push_back( Rectangle( Point( pScreens[i].x_org,
- pScreens[i].y_org ),
- Size( pScreens[i].width,
- pScreens[i].height ) ) );
+ addXineramaScreenUnique( pScreens[i].x_org,
+ pScreens[i].y_org,
+ pScreens[i].width,
+ pScreens[i].height );
}
m_bXinerama = m_aXineramaScreens.size() > 1;
}
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index fd34cfa73a..f93b0a97b1 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -643,7 +643,7 @@ namespace
}
}
-int PrintFontManager::countFontconfigFonts()
+int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl::OStringHash>& o_rVisitedPaths )
{
int nFonts = 0;
@@ -704,6 +704,9 @@ int PrintFontManager::countFontconfigFonts()
std::list< PrintFont* > aFonts;
OString aDir, aBase, aOrgPath( (sal_Char*)file );
splitPath( aOrgPath, aDir, aBase );
+
+ o_rVisitedPaths[aDir] = 1;
+
int nDirID = getDirectoryAtom( aDir, true );
if( ! m_pFontCache->getFontCacheFile( nDirID, aBase, aFonts ) )
{
@@ -1183,7 +1186,7 @@ bool PrintFontManager::initFontconfig()
return false;
}
-int PrintFontManager::countFontconfigFonts()
+int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl::OStringHash>& )
{
return 0;
}
diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx
index 3696bac5e9..9798df943c 100644
--- a/vcl/unx/source/fontmanager/fontmanager.cxx
+++ b/vcl/unx/source/fontmanager/fontmanager.cxx
@@ -2149,10 +2149,14 @@ void PrintFontManager::initialize()
} while( nIndex >= 0 );
}
+ // protect against duplicate paths
+ std::hash_map< OString, int, OStringHash > visited_dirs;
+
// now that all global and local font dirs are known to fontconfig
// check that there are fonts actually managed by fontconfig
+ // also don't search directories that fontconfig already did
if( m_bFontconfigSuccess )
- m_bFontconfigSuccess = (countFontconfigFonts() > 0);
+ m_bFontconfigSuccess = (countFontconfigFonts( visited_dirs ) > 0);
// don't search through many directories fontconfig already told us about
if( ! m_bFontconfigSuccess )
@@ -2163,8 +2167,6 @@ void PrintFontManager::initialize()
// search for font files in each path
std::list< OString >::iterator dir_it;
- // protect against duplicate paths
- std::hash_map< OString, int, OStringHash > visited_dirs;
for( dir_it = m_aFontDirectories.begin(); dir_it != m_aFontDirectories.end(); ++dir_it )
{
OString aPath( *dir_it );
diff --git a/vcl/unx/source/fontmanager/parseAFM.cxx b/vcl/unx/source/fontmanager/parseAFM.cxx
index cc4caacb3f..687253209a 100644
--- a/vcl/unx/source/fontmanager/parseAFM.cxx
+++ b/vcl/unx/source/fontmanager/parseAFM.cxx
@@ -403,89 +403,91 @@ static int parseGlobals( FileInputStream* fp, register GlobalFontInfo* gfi )
switch(recognize(keyword, tokenlen))
{
case STARTFONTMETRICS:
- keyword = token(fp,tokenlen);
- gfi->afmVersion = strdup( keyword );
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->afmVersion = strdup( keyword );
break;
case COMMENT:
keyword = linetoken(fp);
break;
case FONTNAME:
- keyword = token(fp, tokenlen);
- gfi->fontName = strdup( keyword );
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->fontName = strdup( keyword );
break;
case ENCODINGSCHEME:
- keyword = token(fp, tokenlen);
- gfi->encodingScheme = strdup( keyword );
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->encodingScheme = strdup( keyword );
break;
case FULLNAME:
- keyword = linetoken(fp);
- gfi->fullName = strdup( keyword );
+ if ((keyword = linetoken(fp)) != NULL)
+ gfi->fullName = strdup( keyword );
break;
case FAMILYNAME:
- keyword = linetoken(fp);
- gfi->familyName = strdup( keyword );
+ if ((keyword = linetoken(fp)) != NULL)
+ gfi->familyName = strdup( keyword );
break;
case WEIGHT:
- keyword = token(fp, tokenlen);
- gfi->weight = strdup( keyword );
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->weight = strdup( keyword );
break;
case ITALICANGLE:
- keyword = token(fp,tokenlen);
- gfi->italicAngle = StringToDouble( keyword );
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->italicAngle = StringToDouble( keyword );
break;
case ISFIXEDPITCH:
- keyword = token(fp,tokenlen);
- if (MATCH(keyword, False))
- gfi->isFixedPitch = 0;
- else
- gfi->isFixedPitch = 1;
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ {
+ if (MATCH(keyword, False))
+ gfi->isFixedPitch = 0;
+ else
+ gfi->isFixedPitch = 1;
+ }
break;
case UNDERLINEPOSITION:
- keyword = token(fp,tokenlen);
- gfi->underlinePosition = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->underlinePosition = atoi(keyword);
break;
case UNDERLINETHICKNESS:
- keyword = token(fp,tokenlen);
- gfi->underlineThickness = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->underlineThickness = atoi(keyword);
break;
case VERSION:
- keyword = token(fp,tokenlen);
- gfi->version = strdup( keyword );
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->version = strdup( keyword );
break;
case NOTICE:
- keyword = linetoken(fp);
- gfi->notice = strdup( keyword );
+ if ((keyword = linetoken(fp)) != NULL)
+ gfi->notice = strdup( keyword );
break;
case FONTBBOX:
- keyword = token(fp,tokenlen);
- gfi->fontBBox.llx = atoi(keyword);
- keyword = token(fp,tokenlen);
- gfi->fontBBox.lly = atoi(keyword);
- keyword = token(fp,tokenlen);
- gfi->fontBBox.urx = atoi(keyword);
- keyword = token(fp,tokenlen);
- gfi->fontBBox.ury = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->fontBBox.llx = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->fontBBox.lly = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->fontBBox.urx = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->fontBBox.ury = atoi(keyword);
break;
case CAPHEIGHT:
- keyword = token(fp,tokenlen);
- gfi->capHeight = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->capHeight = atoi(keyword);
break;
case XHEIGHT:
- keyword = token(fp,tokenlen);
- gfi->xHeight = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->xHeight = atoi(keyword);
break;
case DESCENT:
- keyword = token(fp,tokenlen);
- gfi->descender = -atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->descender = -atoi(keyword);
break;
case DESCENDER:
- keyword = token(fp,tokenlen);
- gfi->descender = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->descender = atoi(keyword);
break;
case ASCENT:
case ASCENDER:
- keyword = token(fp,tokenlen);
- gfi->ascender = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ gfi->ascender = atoi(keyword);
break;
case STARTCHARMETRICS:
cont = false;
@@ -499,8 +501,8 @@ static int parseGlobals( FileInputStream* fp, register GlobalFontInfo* gfi )
keyword = token(fp,tokenlen);
break;
case STARTDIRECTION:
- keyword = token(fp,tokenlen);
- direction = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ direction = atoi(keyword);
break; /* ignore this for now */
case ENDDIRECTION:
break; /* ignore this for now */
@@ -523,9 +525,11 @@ static int parseGlobals( FileInputStream* fp, register GlobalFontInfo* gfi )
keyword=token(fp,tokenlen); //ignore
break;
case CHARWIDTH:
- keyword = token(fp,tokenlen);
- if (direction == 0)
- gfi->charwidth = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ {
+ if (direction == 0)
+ gfi->charwidth = atoi(keyword);
+ }
keyword = token(fp,tokenlen);
/* ignore y-width for now */
break;
@@ -584,24 +588,27 @@ static int initializeArray( FileInputStream* fp, register int* cwi)
keyword = linetoken(fp);
break;
case CODE:
- code = atoi(token(fp,tokenlen));
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ code = atoi(keyword);
break;
case CODEHEX:
- sscanf(token(fp,tokenlen),"<%x>", &code);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ sscanf(keyword,"<%x>", &code);
break;
case XWIDTH:
- width = atoi(token(fp,tokenlen));
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ width = atoi(keyword);
break;
case X0WIDTH:
(void) token(fp,tokenlen);
break;
case CHARNAME:
- keyword = token(fp,tokenlen);
- if (MATCH(keyword, Space))
- {
- cont = false;
- found = true;
- }
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ if (MATCH(keyword, Space))
+ {
+ cont = false;
+ found = true;
+ }
break;
case ENDCHARMETRICS:
cont = false;
@@ -690,8 +697,8 @@ static int parseCharWidths( FileInputStream* fp, register int* cwi)
keyword = linetoken(fp);
break;
case CODE:
- keyword = token(fp,tokenlen);
- pos = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ pos = atoi(keyword);
break;
case XYWIDTH:
/* PROBLEM: Should be no Y-WIDTH when doing "quick & dirty" */
@@ -699,16 +706,16 @@ static int parseCharWidths( FileInputStream* fp, register int* cwi)
error = parseError;
break;
case CODEHEX:
- keyword = token(fp,tokenlen);
- sscanf(keyword, "<%x>", &pos);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ sscanf(keyword, "<%x>", &pos);
break;
case X0WIDTH:
(void) token(fp,tokenlen);
break;
case XWIDTH:
- keyword = token(fp,tokenlen);
- if (pos >= 0) /* ignore unmapped chars */
- cwi[pos] = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ if (pos >= 0) /* ignore unmapped chars */
+ cwi[pos] = atoi(keyword);
break;
case ENDCHARMETRICS:
cont = false;
@@ -835,7 +842,8 @@ static int parseCharMetrics( FileInputStream* fp, register FontInfo* fi)
{
if (firstTime) firstTime = false;
else temp++;
- temp->code = atoi(token(fp,tokenlen));
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ temp->code = atoi(keyword);
if (fi->gfi && fi->gfi->charwidth)
temp->wx = fi->gfi->charwidth;
count++;
@@ -859,7 +867,8 @@ static int parseCharMetrics( FileInputStream* fp, register FontInfo* fi)
firstTime = false;
else
temp++;
- sscanf(token(fp,tokenlen),"<%x>", &temp->code);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ sscanf(keyword,"<%x>", &temp->code);
if (fi->gfi && fi->gfi->charwidth)
temp->wx = fi->gfi->charwidth;
count++;
@@ -870,24 +879,32 @@ static int parseCharMetrics( FileInputStream* fp, register FontInfo* fi)
}
break;
case XYWIDTH:
- temp->wx = atoi(token(fp,tokenlen));
- temp->wy = atoi(token(fp,tokenlen));
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ temp->wx = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ temp->wy = atoi(keyword);
break;
case X0WIDTH:
- temp->wx = atoi(token(fp,tokenlen));
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ temp->wx = atoi(keyword);
break;
case XWIDTH:
- temp->wx = atoi(token(fp,tokenlen));
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ temp->wx = atoi(keyword);
break;
case CHARNAME:
- keyword = token(fp,tokenlen);
- temp->name = (char *)strdup(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ temp->name = (char *)strdup(keyword);
break;
case CHARBBOX:
- temp->charBBox.llx = atoi(token(fp,tokenlen));
- temp->charBBox.lly = atoi(token(fp,tokenlen));
- temp->charBBox.urx = atoi(token(fp,tokenlen));
- temp->charBBox.ury = atoi(token(fp,tokenlen));
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ temp->charBBox.llx = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ temp->charBBox.lly = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ temp->charBBox.urx = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ temp->charBBox.ury = atoi(keyword);
break;
case LIGATURE: {
Ligature **tail = &(temp->ligs);
@@ -901,10 +918,10 @@ static int parseCharMetrics( FileInputStream* fp, register FontInfo* fi)
}
*tail = (Ligature *) calloc(1, sizeof(Ligature));
- keyword = token(fp,tokenlen);
- (*tail)->succ = (char *)strdup(keyword);
- keyword = token(fp,tokenlen);
- (*tail)->lig = (char *)strdup(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ (*tail)->succ = (char *)strdup(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ (*tail)->lig = (char *)strdup(keyword);
break; }
case ENDCHARMETRICS:
cont = false;;
@@ -1000,16 +1017,16 @@ static int parseTrackKernData( FileInputStream* fp, register FontInfo* fi)
if (tcount < fi->numOfTracks)
{
- keyword = token(fp,tokenlen);
- fi->tkd[pos].degree = atoi(keyword);
- keyword = token(fp,tokenlen);
- fi->tkd[pos].minPtSize = StringToDouble(keyword);
- keyword = token(fp,tokenlen);
- fi->tkd[pos].minKernAmt = StringToDouble(keyword);
- keyword = token(fp,tokenlen);
- fi->tkd[pos].maxPtSize = StringToDouble(keyword);
- keyword = token(fp,tokenlen);
- fi->tkd[pos++].maxKernAmt = StringToDouble(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->tkd[pos].degree = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->tkd[pos].minPtSize = StringToDouble(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->tkd[pos].minKernAmt = StringToDouble(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->tkd[pos].maxPtSize = StringToDouble(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->tkd[pos++].maxKernAmt = StringToDouble(keyword);
tcount++;
}
else
@@ -1107,14 +1124,14 @@ static int parsePairKernData( FileInputStream* fp, register FontInfo* fi)
}
if (pcount < fi->numOfPairs)
{
- keyword = token(fp,tokenlen);
- fi->pkd[pos].name1 = strdup( keyword );
- keyword = token(fp,tokenlen);
- fi->pkd[pos].name2 = strdup( keyword );
- keyword = token(fp,tokenlen);
- fi->pkd[pos].xamt = atoi(keyword);
- keyword = token(fp,tokenlen);
- fi->pkd[pos++].yamt = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->pkd[pos].name1 = strdup( keyword );
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->pkd[pos].name2 = strdup( keyword );
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->pkd[pos].xamt = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->pkd[pos++].yamt = atoi(keyword);
pcount++;
}
else
@@ -1131,12 +1148,12 @@ static int parsePairKernData( FileInputStream* fp, register FontInfo* fi)
}
if (pcount < fi->numOfPairs)
{
- keyword = token(fp,tokenlen);
- fi->pkd[pos].name1 = strdup( keyword );
- keyword = token(fp,tokenlen);
- fi->pkd[pos].name2 = strdup( keyword );
- keyword = token(fp,tokenlen);
- fi->pkd[pos++].xamt = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->pkd[pos].name1 = strdup( keyword );
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->pkd[pos].name2 = strdup( keyword );
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->pkd[pos++].xamt = atoi(keyword);
pcount++;
}
else
@@ -1258,8 +1275,8 @@ static int parseCompCharData( FileInputStream* fp, register FontInfo* fi)
if (firstTime) firstTime = false;
else pos++;
fi->ccd[pos].ccName = strdup( keyword );
- keyword = token(fp,tokenlen);
- fi->ccd[pos].numOfPieces = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->ccd[pos].numOfPieces = atoi(keyword);
fi->ccd[pos].pieces = (Pcc *)
calloc(fi->ccd[pos].numOfPieces, sizeof(Pcc));
j = 0;
@@ -1274,12 +1291,12 @@ static int parseCompCharData( FileInputStream* fp, register FontInfo* fi)
case COMPCHARPIECE:
if (pcount < fi->ccd[pos].numOfPieces)
{
- keyword = token(fp,tokenlen);
- fi->ccd[pos].pieces[j].pccName = strdup( keyword );
- keyword = token(fp,tokenlen);
- fi->ccd[pos].pieces[j].deltax = atoi(keyword);
- keyword = token(fp,tokenlen);
- fi->ccd[pos].pieces[j++].deltay = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->ccd[pos].pieces[j].pccName = strdup( keyword );
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->ccd[pos].pieces[j].deltax = atoi(keyword);
+ if ((keyword = token(fp,tokenlen)) != NULL)
+ fi->ccd[pos].pieces[j++].deltay = atoi(keyword);
pcount++;
}
else
@@ -1373,7 +1390,8 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags)
if ((code != normalEOF) && (code != earlyEOF))
{
- (*fi)->numOfChars = atoi(token(&aFile,tokenlen));
+ if ((keyword = token(&aFile,tokenlen)) != NULL)
+ (*fi)->numOfChars = atoi(keyword);
if (flags & (P_M ^ P_W))
{
(*fi)->cmi = (CharMetricInfo *)
@@ -1423,7 +1441,7 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags)
break;
case STARTTRACKKERN:
keyword = token(&aFile,tokenlen);
- if (flags & P_T)
+ if ((flags & P_T) && keyword)
{
(*fi)->numOfTracks = atoi(keyword);
(*fi)->tkd = (TrackKernData *)
@@ -1438,7 +1456,7 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags)
break;
case STARTKERNPAIRS:
keyword = token(&aFile,tokenlen);
- if (flags & P_P)
+ if ((flags & P_P) && keyword)
{
(*fi)->numOfPairs = atoi(keyword);
(*fi)->pkd = (PairKernData *)
@@ -1453,7 +1471,7 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags)
break;
case STARTCOMPOSITES:
keyword = token(&aFile,tokenlen);
- if (flags & P_C)
+ if ((flags & P_C) && keyword)
{
(*fi)->numOfComps = atoi(keyword);
(*fi)->ccd = (CompCharData *)
diff --git a/vcl/unx/source/gdi/gcach_xpeer.cxx b/vcl/unx/source/gdi/gcach_xpeer.cxx
index 73396a8ac8..8b20486099 100644
--- a/vcl/unx/source/gdi/gcach_xpeer.cxx
+++ b/vcl/unx/source/gdi/gcach_xpeer.cxx
@@ -119,7 +119,7 @@ void X11GlyphPeer::InitAntialiasing()
// enable XRENDER accelerated aliasing on screens that support it
// unless it explicitly disabled by an environment variable
if( (nEnvAntiAlias & 2) == 0 )
- mnUsingXRender = XRenderPeer::GetInstance().InitRenderText( mnMaxScreens );
+ mnUsingXRender = XRenderPeer::GetInstance().InitRenderText();
// else enable client side antialiasing for these screens
// unless it is explicitly disabled by an environment variable
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 8ad506b03d..87fe0bfe82 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -1088,7 +1088,7 @@ void X11SalGraphics::DrawServerAAFontString( const ServerFontLayout& rLayout )
}
// set font foreground color and opacity
- XRenderColor aRenderColor = GetXRenderColor( nTextPixel_ );
+ XRenderColor aRenderColor = GetXRenderColor( nTextColor_ );
rRenderPeer.FillRectangle( PictOpSrc, rEntry.m_aPicture, &aRenderColor, 0, 0, 1, 1 );
// set clipping
diff --git a/vcl/unx/source/gdi/xrender_peer.cxx b/vcl/unx/source/gdi/xrender_peer.cxx
index 9697188b87..27756e600f 100644
--- a/vcl/unx/source/gdi/xrender_peer.cxx
+++ b/vcl/unx/source/gdi/xrender_peer.cxx
@@ -25,6 +25,9 @@
*
************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
#include <stdio.h>
#include <rtl/ustring.hxx>
#include <osl/module.h>
@@ -172,7 +175,7 @@ void XRenderPeer::InitRenderLib()
#if 0 // not having trapezoid support is supported
if( !pFunc ) return;
#endif
- mpXRenderAddTraps = (void(*)(Display*,Picture,int,int,const XTrap*,int))pFunc;
+ mpXRenderAddTraps = (void(*)(Display*,Picture,int,int,const _XTrap*,int))pFunc;
#endif // XRENDER_LINK
@@ -190,12 +193,16 @@ void XRenderPeer::InitRenderLib()
(*mpXRenderQueryVersion)( mpDisplay, &nMajor, &nMinor );
#endif
mnRenderVersion = 16*nMajor + nMinor;
+
+ // the 8bit alpha mask format must be there
+ XRenderPictFormat aPictFormat={0,0,8,{0,0,0,0,0,0,0,0xFF},0};
+ mpStandardFormatA8 = FindPictureFormat( PictFormatAlphaMask|PictFormatDepth, aPictFormat );
}
// ---------------------------------------------------------------------------
// return mask of screens capable of XRENDER text
-sal_uInt32 XRenderPeer::InitRenderText( int nMaxDepth )
+sal_uInt32 XRenderPeer::InitRenderText()
{
if( mnRenderVersion < 0x01 )
return 0;
@@ -206,9 +213,6 @@ sal_uInt32 XRenderPeer::InitRenderText( int nMaxDepth )
if( mnRenderVersion < 0x02 )
return 0;
- // the 8bit alpha mask format must be there
- XRenderPictFormat aPictFormat={0,0,8,{0,0,0,0,0,0,0,0xFF},0};
- mpStandardFormatA8 = FindPictureFormat( PictFormatAlphaMask|PictFormatDepth, aPictFormat );
if( !mpStandardFormatA8 )
return 0;
@@ -217,18 +221,24 @@ sal_uInt32 XRenderPeer::InitRenderText( int nMaxDepth )
SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
const int nScreenCount = pSalDisp->GetScreenCount();
XRenderPictFormat* pVisualFormat = NULL;
+ int nMaxDepth = 0;
for( int nScreen = 0; nScreen < nScreenCount; ++nScreen )
{
Visual* pXVisual = pSalDisp->GetVisual( nScreen ).GetVisual();
pVisualFormat = FindVisualFormat( pXVisual );
if( pVisualFormat != NULL )
+ {
+ int nVDepth = pSalDisp->GetVisual( nScreen ).GetDepth();
+ if( nVDepth > nMaxDepth )
+ nMaxDepth = nVDepth;
nRetMask |= 1U << nScreen;
+ }
}
// #97763# disable XRENDER on <15bit displays for XFree<=4.2.0
if( mnRenderVersion <= 0x02 )
if( nMaxDepth < 15 )
- return 0;
+ nRetMask = 0;
return nRetMask;
}
diff --git a/vcl/unx/source/gdi/xrender_peer.hxx b/vcl/unx/source/gdi/xrender_peer.hxx
index 378dd79a60..448d75489a 100644
--- a/vcl/unx/source/gdi/xrender_peer.hxx
+++ b/vcl/unx/source/gdi/xrender_peer.hxx
@@ -29,6 +29,7 @@
#define _SV_XRENDER_PEER_HXX
#include <tools/prex.h>
+struct _XTrap; // on some older systems this is not declared within Xrender.h
#include <X11/extensions/Xrender.h>
#include <tools/postx.h>
@@ -41,7 +42,7 @@ public:
static XRenderPeer& GetInstance();
int GetVersion() const;
- sal_uInt32 InitRenderText( int nMaxDepth );
+ sal_uInt32 InitRenderText();
protected:
XRenderPeer();
@@ -84,7 +85,7 @@ public:
const XRenderPictFormat*, int nXSrc, int nYSrc,
const XTrapezoid*, int nCount ) const;
bool AddTraps( Picture aDst, int nXOfs, int nYOfs,
- const XTrap*, int nCount ) const;
+ const _XTrap*, int nCount ) const;
bool AreTrapezoidsSupported() const
#ifdef XRENDER_LINK
@@ -120,7 +121,7 @@ private:
const XRenderColor*,int,int,unsigned int,unsigned int);
void (*mpXRenderCompositeTrapezoids)(Display*,int,Picture,Picture,
const XRenderPictFormat*,int,int,const XTrapezoid*,int);
- void (*mpXRenderAddTraps)(Display*,Picture,int,int,const XTrap*,int);
+ void (*mpXRenderAddTraps)(Display*,Picture,int,int,const _XTrap*,int);
#endif // XRENDER_LINK
};
@@ -326,7 +327,7 @@ inline void XRenderPeer::CompositeTrapezoids( int nOp,
}
inline bool XRenderPeer::AddTraps( Picture aDst, int nXOfs, int nYOfs,
- const XTrap* pTraps, int nCount ) const
+ const _XTrap* pTraps, int nCount ) const
{
#ifdef XRENDER_LINK
XRenderAddTraps( mpDisplay, aDst, nXOfs, nYOfs, pTraps, nCount );
diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx
index b4ac80ee58..e7b232618e 100644
--- a/vcl/unx/source/printer/ppdparser.cxx
+++ b/vcl/unx/source/printer/ppdparser.cxx
@@ -258,7 +258,6 @@ using namespace rtl;
std::list< PPDParser* > PPDParser::aAllParsers;
std::hash_map< OUString, OUString, OUStringHash >* PPDParser::pAllPPDFiles = NULL;
-static String aEmptyString;
class PPDDecompressStream
{
@@ -1284,12 +1283,12 @@ void PPDParser::parseConstraint( const ByteString& rLine )
m_aConstraints.push_back( aConstraint );
}
-const String& PPDParser::getDefaultPaperDimension() const
+String PPDParser::getDefaultPaperDimension() const
{
if( m_pDefaultPaperDimension )
return m_pDefaultPaperDimension->m_aOption;
- return aEmptyString;
+ return String();
}
bool PPDParser::getMargins(
@@ -1356,10 +1355,10 @@ bool PPDParser::getPaperDimension(
return true;
}
-const String& PPDParser::matchPaper( int nWidth, int nHeight ) const
+String PPDParser::matchPaper( int nWidth, int nHeight ) const
{
if( ! m_pPaperDimensions )
- return aEmptyString;
+ return String();
int nPDim = -1;
double PDWidth, PDHeight;
@@ -1393,51 +1392,51 @@ const String& PPDParser::matchPaper( int nWidth, int nHeight ) const
{
// swap portrait/landscape and try again
bDontSwap = true;
- const String& rRet = matchPaper( nHeight, nWidth );
+ String rRet = matchPaper( nHeight, nWidth );
bDontSwap = false;
return rRet;
}
- return nPDim != -1 ? m_pPaperDimensions->getValue( nPDim )->m_aOption : aEmptyString;
+ return nPDim != -1 ? m_pPaperDimensions->getValue( nPDim )->m_aOption : String();
}
-const String& PPDParser::getDefaultInputSlot() const
+String PPDParser::getDefaultInputSlot() const
{
if( m_pDefaultInputSlot )
return m_pDefaultInputSlot->m_aValue;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getSlot( int nSlot ) const
+String PPDParser::getSlot( int nSlot ) const
{
if( ! m_pInputSlots )
- return aEmptyString;
+ return String();
if( nSlot > 0 && nSlot < m_pInputSlots->countValues() )
return m_pInputSlots->getValue( nSlot )->m_aOption;
else if( m_pInputSlots->countValues() > 0 )
return m_pInputSlots->getValue( (ULONG)0 )->m_aOption;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getSlotCommand( int nSlot ) const
+String PPDParser::getSlotCommand( int nSlot ) const
{
if( ! m_pInputSlots )
- return aEmptyString;
+ return String();
if( nSlot > 0 && nSlot < m_pInputSlots->countValues() )
return m_pInputSlots->getValue( nSlot )->m_aValue;
else if( m_pInputSlots->countValues() > 0 )
return m_pInputSlots->getValue( (ULONG)0 )->m_aValue;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getSlotCommand( const String& rSlot ) const
+String PPDParser::getSlotCommand( const String& rSlot ) const
{
if( ! m_pInputSlots )
- return aEmptyString;
+ return String();
for( int i=0; i < m_pInputSlots->countValues(); i++ )
{
@@ -1445,39 +1444,39 @@ const String& PPDParser::getSlotCommand( const String& rSlot ) const
if( pValue->m_aOption == rSlot )
return pValue->m_aValue;
}
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getPaperDimension( int nPaperDimension ) const
+String PPDParser::getPaperDimension( int nPaperDimension ) const
{
if( ! m_pPaperDimensions )
- return aEmptyString;
+ return String();
if( nPaperDimension > 0 && nPaperDimension < m_pPaperDimensions->countValues() )
return m_pPaperDimensions->getValue( nPaperDimension )->m_aOption;
else if( m_pPaperDimensions->countValues() > 0 )
return m_pPaperDimensions->getValue( (ULONG)0 )->m_aOption;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getPaperDimensionCommand( int nPaperDimension ) const
+String PPDParser::getPaperDimensionCommand( int nPaperDimension ) const
{
if( ! m_pPaperDimensions )
- return aEmptyString;
+ return String();
if( nPaperDimension > 0 && nPaperDimension < m_pPaperDimensions->countValues() )
return m_pPaperDimensions->getValue( nPaperDimension )->m_aValue;
else if( m_pPaperDimensions->countValues() > 0 )
return m_pPaperDimensions->getValue( (ULONG)0 )->m_aValue;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getPaperDimensionCommand( const String& rPaperDimension ) const
+String PPDParser::getPaperDimensionCommand( const String& rPaperDimension ) const
{
if( ! m_pPaperDimensions )
- return aEmptyString;
+ return String();
for( int i=0; i < m_pPaperDimensions->countValues(); i++ )
{
@@ -1485,7 +1484,7 @@ const String& PPDParser::getPaperDimensionCommand( const String& rPaperDimension
if( pValue->m_aOption == rPaperDimension )
return pValue->m_aValue;
}
- return aEmptyString;
+ return String();
}
void PPDParser::getResolutionFromString(
@@ -1543,13 +1542,13 @@ void PPDParser::getResolution( int nNr, int& rXRes, int& rYRes ) const
rXRes, rYRes );
}
-const String& PPDParser::getResolutionCommand( int nXRes, int nYRes ) const
+String PPDParser::getResolutionCommand( int nXRes, int nYRes ) const
{
if( ( ! m_pResolutions || m_pResolutions->countValues() == 0 ) && m_pDefaultResolution )
return m_pDefaultResolution->m_aValue;
if( ! m_pResolutions )
- return aEmptyString;
+ return String();
int nX, nY;
for( int i = 0; i < m_pResolutions->countValues(); i++ )
@@ -1559,46 +1558,46 @@ const String& PPDParser::getResolutionCommand( int nXRes, int nYRes ) const
if( nX == nXRes && nY == nYRes )
return m_pResolutions->getValue( i )->m_aValue;
}
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getDefaultDuplexType() const
+String PPDParser::getDefaultDuplexType() const
{
if( m_pDefaultDuplexType )
return m_pDefaultDuplexType->m_aValue;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getDuplex( int nDuplex ) const
+String PPDParser::getDuplex( int nDuplex ) const
{
if( ! m_pDuplexTypes )
- return aEmptyString;
+ return String();
if( nDuplex > 0 && nDuplex < m_pDuplexTypes->countValues() )
return m_pDuplexTypes->getValue( nDuplex )->m_aOption;
else if( m_pDuplexTypes->countValues() > 0 )
return m_pDuplexTypes->getValue( (ULONG)0 )->m_aOption;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getDuplexCommand( int nDuplex ) const
+String PPDParser::getDuplexCommand( int nDuplex ) const
{
if( ! m_pDuplexTypes )
- return aEmptyString;
+ return String();
if( nDuplex > 0 && nDuplex < m_pDuplexTypes->countValues() )
return m_pDuplexTypes->getValue( nDuplex )->m_aValue;
else if( m_pDuplexTypes->countValues() > 0 )
return m_pDuplexTypes->getValue( (ULONG)0 )->m_aValue;
- return aEmptyString;
+ return String();
}
-const String& PPDParser::getDuplexCommand( const String& rDuplex ) const
+String PPDParser::getDuplexCommand( const String& rDuplex ) const
{
if( ! m_pDuplexTypes )
- return aEmptyString;
+ return String();
for( int i=0; i < m_pDuplexTypes->countValues(); i++ )
{
@@ -1606,7 +1605,7 @@ const String& PPDParser::getDuplexCommand( const String& rDuplex ) const
if( pValue->m_aOption == rDuplex )
return pValue->m_aValue;
}
- return aEmptyString;
+ return String();
}
void PPDParser::getFontAttributes(
@@ -1636,14 +1635,14 @@ void PPDParser::getFontAttributes(
}
}
-const String& PPDParser::getFont( int nFont ) const
+String PPDParser::getFont( int nFont ) const
{
if( ! m_pFontList )
- return aEmptyString;
+ return String();
if( nFont >=0 && nFont < m_pFontList->countValues() )
return m_pFontList->getValue( nFont )->m_aOption;
- return aEmptyString;
+ return String();
}
rtl::OUString PPDParser::translateKey( const rtl::OUString& i_rKey,