X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fblackbox.cc;h=6bd47f9c4fee61fdf6e7eacb49d4fdac5737b729;hb=cac80d06ef93fac0b4d39ec28fada1076f5bf28d;hp=6af1d2d3181cd6b70d0b8c2cefa599d0ef578b88;hpb=888c0bac90d4932d00dd7f7447ea52117aff6de0;p=chaz%2Fopenbox diff --git a/src/blackbox.cc b/src/blackbox.cc index 6af1d2d3..6bd47f9c 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()); @@ -322,7 +327,20 @@ void Blackbox::process_event(XEvent *e) { BlackboxWindow *win = searchWindow(e->xmaprequest.window); - if (! win) { + if (win) { + bool focus = False; + if (win->isIconic()) { + win->deiconify(); + 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); if (! screen) { @@ -444,13 +462,9 @@ void Blackbox::process_event(XEvent *e) { case PropertyNotify: { last_time = e->xproperty.time; - if (e->xproperty.state != PropertyDelete) { - BlackboxWindow *win = searchWindow(e->xproperty.window); - - if (win) - win->propertyNotifyEvent(e->xproperty.atom); - } - + BlackboxWindow *win = searchWindow(e->xproperty.window); + if (win) + win->propertyNotifyEvent(&e->xproperty); break; } @@ -958,6 +972,9 @@ void Blackbox::process_event(XEvent *e) { bool Blackbox::handleSignal(int sig) { switch (sig) { case SIGHUP: + restart(); + break; + case SIGUSR1: reconfigure(); break; @@ -1195,7 +1212,7 @@ void Blackbox::save_rc(void) { void Blackbox::load_rc(void) { if (! config.load()) - config.create(); + config.create(); string s;