diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | acconfig.h | 1 | ||||
-rw-r--r-- | configure.in | 13 | ||||
-rw-r--r-- | src/screen.c | 73 | ||||
-rw-r--r-- | src/screen.h | 14 | ||||
-rw-r--r-- | src/util.c | 2 | ||||
-rw-r--r-- | src/util.h | 3 |
7 files changed, 111 insertions, 2 deletions
@@ -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). @@ -10,3 +10,4 @@ #undef HAVE_SHAPE_EXT #undef HAVE_XFT #undef HAVE_SM +#undef HAVE_XINERAMA diff --git a/configure.in b/configure.in index 8b346ba2..0c297eed 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/src/screen.c b/src/screen.c index 005014aa..f02e99d2 100644 --- a/src/screen.c +++ b/src/screen.c @@ -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); diff --git a/src/screen.h b/src/screen.h index 5cda3c7c..6b8c3549 100644 --- a/src/screen.h +++ b/src/screen.h @@ -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, @@ -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"; @@ -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; |