fixed change workspace and indenting

This commit is contained in:
Scott Moynes 2002-08-07 02:10:16 +00:00
parent b0239459c3
commit 1f539dccc6

View file

@ -70,7 +70,7 @@ screen::screen(epist *epist, int number)
} }
if (_managed) if (_managed)
cout << "Found compatible window manager '" << _wm_name << "' for screen " cout << "Found compatible window manager '" << _wm_name << "' for screen "
<< _number << ".\n"; << _number << ".\n";
else { else {
cout << "Unable to find a compatible window manager for screen " << cout << "Unable to find a compatible window manager for screen " <<
_number << ".\n"; _number << ".\n";
@ -154,154 +154,153 @@ void screen::handleKeypress(const XEvent &e) {
const Action *it = _epist->getKeyTree().getAction(e, state, this); const Action *it = _epist->getKeyTree().getAction(e, state, this);
if (!it) if (!it)
return; return;
switch (it->type()) { switch (it->type()) {
case Action::nextScreen: case Action::nextScreen:
_epist->cycleScreen(_number, true); _epist->cycleScreen(_number, true);
return; return;
case Action::prevScreen: case Action::prevScreen:
_epist->cycleScreen(_number, false); _epist->cycleScreen(_number, false);
return; return;
case Action::nextWorkspace: case Action::nextWorkspace:
cycleWorkspace(true); cycleWorkspace(true);
return; return;
case Action::prevWorkspace: case Action::prevWorkspace:
cycleWorkspace(false); cycleWorkspace(false);
return; return;
case Action::nextWindow: case Action::nextWindow:
cycleWindow(true); cycleWindow(true);
return; return;
case Action::prevWindow: case Action::prevWindow:
cycleWindow(false); cycleWindow(false);
return; return;
case Action::nextWindowOnAllWorkspaces: case Action::nextWindowOnAllWorkspaces:
cycleWindow(true, false, true); cycleWindow(true, false, true);
return; return;
case Action::prevWindowOnAllWorkspaces: case Action::prevWindowOnAllWorkspaces:
cycleWindow(false, false, true); cycleWindow(false, false, true);
return; return;
case Action::nextWindowOnAllScreens: case Action::nextWindowOnAllScreens:
cycleWindow(true, true); cycleWindow(true, true);
return; return;
case Action::prevWindowOnAllScreens: case Action::prevWindowOnAllScreens:
cycleWindow(false, true); cycleWindow(false, true);
return; return;
case Action::nextWindowOfClass: case Action::nextWindowOfClass:
cycleWindow(true, false, false, true, it->string()); cycleWindow(true, false, false, true, it->string());
return; return;
case Action::prevWindowOfClass: case Action::prevWindowOfClass:
cycleWindow(false, false, false, true, it->string()); cycleWindow(false, false, false, true, it->string());
return; return;
case Action::nextWindowOfClassOnAllWorkspaces: case Action::nextWindowOfClassOnAllWorkspaces:
cycleWindow(true, false, true, true, it->string()); cycleWindow(true, false, true, true, it->string());
return; return;
case Action::prevWindowOfClassOnAllWorkspaces: case Action::prevWindowOfClassOnAllWorkspaces:
cycleWindow(false, false, true, true, it->string()); cycleWindow(false, false, true, true, it->string());
return; return;
case Action::changeWorkspace: case Action::changeWorkspace:
// we subtract one so counting starts at 1 in the config file changeWorkspace(it->number());
changeWorkspace(it->number() - 1); return;
return;
case Action::execute: case Action::execute:
execCommand(it->string()); execCommand(it->string());
return; return;
default: default:
break; break;
} }
// these actions require an active window // these actions require an active window
if (_active != _clients.end()) { if (_active != _clients.end()) {
XWindow *window = *_active; XWindow *window = *_active;
switch (it->type()) { switch (it->type()) {
case Action::iconify: case Action::iconify:
window->iconify(); window->iconify();
return; return;
case Action::close: case Action::close:
window->close(); window->close();
return; return;
case Action::raise: case Action::raise:
window->raise(); window->raise();
return; return;
case Action::lower: case Action::lower:
window->lower(); window->lower();
return; return;
case Action::sendToWorkspace: case Action::sendToWorkspace:
window->sendTo(it->number()); window->sendTo(it->number());
return; return;
case Action::toggleomnipresent: case Action::toggleomnipresent:
if (window->desktop() == 0xffffffff) if (window->desktop() == 0xffffffff)
window->sendTo(_active_desktop); window->sendTo(_active_desktop);
else else
window->sendTo(0xffffffff); window->sendTo(0xffffffff);
return; return;
case Action::moveWindowUp: case Action::moveWindowUp:
window->move(window->x(), window->y() - it->number()); window->move(window->x(), window->y() - it->number());
return; return;
case Action::moveWindowDown: case Action::moveWindowDown:
window->move(window->x(), window->y() + it->number()); window->move(window->x(), window->y() + it->number());
return; return;
case Action::moveWindowLeft: case Action::moveWindowLeft:
window->move(window->x() - it->number(), window->y()); window->move(window->x() - it->number(), window->y());
return; return;
case Action::moveWindowRight: case Action::moveWindowRight:
window->move(window->x() + it->number(), window->y()); window->move(window->x() + it->number(), window->y());
return; return;
case Action::resizeWindowWidth: case Action::resizeWindowWidth:
window->resize(window->width() + it->number(), window->height()); window->resize(window->width() + it->number(), window->height());
return; return;
case Action::resizeWindowHeight: case Action::resizeWindowHeight:
window->resize(window->width(), window->height() + it->number()); window->resize(window->width(), window->height() + it->number());
return; return;
case Action::toggleshade: case Action::toggleshade:
window->shade(! window->shaded()); window->shade(! window->shaded());
return; return;
case Action::toggleMaximizeHorizontal: case Action::toggleMaximizeHorizontal:
window->toggleMaximize(XWindow::Max_Horz); window->toggleMaximize(XWindow::Max_Horz);
return; return;
case Action::toggleMaximizeVertical: case Action::toggleMaximizeVertical:
window->toggleMaximize(XWindow::Max_Vert); window->toggleMaximize(XWindow::Max_Vert);
return; return;
case Action::toggleMaximizeFull: case Action::toggleMaximizeFull:
window->toggleMaximize(XWindow::Max_Full); window->toggleMaximize(XWindow::Max_Full);
return; return;
default: default:
assert(false); // unhandled action type! assert(false); // unhandled action type!
break; break;
} }
} }
} }
@ -374,7 +373,7 @@ void screen::updateClientList() {
break; break;
if (it == end) { // didn't already exist if (it == end) { // didn't already exist
if (doAddWindow(rootclients[i])) { if (doAddWindow(rootclients[i])) {
// cout << "Added window: 0x" << hex << rootclients[i] << dec << endl; // cout << "Added window: 0x" << hex << rootclients[i] << dec << endl;
_clients.insert(insert_point, new XWindow(_epist, this, _clients.insert(insert_point, new XWindow(_epist, this,
rootclients[i])); rootclients[i]));
} }
@ -394,7 +393,7 @@ void screen::updateClientList() {
if (**it2 == rootclients[i]) if (**it2 == rootclients[i])
break; break;
if (i == num) { // no longer exists if (i == num) { // no longer exists
// cout << "Removed window: 0x" << hex << (*it2)->window() << dec << endl; // cout << "Removed window: 0x" << hex << (*it2)->window() << dec << endl;
// watch for the active and last-active window // watch for the active and last-active window
if (it2 == _active) if (it2 == _active)
_active = _clients.end(); _active = _clients.end();
@ -443,10 +442,10 @@ void screen::updateActiveWindow() {
if (it != end) if (it != end)
_last_active = it; _last_active = it;
/* cout << "Active window is now: "; /* cout << "Active window is now: ";
if (_active == _clients.end()) cout << "None\n"; if (_active == _clients.end()) cout << "None\n";
else cout << "0x" << hex << (*_active)->window() << dec << endl; else cout << "0x" << hex << (*_active)->window() << dec << endl;
*/ */
} }
@ -479,8 +478,8 @@ void screen::cycleWindow(const bool forward, const bool allscreens,
classname = (*_active)->appClass(); classname = (*_active)->appClass();
WindowList::const_iterator target = _active, WindowList::const_iterator target = _active,
begin = _clients.begin(), begin = _clients.begin(),
end = _clients.end(); end = _clients.end();
while (1) { while (1) {
if (forward) { if (forward) {