diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Window.cc | 153 | ||||
-rw-r--r-- | src/Window.hh | 15 |
2 files changed, 82 insertions, 86 deletions
diff --git a/src/Window.cc b/src/Window.cc index a6689cb..8ed85ff 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.38 2002/04/04 13:19:10 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.39 2002/04/04 14:23:30 fluxgen Exp $ |
26 | 26 | ||
27 | //use GNU extensions | 27 | //use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -1689,12 +1689,13 @@ void FluxboxWindow::getBlackboxHints(void) { | |||
1689 | Fluxbox *fluxbox = Fluxbox::instance(); | 1689 | Fluxbox *fluxbox = Fluxbox::instance(); |
1690 | 1690 | ||
1691 | if (XGetWindowProperty(display, client.window, | 1691 | if (XGetWindowProperty(display, client.window, |
1692 | fluxbox->getFluxboxHintsAtom(), 0, | 1692 | fluxbox->getFluxboxHintsAtom(), 0, |
1693 | PropBlackboxHintsElements, false, | 1693 | PropBlackboxHintsElements, False, |
1694 | fluxbox->getFluxboxHintsAtom(), &atom_return, | 1694 | fluxbox->getFluxboxHintsAtom(), &atom_return, |
1695 | &format, &num, &len, | 1695 | &format, &num, &len, |
1696 | (unsigned char **) &client.blackbox_hint) == Success && | 1696 | (unsigned char **) &client.blackbox_hint) == Success && |
1697 | client.blackbox_hint) | 1697 | client.blackbox_hint) { |
1698 | |||
1698 | if (num == PropBlackboxHintsElements) { | 1699 | if (num == PropBlackboxHintsElements) { |
1699 | if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_SHADED) | 1700 | if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_SHADED) |
1700 | shaded = (client.blackbox_hint->attrib & BaseDisplay::ATTRIB_SHADED); | 1701 | shaded = (client.blackbox_hint->attrib & BaseDisplay::ATTRIB_SHADED); |
@@ -1716,46 +1717,11 @@ void FluxboxWindow::getBlackboxHints(void) { | |||
1716 | 1717 | ||
1717 | 1718 | ||
1718 | if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_DECORATION) { | 1719 | if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_DECORATION) { |
1719 | switch (client.blackbox_hint->decoration) { | 1720 | old_decoration = static_cast<Decoration>(client.blackbox_hint->decoration); |
1720 | case BaseDisplay::DECOR_NONE: | 1721 | setDecoration(old_decoration); |
1721 | decorations.titlebar = decorations.border = decorations.handle = | ||
1722 | decorations.iconify = decorations.maximize = | ||
1723 | decorations.menu = decorations.tab = false; //tab is also a decor | ||
1724 | functions.resize = functions.move = functions.iconify = | ||
1725 | functions.maximize = false; | ||
1726 | |||
1727 | break; | ||
1728 | |||
1729 | default: | ||
1730 | case BaseDisplay::DECOR_NORMAL: | ||
1731 | decorations.titlebar = decorations.border = decorations.handle = | ||
1732 | decorations.iconify = decorations.maximize = | ||
1733 | decorations.menu = true; | ||
1734 | functions.resize = functions.move = functions.iconify = | ||
1735 | functions.maximize = true; | ||
1736 | |||
1737 | break; | ||
1738 | |||
1739 | case BaseDisplay::DECOR_TINY: | ||
1740 | decorations.titlebar = decorations.iconify = decorations.menu = | ||
1741 | functions.move = functions.iconify = true; | ||
1742 | decorations.border = decorations.handle = decorations.maximize = | ||
1743 | functions.resize = functions.maximize = false; | ||
1744 | |||
1745 | break; | ||
1746 | |||
1747 | case BaseDisplay::DECOR_TOOL: | ||
1748 | decorations.titlebar = decorations.menu = functions.move = true; | ||
1749 | decorations.iconify = decorations.border = decorations.handle = | ||
1750 | decorations.maximize = functions.resize = functions.maximize = | ||
1751 | functions.iconify = false; | ||
1752 | |||
1753 | break; | ||
1754 | } | ||
1755 | |||
1756 | reconfigure(); | ||
1757 | } | 1722 | } |
1758 | } | 1723 | } |
1724 | } | ||
1759 | } | 1725 | } |
1760 | 1726 | ||
1761 | 1727 | ||
@@ -3466,6 +3432,61 @@ void FluxboxWindow::shapeEvent(XShapeEvent *) { | |||
3466 | #endif // SHAPE | 3432 | #endif // SHAPE |
3467 | 3433 | ||
3468 | 3434 | ||
3435 | void FluxboxWindow::setDecoration(Decoration decoration) { | ||
3436 | |||
3437 | switch (decoration) { | ||
3438 | case DECOR_NONE: | ||
3439 | decorations.titlebar = decorations.border = decorations.handle = | ||
3440 | decorations.iconify = decorations.maximize = | ||
3441 | decorations.menu = decorations.tab = false; //tab is also a decor | ||
3442 | functions.resize = functions.move = functions.iconify = | ||
3443 | functions.maximize = false; | ||
3444 | break; | ||
3445 | |||
3446 | default: | ||
3447 | case DECOR_NORMAL: | ||
3448 | decorations.titlebar = decorations.border = decorations.handle = | ||
3449 | decorations.iconify = decorations.maximize = | ||
3450 | decorations.menu = true; | ||
3451 | functions.resize = functions.move = functions.iconify = | ||
3452 | functions.maximize = true; | ||
3453 | XMapSubwindows(display, frame.window); | ||
3454 | XMapWindow(display, frame.window); | ||
3455 | |||
3456 | break; | ||
3457 | |||
3458 | case DECOR_TINY: | ||
3459 | decorations.titlebar = decorations.iconify = decorations.menu = | ||
3460 | functions.move = functions.iconify = true; | ||
3461 | decorations.border = decorations.handle = decorations.maximize = | ||
3462 | functions.resize = functions.maximize = false; | ||
3463 | XMapSubwindows(display, frame.window); | ||
3464 | XMapWindow(display, frame.window); | ||
3465 | break; | ||
3466 | |||
3467 | case DECOR_TOOL: | ||
3468 | decorations.titlebar = decorations.menu = functions.move = true; | ||
3469 | decorations.iconify = decorations.border = decorations.handle = | ||
3470 | decorations.maximize = functions.resize = functions.maximize = | ||
3471 | functions.iconify = false; | ||
3472 | decorate(); | ||
3473 | break; | ||
3474 | } | ||
3475 | |||
3476 | reconfigure(); | ||
3477 | |||
3478 | } | ||
3479 | |||
3480 | void FluxboxWindow::toggleDecoration() { | ||
3481 | static bool decor = false; | ||
3482 | if (!decor) { | ||
3483 | setDecoration(DECOR_NONE); | ||
3484 | decor = true; | ||
3485 | } else { | ||
3486 | setDecoration(old_decoration); | ||
3487 | decor = false; | ||
3488 | } | ||
3489 | } | ||
3469 | bool FluxboxWindow::validateClient(void) { | 3490 | bool FluxboxWindow::validateClient(void) { |
3470 | XSync(display, false); | 3491 | XSync(display, false); |
3471 | 3492 | ||
@@ -3586,6 +3607,7 @@ void FluxboxWindow::stopResizing(Window win) { | |||
3586 | XUngrabPointer(display, CurrentTime); | 3607 | XUngrabPointer(display, CurrentTime); |
3587 | } | 3608 | } |
3588 | 3609 | ||
3610 | |||
3589 | void FluxboxWindow::restore(void) { | 3611 | void FluxboxWindow::restore(void) { |
3590 | XChangeSaveSet(display, client.window, SetModeDelete); | 3612 | XChangeSaveSet(display, client.window, SetModeDelete); |
3591 | XSelectInput(display, client.window, NoEventMask); | 3613 | XSelectInput(display, client.window, NoEventMask); |
@@ -3652,45 +3674,10 @@ void FluxboxWindow::changeBlackboxHints(BaseDisplay::BlackboxHints *net) { | |||
3652 | } | 3674 | } |
3653 | 3675 | ||
3654 | if (net->flags & BaseDisplay::ATTRIB_DECORATION) { | 3676 | if (net->flags & BaseDisplay::ATTRIB_DECORATION) { |
3655 | switch (net->decoration) { | 3677 | old_decoration = static_cast<Decoration>(net->decoration); |
3656 | case BaseDisplay::DECOR_NONE: | 3678 | setDecoration(old_decoration); |
3657 | decorations.titlebar = decorations.border = decorations.handle = | ||
3658 | decorations.iconify = decorations.maximize = | ||
3659 | decorations.menu = decorations.tab = false; //tab is also a decor | ||
3660 | functions.resize = functions.move = functions.iconify = | ||
3661 | functions.maximize = false; | ||
3662 | |||
3663 | break; | ||
3664 | |||
3665 | default: | ||
3666 | case BaseDisplay::DECOR_NORMAL: | ||
3667 | decorations.titlebar = decorations.border = decorations.handle = | ||
3668 | decorations.iconify = decorations.maximize = | ||
3669 | decorations.menu = true; | ||
3670 | functions.resize = functions.move = functions.iconify = | ||
3671 | functions.maximize = true; | ||
3672 | |||
3673 | break; | ||
3674 | |||
3675 | case BaseDisplay::DECOR_TINY: | ||
3676 | decorations.titlebar = decorations.iconify = decorations.menu = | ||
3677 | functions.move = functions.iconify = true; | ||
3678 | decorations.border = decorations.handle = decorations.maximize = | ||
3679 | functions.resize = functions.maximize = false; | ||
3680 | |||
3681 | break; | ||
3682 | |||
3683 | case BaseDisplay::DECOR_TOOL: | ||
3684 | decorations.titlebar = decorations.menu = functions.move = true; | ||
3685 | decorations.iconify = decorations.border = decorations.handle = | ||
3686 | decorations.maximize = functions.resize = functions.maximize = | ||
3687 | functions.iconify = false; | ||
3688 | |||
3689 | break; | ||
3690 | } | ||
3691 | |||
3692 | reconfigure(); | ||
3693 | } | 3679 | } |
3680 | |||
3694 | } | 3681 | } |
3695 | 3682 | ||
3696 | 3683 | ||
diff --git a/src/Window.hh b/src/Window.hh index 7d61873..4611385 100644 --- a/src/Window.hh +++ b/src/Window.hh | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.hh,v 1.16 2002/04/04 13:19:10 fluxgen Exp $ | 25 | // $Id: Window.hh,v 1.17 2002/04/04 14:23:30 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef WINDOW_HH | 27 | #ifndef WINDOW_HH |
28 | #define WINDOW_HH | 28 | #define WINDOW_HH |
@@ -117,6 +117,9 @@ public: | |||
117 | LAYER_TOP = 0x08 | 117 | LAYER_TOP = 0x08 |
118 | }; | 118 | }; |
119 | 119 | ||
120 | enum Decoration {DECOR_NONE=0, DECOR_NORMAL, DECOR_TINY, DECOR_TOOL}; | ||
121 | |||
122 | |||
120 | FluxboxWindow(Window, BScreen * = 0); | 123 | FluxboxWindow(Window, BScreen * = 0); |
121 | virtual ~FluxboxWindow(void); | 124 | virtual ~FluxboxWindow(void); |
122 | 125 | ||
@@ -197,6 +200,9 @@ public: | |||
197 | void propertyNotifyEvent(Atom); | 200 | void propertyNotifyEvent(Atom); |
198 | void exposeEvent(XExposeEvent *); | 201 | void exposeEvent(XExposeEvent *); |
199 | void configureRequestEvent(XConfigureRequestEvent *); | 202 | void configureRequestEvent(XConfigureRequestEvent *); |
203 | |||
204 | void setDecoration(Decoration decoration); | ||
205 | void toggleDecoration(); | ||
200 | 206 | ||
201 | static void showError(FluxboxWindow::Error error); | 207 | static void showError(FluxboxWindow::Error error); |
202 | 208 | ||
@@ -235,6 +241,7 @@ private: | |||
235 | unsigned int workspace_number; | 241 | unsigned int workspace_number; |
236 | unsigned long current_state; | 242 | unsigned long current_state; |
237 | WinLayer m_layer; | 243 | WinLayer m_layer; |
244 | Decoration old_decoration; | ||
238 | 245 | ||
239 | struct _client { | 246 | struct _client { |
240 | FluxboxWindow *transient_for, // which window are we a transient for? | 247 | FluxboxWindow *transient_for, // which window are we a transient for? |
@@ -256,7 +263,7 @@ private: | |||
256 | 263 | ||
257 | struct _decorations { | 264 | struct _decorations { |
258 | bool titlebar, handle, border, iconify, | 265 | bool titlebar, handle, border, iconify, |
259 | maximize, close, menu, sticky, shade, tab; | 266 | maximize, close, menu, sticky, shade, tab; |
260 | } decorations; | 267 | } decorations; |
261 | 268 | ||
262 | struct _functions { | 269 | struct _functions { |
@@ -309,7 +316,9 @@ private: | |||
309 | void startMoving(Window win); | 316 | void startMoving(Window win); |
310 | void stopMoving(); | 317 | void stopMoving(); |
311 | void startResizing(XMotionEvent *me, bool left); | 318 | void startResizing(XMotionEvent *me, bool left); |
312 | void stopResizing(Window win=0); | 319 | void stopResizing(Window win=0); |
320 | |||
321 | |||
313 | #ifdef GNOME | 322 | #ifdef GNOME |
314 | 323 | ||
315 | void updateGnomeAtoms(); | 324 | void updateGnomeAtoms(); |