]> Dogcows Code - chaz/openbox/commitdiff
toggledecor almost done
authorDana Jansens <danakj@orodu.net>
Wed, 21 Aug 2002 23:57:03 +0000 (23:57 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 21 Aug 2002 23:57:03 +0000 (23:57 +0000)
some code cleanups/fixes

src/XAtom.cc
src/XAtom.hh
util/epist/actions.hh
util/epist/config.cc
util/epist/keytree.hh
util/epist/parser.cc
util/epist/screen.cc
util/epist/window.cc
util/epist/window.hh

index abd68f183c4224dbdc5670d0ae2db62ee32a9a69..15bbc262e55defaa3b40ee6b8cfd338b0d04d881 100644 (file)
@@ -497,7 +497,7 @@ void XAtom::eraseValue(Window win, Atoms atom) const {
 
 void XAtom::sendClientMessage(Window target, Atoms type, Window about,
                               long data, long data1, long data2,
-                              long data3) const {
+                              long data3, long data4) const {
   assert(atom >= 0 && atom < NUM_ATOMS);
   assert(target != None);
 
@@ -510,6 +510,7 @@ void XAtom::sendClientMessage(Window target, Atoms type, Window about,
   e.xclient.data.l[1] = data1;
   e.xclient.data.l[2] = data2;
   e.xclient.data.l[3] = data3;
+  e.xclient.data.l[4] = data4;
 
   XSendEvent(_display, target, False,
              SubstructureRedirectMask | SubstructureNotifyMask,
index f2dae637f798f5d60671f4ecb38b3c99941419ea..2def1c6caf56399d5b1110704ecb7c768915ee83 100644 (file)
@@ -216,7 +216,7 @@ public:
   // sends a client message a window
   void sendClientMessage(Window target, Atoms type, Window about,
                          long data = 0, long data1 = 0, long data2 = 0,
-                         long data3 = 0) const;
+                         long data3 = 0, long data4 = 0) const;
 
   // temporary function!! remove when not used in blackbox.hh anymore!!
   inline Atom getAtom(Atoms a)
index f2d5423ab3552aa9a2a4553af3c3a5fc96f0386d..89b99eca9291ca7008ebabf076308b7c3df33faf 100644 (file)
@@ -87,6 +87,7 @@ public:
     // these are openbox extensions
     showRootMenu,
     showWorkspaceMenu,
+    toggleDecorations,
 
     stringChain, 
     keyChain,
index a64d78d9bfe6ea3354ebc2c16e9a7e06afe1b1ad..0df15e9c9ab0e260ad269f1a101c6517f12b855b 100644 (file)
@@ -22,6 +22,8 @@
 
 #include "config.hh"
 
+using std::string;
+
 Config::Config() {}
 
 Config::~Config()
index 21acb2710705fdd77697bc5da99c6018541717df..efbe9f13200a0124c266adc98f39f6fc80dfebb0 100644 (file)
@@ -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;
 };
 
index 7d7a2e8a4f0597e66b49a6767d8612beb4540e54..548212c45d7f96a1ac7efbf13f19166f556162bb 100644 (file)
@@ -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 },
index 39eb4895def43138390cd8c47597bb94f8052c6a..1bd7ad5da9b872db8de5f4a19b1ba5bf88db4178 100644 (file)
@@ -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!
index 48df206c989b9c9dc18319fe4ae5e643e666e1bc..1e8bc2272de65601935449b604cbb700369c9030 100644 (file)
@@ -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));
+}
index 618731fd003a065f5d38f9794c6010e9bfea2477..f80bcb3dd796cde3fcc62460d019209ba6f7ca64 100644 (file)
@@ -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;
This page took 0.030698 seconds and 4 git commands to generate.