Try to handle Solaris Xinerama, all coded blind, someone on Solaris will

2002-09-27  Havoc Pennington  <hp@redhat.com>

        Try to handle Solaris Xinerama, all coded blind, someone
	on Solaris will need to debug the typos.

	* src/display.c: updates for Solaris Xinerama

	* src/screen.c: updates for Solaris Xinerama

	* configure.in: make Xinerama check more complicated to catch
	Solaris Xinerama
This commit is contained in:
Havoc Pennington 2002-09-27 20:28:34 +00:00 committed by Havoc Pennington
parent e7e41b045d
commit 74b3bca93d
6 changed files with 145 additions and 33 deletions

View File

@ -1,3 +1,15 @@
2002-09-27 Havoc Pennington <hp@redhat.com>
Try to handle Solaris Xinerama, all coded blind, someone
on Solaris will need to debug the typos.
* src/display.c: updates for Solaris Xinerama
* src/screen.c: updates for Solaris Xinerama
* configure.in: make Xinerama check more complicated to catch
Solaris Xinerama
2002-09-27 Havoc Pennington <hp@redhat.com>
* src/window.c (update_transient_for): keep a flag

View File

@ -11,4 +11,6 @@
#undef HAVE_XFT
#undef HAVE_SM
#undef HAVE_XINERAMA
#undef HAVE_SOLARIS_XINERAMA
#undef HAVE_XFREE_XINERAMA
#undef HAVE_SHAPE

View File

@ -102,25 +102,59 @@ fi
AC_PATH_XTRA
XINERAMA_LIBS=
found_xinerama=false
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
AC_CHECK_LIB(Xext, XineramaQueryExtension,
[AC_CHECK_HEADERS(X11/extensions/Xinerama.h,
XINERAMA_LIBS=-lXinerama found_xinerama=true)],
, -lXinerama $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS)
ALL_X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
if test "$found_xinerama" = "true"; then
AC_DEFINE(HAVE_XINERAMA)
fi
# Check for Xinerama extension (Solaris impl or Xfree impl)
metacity_save_cppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
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),
use_solaris_xinerama=no,
[#include <X11/Xlib.h>])
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,
X_EXTRA_LIBS="-lXinerama $X_EXTRA_LIBS"
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),
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
CPPFLAGS="$metacity_save_cppflags"
SHAPE_LIBS=
found_shape=false
AC_CHECK_LIB(Xext, XShapeQueryExtension,
[AC_CHECK_HEADERS(X11/extensions/shape.h,
SHAPE_LIBS=-lXext found_shape=true)],
, -lXext $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS)
, $ALL_X_LIBS)
if test "$found_shape" = "true"; then
AC_DEFINE(HAVE_SHAPE)
@ -128,7 +162,7 @@ fi
CPPFLAGS="$save_CPPFLAGS"
METACITY_LIBS="$XINERAMA_LIBS $SHAPE_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $METACITY_LIBS"
METACITY_LIBS="$SHAPE_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $METACITY_LIBS"
METACITY_MESSAGE_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $METACITY_MESSAGE_LIBS"
METACITY_WINDOW_DEMO_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $METACITY_WINDOW_DEMO_LIBS"
METACITY_PROPS_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $METACITY_PROPS_LIBS"

View File

@ -33,7 +33,10 @@
#include "workspace.h"
#include <X11/Xatom.h>
#include <X11/cursorfont.h>
#ifdef HAVE_XINERAMA
#ifdef HAVE_SOLARIS_XINERAMA
#include <X11/extensions/xinerama.h>
#endif
#ifdef HAVE_XFREE_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
#include <string.h>
@ -238,18 +241,6 @@ meta_display_open (const char *name)
if (meta_is_syncing ())
XSynchronize (xdisplay, True);
#if 0
/* this was debug cruft */
#ifdef HAVE_XINERAMA
if (XineramaIsActive (xdisplay))
meta_topic (META_DEBUG_XINERAMA, "Xinerama active on display\n");
else
meta_topic (META_DEBUG_XINERAMA, "Xinerama not active on display\n");
#else
meta_topic (META_DEBUG_XINERAMA, "No Xinerama support compiled in\n");
#endif
#endif
display = g_new (MetaDisplay, 1);

View File

@ -256,9 +256,19 @@ main (int argc, char **argv)
meta_verbose ("Compiled without shape extension\n");
#endif
#ifdef HAVE_XINERAMA
meta_verbose ("Compiled with Xinerama extension\n");
meta_topic (META_DEBUG_XINERAMA, "Compiled with Xinerama extension\n");
#else
meta_verbose ("Compiled without Xinerama extension\n");
meta_topic (META_DEBUG_XINERAMA, "Compiled without Xinerama extension\n");
#endif
#ifdef HAVE_XFREE_XINERAMA
meta_topic (META_DEBUG_XINERAMA, " (using XFree86 Xinerama)\n");
#else
meta_topic (META_DEBUG_XINERAMA, " (not using XFree86 Xinerama)\n");
#endif
#ifdef HAVE_SOLARIS_XINERAMA
meta_topic (META_DEBUG_XINERAMA, " (using Solaris Xinerama)\n");
#else
meta_topic (META_DEBUG_XINERAMA, " (not using Solaris Xinerama)\n");
#endif
/* Load prefs */

View File

@ -34,7 +34,10 @@
#include "stack.h"
#include "xprops.h"
#ifdef HAVE_XINERAMA
#ifdef HAVE_SOLARIS_XINERAMA
#include <X11/extensions/xinerama.h>
#endif
#ifdef HAVE_XFREE_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
@ -352,7 +355,7 @@ meta_screen_new (MetaDisplay *display,
screen->last_xinerama_index = 0;
#ifdef HAVE_XINERAMA
#ifdef HAVE_XFREE_XINERAMA
if (XineramaIsActive (display->xdisplay))
{
XineramaScreenInfo *infos;
@ -397,14 +400,74 @@ meta_screen_new (MetaDisplay *display,
else
{
meta_topic (META_DEBUG_XINERAMA,
"No Xinerama extension or Xinerama inactive on display %s\n",
"No XFree86 Xinerama extension or XFree86 Xinerama inactive on display %s\n",
display->name);
}
#else
meta_topic (META_DEBUG_XINERAMA,
"Metacity compiled without Xinerama support\n");
#endif
"Metacity compiled without XFree86 Xinerama support\n");
#endif /* HAVE_XFREE_XINERAMA */
#ifdef HAVE_SOLARIS_XINERAMA
/* This code from GDK, Copyright (C) 2002 Sun Microsystems */
if (screen->n_xinerama_infos == 0 &&
XineramaGetState (screen->display->xdisplay,
screen->number))
{
XRectangle monitors[MAXFRAMEBUFFERS];
unsigned char hints[16];
int result;
int n_monitors;
int i;
n_monitors = 0;
result = XineramaGetInfo (screen->xdisplay,
screen->number,
monitors, hints,
&n_monitors);
/* Yes I know it should be Success but the current implementation
* returns the num of monitor
*/
if (result > 0)
{
g_assert (n_monitors > 0);
screen->xinerama_infos = g_new (MetaXineramaScreenInfo, n_monitors);
screen->n_xinerama_infos = n_monitors;
i = 0;
while (i < n_monitors)
{
screen->xinerama_infos[i].number = i;
screen->xinerama_infos[i].x_origin = monitors[i].x;
screen->xinerama_infos[i].y_origin = monitors[i].y;
screen->xinerama_infos[i].width = monitors[i].width;
screen->xinerama_infos[i].height = monitors[i].height;
meta_topic (META_DEBUG_XINERAMA,
"Xinerama %d is %d,%d %d x %d\n",
screen->xinerama_infos[i].number,
screen->xinerama_infos[i].x_origin,
screen->xinerama_infos[i].y_origin,
screen->xinerama_infos[i].width,
screen->xinerama_infos[i].height);
++i;
}
}
}
else if (screen->n_xinerama_infos == 0)
{
meta_topic (META_DEBUG_XINERAMA,
"No Solaris Xinerama extension or Solaris Xinerama inactive on display %s\n",
display->name);
}
#else
meta_topic (META_DEBUG_XINERAMA,
"Metacity compiled without Solaris Xinerama support\n");
#endif /* HAVE_SOLARIS_XINERAMA */
/* If no Xinerama, fill in the single screen info so
* we can use the field unconditionally
*/