aboutsummaryrefslogtreecommitdiff
path: root/src/WindowState.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/WindowState.cc')
-rw-r--r--src/WindowState.cc30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/WindowState.cc b/src/WindowState.cc
index f4df136..50a88fc 100644
--- a/src/WindowState.cc
+++ b/src/WindowState.cc
@@ -43,21 +43,41 @@ bool WindowState::useTitlebar() const {
43} 43}
44 44
45void WindowState::saveGeometry(int new_x, int new_y, 45void WindowState::saveGeometry(int new_x, int new_y,
46 unsigned int new_w, unsigned int new_h) { 46 unsigned int new_w, unsigned int new_h,
47 if (fullscreen || maximized == MAX_FULL) 47 bool force) {
48 if ((fullscreen || maximized == MAX_FULL) && !force)
48 return; 49 return;
49 50
50 if (!(maximized & MAX_HORZ)) { 51 if (!(maximized & MAX_HORZ) || force) {
51 x = new_x; 52 x = new_x;
52 width = new_w; 53 width = new_w;
53 } 54 }
54 if (!(maximized & MAX_VERT)) { 55 if (!(maximized & MAX_VERT) || force) {
55 y = new_y; 56 y = new_y;
56 if (!shaded) 57 if (!shaded || force)
57 height = new_h; 58 height = new_h;
58 } 59 }
59} 60}
60 61
62int WindowState::queryToggleMaximized(int type) const {
63 if (type == MAX_NONE)
64 return maximized;
65
66 int new_max = maximized;
67 // toggle maximize vertically?
68 // when _don't_ we want to toggle?
69 // - type is horizontal maximize, or
70 // - type is full and we are not maximized horz but already vertically
71 if (type != MAX_HORZ && (type != MAX_FULL || maximized != MAX_VERT))
72 new_max ^= MAX_VERT;
73
74 // maximize horizontally?
75 if (type != MAX_VERT && (type != MAX_FULL || maximized != MAX_HORZ))
76 new_max ^= MAX_HORZ;
77
78 return new_max;
79}
80
61int WindowState::getDecoMaskFromString(const std::string &str_label) { 81int WindowState::getDecoMaskFromString(const std::string &str_label) {
62 std::string label = FbTk::StringUtil::toLower(str_label); 82 std::string label = FbTk::StringUtil::toLower(str_label);
63 if (label == "none") 83 if (label == "none")