X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fscreen.cc;h=475a96e20f95581b766e4aec3f44ece9e3580ccf;hb=8e601e4a64b37f333fc3a5f844e4d72d6f289415;hp=74a98e4e8eba3a7fa17f4561d7a3532acc2752c9;hpb=f586e55a8cd3d740a1b7b3a0801bad27030926f9;p=chaz%2Fopenbox diff --git a/util/epist/screen.cc b/util/epist/screen.cc index 74a98e4e..475a96e2 100644 --- a/util/epist/screen.cc +++ b/util/epist/screen.cc @@ -1,5 +1,5 @@ // -*- mode: C++; indent-tabs-mode: nil; -*- -// screen.cc for Epistory - a key handler for NETWM/EWMH window managers. +// screen.cc for Epistophy - a key handler for NETWM/EWMH window managers. // Copyright (c) 2002 - 2002 Ben Jansens // // Permission is hereby granted, free of charge, to any person obtaining a @@ -143,22 +143,36 @@ void screen::processEvent(const XEvent &e) { } void screen::handleKeypress(const XEvent &e) { - list::const_iterator it = _epist->actions().begin(); - list::const_iterator end = _epist->actions().end(); + ActionList::const_iterator it = _epist->actions().begin(); + ActionList::const_iterator end = _epist->actions().end(); for (; it != end; ++it) { if (e.xkey.keycode == it->keycode() && - e.xkey.state == it->modifierMask() ) - { + e.xkey.state == it->modifierMask()) { + switch (it->type()) { + case Action::nextWorkspace: + cycleWorkspace(true); + return; + + case Action::prevWorkspace: + cycleWorkspace(false); + return; + + case Action::changeWorkspace: + changeWorkspace(it->number()); + return; + } + + // these actions require an active window + if (_active != _clients.end()) { + XWindow *window = *_active; + switch (it->type()) { - case Action::nextDesktop: - cycleWorkspace(true); - break; - case Action::prevDesktop: - cycleWorkspace(false); - break; + case Action::shade: + window->shade(! window->shaded()); + return; } - break; } + } } } @@ -210,7 +224,8 @@ void screen::updateClientList() { if (it == end) { // didn't already exist if (doAddWindow(rootclients[i])) { cout << "Added window: 0x" << hex << rootclients[i] << dec << endl; - _clients.insert(insert_point, new XWindow(_epist, rootclients[i])); + _clients.insert(insert_point, new XWindow(_epist, this, + rootclients[i])); } } } @@ -259,9 +274,7 @@ void screen::updateActiveWindow() { } */ -void screen::cycleWorkspace(const bool forward) { - cout << "blef" << endl; - +void screen::cycleWorkspace(const bool forward) const { unsigned long currentDesktop = 0; unsigned long numDesktops = 0; @@ -272,9 +285,6 @@ void screen::cycleWorkspace(const bool forward) { else --currentDesktop; - cout << currentDesktop << endl; - - _xatom->getValue(_root, XAtom::net_number_of_desktops, XAtom::cardinal, numDesktops); @@ -283,10 +293,10 @@ void screen::cycleWorkspace(const bool forward) { else if (currentDesktop >= numDesktops) currentDesktop = 0; - - _xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, - currentDesktop); - + changeWorkspace(currentDesktop); } } - + +void screen::changeWorkspace(const int num) const { + _xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, num); +}