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 349 Lines • ▼ Show 20 Line(s) | 1888 | if (isSpecialWindow() || isSplash() || isToolbar()) | |||
1895 | return false; | 1889 | return false; | ||
1896 | if (rules()->checkSize(QSize()).isValid()) // forced size | 1890 | if (rules()->checkSize(QSize()).isValid()) // forced size | ||
1897 | return false; | 1891 | return false; | ||
1898 | const Position mode = moveResizePointerMode(); | 1892 | const Position mode = moveResizePointerMode(); | ||
1899 | if ((mode == PositionTop || mode == PositionTopLeft || mode == PositionTopRight || | 1893 | if ((mode == PositionTop || mode == PositionTopLeft || mode == PositionTopRight || | ||
1900 | mode == PositionLeft || mode == PositionBottomLeft) && rules()->checkPosition(invalidPoint) != invalidPoint) | 1894 | mode == PositionLeft || mode == PositionBottomLeft) && rules()->checkPosition(invalidPoint) != invalidPoint) | ||
1901 | return false; | 1895 | return false; | ||
1902 | 1896 | | |||
1903 | QSize min = tabGroup() ? tabGroup()->minSize() : minSize(); | 1897 | QSize min = minSize(); | ||
1904 | QSize max = tabGroup() ? tabGroup()->maxSize() : maxSize(); | 1898 | QSize max = maxSize(); | ||
1905 | return min.width() < max.width() || min.height() < max.height(); | 1899 | return min.width() < max.width() || min.height() < max.height(); | ||
1906 | } | 1900 | } | ||
1907 | 1901 | | |||
1908 | bool Client::isMaximizable() const | 1902 | bool Client::isMaximizable() const | ||
1909 | { | 1903 | { | ||
1910 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | 1904 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | ||
1911 | return false; | 1905 | return false; | ||
1912 | if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore && rules()->checkMaximize(MaximizeFull) != MaximizeRestore) | 1906 | if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore && rules()->checkMaximize(MaximizeFull) != MaximizeRestore) | ||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | 1916 | { | |||
1991 | } | 1985 | } | ||
1992 | updateWindowRules(Rules::Position|Rules::Size); | 1986 | updateWindowRules(Rules::Position|Rules::Size); | ||
1993 | 1987 | | |||
1994 | // keep track of old maximize mode | 1988 | // keep track of old maximize mode | ||
1995 | // to detect changes | 1989 | // to detect changes | ||
1996 | screens()->setCurrent(this); | 1990 | screens()->setCurrent(this); | ||
1997 | workspace()->updateStackingOrder(); | 1991 | workspace()->updateStackingOrder(); | ||
1998 | 1992 | | |||
1999 | // need to regenerate decoration pixmaps when either | 1993 | // need to regenerate decoration pixmaps when | ||
2000 | // - size is changed | 1994 | // - size is changed | ||
2001 | // - maximize mode is changed to MaximizeRestore, when size unchanged | | |||
2002 | // which can happen when untabbing maximized windows | | |||
2003 | if (resized) { | 1995 | if (resized) { | ||
2004 | if (oldClientSize != QSize(w,h)) | 1996 | if (oldClientSize != QSize(w,h)) | ||
2005 | discardWindowPixmap(); | 1997 | discardWindowPixmap(); | ||
2006 | } | 1998 | } | ||
2007 | emit geometryShapeChanged(this, geometryBeforeUpdateBlocking()); | 1999 | emit geometryShapeChanged(this, geometryBeforeUpdateBlocking()); | ||
2008 | addRepaintDuringGeometryUpdates(); | 2000 | addRepaintDuringGeometryUpdates(); | ||
2009 | updateGeometryBeforeUpdateBlocking(); | 2001 | updateGeometryBeforeUpdateBlocking(); | ||
2010 | | ||||
2011 | // Update states of all other windows in this group | | |||
2012 | if (tabGroup()) | | |||
2013 | tabGroup()->updateStates(this, TabGroup::Geometry); | | |||
2014 | | ||||
2015 | // TODO: this signal is emitted too often | 2002 | // TODO: this signal is emitted too often | ||
2016 | emit geometryChanged(); | 2003 | emit geometryChanged(); | ||
2017 | } | 2004 | } | ||
2018 | 2005 | | |||
2019 | void Client::plainResize(int w, int h, ForceGeometry_t force) | 2006 | void Client::plainResize(int w, int h, ForceGeometry_t force) | ||
2020 | { | 2007 | { | ||
2021 | // this code is also duplicated in Client::setGeometry(), and it's also commented there | 2008 | // this code is also duplicated in Client::setGeometry(), and it's also commented there | ||
2022 | if (shade_geometry_change) | 2009 | if (shade_geometry_change) | ||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 2042 | // resizeDecoration( s ); | |||
2064 | updateWindowRules(Rules::Position|Rules::Size); | 2051 | updateWindowRules(Rules::Position|Rules::Size); | ||
2065 | screens()->setCurrent(this); | 2052 | screens()->setCurrent(this); | ||
2066 | workspace()->updateStackingOrder(); | 2053 | workspace()->updateStackingOrder(); | ||
2067 | if (oldClientSize != QSize(w,h)) | 2054 | if (oldClientSize != QSize(w,h)) | ||
2068 | discardWindowPixmap(); | 2055 | discardWindowPixmap(); | ||
2069 | emit geometryShapeChanged(this, geometryBeforeUpdateBlocking()); | 2056 | emit geometryShapeChanged(this, geometryBeforeUpdateBlocking()); | ||
2070 | addRepaintDuringGeometryUpdates(); | 2057 | addRepaintDuringGeometryUpdates(); | ||
2071 | updateGeometryBeforeUpdateBlocking(); | 2058 | updateGeometryBeforeUpdateBlocking(); | ||
2072 | | ||||
2073 | // Update states of all other windows in this group | | |||
2074 | if (tabGroup()) | | |||
2075 | tabGroup()->updateStates(this, TabGroup::Geometry); | | |||
2076 | // TODO: this signal is emitted too often | 2059 | // TODO: this signal is emitted too often | ||
2077 | emit geometryChanged(); | 2060 | emit geometryChanged(); | ||
2078 | } | 2061 | } | ||
2079 | 2062 | | |||
2080 | /** | 2063 | /** | ||
2081 | * Reimplemented to inform the client about the new window position. | 2064 | * Reimplemented to inform the client about the new window position. | ||
2082 | */ | 2065 | */ | ||
2083 | void AbstractClient::move(int x, int y, ForceGeometry_t force) | 2066 | void AbstractClient::move(int x, int y, ForceGeometry_t force) | ||
Show All 18 Lines | 2067 | { | |||
2102 | } | 2085 | } | ||
2103 | doMove(x, y); | 2086 | doMove(x, y); | ||
2104 | updateWindowRules(Rules::Position); | 2087 | updateWindowRules(Rules::Position); | ||
2105 | screens()->setCurrent(this); | 2088 | screens()->setCurrent(this); | ||
2106 | workspace()->updateStackingOrder(); | 2089 | workspace()->updateStackingOrder(); | ||
2107 | // client itself is not damaged | 2090 | // client itself is not damaged | ||
2108 | addRepaintDuringGeometryUpdates(); | 2091 | addRepaintDuringGeometryUpdates(); | ||
2109 | updateGeometryBeforeUpdateBlocking(); | 2092 | updateGeometryBeforeUpdateBlocking(); | ||
2110 | | ||||
2111 | // Update states of all other windows in this group | | |||
2112 | updateTabGroupStates(TabGroup::Geometry); | | |||
2113 | emit geometryChanged(); | 2093 | emit geometryChanged(); | ||
2114 | } | 2094 | } | ||
2115 | 2095 | | |||
2116 | void Client::doMove(int x, int y) | 2096 | void Client::doMove(int x, int y) | ||
2117 | { | 2097 | { | ||
2118 | m_frame.move(x, y); | 2098 | m_frame.move(x, y); | ||
2119 | sendSyntheticConfigureNotify(); | 2099 | sendSyntheticConfigureNotify(); | ||
2120 | } | 2100 | } | ||
Show All 33 Lines | 2127 | { | |||
2154 | const MaximizeMode newMode = maximizeMode(); | 2134 | const MaximizeMode newMode = maximizeMode(); | ||
2155 | if (oldMode != newMode) { | 2135 | if (oldMode != newMode) { | ||
2156 | emit clientMaximizedStateChanged(this, newMode); | 2136 | emit clientMaximizedStateChanged(this, newMode); | ||
2157 | emit clientMaximizedStateChanged(this, vertically, horizontally); | 2137 | emit clientMaximizedStateChanged(this, vertically, horizontally); | ||
2158 | } | 2138 | } | ||
2159 | 2139 | | |||
2160 | } | 2140 | } | ||
2161 | 2141 | | |||
2162 | // Update states of all other windows in this group | | |||
2163 | class TabSynchronizer | | |||
2164 | { | | |||
2165 | public: | | |||
2166 | TabSynchronizer(AbstractClient *client, TabGroup::States syncStates) : | | |||
2167 | m_client(client) , m_states(syncStates) | | |||
2168 | { | | |||
2169 | if (client->tabGroup()) | | |||
2170 | client->tabGroup()->blockStateUpdates(true); | | |||
2171 | } | | |||
2172 | ~TabSynchronizer() | | |||
2173 | { | | |||
2174 | syncNow(); | | |||
2175 | } | | |||
2176 | void syncNow() | | |||
2177 | { | | |||
2178 | if (m_client && m_client->tabGroup()) { | | |||
2179 | m_client->tabGroup()->blockStateUpdates(false); | | |||
2180 | m_client->tabGroup()->updateStates(dynamic_cast<Client*>(m_client), m_states); | | |||
2181 | } | | |||
2182 | m_client = 0; | | |||
2183 | } | | |||
2184 | private: | | |||
2185 | AbstractClient *m_client; | | |||
2186 | TabGroup::States m_states; | | |||
2187 | }; | | |||
2188 | | ||||
2189 | | ||||
2190 | static bool changeMaximizeRecursion = false; | 2142 | static bool changeMaximizeRecursion = false; | ||
2191 | void Client::changeMaximize(bool horizontal, bool vertical, bool adjust) | 2143 | void Client::changeMaximize(bool horizontal, bool vertical, bool adjust) | ||
2192 | { | 2144 | { | ||
2193 | if (changeMaximizeRecursion) | 2145 | if (changeMaximizeRecursion) | ||
2194 | return; | 2146 | return; | ||
2195 | 2147 | | |||
2196 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | 2148 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | ||
2197 | return; | 2149 | return; | ||
Show All 33 Lines | 2168 | if (m_geometryHints.hasAspect() && // fixed aspect | |||
2231 | } | 2183 | } | ||
2232 | } | 2184 | } | ||
2233 | 2185 | | |||
2234 | max_mode = rules()->checkMaximize(max_mode); | 2186 | max_mode = rules()->checkMaximize(max_mode); | ||
2235 | if (!adjust && max_mode == old_mode) | 2187 | if (!adjust && max_mode == old_mode) | ||
2236 | return; | 2188 | return; | ||
2237 | 2189 | | |||
2238 | GeometryUpdatesBlocker blocker(this); | 2190 | GeometryUpdatesBlocker blocker(this); | ||
2239 | // QT synchronizing required because we eventually change from QT to Maximized | | |||
2240 | TabSynchronizer syncer(this, TabGroup::Maximized|TabGroup::QuickTile); | | |||
2241 | 2191 | | |||
2242 | // maximing one way and unmaximizing the other way shouldn't happen, | 2192 | // maximing one way and unmaximizing the other way shouldn't happen, | ||
2243 | // so restore first and then maximize the other way | 2193 | // so restore first and then maximize the other way | ||
2244 | if ((old_mode == MaximizeVertical && max_mode == MaximizeHorizontal) | 2194 | if ((old_mode == MaximizeVertical && max_mode == MaximizeHorizontal) | ||
2245 | || (old_mode == MaximizeHorizontal && max_mode == MaximizeVertical)) { | 2195 | || (old_mode == MaximizeHorizontal && max_mode == MaximizeVertical)) { | ||
2246 | changeMaximize(false, false, false); // restore | 2196 | changeMaximize(false, false, false); // restore | ||
2247 | } | 2197 | } | ||
2248 | 2198 | | |||
▲ Show 20 Lines • Show All 183 Lines • ▼ Show 20 Line(s) | 2381 | else | |||
2432 | updateQuickTileMode(QuickTileFlag::None); | 2382 | updateQuickTileMode(QuickTileFlag::None); | ||
2433 | info->setState(NET::Max, NET::Max); | 2383 | info->setState(NET::Max, NET::Max); | ||
2434 | break; | 2384 | break; | ||
2435 | } | 2385 | } | ||
2436 | default: | 2386 | default: | ||
2437 | break; | 2387 | break; | ||
2438 | } | 2388 | } | ||
2439 | 2389 | | |||
2440 | syncer.syncNow(); // important because of window rule updates! | | |||
2441 | | ||||
2442 | updateAllowedActions(); | 2390 | updateAllowedActions(); | ||
2443 | updateWindowRules(Rules::MaximizeVert|Rules::MaximizeHoriz|Rules::Position|Rules::Size); | 2391 | updateWindowRules(Rules::MaximizeVert|Rules::MaximizeHoriz|Rules::Position|Rules::Size); | ||
2444 | emit quickTileModeChanged(); | 2392 | emit quickTileModeChanged(); | ||
2445 | } | 2393 | } | ||
2446 | 2394 | | |||
2447 | bool Client::userCanSetFullScreen() const | 2395 | bool Client::userCanSetFullScreen() const | ||
2448 | { | 2396 | { | ||
2449 | if (!isFullScreenable()) { | 2397 | if (!isFullScreenable()) { | ||
Show All 19 Lines | 2404 | { | |||
2469 | if (wasFullscreen) { | 2417 | if (wasFullscreen) { | ||
2470 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event | 2418 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event | ||
2471 | } else { | 2419 | } else { | ||
2472 | geom_fs_restore = geometry(); | 2420 | geom_fs_restore = geometry(); | ||
2473 | } | 2421 | } | ||
2474 | 2422 | | |||
2475 | if (set) { | 2423 | if (set) { | ||
2476 | m_fullscreenMode = FullScreenNormal; | 2424 | m_fullscreenMode = FullScreenNormal; | ||
2477 | untab(); | | |||
2478 | workspace()->raiseClient(this); | 2425 | workspace()->raiseClient(this); | ||
2479 | } else { | 2426 | } else { | ||
2480 | m_fullscreenMode = FullScreenNone; | 2427 | m_fullscreenMode = FullScreenNone; | ||
2481 | } | 2428 | } | ||
2482 | 2429 | | |||
2483 | StackingUpdatesBlocker blocker1(workspace()); | 2430 | StackingUpdatesBlocker blocker1(workspace()); | ||
2484 | GeometryUpdatesBlocker blocker2(this); | 2431 | GeometryUpdatesBlocker blocker2(this); | ||
2485 | 2432 | | |||
▲ Show 20 Lines • Show All 739 Lines • ▼ Show 20 Line(s) | 3170 | { | |||
3225 | if (!isResizable() && maximizeMode() != MaximizeFull) | 3172 | if (!isResizable() && maximizeMode() != MaximizeFull) | ||
3226 | return; | 3173 | return; | ||
3227 | 3174 | | |||
3228 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event | 3175 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event | ||
3229 | 3176 | | |||
3230 | GeometryUpdatesBlocker blocker(this); | 3177 | GeometryUpdatesBlocker blocker(this); | ||
3231 | 3178 | | |||
3232 | if (mode == QuickTileMode(QuickTileFlag::Maximize)) { | 3179 | if (mode == QuickTileMode(QuickTileFlag::Maximize)) { | ||
3233 | TabSynchronizer syncer(this, TabGroup::QuickTile|TabGroup::Geometry|TabGroup::Maximized); | | |||
3234 | m_quickTileMode = int(QuickTileFlag::None); | 3180 | m_quickTileMode = int(QuickTileFlag::None); | ||
3235 | if (maximizeMode() == MaximizeFull) { | 3181 | if (maximizeMode() == MaximizeFull) { | ||
3236 | setMaximize(false, false); | 3182 | setMaximize(false, false); | ||
3237 | } else { | 3183 | } else { | ||
3238 | QRect prev_geom_restore = geometryRestore(); // setMaximize() would set moveResizeGeom as geom_restore | 3184 | QRect prev_geom_restore = geometryRestore(); // setMaximize() would set moveResizeGeom as geom_restore | ||
3239 | m_quickTileMode = int(QuickTileFlag::Maximize); | 3185 | m_quickTileMode = int(QuickTileFlag::Maximize); | ||
3240 | setMaximize(true, true); | 3186 | setMaximize(true, true); | ||
3241 | QRect clientArea = workspace()->clientArea(MaximizeArea, this); | 3187 | QRect clientArea = workspace()->clientArea(MaximizeArea, this); | ||
Show All 14 Lines | |||||
3256 | if ((mode & QuickTileFlag::Vertical) == QuickTileMode(QuickTileFlag::Vertical)) | 3202 | if ((mode & QuickTileFlag::Vertical) == QuickTileMode(QuickTileFlag::Vertical)) | ||
3257 | mode &= ~QuickTileMode(QuickTileFlag::Vertical); | 3203 | mode &= ~QuickTileMode(QuickTileFlag::Vertical); | ||
3258 | 3204 | | |||
3259 | setElectricBorderMode(mode); // used by ::electricBorderMaximizeGeometry(.) | 3205 | setElectricBorderMode(mode); // used by ::electricBorderMaximizeGeometry(.) | ||
3260 | 3206 | | |||
3261 | // restore from maximized so that it is possible to tile maximized windows with one hit or by dragging | 3207 | // restore from maximized so that it is possible to tile maximized windows with one hit or by dragging | ||
3262 | if (maximizeMode() != MaximizeRestore) { | 3208 | if (maximizeMode() != MaximizeRestore) { | ||
3263 | 3209 | | |||
3264 | TabSynchronizer syncer(this, TabGroup::QuickTile|TabGroup::Geometry|TabGroup::Maximized); | | |||
3265 | | ||||
3266 | if (mode != QuickTileMode(QuickTileFlag::None)) { | 3210 | if (mode != QuickTileMode(QuickTileFlag::None)) { | ||
3267 | // decorations may turn off some borders when tiled | 3211 | // decorations may turn off some borders when tiled | ||
3268 | const ForceGeometry_t geom_mode = isDecorated() ? ForceGeometrySet : NormalGeometrySet; | 3212 | const ForceGeometry_t geom_mode = isDecorated() ? ForceGeometrySet : NormalGeometrySet; | ||
3269 | m_quickTileMode = int(QuickTileFlag::None); // Temporary, so the maximize code doesn't get all confused | 3213 | m_quickTileMode = int(QuickTileFlag::None); // Temporary, so the maximize code doesn't get all confused | ||
3270 | 3214 | | |||
3271 | setMaximize(false, false); | 3215 | setMaximize(false, false); | ||
3272 | 3216 | | |||
3273 | setGeometry(electricBorderMaximizeGeometry(keyboard ? geometry().center() : Cursor::pos(), desktop()), geom_mode); | 3217 | setGeometry(electricBorderMaximizeGeometry(keyboard ? geometry().center() : Cursor::pos(), desktop()), geom_mode); | ||
3274 | // Store the mode change | 3218 | // Store the mode change | ||
3275 | m_quickTileMode = mode; | 3219 | m_quickTileMode = mode; | ||
3276 | } else { | 3220 | } else { | ||
3277 | m_quickTileMode = mode; | 3221 | m_quickTileMode = mode; | ||
3278 | setMaximize(false, false); | 3222 | setMaximize(false, false); | ||
3279 | } | 3223 | } | ||
3280 | 3224 | | |||
3281 | emit quickTileModeChanged(); | 3225 | emit quickTileModeChanged(); | ||
3282 | 3226 | | |||
3283 | return; | 3227 | return; | ||
3284 | } | 3228 | } | ||
3285 | 3229 | | |||
3286 | if (mode != QuickTileMode(QuickTileFlag::None)) { | 3230 | if (mode != QuickTileMode(QuickTileFlag::None)) { | ||
3287 | TabSynchronizer syncer(this, TabGroup::QuickTile|TabGroup::Geometry); | | |||
3288 | | ||||
3289 | QPoint whichScreen = keyboard ? geometry().center() : Cursor::pos(); | 3231 | QPoint whichScreen = keyboard ? geometry().center() : Cursor::pos(); | ||
3290 | 3232 | | |||
3291 | // If trying to tile to the side that the window is already tiled to move the window to the next | 3233 | // If trying to tile to the side that the window is already tiled to move the window to the next | ||
3292 | // screen if it exists, otherwise toggle the mode (set QuickTileFlag::None) | 3234 | // screen if it exists, otherwise toggle the mode (set QuickTileFlag::None) | ||
3293 | if (quickTileMode() == mode) { | 3235 | if (quickTileMode() == mode) { | ||
3294 | const int numScreens = screens()->count(); | 3236 | const int numScreens = screens()->count(); | ||
3295 | const int curScreen = screen(); | 3237 | const int curScreen = screen(); | ||
3296 | int nextScreen = curScreen; | 3238 | int nextScreen = curScreen; | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 3281 | if (mode != QuickTileMode(QuickTileFlag::None)) { | |||
3345 | setGeometry(electricBorderMaximizeGeometry(whichScreen, desktop()), geom_mode); | 3287 | setGeometry(electricBorderMaximizeGeometry(whichScreen, desktop()), geom_mode); | ||
3346 | } | 3288 | } | ||
3347 | 3289 | | |||
3348 | // Store the mode change | 3290 | // Store the mode change | ||
3349 | m_quickTileMode = mode; | 3291 | m_quickTileMode = mode; | ||
3350 | } | 3292 | } | ||
3351 | 3293 | | |||
3352 | if (mode == QuickTileMode(QuickTileFlag::None)) { | 3294 | if (mode == QuickTileMode(QuickTileFlag::None)) { | ||
3353 | TabSynchronizer syncer(this, TabGroup::QuickTile|TabGroup::Geometry); | | |||
3354 | | ||||
3355 | m_quickTileMode = int(QuickTileFlag::None); | 3295 | m_quickTileMode = int(QuickTileFlag::None); | ||
3356 | // Untiling, so just restore geometry, and we're done. | 3296 | // Untiling, so just restore geometry, and we're done. | ||
3357 | if (!geometryRestore().isValid()) // invalid if we started maximized and wait for placement | 3297 | if (!geometryRestore().isValid()) // invalid if we started maximized and wait for placement | ||
3358 | setGeometryRestore(geometry()); | 3298 | setGeometryRestore(geometry()); | ||
3359 | // decorations may turn off some borders when tiled | 3299 | // decorations may turn off some borders when tiled | ||
3360 | const ForceGeometry_t geom_mode = isDecorated() ? ForceGeometrySet : NormalGeometrySet; | 3300 | const ForceGeometry_t geom_mode = isDecorated() ? ForceGeometrySet : NormalGeometrySet; | ||
3361 | setGeometry(geometryRestore(), geom_mode); | 3301 | setGeometry(geometryRestore(), geom_mode); | ||
3362 | checkWorkspacePosition(); // Just in case it's a different screen | 3302 | checkWorkspacePosition(); // Just in case it's a different screen | ||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |