X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fblackbox.cc;h=3ec32d5208d5d1da86f47774c9ac2b54b1916d83;hb=90dbcb271c5e6d7ca73c19a519b93885b833db0a;hp=0865b681f6e50fb1ed330294ea55c1f3a6925d4b;hpb=e15e4a9e03dd7b64004b76ca84b07c12c251f67b;p=chaz%2Fopenbox diff --git a/src/blackbox.cc b/src/blackbox.cc index 0865b681..3ec32d52 100644 --- a/src/blackbox.cc +++ b/src/blackbox.cc @@ -145,6 +145,12 @@ Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu) ::blackbox = this; argv = m_argv; + + // try to make sure the ~/.openbox directory exists + mkdir(expandTilde("~/.openbox").c_str(), S_IREAD | S_IWRITE | S_IEXEC | + S_IRGRP | S_IWGRP | S_IXGRP | + S_IROTH | S_IWOTH | S_IXOTH); + if (! rc) rc = "~/.openbox/rc"; rc_file = expandTilde(rc); config.setFile(rc_file); @@ -158,7 +164,6 @@ Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu) active_screen = 0; focused_window = changing_window = (BlackboxWindow *) 0; - XrmInitialize(); load_rc(); xatom = new XAtom(getXDisplay()); @@ -323,10 +328,18 @@ void Blackbox::process_event(XEvent *e) { BlackboxWindow *win = searchWindow(e->xmaprequest.window); if (win) { + bool focus = False; if (win->isIconic()) { win->deiconify(); - win->setInputFocus(); + focus = True; } + if (win->isShaded()) { + win->shade(); + focus = True; + } + + if (focus && (win->isTransient() || win->getScreen()->doFocusNew())) + win->setInputFocus(); } else { BScreen *screen = searchScreen(e->xmaprequest.parent); @@ -449,9 +462,13 @@ void Blackbox::process_event(XEvent *e) { case PropertyNotify: { last_time = e->xproperty.time; - BlackboxWindow *win = searchWindow(e->xproperty.window); - if (win) + BlackboxWindow *win = (BlackboxWindow *) 0; + BScreen *screen = (BScreen *) 0; + + if ((win = searchWindow(e->xproperty.window))) win->propertyNotifyEvent(&e->xproperty); + else if ((screen = searchScreen(e->xproperty.window))) + screen->propertyNotifyEvent(&e->xproperty); break; } @@ -697,9 +714,11 @@ void Blackbox::process_event(XEvent *e) { if (win) { if (win->isIconic()) win->deiconify(False, True); + if (win->isShaded()) + win->shade(); if (win->isVisible() && win->setInputFocus()) { - //win->getScreen()->getWorkspace(win->getWorkspaceNumber())-> - // raiseWindow(win); + win->getScreen()->getWorkspace(win->getWorkspaceNumber())-> + raiseWindow(win); win->installColormap(True); } } @@ -959,6 +978,9 @@ void Blackbox::process_event(XEvent *e) { bool Blackbox::handleSignal(int sig) { switch (sig) { case SIGHUP: + restart(); + break; + case SIGUSR1: reconfigure(); break; @@ -1196,7 +1218,7 @@ void Blackbox::save_rc(void) { void Blackbox::load_rc(void) { if (! config.load()) - config.create(); + config.create(); string s;