Fix build regression: enable XRANDR support by default

The changes made in b178bed60b used the wrong
variable to set the default state of '--enable-randr' in configure.in, that is fixed now. I
also removed '--enable-randr12': If support for the Xrandr-extension is
available at compile time we set HAVE_RANDR; if there is also support for
Xrandr-1.2 (or higher), we also set HAVE_RANDR1_2 automatically.

Other changes:

* cleaned out public interface of 'class Fluxbox'
* added 'RANDR' to output of 'fluxbox -info'
This commit is contained in:
Mathias Gumz 2012-12-12 10:18:20 +01:00
parent d8cd6a928b
commit 4191cbf2d2
5 changed files with 97 additions and 69 deletions

View file

@ -445,46 +445,48 @@ AS_IF(test "x$enable_shape" = "xyes",[
dnl Check for RANDR support and proper library files.
enableval="yes"
AC_MSG_CHECKING([whether to build support for the Xrandr (X resize and rotate) extension])
AC_ARG_ENABLE(randr,
AS_HELP_STRING([--enable-randr], [enable support of the Xrandr extension (default=yes)]),, [enableval=yes])
AS_IF(test "x$enable_randr" = "xyes",[
AC_CHECK_LIB(Xrandr, XRRQueryExtension,
AC_MSG_CHECKING([whether to build support for the XRANDR (X Resize And Rotate) extension])
AC_ARG_ENABLE(randr,
AS_HELP_STRING([--enable-randr], [XRANDR extension support (default=no)]),,[enable_randr=yes])
AS_IF(test "x$enable_randr" = "xyes", [
AC_MSG_RESULT([yes])
AC_CHECK_LIB(Xrandr, XRRQueryExtension, [
AC_MSG_CHECKING([for X11/extensions/Xrandr.h])
AC_TRY_COMPILE(
#include <X11/Xlib.h>
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xrandr.h>
, XRRQueryExtension(0, 0, 0),
]], [[XRRQueryExtension(0, 0, 0);]]
)], [
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_RANDR, [1], [Define to 1 if you have RANDR])
LIBS="-lXrandr $LIBS",
AC_MSG_RESULT([no])))],[
LIBS="-lXrandr $LIBS"
FEATURES="$FEATURES RANDR"
AC_MSG_CHECKING([for XRRUpdateConfiguration])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xrandr.h>
]], [[XRRUpdateConfiguration(0);]]
)], [
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_RANDR1_2, [1], [Define to 1 if you have RANDR 1.2])
], [
AC_MSG_RESULT([no])
])
], [
AC_MSG_RESULT([no])
])
],[
AC_MSG_RESULT([no])
])],[
AC_MSG_RESULT([no])
CONFIGOPTS="$CONFIGOPTS --disable-randr"])
AC_MSG_CHECKING([whether to have RANDR 1.2 support])
AC_ARG_ENABLE(randr12,
AS_HELP_STRING([--enable-randr12], [RANDR 1.2 support (default=yes)]), , [enable_randr12=yes])
AS_IF(test "x$enable_randr12" = "xyes",[
AC_MSG_RESULT([yes])
AC_CHECK_LIB(Xrandr, XRRQueryExtension,
AC_MSG_CHECKING([for X11/extensions/Xrandr.h])
AC_TRY_COMPILE(
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xrandr.h>
, XRRUpdateConfiguration(0),
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_RANDR1_2, [1], [Define to 1 if you have RANDR 1.2])
LIBS="-lXrandr $LIBS",
AC_MSG_RESULT([no])))],[
AC_MSG_RESULT([no])
CONFIGOPTS="$CONFIGOPTS --disable-randr1.2"])
AC_MSG_CHECKING([whether to have FRIBIDI support])

View file

@ -132,7 +132,7 @@ extern "C" {
}
#endif // XINERAMA
#ifdef HAVE_RANDR
#if defined(HAVE_RANDR) || defined(HAVE_RANDR1_2)
#include <X11/extensions/Xrandr.h>
#endif // HAVE_RANDR
@ -380,19 +380,26 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
XFree(ret_prop);
}
#ifdef HAVE_RANDR
// setup RANDR for this screens root window
// we need to determine if we should use old randr select input function or not
#ifdef X_RRScreenChangeSelectInput
// use old set randr event
XRRScreenChangeSelectInput(disp, rootWindow().window(), True);
#else
XRRSelectInput(disp, rootWindow().window(),
RRScreenChangeNotifyMask);
#endif // X_RRScreenChangeSelectInput
// setup RANDR for this screens root window
#if defined(HAVE_RANDR1_2)
int randr_mask = RRScreenChangeNotifyMask;
#ifdef RRCrtcChangeNotifyMask
randr_mask |= RRCrtcChangeNotifyMask;
#endif
#ifdef RROutputChangeNotifyMask
randr_mask |= RROutputChangeNotifyMask;
#endif
#ifdef RROutputPropertyNotifyMask
randr_mask |= RROutputPropertyNotifyMask;
#endif
XRRSelectInput(disp, rootWindow().window(), randr_mask);
#elif defined(HAVE_RANDR)
XRRScreenChangeSelectInput(disp, rootWindow().window(), True);
#endif // HAVE_RANDR
_FB_USES_NLS;
#ifdef DEBUG

View file

@ -84,7 +84,7 @@
#ifdef SHAPE
#include <X11/extensions/shape.h>
#endif // SHAPE
#ifdef HAVE_RANDR
#if defined(HAVE_RANDR) || defined(HAVE_RANDR1_2)
#include <X11/extensions/Xrandr.h>
#endif // HAVE_RANDR
@ -218,10 +218,17 @@ struct CallMemFunWithRefArg : std::unary_function<Type, ResultType> {
};
int s_randr_event_type = 0; ///< the type number of randr event
int s_shape_eventbase = 0; ///< event base for shape events
bool s_have_shape = false ; ///< if shape is supported by server
Atom s_kwm1_dockwindow;
Atom s_kwm2_dockwindow;
Fluxbox* s_singleton = 0;
} // end anonymous
//static singleton var
Fluxbox *Fluxbox::s_singleton=0;
Fluxbox::Fluxbox(int argc, char **argv,
const std::string& dpy_name,
@ -261,8 +268,7 @@ Fluxbox::Fluxbox(int argc, char **argv,
m_starting(true),
m_restarting(false),
m_shutdown(false),
m_server_grabs(0),
m_randr_event_type(0) {
m_server_grabs(0) {
_FB_USES_NLS;
if (s_singleton != 0)
@ -277,10 +283,10 @@ Fluxbox::Fluxbox(int argc, char **argv,
Display *disp = FbTk::App::instance()->display();
// For KDE dock applets
// KDE v1.x
m_kwm1_dockwindow = XInternAtom(disp,
s_kwm1_dockwindow = XInternAtom(disp,
"KWM_DOCKWINDOW", False);
// KDE v2.x
m_kwm2_dockwindow = XInternAtom(disp,
s_kwm2_dockwindow = XInternAtom(disp,
"_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False);
// setup X error handler
XSetErrorHandler((XErrorHandler) handleXErrors);
@ -314,21 +320,18 @@ Fluxbox::Fluxbox(int argc, char **argv,
XSynchronize(disp, True);
s_singleton = this;
m_have_shape = false;
m_shape_eventbase = 0;
#ifdef SHAPE
int shape_err;
m_have_shape = XShapeQueryExtension(disp, &m_shape_eventbase, &shape_err);
s_have_shape = XShapeQueryExtension(disp, &s_shape_eventbase, &shape_err);
#endif // SHAPE
#ifdef HAVE_RANDR
// get randr event type
#if defined(HAVE_RANDR) || defined(HAVE_RANDR1_2)
int randr_error_base;
XRRQueryExtension(disp, &m_randr_event_type, &randr_error_base);
XRRQueryExtension(disp, &s_randr_event_type, &randr_error_base);
#endif // HAVE_RANDR
load_rc();
grab();
if (! XSupportsLocale())
@ -796,8 +799,8 @@ void Fluxbox::handleEvent(XEvent * const e) {
break;
default: {
#ifdef HAVE_RANDR
if (e->type == m_randr_event_type) {
#if defined(HAVE_RANDR) || defined(HAVE_RANDR1_2)
if (e->type == s_randr_event_type) {
#ifdef HAVE_RANDR1_2
XRRUpdateConfiguration(e);
#endif
@ -1400,3 +1403,17 @@ void Fluxbox::workspaceAreaChanged(BScreen &screen) {
CallMemFunWithRefArg<AtomHandler, BScreen&, void>(&AtomHandler::updateWorkarea, screen));
}
bool Fluxbox::haveShape() const {
return s_have_shape;
}
int Fluxbox::shapeEventbase() const {
return s_shape_eventbase;
}
Fluxbox* Fluxbox::instance() {
return s_singleton;
}

View file

@ -83,7 +83,7 @@ public:
bool xsync = false);
virtual ~Fluxbox();
static Fluxbox *instance() { return s_singleton; }
static Fluxbox *instance();
/// main event loop
void eventLoop();
@ -177,8 +177,8 @@ public:
typedef std::list<BScreen *> ScreenList;
const ScreenList screenList() const { return m_screen_list; }
bool haveShape() const { return m_have_shape; }
int shapeEventbase() const { return m_shape_eventbase; }
bool haveShape() const;
int shapeEventbase() const;
std::string getDefaultDataFilename(const char *name) const;
// screen mouse was in at last key event
BScreen *mouseScreen() { return m_mousescreen; }
@ -285,9 +285,6 @@ private:
std::auto_ptr<Keys> m_key;
//default arguments for titlebar left and right
static Fluxbox *s_singleton;
typedef std::set<AtomHandler *> AtomHandlerContainer;
typedef AtomHandlerContainer::iterator AtomHandlerContainerIt;
@ -297,10 +294,6 @@ private:
bool m_restarting;
bool m_shutdown;
int m_server_grabs;
int m_randr_event_type; ///< the type number of randr event
int m_shape_eventbase; ///< event base for shape events
bool m_have_shape; ///< if shape is supported by server
Atom m_kwm1_dockwindow, m_kwm2_dockwindow;
AttentionNoticeHandler m_attention_handler;
};

View file

@ -192,6 +192,15 @@ static void showInfo(ostream &ostr) {
#endif // USE_TOOLBAR
"TOOLBAR" << endl <<
#ifndef HAVE_RANDR
NOT <<
#endif
"RANDR" <<
#ifdef HAVE_RANDR1_2
"1.2" <<
#endif
endl <<
#ifndef USE_XFT
NOT <<
#endif // USE_XFT