mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 318331 - Default build does not support Xinerama - detect support at runtimep=Sylvain Pasche <sylvain.pasche@gmail.com>r+sr=roc
This commit is contained in:
parent
e13832d06e
commit
6395724420
@ -491,9 +491,6 @@ MOZ_PANGO_LIBS = @MOZ_PANGO_LIBS@
|
||||
|
||||
MOZ_EXTRA_X11CONVERTERS = @MOZ_EXTRA_X11CONVERTERS@
|
||||
|
||||
MOZ_ENABLE_XINERAMA = @MOZ_ENABLE_XINERAMA@
|
||||
MOZ_XINERAMA_LIBS = @MOZ_XINERAMA_LIBS@
|
||||
|
||||
MOZ_XIE_LIBS = @MOZ_XIE_LIBS@
|
||||
XT_LIBS = @XT_LIBS@
|
||||
|
||||
|
@ -93,10 +93,6 @@ endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_XINERAMA
|
||||
STATIC_EXTRA_LIBS += $(MOZ_XINERAMA_LIBS)
|
||||
endif
|
||||
|
||||
ifneq (,$(MOZ_ENABLE_GTK2))
|
||||
STATIC_EXTRA_LIBS += $(XLDFLAGS) $(XT_LIBS)
|
||||
endif
|
||||
|
@ -886,7 +886,6 @@ X11/cursorfont.h
|
||||
X11/extensions/Print.h
|
||||
X11/extensions/shape.h
|
||||
X11/extensions/XIElib.h
|
||||
X11/extensions/Xinerama.h
|
||||
X11/extensions/XShm.h
|
||||
X11/extensions/Xrender.h
|
||||
X11/Intrinsic.h
|
||||
|
33
configure.in
33
configure.in
@ -2883,13 +2883,6 @@ else
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Check for Xinerama
|
||||
dnl ========================================================
|
||||
AC_CHECK_LIB(Xinerama, XineramaIsActive, [MOZ_XINERAMA_LIBS="-lXinerama"],,
|
||||
$XLIBS $XEXT_LIBS)
|
||||
AC_CHECK_HEADER(X11/extensions/Xinerama.h)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Check for XShm
|
||||
dnl ========================================================
|
||||
@ -5248,30 +5241,6 @@ if test -n "$MOZ_OJI"; then
|
||||
AC_DEFINE(OJI)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Xinerama support. The autodetection is done above in the Xlib
|
||||
dnl = detection routines.
|
||||
dnl ========================================================
|
||||
|
||||
if test "$MOZ_WIDGET_TOOLKIT" = "gtk2"; then
|
||||
MOZ_ENABLE_XINERAMA=1
|
||||
fi
|
||||
|
||||
MOZ_ARG_DISABLE_BOOL(xinerama,
|
||||
[ --disable-xinerama Disable Xinerama support],
|
||||
MOZ_ENABLE_XINERAMA=,
|
||||
MOZ_ENABLE_XINERAMA=1 )
|
||||
|
||||
if test -n "$MOZ_ENABLE_XINERAMA"; then
|
||||
if test -z "$MOZ_XINERAMA_LIBS" || \
|
||||
test "$ac_cv_header_X11_extensions_Xinerama_h" = "no"; then
|
||||
AC_MSG_ERROR([Cannot find Xinerama library. To build without Xinerama support, rebuild with --disable-xinerama])
|
||||
fi
|
||||
# Xinerama depends on libXext which is not automatically included on older distribs
|
||||
MOZ_XINERAMA_LIBS="$MOZ_XINERAMA_LIBS $XEXT_LIBS"
|
||||
AC_DEFINE(MOZ_ENABLE_XINERAMA)
|
||||
fi
|
||||
|
||||
dnl bi-directional support always on
|
||||
IBMBIDI=1
|
||||
AC_DEFINE(IBMBIDI)
|
||||
@ -7642,8 +7611,6 @@ AC_SUBST(MOZ_XPRINT_CFLAGS)
|
||||
AC_SUBST(MOZ_XPRINT_LDFLAGS)
|
||||
AC_SUBST(MOZ_ENABLE_XPRINT)
|
||||
AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
|
||||
AC_SUBST(MOZ_XINERAMA_LIBS)
|
||||
AC_SUBST(MOZ_ENABLE_XINERAMA)
|
||||
|
||||
AC_SUBST(XPCOM_USE_LEA)
|
||||
AC_SUBST(BUILD_STATIC_LIBS)
|
||||
|
@ -191,10 +191,6 @@ EXTRA_DSO_LDOPTS += \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_XINERAMA
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_XINERAMA_LIBS)
|
||||
endif
|
||||
|
||||
ifneq (,$(filter gtk2 qt,$(MOZ_WIDGET_TOOLKIT)))
|
||||
EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) $(MOZ_XFT_LIBS) $(MOZ_GTK2_LIBS) $(XT_LIBS)
|
||||
endif
|
||||
|
@ -131,9 +131,6 @@ EXTRA_DSO_LDOPTS += \
|
||||
$(XLDFLAGS) \
|
||||
$(XLIBS) \
|
||||
$(MOZ_GTK2_LIBS)
|
||||
ifdef MOZ_ENABLE_XINERAMA
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_XINERAMA_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_ENABLE_CAIRO_GFX),1)
|
||||
EXTRA_DSO_LDOPTS += -lthebes
|
||||
|
@ -230,7 +230,6 @@ nsScreenGtk :: Init (PRBool aReInit)
|
||||
g_free (workareas);
|
||||
}
|
||||
|
||||
#ifdef MOZ_ENABLE_XINERAMA
|
||||
void
|
||||
nsScreenGtk :: Init (XineramaScreenInfo *aScreenInfo)
|
||||
{
|
||||
@ -241,4 +240,3 @@ nsScreenGtk :: Init (XineramaScreenInfo *aScreenInfo)
|
||||
|
||||
mAvailRect = mRect = xineRect;
|
||||
}
|
||||
#endif // MOZ_ENABLE_XINERAMA
|
||||
|
@ -43,9 +43,14 @@
|
||||
#include "gdk/gdk.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#ifdef MOZ_ENABLE_XINERAMA
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#endif // MOZ_ENABLE_XINERAMA
|
||||
// from Xinerama.h
|
||||
typedef struct {
|
||||
int screen_number;
|
||||
short x_org;
|
||||
short y_org;
|
||||
short width;
|
||||
short height;
|
||||
} XineramaScreenInfo;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
@ -60,9 +65,7 @@ public:
|
||||
|
||||
void Init(PRBool aReInit = PR_FALSE);
|
||||
void ReInit() { Init(PR_TRUE); }
|
||||
#ifdef MOZ_ENABLE_XINERAMA
|
||||
void Init(XineramaScreenInfo *aScreenInfo);
|
||||
#endif
|
||||
|
||||
Atom NetWorkareaAtom() { return mNetWorkareaAtom; }
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Sylvain Pasche <sylvain.pasche@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
@ -40,16 +41,13 @@
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "prlink.h"
|
||||
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
#ifdef MOZ_ENABLE_XINERAMA
|
||||
// this header rocks!
|
||||
extern "C"
|
||||
{
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
}
|
||||
#endif /* MOZ_ENABLE_XINERAMA */
|
||||
// prototypes from Xinerama.h
|
||||
typedef Bool (*_XnrmIsActive_fn)(Display *dpy);
|
||||
typedef XineramaScreenInfo* (*_XnrmQueryScreens_fn)(Display *dpy, int *number);
|
||||
|
||||
nsScreenManagerGtk :: nsScreenManagerGtk ( )
|
||||
{
|
||||
@ -79,23 +77,26 @@ nsScreenManagerGtk :: EnsureInit(void)
|
||||
if (!mCachedScreenArray) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
#ifdef MOZ_ENABLE_XINERAMA
|
||||
// get the number of screens via xinerama
|
||||
XineramaScreenInfo *screenInfo;
|
||||
if (XineramaIsActive(GDK_DISPLAY())) {
|
||||
screenInfo = XineramaQueryScreens(GDK_DISPLAY(), &mNumScreens);
|
||||
XineramaScreenInfo *screenInfo = NULL;
|
||||
|
||||
// We are leaking xineramalib, but there is no other way to do this.
|
||||
PRLibrary* xineramalib = PR_LoadLibrary("libXinerama.so.1");
|
||||
if (xineramalib) {
|
||||
_XnrmIsActive_fn _XnrmIsActive = (_XnrmIsActive_fn)
|
||||
PR_FindFunctionSymbol(xineramalib, "XineramaIsActive");
|
||||
|
||||
_XnrmQueryScreens_fn _XnrmQueryScreens = (_XnrmQueryScreens_fn)
|
||||
PR_FindFunctionSymbol(xineramalib, "XineramaQueryScreens");
|
||||
|
||||
// get the number of screens via xinerama
|
||||
if (_XnrmIsActive && _XnrmQueryScreens &&
|
||||
_XnrmIsActive(GDK_DISPLAY())) {
|
||||
screenInfo = _XnrmQueryScreens(GDK_DISPLAY(), &mNumScreens);
|
||||
}
|
||||
}
|
||||
else {
|
||||
screenInfo = NULL;
|
||||
mNumScreens = 1;
|
||||
}
|
||||
#else
|
||||
mNumScreens = 1;
|
||||
#endif
|
||||
// there will be < 2 screens if we are either not building with
|
||||
// xinerama support or xinerama isn't running on the current
|
||||
// display.
|
||||
if (mNumScreens < 2) {
|
||||
// screenInfo == NULL if either Xinerama couldn't be loaded or
|
||||
// isn't running on the current display
|
||||
if (!screenInfo) {
|
||||
mNumScreens = 1;
|
||||
nsRefPtr<nsScreenGtk> screen = new nsScreenGtk();
|
||||
if (!screen)
|
||||
@ -109,7 +110,6 @@ nsScreenManagerGtk :: EnsureInit(void)
|
||||
// If Xinerama is enabled and there's more than one screen, fill
|
||||
// in the info for all of the screens. If that's not the case
|
||||
// then nsScreenGTK() defaults to the screen width + height
|
||||
#ifdef MOZ_ENABLE_XINERAMA
|
||||
else {
|
||||
#ifdef DEBUG
|
||||
printf("Xinerama superpowers activated for %d screens!\n", mNumScreens);
|
||||
@ -132,10 +132,9 @@ nsScreenManagerGtk :: EnsureInit(void)
|
||||
if (screenInfo) {
|
||||
XFree(screenInfo);
|
||||
}
|
||||
#endif /* MOZ_ENABLE_XINERAMA */
|
||||
}
|
||||
|
||||
return NS_OK;;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user