aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-05-30 00:46:22 (GMT)
committerfluxgen <fluxgen>2002-05-30 00:46:22 (GMT)
commitc3dce81be1e09a2839122416e28d8310c563ce1d (patch)
treef736baf940d24c44635df9885f8f6814eeef553e /src/Window.cc
parentb43aed40723d54ec9e247e538149421e27117441 (diff)
downloadfluxbox-c3dce81be1e09a2839122416e28d8310c563ce1d.zip
fluxbox-c3dce81be1e09a2839122416e28d8310c563ce1d.tar.bz2
changed (void) to () and fixed if-statements in getMWMHints
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc163
1 files changed, 85 insertions, 78 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 0fca281..f45c4a1 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.54 2002/05/21 21:22:05 fluxgen Exp $ 25// $Id: Window.cc,v 1.55 2002/05/30 00:46:22 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -340,7 +340,7 @@ tab(0)
340} 340}
341 341
342 342
343FluxboxWindow::~FluxboxWindow(void) { 343FluxboxWindow::~FluxboxWindow() {
344 if (screen==0) //the window wasn't created 344 if (screen==0) //the window wasn't created
345 return; 345 return;
346 346
@@ -513,7 +513,7 @@ Window FluxboxWindow::createChildWindow(Window parent, Cursor cursor) {
513} 513}
514 514
515 515
516void FluxboxWindow::associateClientWindow(void) { 516void FluxboxWindow::associateClientWindow() {
517 XSetWindowBorderWidth(display, client.window, 0); 517 XSetWindowBorderWidth(display, client.window, 0);
518 getWMName(); 518 getWMName();
519 getWMIconName(); 519 getWMIconName();
@@ -601,7 +601,7 @@ void FluxboxWindow::associateClientWindow(void) {
601} 601}
602 602
603 603
604void FluxboxWindow::decorate(void) { 604void FluxboxWindow::decorate() {
605 605
606 if (tab) 606 if (tab)
607 tab->decorate(); 607 tab->decorate();
@@ -727,7 +727,7 @@ void FluxboxWindow::decorate(void) {
727} 727}
728 728
729 729
730void FluxboxWindow::decorateLabel(void) { 730void FluxboxWindow::decorateLabel() {
731 Pixmap tmp = frame.flabel; 731 Pixmap tmp = frame.flabel;
732 BTexture *texture = &(screen->getWindowStyle()->l_focus); 732 BTexture *texture = &(screen->getWindowStyle()->l_focus);
733 if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { 733 if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) {
@@ -1251,7 +1251,7 @@ void FluxboxWindow::positionButtons(bool redecorate_label) {
1251} 1251}
1252 1252
1253 1253
1254void FluxboxWindow::reconfigure(void) { 1254void FluxboxWindow::reconfigure() {
1255 upsize(); 1255 upsize();
1256 1256
1257 if (Fluxbox::instance()->useTabs()) { 1257 if (Fluxbox::instance()->useTabs()) {
@@ -1314,7 +1314,7 @@ void FluxboxWindow::reconfigure(void) {
1314} 1314}
1315 1315
1316 1316
1317void FluxboxWindow::positionWindows(void) { 1317void FluxboxWindow::positionWindows() {
1318 XResizeWindow(display, frame.window, frame.width, 1318 XResizeWindow(display, frame.window, frame.width,
1319 ((shaded) ? frame.title_h : frame.height)); 1319 ((shaded) ? frame.title_h : frame.height));
1320 XSetWindowBorderWidth(display, frame.window, screen->getBorderWidth()); 1320 XSetWindowBorderWidth(display, frame.window, screen->getBorderWidth());
@@ -1354,7 +1354,7 @@ void FluxboxWindow::positionWindows(void) {
1354} 1354}
1355 1355
1356 1356
1357void FluxboxWindow::getWMName(void) { 1357void FluxboxWindow::getWMName() {
1358 1358
1359 XTextProperty text_prop; 1359 XTextProperty text_prop;
1360 char **list; 1360 char **list;
@@ -1403,7 +1403,7 @@ void FluxboxWindow::getWMName(void) {
1403} 1403}
1404 1404
1405 1405
1406void FluxboxWindow::getWMIconName(void) { 1406void FluxboxWindow::getWMIconName() {
1407 1407
1408 XTextProperty text_prop; 1408 XTextProperty text_prop;
1409 char **list; 1409 char **list;
@@ -1433,7 +1433,7 @@ void FluxboxWindow::getWMIconName(void) {
1433} 1433}
1434 1434
1435 1435
1436void FluxboxWindow::getWMProtocols(void) { 1436void FluxboxWindow::getWMProtocols() {
1437 Atom *proto; 1437 Atom *proto;
1438 int num_return = 0; 1438 int num_return = 0;
1439 Fluxbox *fluxbox = Fluxbox::instance(); 1439 Fluxbox *fluxbox = Fluxbox::instance();
@@ -1453,7 +1453,7 @@ void FluxboxWindow::getWMProtocols(void) {
1453} 1453}
1454 1454
1455 1455
1456void FluxboxWindow::getWMHints(void) { 1456void FluxboxWindow::getWMHints() {
1457 XWMHints *wmhint = XGetWMHints(display, client.window); 1457 XWMHints *wmhint = XGetWMHints(display, client.window);
1458 if (! wmhint) { 1458 if (! wmhint) {
1459 visible = true; 1459 visible = true;
@@ -1496,7 +1496,7 @@ void FluxboxWindow::getWMHints(void) {
1496} 1496}
1497 1497
1498 1498
1499void FluxboxWindow::getWMNormalHints(void) { 1499void FluxboxWindow::getWMNormalHints() {
1500 long icccm_mask; 1500 long icccm_mask;
1501 XSizeHints sizehint; 1501 XSizeHints sizehint;
1502 if (! XGetWMNormalHints(display, client.window, &sizehint, &icccm_mask)) { 1502 if (! XGetWMNormalHints(display, client.window, &sizehint, &icccm_mask)) {
@@ -1554,67 +1554,74 @@ void FluxboxWindow::getWMNormalHints(void) {
1554} 1554}
1555 1555
1556 1556
1557void FluxboxWindow::getMWMHints(void) { 1557void FluxboxWindow::getMWMHints() {
1558 int format; 1558 int format;
1559 Atom atom_return; 1559 Atom atom_return;
1560 unsigned long num, len; 1560 unsigned long num, len;
1561 Fluxbox *fluxbox = Fluxbox::instance(); 1561 Fluxbox *fluxbox = Fluxbox::instance();
1562 if (XGetWindowProperty(display, client.window, 1562 if (!XGetWindowProperty(display, client.window,
1563 fluxbox->getMotifWMHintsAtom(), 0, 1563 fluxbox->getMotifWMHintsAtom(), 0,
1564 PropMwmHintsElements, false, 1564 PropMwmHintsElements, false,
1565 fluxbox->getMotifWMHintsAtom(), &atom_return, 1565 fluxbox->getMotifWMHintsAtom(), &atom_return,
1566 &format, &num, &len, 1566 &format, &num, &len,
1567 (unsigned char **) &client.mwm_hint) == Success && 1567 (unsigned char **) &client.mwm_hint) == Success &&
1568 client.mwm_hint) 1568 client.mwm_hint) {
1569 if (num == PropMwmHintsElements) { 1569 return;
1570 if (client.mwm_hint->flags & MwmHintsDecorations) 1570 }
1571 if (client.mwm_hint->decorations & MwmDecorAll) 1571 if (num != PropMwmHintsElements)
1572 decorations.titlebar = decorations.handle = decorations.border = 1572 return;
1573 decorations.iconify = decorations.maximize = 1573
1574 decorations.close = decorations.menu = true; 1574 if (client.mwm_hint->flags & MwmHintsDecorations) {
1575 else { 1575 if (client.mwm_hint->decorations & MwmDecorAll) {
1576 decorations.titlebar = decorations.handle = decorations.border = 1576 decorations.titlebar = decorations.handle = decorations.border =
1577 decorations.iconify = decorations.maximize = 1577 decorations.iconify = decorations.maximize =
1578 decorations.close = decorations.menu = decorations.tab = false; 1578 decorations.close = decorations.menu = true;
1579 1579 } else {
1580 if (client.mwm_hint->decorations & MwmDecorBorder) 1580 decorations.titlebar = decorations.handle = decorations.border =
1581 decorations.border = true; 1581 decorations.iconify = decorations.maximize =
1582 if (client.mwm_hint->decorations & MwmDecorHandle) 1582 decorations.close = decorations.menu = decorations.tab = false;
1583 decorations.handle = true; 1583
1584 if (client.mwm_hint->decorations & MwmDecorTitle) 1584 if (client.mwm_hint->decorations & MwmDecorBorder)
1585 decorations.titlebar = decorations.tab = true; //only tab on windows with titlebar 1585 decorations.border = true;
1586 if (client.mwm_hint->decorations & MwmDecorMenu) 1586 if (client.mwm_hint->decorations & MwmDecorHandle)
1587 decorations.menu = true; 1587 decorations.handle = true;
1588 if (client.mwm_hint->decorations & MwmDecorIconify) 1588 if (client.mwm_hint->decorations & MwmDecorTitle)
1589 decorations.iconify = true; 1589 decorations.titlebar = decorations.tab = true; //only tab on windows with titlebar
1590 if (client.mwm_hint->decorations & MwmDecorMaximize) 1590 if (client.mwm_hint->decorations & MwmDecorMenu)
1591 decorations.maximize = true; 1591 decorations.menu = true;
1592 } 1592 if (client.mwm_hint->decorations & MwmDecorIconify)
1593 1593 decorations.iconify = true;
1594 if (client.mwm_hint->flags & MwmHintsFunctions) 1594 if (client.mwm_hint->decorations & MwmDecorMaximize)
1595 if (client.mwm_hint->functions & MwmFuncAll) { 1595 decorations.maximize = true;
1596 functions.resize = functions.move = functions.iconify = 1596 }
1597 functions.maximize = functions.close = true; 1597 }
1598 } else { 1598
1599 functions.resize = functions.move = functions.iconify = 1599 if (client.mwm_hint->flags & MwmHintsFunctions) {
1600 functions.maximize = functions.close = false; 1600 if (client.mwm_hint->functions & MwmFuncAll) {
1601 1601 functions.resize = functions.move = functions.iconify =
1602 if (client.mwm_hint->functions & MwmFuncResize) 1602 functions.maximize = functions.close = true;
1603 functions.resize = true; 1603 } else {
1604 if (client.mwm_hint->functions & MwmFuncMove) 1604 functions.resize = functions.move = functions.iconify =
1605 functions.move = true; 1605 functions.maximize = functions.close = false;
1606 if (client.mwm_hint->functions & MwmFuncIconify) 1606
1607 functions.iconify = true; 1607 if (client.mwm_hint->functions & MwmFuncResize)
1608 if (client.mwm_hint->functions & MwmFuncMaximize) 1608 functions.resize = true;
1609 functions.maximize = true; 1609 if (client.mwm_hint->functions & MwmFuncMove)
1610 if (client.mwm_hint->functions & MwmFuncClose) 1610 functions.move = true;
1611 functions.close = true; 1611 if (client.mwm_hint->functions & MwmFuncIconify)
1612 } 1612 functions.iconify = true;
1613 if (client.mwm_hint->functions & MwmFuncMaximize)
1614 functions.maximize = true;
1615 if (client.mwm_hint->functions & MwmFuncClose)
1616 functions.close = true;
1613 } 1617 }
1618 }
1619
1620
1614} 1621}
1615 1622
1616 1623
1617void FluxboxWindow::getBlackboxHints(void) { 1624void FluxboxWindow::getBlackboxHints() {
1618 int format; 1625 int format;
1619 Atom atom_return; 1626 Atom atom_return;
1620 unsigned long num, len; 1627 unsigned long num, len;
@@ -1746,7 +1753,7 @@ void FluxboxWindow::configure(int dx, int dy,
1746} 1753}
1747 1754
1748 1755
1749bool FluxboxWindow::setInputFocus(void) { 1756bool FluxboxWindow::setInputFocus() {
1750 #ifdef GNOME 1757 #ifdef GNOME
1751 if (gnome_hints & WIN_HINTS_SKIP_FOCUS) 1758 if (gnome_hints & WIN_HINTS_SKIP_FOCUS)
1752 return false; 1759 return false;
@@ -1841,7 +1848,7 @@ void FluxboxWindow::setTab(bool flag) {
1841//------------- iconify ---------------- 1848//------------- iconify ----------------
1842// Unmaps the window and removes it from workspace list 1849// Unmaps the window and removes it from workspace list
1843//-------------------------------------- 1850//--------------------------------------
1844void FluxboxWindow::iconify(void) { 1851void FluxboxWindow::iconify() {
1845 1852
1846 if (iconic) 1853 if (iconic)
1847 return; 1854 return;
@@ -1912,7 +1919,7 @@ void FluxboxWindow::deiconify(bool reassoc, bool raise) {
1912} 1919}
1913 1920
1914 1921
1915void FluxboxWindow::close(void) { 1922void FluxboxWindow::close() {
1916 Fluxbox *fluxbox = Fluxbox::instance(); 1923 Fluxbox *fluxbox = Fluxbox::instance();
1917 XEvent ce; 1924 XEvent ce;
1918 ce.xclient.type = ClientMessage; 1925 ce.xclient.type = ClientMessage;
@@ -1929,7 +1936,7 @@ void FluxboxWindow::close(void) {
1929} 1936}
1930 1937
1931 1938
1932void FluxboxWindow::withdraw(void) { 1939void FluxboxWindow::withdraw() {
1933 visible = false; 1940 visible = false;
1934 iconic = false; 1941 iconic = false;
1935 if (isMoving()) 1942 if (isMoving())
@@ -2269,7 +2276,7 @@ void FluxboxWindow::setWorkspace(int n) {
2269} 2276}
2270 2277
2271 2278
2272void FluxboxWindow::shade(void) { 2279void FluxboxWindow::shade() {
2273 if (decorations.titlebar) { 2280 if (decorations.titlebar) {
2274 if (shaded) { 2281 if (shaded) {
2275 XResizeWindow(display, frame.window, frame.width, frame.height); 2282 XResizeWindow(display, frame.window, frame.width, frame.height);
@@ -2293,7 +2300,7 @@ void FluxboxWindow::shade(void) {
2293} 2300}
2294 2301
2295 2302
2296void FluxboxWindow::stick(void) { 2303void FluxboxWindow::stick() {
2297 2304
2298 if (tab) //if it got a tab then do tab's stick on all of the objects in the list 2305 if (tab) //if it got a tab then do tab's stick on all of the objects in the list
2299 tab->stick(); //this window will stick too. 2306 tab->stick(); //this window will stick too.
@@ -2450,7 +2457,7 @@ void FluxboxWindow::setState(unsigned long new_state) {
2450} 2457}
2451 2458
2452//TODO: why ungrab in if-statement? 2459//TODO: why ungrab in if-statement?
2453bool FluxboxWindow::getState(void) { 2460bool FluxboxWindow::getState() {
2454 current_state = 0; 2461 current_state = 0;
2455 2462
2456 Atom atom_return; 2463 Atom atom_return;
@@ -2478,7 +2485,7 @@ bool FluxboxWindow::getState(void) {
2478} 2485}
2479 2486
2480 2487
2481void FluxboxWindow::setGravityOffsets(void) { 2488void FluxboxWindow::setGravityOffsets() {
2482 // translate x coordinate 2489 // translate x coordinate
2483 switch (client.win_gravity) { 2490 switch (client.win_gravity) {
2484 // handle Westward gravity 2491 // handle Westward gravity
@@ -2531,7 +2538,7 @@ void FluxboxWindow::setGravityOffsets(void) {
2531} 2538}
2532 2539
2533 2540
2534void FluxboxWindow::restoreAttributes(void) { 2541void FluxboxWindow::restoreAttributes() {
2535 if (!getState()) 2542 if (!getState())
2536 current_state = NormalState; 2543 current_state = NormalState;
2537 2544
@@ -2619,7 +2626,7 @@ void FluxboxWindow::restoreAttributes(void) {
2619} 2626}
2620 2627
2621 2628
2622void FluxboxWindow::restoreGravity(void) { 2629void FluxboxWindow::restoreGravity() {
2623 // restore x coordinate 2630 // restore x coordinate
2624 switch (client.win_gravity) { 2631 switch (client.win_gravity) {
2625 // handle Westward gravity 2632 // handle Westward gravity
@@ -2657,7 +2664,7 @@ void FluxboxWindow::restoreGravity(void) {
2657 } 2664 }
2658} 2665}
2659 2666
2660bool FluxboxWindow::isLowerTab(void) const { 2667bool FluxboxWindow::isLowerTab() const {
2661 Tab* chkTab = (tab ? tab->first() : 0); 2668 Tab* chkTab = (tab ? tab->first() : 0);
2662 while (chkTab) { 2669 while (chkTab) {
2663 const FluxboxWindow* chkWin = chkTab->getWindow(); 2670 const FluxboxWindow* chkWin = chkTab->getWindow();
@@ -2669,7 +2676,7 @@ bool FluxboxWindow::isLowerTab(void) const {
2669 return false; 2676 return false;
2670} 2677}
2671 2678
2672void FluxboxWindow::redrawLabel(void) { 2679void FluxboxWindow::redrawLabel() {
2673 if (focused) { 2680 if (focused) {
2674 if (frame.flabel) 2681 if (frame.flabel)
2675 XSetWindowBackgroundPixmap(display, frame.label, frame.flabel); 2682 XSetWindowBackgroundPixmap(display, frame.label, frame.flabel);
@@ -2695,7 +2702,7 @@ void FluxboxWindow::redrawLabel(void) {
2695} 2702}
2696 2703
2697 2704
2698void FluxboxWindow::redrawAllButtons(void) { 2705void FluxboxWindow::redrawAllButtons() {
2699 for (unsigned int i=0; i<buttonlist.size(); i++) 2706 for (unsigned int i=0; i<buttonlist.size(); i++)
2700 if (buttonlist[i].draw) 2707 if (buttonlist[i].draw)
2701 buttonlist[i].draw(this, buttonlist[i].win, false); 2708 buttonlist[i].draw(this, buttonlist[i].win, false);
@@ -3429,7 +3436,7 @@ void FluxboxWindow::toggleDecoration() {
3429 } 3436 }
3430} 3437}
3431 3438
3432bool FluxboxWindow::validateClient(void) { 3439bool FluxboxWindow::validateClient() {
3433 XSync(display, false); 3440 XSync(display, false);
3434 3441
3435 XEvent e; 3442 XEvent e;
@@ -3715,7 +3722,7 @@ void FluxboxWindow::checkTransient() {
3715 3722
3716} 3723}
3717 3724
3718void FluxboxWindow::restore(void) { 3725void FluxboxWindow::restore() {
3719 XChangeSaveSet(display, client.window, SetModeDelete); 3726 XChangeSaveSet(display, client.window, SetModeDelete);
3720 XSelectInput(display, client.window, NoEventMask); 3727 XSelectInput(display, client.window, NoEventMask);
3721 3728
@@ -3733,7 +3740,7 @@ void FluxboxWindow::restore(void) {
3733} 3740}
3734 3741
3735 3742
3736void FluxboxWindow::timeout(void) { 3743void FluxboxWindow::timeout() {
3737 if (tab) 3744 if (tab)
3738 tab->raise(); 3745 tab->raise();
3739 screen->getWorkspace(workspace_number)->raiseWindow(this); 3746 screen->getWorkspace(workspace_number)->raiseWindow(this);
@@ -3788,7 +3795,7 @@ void FluxboxWindow::changeBlackboxHints(BaseDisplay::BlackboxHints *net) {
3788} 3795}
3789 3796
3790 3797
3791void FluxboxWindow::upsize(void) { 3798void FluxboxWindow::upsize() {
3792 // convert client.width/height into frame sizes 3799 // convert client.width/height into frame sizes
3793 3800
3794 frame.bevel_w = screen->getBevelWidth(); 3801 frame.bevel_w = screen->getBevelWidth();
@@ -3824,7 +3831,7 @@ void FluxboxWindow::upsize(void) {
3824} 3831}
3825 3832
3826 3833
3827void FluxboxWindow::downsize(void) { 3834void FluxboxWindow::downsize() {
3828 // convert frame.width/height into client sizes 3835 // convert frame.width/height into client sizes
3829 3836
3830 frame.y_handle = frame.height - frame.handle_h; 3837 frame.y_handle = frame.height - frame.handle_h;