all repos — openbox @ 551a17d2563679eb6ef7c650f1384ee7e48dbc29

openbox fork - make it a bit more like ryudo

Fix send to menu, having deleted workspaces in it.
Fix workspace warping, move the mouse and window the same amount.
Fix workspace switching. Put old code back that worked better.
Dana Jansens danakj@orodu.net
commit

551a17d2563679eb6ef7c650f1384ee7e48dbc29

parent

2d114880692ce90eb5c8acdc1d07d2098cc3f1fc

M CHANGELOGCHANGELOG

@@ -1,5 +1,16 @@

Changelog for Openbox: +2.0.1: + * Fix SendTo menus. They would keep workspaces that + had been deleted. (Ben Jansens) + + * Fixes for workspace switching. Putting old code (Ben Jansens) + back. + + * Fixes for workspace warping. Window and mouse would (Ben Jansens) + move slightly out of sync, as one motion event would + get dropped. + 2.0.0: * Add an rc option (modiferMask) to allow changing (Ben Jansens) which modifier combo Openbox uses for mouse
M src/Screen.ccsrc/Screen.cc

@@ -1186,19 +1186,37 @@

void BScreen::changeWorkspaceID(unsigned int id) { if (! current_workspace || id == current_workspace->getID()) return; - current_workspace->hide(); + BlackboxWindow *focused = blackbox->getFocusedWindow(); + if (focused && focused->getScreen() == this) { + assert(focused->isStuck() || + focused->getWorkspaceNumber() == current_workspace->getID()); + current_workspace->setLastFocusedWindow(focused); + } else { + // if no window had focus, no need to store a last focus + current_workspace->setLastFocusedWindow((BlackboxWindow *) 0); + } + + // when we switch workspaces, unfocus whatever was focused + blackbox->setFocusedWindow((BlackboxWindow *) 0); + + current_workspace->hideAll(); workspacemenu->setItemSelected(current_workspace->getID() + 2, False); current_workspace = getWorkspace(id); - current_workspace->show(); - xatom->setValue(getRootWindow(), XAtom::net_current_desktop, XAtom::cardinal, id); workspacemenu->setItemSelected(current_workspace->getID() + 2, True); toolbar->redrawWorkspaceLabel(True); + + current_workspace->showAll(); + + if (resource.focus_last && current_workspace->getLastFocusedWindow()) { + XSync(blackbox->getXDisplay(), False); + current_workspace->getLastFocusedWindow()->setInputFocus(); + } updateNetizenCurrentWorkspace(); }
M src/Window.ccsrc/Window.cc

@@ -3058,10 +3058,6 @@ int dx = x_root - frame.grab_x, dy = y_root - frame.grab_y;

dx -= frame.border_w; dy -= frame.border_w; - if (screen->doWorkspaceWarping()) - if (doWorkspaceWarping(x_root, y_root, dx, dy)) - return; - doWindowSnapping(dx, dy); if (screen->doOpaqueMove()) {

@@ -3084,12 +3080,15 @@ frame.changing.width() - 1,

frame.changing.height() - 1); } + if (screen->doWorkspaceWarping()) + doWorkspaceWarping(x_root, y_root, dx, dy); + screen->showPosition(dx, dy); } -bool BlackboxWindow::doWorkspaceWarping(int x_root, int y_root, - int dx, int dy) { +void BlackboxWindow::doWorkspaceWarping(int x_root, int y_root, + int &dx, int dy) { // workspace warping bool warp = False; unsigned int dest = screen->getCurrentWorkspaceID();

@@ -3106,7 +3105,7 @@ if (dest < screen->getNumberOfWorkspaces() - 1) dest++;

else dest = 0; } if (! warp) - return false; + return; endMove(); bool focus = flags.focused; // had focus while moving?

@@ -3116,6 +3115,15 @@ screen->changeWorkspaceID(dest);

if (focus) setInputFocus(); + int dest_x; + if (x_root <= 0) { + dest_x = screen->getRect().right() - 1; + dx += screen->getRect().width() - 1; + } else { + dest_x = 0; + dx -= screen->getRect().width() - 1; + } + /* We grab the X server here because we are moving the window and then the mouse cursor. When one moves, it could end up putting the mouse cursor

@@ -3123,23 +3131,15 @@ over another window for a moment. This can cause the warp to iniate a

move on another window. */ XGrabServer(blackbox->getXDisplay()); - int dest_x; - if (x_root <= 0) { - dest_x = screen->getRect().right() - 1; - configure(dx + (screen->getRect().width() - 1), dy, - frame.rect.width(), frame.rect.height()); - } else { - dest_x = 0; - configure(dx - (screen->getRect().width() - 1), dy, - frame.rect.width(), frame.rect.height()); - } + + configure(dx, dy, frame.rect.width(), frame.rect.height()); XWarpPointer(blackbox->getXDisplay(), None, screen->getRootWindow(), 0, 0, 0, 0, dest_x, y_root); + XUngrabServer(blackbox->getXDisplay()); beginMove(dest_x, y_root); - return true; }
M src/Window.hhsrc/Window.hh

@@ -296,7 +296,7 @@ void setAllowedActions(void);

void setState(unsigned long new_state); void upsize(void); void doMove(int x_root, int y_root); - bool doWorkspaceWarping(int x_root, int y_root, int dx, int dy); + void doWorkspaceWarping(int x_root, int y_root, int &dx, int dy); void doWindowSnapping(int &dx, int &dy); void endMove(void); void doResize(int x_root, int y_root);
M src/Windowmenu.ccsrc/Windowmenu.cc

@@ -182,9 +182,8 @@

void Windowmenu::SendtoWorkspacemenu::update(void) { unsigned int i, r = getCount(), workspace_count = getScreen()->getWorkspaceCount(); - if (r > workspace_count) { - for (i = r; i < workspace_count; ++i) - remove(0); + while (r > workspace_count) { + remove(0); r = getCount(); }
M src/Workspace.ccsrc/Workspace.cc

@@ -225,6 +225,36 @@ while (! windowList.empty())

windowList.front()->iconify(); } +void Workspace::showAll(void) { + BlackboxWindowList::iterator it = stackingList.begin(); + const BlackboxWindowList::iterator end = stackingList.end(); + for (; it != end; ++it) { + BlackboxWindow *bw = *it; + // not normal windows cant focus from mouse enters anyways, so we dont + // need to unmap/remap them on workspace changes + if (! bw->isStuck() || bw->isNormal()) + bw->show(); + } +} + + +void Workspace::hideAll(void) { + // withdraw in reverse order to minimize the number of Expose events + + BlackboxWindowList lst(stackingList.rbegin(), stackingList.rend()); + + BlackboxWindowList::iterator it = lst.begin(); + const BlackboxWindowList::iterator end = lst.end(); + for (; it != end; ++it) { + BlackboxWindow *bw = *it; + // not normal windows cant focus from mouse enters anyways, so we dont + // need to unmap/remap them on workspace changes + if (! bw->isStuck() || bw->isNormal()) + bw->withdraw(); + } +} + + /* * returns the number of transients for win, plus the number of transients

@@ -427,57 +457,6 @@ const BlackboxWindowList::const_reverse_iterator end = stackingList.rend();

for (; it != end; ++it) if ((*it)->isNormal()) stack_order.push_back(*it); -} - - -void Workspace::hide(void) { - BlackboxWindow *focused = screen->getBlackbox()->getFocusedWindow(); - if (focused && focused->getScreen() == screen) { - assert(focused->isStuck() || focused->getWorkspaceNumber() == id); - - lastfocus = focused; - } else { - // if no window had focus, no need to store a last focus - lastfocus = (BlackboxWindow *) 0; - } - - // when we switch workspaces, unfocus whatever was focused - screen->getBlackbox()->setFocusedWindow((BlackboxWindow *) 0); - - // withdraw windows in reverse order to minimize the number of Expose events - - BlackboxWindowList::reverse_iterator it = stackingList.rbegin(); - const BlackboxWindowList::reverse_iterator end = stackingList.rend(); - for (; it != end; ++it) { - BlackboxWindow *bw = *it; - // not normal windows cant focus from mouse enters anyways, so we dont - // need to unmap/remap them on workspace changes - if (! bw->isStuck() || bw->isNormal()) - bw->withdraw(); - } -} - - -void Workspace::show(void) { - BlackboxWindowList::iterator it = stackingList.begin(); - const BlackboxWindowList::iterator end = stackingList.end(); - for (; it != end; ++it) { - BlackboxWindow *bw = *it; - // not normal windows cant focus from mouse enters anyways, so we dont - // need to unmap/remap them on workspace changes - if (! bw->isStuck() || bw->isNormal()) - bw->show(); - } - - XSync(screen->getBlackbox()->getXDisplay(), False); - - if (screen->doFocusLast()) { - if (! screen->isSloppyFocus() && ! lastfocus && ! stackingList.empty()) - lastfocus = stackingList.front(); - - if (lastfocus) - lastfocus->setInputFocus(); - } }
M src/Workspace.hhsrc/Workspace.hh

@@ -104,8 +104,8 @@ void removeWindow(BlackboxWindow *w, bool sticky = False);

unsigned int getCount(void) const; void appendStackOrder(BlackboxWindowList &stack_order) const; - void show(void); - void hide(void); + void showAll(void); + void hideAll(void); void removeAll(void); void raiseWindow(BlackboxWindow *w); void lowerWindow(BlackboxWindow *w);
M util/epist/DESIGNutil/epist/DESIGN

@@ -2,8 +2,9 @@ Epist design notes, by woodblock

-------------------------------- - Chained keybindings like emacs, and I suppose vi if you're wierd like that. - - most actions can take extra parameters. probably only numbers, or strings, maybe both. - - no interactive string inputs +- most actions can take extra parameters. probably only numbers, + or strings, maybe both. +- no interactive string inputs - A config file that doesn't suck