From 0326af9b428e5406c465c2efa00ede8d963671f3 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Wed, 20 Jul 2011 17:42:00 +0200 Subject: Attach modifiedSig handlers to the session.screenX.tab.placement resource --- src/FbWinFrame.cc | 20 ++++++++++---------- src/Screen.cc | 6 +++--- src/Screen.hh | 10 ++++++---- src/Window.cc | 2 ++ 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 04e7944..6aa65b0 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -260,13 +260,13 @@ void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int heigh m_state.saveGeometry(window().x(), window().y(), window().width(), window().height()); - if (move || (resize && m_screen.getTabPlacement() != TOPLEFT && - m_screen.getTabPlacement() != LEFTTOP)) + if (move || (resize && *m_screen.getTabPlacementResource() != TOPLEFT && + *m_screen.getTabPlacementResource() != LEFTTOP)) alignTabs(); if (resize) { if (m_tabmode == EXTERNAL) { - switch(m_screen.getTabPlacement()) { + switch(*m_screen.getTabPlacementResource()) { case LEFTTOP: case RIGHTTOP: case LEFT: @@ -291,7 +291,7 @@ void FbWinFrame::quietMoveResize(int x, int y, window().width(), window().height()); if (m_tabmode == EXTERNAL) { - switch(m_screen.getTabPlacement()) { + switch(*m_screen.getTabPlacementResource()) { case LEFTTOP: case RIGHTTOP: case LEFT: @@ -320,7 +320,7 @@ void FbWinFrame::alignTabs() { m_tab_container.setMaxSizePerClient(m_screen.getTabWidth()); int tabx = 0, taby = 0; - switch (m_screen.getTabPlacement()) { + switch (*m_screen.getTabPlacementResource()) { case TOPLEFT: if (orig_orient != FbTk::ROT0) m_tab_container.hide(); m_tab_container.setOrientation(FbTk::ROT0); @@ -910,7 +910,7 @@ void FbWinFrame::reconfigure() { if (m_tabmode == EXTERNAL) { unsigned int neww, newh; - switch (m_screen.getTabPlacement()) { + switch (*m_screen.getTabPlacementResource()) { case TOPLEFT: case TOP: case TOPRIGHT: @@ -1640,7 +1640,7 @@ int FbWinFrame::widthOffset() const { return 0; // same height offset for top and bottom tabs - switch (m_screen.getTabPlacement()) { + switch (*m_screen.getTabPlacementResource()) { case LEFTTOP: case RIGHTTOP: case LEFT: @@ -1659,7 +1659,7 @@ int FbWinFrame::heightOffset() const { if (m_tabmode != EXTERNAL || !m_use_tabs) return 0; - switch (m_screen.getTabPlacement()) { + switch (*m_screen.getTabPlacementResource()) { case TOPLEFT: case TOP: case TOPRIGHT: @@ -1678,7 +1678,7 @@ int FbWinFrame::xOffset() const { if (m_tabmode != EXTERNAL || !m_use_tabs) return 0; - switch (m_screen.getTabPlacement()) { + switch (*m_screen.getTabPlacementResource()) { case LEFTTOP: case LEFT: case LEFTBOTTOM: @@ -1694,7 +1694,7 @@ int FbWinFrame::yOffset() const { if (m_tabmode != EXTERNAL || !m_use_tabs) return 0; - switch (m_screen.getTabPlacement()) { + switch (*m_screen.getTabPlacementResource()) { case TOPLEFT: case TOP: case TOPRIGHT: diff --git a/src/Screen.cc b/src/Screen.cc index d8ec167..0772048 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -192,9 +192,9 @@ public: setCloseOnClick(false); } - bool isSelected() const { return m_screen.getTabPlacement() == m_place; } + bool isSelected() const { return *m_screen.getTabPlacementResource() == m_place; } void click(int button, int time, unsigned int mods) { - m_screen.saveTabPlacement(m_place); + *m_screen.getTabPlacementResource() = m_place; FbTk::RadioMenuItem::click(button, time, mods); } @@ -1604,7 +1604,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { tabplacement_menu->insert(p.label); tabplacement_menu->setItemEnabled(i, false); } else - tabplacement_menu->insert(new TabPlacementMenuItem(p.label, *this, p.placement, save_and_reconftabs)); + tabplacement_menu->insert(new TabPlacementMenuItem(p.label, *this, p.placement, saverc_cmd)); } tabplacement_menu->updateMenu(); diff --git a/src/Screen.hh b/src/Screen.hh index c524a91..98c13e4 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -88,6 +88,10 @@ public: typedef std::vector WorkspaceNames; typedef std::list > > ExtraMenus; + typedef FbTk::Resource< + FbWinFrame::TabPlacement, FbTk::EnumTraits + > TabPlacementResource; + BScreen(FbTk::ResourceManager_base &rm, const std::string &screenname, int scrn, int number_of_layers); @@ -119,7 +123,7 @@ public: ExtraMenus &extraWindowMenus() { return m_extramenus; } const ExtraMenus &extraWindowMenus() const { return m_extramenus; } - FbWinFrame::TabPlacement getTabPlacement() const { return *resource.tab_placement; } + TabPlacementResource &getTabPlacementResource() { return resource.tab_placement; } unsigned int noFocusWhileTypingDelay() const { return *resource.typing_delay; } const bool allowRemoteActions() const { return *resource.allow_remote_actions; } @@ -252,8 +256,6 @@ public: void setRootColormapInstalled(bool r) { root_colormap_installed = r; } - void saveTabPlacement(FbWinFrame::TabPlacement place) { *resource.tab_placement = place; } - void saveWorkspaces(int w) { *resource.workspaces = w; } FbTk::ThemeProxy &focusedWinFrameTheme() { return *m_focused_windowtheme.get(); } @@ -515,7 +517,7 @@ private: max_ignore_inc, max_disable_move, max_disable_resize, workspace_warping, show_window_pos, auto_raise, click_raises; FbTk::StringResource default_deco; - FbTk::Resource > tab_placement; + TabPlacementResource tab_placement; FbTk::StringResource windowmenufile; FbTk::UIntResource typing_delay; FbTk::IntResource workspaces, edge_snap_threshold, focused_alpha, diff --git a/src/Window.cc b/src/Window.cc index d82a0b1..0bb0f8f 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -431,6 +431,8 @@ void FluxboxWindow::init() { join(screen().getDefaultInternalTabsResource().modifiedSig(), FbTk::MemFunIgnoreArgs(*this, &FluxboxWindow::applyDecorations)); + join(screen().getTabPlacementResource().modifiedSig(), + FbTk::MemFunIgnoreArgs(*this, &FluxboxWindow::applyDecorations)); /**************************************************/ /* Read state above here, apply state below here. */ -- cgit v0.11.2