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.
This commit is contained in:
parent
2d11488069
commit
551a17d256
8 changed files with 88 additions and 80 deletions
11
CHANGELOG
11
CHANGELOG
|
@ -1,5 +1,16 @@
|
||||||
Changelog for Openbox:
|
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:
|
2.0.0:
|
||||||
* Add an rc option (modiferMask) to allow changing (Ben Jansens)
|
* Add an rc option (modiferMask) to allow changing (Ben Jansens)
|
||||||
which modifier combo Openbox uses for mouse
|
which modifier combo Openbox uses for mouse
|
||||||
|
|
|
@ -1186,20 +1186,38 @@ unsigned int BScreen::removeLastWorkspace(void) {
|
||||||
void BScreen::changeWorkspaceID(unsigned int id) {
|
void BScreen::changeWorkspaceID(unsigned int id) {
|
||||||
if (! current_workspace || id == current_workspace->getID()) return;
|
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);
|
workspacemenu->setItemSelected(current_workspace->getID() + 2, False);
|
||||||
|
|
||||||
current_workspace = getWorkspace(id);
|
current_workspace = getWorkspace(id);
|
||||||
|
|
||||||
current_workspace->show();
|
|
||||||
|
|
||||||
xatom->setValue(getRootWindow(), XAtom::net_current_desktop,
|
xatom->setValue(getRootWindow(), XAtom::net_current_desktop,
|
||||||
XAtom::cardinal, id);
|
XAtom::cardinal, id);
|
||||||
|
|
||||||
workspacemenu->setItemSelected(current_workspace->getID() + 2, True);
|
workspacemenu->setItemSelected(current_workspace->getID() + 2, True);
|
||||||
toolbar->redrawWorkspaceLabel(True);
|
toolbar->redrawWorkspaceLabel(True);
|
||||||
|
|
||||||
|
current_workspace->showAll();
|
||||||
|
|
||||||
|
if (resource.focus_last && current_workspace->getLastFocusedWindow()) {
|
||||||
|
XSync(blackbox->getXDisplay(), False);
|
||||||
|
current_workspace->getLastFocusedWindow()->setInputFocus();
|
||||||
|
}
|
||||||
|
|
||||||
updateNetizenCurrentWorkspace();
|
updateNetizenCurrentWorkspace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3058,10 +3058,6 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
|
||||||
dx -= frame.border_w;
|
dx -= frame.border_w;
|
||||||
dy -= frame.border_w;
|
dy -= frame.border_w;
|
||||||
|
|
||||||
if (screen->doWorkspaceWarping())
|
|
||||||
if (doWorkspaceWarping(x_root, y_root, dx, dy))
|
|
||||||
return;
|
|
||||||
|
|
||||||
doWindowSnapping(dx, dy);
|
doWindowSnapping(dx, dy);
|
||||||
|
|
||||||
if (screen->doOpaqueMove()) {
|
if (screen->doOpaqueMove()) {
|
||||||
|
@ -3084,12 +3080,15 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
|
||||||
frame.changing.height() - 1);
|
frame.changing.height() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (screen->doWorkspaceWarping())
|
||||||
|
doWorkspaceWarping(x_root, y_root, dx, dy);
|
||||||
|
|
||||||
screen->showPosition(dx, dy);
|
screen->showPosition(dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BlackboxWindow::doWorkspaceWarping(int x_root, int y_root,
|
void BlackboxWindow::doWorkspaceWarping(int x_root, int y_root,
|
||||||
int dx, int dy) {
|
int &dx, int dy) {
|
||||||
// workspace warping
|
// workspace warping
|
||||||
bool warp = False;
|
bool warp = False;
|
||||||
unsigned int dest = screen->getCurrentWorkspaceID();
|
unsigned int dest = screen->getCurrentWorkspaceID();
|
||||||
|
@ -3106,7 +3105,7 @@ bool BlackboxWindow::doWorkspaceWarping(int x_root, int y_root,
|
||||||
else dest = 0;
|
else dest = 0;
|
||||||
}
|
}
|
||||||
if (! warp)
|
if (! warp)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
endMove();
|
endMove();
|
||||||
bool focus = flags.focused; // had focus while moving?
|
bool focus = flags.focused; // had focus while moving?
|
||||||
|
@ -3116,6 +3115,15 @@ bool BlackboxWindow::doWorkspaceWarping(int x_root, int y_root,
|
||||||
if (focus)
|
if (focus)
|
||||||
setInputFocus();
|
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
|
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
|
mouse cursor. When one moves, it could end up putting the mouse cursor
|
||||||
|
@ -3123,23 +3131,15 @@ bool BlackboxWindow::doWorkspaceWarping(int x_root, int y_root,
|
||||||
move on another window.
|
move on another window.
|
||||||
*/
|
*/
|
||||||
XGrabServer(blackbox->getXDisplay());
|
XGrabServer(blackbox->getXDisplay());
|
||||||
int dest_x;
|
|
||||||
if (x_root <= 0) {
|
configure(dx, dy, frame.rect.width(), frame.rect.height());
|
||||||
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());
|
|
||||||
}
|
|
||||||
XWarpPointer(blackbox->getXDisplay(), None,
|
XWarpPointer(blackbox->getXDisplay(), None,
|
||||||
screen->getRootWindow(), 0, 0, 0, 0,
|
screen->getRootWindow(), 0, 0, 0, 0,
|
||||||
dest_x, y_root);
|
dest_x, y_root);
|
||||||
|
|
||||||
XUngrabServer(blackbox->getXDisplay());
|
XUngrabServer(blackbox->getXDisplay());
|
||||||
|
|
||||||
beginMove(dest_x, y_root);
|
beginMove(dest_x, y_root);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ private:
|
||||||
void setState(unsigned long new_state);
|
void setState(unsigned long new_state);
|
||||||
void upsize(void);
|
void upsize(void);
|
||||||
void doMove(int x_root, int y_root);
|
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 doWindowSnapping(int &dx, int &dy);
|
||||||
void endMove(void);
|
void endMove(void);
|
||||||
void doResize(int x_root, int y_root);
|
void doResize(int x_root, int y_root);
|
||||||
|
|
|
@ -182,9 +182,8 @@ void Windowmenu::SendtoWorkspacemenu::itemSelected(int button,
|
||||||
void Windowmenu::SendtoWorkspacemenu::update(void) {
|
void Windowmenu::SendtoWorkspacemenu::update(void) {
|
||||||
unsigned int i, r = getCount(),
|
unsigned int i, r = getCount(),
|
||||||
workspace_count = getScreen()->getWorkspaceCount();
|
workspace_count = getScreen()->getWorkspaceCount();
|
||||||
if (r > workspace_count) {
|
while (r > workspace_count) {
|
||||||
for (i = r; i < workspace_count; ++i)
|
remove(0);
|
||||||
remove(0);
|
|
||||||
r = getCount();
|
r = getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,36 @@ void Workspace::removeAll(void) {
|
||||||
windowList.front()->iconify();
|
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
|
* returns the number of transients for win, plus the number of transients
|
||||||
|
@ -430,57 +460,6 @@ void Workspace::appendStackOrder(BlackboxWindowList &stack_order) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Workspace::isCurrent(void) const {
|
bool Workspace::isCurrent(void) const {
|
||||||
return (id == screen->getCurrentWorkspaceID());
|
return (id == screen->getCurrentWorkspaceID());
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,8 +104,8 @@ public:
|
||||||
unsigned int getCount(void) const;
|
unsigned int getCount(void) const;
|
||||||
void appendStackOrder(BlackboxWindowList &stack_order) const;
|
void appendStackOrder(BlackboxWindowList &stack_order) const;
|
||||||
|
|
||||||
void show(void);
|
void showAll(void);
|
||||||
void hide(void);
|
void hideAll(void);
|
||||||
void removeAll(void);
|
void removeAll(void);
|
||||||
void raiseWindow(BlackboxWindow *w);
|
void raiseWindow(BlackboxWindow *w);
|
||||||
void lowerWindow(BlackboxWindow *w);
|
void lowerWindow(BlackboxWindow *w);
|
||||||
|
|
|
@ -2,8 +2,9 @@ Epist design notes, by woodblock
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
- Chained keybindings like emacs, and I suppose vi if you're wierd like that.
|
- 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.
|
- most actions can take extra parameters. probably only numbers,
|
||||||
- no interactive string inputs
|
or strings, maybe both.
|
||||||
|
- no interactive string inputs
|
||||||
- A config file that doesn't suck
|
- A config file that doesn't suck
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue