toggledecor almost done
some code cleanups/fixes
This commit is contained in:
parent
d181f1ad05
commit
cc5bde6d00
9 changed files with 49 additions and 4 deletions
|
@ -497,7 +497,7 @@ void XAtom::eraseValue(Window win, Atoms atom) const {
|
||||||
|
|
||||||
void XAtom::sendClientMessage(Window target, Atoms type, Window about,
|
void XAtom::sendClientMessage(Window target, Atoms type, Window about,
|
||||||
long data, long data1, long data2,
|
long data, long data1, long data2,
|
||||||
long data3) const {
|
long data3, long data4) const {
|
||||||
assert(atom >= 0 && atom < NUM_ATOMS);
|
assert(atom >= 0 && atom < NUM_ATOMS);
|
||||||
assert(target != None);
|
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[1] = data1;
|
||||||
e.xclient.data.l[2] = data2;
|
e.xclient.data.l[2] = data2;
|
||||||
e.xclient.data.l[3] = data3;
|
e.xclient.data.l[3] = data3;
|
||||||
|
e.xclient.data.l[4] = data4;
|
||||||
|
|
||||||
XSendEvent(_display, target, False,
|
XSendEvent(_display, target, False,
|
||||||
SubstructureRedirectMask | SubstructureNotifyMask,
|
SubstructureRedirectMask | SubstructureNotifyMask,
|
||||||
|
|
|
@ -216,7 +216,7 @@ public:
|
||||||
// sends a client message a window
|
// sends a client message a window
|
||||||
void sendClientMessage(Window target, Atoms type, Window about,
|
void sendClientMessage(Window target, Atoms type, Window about,
|
||||||
long data = 0, long data1 = 0, long data2 = 0,
|
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!!
|
// temporary function!! remove when not used in blackbox.hh anymore!!
|
||||||
inline Atom getAtom(Atoms a)
|
inline Atom getAtom(Atoms a)
|
||||||
|
|
|
@ -87,6 +87,7 @@ public:
|
||||||
// these are openbox extensions
|
// these are openbox extensions
|
||||||
showRootMenu,
|
showRootMenu,
|
||||||
showWorkspaceMenu,
|
showWorkspaceMenu,
|
||||||
|
toggleDecorations,
|
||||||
|
|
||||||
stringChain,
|
stringChain,
|
||||||
keyChain,
|
keyChain,
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include "config.hh"
|
#include "config.hh"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
Config::Config() {}
|
Config::Config() {}
|
||||||
|
|
||||||
Config::~Config()
|
Config::~Config()
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct keynode {
|
||||||
class keytree : public TimeoutHandler {
|
class keytree : public TimeoutHandler {
|
||||||
public:
|
public:
|
||||||
keytree(Display *, epist *);
|
keytree(Display *, epist *);
|
||||||
~keytree();
|
virtual ~keytree();
|
||||||
|
|
||||||
void grabDefaults(screen *);
|
void grabDefaults(screen *);
|
||||||
void ungrabDefaults(screen *);
|
void ungrabDefaults(screen *);
|
||||||
|
@ -72,8 +72,8 @@ private:
|
||||||
keynode *_head;
|
keynode *_head;
|
||||||
keynode *_current;
|
keynode *_current;
|
||||||
Display *_display;
|
Display *_display;
|
||||||
BTimer *_timer;
|
|
||||||
screen *_timeout_screen;
|
screen *_timeout_screen;
|
||||||
|
BTimer *_timer;
|
||||||
epist *_epist;
|
epist *_epist;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,7 @@ void parser::setAction(string act)
|
||||||
{ "prevscreen", Action::prevScreen },
|
{ "prevscreen", Action::prevScreen },
|
||||||
{ "showrootmenu", Action::showRootMenu },
|
{ "showrootmenu", Action::showRootMenu },
|
||||||
{ "showworkspacemenu", Action::showWorkspaceMenu },
|
{ "showworkspacemenu", Action::showWorkspaceMenu },
|
||||||
|
{ "toggledecorations", Action::toggleDecorations },
|
||||||
{ "stringchain", Action::stringChain },
|
{ "stringchain", Action::stringChain },
|
||||||
{ "keychain", Action::keyChain },
|
{ "keychain", Action::keyChain },
|
||||||
{ "numberchain", Action::numberChain },
|
{ "numberchain", Action::numberChain },
|
||||||
|
|
|
@ -322,6 +322,10 @@ void screen::handleKeypress(const XEvent &e) {
|
||||||
window->toggleMaximize(XWindow::Max_Full);
|
window->toggleMaximize(XWindow::Max_Full);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case Action::toggleDecorations:
|
||||||
|
window->decorate(! window->decorated());
|
||||||
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert(false); // unhandled action type!
|
assert(false); // unhandled action type!
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -44,6 +44,7 @@ XWindow::XWindow(epist *epist, screen *screen, Window window)
|
||||||
XSelectInput(_epist->getXDisplay(), _window,
|
XSelectInput(_epist->getXDisplay(), _window,
|
||||||
PropertyChangeMask | StructureNotifyMask);
|
PropertyChangeMask | StructureNotifyMask);
|
||||||
|
|
||||||
|
updateBlackboxAttributes();
|
||||||
updateNormalHints();
|
updateNormalHints();
|
||||||
updateWMHints();
|
updateWMHints();
|
||||||
updateDimentions();
|
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() {
|
void XWindow::updateNormalHints() {
|
||||||
XSizeHints size;
|
XSizeHints size;
|
||||||
long ret;
|
long ret;
|
||||||
|
@ -436,3 +454,11 @@ void XWindow::maximize(Max max) const {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void XWindow::decorate(bool d) const {
|
||||||
|
_xatom->sendClientMessage(_screen->rootWindow(),
|
||||||
|
XAtom::blackbox_change_attributes,
|
||||||
|
_window, AttribDecoration,
|
||||||
|
0, 0, 0, (d ? DecorNormal : DecorNone));
|
||||||
|
}
|
||||||
|
|
|
@ -46,6 +46,12 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
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;
|
epist *_epist;
|
||||||
screen *_screen;
|
screen *_screen;
|
||||||
XAtom *_xatom;
|
XAtom *_xatom;
|
||||||
|
@ -67,10 +73,12 @@ private:
|
||||||
bool _iconic;
|
bool _iconic;
|
||||||
bool _max_vert;
|
bool _max_vert;
|
||||||
bool _max_horz;
|
bool _max_horz;
|
||||||
|
bool _decorated;
|
||||||
|
|
||||||
bool _unmapped;
|
bool _unmapped;
|
||||||
|
|
||||||
void updateDimentions();
|
void updateDimentions();
|
||||||
|
void updateBlackboxAttributes();
|
||||||
void updateNormalHints();
|
void updateNormalHints();
|
||||||
void updateWMHints();
|
void updateWMHints();
|
||||||
void updateState();
|
void updateState();
|
||||||
|
@ -95,6 +103,7 @@ public:
|
||||||
inline bool iconic() const { return _iconic; }
|
inline bool iconic() const { return _iconic; }
|
||||||
inline bool maxVert() const { return _max_vert; }
|
inline bool maxVert() const { return _max_vert; }
|
||||||
inline bool maxHorz() const { return _max_horz; }
|
inline bool maxHorz() const { return _max_horz; }
|
||||||
|
inline bool decorated() const { return _decorated; }
|
||||||
inline const Rect &area() const { return _rect; }
|
inline const Rect &area() const { return _rect; }
|
||||||
inline unsigned int x() const { return _rect.x(); }
|
inline unsigned int x() const { return _rect.x(); }
|
||||||
inline unsigned int y() const { return _rect.y(); }
|
inline unsigned int y() const { return _rect.y(); }
|
||||||
|
@ -109,6 +118,7 @@ public:
|
||||||
void lower() const;
|
void lower() const;
|
||||||
void iconify() const;
|
void iconify() const;
|
||||||
void focus() const;
|
void focus() const;
|
||||||
|
void decorate(bool d) const;
|
||||||
void sendTo(unsigned int dest) const;
|
void sendTo(unsigned int dest) const;
|
||||||
void move(int x, int y) const;
|
void move(int x, int y) const;
|
||||||
void resizeRel(int dwidth, int dheight) const;
|
void resizeRel(int dwidth, int dheight) const;
|
||||||
|
|
Loading…
Reference in a new issue