diff options
-rw-r--r-- | src/Window.cc | 94 |
1 files changed, 46 insertions, 48 deletions
diff --git a/src/Window.cc b/src/Window.cc index 2827fb1..1669df9 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.17 2002/01/10 12:54:27 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.18 2002/01/11 10:04:32 fluxgen Exp $ |
26 | 26 | ||
27 | // stupid macros needed to access some functions in version 2 of the GNU C | 27 | // stupid macros needed to access some functions in version 2 of the GNU C |
28 | // library | 28 | // library |
@@ -107,22 +107,22 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s) { | |||
107 | for (char c=0; c<2; c++) { | 107 | for (char c=0; c<2; c++) { |
108 | for (unsigned int i=0; i<dir.size(); i++) { | 108 | for (unsigned int i=0; i<dir.size(); i++) { |
109 | switch (dir[i]) { | 109 | switch (dir[i]) { |
110 | case Fluxbox::Shade: | 110 | case Fluxbox::SHADE: |
111 | decorations.shade = true; | 111 | decorations.shade = true; |
112 | break; | 112 | break; |
113 | case Fluxbox::Maximize: | 113 | case Fluxbox::MAXIMIZE: |
114 | decorations.maximize = true; | 114 | decorations.maximize = true; |
115 | break; | 115 | break; |
116 | case Fluxbox::Minimize: | 116 | case Fluxbox::MINIMIZE: |
117 | decorations.iconify = true; | 117 | decorations.iconify = true; |
118 | break; | 118 | break; |
119 | case Fluxbox::Stick: | 119 | case Fluxbox::STICK: |
120 | decorations.sticky = true; | 120 | decorations.sticky = true; |
121 | break; | 121 | break; |
122 | case Fluxbox::Close: | 122 | case Fluxbox::CLOSE: |
123 | decorations.close = true; | 123 | decorations.close = true; |
124 | break; | 124 | break; |
125 | case Fluxbox::Menu: | 125 | case Fluxbox::MENU: |
126 | decorations.menu = true; | 126 | decorations.menu = true; |
127 | break; | 127 | break; |
128 | default: | 128 | default: |
@@ -362,15 +362,13 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s) { | |||
362 | 362 | ||
363 | associateClientWindow(); | 363 | associateClientWindow(); |
364 | 364 | ||
365 | if (! (screen->isSloppyFocus() || screen->isSemiSloppyFocus())) { | 365 | |
366 | XGrabButton(display, Button1, AnyModifier, | 366 | XGrabButton(display, Button1, AnyModifier, |
367 | frame.plate, True, ButtonPressMask, | 367 | frame.plate, True, ButtonPressMask, |
368 | GrabModeSync, GrabModeSync, None, None); | 368 | GrabModeSync, GrabModeSync, None, None); |
369 | XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame.plate); | 369 | XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame.plate); |
370 | 370 | ||
371 | } else | 371 | |
372 | XUngrabButton(display, Button1, AnyModifier, frame.plate); | ||
373 | |||
374 | XGrabButton(display, Button1, Mod1Mask, frame.window, True, | 372 | XGrabButton(display, Button1, Mod1Mask, frame.window, True, |
375 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, | 373 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, |
376 | GrabModeAsync, None, fluxbox->getMoveCursor()); | 374 | GrabModeAsync, None, fluxbox->getMoveCursor()); |
@@ -437,6 +435,7 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s) { | |||
437 | XChangeProperty(display, client.window, screen->getBaseDisplay()->getGnomeWorkspaceAtom(), XA_CARDINAL, 32, | 435 | XChangeProperty(display, client.window, screen->getBaseDisplay()->getGnomeWorkspaceAtom(), XA_CARDINAL, 32, |
438 | PropModeReplace, (unsigned char *)&val, 1); | 436 | PropModeReplace, (unsigned char *)&val, 1); |
439 | #endif | 437 | #endif |
438 | |||
440 | } | 439 | } |
441 | 440 | ||
442 | 441 | ||
@@ -667,22 +666,22 @@ void FluxboxWindow::associateClientWindow(void) { | |||
667 | #endif // SHAPE | 666 | #endif // SHAPE |
668 | //create the buttons | 667 | //create the buttons |
669 | if (decorations.iconify) | 668 | if (decorations.iconify) |
670 | createButton(Fluxbox::Minimize, FluxboxWindow::iconifyPressed_cb, FluxboxWindow::iconifyButton_cb, FluxboxWindow::iconifyDraw_cb); | 669 | createButton(Fluxbox::MINIMIZE, FluxboxWindow::iconifyPressed_cb, FluxboxWindow::iconifyButton_cb, FluxboxWindow::iconifyDraw_cb); |
671 | if (decorations.maximize) | 670 | if (decorations.maximize) |
672 | createButton(Fluxbox::Maximize, FluxboxWindow::maximizePressed_cb, FluxboxWindow::maximizeButton_cb, | 671 | createButton(Fluxbox::MAXIMIZE, FluxboxWindow::maximizePressed_cb, FluxboxWindow::maximizeButton_cb, |
673 | FluxboxWindow::maximizeDraw_cb); | 672 | FluxboxWindow::maximizeDraw_cb); |
674 | if (decorations.close) | 673 | if (decorations.close) |
675 | createButton(Fluxbox::Close, FluxboxWindow::closePressed_cb, | 674 | createButton(Fluxbox::CLOSE, FluxboxWindow::closePressed_cb, |
676 | FluxboxWindow::closeButton_cb, FluxboxWindow::closeDraw_cb); | 675 | FluxboxWindow::closeButton_cb, FluxboxWindow::closeDraw_cb); |
677 | if (decorations.sticky) | 676 | if (decorations.sticky) |
678 | createButton(Fluxbox::Stick, FluxboxWindow::stickyPressed_cb, | 677 | createButton(Fluxbox::STICK, FluxboxWindow::stickyPressed_cb, |
679 | FluxboxWindow::stickyButton_cb, FluxboxWindow::stickyDraw_cb); | 678 | FluxboxWindow::stickyButton_cb, FluxboxWindow::stickyDraw_cb); |
680 | 679 | ||
681 | if (decorations.menu)//TODO | 680 | if (decorations.menu)//TODO |
682 | createButton(Fluxbox::Menu, 0, 0, 0); | 681 | createButton(Fluxbox::MENU, 0, 0, 0); |
683 | 682 | ||
684 | if (decorations.shade) | 683 | if (decorations.shade) |
685 | createButton(Fluxbox::Shade, 0, FluxboxWindow::shadeButton_cb, FluxboxWindow::shadeDraw_cb); | 684 | createButton(Fluxbox::SHADE, 0, FluxboxWindow::shadeButton_cb, FluxboxWindow::shadeDraw_cb); |
686 | 685 | ||
687 | if (frame.ubutton) { | 686 | if (frame.ubutton) { |
688 | for (unsigned int i=0; i<buttonlist.size(); i++) | 687 | for (unsigned int i=0; i<buttonlist.size(); i++) |
@@ -1298,7 +1297,7 @@ void FluxboxWindow::getWMHints(void) { | |||
1298 | if (! wmhint) { | 1297 | if (! wmhint) { |
1299 | visible = true; | 1298 | visible = true; |
1300 | iconic = false; | 1299 | iconic = false; |
1301 | focus_mode = F_Passive; | 1300 | focus_mode = F_PASSIVE; |
1302 | client.window_group = None; | 1301 | client.window_group = None; |
1303 | client.initial_state = NormalState; | 1302 | client.initial_state = NormalState; |
1304 | } else { | 1303 | } else { |
@@ -1306,17 +1305,17 @@ void FluxboxWindow::getWMHints(void) { | |||
1306 | if (wmhint->flags & InputHint) { | 1305 | if (wmhint->flags & InputHint) { |
1307 | if (wmhint->input == true) { | 1306 | if (wmhint->input == true) { |
1308 | if (send_focus_message) | 1307 | if (send_focus_message) |
1309 | focus_mode = F_LocallyActive; | 1308 | focus_mode = F_LOCALLYACTIVE; |
1310 | else | 1309 | else |
1311 | focus_mode = F_Passive; | 1310 | focus_mode = F_PASSIVE; |
1312 | } else { | 1311 | } else { |
1313 | if (send_focus_message) | 1312 | if (send_focus_message) |
1314 | focus_mode = F_GloballyActive; | 1313 | focus_mode = F_GLOBALLYACTIVE; |
1315 | else | 1314 | else |
1316 | focus_mode = F_NoInput; | 1315 | focus_mode = F_NOINPUT; |
1317 | } | 1316 | } |
1318 | } else | 1317 | } else |
1319 | focus_mode = F_Passive; | 1318 | focus_mode = F_PASSIVE; |
1320 | 1319 | ||
1321 | if (wmhint->flags & StateHint) | 1320 | if (wmhint->flags & StateHint) |
1322 | client.initial_state = wmhint->initial_state; | 1321 | client.initial_state = wmhint->initial_state; |
@@ -1415,14 +1414,14 @@ void FluxboxWindow::getMWMHints(void) { | |||
1415 | else { | 1414 | else { |
1416 | decorations.titlebar = decorations.handle = decorations.border = | 1415 | decorations.titlebar = decorations.handle = decorations.border = |
1417 | decorations.iconify = decorations.maximize = | 1416 | decorations.iconify = decorations.maximize = |
1418 | decorations.close = decorations.menu = false; | 1417 | decorations.close = decorations.menu = decorations.tab = false; |
1419 | 1418 | ||
1420 | if (client.mwm_hint->decorations & MwmDecorBorder) | 1419 | if (client.mwm_hint->decorations & MwmDecorBorder) |
1421 | decorations.border = true; | 1420 | decorations.border = true; |
1422 | if (client.mwm_hint->decorations & MwmDecorHandle) | 1421 | if (client.mwm_hint->decorations & MwmDecorHandle) |
1423 | decorations.handle = true; | 1422 | decorations.handle = true; |
1424 | if (client.mwm_hint->decorations & MwmDecorTitle) | 1423 | if (client.mwm_hint->decorations & MwmDecorTitle) |
1425 | decorations.titlebar = true; | 1424 | decorations.titlebar = decorations.tab = true; //only tab on windows with titlebar |
1426 | if (client.mwm_hint->decorations & MwmDecorMenu) | 1425 | if (client.mwm_hint->decorations & MwmDecorMenu) |
1427 | decorations.menu = true; | 1426 | decorations.menu = true; |
1428 | if (client.mwm_hint->decorations & MwmDecorIconify) | 1427 | if (client.mwm_hint->decorations & MwmDecorIconify) |
@@ -1492,7 +1491,7 @@ void FluxboxWindow::getBlackboxHints(void) { | |||
1492 | case BaseDisplay::DECOR_NONE: | 1491 | case BaseDisplay::DECOR_NONE: |
1493 | decorations.titlebar = decorations.border = decorations.handle = | 1492 | decorations.titlebar = decorations.border = decorations.handle = |
1494 | decorations.iconify = decorations.maximize = | 1493 | decorations.iconify = decorations.maximize = |
1495 | decorations.menu = false; | 1494 | decorations.menu = decorations.tab = false; //tab is also a decor |
1496 | functions.resize = functions.move = functions.iconify = | 1495 | functions.resize = functions.move = functions.iconify = |
1497 | functions.maximize = false; | 1496 | functions.maximize = false; |
1498 | 1497 | ||
@@ -1651,7 +1650,7 @@ bool FluxboxWindow::setInputFocus(void) { | |||
1651 | ret = client.transient->setInputFocus(); | 1650 | ret = client.transient->setInputFocus(); |
1652 | else { | 1651 | else { |
1653 | if (! focused) { | 1652 | if (! focused) { |
1654 | if (focus_mode == F_LocallyActive || focus_mode == F_Passive) | 1653 | if (focus_mode == F_LOCALLYACTIVE || focus_mode == F_PASSIVE) |
1655 | XSetInputFocus(display, client.window, | 1654 | XSetInputFocus(display, client.window, |
1656 | RevertToPointerRoot, CurrentTime); | 1655 | RevertToPointerRoot, CurrentTime); |
1657 | else | 1656 | else |
@@ -1793,8 +1792,8 @@ void FluxboxWindow::close(void) { | |||
1793 | void FluxboxWindow::withdraw(void) { | 1792 | void FluxboxWindow::withdraw(void) { |
1794 | visible = false; | 1793 | visible = false; |
1795 | iconic = false; | 1794 | iconic = false; |
1796 | // | 1795 | // |
1797 | // setState(WithdrawnState); | 1796 | // setState(WithdrawnState); |
1798 | // | 1797 | // |
1799 | XUnmapWindow(display, frame.window); | 1798 | XUnmapWindow(display, frame.window); |
1800 | 1799 | ||
@@ -1822,12 +1821,12 @@ void FluxboxWindow::maximize(unsigned int button) { | |||
1822 | { | 1821 | { |
1823 | switch(screen->getSlitDirection()) | 1822 | switch(screen->getSlitDirection()) |
1824 | { | 1823 | { |
1825 | case Slit::Vertical: | 1824 | case Slit::VERTICAL: |
1826 | switch(screen->getSlitPlacement()) | 1825 | switch(screen->getSlitPlacement()) |
1827 | { | 1826 | { |
1828 | case Slit::TopRight: | 1827 | case Slit::TOPRIGHT: |
1829 | case Slit::CenterRight: | 1828 | case Slit::CENTERRIGHT: |
1830 | case Slit::BottomRight: | 1829 | case Slit::BOTTOMRIGHT: |
1831 | slitModR = mSlt->getWidth() + screen->getBevelWidth(); | 1830 | slitModR = mSlt->getWidth() + screen->getBevelWidth(); |
1832 | break; | 1831 | break; |
1833 | default: | 1832 | default: |
@@ -1835,12 +1834,12 @@ void FluxboxWindow::maximize(unsigned int button) { | |||
1835 | break; | 1834 | break; |
1836 | } | 1835 | } |
1837 | break; | 1836 | break; |
1838 | case Slit::Horizontal: | 1837 | case Slit::HORIZONTAL: |
1839 | switch(screen->getSlitPlacement()) | 1838 | switch(screen->getSlitPlacement()) |
1840 | { | 1839 | { |
1841 | case Slit::TopLeft: | 1840 | case Slit::TOPLEFT: |
1842 | case Slit::TopCenter: | 1841 | case Slit::TOPCENTER: |
1843 | case Slit::TopRight: | 1842 | case Slit::TOPRIGHT: |
1844 | slitModT = mSlt->getHeight() + screen->getBevelWidth(); | 1843 | slitModT = mSlt->getHeight() + screen->getBevelWidth(); |
1845 | switch (screen->getToolbarPlacement()) { | 1844 | switch (screen->getToolbarPlacement()) { |
1846 | case Toolbar::TOPLEFT: | 1845 | case Toolbar::TOPLEFT: |
@@ -2684,16 +2683,16 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) { | |||
2684 | default: | 2683 | default: |
2685 | if (atom == fluxbox->getWMProtocolsAtom()) { | 2684 | if (atom == fluxbox->getWMProtocolsAtom()) { |
2686 | getWMProtocols(); | 2685 | getWMProtocols(); |
2687 | 2686 | ||
2688 | if (decorations.close && !findTitleButton(Fluxbox::Close)) { | 2687 | if (decorations.close && !findTitleButton(Fluxbox::CLOSE)) { |
2689 | createButton(Fluxbox::Close, FluxboxWindow::closePressed_cb, | 2688 | createButton(Fluxbox::CLOSE, FluxboxWindow::closePressed_cb, |
2690 | FluxboxWindow::closeButton_cb, FluxboxWindow::closeDraw_cb); | 2689 | FluxboxWindow::closeButton_cb, FluxboxWindow::closeDraw_cb); |
2691 | 2690 | ||
2692 | if (decorations.titlebar) | 2691 | if (decorations.titlebar) |
2693 | positionButtons(true); | 2692 | positionButtons(true); |
2694 | if (windowmenu) | 2693 | if (windowmenu) |
2695 | windowmenu->reconfigure(); | 2694 | windowmenu->reconfigure(); |
2696 | } | 2695 | } |
2697 | } | 2696 | } |
2698 | 2697 | ||
2699 | break; | 2698 | break; |
@@ -2781,8 +2780,7 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent *be) { | |||
2781 | 2780 | ||
2782 | if (! validateClient()) | 2781 | if (! validateClient()) |
2783 | return; | 2782 | return; |
2784 | 2783 | ||
2785 | |||
2786 | if (be->button == 1 || (be->button == 3 && be->state == Mod1Mask)) { | 2784 | if (be->button == 1 || (be->button == 3 && be->state == Mod1Mask)) { |
2787 | if ((! focused) && (! screen->isSloppyFocus())) //check focus | 2785 | if ((! focused) && (! screen->isSloppyFocus())) //check focus |
2788 | setInputFocus(); | 2786 | setInputFocus(); |
@@ -3245,7 +3243,7 @@ void FluxboxWindow::changeBlackboxHints(BaseDisplay::BlackboxHints *net) { | |||
3245 | case BaseDisplay::DECOR_NONE: | 3243 | case BaseDisplay::DECOR_NONE: |
3246 | decorations.titlebar = decorations.border = decorations.handle = | 3244 | decorations.titlebar = decorations.border = decorations.handle = |
3247 | decorations.iconify = decorations.maximize = | 3245 | decorations.iconify = decorations.maximize = |
3248 | decorations.menu = false; | 3246 | decorations.menu = decorations.tab = false; //tab is also a decor |
3249 | functions.resize = functions.move = functions.iconify = | 3247 | functions.resize = functions.move = functions.iconify = |
3250 | functions.maximize = false; | 3248 | functions.maximize = false; |
3251 | 3249 | ||