Changeset View
Changeset View
Standalone View
Standalone View
geometry.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
59 | 59 | | |||
60 | //******************************************** | 60 | //******************************************** | ||
61 | // Workspace | 61 | // Workspace | ||
62 | //******************************************** | 62 | //******************************************** | ||
63 | 63 | | |||
64 | extern int screen_number; | 64 | extern int screen_number; | ||
65 | extern bool is_multihead; | 65 | extern bool is_multihead; | ||
66 | 66 | | |||
67 | /*! | 67 | /** | ||
68 | Resizes the workspace after an XRANDR screen size change | 68 | * Resizes the workspace after an XRANDR screen size change | ||
69 | */ | 69 | **/ | ||
70 | void Workspace::desktopResized() | 70 | void Workspace::desktopResized() | ||
71 | { | 71 | { | ||
72 | QRect geom = screens()->geometry(); | 72 | QRect geom = screens()->geometry(); | ||
73 | if (rootInfo()) { | 73 | if (rootInfo()) { | ||
74 | NETSize desktop_geometry; | 74 | NETSize desktop_geometry; | ||
75 | desktop_geometry.width = geom.width(); | 75 | desktop_geometry.width = geom.width(); | ||
76 | desktop_geometry.height = geom.height(); | 76 | desktop_geometry.height = geom.height(); | ||
77 | rootInfo()->setDesktopGeometry(desktop_geometry); | 77 | rootInfo()->setDesktopGeometry(desktop_geometry); | ||
Show All 15 Lines | 92 | { | |||
93 | olddisplaysize = screens()->displaySize(); | 93 | olddisplaysize = screens()->displaySize(); | ||
94 | oldscreensizes.clear(); | 94 | oldscreensizes.clear(); | ||
95 | for( int i = 0; | 95 | for( int i = 0; | ||
96 | i < screens()->count(); | 96 | i < screens()->count(); | ||
97 | ++i ) | 97 | ++i ) | ||
98 | oldscreensizes.append( screens()->geometry( i )); | 98 | oldscreensizes.append( screens()->geometry( i )); | ||
99 | } | 99 | } | ||
100 | 100 | | |||
101 | /*! | 101 | /** | ||
102 | Updates the current client areas according to the current clients. | 102 | * Updates the current client areas according to the current clients. | ||
103 | 103 | * | |||
104 | If the area changes or force is true, the new areas are propagated to the world. | 104 | * If the area changes or force is @c true, the new areas are propagated to the world. | ||
105 | 105 | * | |||
106 | The client area is the area that is available for clients (that | 106 | * The client area is the area that is available for clients (that | ||
107 | which is not taken by windows like panels, the top-of-screen menu | 107 | * which is not taken by windows like panels, the top-of-screen menu | ||
108 | etc). | 108 | * etc). | ||
109 | 109 | * | |||
110 | \sa clientArea() | 110 | * @see clientArea() | ||
111 | */ | 111 | **/ | ||
112 | | ||||
113 | void Workspace::updateClientArea(bool force) | 112 | void Workspace::updateClientArea(bool force) | ||
114 | { | 113 | { | ||
115 | const Screens *s = Screens::self(); | 114 | const Screens *s = Screens::self(); | ||
116 | int nscreens = s->count(); | 115 | int nscreens = s->count(); | ||
117 | const int numberOfDesktops = VirtualDesktopManager::self()->count(); | 116 | const int numberOfDesktops = VirtualDesktopManager::self()->count(); | ||
118 | QVector< QRect > new_wareas(numberOfDesktops + 1); | 117 | QVector< QRect > new_wareas(numberOfDesktops + 1); | ||
119 | QVector< StrutRects > new_rmoveareas(numberOfDesktops + 1); | 118 | QVector< StrutRects > new_rmoveareas(numberOfDesktops + 1); | ||
120 | QVector< QVector< QRect > > new_sareas(numberOfDesktops + 1); | 119 | QVector< QVector< QRect > > new_sareas(numberOfDesktops + 1); | ||
▲ Show 20 Lines • Show All 215 Lines • ▼ Show 20 Line(s) | |||||
336 | } | 335 | } | ||
337 | 336 | | |||
338 | void Workspace::updateClientArea() | 337 | void Workspace::updateClientArea() | ||
339 | { | 338 | { | ||
340 | updateClientArea(false); | 339 | updateClientArea(false); | ||
341 | } | 340 | } | ||
342 | 341 | | |||
343 | 342 | | |||
344 | /*! | 343 | /** | ||
345 | returns the area available for clients. This is the desktop | 344 | * Returns the area available for clients. This is the desktop | ||
346 | geometry minus windows on the dock. Placement algorithms should | 345 | * geometry minus windows on the dock. Placement algorithms should | ||
347 | refer to this rather than geometry(). | 346 | * refer to this rather than Screens::geometry. | ||
348 | 347 | **/ | |||
349 | \sa geometry() | | |||
350 | */ | | |||
351 | | ||||
352 | QRect Workspace::clientArea(clientAreaOption opt, int screen, int desktop) const | 348 | QRect Workspace::clientArea(clientAreaOption opt, int screen, int desktop) const | ||
353 | { | 349 | { | ||
354 | if (desktop == NETWinInfo::OnAllDesktops || desktop == 0) | 350 | if (desktop == NETWinInfo::OnAllDesktops || desktop == 0) | ||
355 | desktop = VirtualDesktopManager::self()->current(); | 351 | desktop = VirtualDesktopManager::self()->current(); | ||
356 | if (screen == -1) | 352 | if (screen == -1) | ||
357 | screen = screens()->current(); | 353 | screen = screens()->current(); | ||
358 | const QSize displaySize = screens()->displaySize(); | 354 | const QSize displaySize = screens()->displaySize(); | ||
359 | 355 | | |||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | 443 | { | |||
448 | return olddisplaysize.width(); | 444 | return olddisplaysize.width(); | ||
449 | } | 445 | } | ||
450 | 446 | | |||
451 | int Workspace::oldDisplayHeight() const | 447 | int Workspace::oldDisplayHeight() const | ||
452 | { | 448 | { | ||
453 | return olddisplaysize.height(); | 449 | return olddisplaysize.height(); | ||
454 | } | 450 | } | ||
455 | 451 | | |||
456 | /*! | 452 | /** | ||
457 | Client \a c is moved around to position \a pos. This gives the | 453 | * Client \a c is moved around to position \a pos. This gives the | ||
458 | workspace the opportunity to interveniate and to implement | 454 | * workspace the opportunity to interveniate and to implement | ||
459 | snap-to-windows functionality. | 455 | * snap-to-windows functionality. | ||
460 | 456 | * | |||
461 | The parameter \a snapAdjust is a multiplier used to calculate the | 457 | * The parameter \a snapAdjust is a multiplier used to calculate the | ||
462 | effective snap zones. When 1.0, it means that the snap zones will be | 458 | * effective snap zones. When 1.0, it means that the snap zones will be | ||
463 | used without change. | 459 | * used without change. | ||
464 | */ | 460 | **/ | ||
465 | QPoint Workspace::adjustClientPosition(AbstractClient* c, QPoint pos, bool unrestricted, double snapAdjust) | 461 | QPoint Workspace::adjustClientPosition(AbstractClient* c, QPoint pos, bool unrestricted, double snapAdjust) | ||
466 | { | 462 | { | ||
467 | QSize borderSnapZone(options->borderSnapZone(), options->borderSnapZone()); | 463 | QSize borderSnapZone(options->borderSnapZone(), options->borderSnapZone()); | ||
468 | QRect maxRect; | 464 | QRect maxRect; | ||
469 | int guideMaximized = MaximizeRestore; | 465 | int guideMaximized = MaximizeRestore; | ||
470 | if (c->maximizeMode() != MaximizeRestore) { | 466 | if (c->maximizeMode() != MaximizeRestore) { | ||
471 | maxRect = clientArea(MaximizeArea, pos + c->rect().center(), c->desktop()); | 467 | maxRect = clientArea(MaximizeArea, pos + c->rect().center(), c->desktop()); | ||
472 | QRect geo = c->geometry(); | 468 | QRect geo = c->geometry(); | ||
▲ Show 20 Lines • Show All 407 Lines • ▼ Show 20 Line(s) | 818 | } | |||
880 | // // 2) Snap to the horizontal and vertical center lines of the screen | 876 | // // 2) Snap to the horizontal and vertical center lines of the screen | ||
881 | // } | 877 | // } | ||
882 | 878 | | |||
883 | moveResizeGeom = QRect(QPoint(newcx, newcy), QPoint(newrx, newry)); | 879 | moveResizeGeom = QRect(QPoint(newcx, newcy), QPoint(newrx, newry)); | ||
884 | } | 880 | } | ||
885 | return moveResizeGeom; | 881 | return moveResizeGeom; | ||
886 | } | 882 | } | ||
887 | 883 | | |||
888 | /*! | 884 | /** | ||
889 | Marks the client as being moved around by the user. | 885 | * Marks the client as being moved around by the user. | ||
890 | */ | 886 | **/ | ||
891 | void Workspace::setClientIsMoving(AbstractClient *c) | 887 | void Workspace::setClientIsMoving(AbstractClient *c) | ||
892 | { | 888 | { | ||
893 | Q_ASSERT(!c || !movingClient); // Catch attempts to move a second | 889 | Q_ASSERT(!c || !movingClient); // Catch attempts to move a second | ||
894 | // window while still moving the first one. | 890 | // window while still moving the first one. | ||
895 | movingClient = c; | 891 | movingClient = c; | ||
896 | if (movingClient) | 892 | if (movingClient) | ||
897 | ++block_focus; | 893 | ++block_focus; | ||
898 | else | 894 | else | ||
Show All 16 Lines | 906 | if (frame.left != 0 || frame.top != 0) { | |||
915 | xcb_configure_window(connection(), w, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values); | 911 | xcb_configure_window(connection(), w, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values); | ||
916 | } | 912 | } | ||
917 | } | 913 | } | ||
918 | 914 | | |||
919 | //******************************************** | 915 | //******************************************** | ||
920 | // Client | 916 | // Client | ||
921 | //******************************************** | 917 | //******************************************** | ||
922 | 918 | | |||
923 | /*! | 919 | /** | ||
924 | Returns \a area with the client's strut taken into account. | 920 | * Returns \a area with the client's strut taken into account. | ||
925 | 921 | * | |||
926 | Used from Workspace in updateClientArea. | 922 | * Used from Workspace in updateClientArea. | ||
927 | */ | 923 | **/ | ||
928 | // TODO move to Workspace? | 924 | // TODO move to Workspace? | ||
929 | 925 | | |||
930 | QRect Client::adjustedClientArea(const QRect &desktopArea, const QRect& area) const | 926 | QRect Client::adjustedClientArea(const QRect &desktopArea, const QRect& area) const | ||
931 | { | 927 | { | ||
932 | QRect r = area; | 928 | QRect r = area; | ||
933 | NETExtendedStrut str = strut(); | 929 | NETExtendedStrut str = strut(); | ||
934 | QRect stareaL = QRect( | 930 | QRect stareaL = QRect( | ||
935 | 0, | 931 | 0, | ||
▲ Show 20 Lines • Show All 395 Lines • ▼ Show 20 Line(s) | 1322 | { | |||
1331 | } | 1327 | } | ||
1332 | if (geom->top() > screenArea.bottom()) { | 1328 | if (geom->top() > screenArea.bottom()) { | ||
1333 | geom->moveTop(screenArea.bottom() - screenArea.height()/4); | 1329 | geom->moveTop(screenArea.bottom() - screenArea.height()/4); | ||
1334 | } else if (geom->bottom() < screenArea.top()) { | 1330 | } else if (geom->bottom() < screenArea.top()) { | ||
1335 | geom->moveBottom(screenArea.top() + screenArea.width()/4); | 1331 | geom->moveBottom(screenArea.top() + screenArea.width()/4); | ||
1336 | } | 1332 | } | ||
1337 | } | 1333 | } | ||
1338 | 1334 | | |||
1339 | /*! | | |||
1340 | Adjust the frame size \a frame according to he window's size hints. | | |||
1341 | */ | | |||
1342 | QSize AbstractClient::adjustedSize(const QSize& frame, Sizemode mode) const | 1335 | QSize AbstractClient::adjustedSize(const QSize& frame, Sizemode mode) const | ||
1343 | { | 1336 | { | ||
1344 | // first, get the window size for the given frame size s | 1337 | // first, get the window size for the given frame size s | ||
1345 | QSize wsize(frame.width() - (borderLeft() + borderRight()), | 1338 | QSize wsize(frame.width() - (borderLeft() + borderRight()), | ||
1346 | frame.height() - (borderTop() + borderBottom())); | 1339 | frame.height() - (borderTop() + borderBottom())); | ||
1347 | if (wsize.isEmpty()) | 1340 | if (wsize.isEmpty()) | ||
1348 | wsize = QSize(qMax(wsize.width(), 1), qMax(wsize.height(), 1)); | 1341 | wsize = QSize(qMax(wsize.width(), 1), qMax(wsize.height(), 1)); | ||
1349 | 1342 | | |||
1350 | return sizeForClientSize(wsize, mode, false); | 1343 | return sizeForClientSize(wsize, mode, false); | ||
1351 | } | 1344 | } | ||
1352 | 1345 | | |||
1353 | // this helper returns proper size even if the window is shaded | 1346 | // this helper returns proper size even if the window is shaded | ||
1354 | // see also the comment in Client::setGeometry() | 1347 | // see also the comment in Client::setGeometry() | ||
1355 | QSize AbstractClient::adjustedSize() const | 1348 | QSize AbstractClient::adjustedSize() const | ||
1356 | { | 1349 | { | ||
1357 | return sizeForClientSize(clientSize()); | 1350 | return sizeForClientSize(clientSize()); | ||
1358 | } | 1351 | } | ||
1359 | 1352 | | |||
1360 | /*! | 1353 | /** | ||
1361 | Calculate the appropriate frame size for the given client size \a | 1354 | * Calculate the appropriate frame size for the given client size \a | ||
1362 | wsize. | 1355 | * wsize. | ||
1363 | 1356 | * | |||
1364 | \a wsize is adapted according to the window's size hints (minimum, | 1357 | * \a wsize is adapted according to the window's size hints (minimum, | ||
1365 | maximum and incremental size changes). | 1358 | * maximum and incremental size changes). | ||
1366 | 1359 | **/ | |||
1367 | */ | | |||
1368 | QSize Client::sizeForClientSize(const QSize& wsize, Sizemode mode, bool noframe) const | 1360 | QSize Client::sizeForClientSize(const QSize& wsize, Sizemode mode, bool noframe) const | ||
1369 | { | 1361 | { | ||
1370 | int w = wsize.width(); | 1362 | int w = wsize.width(); | ||
1371 | int h = wsize.height(); | 1363 | int h = wsize.height(); | ||
1372 | if (w < 1 || h < 1) { | 1364 | if (w < 1 || h < 1) { | ||
1373 | qCWarning(KWIN_CORE) << "sizeForClientSize() with empty size!" ; | 1365 | qCWarning(KWIN_CORE) << "sizeForClientSize() with empty size!" ; | ||
1374 | } | 1366 | } | ||
1375 | if (w < 1) w = 1; | 1367 | if (w < 1) w = 1; | ||
▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Line(s) | 1512 | #undef ASPECT_CHECK_GROW_H | |||
1529 | 1521 | | |||
1530 | if (!noframe) { | 1522 | if (!noframe) { | ||
1531 | w += borderLeft() + borderRight(); | 1523 | w += borderLeft() + borderRight(); | ||
1532 | h += borderTop() + borderBottom(); | 1524 | h += borderTop() + borderBottom(); | ||
1533 | } | 1525 | } | ||
1534 | return rules()->checkSize(QSize(w, h)); | 1526 | return rules()->checkSize(QSize(w, h)); | ||
1535 | } | 1527 | } | ||
1536 | 1528 | | |||
1537 | /*! | 1529 | /** | ||
1538 | Gets the client's normal WM hints and reconfigures itself respectively. | 1530 | * Gets the client's normal WM hints and reconfigures itself respectively. | ||
1539 | */ | 1531 | **/ | ||
1540 | void Client::getWmNormalHints() | 1532 | void Client::getWmNormalHints() | ||
1541 | { | 1533 | { | ||
1542 | const bool hadFixedAspect = m_geometryHints.hasAspect(); | 1534 | const bool hadFixedAspect = m_geometryHints.hasAspect(); | ||
1543 | // roundtrip to X server | 1535 | // roundtrip to X server | ||
1544 | m_geometryHints.fetch(); | 1536 | m_geometryHints.fetch(); | ||
1545 | m_geometryHints.read(); | 1537 | m_geometryHints.read(); | ||
1546 | 1538 | | |||
1547 | if (!hadFixedAspect && m_geometryHints.hasAspect()) { | 1539 | if (!hadFixedAspect && m_geometryHints.hasAspect()) { | ||
Show All 35 Lines | 1574 | { | |||
1583 | return rules()->checkMaxSize(m_geometryHints.maxSize()); | 1575 | return rules()->checkMaxSize(m_geometryHints.maxSize()); | ||
1584 | } | 1576 | } | ||
1585 | 1577 | | |||
1586 | QSize Client::basicUnit() const | 1578 | QSize Client::basicUnit() const | ||
1587 | { | 1579 | { | ||
1588 | return m_geometryHints.resizeIncrements(); | 1580 | return m_geometryHints.resizeIncrements(); | ||
1589 | } | 1581 | } | ||
1590 | 1582 | | |||
1591 | /*! | 1583 | /** | ||
1592 | Auxiliary function to inform the client about the current window | 1584 | * Auxiliary function to inform the client about the current window | ||
1593 | configuration. | 1585 | * configuration. | ||
1594 | 1586 | **/ | |||
1595 | */ | | |||
1596 | void Client::sendSyntheticConfigureNotify() | 1587 | void Client::sendSyntheticConfigureNotify() | ||
1597 | { | 1588 | { | ||
1598 | xcb_configure_notify_event_t c; | 1589 | xcb_configure_notify_event_t c; | ||
1599 | memset(&c, 0, sizeof(c)); | 1590 | memset(&c, 0, sizeof(c)); | ||
1600 | c.response_type = XCB_CONFIGURE_NOTIFY; | 1591 | c.response_type = XCB_CONFIGURE_NOTIFY; | ||
1601 | c.event = window(); | 1592 | c.event = window(); | ||
1602 | c.window = window(); | 1593 | c.window = window(); | ||
1603 | c.x = x() + clientPos().x(); | 1594 | c.x = x() + clientPos().x(); | ||
▲ Show 20 Lines • Show All 269 Lines • ▼ Show 20 Line(s) | 1863 | if (flags & (1 << 9)) | |||
1873 | value_mask |= CWY; | 1864 | value_mask |= CWY; | ||
1874 | if (flags & (1 << 10)) | 1865 | if (flags & (1 << 10)) | ||
1875 | value_mask |= CWWidth; | 1866 | value_mask |= CWWidth; | ||
1876 | if (flags & (1 << 11)) | 1867 | if (flags & (1 << 11)) | ||
1877 | value_mask |= CWHeight; | 1868 | value_mask |= CWHeight; | ||
1878 | configureRequest(value_mask, x, y, width, height, gravity, true); | 1869 | configureRequest(value_mask, x, y, width, height, gravity, true); | ||
1879 | } | 1870 | } | ||
1880 | 1871 | | |||
1881 | /*! | | |||
1882 | Returns whether the window is moveable or has a fixed | | |||
1883 | position. | | |||
1884 | */ | | |||
1885 | bool Client::isMovable() const | 1872 | bool Client::isMovable() const | ||
1886 | { | 1873 | { | ||
1887 | if (!hasNETSupport() && !m_motif.move()) { | 1874 | if (!hasNETSupport() && !m_motif.move()) { | ||
1888 | return false; | 1875 | return false; | ||
1889 | } | 1876 | } | ||
1890 | if (isFullScreen()) | 1877 | if (isFullScreen()) | ||
1891 | return false; | 1878 | return false; | ||
1892 | if (isSpecialWindow() && !isSplash() && !isToolbar()) // allow moving of splashscreens :) | 1879 | if (isSpecialWindow() && !isSplash() && !isToolbar()) // allow moving of splashscreens :) | ||
1893 | return false; | 1880 | return false; | ||
1894 | if (rules()->checkPosition(invalidPoint) != invalidPoint) // forced position | 1881 | if (rules()->checkPosition(invalidPoint) != invalidPoint) // forced position | ||
1895 | return false; | 1882 | return false; | ||
1896 | return true; | 1883 | return true; | ||
1897 | } | 1884 | } | ||
1898 | 1885 | | |||
1899 | /*! | | |||
1900 | Returns whether the window is moveable across Xinerama screens | | |||
1901 | */ | | |||
1902 | bool Client::isMovableAcrossScreens() const | 1886 | bool Client::isMovableAcrossScreens() const | ||
1903 | { | 1887 | { | ||
1904 | if (!hasNETSupport() && !m_motif.move()) { | 1888 | if (!hasNETSupport() && !m_motif.move()) { | ||
1905 | return false; | 1889 | return false; | ||
1906 | } | 1890 | } | ||
1907 | if (isSpecialWindow() && !isSplash() && !isToolbar()) // allow moving of splashscreens :) | 1891 | if (isSpecialWindow() && !isSplash() && !isToolbar()) // allow moving of splashscreens :) | ||
1908 | return false; | 1892 | return false; | ||
1909 | if (rules()->checkPosition(invalidPoint) != invalidPoint) // forced position | 1893 | if (rules()->checkPosition(invalidPoint) != invalidPoint) // forced position | ||
1910 | return false; | 1894 | return false; | ||
1911 | return true; | 1895 | return true; | ||
1912 | } | 1896 | } | ||
1913 | 1897 | | |||
1914 | /*! | | |||
1915 | Returns whether the window is resizable or has a fixed size. | | |||
1916 | */ | | |||
1917 | bool Client::isResizable() const | 1898 | bool Client::isResizable() const | ||
1918 | { | 1899 | { | ||
1919 | if (!hasNETSupport() && !m_motif.resize()) { | 1900 | if (!hasNETSupport() && !m_motif.resize()) { | ||
1920 | return false; | 1901 | return false; | ||
1921 | } | 1902 | } | ||
1922 | if (isFullScreen()) | 1903 | if (isFullScreen()) | ||
1923 | return false; | 1904 | return false; | ||
1924 | if (isSpecialWindow() || isSplash() || isToolbar()) | 1905 | if (isSpecialWindow() || isSplash() || isToolbar()) | ||
1925 | return false; | 1906 | return false; | ||
1926 | if (rules()->checkSize(QSize()).isValid()) // forced size | 1907 | if (rules()->checkSize(QSize()).isValid()) // forced size | ||
1927 | return false; | 1908 | return false; | ||
1928 | const Position mode = moveResizePointerMode(); | 1909 | const Position mode = moveResizePointerMode(); | ||
1929 | if ((mode == PositionTop || mode == PositionTopLeft || mode == PositionTopRight || | 1910 | if ((mode == PositionTop || mode == PositionTopLeft || mode == PositionTopRight || | ||
1930 | mode == PositionLeft || mode == PositionBottomLeft) && rules()->checkPosition(invalidPoint) != invalidPoint) | 1911 | mode == PositionLeft || mode == PositionBottomLeft) && rules()->checkPosition(invalidPoint) != invalidPoint) | ||
1931 | return false; | 1912 | return false; | ||
1932 | 1913 | | |||
1933 | QSize min = tabGroup() ? tabGroup()->minSize() : minSize(); | 1914 | QSize min = tabGroup() ? tabGroup()->minSize() : minSize(); | ||
1934 | QSize max = tabGroup() ? tabGroup()->maxSize() : maxSize(); | 1915 | QSize max = tabGroup() ? tabGroup()->maxSize() : maxSize(); | ||
1935 | return min.width() < max.width() || min.height() < max.height(); | 1916 | return min.width() < max.width() || min.height() < max.height(); | ||
1936 | } | 1917 | } | ||
1937 | 1918 | | |||
1938 | /* | | |||
1939 | Returns whether the window is maximizable or not | | |||
1940 | */ | | |||
1941 | bool Client::isMaximizable() const | 1919 | bool Client::isMaximizable() const | ||
1942 | { | 1920 | { | ||
1943 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | 1921 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | ||
1944 | return false; | 1922 | return false; | ||
1945 | if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore && rules()->checkMaximize(MaximizeFull) != MaximizeRestore) | 1923 | if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore && rules()->checkMaximize(MaximizeFull) != MaximizeRestore) | ||
1946 | return true; | 1924 | return true; | ||
1947 | return false; | 1925 | return false; | ||
1948 | } | 1926 | } | ||
1949 | 1927 | | |||
1950 | 1928 | | |||
1951 | /*! | 1929 | /** | ||
1952 | Reimplemented to inform the client about the new window position. | 1930 | * Reimplemented to inform the client about the new window position. | ||
1953 | */ | 1931 | **/ | ||
1954 | void Client::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) | 1932 | void Client::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) | ||
1955 | { | 1933 | { | ||
1956 | // this code is also duplicated in Client::plainResize() | 1934 | // this code is also duplicated in Client::plainResize() | ||
1957 | // Ok, the shading geometry stuff. Generally, code doesn't care about shaded geometry, | 1935 | // Ok, the shading geometry stuff. Generally, code doesn't care about shaded geometry, | ||
1958 | // simply because there are too many places dealing with geometry. Those places | 1936 | // simply because there are too many places dealing with geometry. Those places | ||
1959 | // ignore shaded state and use normal geometry, which they usually should get | 1937 | // ignore shaded state and use normal geometry, which they usually should get | ||
1960 | // from adjustedSize(). Such geometry comes here, and if the window is shaded, | 1938 | // from adjustedSize(). Such geometry comes here, and if the window is shaded, | ||
1961 | // the geometry is used only for client_size, since that one is not used when | 1939 | // the geometry is used only for client_size, since that one is not used when | ||
▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Line(s) | 2066 | // resizeDecoration( s ); | |||
2105 | 2083 | | |||
2106 | // Update states of all other windows in this group | 2084 | // Update states of all other windows in this group | ||
2107 | if (tabGroup()) | 2085 | if (tabGroup()) | ||
2108 | tabGroup()->updateStates(this, TabGroup::Geometry); | 2086 | tabGroup()->updateStates(this, TabGroup::Geometry); | ||
2109 | // TODO: this signal is emitted too often | 2087 | // TODO: this signal is emitted too often | ||
2110 | emit geometryChanged(); | 2088 | emit geometryChanged(); | ||
2111 | } | 2089 | } | ||
2112 | 2090 | | |||
2113 | /*! | 2091 | /** | ||
2114 | Reimplemented to inform the client about the new window position. | 2092 | * Reimplemented to inform the client about the new window position. | ||
2115 | */ | 2093 | **/ | ||
2116 | void AbstractClient::move(int x, int y, ForceGeometry_t force) | 2094 | void AbstractClient::move(int x, int y, ForceGeometry_t force) | ||
2117 | { | 2095 | { | ||
2118 | // resuming geometry updates is handled only in setGeometry() | 2096 | // resuming geometry updates is handled only in setGeometry() | ||
2119 | assert(pendingGeometryUpdate() == PendingGeometryNone || areGeometryUpdatesBlocked()); | 2097 | assert(pendingGeometryUpdate() == PendingGeometryNone || areGeometryUpdatesBlocked()); | ||
2120 | QPoint p(x, y); | 2098 | QPoint p(x, y); | ||
2121 | if (!areGeometryUpdatesBlocked() && p != rules()->checkPosition(p)) { | 2099 | if (!areGeometryUpdatesBlocked() && p != rules()->checkPosition(p)) { | ||
2122 | qCDebug(KWIN_CORE) << "forced position fail:" << p << ":" << rules()->checkPosition(p); | 2100 | qCDebug(KWIN_CORE) << "forced position fail:" << p << ":" << rules()->checkPosition(p); | ||
2123 | } | 2101 | } | ||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||
2174 | void AbstractClient::maximize(MaximizeMode m) | 2152 | void AbstractClient::maximize(MaximizeMode m) | ||
2175 | { | 2153 | { | ||
2176 | if (m == maximizeMode()) { | 2154 | if (m == maximizeMode()) { | ||
2177 | return; | 2155 | return; | ||
2178 | } | 2156 | } | ||
2179 | setMaximize(m & MaximizeVertical, m & MaximizeHorizontal); | 2157 | setMaximize(m & MaximizeVertical, m & MaximizeHorizontal); | ||
2180 | } | 2158 | } | ||
2181 | 2159 | | |||
2182 | /*! | | |||
2183 | Sets the maximization according to \a vertically and \a horizontally | | |||
2184 | */ | | |||
2185 | void AbstractClient::setMaximize(bool vertically, bool horizontally) | 2160 | void AbstractClient::setMaximize(bool vertically, bool horizontally) | ||
2186 | { | 2161 | { | ||
2187 | // changeMaximize() flips the state, so change from set->flip | 2162 | // changeMaximize() flips the state, so change from set->flip | ||
2188 | const MaximizeMode oldMode = maximizeMode(); | 2163 | const MaximizeMode oldMode = maximizeMode(); | ||
2189 | changeMaximize( | 2164 | changeMaximize( | ||
2190 | oldMode & MaximizeVertical ? !vertically : vertically, | 2165 | oldMode & MaximizeVertical ? !vertically : vertically, | ||
2191 | oldMode & MaximizeHorizontal ? !horizontally : horizontally, | 2166 | oldMode & MaximizeHorizontal ? !horizontally : horizontally, | ||
2192 | false); | 2167 | false); | ||
▲ Show 20 Lines • Show All 389 Lines • ▼ Show 20 Line(s) | 2552 | if (topology.top >= nscreens || | |||
2582 | return; | 2557 | return; | ||
2583 | } | 2558 | } | ||
2584 | 2559 | | |||
2585 | info->setFullscreenMonitors(topology); | 2560 | info->setFullscreenMonitors(topology); | ||
2586 | if (isFullScreen()) | 2561 | if (isFullScreen()) | ||
2587 | setGeometry(fullscreenMonitorsArea(topology)); | 2562 | setGeometry(fullscreenMonitorsArea(topology)); | ||
2588 | } | 2563 | } | ||
2589 | 2564 | | |||
2590 | 2565 | /** | |||
2591 | /*! | 2566 | * Calculates the bounding rectangle defined by the 4 monitor indices indicating the | ||
2592 | Calculates the bounding rectangle defined by the 4 monitor indices indicating the | 2567 | * top, bottom, left, and right edges of the window when the fullscreen state is enabled. | ||
2593 | top, bottom, left, and right edges of the window when the fullscreen state is enabled. | 2568 | **/ | ||
2594 | */ | | |||
2595 | QRect Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) const | 2569 | QRect Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) const | ||
2596 | { | 2570 | { | ||
2597 | QRect top, bottom, left, right, total; | 2571 | QRect top, bottom, left, right, total; | ||
2598 | 2572 | | |||
2599 | top = screens()->geometry(requestedTopology.top); | 2573 | top = screens()->geometry(requestedTopology.top); | ||
2600 | bottom = screens()->geometry(requestedTopology.bottom); | 2574 | bottom = screens()->geometry(requestedTopology.bottom); | ||
2601 | left = screens()->geometry(requestedTopology.left); | 2575 | left = screens()->geometry(requestedTopology.left); | ||
2602 | right = screens()->geometry(requestedTopology.right); | 2576 | right = screens()->geometry(requestedTopology.right); | ||
▲ Show 20 Lines • Show All 937 Lines • Show Last 20 Lines |