query Xinerama screen information if HAVE_XINERAMA

2002-04-17  Havoc Pennington  <hp@pobox.com>

	* src/screen.c (meta_screen_new): query Xinerama screen
	information if HAVE_XINERAMA

	* configure.in (found_xinerama): check for Xinerama
This commit is contained in:
Havoc Pennington 2002-04-21 19:35:02 +00:00 committed by Havoc Pennington
parent 458e125c09
commit f5c10f387b
7 changed files with 111 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2002-04-17 Havoc Pennington <hp@pobox.com>
* src/screen.c (meta_screen_new): query Xinerama screen
information if HAVE_XINERAMA
* configure.in (found_xinerama): check for Xinerama
2002-04-17 Changwoo Ryu <cwryu@debian.org>
* configure.in (ALL_LINGUAS): Added ko (Korean).

View File

@ -10,3 +10,4 @@
#undef HAVE_SHAPE_EXT
#undef HAVE_XFT
#undef HAVE_SM
#undef HAVE_XINERAMA

View File

@ -93,7 +93,18 @@ AC_PATH_XTRA
CFLAGS="$METACITY_CFLAGS $CFLAGS $X_CFLAGS"
METACITY_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $METACITY_LIBS"
XINERAMA_LIBS=
found_xinerama=false
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)
if test "$found_xinerama" = "true"; then
AC_DEFINE(HAVE_XINERAMA)
fi
METACITY_LIBS="$XINERAMA_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $METACITY_LIBS"
found_sm=false
case "$METACITY_LIBS" in

View File

@ -30,6 +30,10 @@
#include "keybindings.h"
#include "stack.h"
#ifdef HAVE_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
#include <X11/Xatom.h>
#include <locale.h>
#include <string.h>
@ -210,6 +214,75 @@ meta_screen_new (MetaDisplay *display,
screen->current_cursor = -1; /* invalid/unset */
screen->default_xvisual = DefaultVisualOfScreen (screen->xscreen);
screen->default_depth = DefaultDepthOfScreen (screen->xscreen);
screen->xinerama_infos = NULL;
screen->n_xinerama_infos = 0;
#ifdef HAVE_XINERAMA
if (XineramaQueryExtension (display->xdisplay, NULL, NULL))
{
XineramaScreenInfo *infos;
int n_infos;
int i;
n_infos = 0;
infos = XineramaQueryScreens (display->xdisplay, &n_infos);
meta_topic (META_DEBUG_XINERAMA,
"Found %d Xinerama screens on display %s\n",
n_infos, display->name);
if (n_infos > 0)
{
screen->xinerama_infos = g_new (MetaXineramaScreenInfo, n_infos);
screen->n_xinerama_infos = n_infos;
i = 0;
while (i < n_infos)
{
screen->xinerama_infos[i].number = infos[i].screen_number;
screen->xinerama_infos[i].x_origin = infos[i].x_org;
screen->xinerama_infos[i].y_origin = infos[i].y_org;
screen->xinerama_infos[i].width = infos[i].width;
screen->xinerama_infos[i].height = infos[i].height;
++i;
}
}
meta_XFree (infos);
}
else
{
meta_topic (META_DEBUG_XINERAMA,
"No Xinerama extension on display %s\n",
display->name);
}
#else
meta_topic (META_DEBUG_XINERAMA,
"Metacity compiled without Xinerama support\n");
#endif
/* If no Xinerama, fill in the single screen info so
* we can use the field unconditionally
*/
if (screen->n_xinerama_infos == 0)
{
meta_topic (META_DEBUG_XINERAMA,
"No Xinerama screens, using default screen info\n");
screen->xinerama_infos = g_new (MetaXineramaScreenInfo, 1);
screen->n_xinerama_infos = 1;
screen->xinerama_infos[0].number = 0;
screen->xinerama_infos[0].x_origin = 0;
screen->xinerama_infos[0].y_origin = 0;
screen->xinerama_infos[0].width = screen->width;
screen->xinerama_infos[0].height = screen->height;
}
g_assert (screen->n_xinerama_infos > 0);
g_assert (screen->xinerama_infos != NULL);
meta_screen_set_cursor (screen, META_CURSOR_DEFAULT);

View File

@ -26,6 +26,17 @@
#include <X11/Xutil.h>
#include "ui.h"
typedef struct _MetaXineramaScreenInfo MetaXineramaScreenInfo;
struct _MetaXineramaScreenInfo
{
int number;
int x_origin;
int y_origin;
int width;
int height;
};
typedef void (* MetaScreenWindowFunc) (MetaScreen *screen, MetaWindow *window,
gpointer user_data);
@ -48,6 +59,9 @@ struct _MetaScreen
MetaStack *stack;
MetaCursor current_cursor;
MetaXineramaScreenInfo *xinerama_infos;
int n_xinerama_infos;
};
MetaScreen* meta_screen_new (MetaDisplay *display,

View File

@ -190,6 +190,8 @@ topic_name (MetaDebugTopic topic)
return "GEOMETRY";
case META_DEBUG_PING:
return "PING";
case META_DEBUG_XINERAMA:
return "XINERAMA";
}
return "Window manager";

View File

@ -55,7 +55,8 @@ typedef enum
META_DEBUG_WINDOW_OPS = 1 << 7,
META_DEBUG_GEOMETRY = 1 << 8,
META_DEBUG_PLACEMENT = 1 << 9,
META_DEBUG_PING = 1 << 10
META_DEBUG_PING = 1 << 10,
META_DEBUG_XINERAMA = 1 << 11
} MetaDebugTopic;