Changeset View
Changeset View
Standalone View
Standalone View
geometry.cpp
Show First 20 Lines • Show All 542 Lines • ▼ Show 20 Line(s) | 475 | if (options->windowSnapZone() || !borderSnapZone.isNull() || options->centerSnapZone()) { | |||
---|---|---|---|---|---|
543 | if (snap) { | 543 | if (snap) { | ||
544 | for (auto l = m_allClients.constBegin(); l != m_allClients.constEnd(); ++l) { | 544 | for (auto l = m_allClients.constBegin(); l != m_allClients.constEnd(); ++l) { | ||
545 | if ((*l) == c) | 545 | if ((*l) == c) | ||
546 | continue; | 546 | continue; | ||
547 | if ((*l)->isMinimized()) | 547 | if ((*l)->isMinimized()) | ||
548 | continue; // is minimized | 548 | continue; // is minimized | ||
549 | if (!(*l)->isShown(false)) | 549 | if (!(*l)->isShown(false)) | ||
550 | continue; | 550 | continue; | ||
551 | if ((*l)->tabGroup() && (*l) != (*l)->tabGroup()->current()) | | |||
552 | continue; // is not active tab | | |||
553 | if (!((*l)->isOnDesktop(c->desktop()) || c->isOnDesktop((*l)->desktop()))) | 551 | if (!((*l)->isOnDesktop(c->desktop()) || c->isOnDesktop((*l)->desktop()))) | ||
554 | continue; // wrong virtual desktop | 552 | continue; // wrong virtual desktop | ||
555 | if (!(*l)->isOnCurrentActivity()) | 553 | if (!(*l)->isOnCurrentActivity()) | ||
556 | continue; // wrong activity | 554 | continue; // wrong activity | ||
557 | if ((*l)->isDesktop() || (*l)->isSplash()) | 555 | if ((*l)->isDesktop() || (*l)->isSplash()) | ||
558 | continue; | 556 | continue; | ||
559 | 557 | | |||
560 | lx = (*l)->x(); | 558 | lx = (*l)->x(); | ||
▲ Show 20 Lines • Show All 794 Lines • ▼ Show 20 Line(s) | 1350 | { | |||
1355 | if (w < 1 || h < 1) { | 1353 | if (w < 1 || h < 1) { | ||
1356 | qCWarning(KWIN_CORE) << "sizeForClientSize() with empty size!" ; | 1354 | qCWarning(KWIN_CORE) << "sizeForClientSize() with empty size!" ; | ||
1357 | } | 1355 | } | ||
1358 | if (w < 1) w = 1; | 1356 | if (w < 1) w = 1; | ||
1359 | if (h < 1) h = 1; | 1357 | if (h < 1) h = 1; | ||
1360 | 1358 | | |||
1361 | // basesize, minsize, maxsize, paspect and resizeinc have all values defined, | 1359 | // basesize, minsize, maxsize, paspect and resizeinc have all values defined, | ||
1362 | // even if they're not set in flags - see getWmNormalHints() | 1360 | // even if they're not set in flags - see getWmNormalHints() | ||
1363 | QSize min_size = tabGroup() ? tabGroup()->minSize() : minSize(); | 1361 | QSize min_size = minSize(); | ||
1364 | QSize max_size = tabGroup() ? tabGroup()->maxSize() : maxSize(); | 1362 | QSize max_size = maxSize(); | ||
1365 | if (isDecorated()) { | 1363 | if (isDecorated()) { | ||
1366 | QSize decominsize(0, 0); | 1364 | QSize decominsize(0, 0); | ||
1367 | QSize border_size(borderLeft() + borderRight(), borderTop() + borderBottom()); | 1365 | QSize border_size(borderLeft() + borderRight(), borderTop() + borderBottom()); | ||
1368 | if (border_size.width() > decominsize.width()) // just in case | 1366 | if (border_size.width() > decominsize.width()) // just in case | ||
1369 | decominsize.setWidth(border_size.width()); | 1367 | decominsize.setWidth(border_size.width()); | ||
1370 | if (border_size.height() > decominsize.height()) | 1368 | if (border_size.height() > decominsize.height()) | ||
1371 | decominsize.setHeight(border_size.height()); | 1369 | decominsize.setHeight(border_size.height()); | ||
1372 | if (decominsize.width() > min_size.width()) | 1370 | if (decominsize.width() > min_size.width()) | ||
▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Line(s) | 1522 | { | |||
1526 | // roundtrip to X server | 1524 | // roundtrip to X server | ||
1527 | m_geometryHints.fetch(); | 1525 | m_geometryHints.fetch(); | ||
1528 | m_geometryHints.read(); | 1526 | m_geometryHints.read(); | ||
1529 | 1527 | | |||
1530 | if (!hadFixedAspect && m_geometryHints.hasAspect()) { | 1528 | if (!hadFixedAspect && m_geometryHints.hasAspect()) { | ||
1531 | // align to eventual new contraints | 1529 | // align to eventual new contraints | ||
1532 | maximize(max_mode); | 1530 | maximize(max_mode); | ||
1533 | } | 1531 | } | ||
1534 | // Update min/max size of this group | | |||
1535 | if (tabGroup()) | | |||
1536 | tabGroup()->updateMinMaxSize(); | | |||
1537 | | ||||
1538 | if (isManaged()) { | 1532 | if (isManaged()) { | ||
1539 | // update to match restrictions | 1533 | // update to match restrictions | ||
1540 | QSize new_size = adjustedSize(); | 1534 | QSize new_size = adjustedSize(); | ||
1541 | if (new_size != size() && !isFullScreen()) { | 1535 | if (new_size != size() && !isFullScreen()) { | ||
1542 | QRect origClientGeometry(pos() + clientPos(), clientSize()); | 1536 | QRect origClientGeometry(pos() + clientPos(), clientSize()); | ||
1543 | resizeWithChecks(new_size); | 1537 | resizeWithChecks(new_size); | ||
1544 | if ((!isSpecialWindow() || isToolbar()) && !isFullScreen()) { | 1538 | if ((!isSpecialWindow() || isToolbar()) && !isFullScreen()) { | ||
1545 | // try to keep the window in its xinerama screen if possible, | 1539 | // try to keep the window in its xinerama screen if possible, | ||
▲ Show 20 Lines • Show All 362 Lines • ▼ Show 20 Line(s) | 1901 | if (isSpecialWindow() || isSplash() || isToolbar()) | |||
1908 | return false; | 1902 | return false; | ||
1909 | if (rules()->checkSize(QSize()).isValid()) // forced size | 1903 | if (rules()->checkSize(QSize()).isValid()) // forced size | ||
1910 | return false; | 1904 | return false; | ||
1911 | const Position mode = moveResizePointerMode(); | 1905 | const Position mode = moveResizePointerMode(); | ||
1912 | if ((mode == PositionTop || mode == PositionTopLeft || mode == PositionTopRight || | 1906 | if ((mode == PositionTop || mode == PositionTopLeft || mode == PositionTopRight || | ||
1913 | mode == PositionLeft || mode == PositionBottomLeft) && rules()->checkPosition(invalidPoint) != invalidPoint) | 1907 | mode == PositionLeft || mode == PositionBottomLeft) && rules()->checkPosition(invalidPoint) != invalidPoint) | ||
1914 | return false; | 1908 | return false; | ||
1915 | 1909 | | |||
1916 | QSize min = tabGroup() ? tabGroup()->minSize() : minSize(); | 1910 | QSize min = minSize(); | ||
1917 | QSize max = tabGroup() ? tabGroup()->maxSize() : maxSize(); | 1911 | QSize max = maxSize(); | ||
1918 | return min.width() < max.width() || min.height() < max.height(); | 1912 | return min.width() < max.width() || min.height() < max.height(); | ||
1919 | } | 1913 | } | ||
1920 | 1914 | | |||
1921 | bool Client::isMaximizable() const | 1915 | bool Client::isMaximizable() const | ||
1922 | { | 1916 | { | ||
1923 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | 1917 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | ||
1924 | return false; | 1918 | return false; | ||
1925 | if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore && rules()->checkMaximize(MaximizeFull) != MaximizeRestore) | 1919 | if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore && rules()->checkMaximize(MaximizeFull) != MaximizeRestore) | ||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | 1929 | { | |||
2004 | } | 1998 | } | ||
2005 | updateWindowRules(Rules::Position|Rules::Size); | 1999 | updateWindowRules(Rules::Position|Rules::Size); | ||
2006 | 2000 | | |||
2007 | // keep track of old maximize mode | 2001 | // keep track of old maximize mode | ||
2008 | // to detect changes | 2002 | // to detect changes | ||
2009 | screens()->setCurrent(this); | 2003 | screens()->setCurrent(this); | ||
2010 | workspace()->updateStackingOrder(); | 2004 | workspace()->updateStackingOrder(); | ||
2011 | 2005 | | |||
2012 | // need to regenerate decoration pixmaps when either | 2006 | // need to regenerate decoration pixmaps when | ||
2013 | // - size is changed | 2007 | // - size is changed | ||
2014 | // - maximize mode is changed to MaximizeRestore, when size unchanged | | |||
2015 | // which can happen when untabbing maximized windows | | |||
2016 | if (resized) { | 2008 | if (resized) { | ||
2017 | if (oldClientSize != QSize(w,h)) | 2009 | if (oldClientSize != QSize(w,h)) | ||
2018 | discardWindowPixmap(); | 2010 | discardWindowPixmap(); | ||
2019 | } | 2011 | } | ||
2020 | emit geometryShapeChanged(this, geometryBeforeUpdateBlocking()); | 2012 | emit geometryShapeChanged(this, geometryBeforeUpdateBlocking()); | ||
2021 | addRepaintDuringGeometryUpdates(); | 2013 | addRepaintDuringGeometryUpdates(); | ||
2022 | updateGeometryBeforeUpdateBlocking(); | 2014 | updateGeometryBeforeUpdateBlocking(); | ||
2023 | | ||||
2024 | // Update states of all other windows in this group | | |||
2025 | if (tabGroup()) | | |||
2026 | tabGroup()->updateStates(this, TabGroup::Geometry); | | |||
2027 | | ||||
2028 | // TODO: this signal is emitted too often | 2015 | // TODO: this signal is emitted too often | ||
2029 | emit geometryChanged(); | 2016 | emit geometryChanged(); | ||
2030 | } | 2017 | } | ||
2031 | 2018 | | |||
2032 | void Client::plainResize(int w, int h, ForceGeometry_t force) | 2019 | void Client::plainResize(int w, int h, ForceGeometry_t force) | ||
2033 | { | 2020 | { | ||
2034 | // this code is also duplicated in Client::setGeometry(), and it's also commented there | 2021 | // this code is also duplicated in Client::setGeometry(), and it's also commented there | ||
2035 | if (shade_geometry_change) | 2022 | if (shade_geometry_change) | ||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 2055 | // resizeDecoration( s ); | |||
2077 | updateWindowRules(Rules::Position|Rules::Size); | 2064 | updateWindowRules(Rules::Position|Rules::Size); | ||
2078 | screens()->setCurrent(this); | 2065 | screens()->setCurrent(this); | ||
2079 | workspace()->updateStackingOrder(); | 2066 | workspace()->updateStackingOrder(); | ||
2080 | if (oldClientSize != QSize(w,h)) | 2067 | if (oldClientSize != QSize(w,h)) | ||
2081 | discardWindowPixmap(); | 2068 | discardWindowPixmap(); | ||
2082 | emit geometryShapeChanged(this, geometryBeforeUpdateBlocking()); | 2069 | emit geometryShapeChanged(this, geometryBeforeUpdateBlocking()); | ||
2083 | addRepaintDuringGeometryUpdates(); | 2070 | addRepaintDuringGeometryUpdates(); | ||
2084 | updateGeometryBeforeUpdateBlocking(); | 2071 | updateGeometryBeforeUpdateBlocking(); | ||
2085 | | ||||
2086 | // Update states of all other windows in this group | | |||
2087 | if (tabGroup()) | | |||
2088 | tabGroup()->updateStates(this, TabGroup::Geometry); | | |||
2089 | // TODO: this signal is emitted too often | 2072 | // TODO: this signal is emitted too often | ||
2090 | emit geometryChanged(); | 2073 | emit geometryChanged(); | ||
2091 | } | 2074 | } | ||
2092 | 2075 | | |||
2093 | /** | 2076 | /** | ||
2094 | * Reimplemented to inform the client about the new window position. | 2077 | * Reimplemented to inform the client about the new window position. | ||
2095 | */ | 2078 | */ | ||
2096 | void AbstractClient::move(int x, int y, ForceGeometry_t force) | 2079 | void AbstractClient::move(int x, int y, ForceGeometry_t force) | ||
Show All 18 Lines | 2080 | { | |||
2115 | } | 2098 | } | ||
2116 | doMove(x, y); | 2099 | doMove(x, y); | ||
2117 | updateWindowRules(Rules::Position); | 2100 | updateWindowRules(Rules::Position); | ||
2118 | screens()->setCurrent(this); | 2101 | screens()->setCurrent(this); | ||
2119 | workspace()->updateStackingOrder(); | 2102 | workspace()->updateStackingOrder(); | ||
2120 | // client itself is not damaged | 2103 | // client itself is not damaged | ||
2121 | addRepaintDuringGeometryUpdates(); | 2104 | addRepaintDuringGeometryUpdates(); | ||
2122 | updateGeometryBeforeUpdateBlocking(); | 2105 | updateGeometryBeforeUpdateBlocking(); | ||
2123 | | ||||
2124 | // Update states of all other windows in this group | | |||
2125 | updateTabGroupStates(TabGroup::Geometry); | | |||
2126 | emit geometryChanged(); | 2106 | emit geometryChanged(); | ||
2127 | } | 2107 | } | ||
2128 | 2108 | | |||
2129 | void Client::doMove(int x, int y) | 2109 | void Client::doMove(int x, int y) | ||
2130 | { | 2110 | { | ||
2131 | m_frame.move(x, y); | 2111 | m_frame.move(x, y); | ||
2132 | sendSyntheticConfigureNotify(); | 2112 | sendSyntheticConfigureNotify(); | ||
2133 | } | 2113 | } | ||
Show All 33 Lines | 2140 | { | |||
2167 | const MaximizeMode newMode = maximizeMode(); | 2147 | const MaximizeMode newMode = maximizeMode(); | ||
2168 | if (oldMode != newMode) { | 2148 | if (oldMode != newMode) { | ||
2169 | emit clientMaximizedStateChanged(this, newMode); | 2149 | emit clientMaximizedStateChanged(this, newMode); | ||
2170 | emit clientMaximizedStateChanged(this, vertically, horizontally); | 2150 | emit clientMaximizedStateChanged(this, vertically, horizontally); | ||
2171 | } | 2151 | } | ||
2172 | 2152 | | |||
2173 | } | 2153 | } | ||
2174 | 2154 | | |||
2175 | // Update states of all other windows in this group | | |||
2176 | class TabSynchronizer | | |||
2177 | { | | |||
2178 | public: | | |||
2179 | TabSynchronizer(AbstractClient *client, TabGroup::States syncStates) : | | |||
2180 | m_client(client) , m_states(syncStates) | | |||
2181 | { | | |||
2182 | if (client->tabGroup()) | | |||
2183 | client->tabGroup()->blockStateUpdates(true); | | |||
2184 | } | | |||
2185 | ~TabSynchronizer() | | |||
2186 | { | | |||
2187 | syncNow(); | | |||
2188 | } | | |||
2189 | void syncNow() | | |||
2190 | { | | |||
2191 | if (m_client && m_client->tabGroup()) { | | |||
2192 | m_client->tabGroup()->blockStateUpdates(false); | | |||
2193 | m_client->tabGroup()->updateStates(dynamic_cast<Client*>(m_client), m_states); | | |||
2194 | } | | |||
2195 | m_client = 0; | | |||
2196 | } | | |||
2197 | private: | | |||
2198 | AbstractClient *m_client; | | |||
2199 | TabGroup::States m_states; | | |||
2200 | }; | | |||
2201 | | ||||
2202 | | ||||
2203 | static bool changeMaximizeRecursion = false; | 2155 | static bool changeMaximizeRecursion = false; | ||
2204 | void Client::changeMaximize(bool horizontal, bool vertical, bool adjust) | 2156 | void Client::changeMaximize(bool horizontal, bool vertical, bool adjust) | ||
2205 | { | 2157 | { | ||
2206 | if (changeMaximizeRecursion) | 2158 | if (changeMaximizeRecursion) | ||
2207 | return; | 2159 | return; | ||
2208 | 2160 | | |||
2209 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | 2161 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | ||
2210 | return; | 2162 | return; | ||
Show All 33 Lines | 2181 | if (m_geometryHints.hasAspect() && // fixed aspect | |||
2244 | } | 2196 | } | ||
2245 | } | 2197 | } | ||
2246 | 2198 | | |||
2247 | max_mode = rules()->checkMaximize(max_mode); | 2199 | max_mode = rules()->checkMaximize(max_mode); | ||
2248 | if (!adjust && max_mode == old_mode) | 2200 | if (!adjust && max_mode == old_mode) | ||
2249 | return; | 2201 | return; | ||
2250 | 2202 | | |||
2251 | GeometryUpdatesBlocker blocker(this); | 2203 | GeometryUpdatesBlocker blocker(this); | ||
2252 | // QT synchronizing required because we eventually change from QT to Maximized | | |||
2253 | TabSynchronizer syncer(this, TabGroup::Maximized|TabGroup::QuickTile); | | |||
2254 | 2204 | | |||
2255 | // maximing one way and unmaximizing the other way shouldn't happen, | 2205 | // maximing one way and unmaximizing the other way shouldn't happen, | ||
2256 | // so restore first and then maximize the other way | 2206 | // so restore first and then maximize the other way | ||
2257 | if ((old_mode == MaximizeVertical && max_mode == MaximizeHorizontal) | 2207 | if ((old_mode == MaximizeVertical && max_mode == MaximizeHorizontal) | ||
2258 | || (old_mode == MaximizeHorizontal && max_mode == MaximizeVertical)) { | 2208 | || (old_mode == MaximizeHorizontal && max_mode == MaximizeVertical)) { | ||
2259 | changeMaximize(false, false, false); // restore | 2209 | changeMaximize(false, false, false); // restore | ||
2260 | } | 2210 | } | ||
2261 | 2211 | | |||
▲ Show 20 Lines • Show All 183 Lines • ▼ Show 20 Line(s) | 2394 | else | |||
2445 | updateQuickTileMode(QuickTileFlag::None); | 2395 | updateQuickTileMode(QuickTileFlag::None); | ||
2446 | info->setState(NET::Max, NET::Max); | 2396 | info->setState(NET::Max, NET::Max); | ||
2447 | break; | 2397 | break; | ||
2448 | } | 2398 | } | ||
2449 | default: | 2399 | default: | ||
2450 | break; | 2400 | break; | ||
2451 | } | 2401 | } | ||
2452 | 2402 | | |||
2453 | syncer.syncNow(); // important because of window rule updates! | | |||
2454 | | ||||
2455 | updateAllowedActions(); | 2403 | updateAllowedActions(); | ||
2456 | updateWindowRules(Rules::MaximizeVert|Rules::MaximizeHoriz|Rules::Position|Rules::Size); | 2404 | updateWindowRules(Rules::MaximizeVert|Rules::MaximizeHoriz|Rules::Position|Rules::Size); | ||
2457 | emit quickTileModeChanged(); | 2405 | emit quickTileModeChanged(); | ||
2458 | } | 2406 | } | ||
2459 | 2407 | | |||
2460 | bool Client::userCanSetFullScreen() const | 2408 | bool Client::userCanSetFullScreen() const | ||
2461 | { | 2409 | { | ||
2462 | if (!isFullScreenable()) { | 2410 | if (!isFullScreenable()) { | ||
Show All 19 Lines | 2417 | { | |||
2482 | if (wasFullscreen) { | 2430 | if (wasFullscreen) { | ||
2483 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event | 2431 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event | ||
2484 | } else { | 2432 | } else { | ||
2485 | geom_fs_restore = geometry(); | 2433 | geom_fs_restore = geometry(); | ||
2486 | } | 2434 | } | ||
2487 | 2435 | | |||
2488 | if (set) { | 2436 | if (set) { | ||
2489 | m_fullscreenMode = FullScreenNormal; | 2437 | m_fullscreenMode = FullScreenNormal; | ||
2490 | untab(); | | |||
2491 | workspace()->raiseClient(this); | 2438 | workspace()->raiseClient(this); | ||
2492 | } else { | 2439 | } else { | ||
2493 | m_fullscreenMode = FullScreenNone; | 2440 | m_fullscreenMode = FullScreenNone; | ||
2494 | } | 2441 | } | ||
2495 | 2442 | | |||
2496 | StackingUpdatesBlocker blocker1(workspace()); | 2443 | StackingUpdatesBlocker blocker1(workspace()); | ||
2497 | GeometryUpdatesBlocker blocker2(this); | 2444 | GeometryUpdatesBlocker blocker2(this); | ||
2498 | 2445 | | |||
▲ Show 20 Lines • Show All 740 Lines • ▼ Show 20 Line(s) | 3185 | if (!isResizable()) { | |||
3239 | return; | 3186 | return; | ||
3240 | } | 3187 | } | ||
3241 | 3188 | | |||
3242 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event | 3189 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event | ||
3243 | 3190 | | |||
3244 | GeometryUpdatesBlocker blocker(this); | 3191 | GeometryUpdatesBlocker blocker(this); | ||
3245 | 3192 | | |||
3246 | if (mode == QuickTileMode(QuickTileFlag::Maximize)) { | 3193 | if (mode == QuickTileMode(QuickTileFlag::Maximize)) { | ||
3247 | TabSynchronizer syncer(this, TabGroup::QuickTile|TabGroup::Geometry|TabGroup::Maximized); | | |||
3248 | m_quickTileMode = int(QuickTileFlag::None); | 3194 | m_quickTileMode = int(QuickTileFlag::None); | ||
3249 | if (maximizeMode() == MaximizeFull) { | 3195 | if (maximizeMode() == MaximizeFull) { | ||
3250 | setMaximize(false, false); | 3196 | setMaximize(false, false); | ||
3251 | } else { | 3197 | } else { | ||
3252 | QRect prev_geom_restore = geometryRestore(); // setMaximize() would set moveResizeGeom as geom_restore | 3198 | QRect prev_geom_restore = geometryRestore(); // setMaximize() would set moveResizeGeom as geom_restore | ||
3253 | m_quickTileMode = int(QuickTileFlag::Maximize); | 3199 | m_quickTileMode = int(QuickTileFlag::Maximize); | ||
3254 | setMaximize(true, true); | 3200 | setMaximize(true, true); | ||
3255 | QRect clientArea = workspace()->clientArea(MaximizeArea, this); | 3201 | QRect clientArea = workspace()->clientArea(MaximizeArea, this); | ||
Show All 14 Lines | |||||
3270 | if ((mode & QuickTileFlag::Vertical) == QuickTileMode(QuickTileFlag::Vertical)) | 3216 | if ((mode & QuickTileFlag::Vertical) == QuickTileMode(QuickTileFlag::Vertical)) | ||
3271 | mode &= ~QuickTileMode(QuickTileFlag::Vertical); | 3217 | mode &= ~QuickTileMode(QuickTileFlag::Vertical); | ||
3272 | 3218 | | |||
3273 | setElectricBorderMode(mode); // used by ::electricBorderMaximizeGeometry(.) | 3219 | setElectricBorderMode(mode); // used by ::electricBorderMaximizeGeometry(.) | ||
3274 | 3220 | | |||
3275 | // restore from maximized so that it is possible to tile maximized windows with one hit or by dragging | 3221 | // restore from maximized so that it is possible to tile maximized windows with one hit or by dragging | ||
3276 | if (maximizeMode() != MaximizeRestore) { | 3222 | if (maximizeMode() != MaximizeRestore) { | ||
3277 | 3223 | | |||
3278 | TabSynchronizer syncer(this, TabGroup::QuickTile|TabGroup::Geometry|TabGroup::Maximized); | | |||
3279 | | ||||
3280 | if (mode != QuickTileMode(QuickTileFlag::None)) { | 3224 | if (mode != QuickTileMode(QuickTileFlag::None)) { | ||
3281 | // decorations may turn off some borders when tiled | 3225 | // decorations may turn off some borders when tiled | ||
3282 | const ForceGeometry_t geom_mode = isDecorated() ? ForceGeometrySet : NormalGeometrySet; | 3226 | const ForceGeometry_t geom_mode = isDecorated() ? ForceGeometrySet : NormalGeometrySet; | ||
3283 | m_quickTileMode = int(QuickTileFlag::None); // Temporary, so the maximize code doesn't get all confused | 3227 | m_quickTileMode = int(QuickTileFlag::None); // Temporary, so the maximize code doesn't get all confused | ||
3284 | 3228 | | |||
3285 | setMaximize(false, false); | 3229 | setMaximize(false, false); | ||
3286 | 3230 | | |||
3287 | setGeometry(electricBorderMaximizeGeometry(keyboard ? geometry().center() : Cursor::pos(), desktop()), geom_mode); | 3231 | setGeometry(electricBorderMaximizeGeometry(keyboard ? geometry().center() : Cursor::pos(), desktop()), geom_mode); | ||
3288 | // Store the mode change | 3232 | // Store the mode change | ||
3289 | m_quickTileMode = mode; | 3233 | m_quickTileMode = mode; | ||
3290 | } else { | 3234 | } else { | ||
3291 | m_quickTileMode = mode; | 3235 | m_quickTileMode = mode; | ||
3292 | setMaximize(false, false); | 3236 | setMaximize(false, false); | ||
3293 | } | 3237 | } | ||
3294 | 3238 | | |||
3295 | emit quickTileModeChanged(); | 3239 | emit quickTileModeChanged(); | ||
3296 | 3240 | | |||
3297 | return; | 3241 | return; | ||
3298 | } | 3242 | } | ||
3299 | 3243 | | |||
3300 | if (mode != QuickTileMode(QuickTileFlag::None)) { | 3244 | if (mode != QuickTileMode(QuickTileFlag::None)) { | ||
3301 | TabSynchronizer syncer(this, TabGroup::QuickTile|TabGroup::Geometry); | | |||
3302 | | ||||
3303 | QPoint whichScreen = keyboard ? geometry().center() : Cursor::pos(); | 3245 | QPoint whichScreen = keyboard ? geometry().center() : Cursor::pos(); | ||
3304 | 3246 | | |||
3305 | // If trying to tile to the side that the window is already tiled to move the window to the next | 3247 | // If trying to tile to the side that the window is already tiled to move the window to the next | ||
3306 | // screen if it exists, otherwise toggle the mode (set QuickTileFlag::None) | 3248 | // screen if it exists, otherwise toggle the mode (set QuickTileFlag::None) | ||
3307 | if (quickTileMode() == mode) { | 3249 | if (quickTileMode() == mode) { | ||
3308 | const int numScreens = screens()->count(); | 3250 | const int numScreens = screens()->count(); | ||
3309 | const int curScreen = screen(); | 3251 | const int curScreen = screen(); | ||
3310 | int nextScreen = curScreen; | 3252 | int nextScreen = curScreen; | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 3295 | if (mode != QuickTileMode(QuickTileFlag::None)) { | |||
3359 | setGeometry(electricBorderMaximizeGeometry(whichScreen, desktop()), geom_mode); | 3301 | setGeometry(electricBorderMaximizeGeometry(whichScreen, desktop()), geom_mode); | ||
3360 | } | 3302 | } | ||
3361 | 3303 | | |||
3362 | // Store the mode change | 3304 | // Store the mode change | ||
3363 | m_quickTileMode = mode; | 3305 | m_quickTileMode = mode; | ||
3364 | } | 3306 | } | ||
3365 | 3307 | | |||
3366 | if (mode == QuickTileMode(QuickTileFlag::None)) { | 3308 | if (mode == QuickTileMode(QuickTileFlag::None)) { | ||
3367 | TabSynchronizer syncer(this, TabGroup::QuickTile|TabGroup::Geometry); | | |||
3368 | | ||||
3369 | m_quickTileMode = int(QuickTileFlag::None); | 3309 | m_quickTileMode = int(QuickTileFlag::None); | ||
3370 | // Untiling, so just restore geometry, and we're done. | 3310 | // Untiling, so just restore geometry, and we're done. | ||
3371 | if (!geometryRestore().isValid()) // invalid if we started maximized and wait for placement | 3311 | if (!geometryRestore().isValid()) // invalid if we started maximized and wait for placement | ||
3372 | setGeometryRestore(geometry()); | 3312 | setGeometryRestore(geometry()); | ||
3373 | // decorations may turn off some borders when tiled | 3313 | // decorations may turn off some borders when tiled | ||
3374 | const ForceGeometry_t geom_mode = isDecorated() ? ForceGeometrySet : NormalGeometrySet; | 3314 | const ForceGeometry_t geom_mode = isDecorated() ? ForceGeometrySet : NormalGeometrySet; | ||
3375 | setGeometry(geometryRestore(), geom_mode); | 3315 | setGeometry(geometryRestore(), geom_mode); | ||
3376 | checkWorkspacePosition(); // Just in case it's a different screen | 3316 | checkWorkspacePosition(); // Just in case it's a different screen | ||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |