From ed3731fa30c8563e1187ff72528fcc2ca567c43d Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 6 Mar 2007 17:20:13 +0000 Subject: session.screen0.defaultDeco now understands TAB, BORDER, etc. --- ChangeLog | 7 +++++-- src/Remember.cc | 65 +++++++++++++++++++++++++++------------------------------ src/Remember.hh | 2 ++ src/Screen.cc | 2 +- src/Screen.hh | 4 ++-- src/Window.cc | 6 +++--- 6 files changed, 44 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index bbf252c..7dab9ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,13 +1,16 @@ (Format: Year/Month/Day) Changes for 1.0rc3: -*07/03/03 +*07/03/06: + * session.screen.defaultDeco now allows same strings as apps file (Mark) + Screen.cc/hh Window.cc Remember.cc/hh +*07/03/03: * Added typeahead support to menus (patch by Philipp Goedl, modified by Mark and Matteo Galiazzo) - Added new style item menu.frame.underlineColor: for displaying matching items FbTk/Menu.cc/hh MenuItem.cc/hh MenuTheme.cc/hh Makefile.am and added FbTk/ITypeAheadable.hh TypeAhead.hh SearchResult.cc/hh -*07/03/02 +*07/03/02: * Added support for keypad enter key in menu (Mark) FbTk/Menu.cc *07/02/28: diff --git a/src/Remember.cc b/src/Remember.cc index 62c0d18..2b8fbce 100644 --- a/src/Remember.cc +++ b/src/Remember.cc @@ -290,6 +290,32 @@ Remember::~Remember() { s_instance = 0; } +int Remember::getDecoFromString(const string &str_label) { + if (strcasecmp(str_label.c_str(), "NONE") == 0) + return 0; + if (strcasecmp(str_label.c_str(), "NORMAL") == 0) + return FluxboxWindow::DECORM_LAST - 1; + if (strcasecmp(str_label.c_str(), "TINY") == 0) + return FluxboxWindow::DECORM_TITLEBAR + | FluxboxWindow::DECORM_ICONIFY + | FluxboxWindow::DECORM_MENU + | FluxboxWindow::DECORM_TAB; + if (strcasecmp(str_label.c_str(), "TOOL") == 0) + return FluxboxWindow::DECORM_TITLEBAR + | FluxboxWindow::DECORM_MENU; + if (strcasecmp(str_label.c_str(), "BORDER") == 0) + return FluxboxWindow::DECORM_BORDER + | FluxboxWindow::DECORM_MENU; + if (strcasecmp(str_label.c_str(), "TAB") == 0) + return FluxboxWindow::DECORM_BORDER + | FluxboxWindow::DECORM_MENU + | FluxboxWindow::DECORM_TAB; + unsigned int mask; + if (getuint(str_label.c_str(), mask)) + return mask; + return -1; +} + Application* Remember::find(WinClient &winclient) { // if it is already associated with a application, return that one // otherwise, check it against every pattern that we've got @@ -448,40 +474,11 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) { app.rememberIconHiddenstate((strcasecmp(str_label.c_str(), "yes") == 0)); app.rememberFocusHiddenstate((strcasecmp(str_label.c_str(), "yes") == 0)); } else if (strcasecmp(str_key.c_str(), "Deco") == 0) { - if (strcasecmp(str_label.c_str(), "NONE") == 0) { - app.rememberDecostate((unsigned int) 0); - } else if (strcasecmp(str_label.c_str(), "NORMAL") == 0) { - app.rememberDecostate((unsigned int) 0xfffffff); - } else if (strcasecmp(str_label.c_str(), "TINY") == 0) { - app.rememberDecostate((unsigned int) - FluxboxWindow::DECORM_TITLEBAR - | FluxboxWindow::DECORM_ICONIFY - | FluxboxWindow::DECORM_MENU - | FluxboxWindow::DECORM_TAB - ); - } else if (strcasecmp(str_label.c_str(), "TOOL") == 0) { - app.rememberDecostate((unsigned int) - FluxboxWindow::DECORM_TITLEBAR - | FluxboxWindow::DECORM_MENU - ); - } else if (strcasecmp(str_label.c_str(), "BORDER") == 0) { - app.rememberDecostate((unsigned int) - FluxboxWindow::DECORM_BORDER - | FluxboxWindow::DECORM_MENU - ); - } else if (strcasecmp(str_label.c_str(), "TAB") == 0) { - app.rememberDecostate((unsigned int) - FluxboxWindow::DECORM_BORDER - | FluxboxWindow::DECORM_MENU - | FluxboxWindow::DECORM_TAB - ); - } else { - unsigned int mask; - if (getuint(str_label.c_str(), mask)) - app.rememberDecostate(mask); - else - had_error = 1; - } + int deco = getDecoFromString(str_label); + if (deco == -1) + had_error = 1; + else + app.rememberDecostate((unsigned int)deco); } else if (strcasecmp(str_key.c_str(), "Alpha") == 0) { int focused_a, unfocused_a; if (sscanf(str_label.c_str(), "%i %i", &focused_a, &unfocused_a) == 2) diff --git a/src/Remember.hh b/src/Remember.hh index 581e525..a1e75da 100644 --- a/src/Remember.hh +++ b/src/Remember.hh @@ -205,6 +205,8 @@ public: Remember(); ~Remember(); + static int getDecoFromString(const std::string &str); + Application* find(WinClient &winclient); Application* add(WinClient &winclient); FluxboxWindow* findGroup(Application *, BScreen &screen); diff --git a/src/Screen.cc b/src/Screen.cc index 3dfe324..3f3daf9 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -293,7 +293,7 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, auto_raise(rm, true, scrname+".autoRaise", altscrname+".AutoRaise"), click_raises(rm, true, scrname+".clickRaises", altscrname+".ClickRaises"), decorate_transient(rm, true, scrname+".decorateTransient", altscrname+".DecorateTransient"), - default_deco(rm, FluxboxWindow::DECORM_LAST-1, scrname+".defaultDeco", altscrname+".DefaultDeco"), + default_deco(rm, "NORMAL", scrname+".defaultDeco", altscrname+".DefaultDeco"), rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"), resize_model(rm, BOTTOMRESIZE, scrname+".resizeMode", altscrname+".ResizeMode"), tab_placement(rm, FbWinFrame::TOPLEFT, scrname+".tab.placement", altscrname+".Tab.Placement"), diff --git a/src/Screen.hh b/src/Screen.hh index 8694f6d..bf03ac6 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -123,7 +123,7 @@ public: bool doFullMax() const { return *resource.full_max; } bool doShowWindowPos() const { return *resource.show_window_pos; } bool decorateTransient() const { return *resource.decorate_transient; } - unsigned int defaultDeco() const { return *resource.default_deco; } + const std::string &defaultDeco() const { return *resource.default_deco; } const std::string &windowMenuFilename() const { return *resource.windowmenufile; } FbTk::ImageControl &imageControl() { return *m_image_control.get(); } // menus @@ -449,7 +449,7 @@ private: workspace_warping, desktop_wheeling, reverse_wheeling, show_window_pos, auto_raise, click_raises, decorate_transient; - FbTk::Resource default_deco; + FbTk::Resource default_deco; FbTk::Resource rootcommand; FbTk::Resource resize_model; FbTk::Resource tab_placement; diff --git a/src/Window.cc b/src/Window.cc index 3d0db79..5b10058 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -394,10 +394,10 @@ void FluxboxWindow::init() { m_blackbox_attrib.premax_w = m_blackbox_attrib.premax_h = 0; // set default decorations but don't apply them - setDecorationMask(screen().defaultDeco(), false); + setDecorationMask(Remember::getDecoFromString(screen().defaultDeco()), false); - functions.resize = functions.move = functions.iconify = functions.maximize = functions.close = functions.tabable = true; - decorations.close = false; + functions.resize = functions.move = functions.iconify = functions.maximize + = functions.close = functions.tabable = true; if (m_client->getBlackboxHint() != 0) updateBlackboxHintsFromClient(*m_client); -- cgit v0.11.2