summaryrefslogtreecommitdiff
path: root/util/epist
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-08-21 23:57:03 +0000
committerDana Jansens <danakj@orodu.net>2002-08-21 23:57:03 +0000
commitcc5bde6d00892cf27fcb6e4e0b4974bcecca265f (patch)
tree1573f740857df62f526e768cd5f7d89b2218a71f /util/epist
parentd181f1ad05332c42eb090384666171a142f54b0c (diff)
toggledecor almost done
some code cleanups/fixes
Diffstat (limited to 'util/epist')
-rw-r--r--util/epist/actions.hh1
-rw-r--r--util/epist/config.cc2
-rw-r--r--util/epist/keytree.hh4
-rw-r--r--util/epist/parser.cc1
-rw-r--r--util/epist/screen.cc4
-rw-r--r--util/epist/window.cc26
-rw-r--r--util/epist/window.hh10
7 files changed, 46 insertions, 2 deletions
diff --git a/util/epist/actions.hh b/util/epist/actions.hh
index f2d5423a..89b99eca 100644
--- a/util/epist/actions.hh
+++ b/util/epist/actions.hh
@@ -87,6 +87,7 @@ public:
// these are openbox extensions
showRootMenu,
showWorkspaceMenu,
+ toggleDecorations,
stringChain,
keyChain,
diff --git a/util/epist/config.cc b/util/epist/config.cc
index a64d78d9..0df15e9c 100644
--- a/util/epist/config.cc
+++ b/util/epist/config.cc
@@ -22,6 +22,8 @@
#include "config.hh"
+using std::string;
+
Config::Config() {}
Config::~Config()
diff --git a/util/epist/keytree.hh b/util/epist/keytree.hh
index 21acb271..efbe9f13 100644
--- a/util/epist/keytree.hh
+++ b/util/epist/keytree.hh
@@ -40,7 +40,7 @@ struct keynode {
class keytree : public TimeoutHandler {
public:
keytree(Display *, epist *);
- ~keytree();
+ virtual ~keytree();
void grabDefaults(screen *);
void ungrabDefaults(screen *);
@@ -72,8 +72,8 @@ private:
keynode *_head;
keynode *_current;
Display *_display;
- BTimer *_timer;
screen *_timeout_screen;
+ BTimer *_timer;
epist *_epist;
};
diff --git a/util/epist/parser.cc b/util/epist/parser.cc
index 7d7a2e8a..548212c4 100644
--- a/util/epist/parser.cc
+++ b/util/epist/parser.cc
@@ -101,6 +101,7 @@ void parser::setAction(string act)
{ "prevscreen", Action::prevScreen },
{ "showrootmenu", Action::showRootMenu },
{ "showworkspacemenu", Action::showWorkspaceMenu },
+ { "toggledecorations", Action::toggleDecorations },
{ "stringchain", Action::stringChain },
{ "keychain", Action::keyChain },
{ "numberchain", Action::numberChain },
diff --git a/util/epist/screen.cc b/util/epist/screen.cc
index 39eb4895..1bd7ad5d 100644
--- a/util/epist/screen.cc
+++ b/util/epist/screen.cc
@@ -321,6 +321,10 @@ void screen::handleKeypress(const XEvent &e) {
case Action::toggleMaximizeFull:
window->toggleMaximize(XWindow::Max_Full);
return;
+
+ case Action::toggleDecorations:
+ window->decorate(! window->decorated());
+ return;
default:
assert(false); // unhandled action type!
diff --git a/util/epist/window.cc b/util/epist/window.cc
index 48df206c..1e8bc227 100644
--- a/util/epist/window.cc
+++ b/util/epist/window.cc
@@ -44,6 +44,7 @@ XWindow::XWindow(epist *epist, screen *screen, Window window)
XSelectInput(_epist->getXDisplay(), _window,
PropertyChangeMask | StructureNotifyMask);
+ updateBlackboxAttributes();
updateNormalHints();
updateWMHints();
updateDimentions();
@@ -78,6 +79,23 @@ void XWindow::updateDimentions() {
}
+void XWindow::updateBlackboxAttributes() {
+ unsigned long *data;
+ unsigned long num = PropBlackboxAttributesElements;
+
+ _decorated = true;
+
+ if (_xatom->getValue(_window,
+ XAtom::blackbox_attributes, XAtom::blackbox_attributes,
+ num, &data)) {
+ if (num == PropBlackboxAttributesElements)
+ if (data[0] & AttribDecoration)
+ _decorated = (data[4] != DecorNone);
+ delete data;
+ }
+}
+
+
void XWindow::updateNormalHints() {
XSizeHints size;
long ret;
@@ -436,3 +454,11 @@ void XWindow::maximize(Max max) const {
break;
}
}
+
+
+void XWindow::decorate(bool d) const {
+ _xatom->sendClientMessage(_screen->rootWindow(),
+ XAtom::blackbox_change_attributes,
+ _window, AttribDecoration,
+ 0, 0, 0, (d ? DecorNormal : DecorNone));
+}
diff --git a/util/epist/window.hh b/util/epist/window.hh
index 618731fd..f80bcb3d 100644
--- a/util/epist/window.hh
+++ b/util/epist/window.hh
@@ -46,6 +46,12 @@ public:
};
private:
+ // defined by black/openbox
+ static const unsigned int PropBlackboxAttributesElements = 9;
+ static const unsigned int AttribDecoration = 1 << 6;
+ static const unsigned int DecorNone = 0;
+ static const unsigned int DecorNormal = 2;
+
epist *_epist;
screen *_screen;
XAtom *_xatom;
@@ -67,10 +73,12 @@ private:
bool _iconic;
bool _max_vert;
bool _max_horz;
+ bool _decorated;
bool _unmapped;
void updateDimentions();
+ void updateBlackboxAttributes();
void updateNormalHints();
void updateWMHints();
void updateState();
@@ -95,6 +103,7 @@ public:
inline bool iconic() const { return _iconic; }
inline bool maxVert() const { return _max_vert; }
inline bool maxHorz() const { return _max_horz; }
+ inline bool decorated() const { return _decorated; }
inline const Rect &area() const { return _rect; }
inline unsigned int x() const { return _rect.x(); }
inline unsigned int y() const { return _rect.y(); }
@@ -109,6 +118,7 @@ public:
void lower() const;
void iconify() const;
void focus() const;
+ void decorate(bool d) const;
void sendTo(unsigned int dest) const;
void move(int x, int y) const;
void resizeRel(int dwidth, int dheight) const;