diff options
author | fluxgen <fluxgen> | 2003-06-25 13:37:06 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-06-25 13:37:06 (GMT) |
commit | 6b3881d999b79126595df8bca2585ee3eed366d2 (patch) | |
tree | 6240a203bf4a5b71cbb5522920989af2274b055f /src/Window.cc | |
parent | 2a08e33735bea68dd0232d0f00775768069bbf12 (diff) | |
download | fluxbox-6b3881d999b79126595df8bca2585ee3eed366d2.zip fluxbox-6b3881d999b79126595df8bca2585ee3eed366d2.tar.bz2 |
applied max vert horiz toggle patch from MrChuoi
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 66 |
1 files changed, 39 insertions, 27 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 | |||
226 | FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &tm, | 222 | FluxboxWindow::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 | */ | ||
1255 | void FluxboxWindow::maximizeHorizontal() { | 1255 | void 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 | */ |
1267 | void FluxboxWindow::maximizeVertical() { | 1273 | void 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) |