aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbWinFrame.cc1
-rw-r--r--src/FbWinFrame.hh30
-rw-r--r--src/Remember.cc22
-rw-r--r--src/Window.cc79
-rw-r--r--src/Window.hh28
5 files changed, 82 insertions, 78 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index f710416..266ddea 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -81,6 +81,7 @@ FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageContr
81 ButtonMotionMask | ExposureMask | 81 ButtonMotionMask | ExposureMask |
82 EnterWindowMask | LeaveWindowMask), 82 EnterWindowMask | LeaveWindowMask),
83 m_bevel(1), 83 m_bevel(1),
84 m_decoration_mask(DECOR_NORMAL),
84 m_use_titlebar(true), 85 m_use_titlebar(true),
85 m_use_tabs(true), 86 m_use_tabs(true),
86 m_use_handle(true), 87 m_use_handle(true),
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 9bd29dd..5af852e 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -72,6 +72,34 @@ public:
72 RIGHTBOTTOM, RIGHTTOP 72 RIGHTBOTTOM, RIGHTTOP
73 }; 73 };
74 74
75 /**
76 This enumeration represents individual decoration
77 attributes, they can be OR-d together to get a mask.
78 Useful for saving.
79 */
80 enum DecorationMask {
81 DECORM_TITLEBAR = (1<<0),
82 DECORM_HANDLE = (1<<1),
83 DECORM_BORDER = (1<<2),
84 DECORM_ICONIFY = (1<<3),
85 DECORM_MAXIMIZE = (1<<4),
86 DECORM_CLOSE = (1<<5),
87 DECORM_MENU = (1<<6),
88 DECORM_STICKY = (1<<7),
89 DECORM_SHADE = (1<<8),
90 DECORM_TAB = (1<<9),
91 DECORM_ENABLED = (1<<10),
92 DECORM_LAST = (1<<11) // useful for getting "All"
93 };
94
95 enum Decoration {
96 DECOR_NONE = 0,
97 DECOR_NORMAL = DECORM_LAST - 1,
98 DECOR_TINY = DECORM_TITLEBAR|DECORM_ICONIFY|DECORM_MENU|DECORM_TAB,
99 DECOR_TOOL = DECORM_TITLEBAR|DECORM_MENU,
100 DECOR_BORDER = DECORM_BORDER|DECORM_MENU,
101 DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB
102 };
75 103
76 /// create a top level window 104 /// create a top level window
77 FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, 105 FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl,
@@ -161,6 +189,7 @@ public:
161 /// remove any handler for the windows 189 /// remove any handler for the windows
162 void removeEventHandler(); 190 void removeEventHandler();
163 191
192 void setDecorationMask(unsigned int mask) { m_decoration_mask = mask; }
164 // these return true/false for if something changed 193 // these return true/false for if something changed
165 bool hideTitlebar(); 194 bool hideTitlebar();
166 bool showTitlebar(); 195 bool showTitlebar();
@@ -314,6 +343,7 @@ private:
314 typedef std::list<FbTk::TextButton *> LabelList; 343 typedef std::list<FbTk::TextButton *> LabelList;
315 IconButton *m_current_label; ///< which client button is focused at the moment 344 IconButton *m_current_label; ///< which client button is focused at the moment
316 int m_bevel; ///< bevel between titlebar items and titlebar 345 int m_bevel; ///< bevel between titlebar items and titlebar
346 unsigned int m_decoration_mask; ///< bitmask of applied decorations
317 bool m_use_titlebar; ///< if we should use titlebar 347 bool m_use_titlebar; ///< if we should use titlebar
318 bool m_use_tabs; ///< if we should use tabs (turns them off in external mode only) 348 bool m_use_tabs; ///< if we should use tabs (turns them off in external mode only)
319 bool m_use_handle; ///< if we should use handle 349 bool m_use_handle; ///< if we should use handle
diff --git a/src/Remember.cc b/src/Remember.cc
index 2090008..a48f399 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -814,25 +814,25 @@ void Remember::save() {
814 apps_file << " [Deco]\t{NONE}" << endl; 814 apps_file << " [Deco]\t{NONE}" << endl;
815 break; 815 break;
816 case (0xffffffff): 816 case (0xffffffff):
817 case (FluxboxWindow::DECORM_LAST - 1): 817 case (FbWinFrame::DECORM_LAST - 1):
818 apps_file << " [Deco]\t{NORMAL}" << endl; 818 apps_file << " [Deco]\t{NORMAL}" << endl;
819 break; 819 break;
820 case (FluxboxWindow::DECORM_TITLEBAR 820 case (FbWinFrame::DECORM_TITLEBAR
821 | FluxboxWindow::DECORM_ICONIFY 821 | FbWinFrame::DECORM_ICONIFY
822 | FluxboxWindow::DECORM_MENU): 822 | FbWinFrame::DECORM_MENU):
823 apps_file << " [Deco]\t{TOOL}" << endl; 823 apps_file << " [Deco]\t{TOOL}" << endl;
824 break; 824 break;
825 case (FluxboxWindow::DECORM_TITLEBAR 825 case (FbWinFrame::DECORM_TITLEBAR
826 | FluxboxWindow::DECORM_MENU): 826 | FbWinFrame::DECORM_MENU):
827 apps_file << " [Deco]\t{TINY}" << endl; 827 apps_file << " [Deco]\t{TINY}" << endl;
828 break; 828 break;
829 case (FluxboxWindow::DECORM_BORDER 829 case (FbWinFrame::DECORM_BORDER
830 | FluxboxWindow::DECORM_MENU): 830 | FbWinFrame::DECORM_MENU):
831 apps_file << " [Deco]\t{BORDER}" << endl; 831 apps_file << " [Deco]\t{BORDER}" << endl;
832 break; 832 break;
833 case (FluxboxWindow::DECORM_BORDER 833 case (FbWinFrame::DECORM_BORDER
834 | FluxboxWindow::DECORM_MENU 834 | FbWinFrame::DECORM_MENU
835 | FluxboxWindow::DECORM_TAB): 835 | FbWinFrame::DECORM_TAB):
836 apps_file << " [Deco]\t{TAB}" << endl; 836 apps_file << " [Deco]\t{TAB}" << endl;
837 break; 837 break;
838 default: 838 default:
diff --git a/src/Window.cc b/src/Window.cc
index 6806afa..54f6915 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1516,10 +1516,10 @@ void FluxboxWindow::setFullscreen(bool flag) {
1516 1516
1517 frame().setUseShape(true); 1517 frame().setUseShape(true);
1518 if (m_toggled_decos) { 1518 if (m_toggled_decos) {
1519 if (m_old_decoration_mask & (DECORM_TITLEBAR | DECORM_TAB)) 1519 if (m_old_decoration_mask & (FbWinFrame::DECORM_TITLEBAR | FbWinFrame::DECORM_TAB))
1520 setDecorationMask(DECOR_NONE); 1520 setDecorationMask(FbWinFrame::DECOR_NONE);
1521 else 1521 else
1522 setDecorationMask(DECOR_NORMAL); 1522 setDecorationMask(FbWinFrame::DECOR_NORMAL);
1523 } else 1523 } else
1524 setDecorationMask(m_old_decoration_mask); 1524 setDecorationMask(m_old_decoration_mask);
1525 1525
@@ -3032,6 +3032,7 @@ void FluxboxWindow::applyDecorations(bool initial) {
3032 client_move = true; 3032 client_move = true;
3033 } 3033 }
3034 3034
3035 frame().setDecorationMask(decorationMask());
3035 frame().reconfigure(); 3036 frame().reconfigure();
3036 if (client_move) 3037 if (client_move)
3037 Fluxbox::instance()->updateFrameExtents(*this); 3038 Fluxbox::instance()->updateFrameExtents(*this);
@@ -3051,9 +3052,9 @@ void FluxboxWindow::toggleDecoration() {
3051 if (m_toggled_decos) { 3052 if (m_toggled_decos) {
3052 m_old_decoration_mask = decorationMask(); 3053 m_old_decoration_mask = decorationMask();
3053 if (decorations.titlebar | decorations.tab) 3054 if (decorations.titlebar | decorations.tab)
3054 setDecorationMask(DECOR_NONE); 3055 setDecorationMask(FbWinFrame::DECOR_NONE);
3055 else 3056 else
3056 setDecorationMask(DECOR_NORMAL); 3057 setDecorationMask(FbWinFrame::DECOR_NORMAL);
3057 } else //revert back to old decoration 3058 } else //revert back to old decoration
3058 setDecorationMask(m_old_decoration_mask); 3059 setDecorationMask(m_old_decoration_mask);
3059 3060
@@ -3062,42 +3063,42 @@ void FluxboxWindow::toggleDecoration() {
3062unsigned int FluxboxWindow::decorationMask() const { 3063unsigned int FluxboxWindow::decorationMask() const {
3063 unsigned int ret = 0; 3064 unsigned int ret = 0;
3064 if (decorations.titlebar) 3065 if (decorations.titlebar)
3065 ret |= DECORM_TITLEBAR; 3066 ret |= FbWinFrame::DECORM_TITLEBAR;
3066 if (decorations.handle) 3067 if (decorations.handle)
3067 ret |= DECORM_HANDLE; 3068 ret |= FbWinFrame::DECORM_HANDLE;
3068 if (decorations.border) 3069 if (decorations.border)
3069 ret |= DECORM_BORDER; 3070 ret |= FbWinFrame::DECORM_BORDER;
3070 if (decorations.iconify) 3071 if (decorations.iconify)
3071 ret |= DECORM_ICONIFY; 3072 ret |= FbWinFrame::DECORM_ICONIFY;
3072 if (decorations.maximize) 3073 if (decorations.maximize)
3073 ret |= DECORM_MAXIMIZE; 3074 ret |= FbWinFrame::DECORM_MAXIMIZE;
3074 if (decorations.close) 3075 if (decorations.close)
3075 ret |= DECORM_CLOSE; 3076 ret |= FbWinFrame::DECORM_CLOSE;
3076 if (decorations.menu) 3077 if (decorations.menu)
3077 ret |= DECORM_MENU; 3078 ret |= FbWinFrame::DECORM_MENU;
3078 if (decorations.sticky) 3079 if (decorations.sticky)
3079 ret |= DECORM_STICKY; 3080 ret |= FbWinFrame::DECORM_STICKY;
3080 if (decorations.shade) 3081 if (decorations.shade)
3081 ret |= DECORM_SHADE; 3082 ret |= FbWinFrame::DECORM_SHADE;
3082 if (decorations.tab) 3083 if (decorations.tab)
3083 ret |= DECORM_TAB; 3084 ret |= FbWinFrame::DECORM_TAB;
3084 if (decorations.enabled) 3085 if (decorations.enabled)
3085 ret |= DECORM_ENABLED; 3086 ret |= FbWinFrame::DECORM_ENABLED;
3086 return ret; 3087 return ret;
3087} 3088}
3088 3089
3089void FluxboxWindow::setDecorationMask(unsigned int mask, bool apply) { 3090void FluxboxWindow::setDecorationMask(unsigned int mask, bool apply) {
3090 decorations.titlebar = mask & DECORM_TITLEBAR; 3091 decorations.titlebar = mask & FbWinFrame::DECORM_TITLEBAR;
3091 decorations.handle = mask & DECORM_HANDLE; 3092 decorations.handle = mask & FbWinFrame::DECORM_HANDLE;
3092 decorations.border = mask & DECORM_BORDER; 3093 decorations.border = mask & FbWinFrame::DECORM_BORDER;
3093 decorations.iconify = mask & DECORM_ICONIFY; 3094 decorations.iconify = mask & FbWinFrame::DECORM_ICONIFY;
3094 decorations.maximize = mask & DECORM_MAXIMIZE; 3095 decorations.maximize = mask & FbWinFrame::DECORM_MAXIMIZE;
3095 decorations.close = mask & DECORM_CLOSE; 3096 decorations.close = mask & FbWinFrame::DECORM_CLOSE;
3096 decorations.menu = mask & DECORM_MENU; 3097 decorations.menu = mask & FbWinFrame::DECORM_MENU;
3097 decorations.sticky = mask & DECORM_STICKY; 3098 decorations.sticky = mask & FbWinFrame::DECORM_STICKY;
3098 decorations.shade = mask & DECORM_SHADE; 3099 decorations.shade = mask & FbWinFrame::DECORM_SHADE;
3099 decorations.tab = mask & DECORM_TAB; 3100 decorations.tab = mask & FbWinFrame::DECORM_TAB;
3100 decorations.enabled = mask & DECORM_ENABLED; 3101 decorations.enabled = mask & FbWinFrame::DECORM_ENABLED;
3101 // we don't want to do this during initialization 3102 // we don't want to do this during initialization
3102 if (apply) 3103 if (apply)
3103 applyDecorations(); 3104 applyDecorations();
@@ -3268,7 +3269,7 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
3268 // we only care about the left/top etc that includes borders 3269 // we only care about the left/top etc that includes borders
3269 int borderW = 0; 3270 int borderW = 0;
3270 3271
3271 if (decorationMask() & (DECORM_BORDER|DECORM_HANDLE)) 3272 if (decorationMask() & (FbWinFrame::DECORM_BORDER|FbWinFrame::DECORM_HANDLE))
3272 borderW = frame().window().borderWidth(); 3273 borderW = frame().window().borderWidth();
3273 3274
3274 int top = orig_top; // orig include the borders 3275 int top = orig_top; // orig include the borders
@@ -3340,7 +3341,7 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
3340 if ((*it) == this) 3341 if ((*it) == this)
3341 continue; // skip myself 3342 continue; // skip myself
3342 3343
3343 bw = (*it)->decorationMask() & (DECORM_BORDER|DECORM_HANDLE) ? 3344 bw = (*it)->decorationMask() & (FbWinFrame::DECORM_BORDER|FbWinFrame::DECORM_HANDLE) ?
3344 (*it)->frame().window().borderWidth() : 0; 3345 (*it)->frame().window().borderWidth() : 0;
3345 3346
3346 snapToWindow(dx, dy, left, right, top, bottom, 3347 snapToWindow(dx, dy, left, right, top, bottom,
@@ -4106,17 +4107,17 @@ void FluxboxWindow::associateClient(WinClient &client) {
4106 4107
4107int FluxboxWindow::getDecoMaskFromString(const string &str_label) { 4108int FluxboxWindow::getDecoMaskFromString(const string &str_label) {
4108 if (strcasecmp(str_label.c_str(), "NONE") == 0) 4109 if (strcasecmp(str_label.c_str(), "NONE") == 0)
4109 return DECOR_NONE; 4110 return FbWinFrame::DECOR_NONE;
4110 if (strcasecmp(str_label.c_str(), "NORMAL") == 0) 4111 if (strcasecmp(str_label.c_str(), "NORMAL") == 0)
4111 return DECOR_NORMAL; 4112 return FbWinFrame::DECOR_NORMAL;
4112 if (strcasecmp(str_label.c_str(), "TINY") == 0) 4113 if (strcasecmp(str_label.c_str(), "TINY") == 0)
4113 return DECOR_TINY; 4114 return FbWinFrame::DECOR_TINY;
4114 if (strcasecmp(str_label.c_str(), "TOOL") == 0) 4115 if (strcasecmp(str_label.c_str(), "TOOL") == 0)
4115 return DECOR_TOOL; 4116 return FbWinFrame::DECOR_TOOL;
4116 if (strcasecmp(str_label.c_str(), "BORDER") == 0) 4117 if (strcasecmp(str_label.c_str(), "BORDER") == 0)
4117 return DECOR_BORDER; 4118 return FbWinFrame::DECOR_BORDER;
4118 if (strcasecmp(str_label.c_str(), "TAB") == 0) 4119 if (strcasecmp(str_label.c_str(), "TAB") == 0)
4119 return DECOR_TAB; 4120 return FbWinFrame::DECOR_TAB;
4120 int mask = -1; 4121 int mask = -1;
4121 if (str_label.size() > 1 && str_label[0] == '0' && str_label[1] == 'x' || 4122 if (str_label.size() > 1 && str_label[0] == '0' && str_label[1] == 'x' ||
4122 str_label.size() > 0 && isdigit(str_label[0])) 4123 str_label.size() > 0 && isdigit(str_label[0]))
@@ -4158,7 +4159,7 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
4158 */ 4159 */
4159 setFocusHidden(true); 4160 setFocusHidden(true);
4160 setIconHidden(true); 4161 setIconHidden(true);
4161 setDecorationMask(DECOR_NONE); 4162 setDecorationMask(FbWinFrame::DECOR_NONE);
4162 moveToLayer(::Layer::DOCK); 4163 moveToLayer(::Layer::DOCK);
4163 break; 4164 break;
4164 case Focusable::TYPE_DESKTOP: 4165 case Focusable::TYPE_DESKTOP:
@@ -4171,7 +4172,7 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
4171 setFocusHidden(true); 4172 setFocusHidden(true);
4172 setIconHidden(true); 4173 setIconHidden(true);
4173 moveToLayer(::Layer::DESKTOP); 4174 moveToLayer(::Layer::DESKTOP);
4174 setDecorationMask(DECOR_NONE); 4175 setDecorationMask(FbWinFrame::DECOR_NONE);
4175 setTabable(false); 4176 setTabable(false);
4176 setMovable(false); 4177 setMovable(false);
4177 setResizable(false); 4178 setResizable(false);
@@ -4183,7 +4184,7 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
4183 * window is a splash screen displayed as an application 4184 * window is a splash screen displayed as an application
4184 * is starting up. 4185 * is starting up.
4185 */ 4186 */
4186 setDecorationMask(DECOR_NONE); 4187 setDecorationMask(FbWinFrame::DECOR_NONE);
4187 setFocusHidden(true); 4188 setFocusHidden(true);
4188 setIconHidden(true); 4189 setIconHidden(true);
4189 setMovable(false); 4190 setMovable(false);
@@ -4200,7 +4201,7 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
4200 * application). Windows of this type may set the 4201 * application). Windows of this type may set the
4201 * WM_TRANSIENT_FOR hint indicating the main application window. 4202 * WM_TRANSIENT_FOR hint indicating the main application window.
4202 */ 4203 */
4203 setDecorationMask(DECOR_TOOL); 4204 setDecorationMask(FbWinFrame::DECOR_TOOL);
4204 setIconHidden(true); 4205 setIconHidden(true);
4205 moveToLayer(::Layer::ABOVE_DOCK); 4206 moveToLayer(::Layer::ABOVE_DOCK);
4206 break; 4207 break;
diff --git a/src/Window.hh b/src/Window.hh
index eeb7ae1..1d54d18 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -110,34 +110,6 @@ public:
110 MAX_VERT = 2, ///< maximize vertical 110 MAX_VERT = 2, ///< maximize vertical
111 MAX_FULL = 3 ///< maximize full 111 MAX_FULL = 3 ///< maximize full
112 }; 112 };
113 /**
114 This enumeration represents individual decoration
115 attributes, they can be OR-d together to get a mask.
116 Useful for saving.
117 */
118 enum DecorationMask {
119 DECORM_TITLEBAR = (1<<0),
120 DECORM_HANDLE = (1<<1),
121 DECORM_BORDER = (1<<2),
122 DECORM_ICONIFY = (1<<3),
123 DECORM_MAXIMIZE = (1<<4),
124 DECORM_CLOSE = (1<<5),
125 DECORM_MENU = (1<<6),
126 DECORM_STICKY = (1<<7),
127 DECORM_SHADE = (1<<8),
128 DECORM_TAB = (1<<9),
129 DECORM_ENABLED = (1<<10),
130 DECORM_LAST = (1<<11) // useful for getting "All"
131 };
132
133 enum Decoration {
134 DECOR_NONE = 0,
135 DECOR_NORMAL = DECORM_LAST - 1,
136 DECOR_TINY = DECORM_TITLEBAR|DECORM_ICONIFY|DECORM_MENU|DECORM_TAB,
137 DECOR_TOOL = DECORM_TITLEBAR|DECORM_MENU,
138 DECOR_BORDER = DECORM_BORDER|DECORM_MENU,
139 DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB
140 };
141 113
142 /// Different resize modes when resizing a window 114 /// Different resize modes when resizing a window
143 enum ResizeModel { 115 enum ResizeModel {