417ff2f
From ca9fe5dff457794e55a6bb68633d2a4c2606bd63 Mon Sep 17 00:00:00 2001
417ff2f
From: Josh Heidenreich <josh.sickmate@gmail.com>
417ff2f
Date: Wed, 20 Jul 2011 14:17:33 +0930
417ff2f
Subject: [PATCH] Splash screen fix for multi-head on Linux (fdo#33214)
417ff2f
417ff2f
Uses xinerama to get the size of the primary screen
417ff2f
---
417ff2f
 desktop/unx/source/makefile.mk |    6 ++++++
417ff2f
 desktop/unx/source/splashx.c   |   23 +++++++++++++++++++++++
417ff2f
 2 files changed, 29 insertions(+), 0 deletions(-)
417ff2f
417ff2f
diff --git a/desktop/unx/source/makefile.mk b/desktop/unx/source/makefile.mk
417ff2f
index 2dea54a..7864dd8 100755
417ff2f
--- a/desktop/unx/source/makefile.mk
417ff2f
+++ b/desktop/unx/source/makefile.mk
417ff2f
@@ -42,6 +42,9 @@ dummy:
417ff2f
 CFLAGS+=-DENABLE_QUICKSTART_LIBPNG
417ff2f
 CFLAGS+=$(LIBPNG_CFLAGS)
417ff2f
 .ENDIF
417ff2f
+.IF "$(USE_XINERAMA)"=="YES"
417ff2f
+CFLAGS+=-DUSE_XINERAMA
417ff2f
+.ENDIF
417ff2f
 
417ff2f
 STDLIB=
417ff2f
 
417ff2f
@@ -61,6 +64,9 @@ APP1STDLIBS = $(PTHREAD_LIBS) $(X11LINK_DYNAMIC) $(SALLIB)
417ff2f
 .IF "$(ENABLE_QUICKSTART_LIBPNG)"=="TRUE"
417ff2f
 APP1STDLIBS += $(LIBPNG_LIBS)
417ff2f
 .ENDIF
417ff2f
+.IF "$(USE_XINERAMA)"=="YES"
417ff2f
+APP1STDLIBS += -lXinerama
417ff2f
+.ENDIF
417ff2f
 .IF "$(OS)"=="SOLARIS"
417ff2f
 APP1STDLIBS+= -lsocket
417ff2f
 .ENDIF
417ff2f
diff --git a/desktop/unx/source/splashx.c b/desktop/unx/source/splashx.c
417ff2f
index c365d47..76ef3eb 100755
417ff2f
--- a/desktop/unx/source/splashx.c
417ff2f
+++ b/desktop/unx/source/splashx.c
417ff2f
@@ -32,6 +32,10 @@
417ff2f
 #include <X11/Xatom.h>
417ff2f
 #include <X11/Xutil.h>
417ff2f
 
417ff2f
+#ifdef USE_XINERAMA
417ff2f
+#include <X11/extensions/Xinerama.h>
417ff2f
+#endif
417ff2f
+
417ff2f
 #define USE_LIBPNG
417ff2f
 
417ff2f
 #include "osl/endian.h"
417ff2f
@@ -511,6 +515,25 @@ int splash_create_window( int argc, char** argv )
417ff2f
     int display_width = DisplayWidth( display, screen );
417ff2f
     int display_height = DisplayHeight( display, screen );
417ff2f
 
417ff2f
+#ifdef USE_XINERAMA
417ff2f
+    int n_xinerama_screens = 1;
417ff2f
+    XineramaScreenInfo* p_screens = XineramaQueryScreens( display, &n_xinerama_screens );
417ff2f
+    if( p_screens )
417ff2f
+    {
417ff2f
+        int i = 0;
417ff2f
+        for( ; i < n_xinerama_screens; i++ )
417ff2f
+        {
417ff2f
+            if ( p_screens[i].screen_number == screen )
417ff2f
+            {
417ff2f
+                display_width = p_screens[i].width;
417ff2f
+                display_height = p_screens[i].height;
417ff2f
+                break;
417ff2f
+            }
417ff2f
+        }
417ff2f
+        XFree( p_screens );
417ff2f
+    }
417ff2f
+#endif
417ff2f
+
417ff2f
     win = XCreateSimpleWindow( display, root_win,
417ff2f
             ( display_width - width ) / 2, ( display_height - height ) / 2,
417ff2f
             width, height, 0,
417ff2f
-- 
417ff2f
1.7.7.6
417ff2f