From 09a76586dec0059dea3ef9183e417e232a0012a2 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 d51ffdf..21de2c5 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -263,13 +263,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: @@ -294,7 +294,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: @@ -323,7 +323,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); @@ -913,7 +913,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: @@ -1643,7 +1643,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: @@ -1662,7 +1662,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: @@ -1681,7 +1681,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: @@ -1697,7 +1697,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 c8e4ad7..2766c06 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -194,9 +194,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); } @@ -1685,7 +1685,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 81812ba..8d50fbc 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -89,6 +89,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); @@ -120,7 +124,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; } @@ -253,8 +257,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(); } @@ -532,7 +534,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 fae5272..6c2cc66 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -443,6 +443,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