add the ability to close a window

This commit is contained in:
Dana Jansens 2002-07-20 09:17:23 +00:00
parent c9be3ee061
commit 5bf463ea95
5 changed files with 21 additions and 6 deletions

View file

@ -36,17 +36,17 @@ public:
noaction = 0,
execute,
iconify,
raiseWindow,
lowerWindow,
closeWindow,
toggleshade,
raise,
lower,
close, //done
toggleshade, //done
moveWindowUp,
moveWindowDown,
moveWindowLeft,
moveWindowRight,
nextWindow,
prevWindow,
nextWindow, //done for now
prevWindow, //done for now
nextWindowOnAllWorkspaces,
prevWindowOnAllWorkspaces,

View file

@ -88,6 +88,10 @@ epist::epist(char **argv, char *dpy_name, char *rc_file)
XKeysymToKeycode(getXDisplay(),
XStringToKeysym("F5")),
Mod1Mask));
_actions.push_back(Action(Action::close,
XKeysymToKeycode(getXDisplay(),
XStringToKeysym("F4")),
Mod1Mask));
_actions.push_back(Action(Action::nextWindow,
XKeysymToKeycode(getXDisplay(),
XStringToKeysym("Tab")),

View file

@ -175,6 +175,10 @@ void screen::handleKeypress(const XEvent &e) {
XWindow *window = *_active;
switch (it->type()) {
case Action::close:
window->close();
return;
case Action::toggleshade:
window->shade(! window->shaded());
return;

View file

@ -148,3 +148,9 @@ void XWindow::shade(const bool sh) const {
_window, (sh ? 1 : 0),
_xatom->getAtom(XAtom::net_wm_state_shaded));
}
void XWindow::close() const {
_xatom->sendClientMessage(_screen->rootWindow(), XAtom::net_close_window,
_window);
}

View file

@ -81,6 +81,7 @@ public:
void processEvent(const XEvent &e);
void shade(const bool sh) const;
void close() const;
bool operator == (const XWindow &w) const { return w._window == _window; }
bool operator == (const Window &w) const { return w == _window; }