[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 9 commits - sd/source vcl/aqua vcl/headless vcl/inc vcl/ios vcl/source vcl/unx vcl/win

Michael Meeks michael at kemper.freedesktop.org
Mon Jan 16 08:16:56 PST 2012


 sd/source/ui/dlg/present.cxx                  |    8 
 vcl/aqua/source/app/salsys.cxx                |   14 
 vcl/aqua/source/window/salframe.cxx           |    2 
 vcl/headless/svpdummies.cxx                   |   14 
 vcl/inc/aqua/salsys.h                         |    6 
 vcl/inc/headless/svpdummies.hxx               |    6 
 vcl/inc/ios/salsys.h                          |    6 
 vcl/inc/salgeom.hxx                           |    4 
 vcl/inc/salsys.hxx                            |   18 
 vcl/inc/unx/gtk/gtkdata.hxx                   |   15 
 vcl/inc/unx/gtk/gtkframe.hxx                  |   14 
 vcl/inc/unx/gtk/gtksys.hxx                    |   14 
 vcl/inc/unx/salbmp.h                          |   26 -
 vcl/inc/unx/saldisp.hxx                       |  106 ++--
 vcl/inc/unx/salframe.h                        |   22 -
 vcl/inc/unx/salgdi.h                          |   12 
 vcl/inc/unx/saltype.h                         |   47 ++
 vcl/inc/unx/salvd.h                           |   27 -
 vcl/inc/unx/soicon.hxx                        |    8 
 vcl/inc/unx/x11/x11sys.hxx                    |   10 
 vcl/inc/vcl/svapp.hxx                         |   29 -
 vcl/inc/vcl/syswin.hxx                        |    8 
 vcl/inc/vcl/wrkwin.hxx                        |   25 -
 vcl/inc/win/salsys.h                          |    7 
 vcl/ios/source/app/salsys.cxx                 |   14 
 vcl/ios/source/window/salframe.cxx            |    2 
 vcl/source/app/svapp.cxx                      |   18 
 vcl/source/components/display.cxx             |   66 +--
 vcl/source/window/floatwin.cxx                |    2 
 vcl/source/window/menu.cxx                    |    6 
 vcl/source/window/syswin.cxx                  |   16 
 vcl/source/window/wrkwin.cxx                  |   16 
 vcl/unx/generic/app/i18n_status.cxx           |    2 
 vcl/unx/generic/app/saldisp.cxx               |  153 +++----
 vcl/unx/generic/app/sm.cxx                    |    4 
 vcl/unx/generic/app/soicon.cxx                |   22 -
 vcl/unx/generic/app/wmadaptor.cxx             |   32 -
 vcl/unx/generic/gdi/gcach_xpeer.cxx           |    4 
 vcl/unx/generic/gdi/salbmp.cxx                |   48 +-
 vcl/unx/generic/gdi/salgdi.cxx                |   33 -
 vcl/unx/generic/gdi/salgdi2.cxx               |   56 +-
 vcl/unx/generic/gdi/salgdi3.cxx               |    6 
 vcl/unx/generic/gdi/salvd.cxx                 |   41 +
 vcl/unx/generic/window/salframe.cxx           |  148 +++---
 vcl/unx/generic/window/salobj.cxx             |   24 -
 vcl/unx/gtk/app/gtkdata.cxx                   |   34 -
 vcl/unx/gtk/app/gtksys.cxx                    |   38 +
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx      |  554 +++++++++++++-------------
 vcl/unx/gtk/window/gtkframe.cxx               |   72 +--
 vcl/unx/gtk/window/gtkobject.cxx              |    8 
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |    6 
 vcl/unx/kde/salnativewidgets-kde.cxx          |   32 -
 vcl/unx/x11/x11sys.cxx                        |   22 -
 vcl/win/source/app/salinfo.cxx                |   11 
 vcl/win/source/window/salframe.cxx            |    4 
 55 files changed, 1010 insertions(+), 932 deletions(-)

New commits:
commit 41991c7521dd33f45ec3dadfed34c5d2a24fb288
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon Jan 16 15:17:56 2012 +0000

    vcl: more back-port cleanup

diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 250ed1c..1f3f0d0 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -2795,7 +2795,7 @@ SalColormap::SalColormap( const BitmapPalette &rPalette )
       m_nWhitePixel( SALCOLOR_NONE ),
       m_nBlackPixel( SALCOLOR_NONE ),
       m_nUsed( rPalette.GetEntryCount() ),
-      m_nScreen( GetGenericData()->GetSalDisplay()->GetDefaultScreenNumber() )
+      m_nXScreen( m_pDisplay ? m_pDisplay->GetDefaultXScreen() : SalX11Screen( 0 ) )
 {
     m_aPalette = std::vector<SalColor>(m_nUsed);
 
@@ -2925,7 +2925,7 @@ SalColormap::~SalColormap()
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 void SalColormap::SetPalette( const BitmapPalette &rPalette )
 {
-    if( this != &GetGenericData()->GetSalDisplay()->GetColormap(m_nScreen) )
+    if( this != &GetGenericData()->GetSalDisplay()->GetColormap(m_nXScreen) )
     {
         m_nBlackPixel = SALCOLOR_NONE;
         m_nWhitePixel = SALCOLOR_NONE;
commit d9fa47c4dcbf95f5d3ca07fc3815d8ab9b2468eb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 16 10:30:36 2012 +0000

    WaE: getXScreen is an unsigned int now

diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index f81f911..4de2b33 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -375,13 +375,14 @@ public:
                                XIC = NULL ) const;
 
     XLIB_Cursor           GetPointer( int ePointerStyle );
+    sal_Bool              IsLocal();
     virtual int           CaptureMouse( SalFrame *pCapture );
 
     void                  Remove( XEvent   *pEvent );
     virtual ScreenData   *initScreen( SalX11Screen nXScreen ) const;
     const ScreenData&     getDataForScreen( SalX11Screen nXScreen ) const
     {
-        if( nXScreen.getXScreen() >= static_cast<int>(m_aScreens.size()) )
+        if( nXScreen.getXScreen() >= static_cast<unsigned int>(m_aScreens.size()) )
             return m_aInvalidScreenData;
         if( ! m_aScreens[nXScreen.getXScreen()].m_bInit )
             initScreen( nXScreen );
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 78853ac..250ed1c 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -641,7 +641,7 @@ void SalX11Display::PostUserEvent()
 SalDisplay::ScreenData *
 SalDisplay::initScreen( SalX11Screen nXScreen ) const
 {
-    if( nXScreen.getXScreen() >= static_cast<int>(m_aScreens.size()) )
+    if( nXScreen.getXScreen() >= static_cast<unsigned int>(m_aScreens.size()) )
         nXScreen = m_nXDefaultScreen;
     ScreenData* pSD = const_cast<ScreenData *>(&m_aScreens[nXScreen.getXScreen()]);
     if( pSD->m_bInit )
commit ed7de95ca10fdf86f00772a7e7af093db0b85d43
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Sun Jan 15 01:24:38 2012 +0000

    vcl: second part of fix for fdo#43458 - get xrandr / y positioning right

diff --git a/vcl/inc/vcl/wrkwin.hxx b/vcl/inc/vcl/wrkwin.hxx
index c58f697..c9a3da9 100644
--- a/vcl/inc/vcl/wrkwin.hxx
+++ b/vcl/inc/vcl/wrkwin.hxx
@@ -80,30 +80,33 @@ public:
 
     virtual sal_Bool    Close();
 
-    /** The default value of nDisplay = -1 means "don't care" and
-        allows to backends to use any screen [** or display? terminology!]
-        they like (most probably the current one).
+    /** The default value of nDisplayScreen = -1 means "don't care" and
+        allows to backends to use any screen they like (most probably
+        the current one).
 
         NOTE: The default value cannot be 0, because 0 is a legitimate
-        screen number.
+        Display Screen number.
      */
-    void            ShowFullScreenMode( sal_Bool bFullScreenMode = sal_True, sal_Int32 nDisplay = -1 );
+    void            ShowFullScreenMode( sal_Bool bFullScreenMode = sal_True,
+                                        sal_Int32 nDisplayScreen = -1 );
     void            EndFullScreenMode() { ShowFullScreenMode( sal_False ); }
-    sal_Bool            IsFullScreenMode() const { return mbFullScreenMode; }
+    sal_Bool        IsFullScreenMode() const { return mbFullScreenMode; }
 
-    void            StartPresentationMode( sal_Bool bPresentation = sal_True, sal_uInt16 nFlags = 0, sal_Int32 nDisplay = 0 );
+    void            StartPresentationMode( sal_Bool   bPresentation = sal_True,
+                                           sal_uInt16 nFlags = 0,
+                                           sal_Int32  nDisplayScreen = 0 );
     void            EndPresentationMode() {  StartPresentationMode( sal_False ); }
-    sal_Bool            IsPresentationMode() const { return mbPresentationMode; }
+    sal_Bool        IsPresentationMode() const { return mbPresentationMode; }
 
-    sal_Bool            IsMinimized() const;
+    sal_Bool        IsMinimized() const;
 
-    sal_Bool            SetPluginParent( SystemParentData* pParent );
+    sal_Bool        SetPluginParent( SystemParentData* pParent );
 
     void            Minimize();
     void            Restore();
 
     void            Maximize( sal_Bool bMaximize = sal_True );
-    sal_Bool            IsMaximized() const;
+    sal_Bool        IsMaximized() const;
 };
 
 #endif // _SV_WRKWIN_HXX
diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx
index 091f888..ef5ba5f 100644
--- a/vcl/source/window/wrkwin.cxx
+++ b/vcl/source/window/wrkwin.cxx
@@ -177,15 +177,15 @@ WorkWindow::~WorkWindow()
 
 // -----------------------------------------------------------------------
 
-void WorkWindow::ShowFullScreenMode( sal_Bool bFullScreenMode, sal_Int32 nDisplay )
+void WorkWindow::ShowFullScreenMode( sal_Bool bFullScreenMode, sal_Int32 nDisplayScreen )
 {
     if ( !mbFullScreenMode == !bFullScreenMode )
         return;
 
-    if( (nDisplay < 0)
-    || (nDisplay >= static_cast<sal_Int32>(Application::GetScreenCount()) ) )
+    if( (nDisplayScreen < 0)
+    || (nDisplayScreen >= static_cast<sal_Int32>(Application::GetScreenCount()) ) )
     {
-        nDisplay = GetScreenNumber();
+        nDisplayScreen = GetScreenNumber();
     }
 
     mbFullScreenMode = bFullScreenMode != 0;
@@ -204,13 +204,13 @@ void WorkWindow::ShowFullScreenMode( sal_Bool bFullScreenMode, sal_Int32 nDispla
         }
 
         mpWindowImpl->mpFrameWindow->mpWindowImpl->mbWaitSystemResize = sal_True;
-        ImplGetFrame()->ShowFullScreen( bFullScreenMode, nDisplay );
+        ImplGetFrame()->ShowFullScreen( bFullScreenMode, nDisplayScreen );
     }
 }
 
 // -----------------------------------------------------------------------
 
-void WorkWindow::StartPresentationMode( sal_Bool bPresentation, sal_uInt16 nFlags, sal_Int32 nDisplay )
+void WorkWindow::StartPresentationMode( sal_Bool bPresentation, sal_uInt16 nFlags, sal_Int32 nDisplayScreen )
 {
     if ( !bPresentation == !mbPresentationMode )
         return;
@@ -223,7 +223,7 @@ void WorkWindow::StartPresentationMode( sal_Bool bPresentation, sal_uInt16 nFlag
         mnPresentationFlags     = nFlags;
 
         if ( !(mnPresentationFlags & PRESENTATION_NOFULLSCREEN) )
-            ShowFullScreenMode( sal_True, nDisplay );
+            ShowFullScreenMode( sal_True, nDisplayScreen );
         if ( !mbSysChild )
         {
             if ( mnPresentationFlags & PRESENTATION_HIDEALLAPPS )
@@ -245,7 +245,7 @@ void WorkWindow::StartPresentationMode( sal_Bool bPresentation, sal_uInt16 nFlag
             if ( mnPresentationFlags & PRESENTATION_HIDEALLAPPS )
                 mpWindowImpl->mpFrame->SetAlwaysOnTop( sal_False );
         }
-        ShowFullScreenMode( mbPresentationFull, nDisplay );
+        ShowFullScreenMode( mbPresentationFull, nDisplayScreen );
 
         mbPresentationMode      = sal_False;
         mbPresentationVisible   = sal_False;
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 0768093..4869c45 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -1880,7 +1880,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
     if( eType == SET_FULLSCREEN )
     {
         maGeometry.nX = aNewMonitor.x;
-        maGeometry.nY = aNewMonitor.x;
+        maGeometry.nY = aNewMonitor.y;
         maGeometry.nWidth = aNewMonitor.width;
         maGeometry.nHeight = aNewMonitor.height;
         m_nStyle |= SAL_FRAME_STYLE_PARTIAL_FULLSCREEN;
commit 8f101cc385506f765b7364d247bef2e7351e5d09
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon Jan 16 14:19:58 2012 +0000

    vcl: introduce crystal clear separation between X11 Screens and DisplayScreens
    
    A DisplayScreen is a screen index as used by the upper level abstractions,
    an X11Screen is a wrapper around an integer X screen index.
    
    Conflicts:
    
    	vcl/inc/unx/saldisp.hxx

diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index ca1108c..d90b468 100644
--- a/vcl/aqua/source/window/salframe.cxx
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -1665,7 +1665,7 @@ void AquaSalFrame::UpdateFrameGeometry()
         maScreenRect = [pScreen frame];
         NSArray* pScreens = [NSScreen screens];
         if( pScreens )
-            maGeometry.nScreenNumber = [pScreens indexOfObject: pScreen];
+            maGeometry.nDisplayScreenNumber = [pScreens indexOfObject: pScreen];
     }
 
     NSRect aFrameRect = [mpWindow frame];
diff --git a/vcl/inc/salgeom.hxx b/vcl/inc/salgeom.hxx
index c512d0a..045c659 100644
--- a/vcl/inc/salgeom.hxx
+++ b/vcl/inc/salgeom.hxx
@@ -39,13 +39,13 @@ typedef struct _SalFrameGeometry {
                         nTopDecoration,
                         nRightDecoration,
                         nBottomDecoration;
-    unsigned int        nScreenNumber;
+    unsigned int        nDisplayScreenNumber;
 
     _SalFrameGeometry() :
     nX( 0 ), nY( 0 ), nWidth( 1 ), nHeight( 1 ),
     nLeftDecoration( 0 ), nTopDecoration( 0 ),
     nRightDecoration( 0 ), nBottomDecoration( 0 ),
-    nScreenNumber( 0 )
+    nDisplayScreenNumber( 0 )
     {}
 } SalFrameGeometry;
 
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index ced4d16..21fb1e4 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -154,12 +154,16 @@ public:
     GdkCursor *getCursor( PointerStyle ePointerStyle );
     virtual int CaptureMouse( SalFrame* pFrame );
 
+    int          GetDefaultScreen() { return m_pSys->GetDisplayDefaultScreen(); }
+    SalX11Screen GetDefaultXScreen() { return m_pSys->GetDisplayDefaultXScreen(); }
+    Size         GetScreenSize( int nDisplayScreen );
+    int          GetXScreenCount() { return m_pSys->GetDisplayXScreenCount(); }
 #if GTK_CHECK_VERSION(3,0,0)
-    int  GetDefaultScreenNumber() { return m_pSys->GetDisplayDefaultScreen(); }
-    int  GetScreenCount() { return m_pSys->GetDisplayScreenCount(); }
-    Size GetScreenSize( int screen );
+//    int          GetScreenCount() { return m_pSys->GetDisplayScreenCount(); }
+#endif
+#if !GTK_CHECK_VERSION(3,0,0)
+    virtual ScreenData *initScreen( SalX11Screen nXScreen ) const;
 #endif
-    virtual void initScreen( int nScreen ) const;
 
     GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event,
                                     GdkEvent* event );
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 1facf7e..f1d49ac 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -42,6 +42,7 @@
 
 #include <salframe.hxx>
 #include <vcl/sysdata.hxx>
+#include <unx/saltype.h>
 
 #include "tools/link.hxx"
 
@@ -176,7 +177,7 @@ class GtkSalFrame : public SalFrame
     };
     friend struct IMHandler;
 
-    int                             m_nScreen;
+    SalX11Screen                    m_nXScreen;
     GtkWidget*                      m_pWindow;
     int                             m_nDuringRender;
     GdkWindow*                      m_pForeignParent;
@@ -184,7 +185,7 @@ class GtkSalFrame : public SalFrame
     GdkWindow*                      m_pForeignTopLevel;
     GdkNativeWindow                 m_aForeignTopLevelWindow;
     Pixmap                          m_hBackgroundPixmap;
-    sal_uLong                     m_nStyle;
+    sal_uLong                       m_nStyle;
     SalExtStyle                     m_nExtStyle;
     GtkFixed*                       m_pFixedContainer;
     GtkSalFrame*                    m_pParent;
@@ -192,7 +193,7 @@ class GtkSalFrame : public SalFrame
     GdkWindowState                  m_nState;
     SystemEnvData                   m_aSystemData;
     GraphicsHolder                  m_aGraphics[ nMaxGraphics ];
-    sal_uInt16                          m_nKeyModifiers;
+    sal_uInt16                      m_nKeyModifiers;
     GdkCursor                      *m_pCurrentCursor;
     GdkVisibilityState              m_nVisibility;
     PointerStyle                    m_ePointerStyle;
@@ -205,7 +206,7 @@ class GtkSalFrame : public SalFrame
     bool                            m_bSendModChangeOnRelease;
     bool                            m_bWindowIsGtkPlug;
     bool                            m_bSetFocusOnMap;
-    rtl::OUString                          m_aTitle;
+    rtl::OUString                   m_aTitle;
     rtl::OUString                   m_sWMClass;
 
     IMHandler*                      m_pIMHandler;
@@ -287,7 +288,7 @@ class GtkSalFrame : public SalFrame
     Size calcDefaultSize();
 
     void setMinMaxSize();
-    void createNewWindow( XLIB_Window aParent, bool bXEmbed, int nScreen );
+    void createNewWindow( XLIB_Window aParent, bool bXEmbed, SalX11Screen nXScreen );
     void askForXEmbedFocus( sal_Int32 nTimecode );
 
     void AllocateFrame();
@@ -320,7 +321,8 @@ public:
     GdkVisibilityState getVisibilityState() const
     { return m_nVisibility; }
     Pixmap getBackgroundPixmap() const { return m_hBackgroundPixmap; }
-    int getScreenNumber() const { return m_nScreen; }
+    SalX11Screen getXScreenNumber() const { return m_nXScreen; }
+    int          GetDisplayScreen() const { return maGeometry.nDisplayScreenNumber; }
     void updateScreenNumber();
 
     // only for gtk3 ...
diff --git a/vcl/inc/unx/gtk/gtksys.hxx b/vcl/inc/unx/gtk/gtksys.hxx
index 784623b..df9e79e 100644
--- a/vcl/inc/unx/gtk/gtksys.hxx
+++ b/vcl/inc/unx/gtk/gtksys.hxx
@@ -32,6 +32,7 @@
 
 #include "generic/gensys.h"
 #include <gtk/gtk.h>
+#include <unx/saltype.h>
 
 class GtkSalSystem : public SalGenericSystem
 {
@@ -51,7 +52,10 @@ public:
                                             const rtl::OUString&              rMessage,
                                             const std::list< rtl::OUString >& rButtons,
                                             int                        nDefButton);
-
+    SalX11Screen      GetDisplayDefaultXScreen()
+            { return getXScreenFromDisplayScreen( GetDisplayDefaultScreen() ); }
+    int               GetDisplayXScreenCount();
+    SalX11Screen      getXScreenFromDisplayScreen(unsigned int nDisplayScreen);
     // We have a 'screen' number that is combined from screen-idx + monitor-idx
     static int        getScreenIdxFromPtr     (GdkDisplay *pDisplay, GdkScreen *pScreen);
     static int        getScreenMonitorIdx     (GdkDisplay *pDisplay, GdkScreen *pScreen, int nX, int nY);
diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h
index 0fa69ae..a5f0bac 100644
--- a/vcl/inc/unx/salbmp.h
+++ b/vcl/inc/unx/salbmp.h
@@ -60,7 +60,7 @@ private:
 
     static BitmapBuffer*        ImplCreateDIB(
                                     Drawable aDrawable,
-                                    int nScreen,
+                                    SalX11Screen nXScreen,
                                     long nDrawableDepth,
                                     long nX,
                                     long nY,
@@ -82,7 +82,7 @@ public:
     bool                        ImplCreateFromXImage(
                                     Display* pDisplay,
                                     XLIB_Window hWindow,
-                                    int nScreen,
+                                    SalX11Screen nXScreen,
                                     XImage* pImage
                                 );
 private:
@@ -95,7 +95,7 @@ public:
 
     SAL_DLLPRIVATE bool         ImplCreateFromDrawable(
                                     Drawable aDrawable,
-                                    int nScreen,
+                                    SalX11Screen nXScreen,
                                     long nDrawableDepth,
                                     long nX,
                                     long nY,
@@ -105,21 +105,21 @@ public:
 
     SAL_DLLPRIVATE XImage*      ImplCreateXImage(
                                     SalDisplay* pSalDisp,
-                                    int nScreen,
+                                    SalX11Screen nXScreen,
                                     long nDepth,
                                     const SalTwoRect& rTwoRect
                                 ) const;
 
     SAL_DLLPRIVATE ImplSalDDB*  ImplGetDDB(
                                     Drawable,
-                                    int nScreen,
+                                    SalX11Screen nXScreen,
                                     long nDrawableDepth,
                                     const SalTwoRect&
                                 ) const;
 
     void                        ImplDraw(
                                     Drawable aDrawable,
-                                    int nScreen,
+                                    SalX11Screen nXScreen,
                                     long nDrawableDepth,
                                     const SalTwoRect& rTwoRect,
                                     const GC& rGC
@@ -177,9 +177,9 @@ private:
     Pixmap          maPixmap;
     SalTwoRect      maTwoRect;
     long            mnDepth;
-    int             mnScreen;
+    SalX11Screen    mnXScreen;
 
-                    ImplSalDDB() {}
+                    ImplSalDDB() : mnXScreen(0) {}
 
     static void     ImplDraw(
                         Drawable aSrcDrawable,
@@ -200,13 +200,13 @@ public:
                     ImplSalDDB(
                         XImage* pImage,
                         Drawable aDrawable,
-                        int nScreen,
+                        SalX11Screen nXScreen,
                         const SalTwoRect& rTwoRect
                     );
 
                     ImplSalDDB(
                         Drawable aDrawable,
-                        int nScreen,
+                        SalX11Screen nXScreen,
                         long nDrawableDepth,
                         long nX,
                         long nY,
@@ -217,7 +217,7 @@ public:
                     ImplSalDDB(
                         Display* pDisplay,
                         XLIB_Window hWindow,
-                        int nScreen,
+                        SalX11Screen nXScreen,
                         XImage* pImage
                     );
 
@@ -231,9 +231,9 @@ public:
                     {
                         return( ( maTwoRect.mnDestWidth * maTwoRect.mnDestHeight * mnDepth ) >> 3 );
                     }
-    int             ImplGetScreen() const { return mnScreen; }
+    SalX11Screen    ImplGetScreen() const { return mnXScreen; }
 
-    bool            ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const;
+    bool            ImplMatches( SalX11Screen nXScreen, long nDepth, const SalTwoRect& rTwoRect ) const;
 
     void            ImplDraw(
                         Drawable aDrawable,
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index ded2d1c..f81f911 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -37,6 +37,7 @@ class   SalXLib;
 
 // -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 #include <unx/salunx.h>
+#include <unx/saltype.h>
 #include <vcl/salgtype.hxx>
 #include <vcl/ptrstyle.hxx>
 #include <sal/types.h>
@@ -155,16 +156,16 @@ class SalColormap
     Pixel                   m_nWhitePixel;
     Pixel                   m_nBlackPixel;
     Pixel                   m_nUsed;            // Pseudocolor
-    int                     m_nScreen;
+    SalX11Screen            m_nXScreen;
 
     void            GetPalette();
     void            GetLookupTable();
 public:
     SalColormap( const SalDisplay*  pSalDisplay,
                  Colormap           hColormap,
-                 int                nScreen );
+                 SalX11Screen       nXScreen );
     SalColormap( const BitmapPalette &rpPalette );
-    SalColormap( sal_uInt16             nDepth );
+    SalColormap( sal_uInt16         nDepth );
     SalColormap();
     ~SalColormap();
 
@@ -177,16 +178,15 @@ public:
     inline  Pixel               GetBlackPixel() const { return m_nBlackPixel; }
     inline  Pixel               GetUsed() const { return m_nUsed; }
     inline  int                 GetClass() const { return m_aVisual.GetClass(); }
-    inline  int                 GetScreenNumber() const { return m_nScreen; }
 
     sal_Bool            GetXPixels( XColor  &rColor,
-                                int      r,
-                                int      g,
-                                int      b ) const;
+                                    int      r,
+                                    int      g,
+                                    int      b ) const;
     inline  sal_Bool            GetXPixel( XColor  &rColor,
-                                       int      r,
-                                       int      g,
-                                       int      b ) const;
+                                           int      r,
+                                           int      g,
+                                           int      b ) const;
     Pixel           GetPixel( SalColor nColor ) const;
     SalColor        GetColor( Pixel nPixel ) const;
     void            SetPalette( const BitmapPalette &rPalette );
@@ -297,7 +297,8 @@ protected:
     AttributeProvider           *mpFactory;
 
     Display        *pDisp_;             // X Display
-    int             m_nDefaultScreen;           // XDefaultScreen
+
+    SalX11Screen                 m_nXDefaultScreen;
     std::vector< ScreenData >    m_aScreens;
     ScreenData      m_aInvalidScreenData;
     Pair            aResolution_;       // [dpi]
@@ -373,69 +374,63 @@ public:
                                Status         *pStatus,
                                XIC = NULL ) const;
 
-    XLIB_Cursor     GetPointer( int ePointerStyle );
-    virtual int CaptureMouse( SalFrame *pCapture );
-
-    sal_Bool            IsLocal();
+    XLIB_Cursor           GetPointer( int ePointerStyle );
+    virtual int           CaptureMouse( SalFrame *pCapture );
 
-    void            Remove( XEvent   *pEvent );
-
-    virtual void          initScreen( int nScreen ) const;
-    const ScreenData&     getDataForScreen( int nScreen ) const
+    void                  Remove( XEvent   *pEvent );
+    virtual ScreenData   *initScreen( SalX11Screen nXScreen ) const;
+    const ScreenData&     getDataForScreen( SalX11Screen nXScreen ) const
     {
-        if( nScreen < 0 || nScreen >= static_cast<int>(m_aScreens.size()) )
+        if( nXScreen.getXScreen() >= static_cast<int>(m_aScreens.size()) )
             return m_aInvalidScreenData;
-        if( ! m_aScreens[nScreen].m_bInit )
-            initScreen( nScreen );
-        return m_aScreens[nScreen];
+        if( ! m_aScreens[nXScreen.getXScreen()].m_bInit )
+            initScreen( nXScreen );
+        return m_aScreens[nXScreen.getXScreen()];
     }
 
-    XLIB_Window     GetDrawable( int nScreen ) const { return getDataForScreen( nScreen ).m_aRefWindow; }
+    XLIB_Window     GetDrawable( SalX11Screen nXScreen ) const { return getDataForScreen( nXScreen ).m_aRefWindow; }
     Display        *GetDisplay() const { return pDisp_; }
-    int             GetDefaultScreenNumber() const { return m_nDefaultScreen; }
-    const Size&     GetScreenSize( int nScreen ) const { return getDataForScreen( nScreen ).m_aSize; }
+    SalX11Screen    GetDefaultXScreen() const { return m_nXDefaultScreen; }
+    const Size&     GetScreenSize( SalX11Screen nXScreen ) const { return getDataForScreen( nXScreen ).m_aSize; }
     srv_vendor_t    GetServerVendor() const { return meServerVendor; }
     void            SetServerVendor() { meServerVendor = sal_GetServerVendor(pDisp_); }
-    sal_Bool            IsDisplay() const { return !!pXLib_; }
-    GC              GetMonoGC( int nScreen ) const { return getDataForScreen(nScreen).m_aMonoGC; }
-    GC              GetCopyGC( int nScreen ) const { return getDataForScreen(nScreen).m_aCopyGC; }
-    GC              GetAndInvertedGC( int nScreen ) const { return getDataForScreen(nScreen).m_aAndInvertedGC; }
-    GC              GetAndGC( int nScreen ) const { return getDataForScreen(nScreen).m_aAndGC; }
-    GC              GetOrGC( int nScreen ) const { return getDataForScreen(nScreen).m_aOrGC; }
-    GC              GetStippleGC( int nScreen ) const { return getDataForScreen(nScreen).m_aStippleGC; }
-    GC              GetGC( sal_uInt16 nDepth, int nScreen ) const;
-    Pixmap          GetInvert50( int nScreen ) const { return getDataForScreen(nScreen).m_hInvert50; }
-    const SalColormap&    GetColormap( int nScreen ) const { return getDataForScreen(nScreen).m_aColormap; }
-    const SalVisual&      GetVisual( int nScreen ) const { return getDataForScreen(nScreen).m_aVisual; }
-    RenderEntryMap&       GetRenderEntries( int nScreen ) const { return getDataForScreen(nScreen).m_aRenderData; }
+    sal_Bool        IsDisplay() const { return !!pXLib_; }
+    GC              GetMonoGC( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aMonoGC; }
+    GC              GetCopyGC( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aCopyGC; }
+    GC              GetAndInvertedGC( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aAndInvertedGC; }
+    GC              GetAndGC( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aAndGC; }
+    GC              GetOrGC( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aOrGC; }
+    GC              GetStippleGC( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aStippleGC; }
+    GC              GetGC( sal_uInt16 nDepth, SalX11Screen nXScreen ) const;
+    Pixmap          GetInvert50( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_hInvert50; }
+    const SalColormap&    GetColormap( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aColormap; }
+    const SalVisual&      GetVisual( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aVisual; }
+    RenderEntryMap&       GetRenderEntries( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aRenderData; }
     const Pair     &GetResolution() const { return aResolution_; }
     bool            GetExactResolution() const { return mbExactResolution; }
-    sal_uLong           GetProperties() const { return PROPERTY_DEFAULT; }
-    sal_uLong           GetMaxRequestSize() const { return nMaxRequestSize_; }
+    sal_uLong       GetProperties() const { return PROPERTY_DEFAULT; }
+    sal_uLong       GetMaxRequestSize() const { return nMaxRequestSize_; }
     XLIB_Time       GetLastUserEventTime( bool bAlwaysReget = false ) const;
 
     bool            XIfEventWithTimeout( XEvent*, XPointer, X_if_predicate, long i_nTimeout = 1000 ) const;
-    SalXLib*         GetXLib() const { return pXLib_; }
+    SalXLib*        GetXLib() const { return pXLib_; }
 
-    SalI18N_InputMethod*            GetInputMethod()  const { return mpInputMethod;  }
+    SalI18N_InputMethod*        GetInputMethod()  const { return mpInputMethod;  }
     SalI18N_KeyboardExtension*  GetKbdExtension() const { return mpKbdExtension; }
     void            SetInputMethod( SalI18N_InputMethod *pInputMethod )
     { mpInputMethod = pInputMethod; }
     void            SetKbdExtension(SalI18N_KeyboardExtension *pKbdExtension)
     { mpKbdExtension = pKbdExtension; }
-    const char* GetKeyboardName( bool bRefresh = false );
+    const char*     GetKeyboardName( bool bRefresh = false );
     ::vcl_sal::WMAdaptor* getWMAdaptor() const { return m_pWMAdaptor; }
     bool            IsXinerama() const { return m_bXinerama; }
     const std::vector< Rectangle >& GetXineramaScreens() const { return m_aXineramaScreens; }
-    XLIB_Window     GetRootWindow( int nScreen ) const
-    { return getDataForScreen( nScreen ).m_aRoot; }
-    const std::vector< ScreenData >& GetScreenData()
-    { return m_aScreens; }
-    int GetScreenCount() const { return static_cast<int>(m_aScreens.size()); }
-
-    const std::list< SalFrame* >& getFrames() const
-    { return m_aFrames; }
+    XLIB_Window     GetRootWindow( SalX11Screen nXScreen ) const
+            { return getDataForScreen( nXScreen ).m_aRoot; }
+    const std::vector< ScreenData >& GetScreenData() { return m_aScreens; }
+    unsigned int GetXScreenCount() const { return m_aScreens.size(); }
 
+    const std::list< SalFrame* >& getFrames() const { return m_aFrames; }
     sal_Bool            IsNumLockFromXS() const { return bNumLockFromXS_; }
 
     std::list< SalObject* >& getSalObjects() { return m_aSalObjects; }
@@ -445,11 +440,11 @@ public:
 
 // -=-= inlines =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-inline GC SalDisplay::GetGC( sal_uInt16 nDepth, int nScreen ) const
+inline GC SalDisplay::GetGC( sal_uInt16 nDepth, SalX11Screen nXScreen ) const
 { return 1 == nDepth
-         ? GetMonoGC( nScreen )
-         : getDataForScreen(nScreen).m_aVisual.GetDepth() == nDepth
-           ? GetCopyGC( nScreen )
+         ? GetMonoGC( nXScreen )
+         : getDataForScreen(nXScreen).m_aVisual.GetDepth() == nDepth
+           ? GetCopyGC( nXScreen )
            : None; }
 
 inline  Display *SalColormap::GetXDisplay() const
diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
index 6343d44..5c87692 100644
--- a/vcl/inc/unx/salframe.h
+++ b/vcl/inc/unx/salframe.h
@@ -31,6 +31,7 @@
 // -=-= #includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 #include <unx/salstd.hxx>
 #include <unx/salunx.h>
+#include <unx/saltype.h>
 
 #include <salframe.hxx>
 #include <salwtype.hxx>
@@ -41,7 +42,6 @@
 #include <vcl/timer.hxx>
 #include <vclpluginapi.h>
 
-
 #include <list>
 
 // -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -66,13 +66,13 @@ class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame
 
     static X11SalFrame* s_pSaveYourselfFrame;
 
-    X11SalFrame*    mpParent;            // pointer to parent frame
-                                    // which should never obscur this frame
+    X11SalFrame*    mpParent;             // pointer to parent frame
+                                          // which should never obscur this frame
     bool            mbTransientForRoot;
-    std::list< X11SalFrame* > maChildren;         // List of child frames
+    std::list< X11SalFrame* > maChildren; // List of child frames
 
     SalDisplay     *pDisplay_;
-    int             m_nScreen;
+    SalX11Screen    m_nXScreen;
     XLIB_Window     mhWindow;
     XLIB_Window     mhShellWindow;
     XLIB_Window     mhForeignParent;
@@ -89,11 +89,11 @@ class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame
     X11SalGraphics  *pFreeGraphics_;        // first free frame graphics
 
     XLIB_Time       nReleaseTime_;      // timestamp of last key release
-    sal_uInt16          nKeyCode_;          // last key code
-    sal_uInt16          nKeyState_;         // last key state
+    sal_uInt16      nKeyCode_;          // last key code
+    sal_uInt16      nKeyState_;         // last key state
     int             nCompose_;          // compose state
     bool            mbSendExtKeyModChange;
-    sal_uInt16          mnExtKeyMod;
+    sal_uInt16      mnExtKeyMod;
 
     int             nShowState_;        // show state
     int             nWidth_;            // client width
@@ -169,7 +169,7 @@ class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame
 
     void            passOnSaveYourSelf();
 
-    void            createNewWindow( XLIB_Window aParent, int nScreen = -1 );
+    void            createNewWindow( XLIB_Window aParent, SalX11Screen nXScreen = SalX11Screen( -1 ) );
     void            updateScreenNumber();
 
     void            setXEmbedInfo();
@@ -181,13 +181,13 @@ public:
     virtual ~X11SalFrame();
 
     long            Dispatch( XEvent *pEvent );
-    void            Init( sal_uIntPtr nSalFrameStyle, int nScreen = -1,
+    void            Init( sal_uIntPtr nSalFrameStyle, SalX11Screen nScreen = SalX11Screen( -1 ),
                           SystemParentData* pParentData = NULL, bool bUseGeometry = false );
 
     SalDisplay*             GetDisplay() const { return pDisplay_; }
     Display*                GetXDisplay() const;
     XLIB_Window             GetDrawable() const;
-    int                     GetScreenNumber() const { return m_nScreen; }
+    SalX11Screen            GetScreenNumber() const { return m_nXScreen; }
     XLIB_Window             GetWindow() const { return mhWindow; }
     XLIB_Window             GetShellWindow() const { return mhShellWindow; }
     XLIB_Window             GetForeignParent() const { return mhForeignParent; }
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 9ef7773..fd0ffbe 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -105,7 +105,7 @@ protected:
     const SalColormap*      m_pColormap;
     SalColormap    *m_pDeleteColormap;
     Drawable        hDrawable_;     // use
-    int             m_nScreen;
+    SalX11Screen    m_nXScreen;
     mutable XRenderPictFormat* m_pXRenderFormat;
     XID             m_aXRenderPicture;
     CairoFontsCache m_aCairoFontsCache;
@@ -220,7 +220,7 @@ public:
                             X11SalGraphics();
     virtual             ~X11SalGraphics();
 
-            void            Init( SalFrame *pFrame, Drawable aDrawable, int nScreen );
+            void            Init( SalFrame *pFrame, Drawable aDrawable, SalX11Screen nXScreen );
             void            Init( X11SalVirtualDevice *pVirtualDevice, SalColormap* pColormap = NULL, bool bDeleteColormap = false );
             void            Init( class ImplSalPrinterData *pPrinter );
             void            DeInit();
@@ -229,7 +229,7 @@ public:
     inline  Display*            GetXDisplay() const;
     inline  const SalVisual&    GetVisual() const;
     inline  Drawable        GetDrawable() const { return hDrawable_; }
-    void                    SetDrawable( Drawable d, int nScreen );
+    void                    SetDrawable( Drawable d, SalX11Screen nXScreen );
     XID                     GetXRenderPicture();
     XRenderPictFormat*      GetXRenderFormat() const;
     inline  void            SetXRenderFormat( XRenderPictFormat* pXRenderFormat ) { m_pXRenderFormat = pXRenderFormat; }
@@ -237,7 +237,7 @@ public:
     using SalGraphics::GetPixel;
     inline  Pixel           GetPixel( SalColor nSalColor ) const;
 
-    int                     GetScreenNumber() const { return m_nScreen; }
+    SalX11Screen            GetScreenNumber() const { return m_nXScreen; }
 
     // overload all pure virtual methods
     virtual void            GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY );
@@ -368,8 +368,8 @@ public:
     // do XCopyArea or XGet/PutImage depending on screen numbers
     // signature is like XCopyArea with screen numbers added
     static void CopyScreenArea( Display* pDisplay,
-                                Drawable aSrc, int nScreenSrc, int nSrcDepth,
-                                Drawable aDest, int nScreenDest, int nDestDepth,
+                                Drawable aSrc, SalX11Screen nXScreenSrc, int nSrcDepth,
+                                Drawable aDest, SalX11Screen nXScreenDest, int nDestDepth,
                                 GC aDestGC,
                                 int src_x, int src_y,
                                 unsigned int w, unsigned int h,
diff --git a/vcl/inc/unx/saltype.h b/vcl/inc/unx/saltype.h
new file mode 100644
index 0000000..fd87d11
--- /dev/null
+++ b/vcl/inc/unx/saltype.h
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *       Michael Meeks <michael.meeks at novell.com>
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Major Contributor(s):
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef SAL_TYPE_H
+#define SAL_TYPE_H
+
+// an X11 screen index - this unpleasant construct is to allow
+// us to cleanly separate the 'DisplayScreen' concept - as used
+// in the public facing API, from X's idea of screen indicees.
+// Both of these are plain unsigned integers called 'screen'
+class SalX11Screen {
+    unsigned int mnXScreen;
+public:
+    explicit SalX11Screen(unsigned int nXScreen) : mnXScreen( nXScreen ) {}
+    unsigned int getXScreen() const { return mnXScreen; }
+    bool operator==(const SalX11Screen &rOther) { return rOther.mnXScreen == mnXScreen; }
+    bool operator!=(const SalX11Screen &rOther) { return rOther.mnXScreen != mnXScreen; }
+};
+
+#endif // SAL_TYPE_H
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h
index 42ce192..d0d4623 100644
--- a/vcl/inc/unx/salvd.h
+++ b/vcl/inc/unx/salvd.h
@@ -31,6 +31,7 @@
 
 // -=-= #includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 #include <unx/salstd.hxx>
+#include <unx/saltype.h>
 #include <salvd.hxx>
 
 // -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -45,40 +46,40 @@ class X11SalVirtualDevice : public SalVirtualDevice
 
 
     Pixmap          hDrawable_;
-    int             m_nScreen;
+    SalX11Screen    m_nXScreen;
 
     int             nDX_;
     int             nDY_;
-    sal_uInt16          nDepth_;
-    sal_Bool            bGraphics_;         // is Graphics used
-    sal_Bool            bExternPixmap_;
+    sal_uInt16      nDepth_;
+    sal_Bool        bGraphics_;         // is Graphics used
+    sal_Bool        bExternPixmap_;
 
 public:
     X11SalVirtualDevice();
     virtual ~X11SalVirtualDevice();
 
     sal_Bool            Init( SalDisplay *pDisplay,
-                          long nDX, long nDY,
-                          sal_uInt16 nBitCount,
-                          int nScreen,
-                          Pixmap hDrawable = None,
-                          XRenderPictFormat* pXRenderFormat = NULL );
+                              long nDX, long nDY,
+                              sal_uInt16 nBitCount,
+                              SalX11Screen nXScreen,
+                              Pixmap hDrawable = None,
+                              XRenderPictFormat* pXRenderFormat = NULL );
     inline  void            InitGraphics( X11SalVirtualDevice *pVD );
 
     inline  Display        *GetXDisplay() const;
     inline  SalDisplay     *GetDisplay() const;
-    inline  sal_Bool            IsDisplay() const;
+    inline  sal_Bool        IsDisplay() const;
     inline  Pixmap          GetDrawable() const { return hDrawable_; }
-    inline  sal_uInt16          GetDepth() const { return nDepth_; }
+    inline  sal_uInt16      GetDepth() const { return nDepth_; }
     int                     GetWidth() const { return nDX_; }
     int                     GetHeight() const { return nDY_; }
-    int                     GetScreenNumber() const { return m_nScreen; }
+    SalX11Screen            GetXScreenNumber() const { return m_nXScreen; }
 
     virtual SalGraphics*    GetGraphics();
     virtual void            ReleaseGraphics( SalGraphics* pGraphics );
 
                             // Set new size, without saving the old contents
-    virtual sal_Bool            SetSize( long nNewDX, long nNewDY );
+    virtual sal_Bool        SetSize( long nNewDX, long nNewDY );
     virtual void            GetSize( long& rWidth, long& rHeight );
 };
 
diff --git a/vcl/inc/unx/soicon.hxx b/vcl/inc/unx/soicon.hxx
index cb3302c..9ec95e6 100644
--- a/vcl/inc/unx/soicon.hxx
+++ b/vcl/inc/unx/soicon.hxx
@@ -28,13 +28,15 @@
 #ifndef _SV_SOICON_HXX
 #define _SV_SOICON_HXX
 
+#include <unx/saltype.h>
+
 class SalDisplay;
 class SalBitmap;
 class Bitmap;
 
-sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen,
-                          sal_uInt16 nIcon, sal_uInt16 iconSize,
-                          Pixmap& icon_pixmap, Pixmap& icon_mask );
+sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, SalX11Screen nScreen,
+                              sal_uInt16 nIcon, sal_uInt16 iconSize,
+                              Pixmap& icon_pixmap, Pixmap& icon_mask );
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/window/salframe.cxx b/vcl/ios/source/window/salframe.cxx
index efe3f3d..b1464a6 100644
--- a/vcl/ios/source/window/salframe.cxx
+++ b/vcl/ios/source/window/salframe.cxx
@@ -1003,7 +1003,7 @@ void IosSalFrame::UpdateFrameGeometry()
         maScreenRect = [pScreen frame];
         NSArray* pScreens = [NSScreen screens];
         if( pScreens )
-            maGeometry.nScreenNumber = [pScreens indexOfObject: pScreen];
+            maGeometry.nDisplayScreenNumber = [pScreens indexOfObject: pScreen];
     }
 
     CGRect aFrameRect = [mpWindow frame];
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 31ea5fc..3da96c2 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2517,8 +2517,8 @@ Size Menu::ImplCalcSize( Window* pWin )
         // except on rather small screens
         // TODO: move GetScreenNumber from SystemWindow to Window ?
         // currently we rely on internal privileges
-        unsigned int nScreenNumber = pWin->ImplGetWindowImpl()->mpFrame->maGeometry.nScreenNumber;
-        Rectangle aDispRect( Application::GetScreenPosSizePixel( nScreenNumber ) );
+        unsigned int nDisplayScreen = pWin->ImplGetWindowImpl()->mpFrame->maGeometry.nDisplayScreenNumber;
+        Rectangle aDispRect( Application::GetScreenPosSizePixel( nDisplayScreen ) );
         long nScreenWidth = aDispRect.GetWidth() >= 800 ? aDispRect.GetWidth() : 800;
         if( nMaxWidth > nScreenWidth/2 )
             nMaxWidth = nScreenWidth/2;
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index f087921..d439943 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -1019,23 +1019,19 @@ sal_Bool SystemWindow::ImplIsInTaskPaneList( Window* pWin )
     return sal_False;
 }
 
-// -----------------------------------------------------------------------
-
 unsigned int SystemWindow::GetScreenNumber() const
 {
-    return mpWindowImpl->mpFrame->maGeometry.nScreenNumber;
+    return mpWindowImpl->mpFrame->maGeometry.nDisplayScreenNumber;
 }
 
-// -----------------------------------------------------------------------
-
-void SystemWindow::SetScreenNumber(unsigned int nScreen)
+void SystemWindow::SetScreenNumber(unsigned int nDisplayScreen)
 {
-    mpWindowImpl->mpFrame->SetScreenNumber( nScreen );
+    mpWindowImpl->mpFrame->SetScreenNumber( nDisplayScreen );
 }
 
 void SystemWindow::SetApplicationID(const rtl::OUString &rApplicationID)
 {
-    mpWindowImpl->mpFrame->SetApplicationID(rApplicationID);
+    mpWindowImpl->mpFrame->SetApplicationID( rApplicationID );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx
index 83ffa42..3077c34 100644
--- a/vcl/unx/generic/app/i18n_status.cxx
+++ b/vcl/unx/generic/app/i18n_status.cxx
@@ -212,7 +212,7 @@ Point XIMStatusWindow::updatePosition()
         XLIB_Window aChild;
         XTranslateCoordinates( (Display*)pParentEnvData->pDisplay,
                                (XLIB_Window)pParentEnvData->aShellWindow,
-                               GetGenericData()->GetSalDisplay()->GetRootWindow( GetGenericData()->GetSalDisplay()->GetDefaultScreenNumber() ),
+                               GetGenericData()->GetSalDisplay()->GetRootWindow( GetGenericData()->GetSalDisplay()->GetDefaultXScreen() ),
                                0, 0,
                                &x, &y,
                                &aChild );
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 3c53b7b..78853ac 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -481,6 +481,7 @@ sal_Bool SalDisplay::BestVisual( Display     *pDisplay,
 SalDisplay::SalDisplay( Display *display ) :
         mpInputMethod( NULL ),
         pDisp_( display ),
+        m_nXDefaultScreen( 0 ),
         m_pWMAdaptor( NULL ),
         m_bUseRandRWrapper( true ),
         m_nLastUserEventTime( CurrentTime )
@@ -494,7 +495,7 @@ SalDisplay::SalDisplay( Display *display ) :
     DBG_ASSERT( ! pData->GetDisplay(), "Second SalDisplay created !!!\n" );
     pData->SetDisplay( this );
 
-    m_nDefaultScreen = DefaultScreen( pDisp_ );
+    m_nXDefaultScreen = SalX11Screen( DefaultScreen( pDisp_ ) );
 }
 
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -637,61 +638,62 @@ void SalX11Display::PostUserEvent()
         pXLib_->PostUserEvent();
 }
 
-void SalDisplay::initScreen( int nScreen ) const
+SalDisplay::ScreenData *
+SalDisplay::initScreen( SalX11Screen nXScreen ) const
 {
-    if( nScreen < 0 || nScreen >= static_cast<int>(m_aScreens.size()) )
-        nScreen = m_nDefaultScreen;
-    ScreenData& rSD = const_cast<ScreenData&>(m_aScreens[nScreen]);
-    if( rSD.m_bInit )
-        return;
-    rSD.m_bInit = true;
+    if( nXScreen.getXScreen() >= static_cast<int>(m_aScreens.size()) )
+        nXScreen = m_nXDefaultScreen;
+    ScreenData* pSD = const_cast<ScreenData *>(&m_aScreens[nXScreen.getXScreen()]);
+    if( pSD->m_bInit )
+        return NULL;
+    pSD->m_bInit = true;
 
     XVisualInfo aVI;
     Colormap    aColMap;
 
-    if( SalDisplay::BestVisual( pDisp_, nScreen, aVI ) ) // DefaultVisual
-        aColMap = DefaultColormap( pDisp_, nScreen );
+    if( SalDisplay::BestVisual( pDisp_, nXScreen.getXScreen(), aVI ) ) // DefaultVisual
+        aColMap = DefaultColormap( pDisp_, nXScreen.getXScreen() );
     else
         aColMap = XCreateColormap( pDisp_,
-                                   RootWindow( pDisp_, nScreen ),
+                                   RootWindow( pDisp_, nXScreen.getXScreen() ),
                                    aVI.visual,
                                    AllocNone );
 
-    Screen* pScreen = ScreenOfDisplay( pDisp_, nScreen );
+    Screen* pScreen = ScreenOfDisplay( pDisp_, nXScreen.getXScreen() );
 
-    rSD.m_aSize = Size( WidthOfScreen( pScreen ), HeightOfScreen( pScreen ) );
-    rSD.m_aRoot = RootWindow( pDisp_, nScreen );
-    rSD.m_aVisual = SalVisual( &aVI );
-    rSD.m_aColormap = SalColormap( this, aColMap, nScreen );
+    pSD->m_aSize = Size( WidthOfScreen( pScreen ), HeightOfScreen( pScreen ) );
+    pSD->m_aRoot = RootWindow( pDisp_, nXScreen.getXScreen() );
+    pSD->m_aVisual = SalVisual( &aVI );
+    pSD->m_aColormap = SalColormap( this, aColMap, nXScreen );
 
     // we're interested in configure notification of root windows
-    InitRandR( rSD.m_aRoot );
+    InitRandR( pSD->m_aRoot );
 
     // - - - - - - - - - - Reference Window/Default Drawable - -
     XSetWindowAttributes aXWAttributes;
     aXWAttributes.border_pixel      = 0;
     aXWAttributes.background_pixel  = 0;
     aXWAttributes.colormap          = aColMap;
-    rSD.m_aRefWindow     = XCreateWindow( pDisp_,
-                                          rSD.m_aRoot,
+    pSD->m_aRefWindow     = XCreateWindow( pDisp_,
+                                          pSD->m_aRoot,
                                           0,0, 16,16, 0,
-                                          rSD.m_aVisual.GetDepth(),
+                                          pSD->m_aVisual.GetDepth(),
                                           InputOutput,
-                                          rSD.m_aVisual.GetVisual(),
+                                          pSD->m_aVisual.GetVisual(),
                                           CWBorderPixel|CWBackPixel|CWColormap,
                                           &aXWAttributes );
 
     // set client leader (session id gets set when session is started)
-    if( rSD.m_aRefWindow )
+    if( pSD->m_aRefWindow )
     {
         // client leader must have WM_CLIENT_LEADER pointing to itself
         XChangeProperty( pDisp_,
-                         rSD.m_aRefWindow,
+                         pSD->m_aRefWindow,
                          XInternAtom( pDisp_, "WM_CLIENT_LEADER", False ),
                          XA_WINDOW,
                          32,
                          PropModeReplace,
-                         (unsigned char*)&rSD.m_aRefWindow,
+                         (unsigned char*)&pSD->m_aRefWindow,
                          1
                          );
 
@@ -699,73 +701,74 @@ void SalDisplay::initScreen( int nScreen ) const
         const char* argv[2];
         argv[0] = "/bin/sh";
         argv[1] = aExec.getStr();
-        XSetCommand( pDisp_, rSD.m_aRefWindow, const_cast<char**>(argv), 2 );
-        XSelectInput( pDisp_, rSD.m_aRefWindow, PropertyChangeMask );
+        XSetCommand( pDisp_, pSD->m_aRefWindow, const_cast<char**>(argv), 2 );
+        XSelectInput( pDisp_, pSD->m_aRefWindow, PropertyChangeMask );
 
         // - - - - - - - - - - GCs - - - - - - - - - - - - - - - - -
         XGCValues values;
         values.graphics_exposures   = False;
         values.fill_style           = FillOpaqueStippled;
-        values.background           = (1<<rSD.m_aVisual.GetDepth())-1;
+        values.background           = (1<<pSD->m_aVisual.GetDepth())-1;
         values.foreground           = 0;
 
-        rSD.m_aCopyGC       = XCreateGC( pDisp_,
-                                         rSD.m_aRefWindow,
+        pSD->m_aCopyGC       = XCreateGC( pDisp_,
+                                         pSD->m_aRefWindow,
                                          GCGraphicsExposures
                                          | GCForeground
                                          | GCBackground,
                                          &values );
-        rSD.m_aAndInvertedGC= XCreateGC( pDisp_,
-                                         rSD.m_aRefWindow,
+        pSD->m_aAndInvertedGC= XCreateGC( pDisp_,
+                                         pSD->m_aRefWindow,
                                          GCGraphicsExposures
                                          | GCForeground
                                          | GCBackground,
                                          &values );
-        rSD.m_aAndGC        = XCreateGC( pDisp_,
-                                         rSD.m_aRefWindow,
+        pSD->m_aAndGC        = XCreateGC( pDisp_,
+                                         pSD->m_aRefWindow,
                                          GCGraphicsExposures
                                          | GCForeground
                                          | GCBackground,
                                          &values );
-        rSD.m_aOrGC         = XCreateGC( pDisp_,
-                                         rSD.m_aRefWindow,
+        pSD->m_aOrGC         = XCreateGC( pDisp_,
+                                         pSD->m_aRefWindow,
                                          GCGraphicsExposures
                                          | GCForeground
                                          | GCBackground,
                                          &values    );
-        rSD.m_aStippleGC    = XCreateGC( pDisp_,
-                                         rSD.m_aRefWindow,
+        pSD->m_aStippleGC    = XCreateGC( pDisp_,
+                                         pSD->m_aRefWindow,
                                          GCGraphicsExposures
                                          | GCFillStyle
                                          | GCForeground
                                          | GCBackground,
                                          &values );
 
-        XSetFunction( pDisp_, rSD.m_aAndInvertedGC,  GXandInverted );
-        XSetFunction( pDisp_, rSD.m_aAndGC,          GXand );
+        XSetFunction( pDisp_, pSD->m_aAndInvertedGC,  GXandInverted );
+        XSetFunction( pDisp_, pSD->m_aAndGC,          GXand );
         // PowerPC Solaris 2.5 (XSun 3500) Bug: GXor = GXnop
-        XSetFunction( pDisp_, rSD.m_aOrGC,           GXxor );
+        XSetFunction( pDisp_, pSD->m_aOrGC,           GXxor );
 
-        if( 1 == rSD.m_aVisual.GetDepth() )
+        if( 1 == pSD->m_aVisual.GetDepth() )
         {
-            XSetFunction( pDisp_, rSD.m_aCopyGC, GXcopyInverted );
-            rSD.m_aMonoGC = rSD.m_aCopyGC;
+            XSetFunction( pDisp_, pSD->m_aCopyGC, GXcopyInverted );
+            pSD->m_aMonoGC = pSD->m_aCopyGC;
         }
         else
         {
-            Pixmap hPixmap = XCreatePixmap( pDisp_, rSD.m_aRefWindow, 1, 1, 1 );
-            rSD.m_aMonoGC = XCreateGC( pDisp_,
+            Pixmap hPixmap = XCreatePixmap( pDisp_, pSD->m_aRefWindow, 1, 1, 1 );
+            pSD->m_aMonoGC = XCreateGC( pDisp_,
                                        hPixmap,
                                        GCGraphicsExposures,
                                        &values );
             XFreePixmap( pDisp_, hPixmap );
         }
-        rSD.m_hInvert50 = XCreateBitmapFromData( pDisp_,
-                                                 rSD.m_aRefWindow,
+        pSD->m_hInvert50 = XCreateBitmapFromData( pDisp_,
+                                                 pSD->m_aRefWindow,
                                                  reinterpret_cast<const char*>(invert50_bits),
                                                  invert50_width,
                                                  invert50_height );
     }
+    return pSD;
 }
 
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -801,8 +804,10 @@ void SalDisplay::Init()
     if( mbExactResolution == false )
     {
         aResolution_     =
-            Pair( DPI( WidthOfScreen( DefaultScreenOfDisplay( pDisp_ ) ), DisplayWidthMM ( pDisp_, m_nDefaultScreen ) ),
-                  DPI( HeightOfScreen( DefaultScreenOfDisplay( pDisp_ ) ), DisplayHeightMM( pDisp_, m_nDefaultScreen ) ) );
+            Pair( DPI( WidthOfScreen( DefaultScreenOfDisplay( pDisp_ ) ),
+                       DisplayWidthMM ( pDisp_, m_nXDefaultScreen.getXScreen() ) ),
+                  DPI( HeightOfScreen( DefaultScreenOfDisplay( pDisp_ ) ),
+                       DisplayHeightMM( pDisp_, m_nXDefaultScreen.getXScreen() ) ) );
     }
 
     nMaxRequestSize_    = XExtendedMaxRequestSize( pDisp_ ) * 4;
@@ -2013,7 +2018,7 @@ XLIB_Cursor SalDisplay::GetPointer( int ePointerStyle )
     if( None == aCur )
     {
         XColor      aBlack, aWhite, aDummy;
-        Colormap    hColormap = GetColormap(m_nDefaultScreen).GetXColormap();
+        Colormap    hColormap = GetColormap(m_nXDefaultScreen).GetXColormap();
 
         XAllocNamedColor( pDisp_, hColormap, "black", &aBlack, &aDummy );
         XAllocNamedColor( pDisp_, hColormap, "white", &aWhite, &aDummy );
@@ -2389,7 +2394,8 @@ void SalDisplay::PrintInfo() const
         fprintf( stderr, "\tProtocol          \t%d.%d\n",
                  ProtocolVersion(pDisp_), ProtocolRevision(pDisp_) );
         fprintf( stderr, "\tScreen (count,def)\t%d (%d,%d)\n",
-                 m_nDefaultScreen, ScreenCount(pDisp_), DefaultScreen(pDisp_) );
+                 m_nXDefaultScreen.getXScreen(),
+                 ScreenCount(pDisp_), DefaultScreen(pDisp_) );
         fprintf( stderr, "\tshift ctrl alt    \t%s (0x%X) %s (0x%X) %s (0x%X)\n",
                  KeyStr( nShiftKeySym_ ), sal::static_int_cast< unsigned int >(nShiftKeySym_),
                  KeyStr( nCtrlKeySym_ ),  sal::static_int_cast< unsigned int >(nCtrlKeySym_),
@@ -2406,17 +2412,21 @@ void SalDisplay::PrintInfo() const
     fprintf( stderr, "Screen\n" );
     fprintf( stderr, "\tResolution/Size   \t%ld*%ld %ld*%ld %.1lf\"\n",
              aResolution_.A(), aResolution_.B(),
-             m_aScreens[m_nDefaultScreen].m_aSize.Width(), m_aScreens[m_nDefaultScreen].m_aSize.Height(),
-             Hypothenuse( DisplayWidthMM ( pDisp_, m_nDefaultScreen ),
-                          DisplayHeightMM( pDisp_, m_nDefaultScreen ) ) / 25.4 );
+             m_aScreens[m_nXDefaultScreen.getXScreen()].m_aSize.Width(),
+             m_aScreens[m_nXDefaultScreen.getXScreen()].m_aSize.Height(),
+             Hypothenuse( DisplayWidthMM ( pDisp_, m_nXDefaultScreen.getXScreen() ),
+                          DisplayHeightMM( pDisp_, m_nXDefaultScreen.getXScreen() ) ) / 25.4 );
     fprintf( stderr, "\tBlack&White       \t%lu %lu\n",
-             GetColormap(m_nDefaultScreen).GetBlackPixel(), GetColormap(m_nDefaultScreen).GetWhitePixel() );
+             GetColormap(m_nXDefaultScreen).GetBlackPixel(),
+             GetColormap(m_nXDefaultScreen).GetWhitePixel() );
     fprintf( stderr, "\tRGB               \t0x%lx 0x%lx 0x%lx\n",
-             GetVisual(m_nDefaultScreen).red_mask, GetVisual(m_nDefaultScreen).green_mask, GetVisual(m_nDefaultScreen).blue_mask );
+             GetVisual(m_nXDefaultScreen).red_mask,
+             GetVisual(m_nXDefaultScreen).green_mask,
+             GetVisual(m_nXDefaultScreen).blue_mask );
     fprintf( stderr, "\tVisual            \t%d-bit %s ID=0x%x\n",
-             GetVisual(m_nDefaultScreen).GetDepth(),
-             VisualClassName[ GetVisual(m_nDefaultScreen).GetClass() ],
-             sal::static_int_cast< unsigned int >(GetVisual(m_nDefaultScreen).GetVisualId()) );
+             GetVisual(m_nXDefaultScreen).GetDepth(),
+             VisualClassName[ GetVisual(m_nXDefaultScreen).GetClass() ],
+             sal::static_int_cast< unsigned int >(GetVisual(m_nXDefaultScreen).GetVisualId()) );
 }
 
 void SalDisplay::addXineramaScreenUnique( int i, long i_nX, long i_nY, long i_nWidth, long i_nHeight )
@@ -2513,7 +2523,7 @@ extern "C"
     {
         SalDisplay* pSalDisplay = reinterpret_cast<SalDisplay*>(i_pArg);
         if( i_pEvent->type == PropertyNotify &&
-            i_pEvent->xproperty.window == pSalDisplay->GetDrawable( pSalDisplay->GetDefaultScreenNumber() ) &&
+            i_pEvent->xproperty.window == pSalDisplay->GetDrawable( pSalDisplay->GetDefaultXScreen() ) &&
             i_pEvent->xproperty.atom == pSalDisplay->getWMAdaptor()->getAtom( WMAdaptor::SAL_GETTIMEEVENT )
             )
         return True;
@@ -2530,7 +2540,7 @@ XLIB_Time SalDisplay::GetLastUserEventTime( bool i_bAlwaysReget ) const
         unsigned char c = 0;
         XEvent aEvent;
         Atom nAtom = getWMAdaptor()->getAtom( WMAdaptor::SAL_GETTIMEEVENT );
-        XChangeProperty( GetDisplay(), GetDrawable( GetDefaultScreenNumber() ),
+        XChangeProperty( GetDisplay(), GetDrawable( GetDefaultXScreen() ),
                          nAtom, nAtom, 8, PropModeReplace, &c, 1 );
         XFlush( GetDisplay() );
 
@@ -2713,12 +2723,13 @@ Pixel SalVisual::GetTCPixel( SalColor nSalColor ) const
 
 // -=-= SalColormap -=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-SalColormap::SalColormap( const SalDisplay *pDisplay, Colormap hColormap, int nScreen )
+SalColormap::SalColormap( const SalDisplay *pDisplay, Colormap hColormap,
+                          SalX11Screen nXScreen )
     : m_pDisplay( pDisplay ),
       m_hColormap( hColormap ),
-      m_nScreen( nScreen )
+      m_nXScreen( nXScreen )
 {
-    m_aVisual = m_pDisplay->GetVisual( m_nScreen );
+    m_aVisual = m_pDisplay->GetVisual( m_nXScreen );
 
     XColor aColor;
 
@@ -2808,10 +2819,8 @@ SalColormap::SalColormap()
       m_nWhitePixel( 1 ),
       m_nBlackPixel( 0 ),
       m_nUsed( 2 ),
-      m_nScreen( 0 )
+      m_nXScreen( m_pDisplay != NULL ? m_pDisplay->GetDefaultXScreen() : SalX11Screen( 0 ) )
 {
-    if( m_pDisplay )
-        m_nScreen = m_pDisplay->GetDefaultScreenNumber();
     m_aPalette = std::vector<SalColor>(m_nUsed);
 
     m_aPalette[m_nBlackPixel] = SALCOLOR_BLACK;
@@ -2825,9 +2834,9 @@ SalColormap::SalColormap( sal_uInt16 nDepth )
       m_nWhitePixel( (1 << nDepth) - 1 ),
       m_nBlackPixel( 0x00000000 ),
       m_nUsed( 1 << nDepth ),
-      m_nScreen( GetGenericData()->GetSalDisplay()->GetDefaultScreenNumber() )
+      m_nXScreen( GetGenericData()->GetSalDisplay()->GetDefaultXScreen() )
 {
-    const SalVisual *pVisual  = &m_pDisplay->GetVisual( m_nScreen );
+    const SalVisual *pVisual = &m_pDisplay->GetVisual( m_nXScreen );
 
     if( pVisual->GetClass() == TrueColor && pVisual->GetDepth() == nDepth )
         m_aVisual = *pVisual;
@@ -2836,7 +2845,7 @@ SalColormap::SalColormap( sal_uInt16 nDepth )
         XVisualInfo aVI;
 
         if( !XMatchVisualInfo( m_pDisplay->GetDisplay(),
-                               m_pDisplay->GetDefaultScreenNumber(),
+                               m_pDisplay->GetDefaultXScreen().getXScreen(),
                                nDepth,
                                TrueColor,
                                &aVI ) )
diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx
index d4f9763..68f1dfe 100644
--- a/vcl/unx/generic/app/sm.cxx
+++ b/vcl/unx/generic/app/sm.cxx
@@ -486,10 +486,10 @@ void SessionManagerClient::open()
         ICEConnectionObserver::unlock();
 
         SalDisplay* pDisp = GetGenericData()->GetSalDisplay();
-        if( pDisp->GetDrawable(pDisp->GetDefaultScreenNumber()) && !m_aClientID.isEmpty() )
+        if( pDisp->GetDrawable(pDisp->GetDefaultXScreen()) && !m_aClientID.isEmpty() )
         {
             XChangeProperty( pDisp->GetDisplay(),
-                             pDisp->GetDrawable( pDisp->GetDefaultScreenNumber() ),
+                             pDisp->GetDrawable( pDisp->GetDefaultXScreen() ),
                              XInternAtom( pDisp->GetDisplay(), "SM_CLIENT_ID", False ),
                              XA_STRING,
                              8,
diff --git a/vcl/unx/generic/app/soicon.cxx b/vcl/unx/generic/app/soicon.cxx
index b2db0a5..79d9e60 100644
--- a/vcl/unx/generic/app/soicon.cxx
+++ b/vcl/unx/generic/app/soicon.cxx
@@ -43,8 +43,9 @@
 #include <impbmp.hxx>
 
 
-sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen,sal_uInt16 nIcon, sal_uInt16 iconSize,
-                          Pixmap& icon_pixmap, Pixmap& icon_mask)
+sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, SalX11Screen nXScreen,
+                              sal_uInt16 nIcon, sal_uInt16 iconSize,
+                              Pixmap& icon_pixmap, Pixmap& icon_mask)
 {
     if( ! ImplGetResMgr() )
         return sal_False;
@@ -74,23 +75,26 @@ sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen,sal_uInt16 nIcon
         (aIcon.ImplGetBitmapImpBitmap()->ImplGetSalBitmap());
 
     icon_pixmap = XCreatePixmap( pDisplay->GetDisplay(),
-                                 pDisplay->GetRootWindow( nScreen ),
+                                 pDisplay->GetRootWindow( nXScreen ),
                                  iconSize, iconSize,
-                                 DefaultDepth( pDisplay->GetDisplay(), nScreen )
+                                 DefaultDepth( pDisplay->GetDisplay(),
+                                               nXScreen.getXScreen() )
                                  );
 
     pBitmap->ImplDraw( icon_pixmap,
-                       nScreen,
-                       DefaultDepth( pDisplay->GetDisplay(), nScreen ),
+                       nXScreen,
+                       DefaultDepth( pDisplay->GetDisplay(),
+                                     nXScreen.getXScreen() ),
                        aRect,
-                       DefaultGC(pDisplay->GetDisplay(), nScreen ) );
+                       DefaultGC( pDisplay->GetDisplay(),
+                                  nXScreen.getXScreen() ) );
 
     icon_mask = None;
 
     if( TRANSPARENT_BITMAP == aIcon.GetTransparentType() )
     {
         icon_mask = XCreatePixmap( pDisplay->GetDisplay(),
-                                   pDisplay->GetRootWindow( pDisplay->GetDefaultScreenNumber() ),
+                                   pDisplay->GetRootWindow( pDisplay->GetDefaultXScreen() ),
                                    iconSize, iconSize, 1);
 
         XGCValues aValues;
@@ -106,7 +110,7 @@ sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen,sal_uInt16 nIcon
         X11SalBitmap *pMask = static_cast < X11SalBitmap * >
             (aMask.ImplGetImpBitmap()->ImplGetSalBitmap());
 
-        pMask->ImplDraw(icon_mask, nScreen, 1, aRect, aMonoGC);
+        pMask->ImplDraw(icon_mask, nXScreen, 1, aRect, aMonoGC);
         XFreeGC( pDisplay->GetDisplay(), aMonoGC );
     }
 
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index b812e21..3d5d60a 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -255,7 +255,7 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) :
     // default desktops
     m_nDesktops = 1;
     m_aWMWorkAreas = ::std::vector< Rectangle >
-        ( 1, Rectangle( Point(), m_pSalDisplay->GetScreenSize( m_pSalDisplay->GetDefaultScreenNumber() ) ) );
+        ( 1, Rectangle( Point(), m_pSalDisplay->GetScreenSize( m_pSalDisplay->GetDefaultXScreen() ) ) );
     m_bEqualWorkAreas = true;
 
     memset( m_aWMAtoms, 0, sizeof( m_aWMAtoms ) );
@@ -270,7 +270,7 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) :
         Atom aRwmRunning = XInternAtom( m_pDisplay, "RWM_RUNNING", True );
         if( aRwmRunning != None &&
             XGetWindowProperty( m_pDisplay,
-                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                 aRwmRunning,
                                 0, 32,
                                 False,
@@ -287,7 +287,7 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) :
         }
         else if( (aRwmRunning = XInternAtom( m_pDisplay, "_WRQ_WM_RUNNING", True )) != None &&
             XGetWindowProperty( m_pDisplay,
-                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                 aRwmRunning,
                                 0, 32,
                                 False,
@@ -308,7 +308,7 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) :
         Atom aTTAPlatform = XInternAtom( m_pDisplay, "TTA_CLIENT_PLATFORM", True );
         if( aTTAPlatform != None &&
             XGetWindowProperty( m_pDisplay,
-                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                 aTTAPlatform,
                                 0, 32,
                                 False,
@@ -367,7 +367,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
     bNetWM = getNetWmName();
     if( bNetWM
         && XGetWindowProperty( m_pDisplay,
-                               m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                               m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                m_aWMAtoms[ NET_SUPPORTED ],
                                0, 0,
                                False,
@@ -388,7 +388,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
         }
         // collect supported protocols
         if( XGetWindowProperty( m_pDisplay,
-                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                 m_aWMAtoms[ NET_SUPPORTED ],
                                 0, nBytesLeft/4,
                                 False,
@@ -446,7 +446,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
         // get number of desktops
         if( m_aWMAtoms[ NET_NUMBER_OF_DESKTOPS ]
             && XGetWindowProperty( m_pDisplay,
-                                   m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                                   m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                    m_aWMAtoms[ NET_NUMBER_OF_DESKTOPS ],
                                    0, 1,
                                    False,
@@ -465,7 +465,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
             // get work areas
             if( m_aWMAtoms[ NET_WORKAREA ]
                 && XGetWindowProperty( m_pDisplay,
-                                       m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                                       m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                        m_aWMAtoms[ NET_WORKAREA ],
                                        0, 4*m_nDesktops,
                                        False,
@@ -558,7 +558,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
     {
         XLIB_Window         aWMChild    = None;
         if( XGetWindowProperty( m_pDisplay,
-                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                 m_aWMAtoms[ WIN_SUPPORTING_WM_CHECK ],
                                 0, 1,
                                 False,
@@ -625,7 +625,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
     }
     if( m_bValid
         && XGetWindowProperty( m_pDisplay,
-                               m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                               m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                m_aWMAtoms[ WIN_PROTOCOLS ],
                                0, 0,
                                False,
@@ -646,7 +646,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
         }
         // collect supported protocols
         if( XGetWindowProperty( m_pDisplay,
-                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                 m_aWMAtoms[ WIN_PROTOCOLS ],
                                 0, nBytesLeft/4,
                                 False,
@@ -710,7 +710,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
         // get number of desktops
         if( m_aWMAtoms[ WIN_WORKSPACE_COUNT ]
             && XGetWindowProperty( m_pDisplay,
-                                   m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                                   m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                    m_aWMAtoms[ WIN_WORKSPACE_COUNT ],
                                    0, 1,
                                    False,
@@ -763,7 +763,7 @@ bool WMAdaptor::getNetWmName()
     {
         XLIB_Window         aWMChild = None;
         if( XGetWindowProperty( m_pDisplay,
-                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                 m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ],
                                 0, 1,
                                 False,
@@ -2182,7 +2182,7 @@ int WMAdaptor::getCurrentWorkArea() const
         unsigned long       nBytesLeft  = 0;
         unsigned char*  pProperty   = NULL;
         if( XGetWindowProperty( m_pDisplay,
-                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                                 m_aWMAtoms[ NET_CURRENT_DESKTOP ],
                                 0, 1,
                                 False,
@@ -2260,7 +2260,7 @@ void WMAdaptor::switchToWorkArea( int nWorkArea, bool bConsiderWM ) const
         XEvent aEvent;
         aEvent.type                 = ClientMessage;
         aEvent.xclient.display      = m_pDisplay;
-        aEvent.xclient.window       = m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() );
+        aEvent.xclient.window       = m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() );
         aEvent.xclient.message_type = m_aWMAtoms[ NET_CURRENT_DESKTOP ];
         aEvent.xclient.format       = 32;
         aEvent.xclient.data.l[0]    = nWorkArea;
@@ -2269,7 +2269,7 @@ void WMAdaptor::switchToWorkArea( int nWorkArea, bool bConsiderWM ) const
         aEvent.xclient.data.l[3]    = 0;
         aEvent.xclient.data.l[4]    = 0;
         XSendEvent( m_pDisplay,
-                    m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultScreenNumber() ),
+                    m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
                     False,
                     SubstructureNotifyMask | SubstructureRedirectMask,
                     &aEvent
diff --git a/vcl/unx/generic/gdi/gcach_xpeer.cxx b/vcl/unx/generic/gdi/gcach_xpeer.cxx
index ac37934..c6a23f3 100644
--- a/vcl/unx/generic/gdi/gcach_xpeer.cxx
+++ b/vcl/unx/generic/gdi/gcach_xpeer.cxx
@@ -54,12 +54,12 @@ X11GlyphPeer::~X11GlyphPeer()
     //Why do this here, move into dtor/shutdown of display?
     SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
     Display* const pX11Disp = pSalDisp->GetDisplay();
-    int nMaxScreens = pSalDisp->GetScreenCount();
+    int nMaxScreens = pSalDisp->GetXScreenCount();
     XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
 
     for( int i = 0; i < nMaxScreens; i++ )
     {
-        SalDisplay::RenderEntryMap& rMap = pSalDisp->GetRenderEntries( i );
+        SalDisplay::RenderEntryMap& rMap = pSalDisp->GetRenderEntries( SalX11Screen (i) );
         for( SalDisplay::RenderEntryMap::iterator it = rMap.begin(); it != rMap.end(); ++it )
         {
             if( it->second.m_aPixmap )
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 51d0f19..0eccf20 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -203,7 +203,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
 
 BitmapBuffer* X11SalBitmap::ImplCreateDIB(
     Drawable aDrawable,
-    int nScreen,
+    SalX11Screen nScreen,
     long nDrawableDepth,
     long nX,
     long nY,
@@ -378,7 +378,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
 
 XImage* X11SalBitmap::ImplCreateXImage(
     SalDisplay *pSalDisp,
-    int nScreen,
+    SalX11Screen nScreen,
     long nDepth,
     const SalTwoRect& rTwoRect
 ) const
@@ -549,7 +549,7 @@ XImage* X11SalBitmap::ImplCreateXImage(
 // -----------------------------------------------------------------------------
 bool X11SalBitmap::ImplCreateFromDrawable(
     Drawable aDrawable,
-    int nScreen,
+    SalX11Screen nScreen,
     long nDrawableDepth,
     long nX,
     long nY,
@@ -628,10 +628,10 @@ bool X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow)
                 {
                     XImage* pImage = XGetImage( pDisplay, aAttribute.root,
                                                 x, y, width, height, AllPlanes, ZPixmap );
-                    bool bSnapShot = ImplCreateFromXImage( pDisplay,
-                                                           aAttribute.root,
-                                                           XScreenNumberOfScreen( aAttribute.screen ),
-                                                           pImage );
+                    bool bSnapShot = ImplCreateFromXImage(
+                                        pDisplay, aAttribute.root,
+                                        SalX11Screen (XScreenNumberOfScreen( aAttribute.screen ) ),
+                                        pImage );
                     XDestroyImage (pImage);
 
                     return bSnapShot;
@@ -646,7 +646,7 @@ bool X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow)
 bool X11SalBitmap::ImplCreateFromXImage (
     Display* pDisplay,
     XLIB_Window hWindow,
-    int nScreen,
+    SalX11Screen nScreen,
     XImage* pImage
 ) {
     Destroy();
@@ -661,12 +661,12 @@ bool X11SalBitmap::ImplCreateFromXImage (
 
 ImplSalDDB* X11SalBitmap::ImplGetDDB(
     Drawable          aDrawable,
-    int               nScreen,
+    SalX11Screen      nXScreen,
     long              nDrawableDepth,
     const SalTwoRect& rTwoRect
 ) const
 {
-    if( !mpDDB || !mpDDB->ImplMatches( nScreen, nDrawableDepth, rTwoRect ) )
+    if( !mpDDB || !mpDDB->ImplMatches( nXScreen, nDrawableDepth, rTwoRect ) )
     {
         if( mpDDB )
         {
@@ -739,12 +739,12 @@ ImplSalDDB* X11SalBitmap::ImplGetDDB(
             }
         }
 
-        XImage* pImage = ImplCreateXImage( GetGenericData()->GetSalDisplay(), nScreen,
+        XImage* pImage = ImplCreateXImage( GetGenericData()->GetSalDisplay(), nXScreen,
                                            nDrawableDepth, aTwoRect );
 
         if( pImage )
         {
-            const_cast<X11SalBitmap*>(this)->mpDDB = new ImplSalDDB( pImage, aDrawable, nScreen, aTwoRect );
+            const_cast<X11SalBitmap*>(this)->mpDDB = new ImplSalDDB( pImage, aDrawable, nXScreen, aTwoRect );
             delete[] pImage->data, pImage->data = NULL;
             XDestroyImage( pImage );
 
@@ -760,13 +760,13 @@ ImplSalDDB* X11SalBitmap::ImplGetDDB(
 
 void X11SalBitmap::ImplDraw(
     Drawable           aDrawable,
-    int                nScreen,
+    SalX11Screen       nXScreen,
     long               nDrawableDepth,
     const SalTwoRect&  rTwoRect,
     const GC&          rGC
 ) const
 {
-    ImplGetDDB( aDrawable, nScreen, nDrawableDepth, rTwoRect );
+    ImplGetDDB( aDrawable, nXScreen, nDrawableDepth, rTwoRect );
     if( mpDDB )
         mpDDB->ImplDraw( aDrawable, nDrawableDepth, rTwoRect, rGC );
 }
@@ -853,7 +853,8 @@ bool X11SalBitmap::Create(
                 mbGrey = bMask;
                 bool bSuccess = ImplCreateFromDrawable(
                                     pixmapHandle,
-                                    0,
+                                    // FIXME: this seems multi-screen broken to me
+                                    SalX11Screen( 0 ),
                                     depth,
                                     0,
                                     0,
@@ -975,11 +976,12 @@ bool X11SalBitmap::GetSystemData( BitmapSystemData& rData )
 // - ImplSalDDB -
 // --------------
 
-ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const SalTwoRect& rTwoRect )
+ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable,
+                        SalX11Screen nXScreen, const SalTwoRect& rTwoRect )
     : maPixmap    ( 0 )
     , maTwoRect   ( rTwoRect )
     , mnDepth     ( pImage->depth )
-    , mnScreen    ( nScreen )
+    , mnXScreen   ( nXScreen )
 {
     SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
     Display*    pXDisp = pSalDisp->GetDisplay();
@@ -1007,8 +1009,8 @@ ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const S
 // -----------------------------------------------------------------------------------------
 // create from XImage
 
-ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage)
-    : mnScreen( nScreen )
+ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, SalX11Screen nXScreen, XImage* pImage)
+    : mnXScreen( nXScreen )
 {
     maPixmap = XCreatePixmap (pDisplay, hWindow, pImage->width, pImage->height, pImage->depth);
     if (maPixmap != 0)
@@ -1047,14 +1049,14 @@ ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XIm
 
 ImplSalDDB::ImplSalDDB(
     Drawable aDrawable,
-    int nScreen,
+    SalX11Screen nXScreen,
     long nDrawableDepth,
     long nX,
     long nY,
     long nWidth,
     long nHeight
 )   : mnDepth( nDrawableDepth )
-    , mnScreen( nScreen )
+    , mnXScreen( nXScreen )
 {
     SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
     Display*    pXDisp = pSalDisp->GetDisplay();
@@ -1094,11 +1096,11 @@ ImplSalDDB::~ImplSalDDB()
 
 // -----------------------------------------------------------------------------
 
-bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const
+bool ImplSalDDB::ImplMatches( SalX11Screen nXScreen, long nDepth, const SalTwoRect& rTwoRect ) const
 {
     bool bRet = false;
 
-    if( ( maPixmap != 0 ) && ( ( mnDepth == nDepth ) || ( 1 == mnDepth ) ) && nScreen == mnScreen)
+    if( ( maPixmap != 0 ) && ( ( mnDepth == nDepth ) || ( 1 == mnDepth ) ) && nXScreen == mnXScreen)
     {
         if (  rTwoRect.mnSrcX       == maTwoRect.mnSrcX
            && rTwoRect.mnSrcY       == maTwoRect.mnSrcY
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index e3e1090..7ad13a0 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -96,6 +96,7 @@ inline SalPolyLine::~SalPolyLine()
 // -=-= X11SalGraphics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 X11SalGraphics::X11SalGraphics()
+    : m_nXScreen( 0 )
 {
     m_pFrame            = NULL;
     m_pVDev             = NULL;
@@ -189,18 +190,18 @@ void X11SalGraphics::freeResources()
     bPenGC_ = bFontGC_ = bBrushGC_ = bMonoGC_ = bCopyGC_ = bInvertGC_ = bInvert50GC_ = bStippleGC_ = bTrackingGC_ = false;
 }
 
-void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen )
+void X11SalGraphics::SetDrawable( Drawable aDrawable, SalX11Screen nXScreen )
 {
     // shortcut if nothing changed
     if( hDrawable_ == aDrawable )
         return;
 
     // free screen specific resources if needed
-    if( nScreen != m_nScreen )
+    if( nXScreen != m_nXScreen )
     {
         freeResources();
-        m_pColormap = &GetGenericData()->GetSalDisplay()->GetColormap( nScreen );
-        m_nScreen = nScreen;
+        m_pColormap = &GetGenericData()->GetSalDisplay()->GetColormap( nXScreen );
+        m_nXScreen = nXScreen;
     }
 
     hDrawable_ = aDrawable;
@@ -219,22 +220,22 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen )
     }
 }
 
-void X11SalGraphics::Init( SalFrame *pFrame, Drawable aTarget, int nScreen )
+void X11SalGraphics::Init( SalFrame *pFrame, Drawable aTarget,
+                           SalX11Screen nXScreen )
 {
+    m_pColormap = &GetGenericData()->GetSalDisplay()->GetColormap(nXScreen);
+    m_nXScreen  = nXScreen;
+    SetDrawable( aTarget, nXScreen );
 
-    m_pColormap     = &GetGenericData()->GetSalDisplay()->GetColormap(nScreen);
-    m_nScreen = nScreen;
-    SetDrawable( aTarget, nScreen );
-
-    bWindow_        = sal_True;
-    m_pFrame        = pFrame;
-    m_pVDev         = NULL;
+    bWindow_    = sal_True;
+    m_pFrame    = pFrame;
+    m_pVDev     = NULL;
 }
 
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 void X11SalGraphics::DeInit()
 {
-    SetDrawable( None, m_nScreen );
+    SetDrawable( None, m_nXScreen );
 }
 
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -477,7 +478,7 @@ BOOL X11SalGraphics::GetDitherPixmap( SalColor nSalColor )
     // put the ximage to the pixmap
     XPutImage( GetXDisplay(),
                hBrush_,
-               GetDisplay()->GetCopyGC( m_nScreen ),
+               GetDisplay()->GetCopyGC( m_nXScreen ),
                pImage,
                0, 0,                        // Source
                0, 0,                        // Destination
@@ -1035,7 +1036,7 @@ SystemGraphicsData X11SalGraphics::GetGraphicsData() const
     aRes.pDisplay  = GetXDisplay();
     aRes.hDrawable = hDrawable_;
     aRes.pVisual   = GetVisual().visual;
-    aRes.nScreen   = m_nScreen;
+    aRes.nScreen   = m_nXScreen.getXScreen();
     aRes.nDepth    = GetBitCount();
     aRes.aColormap = GetColormap().GetXColormap();
     aRes.pXRenderFormat = m_pXRenderFormat;
@@ -1129,7 +1130,7 @@ bool X11SalGraphics::drawFilledTrapezoids( const ::basegfx::B2DTrapezoid* pB2DTr
     // get xrender Picture for polygon foreground
     // TODO: cache it like the target picture which uses GetXRenderPicture()
     XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
-    SalDisplay::RenderEntry& rEntry = GetDisplay()->GetRenderEntries( m_nScreen )[ 32 ];
+    SalDisplay::RenderEntry& rEntry = GetDisplay()->GetRenderEntries( m_nXScreen )[ 32 ];
     if( !rEntry.m_aPicture )
     {
         Display* pXDisplay = GetXDisplay();
diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx
index 900bd90..e61576e 100644
--- a/vcl/unx/generic/gdi/salgdi2.cxx
+++ b/vcl/unx/generic/gdi/salgdi2.cxx
@@ -68,16 +68,16 @@
 // -=-= X11SalGraphics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 void X11SalGraphics::CopyScreenArea( Display* pDisplay,
-                               Drawable aSrc, int nScreenSrc, int nSrcDepth,
-                               Drawable aDest, int nScreenDest, int nDestDepth,
-                               GC aDestGC,
-                               int src_x, int src_y,
-                               unsigned int w, unsigned int h,
-                               int dest_x, int dest_y )
+                                     Drawable aSrc, SalX11Screen nXScreenSrc, int nSrcDepth,
+                                     Drawable aDest, SalX11Screen nXScreenDest, int nDestDepth,
+                                     GC aDestGC,
+                                     int src_x, int src_y,
+                                     unsigned int w, unsigned int h,
+                                     int dest_x, int dest_y )
 {
     if( nSrcDepth == nDestDepth )
     {
-        if( nScreenSrc == nScreenDest )
+        if( nXScreenSrc == nXScreenDest )
             XCopyArea( pDisplay, aSrc, aDest, aDestGC,
                        src_x, src_y, w, h, dest_x, dest_y );
         else
@@ -98,14 +98,14 @@ void X11SalGraphics::CopyScreenArea( Display* pDisplay,
     else
     {
         X11SalBitmap aBM;
-        aBM.ImplCreateFromDrawable( aSrc, nScreenSrc, nSrcDepth, src_x, src_y, w, h );
+        aBM.ImplCreateFromDrawable( aSrc, nXScreenSrc, nSrcDepth, src_x, src_y, w, h );
         SalTwoRect aTwoRect;
         aTwoRect.mnSrcX = aTwoRect.mnSrcY = 0;
         aTwoRect.mnSrcWidth = aTwoRect.mnDestWidth = w;
         aTwoRect.mnSrcHeight = aTwoRect.mnDestHeight = h;
         aTwoRect.mnDestX = dest_x;
         aTwoRect.mnDestY = dest_y;
-        aBM.ImplDraw( aDest, nScreenDest, nDestDepth, aTwoRect,aDestGC );
+        aBM.ImplDraw( aDest, nXScreenDest, nDestDepth, aTwoRect,aDestGC );
     }
 }
 
@@ -119,7 +119,7 @@ GC X11SalGraphics::CreateGC( Drawable hDrawable, unsigned long nMask )
     values.function             = GXxor;
     values.line_width           = 1;
     values.fill_style           = FillStippled;
-    values.stipple              = GetDisplay()->GetInvert50( m_nScreen );
+    values.stipple              = GetDisplay()->GetInvert50( m_nXScreen );
     values.subwindow_mode       = ClipByChildren;
 
     return XCreateGC( GetXDisplay(), hDrawable, nMask | GCSubwindowMode, &values );
@@ -206,7 +206,7 @@ GC X11SalGraphics::GetInvert50GC()
         else
         {
             values.fill_style           = FillStippled;
-            values.stipple              = GetDisplay()->GetInvert50( m_nScreen );
+            values.stipple              = GetDisplay()->GetInvert50( m_nXScreen );
         }
 
         pInvert50GC_ = XCreateGC( GetXDisplay(), GetDrawable(),
@@ -360,7 +360,7 @@ GC X11SalGraphics::SetMask( int           &nX,
     // - - - - reset pixmap; all 0 - - - - - - - - - - - - - - - - - - -
     XFillRectangle( pDisplay,
                     hPixmap,
-                    GetDisplay()->GetMonoGC( m_nScreen ),
+                    GetDisplay()->GetMonoGC( m_nXScreen ),
                     0,   0,
                     nDX, nDY );
 
@@ -467,7 +467,7 @@ void X11SalGraphics::copyBits( const SalTwoRect *pPosAry,
     {
         // window or compatible virtual device
         if( pSrcGraphics->GetDisplay() == GetDisplay() &&
-            pSrcGraphics->m_nScreen == m_nScreen &&
+            pSrcGraphics->m_nXScreen == m_nXScreen &&
             pSrcGraphics->GetVisual().GetDepth() == GetVisual().GetDepth()
             )
             n = 2; // same Display
@@ -508,7 +508,7 @@ void X11SalGraphics::copyBits( const SalTwoRect *pPosAry,
                                             pPosAry->mnSrcWidth, pPosAry->mnSrcHeight,
                                             pSrcGraphics->GetBitCount() );
 
-            pCopyGC = GetDisplay()->GetCopyGC( m_nScreen );
+            pCopyGC = GetDisplay()->GetCopyGC( m_nXScreen );
 
             if( bNeedGraphicsExposures )
                 XSetGraphicsExposures( GetXDisplay(),
@@ -615,8 +615,8 @@ void X11SalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSa
     const SalDisplay*   pSalDisp = GetDisplay();
     Display*            pXDisp = pSalDisp->GetDisplay();
     const Drawable      aDrawable( GetDrawable() );
-    const SalColormap&  rColMap = pSalDisp->GetColormap( m_nScreen );
-    const long          nDepth = GetDisplay()->GetVisual( m_nScreen ).GetDepth();
+    const SalColormap&  rColMap = pSalDisp->GetColormap( m_nXScreen );
+    const long          nDepth = GetDisplay()->GetVisual( m_nXScreen ).GetDepth();
     GC                  aGC( GetCopyGC() );
     XGCValues           aOldVal, aNewVal;
     int                 nValues = GCForeground | GCBackground;
@@ -644,7 +644,7 @@ void X11SalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSa
         XChangeGC( pXDisp, aGC, nValues, &aNewVal );
     }
 
-    static_cast<const X11SalBitmap&>(rSalBitmap).ImplDraw( aDrawable, m_nScreen, nDepth, *pPosAry, aGC );
+    static_cast<const X11SalBitmap&>(rSalBitmap).ImplDraw( aDrawable, m_nXScreen, nDepth, *pPosAry, aGC );
 
     if( rSalBitmap.GetBitCount() == 1 )
         XChangeGC( pXDisp, aGC, nValues, &aOldVal );
@@ -687,7 +687,7 @@ void X11SalGraphics::drawMaskedBitmap( const SalTwoRect* pPosAry,
     // refuse to work.
     const sal_uInt16    nDepth( m_pVDev ?
                             m_pVDev->GetDepth() :
-                            pSalDisp->GetVisual( m_nScreen ).GetDepth() );
+                            pSalDisp->GetVisual( m_nXScreen ).GetDepth() );
     Pixmap          aFG( XCreatePixmap( pXDisp, aDrawable, pPosAry->mnDestWidth,
                                         pPosAry->mnDestHeight, nDepth ) );
     Pixmap          aBG( XCreatePixmap( pXDisp, aDrawable, pPosAry->mnDestWidth,
@@ -697,7 +697,7 @@ void X11SalGraphics::drawMaskedBitmap( const SalTwoRect* pPosAry,
     {
         GC                  aTmpGC;
         XGCValues           aValues;
-        const SalColormap&  rColMap = pSalDisp->GetColormap( m_nScreen );
+        const SalColormap&  rColMap = pSalDisp->GetColormap( m_nXScreen );
         const int           nBlack = rColMap.GetBlackPixel(), nWhite = rColMap.GetWhitePixel();
         const int           nValues = GCFunction | GCForeground | GCBackground;
         SalTwoRect          aTmpRect( *pPosAry ); aTmpRect.mnDestX = aTmpRect.mnDestY = 0;
@@ -705,7 +705,7 @@ void X11SalGraphics::drawMaskedBitmap( const SalTwoRect* pPosAry,
         // draw paint bitmap in pixmap #1
         aValues.function = GXcopy, aValues.foreground = nWhite, aValues.background = nBlack;
         aTmpGC = XCreateGC( pXDisp, aFG, nValues, &aValues );
-        static_cast<const X11SalBitmap&>(rSalBitmap).ImplDraw( aFG, m_nScreen, nDepth, aTmpRect, aTmpGC );
+        static_cast<const X11SalBitmap&>(rSalBitmap).ImplDraw( aFG, m_nXScreen, nDepth, aTmpRect, aTmpGC );
         DBG_TESTTRANS( aFG );
 
         // draw background in pixmap #2
@@ -719,7 +719,7 @@ void X11SalGraphics::drawMaskedBitmap( const SalTwoRect* pPosAry,
         // mask out paint bitmap in pixmap #1 (transparent areas 0)
         aValues.function = GXand, aValues.foreground = 0x00000000, aValues.background = 0xffffffff;
         XChangeGC( pXDisp, aTmpGC, nValues, &aValues );
-        static_cast<const X11SalBitmap&>(rTransBitmap).ImplDraw( aFG, m_nScreen, 1, aTmpRect, aTmpGC );
+        static_cast<const X11SalBitmap&>(rTransBitmap).ImplDraw( aFG, m_nXScreen, 1, aTmpRect, aTmpGC );
 
         DBG_TESTTRANS( aFG );
 
@@ -729,7 +729,7 @@ void X11SalGraphics::drawMaskedBitmap( const SalTwoRect* pPosAry,
             // mask out background in pixmap #2 (nontransparent areas 0)
             aValues.function = GXand, aValues.foreground = 0xffffffff, aValues.background = 0x00000000;
             XChangeGC( pXDisp, aTmpGC, nValues, &aValues );
-            static_cast<const X11SalBitmap&>(rTransBitmap).ImplDraw( aBG, m_nScreen, 1, aTmpRect, aTmpGC );
+            static_cast<const X11SalBitmap&>(rTransBitmap).ImplDraw( aBG, m_nXScreen, 1, aTmpRect, aTmpGC );
 
             DBG_TESTTRANS( aBG );
         }
@@ -794,13 +794,13 @@ bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
         return false;
 
     const SalDisplay* pSalDisp = GetDisplay();
-    const SalVisual& rSalVis = pSalDisp->GetVisual( m_nScreen );
+    const SalVisual& rSalVis = pSalDisp->GetVisual( m_nXScreen );
     Display* pXDisplay = pSalDisp->GetDisplay();
 
     // create source Picture
     int nDepth = m_pVDev ? m_pVDev->GetDepth() : rSalVis.GetDepth();
     const X11SalBitmap& rSrcX11Bmp = static_cast<const X11SalBitmap&>( rSrcBitmap );
-    ImplSalDDB* pSrcDDB = rSrcX11Bmp.ImplGetDDB( hDrawable_, m_nScreen, nDepth, rTR );
+    ImplSalDDB* pSrcDDB = rSrcX11Bmp.ImplGetDDB( hDrawable_, m_nXScreen, nDepth, rTR );
     if( !pSrcDDB )
         return false;
 
@@ -958,7 +958,7 @@ void X11SalGraphics::drawMask( const SalTwoRect* pPosAry,
         aValues.function = GXcopyInverted;
         aValues.foreground = 1, aValues.background = 0;
         aTmpGC = XCreateGC( pXDisp, aStipple, GCFunction | GCForeground | GCBackground, &aValues );
-        static_cast<const X11SalBitmap&>(rSalBitmap).ImplDraw( aStipple, m_nScreen, 1, aTwoRect, aTmpGC );
+        static_cast<const X11SalBitmap&>(rSalBitmap).ImplDraw( aStipple, m_nXScreen, 1, aTwoRect, aTmpGC );
 
         XFreeGC( pXDisp, aTmpGC );
 
@@ -1039,11 +1039,11 @@ SalBitmap *X11SalGraphics::getBitmap( long nX, long nY, long nDX, long nDY )
     X11SalBitmap*   pSalBitmap = new X11SalBitmap;
     sal_uInt16          nBitCount = GetBitCount();
 
-    if( &GetDisplay()->GetColormap( m_nScreen ) != &GetColormap() )
+    if( &GetDisplay()->GetColormap( m_nXScreen ) != &GetColormap() )
         nBitCount = 1;
 
     if( ! bFakeWindowBG )
-        pSalBitmap->ImplCreateFromDrawable( GetDrawable(), m_nScreen, nBitCount, nX, nY, nDX, nDY );
+        pSalBitmap->ImplCreateFromDrawable( GetDrawable(), m_nXScreen, nBitCount, nX, nY, nDX, nDY );
     else
         pSalBitmap->Create( Size( nDX, nDY ), (nBitCount > 8) ? 24 : nBitCount, BitmapPalette( nBitCount > 8 ? nBitCount : 0 ) );
 
@@ -1123,7 +1123,7 @@ bool X11SalGraphics::supportsOperation( OutDevSupportType eType ) const
         {
             XRenderPeer& rPeer = XRenderPeer::GetInstance();
             const SalDisplay* pSalDisp = GetDisplay();
-            const SalVisual& rSalVis = pSalDisp->GetVisual( m_nScreen );
+            const SalVisual& rSalVis = pSalDisp->GetVisual( m_nXScreen );
 
             Visual* pDstXVisual = rSalVis.GetVisual();
             XRenderPictFormat* pDstVisFmt = rPeer.FindVisualFormat( pDstXVisual );
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
index fbd9239..2e40bb9 100644
--- a/vcl/unx/generic/gdi/salgdi3.cxx
+++ b/vcl/unx/generic/gdi/salgdi3.cxx
@@ -327,8 +327,10 @@ void X11SalGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout )
 
     if (pVisualFormat)
     {
-        surface = cairo_xlib_surface_create_with_xrender_format (pDisplay, hDrawable_,
-            ScreenOfDisplay(pDisplay, m_nScreen), pVisualFormat, SAL_MAX_INT16, SAL_MAX_INT16);
+        surface = cairo_xlib_surface_create_with_xrender_format (
+                        pDisplay, hDrawable_,
+                        ScreenOfDisplay(pDisplay, m_nXScreen.getXScreen()),
+                        pVisualFormat, SAL_MAX_INT16, SAL_MAX_INT16);
     }
     else
     {
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index 757e11d..0bf64df 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -68,7 +68,8 @@ SalVirtualDevice* X11SalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
         }
         nDX = (long)w;
         nDY = (long)h;
-        if( !pVDev->Init( GetGenericData()->GetSalDisplay(), nDX, nDY, nBitCount, nScreen, pData->hDrawable,
+        if( !pVDev->Init( GetGenericData()->GetSalDisplay(), nDX, nDY, nBitCount,
+                          SalX11Screen( nScreen ), pData->hDrawable,
                 static_cast< XRenderPictFormat* >( pData->pXRenderFormat )) )
         {
             delete pVDev;
@@ -77,7 +78,7 @@ SalVirtualDevice* X11SalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
     }
     else if( !pVDev->Init( GetGenericData()->GetSalDisplay(), nDX, nDY, nBitCount,
                            pGraphics ? static_cast<X11SalGraphics*>(pGraphics)->GetScreenNumber() :
-                                       GetGenericData()->GetSalDisplay()->GetDefaultScreenNumber() ) )
+                                       GetGenericData()->GetSalDisplay()->GetDefaultXScreen() ) )
     {
         delete pVDev;
         return NULL;

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list