diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2012-12-12 09:18:20 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2012-12-12 09:18:20 (GMT) |
commit | 4191cbf2d2a71a5aeae41d54a5638abfc4789122 (patch) | |
tree | ea647d0fb35362b432653d0fc098ec8c22412dd4 | |
parent | d8cd6a928b76dbe63afa82327c51715cb1a1bdc8 (diff) | |
download | fluxbox-4191cbf2d2a71a5aeae41d54a5638abfc4789122.zip fluxbox-4191cbf2d2a71a5aeae41d54a5638abfc4789122.tar.bz2 |
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'
-rw-r--r-- | configure.in | 64 | ||||
-rw-r--r-- | src/Screen.cc | 29 | ||||
-rw-r--r-- | src/fluxbox.cc | 49 | ||||
-rw-r--r-- | src/fluxbox.hh | 13 | ||||
-rw-r--r-- | 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",[ | |||
445 | 445 | ||
446 | 446 | ||
447 | dnl Check for RANDR support and proper library files. | 447 | dnl Check for RANDR support and proper library files. |
448 | enableval="yes" | 448 | |
449 | AC_MSG_CHECKING([whether to build support for the Xrandr (X resize and rotate) extension]) | 449 | AC_MSG_CHECKING([whether to build support for the XRANDR (X Resize And Rotate) extension]) |
450 | AC_ARG_ENABLE(randr, | 450 | AC_ARG_ENABLE(randr, |
451 | AS_HELP_STRING([--enable-randr], [enable support of the Xrandr extension (default=yes)]),, [enableval=yes]) | 451 | AS_HELP_STRING([--enable-randr], [XRANDR extension support (default=no)]),,[enable_randr=yes]) |
452 | 452 | ||
453 | AS_IF(test "x$enable_randr" = "xyes",[ | 453 | AS_IF(test "x$enable_randr" = "xyes", [ |
454 | AC_CHECK_LIB(Xrandr, XRRQueryExtension, | 454 | AC_MSG_RESULT([yes]) |
455 | AC_CHECK_LIB(Xrandr, XRRQueryExtension, [ | ||
455 | AC_MSG_CHECKING([for X11/extensions/Xrandr.h]) | 456 | AC_MSG_CHECKING([for X11/extensions/Xrandr.h]) |
456 | AC_TRY_COMPILE( | 457 | AC_COMPILE_IFELSE([ |
457 | #include <X11/Xlib.h> | 458 | AC_LANG_PROGRAM([[#include <X11/Xlib.h> |
458 | #include <X11/Xutil.h> | 459 | #include <X11/Xutil.h> |
459 | #include <X11/extensions/Xrandr.h> | 460 | #include <X11/extensions/Xrandr.h> |
460 | , XRRQueryExtension(0, 0, 0), | 461 | ]], [[XRRQueryExtension(0, 0, 0);]] |
461 | AC_MSG_RESULT([yes]) | 462 | )], [ |
462 | AC_DEFINE(HAVE_RANDR, [1], [Define to 1 if you have RANDR]) | 463 | AC_MSG_RESULT([yes]) |
463 | LIBS="-lXrandr $LIBS", | 464 | AC_DEFINE(HAVE_RANDR, [1], [Define to 1 if you have RANDR]) |
464 | AC_MSG_RESULT([no])))],[ | 465 | LIBS="-lXrandr $LIBS" |
465 | AC_MSG_RESULT([no]) | 466 | FEATURES="$FEATURES RANDR" |
466 | CONFIGOPTS="$CONFIGOPTS --disable-randr"]) | 467 | |
467 | 468 | AC_MSG_CHECKING([for XRRUpdateConfiguration]) | |
468 | 469 | AC_COMPILE_IFELSE([ | |
469 | AC_MSG_CHECKING([whether to have RANDR 1.2 support]) | 470 | AC_LANG_PROGRAM([[#include <X11/Xlib.h> |
470 | AC_ARG_ENABLE(randr12, | ||
471 | AS_HELP_STRING([--enable-randr12], [RANDR 1.2 support (default=yes)]), , [enable_randr12=yes]) | ||
472 | AS_IF(test "x$enable_randr12" = "xyes",[ | ||
473 | AC_MSG_RESULT([yes]) | ||
474 | AC_CHECK_LIB(Xrandr, XRRQueryExtension, | ||
475 | AC_MSG_CHECKING([for X11/extensions/Xrandr.h]) | ||
476 | AC_TRY_COMPILE( | ||
477 | #include <X11/Xlib.h> | ||
478 | #include <X11/Xutil.h> | 471 | #include <X11/Xutil.h> |
479 | #include <X11/extensions/Xrandr.h> | 472 | #include <X11/extensions/Xrandr.h> |
480 | , XRRUpdateConfiguration(0), | 473 | ]], [[XRRUpdateConfiguration(0);]] |
481 | AC_MSG_RESULT([yes]) | 474 | )], [ |
482 | AC_DEFINE(HAVE_RANDR1_2, [1], [Define to 1 if you have RANDR 1.2]) | 475 | AC_MSG_RESULT([yes]) |
483 | LIBS="-lXrandr $LIBS", | 476 | AC_DEFINE(HAVE_RANDR1_2, [1], [Define to 1 if you have RANDR 1.2]) |
484 | AC_MSG_RESULT([no])))],[ | 477 | ], [ |
478 | AC_MSG_RESULT([no]) | ||
479 | ]) | ||
480 | ], [ | ||
481 | AC_MSG_RESULT([no]) | ||
482 | ]) | ||
483 | ],[ | ||
484 | AC_MSG_RESULT([no]) | ||
485 | ])],[ | ||
485 | AC_MSG_RESULT([no]) | 486 | AC_MSG_RESULT([no]) |
486 | CONFIGOPTS="$CONFIGOPTS --disable-randr1.2"]) | 487 | CONFIGOPTS="$CONFIGOPTS --disable-randr"]) |
488 | |||
487 | 489 | ||
488 | 490 | ||
489 | 491 | ||
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" { | |||
132 | } | 132 | } |
133 | #endif // XINERAMA | 133 | #endif // XINERAMA |
134 | 134 | ||
135 | #ifdef HAVE_RANDR | 135 | #if defined(HAVE_RANDR) || defined(HAVE_RANDR1_2) |
136 | #include <X11/extensions/Xrandr.h> | 136 | #include <X11/extensions/Xrandr.h> |
137 | #endif // HAVE_RANDR | 137 | #endif // HAVE_RANDR |
138 | 138 | ||
@@ -380,19 +380,26 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
380 | XFree(ret_prop); | 380 | XFree(ret_prop); |
381 | } | 381 | } |
382 | 382 | ||
383 | #ifdef HAVE_RANDR | ||
384 | // setup RANDR for this screens root window | ||
385 | // we need to determine if we should use old randr select input function or not | ||
386 | #ifdef X_RRScreenChangeSelectInput | ||
387 | // use old set randr event | ||
388 | XRRScreenChangeSelectInput(disp, rootWindow().window(), True); | ||
389 | #else | ||
390 | XRRSelectInput(disp, rootWindow().window(), | ||
391 | RRScreenChangeNotifyMask); | ||
392 | #endif // X_RRScreenChangeSelectInput | ||
393 | 383 | ||
384 | // setup RANDR for this screens root window | ||
385 | #if defined(HAVE_RANDR1_2) | ||
386 | int randr_mask = RRScreenChangeNotifyMask; | ||
387 | #ifdef RRCrtcChangeNotifyMask | ||
388 | randr_mask |= RRCrtcChangeNotifyMask; | ||
389 | #endif | ||
390 | #ifdef RROutputChangeNotifyMask | ||
391 | randr_mask |= RROutputChangeNotifyMask; | ||
392 | #endif | ||
393 | #ifdef RROutputPropertyNotifyMask | ||
394 | randr_mask |= RROutputPropertyNotifyMask; | ||
395 | #endif | ||
396 | XRRSelectInput(disp, rootWindow().window(), randr_mask); | ||
397 | |||
398 | #elif defined(HAVE_RANDR) | ||
399 | XRRScreenChangeSelectInput(disp, rootWindow().window(), True); | ||
394 | #endif // HAVE_RANDR | 400 | #endif // HAVE_RANDR |
395 | 401 | ||
402 | |||
396 | _FB_USES_NLS; | 403 | _FB_USES_NLS; |
397 | 404 | ||
398 | #ifdef DEBUG | 405 | #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 @@ | |||
84 | #ifdef SHAPE | 84 | #ifdef SHAPE |
85 | #include <X11/extensions/shape.h> | 85 | #include <X11/extensions/shape.h> |
86 | #endif // SHAPE | 86 | #endif // SHAPE |
87 | #ifdef HAVE_RANDR | 87 | #if defined(HAVE_RANDR) || defined(HAVE_RANDR1_2) |
88 | #include <X11/extensions/Xrandr.h> | 88 | #include <X11/extensions/Xrandr.h> |
89 | #endif // HAVE_RANDR | 89 | #endif // HAVE_RANDR |
90 | 90 | ||
@@ -218,10 +218,17 @@ struct CallMemFunWithRefArg : std::unary_function<Type, ResultType> { | |||
218 | }; | 218 | }; |
219 | 219 | ||
220 | 220 | ||
221 | int s_randr_event_type = 0; ///< the type number of randr event | ||
222 | int s_shape_eventbase = 0; ///< event base for shape events | ||
223 | bool s_have_shape = false ; ///< if shape is supported by server | ||
224 | |||
225 | Atom s_kwm1_dockwindow; | ||
226 | Atom s_kwm2_dockwindow; | ||
227 | |||
228 | Fluxbox* s_singleton = 0; | ||
229 | |||
221 | } // end anonymous | 230 | } // end anonymous |
222 | 231 | ||
223 | //static singleton var | ||
224 | Fluxbox *Fluxbox::s_singleton=0; | ||
225 | 232 | ||
226 | Fluxbox::Fluxbox(int argc, char **argv, | 233 | Fluxbox::Fluxbox(int argc, char **argv, |
227 | const std::string& dpy_name, | 234 | const std::string& dpy_name, |
@@ -261,8 +268,7 @@ Fluxbox::Fluxbox(int argc, char **argv, | |||
261 | m_starting(true), | 268 | m_starting(true), |
262 | m_restarting(false), | 269 | m_restarting(false), |
263 | m_shutdown(false), | 270 | m_shutdown(false), |
264 | m_server_grabs(0), | 271 | m_server_grabs(0) { |
265 | m_randr_event_type(0) { | ||
266 | 272 | ||
267 | _FB_USES_NLS; | 273 | _FB_USES_NLS; |
268 | if (s_singleton != 0) | 274 | if (s_singleton != 0) |
@@ -277,10 +283,10 @@ Fluxbox::Fluxbox(int argc, char **argv, | |||
277 | Display *disp = FbTk::App::instance()->display(); | 283 | Display *disp = FbTk::App::instance()->display(); |
278 | // For KDE dock applets | 284 | // For KDE dock applets |
279 | // KDE v1.x | 285 | // KDE v1.x |
280 | m_kwm1_dockwindow = XInternAtom(disp, | 286 | s_kwm1_dockwindow = XInternAtom(disp, |
281 | "KWM_DOCKWINDOW", False); | 287 | "KWM_DOCKWINDOW", False); |
282 | // KDE v2.x | 288 | // KDE v2.x |
283 | m_kwm2_dockwindow = XInternAtom(disp, | 289 | s_kwm2_dockwindow = XInternAtom(disp, |
284 | "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False); | 290 | "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False); |
285 | // setup X error handler | 291 | // setup X error handler |
286 | XSetErrorHandler((XErrorHandler) handleXErrors); | 292 | XSetErrorHandler((XErrorHandler) handleXErrors); |
@@ -314,21 +320,18 @@ Fluxbox::Fluxbox(int argc, char **argv, | |||
314 | XSynchronize(disp, True); | 320 | XSynchronize(disp, True); |
315 | 321 | ||
316 | s_singleton = this; | 322 | s_singleton = this; |
317 | m_have_shape = false; | 323 | |
318 | m_shape_eventbase = 0; | ||
319 | #ifdef SHAPE | 324 | #ifdef SHAPE |
320 | int shape_err; | 325 | int shape_err; |
321 | m_have_shape = XShapeQueryExtension(disp, &m_shape_eventbase, &shape_err); | 326 | s_have_shape = XShapeQueryExtension(disp, &s_shape_eventbase, &shape_err); |
322 | #endif // SHAPE | 327 | #endif // SHAPE |
323 | 328 | ||
324 | #ifdef HAVE_RANDR | 329 | #if defined(HAVE_RANDR) || defined(HAVE_RANDR1_2) |
325 | // get randr event type | ||
326 | int randr_error_base; | 330 | int randr_error_base; |
327 | XRRQueryExtension(disp, &m_randr_event_type, &randr_error_base); | 331 | XRRQueryExtension(disp, &s_randr_event_type, &randr_error_base); |
328 | #endif // HAVE_RANDR | 332 | #endif // HAVE_RANDR |
329 | 333 | ||
330 | load_rc(); | 334 | load_rc(); |
331 | |||
332 | grab(); | 335 | grab(); |
333 | 336 | ||
334 | if (! XSupportsLocale()) | 337 | if (! XSupportsLocale()) |
@@ -796,8 +799,8 @@ void Fluxbox::handleEvent(XEvent * const e) { | |||
796 | break; | 799 | break; |
797 | default: { | 800 | default: { |
798 | 801 | ||
799 | #ifdef HAVE_RANDR | 802 | #if defined(HAVE_RANDR) || defined(HAVE_RANDR1_2) |
800 | if (e->type == m_randr_event_type) { | 803 | if (e->type == s_randr_event_type) { |
801 | #ifdef HAVE_RANDR1_2 | 804 | #ifdef HAVE_RANDR1_2 |
802 | XRRUpdateConfiguration(e); | 805 | XRRUpdateConfiguration(e); |
803 | #endif | 806 | #endif |
@@ -1400,3 +1403,17 @@ void Fluxbox::workspaceAreaChanged(BScreen &screen) { | |||
1400 | CallMemFunWithRefArg<AtomHandler, BScreen&, void>(&AtomHandler::updateWorkarea, screen)); | 1403 | CallMemFunWithRefArg<AtomHandler, BScreen&, void>(&AtomHandler::updateWorkarea, screen)); |
1401 | } | 1404 | } |
1402 | 1405 | ||
1406 | bool Fluxbox::haveShape() const { | ||
1407 | return s_have_shape; | ||
1408 | } | ||
1409 | |||
1410 | int Fluxbox::shapeEventbase() const { | ||
1411 | return s_shape_eventbase; | ||
1412 | } | ||
1413 | |||
1414 | Fluxbox* Fluxbox::instance() { | ||
1415 | return s_singleton; | ||
1416 | } | ||
1417 | |||
1418 | |||
1419 | |||
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: | |||
83 | bool xsync = false); | 83 | bool xsync = false); |
84 | virtual ~Fluxbox(); | 84 | virtual ~Fluxbox(); |
85 | 85 | ||
86 | static Fluxbox *instance() { return s_singleton; } | 86 | static Fluxbox *instance(); |
87 | 87 | ||
88 | /// main event loop | 88 | /// main event loop |
89 | void eventLoop(); | 89 | void eventLoop(); |
@@ -177,8 +177,8 @@ public: | |||
177 | typedef std::list<BScreen *> ScreenList; | 177 | typedef std::list<BScreen *> ScreenList; |
178 | const ScreenList screenList() const { return m_screen_list; } | 178 | const ScreenList screenList() const { return m_screen_list; } |
179 | 179 | ||
180 | bool haveShape() const { return m_have_shape; } | 180 | bool haveShape() const; |
181 | int shapeEventbase() const { return m_shape_eventbase; } | 181 | int shapeEventbase() const; |
182 | std::string getDefaultDataFilename(const char *name) const; | 182 | std::string getDefaultDataFilename(const char *name) const; |
183 | // screen mouse was in at last key event | 183 | // screen mouse was in at last key event |
184 | BScreen *mouseScreen() { return m_mousescreen; } | 184 | BScreen *mouseScreen() { return m_mousescreen; } |
@@ -285,9 +285,6 @@ private: | |||
285 | 285 | ||
286 | std::auto_ptr<Keys> m_key; | 286 | std::auto_ptr<Keys> m_key; |
287 | 287 | ||
288 | //default arguments for titlebar left and right | ||
289 | static Fluxbox *s_singleton; | ||
290 | |||
291 | typedef std::set<AtomHandler *> AtomHandlerContainer; | 288 | typedef std::set<AtomHandler *> AtomHandlerContainer; |
292 | typedef AtomHandlerContainer::iterator AtomHandlerContainerIt; | 289 | typedef AtomHandlerContainer::iterator AtomHandlerContainerIt; |
293 | 290 | ||
@@ -297,10 +294,6 @@ private: | |||
297 | bool m_restarting; | 294 | bool m_restarting; |
298 | bool m_shutdown; | 295 | bool m_shutdown; |
299 | int m_server_grabs; | 296 | int m_server_grabs; |
300 | int m_randr_event_type; ///< the type number of randr event | ||
301 | int m_shape_eventbase; ///< event base for shape events | ||
302 | bool m_have_shape; ///< if shape is supported by server | ||
303 | Atom m_kwm1_dockwindow, m_kwm2_dockwindow; | ||
304 | 297 | ||
305 | AttentionNoticeHandler m_attention_handler; | 298 | AttentionNoticeHandler m_attention_handler; |
306 | }; | 299 | }; |
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) { | |||
192 | #endif // USE_TOOLBAR | 192 | #endif // USE_TOOLBAR |
193 | "TOOLBAR" << endl << | 193 | "TOOLBAR" << endl << |
194 | 194 | ||
195 | #ifndef HAVE_RANDR | ||
196 | NOT << | ||
197 | #endif | ||
198 | "RANDR" << | ||
199 | #ifdef HAVE_RANDR1_2 | ||
200 | "1.2" << | ||
201 | #endif | ||
202 | endl << | ||
203 | |||
195 | #ifndef USE_XFT | 204 | #ifndef USE_XFT |
196 | NOT << | 205 | NOT << |
197 | #endif // USE_XFT | 206 | #endif // USE_XFT |