From 4191cbf2d2a71a5aeae41d54a5638abfc4789122 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Wed, 12 Dec 2012 10:18:20 +0100 Subject: 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' --- configure.in | 64 ++++++++++++++++++++++++++++++---------------------------- src/Screen.cc | 29 ++++++++++++++++---------- src/fluxbox.cc | 49 +++++++++++++++++++++++++++++--------------- src/fluxbox.hh | 13 +++--------- src/main.cc | 9 +++++++++ 5 files changed, 96 insertions(+), 68 deletions(-) diff --git a/configure.in b/configure.in index b20bf9b..e3ee2aa 100644 --- a/configure.in +++ b/configure.in @@ -445,45 +445,47 @@ 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_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 + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[#include #include #include - , 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"]) - - -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 + ]], [[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([for XRRUpdateConfiguration]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[#include #include #include - , 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"]) + diff --git a/src/Screen.cc b/src/Screen.cc index 0d1923b..7992a19 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -132,7 +132,7 @@ extern "C" { } #endif // XINERAMA -#ifdef HAVE_RANDR +#if defined(HAVE_RANDR) || defined(HAVE_RANDR1_2) #include #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 diff --git a/src/fluxbox.cc b/src/fluxbox.cc index c144630..7dd0c4c 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -84,7 +84,7 @@ #ifdef SHAPE #include #endif // SHAPE -#ifdef HAVE_RANDR +#if defined(HAVE_RANDR) || defined(HAVE_RANDR1_2) #include #endif // HAVE_RANDR @@ -218,10 +218,17 @@ struct CallMemFunWithRefArg : std::unary_function { }; +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::updateWorkarea, screen)); } +bool Fluxbox::haveShape() const { + return s_have_shape; +} + +int Fluxbox::shapeEventbase() const { + return s_shape_eventbase; +} + +Fluxbox* Fluxbox::instance() { + return s_singleton; +} + + + diff --git a/src/fluxbox.hh b/src/fluxbox.hh index d1e8e93..35c1649 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -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 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 m_key; - //default arguments for titlebar left and right - static Fluxbox *s_singleton; - typedef std::set 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; }; diff --git a/src/main.cc b/src/main.cc index c93aabf..74a3373 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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 -- cgit v0.11.2