summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Window.cc66
-rw-r--r--src/Window.hh56
2 files changed, 73 insertions, 49 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 2cecd25..464210c 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.197 2003/06/25 06:02:15 fluxgen Exp $ 25// $Id: Window.cc,v 1.198 2003/06/25 13:37:06 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -219,10 +219,6 @@ void LayerMenuItem<FluxboxWindow>::click(int button, int time) {
219 m_object->moveToLayer(m_layernum); 219 m_object->moveToLayer(m_layernum);
220} 220}
221 221
222
223//int FluxboxWindow::PropBlackboxHintsElements = 5;
224//int FluxboxWindow::PropBlackboxAttributesElements = 8;
225
226FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &tm, 222FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &tm,
227 FbTk::MenuTheme &menutheme, 223 FbTk::MenuTheme &menutheme,
228 FbTk::XLayer &layer): 224 FbTk::XLayer &layer):
@@ -232,9 +228,10 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t
232 m_layersig(*this), 228 m_layersig(*this),
233 m_workspacesig(*this), 229 m_workspacesig(*this),
234 m_diesig(*this), 230 m_diesig(*this),
235 moving(false), resizing(false), shaded(false), maximized(false), 231 moving(false), resizing(false), shaded(false),
236 iconic(false), focused(false), 232 iconic(false), focused(false),
237 stuck(false), m_managed(false), 233 stuck(false), m_managed(false),
234 maximized(MAX_NONE),
238 m_screen(scr), 235 m_screen(scr),
239 m_timer(this), 236 m_timer(this),
240 display(0), 237 display(0),
@@ -512,7 +509,7 @@ void FluxboxWindow::init() {
512 } 509 }
513 510
514 if (maximized && functions.maximize) { // start maximized 511 if (maximized && functions.maximize) { // start maximized
515 maximized = false; 512 maximized = MAX_NONE;
516 maximize(); 513 maximize();
517 } 514 }
518 515
@@ -961,13 +958,13 @@ void FluxboxWindow::getBlackboxHints() {
961 (hint->flags & ATTRIB_MAXVERT)) 958 (hint->flags & ATTRIB_MAXVERT))
962 maximized = ((hint->attrib & 959 maximized = ((hint->attrib &
963 (ATTRIB_MAXHORIZ | 960 (ATTRIB_MAXHORIZ |
964 ATTRIB_MAXVERT)) ? 1 : 0); 961 ATTRIB_MAXVERT)) ? MAX_FULL : MAX_NONE);
965 else if (hint->flags & ATTRIB_MAXVERT) 962 else if (hint->flags & ATTRIB_MAXVERT)
966 maximized = ((hint->attrib & 963 maximized = ((hint->attrib &
967 ATTRIB_MAXVERT) ? 2 : 0); 964 ATTRIB_MAXVERT) ? MAX_VERT : MAX_NONE);
968 else if (hint->flags & ATTRIB_MAXHORIZ) 965 else if (hint->flags & ATTRIB_MAXHORIZ)
969 maximized = ((hint->attrib & 966 maximized = ((hint->attrib &
970 ATTRIB_MAXHORIZ) ? 3 : 0); 967 ATTRIB_MAXHORIZ) ? MAX_HORZ : MAX_NONE);
971 968
972 if (hint->flags & ATTRIB_OMNIPRESENT) 969 if (hint->flags & ATTRIB_OMNIPRESENT)
973 stuck = (hint->attrib & 970 stuck = (hint->attrib &
@@ -1244,32 +1241,47 @@ void FluxboxWindow::maximize() {
1244 moveResize(left_x, max_top, 1241 moveResize(left_x, max_top,
1245 max_width - left_x - 2*frame().window().borderWidth(), 1242 max_width - left_x - 2*frame().window().borderWidth(),
1246 screen().maxBottom(head) - max_top - 2*frame().window().borderWidth()); 1243 screen().maxBottom(head) - max_top - 2*frame().window().borderWidth());
1244 maximized = MAX_FULL;
1247 } else { // demaximize, restore to old values 1245 } else { // demaximize, restore to old values
1248 moveResize(m_old_pos_x, m_old_pos_y, 1246 moveResize(m_old_pos_x, m_old_pos_y,
1249 m_old_width, m_old_height); 1247 m_old_width, m_old_height);
1248 maximized = MAX_NONE;
1250 } 1249 }
1251 // toggle maximize
1252 maximized = !maximized;
1253}
1254 1250
1251}
1252/**
1253 * Maximize window horizontal
1254 */
1255void FluxboxWindow::maximizeHorizontal() { 1255void FluxboxWindow::maximizeHorizontal() {
1256 int head = screen().getHead(frame().window()); 1256 if (! (maximized & MAX_HORZ) ) {
1257 unsigned int left_x = screen().maxLeft(head); 1257 const int head = screen().getHead(frame().window());
1258 unsigned int max_width = screen().maxRight(head); 1258 const unsigned int left_x = screen().maxLeft(head);
1259 moveResize(left_x, frame().y(), 1259 const unsigned int max_width = screen().maxRight(head);
1260 max_width - left_x - 2*frame().window().borderWidth(), frame().height()); 1260 m_old_width = frame().width();
1261 1261 m_old_pos_x = frame().x();
1262 moveResize(left_x, frame().y(), max_width - left_x, frame().height());
1263 maximized |= MAX_HORZ;
1264 } else {
1265 moveResize(m_old_pos_x, frame().y(), m_old_width, frame().height());
1266 maximized &= ~MAX_HORZ;
1267 }
1262} 1268}
1263 1269
1264/** 1270/**
1265 Maximize window horizontal 1271 * Maximize window vertical
1266 */ 1272 */
1267void FluxboxWindow::maximizeVertical() { 1273void FluxboxWindow::maximizeVertical() {
1268 int head = screen().getHead(frame().window()); 1274 if (! (maximized & MAX_VERT) ) {
1269 unsigned int max_top = screen().maxTop(head); 1275 const int head = screen().getHead(frame().window());
1270 moveResize(frame().x(), max_top, 1276 const unsigned int max_top = screen().maxTop(head);
1271 frame().width(), 1277 m_old_height = frame().height();
1272 screen().maxBottom(head) - max_top - 2*frame().window().borderWidth()); 1278 m_old_pos_y = frame().y();
1279 moveResize(frame().x(), max_top, frame().width(), screen().maxBottom(head) - max_top);
1280 maximized |= MAX_VERT;
1281 } else {
1282 moveResize(frame().x(), m_old_pos_y, frame().width(), m_old_height);
1283 maximized &= ~MAX_VERT;
1284 }
1273} 1285}
1274 1286
1275 1287
@@ -1753,10 +1765,10 @@ void FluxboxWindow::restoreAttributes() {
1753 (m_blackbox_attrib.flags & ATTRIB_MAXVERT)) { 1765 (m_blackbox_attrib.flags & ATTRIB_MAXVERT)) {
1754 int x = m_blackbox_attrib.premax_x, y = m_blackbox_attrib.premax_y; 1766 int x = m_blackbox_attrib.premax_x, y = m_blackbox_attrib.premax_y;
1755 unsigned int w = m_blackbox_attrib.premax_w, h = m_blackbox_attrib.premax_h; 1767 unsigned int w = m_blackbox_attrib.premax_w, h = m_blackbox_attrib.premax_h;
1756 maximized = false; 1768 maximized = MAX_NONE;
1757 if ((m_blackbox_attrib.flags & ATTRIB_MAXHORIZ) && 1769 if ((m_blackbox_attrib.flags & ATTRIB_MAXHORIZ) &&
1758 (m_blackbox_attrib.flags & ATTRIB_MAXVERT)) 1770 (m_blackbox_attrib.flags & ATTRIB_MAXVERT))
1759 maximized = true; 1771 maximized = MAX_FULL;
1760 else if (m_blackbox_attrib.flags & ATTRIB_MAXVERT) 1772 else if (m_blackbox_attrib.flags & ATTRIB_MAXVERT)
1761 maximizeVertical(); 1773 maximizeVertical();
1762 else if (m_blackbox_attrib.flags & ATTRIB_MAXHORIZ) 1774 else if (m_blackbox_attrib.flags & ATTRIB_MAXHORIZ)
diff --git a/src/Window.hh b/src/Window.hh
index d7a6769..a7ef327 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.hh,v 1.81 2003/06/24 14:57:06 fluxgen Exp $ 25// $Id: Window.hh,v 1.82 2003/06/25 13:37:06 fluxgen Exp $
26 26
27#ifndef WINDOW_HH 27#ifndef WINDOW_HH
28#define WINDOW_HH 28#define WINDOW_HH
@@ -103,6 +103,35 @@ public:
103 ATTRIB_DECORATION = 0x40 103 ATTRIB_DECORATION = 0x40
104 }; 104 };
105 105
106 /**
107 * Types of maximization
108 */
109 enum MaximizeMode {
110 MAX_NONE = 0, ///< normal state
111 MAX_HORZ = 1, ///< maximize horizontal
112 MAX_VERT = 2, ///< maximize vertical
113 MAX_FULL = 3 ///< maximize full
114 };
115 /**
116 This enumeration represents individual decoration
117 attributes, they can be OR-d together to get a mask.
118 Useful for saving.
119 */
120 enum DecorationMask {
121 DECORM_TITLEBAR = (1<<0),
122 DECORM_HANDLE = (1<<1),
123 DECORM_BORDER = (1<<2),
124 DECORM_ICONIFY = (1<<3),
125 DECORM_MAXIMIZE = (1<<4),
126 DECORM_CLOSE = (1<<5),
127 DECORM_MENU = (1<<6),
128 DECORM_STICKY = (1<<7),
129 DECORM_SHADE = (1<<8),
130 DECORM_TAB = (1<<9),
131 DECORM_ENABLED = (1<<10),
132 DECORM_LAST = (1<<11) // useful for getting "All"
133 };
134
106 typedef struct _blackbox_hints { 135 typedef struct _blackbox_hints {
107 unsigned long flags, attrib, workspace, stack; 136 unsigned long flags, attrib, workspace, stack;
108 int decoration; 137 int decoration;
@@ -212,25 +241,6 @@ public:
212 void applyDecorations(); 241 void applyDecorations();
213 void toggleDecoration(); 242 void toggleDecoration();
214 243
215 /**
216 This enumeration represents individual decoration
217 attributes, they can be OR-d together to get a mask.
218 Useful for saving.
219 */
220 enum DecorationMask {
221 DECORM_TITLEBAR = (1<<0),
222 DECORM_HANDLE = (1<<1),
223 DECORM_BORDER = (1<<2),
224 DECORM_ICONIFY = (1<<3),
225 DECORM_MAXIMIZE = (1<<4),
226 DECORM_CLOSE = (1<<5),
227 DECORM_MENU = (1<<6),
228 DECORM_STICKY = (1<<7),
229 DECORM_SHADE = (1<<8),
230 DECORM_TAB = (1<<9),
231 DECORM_ENABLED = (1<<10),
232 DECORM_LAST = (1<<11) // useful for getting "All"
233 };
234 244
235 void setStrut(Strut *strut); 245 void setStrut(Strut *strut);
236 void clearStrut(); 246 void clearStrut();
@@ -249,7 +259,7 @@ public:
249 bool isVisible() const; 259 bool isVisible() const;
250 inline bool isIconic() const { return iconic; } 260 inline bool isIconic() const { return iconic; }
251 inline bool isShaded() const { return shaded; } 261 inline bool isShaded() const { return shaded; }
252 inline bool isMaximized() const { return maximized; } 262 inline bool isMaximized() const { return maximized == MAX_FULL; }
253 inline bool isIconifiable() const { return functions.iconify; } 263 inline bool isIconifiable() const { return functions.iconify; }
254 inline bool isMaximizable() const { return functions.maximize; } 264 inline bool isMaximizable() const { return functions.maximize; }
255 inline bool isResizable() const { return functions.resize; } 265 inline bool isResizable() const { return functions.resize; }
@@ -382,9 +392,11 @@ private:
382 WinSubject m_hintsig, m_statesig, m_layersig, m_workspacesig, m_diesig; 392 WinSubject m_hintsig, m_statesig, m_layersig, m_workspacesig, m_diesig;
383 393
384 // Window states 394 // Window states
385 bool moving, resizing, shaded, maximized, iconic, 395 bool moving, resizing, shaded, iconic,
386 focused, stuck, m_managed; 396 focused, stuck, m_managed;
387 397
398 int maximized;
399
388 WinClient *m_attaching_tab; 400 WinClient *m_attaching_tab;
389 401
390 BScreen &m_screen; /// screen on which this window exist 402 BScreen &m_screen; /// screen on which this window exist