X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fblackbox.cc;h=0e03e17817ebc9289f31b5d89bb8a95a92ad10da;hb=39bd954b8bf197fa08f73ffade953fe531463796;hp=ae3b5ead51865af7bff0b618ce94c300f3120f9b;hpb=17fbff7d7029924be0b0be538af02c074dc15270;p=chaz%2Fopenbox diff --git a/src/blackbox.cc b/src/blackbox.cc index ae3b5ead..0e03e178 100644 --- a/src/blackbox.cc +++ b/src/blackbox.cc @@ -282,16 +282,6 @@ void Blackbox::process_event(XEvent *e) { } case ConfigureRequest: { - // compress configure requests... - XEvent realevent; - unsigned int i = 0; - while(XCheckTypedWindowEvent(getXDisplay(), e->xconfigurerequest.window, - ConfigureRequest, &realevent)) { - i++; - } - if ( i > 0 ) - e = &realevent; - BlackboxWindow *win = (BlackboxWindow *) 0; Slit *slit = (Slit *) 0; @@ -338,7 +328,8 @@ void Blackbox::process_event(XEvent *e) { focus = True; } - if (focus && (win->isTransient() || win->getScreen()->doFocusNew())) + if (focus && (win->isTransient() || win->getScreen()->doFocusNew()) && + win->isVisible()) win->setInputFocus(); } else { BScreen *screen = searchScreen(e->xmaprequest.parent); @@ -384,8 +375,6 @@ void Blackbox::process_event(XEvent *e) { slit->unmapNotifyEvent(&e->xunmap); } else if ((screen = searchSystrayWindow(e->xunmap.window))) { screen->removeSystrayWindow(e->xunmap.window); - } else if ((screen = searchDesktopWindow(e->xunmap.window))) { - screen->removeDesktopWindow(e->xunmap.window); } break; @@ -405,8 +394,6 @@ void Blackbox::process_event(XEvent *e) { delete group; } else if ((screen = searchSystrayWindow(e->xunmap.window))) { screen->removeSystrayWindow(e->xunmap.window); - } else if ((screen = searchDesktopWindow(e->xunmap.window))) { - screen->removeDesktopWindow(e->xunmap.window); } break; @@ -443,8 +430,12 @@ void Blackbox::process_event(XEvent *e) { if ( i > 0 ) e = &realevent; + // the pointer is on the wrong screen + if (! e->xmotion.same_screen) + break; + // strip the lock key modifiers - e->xbutton.state &= ~(NumLockMask | ScrollLockMask | LockMask); + e->xmotion.state &= ~(NumLockMask | ScrollLockMask | LockMask); last_time = e->xmotion.time; @@ -462,9 +453,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; } @@ -490,8 +485,9 @@ void Blackbox::process_event(XEvent *e) { screen->getImageControl()->installRootColormap(); } else if ((win = searchWindow(e->xcrossing.window))) { if (win->getScreen()->isSloppyFocus() && - (! win->isFocused()) && (! no_focus)) { - if (((! sa.leave) || sa.inferior) && win->isVisible()) { + (! win->isFocused()) && (! no_focus) && + win->isNormal()) { // don't focus non-normal windows with mouseover + if ((! sa.leave || sa.inferior) && win->isVisible()) { if (win->setInputFocus()) win->installColormap(True); // XXX: shouldnt we honour no install? } @@ -701,17 +697,25 @@ void Blackbox::process_event(XEvent *e) { if (screen && workspace < screen->getWorkspaceCount()) screen->changeWorkspaceID(workspace); } else if (e->xclient.message_type == - xatom->getAtom(XAtom::blackbox_change_window_focus) || - e->xclient.message_type == + xatom->getAtom(XAtom::blackbox_change_window_focus)) { + // TEMP HACK TO KEEP BBKEYS WORKING + BlackboxWindow *win = searchWindow(e->xclient.window); + + if (win && win->isVisible() && win->setInputFocus()) + win->installColormap(True); + } else if (e->xclient.message_type == xatom->getAtom(XAtom::net_active_window)) { // NET_ACTIVE_WINDOW BlackboxWindow *win = searchWindow(e->xclient.window); if (win) { + BScreen *screen = win->getScreen(); + if (win->isIconic()) win->deiconify(False, True); - if (win->isShaded()) - win->shade(); + if (! win->isStuck() && + (win->getWorkspaceNumber() != screen->getCurrentWorkspaceID())) + screen->changeWorkspaceID(win->getWorkspaceNumber()); if (win->isVisible() && win->setInputFocus()) { win->getScreen()->getWorkspace(win->getWorkspaceNumber())-> raiseWindow(win); @@ -745,7 +749,8 @@ void Blackbox::process_event(XEvent *e) { else win->show(); screen->reassociateWindow(win, wksp, True); - } else if (wksp == 0xfffffffe) { // XXX: BUG, BUT DOING THIS SO KDE WORKS FOR NOW!! + } else if (wksp == 0xfffffffe || // XXX: BUG, BUT DOING THIS SO KDE WORKS FOR NOW!! + wksp == 0xffffffff) { if (win->isIconic()) win->deiconify(False, True); if (! win->isStuck()) win->stick(); if (! win->isVisible()) win->show(); @@ -771,22 +776,8 @@ void Blackbox::process_event(XEvent *e) { // NET_NUMBER_OF_DESKTOPS BScreen *screen = searchScreen(e->xclient.window); - if (e->xclient.data.l[0] > 0) { - if ((unsigned) e->xclient.data.l[0] < screen->getWorkspaceCount()) { - // shrink - for (int i = screen->getWorkspaceCount(); - i > e->xclient.data.l[0]; --i) - screen->removeLastWorkspace(); - // removeLast already sets the current workspace to the - // last available one. - } else if ((unsigned) e->xclient.data.l[0] > - screen->getWorkspaceCount()) { - // grow - for(int i = screen->getWorkspaceCount(); - i < e->xclient.data.l[0]; ++i) - screen->addWorkspace(); - } - } + if (e->xclient.data.l[0] > 0) + screen->changeWorkspaceCount((unsigned) e->xclient.data.l[0]); } else if (e->xclient.message_type == xatom->getAtom(XAtom::net_close_window)) { // NET_CLOSE_WINDOW @@ -974,11 +965,11 @@ void Blackbox::process_event(XEvent *e) { bool Blackbox::handleSignal(int sig) { switch (sig) { case SIGHUP: - restart(); + reconfigure(); break; case SIGUSR1: - reconfigure(); + restart(); break; case SIGUSR2: @@ -1025,15 +1016,6 @@ BScreen *Blackbox::searchScreen(Window window) { } -BScreen *Blackbox::searchDesktopWindow(Window window) { - WindowScreenLookup::iterator it = desktopSearchList.find(window); - if (it != desktopSearchList.end()) - return it->second; - - return (BScreen*) 0; -} - - BScreen *Blackbox::searchSystrayWindow(Window window) { WindowScreenLookup::iterator it = systraySearchList.find(window); if (it != systraySearchList.end()) @@ -1088,11 +1070,6 @@ Slit *Blackbox::searchSlit(Window window) { } -void Blackbox::saveDesktopWindowSearch(Window window, BScreen *screen) { - desktopSearchList.insert(WindowScreenLookupPair(window, screen)); -} - - void Blackbox::saveSystrayWindowSearch(Window window, BScreen *screen) { systraySearchList.insert(WindowScreenLookupPair(window, screen)); } @@ -1123,11 +1100,6 @@ void Blackbox::saveSlitSearch(Window window, Slit *data) { } -void Blackbox::removeDesktopWindowSearch(Window window) { - desktopSearchList.erase(window); -} - - void Blackbox::removeSystrayWindowSearch(Window window) { systraySearchList.erase(window); } @@ -1186,6 +1158,32 @@ void Blackbox::shutdown(void) { } +#ifdef XINERAMA +void Blackbox::saveXineramaPlacement(bool x) { + resource.xinerama_placement = x; + config.setValue("session.xineramaSupport.windowPlacement", + resource.xinerama_placement); + reconfigure(); // make sure all screens get this change +} + + +void Blackbox::saveXineramaMaximizing(bool x) { + resource.xinerama_maximize = x; + config.setValue("session.xineramaSupport.windowMaximizing", + resource.xinerama_maximize); + reconfigure(); // make sure all screens get this change +} + + +void Blackbox::saveXineramaSnapping(bool x) { + resource.xinerama_snap = x; + config.setValue("session.xineramaSupport.windowSnapping", + resource.xinerama_snap); + reconfigure(); // make sure all screens get this change +} +#endif // XINERAMA + + /* * Save all values as they are so that the defaults will be written to the rc * file @@ -1204,6 +1202,12 @@ void Blackbox::save_rc(void) { config.setValue("session.styleFile", resource.style_file); config.setValue("session.titlebarLayout", resource.titlebar_layout); +#ifdef XINERAMA + saveXineramaPlacement(resource.xinerama_placement); + saveXineramaMaximizing(resource.xinerama_maximize); + saveXineramaSnapping(resource.xinerama_snap); +#endif // XINERAMA + std::for_each(screenList.begin(), screenList.end(), std::mem_fun(&BScreen::save_rc)); @@ -1250,10 +1254,28 @@ void Blackbox::load_rc(void) { if (! config.getValue("session.titlebarLayout", resource.titlebar_layout)) resource.titlebar_layout = "ILMC"; + +#ifdef XINERAMA + if (! config.getValue("session.xineramaSupport.windowPlacement", + resource.xinerama_placement)) + resource.xinerama_placement = false; + + if (! config.getValue("session.xineramaSupport.windowMaximizing", + resource.xinerama_maximize)) + resource.xinerama_maximize = false; + + if (! config.getValue("session.xineramaSupport.windowSnapping", + resource.xinerama_snap)) + resource.xinerama_snap = false; +#endif // XINERAMA } 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; + reconfigure_wait = True; if (! timer->isTiming()) timer->start();