diff options
Diffstat (limited to 'src/Screen.cc')
-rw-r--r-- | src/Screen.cc | 57 |
1 files changed, 23 insertions, 34 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 44f0eba..8ffaf4f 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -186,9 +186,8 @@ int calcSquareDistance(int x1, int y1, int x2, int y2) { | |||
186 | class TabPlacementMenuItem: public FbTk::RadioMenuItem { | 186 | class TabPlacementMenuItem: public FbTk::RadioMenuItem { |
187 | public: | 187 | public: |
188 | TabPlacementMenuItem(const FbTk::FbString & label, BScreen &screen, | 188 | TabPlacementMenuItem(const FbTk::FbString & label, BScreen &screen, |
189 | FbWinFrame::TabPlacement place, | 189 | FbWinFrame::TabPlacement place): |
190 | FbTk::RefCount<FbTk::Command<void> > &cmd): | 190 | FbTk::RadioMenuItem(label), |
191 | FbTk::RadioMenuItem(label, cmd), | ||
192 | m_screen(screen), | 191 | m_screen(screen), |
193 | m_place(place) { | 192 | m_place(place) { |
194 | setCloseOnClick(false); | 193 | setCloseOnClick(false); |
@@ -1512,15 +1511,8 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1512 | 1511 | ||
1513 | menu.removeAll(); | 1512 | menu.removeAll(); |
1514 | 1513 | ||
1515 | FbTk::MacroCommand *s_a_reconf_macro = new FbTk::MacroCommand(); | ||
1516 | FbTk::RefCount<FbTk::Command<void> > saverc_cmd(new FbTk::SimpleCommand<Fluxbox>( | ||
1517 | *Fluxbox::instance(), | ||
1518 | &Fluxbox::save_rc)); | ||
1519 | FbTk::RefCount<FbTk::Command<void> > reconf_cmd(FbTk::CommandParser<void>::instance().parse("reconfigure")); | 1514 | FbTk::RefCount<FbTk::Command<void> > reconf_cmd(FbTk::CommandParser<void>::instance().parse("reconfigure")); |
1520 | 1515 | ||
1521 | s_a_reconf_macro->add(saverc_cmd); | ||
1522 | s_a_reconf_macro->add(reconf_cmd); | ||
1523 | FbTk::RefCount<FbTk::Command<void> > save_and_reconfigure(s_a_reconf_macro); | ||
1524 | // create focus menu | 1516 | // create focus menu |
1525 | // we don't set this to internal menu so will | 1517 | // we don't set this to internal menu so will |
1526 | // be deleted toghether with the parent | 1518 | // be deleted toghether with the parent |
@@ -1529,12 +1521,12 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1529 | "Method used to give focus to windows"); | 1521 | "Method used to give focus to windows"); |
1530 | FbTk::RefCount<FbTk::Menu> focus_menu( createMenu(focusmenu_label) ); | 1522 | FbTk::RefCount<FbTk::Menu> focus_menu( createMenu(focusmenu_label) ); |
1531 | 1523 | ||
1532 | #define _BOOLITEM(m,a, b, c, d, e, f) (m).insert(new FbTk::BoolMenuItem(_FB_XTEXT(a, b, c, d), e, f)) | 1524 | #define _BOOLITEM(m,a, b, c, d, e) (m).insert(new FbTk::BoolMenuItem(_FB_XTEXT(a, b, c, d), e)) |
1533 | 1525 | ||
1534 | 1526 | ||
1535 | #define _FOCUSITEM(a, b, c, d, e) \ | 1527 | #define _FOCUSITEM(a, b, c, d, e) \ |
1536 | focus_menu->insert(new FocusModelMenuItem(_FB_XTEXT(a, b, c, d), focusControl(), \ | 1528 | focus_menu->insert(new FocusModelMenuItem(_FB_XTEXT(a, b, c, d), focusControl(), \ |
1537 | e, save_and_reconfigure)) | 1529 | e, reconf_cmd)) |
1538 | 1530 | ||
1539 | _FOCUSITEM(Configmenu, ClickFocus, | 1531 | _FOCUSITEM(Configmenu, ClickFocus, |
1540 | "Click To Focus", "Click to focus", | 1532 | "Click To Focus", "Click to focus", |
@@ -1552,17 +1544,16 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1552 | focus_menu->insert(new FbTk::MenuSeparator()); | 1544 | focus_menu->insert(new FbTk::MenuSeparator()); |
1553 | focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu, | 1545 | focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu, |
1554 | ClickTabFocus, "ClickTabFocus", "Click tab to focus windows"), | 1546 | ClickTabFocus, "ClickTabFocus", "Click tab to focus windows"), |
1555 | focusControl(), FocusControl::CLICKTABFOCUS, save_and_reconfigure)); | 1547 | focusControl(), FocusControl::CLICKTABFOCUS, reconf_cmd)); |
1556 | focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu, | 1548 | focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu, |
1557 | MouseTabFocus, "MouseTabFocus", "Hover over tab to focus windows"), | 1549 | MouseTabFocus, "MouseTabFocus", "Hover over tab to focus windows"), |
1558 | focusControl(), FocusControl::MOUSETABFOCUS, save_and_reconfigure)); | 1550 | focusControl(), FocusControl::MOUSETABFOCUS, reconf_cmd)); |
1559 | focus_menu->insert(new FbTk::MenuSeparator()); | 1551 | focus_menu->insert(new FbTk::MenuSeparator()); |
1560 | 1552 | ||
1561 | try { | 1553 | try { |
1562 | focus_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, FocusNew, | 1554 | focus_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, FocusNew, |
1563 | "Focus New Windows", "Focus newly created windows"), | 1555 | "Focus New Windows", "Focus newly created windows"), |
1564 | m_resource_manager.getResource<bool, FbTk::BoolTraits>(name() + ".focusNewWindows"), | 1556 | m_resource_manager.getResource<bool, FbTk::BoolTraits>(name() + ".focusNewWindows"))); |
1565 | saverc_cmd)); | ||
1566 | } catch (FbTk::ResourceException & e) { | 1557 | } catch (FbTk::ResourceException & e) { |
1567 | cerr<<e.what()<<endl; | 1558 | cerr<<e.what()<<endl; |
1568 | } | 1559 | } |
@@ -1571,19 +1562,18 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1571 | try { | 1562 | try { |
1572 | focus_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, FocusSameHead, | 1563 | focus_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, FocusSameHead, |
1573 | "Keep Head", "Only revert focus on same head"), | 1564 | "Keep Head", "Only revert focus on same head"), |
1574 | m_resource_manager.getResource<bool, FbTk::BoolTraits>(name() + ".focusSameHead"), | 1565 | m_resource_manager.getResource<bool, FbTk::BoolTraits>(name() + ".focusSameHead"))); |
1575 | saverc_cmd)); | 1566 | } catch (FbTk::ResourceException & e) { |
1576 | } catch (FbTk::ResourceException e) { | ||
1577 | cerr<<e.what()<<endl; | 1567 | cerr<<e.what()<<endl; |
1578 | } | 1568 | } |
1579 | #endif // XINERAMA | 1569 | #endif // XINERAMA |
1580 | 1570 | ||
1581 | _BOOLITEM(*focus_menu, Configmenu, AutoRaise, | 1571 | _BOOLITEM(*focus_menu, Configmenu, AutoRaise, |
1582 | "Auto Raise", "Auto Raise windows on sloppy", | 1572 | "Auto Raise", "Auto Raise windows on sloppy", |
1583 | resource.auto_raise, saverc_cmd); | 1573 | resource.auto_raise); |
1584 | _BOOLITEM(*focus_menu, Configmenu, ClickRaises, | 1574 | _BOOLITEM(*focus_menu, Configmenu, ClickRaises, |
1585 | "Click Raises", "Click Raises", | 1575 | "Click Raises", "Click Raises", |
1586 | resource.click_raises, saverc_cmd); | 1576 | resource.click_raises); |
1587 | 1577 | ||
1588 | focus_menu->updateMenu(); | 1578 | focus_menu->updateMenu(); |
1589 | 1579 | ||
@@ -1599,17 +1589,17 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1599 | 1589 | ||
1600 | _BOOLITEM(*maxmenu, Configmenu, FullMax, | 1590 | _BOOLITEM(*maxmenu, Configmenu, FullMax, |
1601 | "Full Maximization", "Maximise over slit, toolbar, etc", | 1591 | "Full Maximization", "Maximise over slit, toolbar, etc", |
1602 | resource.full_max, saverc_cmd); | 1592 | resource.full_max); |
1603 | _BOOLITEM(*maxmenu, Configmenu, MaxIgnoreInc, | 1593 | _BOOLITEM(*maxmenu, Configmenu, MaxIgnoreInc, |
1604 | "Ignore Resize Increment", | 1594 | "Ignore Resize Increment", |
1605 | "Maximizing Ignores Resize Increment (e.g. xterm)", | 1595 | "Maximizing Ignores Resize Increment (e.g. xterm)", |
1606 | resource.max_ignore_inc, saverc_cmd); | 1596 | resource.max_ignore_inc); |
1607 | _BOOLITEM(*maxmenu, Configmenu, MaxDisableMove, | 1597 | _BOOLITEM(*maxmenu, Configmenu, MaxDisableMove, |
1608 | "Disable Moving", "Don't Allow Moving While Maximized", | 1598 | "Disable Moving", "Don't Allow Moving While Maximized", |
1609 | resource.max_disable_move, saverc_cmd); | 1599 | resource.max_disable_move); |
1610 | _BOOLITEM(*maxmenu, Configmenu, MaxDisableResize, | 1600 | _BOOLITEM(*maxmenu, Configmenu, MaxDisableResize, |
1611 | "Disable Resizing", "Don't Allow Resizing While Maximized", | 1601 | "Disable Resizing", "Don't Allow Resizing While Maximized", |
1612 | resource.max_disable_resize, saverc_cmd); | 1602 | resource.max_disable_resize); |
1613 | 1603 | ||
1614 | maxmenu->updateMenu(); | 1604 | maxmenu->updateMenu(); |
1615 | menu.insert(maxmenu_label, maxmenu); | 1605 | menu.insert(maxmenu_label, maxmenu); |
@@ -1629,13 +1619,13 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1629 | 1619 | ||
1630 | _BOOLITEM(*tab_menu,Configmenu, TabsInTitlebar, | 1620 | _BOOLITEM(*tab_menu,Configmenu, TabsInTitlebar, |
1631 | "Tabs in Titlebar", "Tabs in Titlebar", | 1621 | "Tabs in Titlebar", "Tabs in Titlebar", |
1632 | resource.default_internal_tabs, saverc_cmd); | 1622 | resource.default_internal_tabs); |
1633 | tab_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Common, MaximizeOver, | 1623 | tab_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Common, MaximizeOver, |
1634 | "Maximize Over", "Maximize over this thing when maximizing"), | 1624 | "Maximize Over", "Maximize over this thing when maximizing"), |
1635 | resource.max_over_tabs, save_and_reconfigure)); | 1625 | resource.max_over_tabs, reconf_cmd)); |
1636 | tab_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Toolbar, ShowIcons, | 1626 | tab_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Toolbar, ShowIcons, |
1637 | "Show Pictures", "chooses if little icons are shown next to title in the iconbar"), | 1627 | "Show Pictures", "chooses if little icons are shown next to title in the iconbar"), |
1638 | resource.tabs_use_pixmap, save_and_reconfigure)); | 1628 | resource.tabs_use_pixmap, reconf_cmd)); |
1639 | 1629 | ||
1640 | FbTk::MenuItem *tab_width_item = | 1630 | FbTk::MenuItem *tab_width_item = |
1641 | new FbTk::IntMenuItem(_FB_XTEXT(Configmenu, ExternalTabWidth, | 1631 | new FbTk::IntMenuItem(_FB_XTEXT(Configmenu, ExternalTabWidth, |
@@ -1643,7 +1633,6 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1643 | "Width of external-style tabs"), | 1633 | "Width of external-style tabs"), |
1644 | resource.tab_width, 10, 3000, /* silly number */ | 1634 | resource.tab_width, 10, 3000, /* silly number */ |
1645 | *tab_menu); | 1635 | *tab_menu); |
1646 | tab_width_item->setCommand(saverc_cmd); | ||
1647 | tab_menu->insert(tab_width_item); | 1636 | tab_menu->insert(tab_width_item); |
1648 | 1637 | ||
1649 | // menu is 3 wide, 5 down | 1638 | // menu is 3 wide, 5 down |
@@ -1678,7 +1667,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1678 | tabplacement_menu->insert(p.label); | 1667 | tabplacement_menu->insert(p.label); |
1679 | tabplacement_menu->setItemEnabled(i, false); | 1668 | tabplacement_menu->setItemEnabled(i, false); |
1680 | } else | 1669 | } else |
1681 | tabplacement_menu->insert(new TabPlacementMenuItem(p.label, *this, p.placement, saverc_cmd)); | 1670 | tabplacement_menu->insert(new TabPlacementMenuItem(p.label, *this, p.placement)); |
1682 | } | 1671 | } |
1683 | tabplacement_menu->updateMenu(); | 1672 | tabplacement_menu->updateMenu(); |
1684 | 1673 | ||
@@ -1697,13 +1686,13 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1697 | alpha_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, ForcePseudoTrans, | 1686 | alpha_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, ForcePseudoTrans, |
1698 | "Force Pseudo-Transparency", | 1687 | "Force Pseudo-Transparency", |
1699 | "When composite is available, still use old pseudo-transparency"), | 1688 | "When composite is available, still use old pseudo-transparency"), |
1700 | Fluxbox::instance()->getPseudoTransResource(), save_and_reconfigure)); | 1689 | Fluxbox::instance()->getPseudoTransResource(), reconf_cmd)); |
1701 | } | 1690 | } |
1702 | 1691 | ||
1703 | // in order to save system resources, don't save or reconfigure alpha | 1692 | // in order to save system resources, don't save or reconfigure alpha |
1704 | // settings until after the user is done changing them | 1693 | // settings until after the user is done changing them |
1705 | FbTk::RefCount<FbTk::Command<void> > delayed_save_and_reconf( | 1694 | FbTk::RefCount<FbTk::Command<void> > delayed_save_and_reconf( |
1706 | new FbTk::DelayedCmd(save_and_reconfigure)); | 1695 | new FbTk::DelayedCmd(reconf_cmd)); |
1707 | 1696 | ||
1708 | FbTk::MenuItem *focused_alpha_item = | 1697 | FbTk::MenuItem *focused_alpha_item = |
1709 | new FbTk::IntMenuItem(_FB_XTEXT(Configmenu, FocusedAlpha, | 1698 | new FbTk::IntMenuItem(_FB_XTEXT(Configmenu, FocusedAlpha, |
@@ -1743,11 +1732,11 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1743 | _BOOLITEM(menu, Configmenu, OpaqueMove, | 1732 | _BOOLITEM(menu, Configmenu, OpaqueMove, |
1744 | "Opaque Window Moving", | 1733 | "Opaque Window Moving", |
1745 | "Window Moving with whole window visible (as opposed to outline moving)", | 1734 | "Window Moving with whole window visible (as opposed to outline moving)", |
1746 | resource.opaque_move, saverc_cmd); | 1735 | resource.opaque_move); |
1747 | _BOOLITEM(menu, Configmenu, WorkspaceWarping, | 1736 | _BOOLITEM(menu, Configmenu, WorkspaceWarping, |
1748 | "Workspace Warping", | 1737 | "Workspace Warping", |
1749 | "Workspace Warping - dragging windows to the edge and onto the next workspace", | 1738 | "Workspace Warping - dragging windows to the edge and onto the next workspace", |
1750 | resource.workspace_warping, saverc_cmd); | 1739 | resource.workspace_warping); |
1751 | 1740 | ||
1752 | #undef _BOOLITEM | 1741 | #undef _BOOLITEM |
1753 | 1742 | ||