diff options
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r-- | src/fluxbox.cc | 49 |
1 files changed, 33 insertions, 16 deletions
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 | |||