Fix build regression: enable XRANDR support by default The changes made in b178bed60b5bd8b2c9ed0cbc67fd729ff3820589 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'
Mathias Gumz akira at fluxbox dot org
5 files changed,
95 insertions(+),
67 deletions(-)
M
configure.in
→
configure.in
@@ -445,45 +445,47 @@
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_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_HELP_STRING([--enable-randr], [XRANDR extension support (default=no)]),,[enable_randr=yes]) -AS_IF(test "x$enable_randr" = "xyes",[ - AC_CHECK_LIB(Xrandr, XRRQueryExtension, +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), - AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_RANDR, [1], [Define to 1 if you have RANDR]) - LIBS="-lXrandr $LIBS", - AC_MSG_RESULT([no])))],[ - AC_MSG_RESULT([no]) - CONFIGOPTS="$CONFIGOPTS --disable-randr"]) + ]], [[XRRQueryExtension(0, 0, 0);]] + )], [ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_RANDR, [1], [Define to 1 if you have RANDR]) + LIBS="-lXrandr $LIBS" + FEATURES="$FEATURES 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> + 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]) - LIBS="-lXrandr $LIBS", - AC_MSG_RESULT([no])))],[ + ]], [[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-randr1.2"]) + CONFIGOPTS="$CONFIGOPTS --disable-randr"]) +
M
src/Screen.cc
→
src/Screen.cc
@@ -132,7 +132,7 @@ #include <X11/extensions/Xinerama.h>
} #endif // XINERAMA -#ifdef HAVE_RANDR +#if defined(HAVE_RANDR) || defined(HAVE_RANDR1_2) #include <X11/extensions/Xrandr.h> #endif // HAVE_RANDR@@ -380,18 +380,25 @@ m_restart = (ret_prop != NULL);
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 + +// 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); -#else - XRRSelectInput(disp, rootWindow().window(), - RRScreenChangeNotifyMask); -#endif // X_RRScreenChangeSelectInput +#endif // HAVE_RANDR -#endif // HAVE_RANDR _FB_USES_NLS;
M
src/fluxbox.cc
→
src/fluxbox.cc
@@ -84,7 +84,7 @@ // X extensions
#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 @@ ResultType (Type::*m_func)(ArgType);
}; +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 @@ m_showing_dialog(false),
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 @@
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 @@ if (xsync)
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 @@ handleClientMessage(e->xclient);
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 @@ STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
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; +} + + +
M
src/fluxbox.hh
→
src/fluxbox.hh
@@ -83,7 +83,7 @@ const std::string& rc_path, const std::string& rc_filename,
bool xsync = false); virtual ~Fluxbox(); - static Fluxbox *instance() { return s_singleton; } + static Fluxbox *instance(); /// main event loop void eventLoop();@@ -177,8 +177,8 @@
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 @@ bool m_showing_dialog;
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 @@ bool m_starting;
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; };
M
src/main.cc
→
src/main.cc
@@ -192,6 +192,15 @@ NOT <<
#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