diff options
-rw-r--r-- | acconfig.h | 4 | ||||
-rw-r--r-- | config/gdm.conf.in | 10 | ||||
-rw-r--r-- | configure.in | 73 | ||||
-rw-r--r-- | daemon/slave.c | 51 | ||||
-rw-r--r-- | gui/Makefile.am | 2 | ||||
-rw-r--r-- | gui/gdmwm.c | 67 |
6 files changed, 184 insertions, 23 deletions
@@ -10,7 +10,9 @@ #undef HAVE_TCPWRAPPERS #undef HAVE_SHADOW #undef HAVE_CRYPT -#undef HAVE_LIBXINERAMA +#undef HAVE_XINERAMA +#undef HAVE_XFREE_XINERAMA +#undef HAVE_SOLARIS_XINERAMA #undef HAVE_LIBXDMCP #undef HAVE_SETENV #undef HAVE_UNSETENV diff --git a/config/gdm.conf.in b/config/gdm.conf.in index fc00ab24..8eb899aa 100644 --- a/config/gdm.conf.in +++ b/config/gdm.conf.in @@ -42,9 +42,9 @@ GnomeDefaultSession=@EXPANDED_DATADIR@/gnome/default.session # should leave this alone Chooser=@EXPANDED_BINDIR@/gdmchooser # Default path to set. The profile scripts will likely override this -DefaultPath=/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin:@EXPANDED_BINDIR@ +DefaultPath=/bin:/usr/bin:/usr/bin/X11:@X_PATH@:/usr/local/bin:@EXPANDED_BINDIR@ # Default path for root. The profile scripts will likely override this -RootPath=/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin:@EXPANDED_BINDIR@ +RootPath=/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:@X_PATH@:/usr/local/bin:@EXPANDED_BINDIR@ DisplayInitDir=@EXPANDED_SYSCONFDIR@/gdm/Init # Greeter for local (non-xdmcp) logins. Change gdmlogin to gdmgreeter to # get the new graphical greeter. @@ -88,11 +88,11 @@ UserAuthDir= UserAuthFBDir=/tmp UserAuthFile=.Xauthority # The X server to use if we can't figure out what else to run. -StandardXServer=/usr/X11R6/bin/X +StandardXServer=@X_SERVER@ # The maximum number of flexible X servers to run. FlexibleXServers=5 # the X nest command -Xnest=/usr/X11R6/bin/Xnest -name Xnest +Xnest=@X_PATH@/Xnest -name Xnest # Automatic VT allocation. Right now only works on Linux. This way # we force X to use specific vts. turn VTAllocation to false if this # is causing problems. @@ -289,7 +289,7 @@ Enable=false # Definition of the standard X server. [server-Standard] name=Standard server -command=/usr/X11R6/bin/X +command=@X_SERVER@ flexible=true # To use this server type you should add -query host or -indirect host diff --git a/configure.in b/configure.in index 0200b964..c40c1d95 100644 --- a/configure.in +++ b/configure.in @@ -327,7 +327,7 @@ if test x$with_xdmcp != xno ; then AC_DEFINE(HAVE_LIBXDMCP) XDMCP_LIBS="-lXdmcp" XDMCP_SUPPORT=yes],,[$X_LIBS -lX11 $X_EXTRA_LIBS]) - ]) + ],,[#include <X11/Xproto.h>]) if test x$with_xdmcp = xyes -a x$XDMCP_SUPPORT = x ; then AC_MSG_ERROR(XDMCP support requested but XDMCP libraries not found) @@ -351,20 +351,57 @@ AC_SUBST(GDMXNESTCHOOSER) # # X11 Xinerama extension # -XINERAMA_LIBS= -if test x$with_xinerama != xno ; then - AC_CHECK_HEADER(X11/extensions/Xinerama.h, [ - AC_CHECK_LIB(Xinerama, XineramaQueryScreens, [ - AC_DEFINE(HAVE_LIBXINERAMA) - XINERAMA_LIBS="-lXinerama" - XINERAMA_SUPPORT=yes],,$[X_LIBS -lX11 -lXext $X_EXTRA_LIBS]) - ]) - - if test x$with_xinerama = xyes -a x$XINERAMA_SUPPORT = x ; then - AC_MSG_ERROR(Xinerama support requested but Xinerama libraries not found) +# Check for Xinerama extension (Solaris impl or Xfree impl) +xinerama_save_cppflags="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $X_CFLAGS" + +ALL_X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS" + +case "$host" in + *-*-solaris*) + # Check for solaris + use_solaris_xinerama=yes + AC_CHECK_LIB(Xext, XineramaGetInfo, + use_solaris_xinerama=yes, use_solaris_xinerama=no, + $ALL_X_LIBS) + if test "x$use_solaris_xinerama" = "xyes"; then + AC_CHECK_HEADER(X11/extensions/xinerama.h, + if test -z "`echo $ALL_X_LIBS | grep "\-lXext" 2> /dev/null`"; then + X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS" + fi + AC_DEFINE(HAVE_SOLARIS_XINERAMA) + AC_DEFINE(HAVE_XINERAMA) + XINERAMA_LIBS="" + XINERAMA_SUPPORT=yes, + use_solaris_xinerama=no, + [#include <X11/Xlib.h>]) fi -fi + AC_MSG_CHECKING(for Xinerama support on Solaris) + AC_MSG_RESULT($use_solaris_xinerama); + ;; + *) + # Check for XFree + use_xfree_xinerama=yes + AC_CHECK_LIB(Xinerama, XineramaQueryExtension, + [AC_CHECK_HEADER(X11/extensions/Xinerama.h, + if test -z "`echo $ALL_X_LIBS | grep "\-lXext" 2> /dev/null`"; then + X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS" + fi + AC_DEFINE(HAVE_XFREE_XINERAMA) + AC_DEFINE(HAVE_XINERAMA) + XINERAMA_LIBS="-lXinerama" + XINERAMA_SUPPORT=yes, + use_xfree_xinerama=no, + [#include <X11/Xlib.h>])], + use_xfree_xinerama=no, -lXext $ALL_X_LIBS) + AC_MSG_CHECKING(for Xinerama support on XFree86) + AC_MSG_RESULT($use_xfree_xinerama); + ;; +esac + AC_SUBST(XINERAMA_LIBS) +CPPFLAGS="$xinerama_save_cppflags" + # # Subst the extra libs @@ -418,6 +455,16 @@ EXPANDED_AUTHDIR=`eval echo $AUTHDIR_TMP` AC_SUBST(EXPANDED_AUTHDIR) AC_DEFINE_UNQUOTED(EXPANDED_AUTHDIR,"$EXPANDED_AUTHDIR") +if test -x /usr/X11R6/bin/X; then + X_PATH="/usr/X11R6/bin" + X_SERVER="/usr/X11R6/bin/X" +elif test -x /usr/openwin/bin/Xsun; then + X_PATH="/usr/openwin/bin" + X_SERVER="/usr/openwin/bin/Xsun" +fi +AC_SUBST(X_PATH) +AC_SUBST(X_SERVER) + SYSCONFDIR_TMP="$sysconfdir" EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP` AC_SUBST(EXPANDED_SYSCONFDIR) diff --git a/daemon/slave.c b/daemon/slave.c index 0c3da0bb..5ba30275 100644 --- a/daemon/slave.c +++ b/daemon/slave.c @@ -41,8 +41,10 @@ #include <arpa/inet.h> #include <X11/Xlib.h> #include <X11/Xatom.h> -#ifdef HAVE_LIBXINERAMA +#ifdef HAVE_XFREE_XINERAMA #include <X11/extensions/Xinerama.h> +#elif HAVE_SOLARIS_XINERAMA +#include <X11/extensions/xinerama.h> #endif #include <signal.h> #include <pwd.h> @@ -390,7 +392,7 @@ setup_automatic_session (GdmDisplay *display, const char *name) static void gdm_screen_init (GdmDisplay *display) { -#ifdef HAVE_LIBXINERAMA +#ifdef HAVE_XFREE_XINERAMA int (* old_xerror_handler) (Display *, XErrorEvent *); gboolean have_xinerama = FALSE; @@ -434,6 +436,51 @@ gdm_screen_init (GdmDisplay *display) XFree (xscreens); } else +#elif HAVE_SOLARIS_XINERAMA + /* This code from GDK, Copyright (C) 2002 Sun Microsystems */ + int opcode; + int firstevent; + int firsterror; + int n_monitors = 0; + + gboolean have_xinerama = FALSE; + have_xinerama = XQueryExtension (display->dsp, + "XINERAMA", + &opcode, + &firstevent, + &firsterror); + + if (have_xinerama) { + + int result; + XRectangle monitors[MAXFRAMEBUFFERS]; + unsigned char hints[16]; + + result = XineramaGetInfo (display->dsp, 0, monitors, hints, &n_monitors); + /* Yes I know it should be Success but the current implementation + * returns the num of monitor + */ + if (result <= 0) + gdm_fail ("Xinerama active, but <= 0 screens?"); + + if (n_monitors <= GdmXineramaScreen) + GdmXineramaScreen = 0; + + display->screenx = monitors[GdmXineramaScreen].x; + display->screeny = monitors[GdmXineramaScreen].y; + display->screenwidth = monitors[GdmXineramaScreen].width; + display->screenheight = monitors[GdmXineramaScreen].height; + + display->lrh_offsetx = + DisplayWidth (display->dsp, + DefaultScreen (display->dsp)) + - (display->screenx + display->screenwidth); + display->lrh_offsety = + DisplayHeight (display->dsp, + DefaultScreen (display->dsp)) + - (display->screeny + display->screenheight); + + } else #endif { display->screenx = 0; diff --git a/gui/Makefile.am b/gui/Makefile.am index 88810156..6bca5897 100644 --- a/gui/Makefile.am +++ b/gui/Makefile.am @@ -76,6 +76,7 @@ gdmchooser_LDADD = \ $(XDMCP_LIBS) \ -lX11 \ $(XINERAMA_LIBS) \ + $(X_EXTRA_LIBS) \ $(INTLLIBS) \ -L$(top_builddir)/vicious-extensions \ -lviciousui @@ -110,6 +111,7 @@ gdmphotosetup_LDADD = \ gdmXnestchooser_LDADD = \ $(GUI_LIBS) \ -lXau \ + -lX11 \ $(INTLLIBS) \ -L$(top_builddir)/vicious-extensions \ -lviciousui diff --git a/gui/gdmwm.c b/gui/gdmwm.c index 3be70d26..bdb40119 100644 --- a/gui/gdmwm.c +++ b/gui/gdmwm.c @@ -25,8 +25,10 @@ #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xatom.h> -#ifdef HAVE_LIBXINERAMA +#ifdef HAVE_XFREE_XINERAMA #include <X11/extensions/Xinerama.h> +#elif HAVE_SOLARIS_XINERAMA +#include <X11/extensions/xinerama.h> #endif #include <pwd.h> #include <unistd.h> @@ -91,7 +93,7 @@ gdm_wm_screen_init (int cur_screen_num) } { -#ifdef HAVE_LIBXINERAMA +#ifdef HAVE_XFREE_XINERAMA gboolean have_xinerama = FALSE; gdk_flush (); @@ -140,6 +142,67 @@ gdm_wm_screen_init (int cur_screen_num) XFree (xscreens); } else +#elif HAVE_SOLARIS_XINERAMA + gboolean have_xinerama = FALSE; + /* This code from GDK, Copyright (C) 2002 Sun Microsystems */ + int opcode; + int firstevent; + int firsterror; + int n_monitors = 0; + + gdk_flush (); + gdk_error_trap_push (); + have_xinerama = XQueryExtension (GDK_DISPLAY (), + "XINERAMA", + &opcode, + &firstevent, + &firsterror); + gdk_flush (); + if (gdk_error_trap_pop () != 0) + have_xinerama = FALSE; + + if (have_xinerama) { + int i; + int result; + XRectangle monitors[MAXFRAMEBUFFERS]; + unsigned char hints[16]; + + result = XineramaGetInfo (GDK_DISPLAY (), 0, monitors, hints, &n_monitors); + /* Yes I know it should be Success but the current implementation + * returns the num of monitor + */ + + if (result <= 0) { + /* should NEVER EVER happen */ + syslog (LOG_ERR, "Xinerama active, but <= 0 screens?"); + gdm_wm_screen.x = 0; + gdm_wm_screen.y = 0; + gdm_wm_screen.width = gdk_screen_width (); + gdm_wm_screen.height = gdk_screen_height (); + + gdm_wm_allscreens = g_new0 (GdkRectangle, 1); + gdm_wm_allscreens[0] = gdm_wm_screen; + gdm_wm_screens = 1; + return; + } + + if (n_monitors <= cur_screen_num) + cur_screen_num = 0; + + gdm_wm_allscreens = g_new0 (GdkRectangle, n_monitors); + gdm_wm_screens = n_monitors; + + for (i = 0; i < n_monitors; i++) { + gdm_wm_allscreens[i].x = monitors[i].x; + gdm_wm_allscreens[i].y = monitors[i].y; + gdm_wm_allscreens[i].width = monitors[i].width; + gdm_wm_allscreens[i].height = monitors[i].height; + + if (cur_screen_num == i) + gdm_wm_screen = gdm_wm_allscreens[i]; + } + + } else #endif { gdm_wm_screen.x = 0; |