added toggleDecoration and setDecoration functions
This commit is contained in:
parent
e4d3840f26
commit
598cd8a7fd
2 changed files with 82 additions and 86 deletions
153
src/Window.cc
153
src/Window.cc
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Window.cc,v 1.38 2002/04/04 13:19:10 fluxgen Exp $
|
// $Id: Window.cc,v 1.39 2002/04/04 14:23:30 fluxgen Exp $
|
||||||
|
|
||||||
//use GNU extensions
|
//use GNU extensions
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
|
@ -1689,12 +1689,13 @@ void FluxboxWindow::getBlackboxHints(void) {
|
||||||
Fluxbox *fluxbox = Fluxbox::instance();
|
Fluxbox *fluxbox = Fluxbox::instance();
|
||||||
|
|
||||||
if (XGetWindowProperty(display, client.window,
|
if (XGetWindowProperty(display, client.window,
|
||||||
fluxbox->getFluxboxHintsAtom(), 0,
|
fluxbox->getFluxboxHintsAtom(), 0,
|
||||||
PropBlackboxHintsElements, false,
|
PropBlackboxHintsElements, False,
|
||||||
fluxbox->getFluxboxHintsAtom(), &atom_return,
|
fluxbox->getFluxboxHintsAtom(), &atom_return,
|
||||||
&format, &num, &len,
|
&format, &num, &len,
|
||||||
(unsigned char **) &client.blackbox_hint) == Success &&
|
(unsigned char **) &client.blackbox_hint) == Success &&
|
||||||
client.blackbox_hint)
|
client.blackbox_hint) {
|
||||||
|
|
||||||
if (num == PropBlackboxHintsElements) {
|
if (num == PropBlackboxHintsElements) {
|
||||||
if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_SHADED)
|
if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_SHADED)
|
||||||
shaded = (client.blackbox_hint->attrib & BaseDisplay::ATTRIB_SHADED);
|
shaded = (client.blackbox_hint->attrib & BaseDisplay::ATTRIB_SHADED);
|
||||||
|
@ -1716,46 +1717,11 @@ void FluxboxWindow::getBlackboxHints(void) {
|
||||||
|
|
||||||
|
|
||||||
if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_DECORATION) {
|
if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_DECORATION) {
|
||||||
switch (client.blackbox_hint->decoration) {
|
old_decoration = static_cast<Decoration>(client.blackbox_hint->decoration);
|
||||||
case BaseDisplay::DECOR_NONE:
|
setDecoration(old_decoration);
|
||||||
decorations.titlebar = decorations.border = decorations.handle =
|
|
||||||
decorations.iconify = decorations.maximize =
|
|
||||||
decorations.menu = decorations.tab = false; //tab is also a decor
|
|
||||||
functions.resize = functions.move = functions.iconify =
|
|
||||||
functions.maximize = false;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
case BaseDisplay::DECOR_NORMAL:
|
|
||||||
decorations.titlebar = decorations.border = decorations.handle =
|
|
||||||
decorations.iconify = decorations.maximize =
|
|
||||||
decorations.menu = true;
|
|
||||||
functions.resize = functions.move = functions.iconify =
|
|
||||||
functions.maximize = true;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BaseDisplay::DECOR_TINY:
|
|
||||||
decorations.titlebar = decorations.iconify = decorations.menu =
|
|
||||||
functions.move = functions.iconify = true;
|
|
||||||
decorations.border = decorations.handle = decorations.maximize =
|
|
||||||
functions.resize = functions.maximize = false;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BaseDisplay::DECOR_TOOL:
|
|
||||||
decorations.titlebar = decorations.menu = functions.move = true;
|
|
||||||
decorations.iconify = decorations.border = decorations.handle =
|
|
||||||
decorations.maximize = functions.resize = functions.maximize =
|
|
||||||
functions.iconify = false;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
reconfigure();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3466,6 +3432,61 @@ void FluxboxWindow::shapeEvent(XShapeEvent *) {
|
||||||
#endif // SHAPE
|
#endif // SHAPE
|
||||||
|
|
||||||
|
|
||||||
|
void FluxboxWindow::setDecoration(Decoration decoration) {
|
||||||
|
|
||||||
|
switch (decoration) {
|
||||||
|
case DECOR_NONE:
|
||||||
|
decorations.titlebar = decorations.border = decorations.handle =
|
||||||
|
decorations.iconify = decorations.maximize =
|
||||||
|
decorations.menu = decorations.tab = false; //tab is also a decor
|
||||||
|
functions.resize = functions.move = functions.iconify =
|
||||||
|
functions.maximize = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
case DECOR_NORMAL:
|
||||||
|
decorations.titlebar = decorations.border = decorations.handle =
|
||||||
|
decorations.iconify = decorations.maximize =
|
||||||
|
decorations.menu = true;
|
||||||
|
functions.resize = functions.move = functions.iconify =
|
||||||
|
functions.maximize = true;
|
||||||
|
XMapSubwindows(display, frame.window);
|
||||||
|
XMapWindow(display, frame.window);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DECOR_TINY:
|
||||||
|
decorations.titlebar = decorations.iconify = decorations.menu =
|
||||||
|
functions.move = functions.iconify = true;
|
||||||
|
decorations.border = decorations.handle = decorations.maximize =
|
||||||
|
functions.resize = functions.maximize = false;
|
||||||
|
XMapSubwindows(display, frame.window);
|
||||||
|
XMapWindow(display, frame.window);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DECOR_TOOL:
|
||||||
|
decorations.titlebar = decorations.menu = functions.move = true;
|
||||||
|
decorations.iconify = decorations.border = decorations.handle =
|
||||||
|
decorations.maximize = functions.resize = functions.maximize =
|
||||||
|
functions.iconify = false;
|
||||||
|
decorate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
reconfigure();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FluxboxWindow::toggleDecoration() {
|
||||||
|
static bool decor = false;
|
||||||
|
if (!decor) {
|
||||||
|
setDecoration(DECOR_NONE);
|
||||||
|
decor = true;
|
||||||
|
} else {
|
||||||
|
setDecoration(old_decoration);
|
||||||
|
decor = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
bool FluxboxWindow::validateClient(void) {
|
bool FluxboxWindow::validateClient(void) {
|
||||||
XSync(display, false);
|
XSync(display, false);
|
||||||
|
|
||||||
|
@ -3586,6 +3607,7 @@ void FluxboxWindow::stopResizing(Window win) {
|
||||||
XUngrabPointer(display, CurrentTime);
|
XUngrabPointer(display, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FluxboxWindow::restore(void) {
|
void FluxboxWindow::restore(void) {
|
||||||
XChangeSaveSet(display, client.window, SetModeDelete);
|
XChangeSaveSet(display, client.window, SetModeDelete);
|
||||||
XSelectInput(display, client.window, NoEventMask);
|
XSelectInput(display, client.window, NoEventMask);
|
||||||
|
@ -3652,45 +3674,10 @@ void FluxboxWindow::changeBlackboxHints(BaseDisplay::BlackboxHints *net) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (net->flags & BaseDisplay::ATTRIB_DECORATION) {
|
if (net->flags & BaseDisplay::ATTRIB_DECORATION) {
|
||||||
switch (net->decoration) {
|
old_decoration = static_cast<Decoration>(net->decoration);
|
||||||
case BaseDisplay::DECOR_NONE:
|
setDecoration(old_decoration);
|
||||||
decorations.titlebar = decorations.border = decorations.handle =
|
|
||||||
decorations.iconify = decorations.maximize =
|
|
||||||
decorations.menu = decorations.tab = false; //tab is also a decor
|
|
||||||
functions.resize = functions.move = functions.iconify =
|
|
||||||
functions.maximize = false;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
case BaseDisplay::DECOR_NORMAL:
|
|
||||||
decorations.titlebar = decorations.border = decorations.handle =
|
|
||||||
decorations.iconify = decorations.maximize =
|
|
||||||
decorations.menu = true;
|
|
||||||
functions.resize = functions.move = functions.iconify =
|
|
||||||
functions.maximize = true;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BaseDisplay::DECOR_TINY:
|
|
||||||
decorations.titlebar = decorations.iconify = decorations.menu =
|
|
||||||
functions.move = functions.iconify = true;
|
|
||||||
decorations.border = decorations.handle = decorations.maximize =
|
|
||||||
functions.resize = functions.maximize = false;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BaseDisplay::DECOR_TOOL:
|
|
||||||
decorations.titlebar = decorations.menu = functions.move = true;
|
|
||||||
decorations.iconify = decorations.border = decorations.handle =
|
|
||||||
decorations.maximize = functions.resize = functions.maximize =
|
|
||||||
functions.iconify = false;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
reconfigure();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Window.hh,v 1.16 2002/04/04 13:19:10 fluxgen Exp $
|
// $Id: Window.hh,v 1.17 2002/04/04 14:23:30 fluxgen Exp $
|
||||||
|
|
||||||
#ifndef WINDOW_HH
|
#ifndef WINDOW_HH
|
||||||
#define WINDOW_HH
|
#define WINDOW_HH
|
||||||
|
@ -117,6 +117,9 @@ public:
|
||||||
LAYER_TOP = 0x08
|
LAYER_TOP = 0x08
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Decoration {DECOR_NONE=0, DECOR_NORMAL, DECOR_TINY, DECOR_TOOL};
|
||||||
|
|
||||||
|
|
||||||
FluxboxWindow(Window, BScreen * = 0);
|
FluxboxWindow(Window, BScreen * = 0);
|
||||||
virtual ~FluxboxWindow(void);
|
virtual ~FluxboxWindow(void);
|
||||||
|
|
||||||
|
@ -197,6 +200,9 @@ public:
|
||||||
void propertyNotifyEvent(Atom);
|
void propertyNotifyEvent(Atom);
|
||||||
void exposeEvent(XExposeEvent *);
|
void exposeEvent(XExposeEvent *);
|
||||||
void configureRequestEvent(XConfigureRequestEvent *);
|
void configureRequestEvent(XConfigureRequestEvent *);
|
||||||
|
|
||||||
|
void setDecoration(Decoration decoration);
|
||||||
|
void toggleDecoration();
|
||||||
|
|
||||||
static void showError(FluxboxWindow::Error error);
|
static void showError(FluxboxWindow::Error error);
|
||||||
|
|
||||||
|
@ -235,6 +241,7 @@ private:
|
||||||
unsigned int workspace_number;
|
unsigned int workspace_number;
|
||||||
unsigned long current_state;
|
unsigned long current_state;
|
||||||
WinLayer m_layer;
|
WinLayer m_layer;
|
||||||
|
Decoration old_decoration;
|
||||||
|
|
||||||
struct _client {
|
struct _client {
|
||||||
FluxboxWindow *transient_for, // which window are we a transient for?
|
FluxboxWindow *transient_for, // which window are we a transient for?
|
||||||
|
@ -256,7 +263,7 @@ private:
|
||||||
|
|
||||||
struct _decorations {
|
struct _decorations {
|
||||||
bool titlebar, handle, border, iconify,
|
bool titlebar, handle, border, iconify,
|
||||||
maximize, close, menu, sticky, shade, tab;
|
maximize, close, menu, sticky, shade, tab;
|
||||||
} decorations;
|
} decorations;
|
||||||
|
|
||||||
struct _functions {
|
struct _functions {
|
||||||
|
@ -309,7 +316,9 @@ private:
|
||||||
void startMoving(Window win);
|
void startMoving(Window win);
|
||||||
void stopMoving();
|
void stopMoving();
|
||||||
void startResizing(XMotionEvent *me, bool left);
|
void startResizing(XMotionEvent *me, bool left);
|
||||||
void stopResizing(Window win=0);
|
void stopResizing(Window win=0);
|
||||||
|
|
||||||
|
|
||||||
#ifdef GNOME
|
#ifdef GNOME
|
||||||
|
|
||||||
void updateGnomeAtoms();
|
void updateGnomeAtoms();
|
||||||
|
|
Loading…
Reference in a new issue