using std::string;
#include "blackbox.hh"
-#include "gccache.hh"
-#include "image.hh"
+#include "otk/gccache.hh"
+#include "otk/image.hh"
+#include "otk/assassin.hh"
#include "screen.hh"
#include "util.hh"
#include "window.hh"
#include "workspace.hh"
#include "xatom.hh"
+namespace ob {
+
Blackbox *blackbox;
-Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc)
- : BaseDisplay(m_argv[0], dpy_name) {
+Blackbox::Blackbox(int argc, char **m_argv, char *rc)
+ : Openbox(argc, m_argv) {
if (! XSupportsLocale())
fprintf(stderr, "X server does not support locale\n");
if (XSetLocaleModifiers("") == NULL)
fprintf(stderr, "cannot set locale modifiers\n");
- ::blackbox = this;
+ ob::blackbox = this;
argv = m_argv;
// try to make sure the ~/.openbox directory exists
load_rc();
- xatom = new XAtom(getXDisplay());
+ xatom = new XAtom(otk::OBDisplay::display);
- cursor.session = XCreateFontCursor(getXDisplay(), XC_left_ptr);
- cursor.move = XCreateFontCursor(getXDisplay(), XC_fleur);
- cursor.ll_angle = XCreateFontCursor(getXDisplay(), XC_ll_angle);
- cursor.lr_angle = XCreateFontCursor(getXDisplay(), XC_lr_angle);
- cursor.ul_angle = XCreateFontCursor(getXDisplay(), XC_ul_angle);
- cursor.ur_angle = XCreateFontCursor(getXDisplay(), XC_ur_angle);
+ cursor.session = XCreateFontCursor(otk::OBDisplay::display, XC_left_ptr);
+ cursor.move = XCreateFontCursor(otk::OBDisplay::display, XC_fleur);
+ cursor.ll_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ll_angle);
+ cursor.lr_angle = XCreateFontCursor(otk::OBDisplay::display, XC_lr_angle);
+ cursor.ul_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ul_angle);
+ cursor.ur_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ur_angle);
- for (unsigned int i = 0; i < getNumberOfScreens(); i++) {
+ for (int i = 0; i < ScreenCount(otk::OBDisplay::display); i++) {
BScreen *screen = new BScreen(this, i);
if (! screen->isScreenManaged()) {
active_screen = screenList.front();
setFocusedWindow(0);
- XSynchronize(getXDisplay(), False);
- XSync(getXDisplay(), False);
+ XSynchronize(otk::OBDisplay::display, False);
+ XSync(otk::OBDisplay::display, False);
reconfigure_wait = False;
Blackbox::~Blackbox(void) {
- std::for_each(screenList.begin(), screenList.end(), PointerAssassin());
+ std::for_each(screenList.begin(), screenList.end(), otk::PointerAssassin());
delete xatom;
switch (e->type) {
case ButtonPress: {
// strip the lock key modifiers
- e->xbutton.state &= ~(NumLockMask | ScrollLockMask | LockMask);
+ //e->xbutton.state &= ~(NumLockMask | ScrollLockMask | LockMask);
last_time = e->xbutton.time;
case ButtonRelease: {
// strip the lock key modifiers
- e->xbutton.state &= ~(NumLockMask | ScrollLockMask | LockMask);
+ //e->xbutton.state &= ~(NumLockMask | ScrollLockMask | LockMask);
last_time = e->xbutton.time;
xwc.sibling = e->xconfigurerequest.above;
xwc.stack_mode = e->xconfigurerequest.detail;
- XConfigureWindow(getXDisplay(), e->xconfigurerequest.window,
+ XConfigureWindow(otk::OBDisplay::display, e->xconfigurerequest.window,
e->xconfigurerequest.value_mask, &xwc);
}
}
the window is on
*/
XWindowAttributes wattrib;
- if (! XGetWindowAttributes(getXDisplay(), e->xmaprequest.window,
+ if (! XGetWindowAttributes(otk::OBDisplay::display, e->xmaprequest.window,
&wattrib)) {
// failed to get the window attributes, perhaps the window has
// now been destroyed?
// motion notify compression...
XEvent realevent;
unsigned int i = 0;
- while (XCheckTypedWindowEvent(getXDisplay(), e->xmotion.window,
+ while (XCheckTypedWindowEvent(otk::OBDisplay::display, e->xmotion.window,
MotionNotify, &realevent)) {
i++;
}
break;
// strip the lock key modifiers
- e->xmotion.state &= ~(NumLockMask | ScrollLockMask | LockMask);
+ //e->xmotion.state &= ~(NumLockMask | ScrollLockMask | LockMask);
last_time = e->xmotion.time;
ey1 = e->xexpose.y;
ex2 = ex1 + e->xexpose.width - 1;
ey2 = ey1 + e->xexpose.height - 1;
- while (XCheckTypedWindowEvent(getXDisplay(), e->xexpose.window,
+ while (XCheckTypedWindowEvent(otk::OBDisplay::display, e->xexpose.window,
Expose, &realevent)) {
i++;
(the FocusIn event handler sets the window in the event
structure to None to indicate this).
*/
- if (XCheckTypedEvent(getXDisplay(), FocusIn, &event)) {
+ if (XCheckTypedEvent(otk::OBDisplay::display, FocusIn, &event)) {
process_event(&event);
if (event.xfocus.window == None) {
BlackboxWindow *focus;
Window w;
int revert;
- XGetInputFocus(getXDisplay(), &w, &revert);
+ XGetInputFocus(otk::OBDisplay::display, &w, &revert);
focus = searchWindow(w);
if (focus) {
/*
bool Blackbox::validateWindow(Window window) {
XEvent event;
- if (XCheckTypedWindowEvent(getXDisplay(), window, DestroyNotify, &event)) {
- XPutBackEvent(getXDisplay(), &event);
+ if (XCheckTypedWindowEvent(otk::OBDisplay::display, window, DestroyNotify, &event)) {
+ XPutBackEvent(otk::OBDisplay::display, &event);
return False;
}
// fall back in case the above execlp doesn't work
execvp(argv[0], argv);
- string name = basename(argv[0]);
+ string name = ::basename(argv[0]);
execvp(name.c_str(), argv);
}
void Blackbox::shutdown(void) {
- BaseDisplay::shutdown();
+ Openbox::shutdown();
- XSetInputFocus(getXDisplay(), PointerRoot, None, CurrentTime);
+ XSetInputFocus(otk::OBDisplay::display, PointerRoot, None, CurrentTime);
std::for_each(screenList.begin(), screenList.end(),
std::mem_fun(&BScreen::shutdown));
- XSync(getXDisplay(), False);
+ XSync(otk::OBDisplay::display, False);
}
resource.xinerama_placement = x;
config.setValue("session.xineramaSupport.windowPlacement",
resource.xinerama_placement);
- reconfigure(); // make sure all screens get this change
-}
-
+ reconfigure(); // make sure all screens get this
void Blackbox::saveXineramaMaximizing(bool x) {
resource.xinerama_maximize = x;
void Blackbox::reconfigure(void) {
// don't reconfigure while saving the initial rc file, it's a waste and it
// breaks somethings (workspace names)
- if (isStartup()) return;
+ if (state() == Openbox::State_Starting) return;
reconfigure_wait = True;
void Blackbox::real_reconfigure(void) {
load_rc();
- gcCache()->purge();
+ otk::OBDisplay::gcCache()->purge();
std::for_each(screenList.begin(), screenList.end(),
std::mem_fun(&BScreen::reconfigure));
if (! old_screen) {
if (active_screen) {
// set input focus to the toolbar of the screen with mouse
- XSetInputFocus(getXDisplay(),
+ XSetInputFocus(otk::OBDisplay::display,
active_screen->getRootWindow(),
RevertToPointerRoot, CurrentTime);
} else {
// set input focus to the toolbar of the first managed screen
- XSetInputFocus(getXDisplay(),
+ XSetInputFocus(otk::OBDisplay::display,
screenList.front()->getRootWindow(),
RevertToPointerRoot, CurrentTime);
}
} else {
// set input focus to the toolbar of the last screen
- XSetInputFocus(getXDisplay(), old_screen->getRootWindow(),
+ XSetInputFocus(otk::OBDisplay::display, old_screen->getRootWindow(),
RevertToPointerRoot, CurrentTime);
}
}
old_screen->updateNetizenWindowFocus();
}
}
+
+
+void Blackbox::addTimer(BTimer *timer) {
+ (void)timer;
+}
+
+
+void Blackbox::removeTimer(BTimer *timer) {
+ (void)timer;
+}
+
+
+}