Changeset View
Changeset View
Standalone View
Standalone View
geometry.cpp
Show All 21 Lines | |||||
22 | 22 | | |||
23 | /* | 23 | /* | ||
24 | 24 | | |||
25 | This file contains things relevant to geometry, i.e. workspace size, | 25 | This file contains things relevant to geometry, i.e. workspace size, | ||
26 | window positions and window sizes. | 26 | window positions and window sizes. | ||
27 | 27 | | |||
28 | */ | 28 | */ | ||
29 | 29 | | |||
30 | #include "client.h" | 30 | #include "x11client.h" | ||
31 | #include "composite.h" | 31 | #include "composite.h" | ||
32 | #include "cursor.h" | 32 | #include "cursor.h" | ||
33 | #include "netinfo.h" | 33 | #include "netinfo.h" | ||
34 | #include "workspace.h" | 34 | #include "workspace.h" | ||
35 | 35 | | |||
36 | #include "placement.h" | 36 | #include "placement.h" | ||
37 | #include "geometrytip.h" | 37 | #include "geometrytip.h" | ||
38 | #include "rules.h" | 38 | #include "rules.h" | ||
▲ Show 20 Lines • Show All 870 Lines • ▼ Show 20 Line(s) | |||||
909 | 909 | | |||
910 | /** | 910 | /** | ||
911 | * Returns \a area with the client's strut taken into account. | 911 | * Returns \a area with the client's strut taken into account. | ||
912 | * | 912 | * | ||
913 | * Used from Workspace in updateClientArea. | 913 | * Used from Workspace in updateClientArea. | ||
914 | */ | 914 | */ | ||
915 | // TODO move to Workspace? | 915 | // TODO move to Workspace? | ||
916 | 916 | | |||
917 | QRect Client::adjustedClientArea(const QRect &desktopArea, const QRect& area) const | 917 | QRect X11Client::adjustedClientArea(const QRect &desktopArea, const QRect& area) const | ||
918 | { | 918 | { | ||
919 | QRect r = area; | 919 | QRect r = area; | ||
920 | NETExtendedStrut str = strut(); | 920 | NETExtendedStrut str = strut(); | ||
921 | QRect stareaL = QRect( | 921 | QRect stareaL = QRect( | ||
922 | 0, | 922 | 0, | ||
923 | str . left_start, | 923 | str . left_start, | ||
924 | str . left_width, | 924 | str . left_width, | ||
925 | str . left_end - str . left_start + 1); | 925 | str . left_end - str . left_start + 1); | ||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 973 | // qDebug() << "Moving top of: " << r << " to " << stareaT.bottom() + 1; | |||
976 | if (stareaB . intersects(area)) { | 976 | if (stareaB . intersects(area)) { | ||
977 | // qDebug() << "Moving bottom of: " << r << " to " << stareaB.top() - 1; | 977 | // qDebug() << "Moving bottom of: " << r << " to " << stareaB.top() - 1; | ||
978 | r . setBottom(stareaB . top() - 1); | 978 | r . setBottom(stareaB . top() - 1); | ||
979 | } | 979 | } | ||
980 | 980 | | |||
981 | return r; | 981 | return r; | ||
982 | } | 982 | } | ||
983 | 983 | | |||
984 | NETExtendedStrut Client::strut() const | 984 | NETExtendedStrut X11Client::strut() const | ||
985 | { | 985 | { | ||
986 | NETExtendedStrut ext = info->extendedStrut(); | 986 | NETExtendedStrut ext = info->extendedStrut(); | ||
987 | NETStrut str = info->strut(); | 987 | NETStrut str = info->strut(); | ||
988 | const QSize displaySize = screens()->displaySize(); | 988 | const QSize displaySize = screens()->displaySize(); | ||
989 | if (ext.left_width == 0 && ext.right_width == 0 && ext.top_width == 0 && ext.bottom_width == 0 | 989 | if (ext.left_width == 0 && ext.right_width == 0 && ext.top_width == 0 && ext.bottom_width == 0 | ||
990 | && (str.left != 0 || str.right != 0 || str.top != 0 || str.bottom != 0)) { | 990 | && (str.left != 0 || str.right != 0 || str.top != 0 || str.bottom != 0)) { | ||
991 | // build extended from simple | 991 | // build extended from simple | ||
992 | if (str.left != 0) { | 992 | if (str.left != 0) { | ||
Show All 15 Lines | 1007 | if (str.bottom != 0) { | |||
1008 | ext.bottom_width = str.bottom; | 1008 | ext.bottom_width = str.bottom; | ||
1009 | ext.bottom_start = 0; | 1009 | ext.bottom_start = 0; | ||
1010 | ext.bottom_end = displaySize.width(); | 1010 | ext.bottom_end = displaySize.width(); | ||
1011 | } | 1011 | } | ||
1012 | } | 1012 | } | ||
1013 | return ext; | 1013 | return ext; | ||
1014 | } | 1014 | } | ||
1015 | 1015 | | |||
1016 | StrutRect Client::strutRect(StrutArea area) const | 1016 | StrutRect X11Client::strutRect(StrutArea area) const | ||
1017 | { | 1017 | { | ||
1018 | Q_ASSERT(area != StrutAreaAll); // Not valid | 1018 | Q_ASSERT(area != StrutAreaAll); // Not valid | ||
1019 | const QSize displaySize = screens()->displaySize(); | 1019 | const QSize displaySize = screens()->displaySize(); | ||
1020 | NETExtendedStrut strutArea = strut(); | 1020 | NETExtendedStrut strutArea = strut(); | ||
1021 | switch(area) { | 1021 | switch(area) { | ||
1022 | case StrutAreaTop: | 1022 | case StrutAreaTop: | ||
1023 | if (strutArea.top_width != 0) | 1023 | if (strutArea.top_width != 0) | ||
1024 | return StrutRect(QRect( | 1024 | return StrutRect(QRect( | ||
Show All 23 Lines | 1045 | return StrutRect(QRect( | |||
1048 | ), StrutAreaLeft); | 1048 | ), StrutAreaLeft); | ||
1049 | break; | 1049 | break; | ||
1050 | default: | 1050 | default: | ||
1051 | abort(); // Not valid | 1051 | abort(); // Not valid | ||
1052 | } | 1052 | } | ||
1053 | return StrutRect(); // Null rect | 1053 | return StrutRect(); // Null rect | ||
1054 | } | 1054 | } | ||
1055 | 1055 | | |||
1056 | StrutRects Client::strutRects() const | 1056 | StrutRects X11Client::strutRects() const | ||
1057 | { | 1057 | { | ||
1058 | StrutRects region; | 1058 | StrutRects region; | ||
1059 | region += strutRect(StrutAreaTop); | 1059 | region += strutRect(StrutAreaTop); | ||
1060 | region += strutRect(StrutAreaRight); | 1060 | region += strutRect(StrutAreaRight); | ||
1061 | region += strutRect(StrutAreaBottom); | 1061 | region += strutRect(StrutAreaBottom); | ||
1062 | region += strutRect(StrutAreaLeft); | 1062 | region += strutRect(StrutAreaLeft); | ||
1063 | return region; | 1063 | return region; | ||
1064 | } | 1064 | } | ||
1065 | 1065 | | |||
1066 | bool Client::hasStrut() const | 1066 | bool X11Client::hasStrut() const | ||
1067 | { | 1067 | { | ||
1068 | NETExtendedStrut ext = strut(); | 1068 | NETExtendedStrut ext = strut(); | ||
1069 | if (ext.left_width == 0 && ext.right_width == 0 && ext.top_width == 0 && ext.bottom_width == 0) | 1069 | if (ext.left_width == 0 && ext.right_width == 0 && ext.top_width == 0 && ext.bottom_width == 0) | ||
1070 | return false; | 1070 | return false; | ||
1071 | return true; | 1071 | return true; | ||
1072 | } | 1072 | } | ||
1073 | 1073 | | |||
1074 | bool Client::hasOffscreenXineramaStrut() const | 1074 | bool X11Client::hasOffscreenXineramaStrut() const | ||
1075 | { | 1075 | { | ||
1076 | // Get strut as a QRegion | 1076 | // Get strut as a QRegion | ||
1077 | QRegion region; | 1077 | QRegion region; | ||
1078 | region += strutRect(StrutAreaTop); | 1078 | region += strutRect(StrutAreaTop); | ||
1079 | region += strutRect(StrutAreaRight); | 1079 | region += strutRect(StrutAreaRight); | ||
1080 | region += strutRect(StrutAreaBottom); | 1080 | region += strutRect(StrutAreaBottom); | ||
1081 | region += strutRect(StrutAreaLeft); | 1081 | region += strutRect(StrutAreaLeft); | ||
1082 | 1082 | | |||
▲ Show 20 Lines • Show All 242 Lines • ▼ Show 20 Line(s) | 1324 | QSize wsize(frame.width() - (borderLeft() + borderRight()), | |||
1325 | frame.height() - (borderTop() + borderBottom())); | 1325 | frame.height() - (borderTop() + borderBottom())); | ||
1326 | if (wsize.isEmpty()) | 1326 | if (wsize.isEmpty()) | ||
1327 | wsize = QSize(qMax(wsize.width(), 1), qMax(wsize.height(), 1)); | 1327 | wsize = QSize(qMax(wsize.width(), 1), qMax(wsize.height(), 1)); | ||
1328 | 1328 | | |||
1329 | return sizeForClientSize(wsize, mode, false); | 1329 | return sizeForClientSize(wsize, mode, false); | ||
1330 | } | 1330 | } | ||
1331 | 1331 | | |||
1332 | // this helper returns proper size even if the window is shaded | 1332 | // this helper returns proper size even if the window is shaded | ||
1333 | // see also the comment in Client::setGeometry() | 1333 | // see also the comment in X11Client::setGeometry() | ||
1334 | QSize AbstractClient::adjustedSize() const | 1334 | QSize AbstractClient::adjustedSize() const | ||
1335 | { | 1335 | { | ||
1336 | return sizeForClientSize(clientSize()); | 1336 | return sizeForClientSize(clientSize()); | ||
1337 | } | 1337 | } | ||
1338 | 1338 | | |||
1339 | /** | 1339 | /** | ||
1340 | * Calculate the appropriate frame size for the given client size \a | 1340 | * Calculate the appropriate frame size for the given client size \a | ||
1341 | * wsize. | 1341 | * wsize. | ||
1342 | * | 1342 | * | ||
1343 | * \a wsize is adapted according to the window's size hints (minimum, | 1343 | * \a wsize is adapted according to the window's size hints (minimum, | ||
1344 | * maximum and incremental size changes). | 1344 | * maximum and incremental size changes). | ||
1345 | */ | 1345 | */ | ||
1346 | QSize Client::sizeForClientSize(const QSize& wsize, Sizemode mode, bool noframe) const | 1346 | QSize X11Client::sizeForClientSize(const QSize& wsize, Sizemode mode, bool noframe) const | ||
1347 | { | 1347 | { | ||
1348 | int w = wsize.width(); | 1348 | int w = wsize.width(); | ||
1349 | int h = wsize.height(); | 1349 | int h = wsize.height(); | ||
1350 | if (w < 1 || h < 1) { | 1350 | if (w < 1 || h < 1) { | ||
1351 | qCWarning(KWIN_CORE) << "sizeForClientSize() with empty size!" ; | 1351 | qCWarning(KWIN_CORE) << "sizeForClientSize() with empty size!" ; | ||
1352 | } | 1352 | } | ||
1353 | if (w < 1) w = 1; | 1353 | if (w < 1) w = 1; | ||
1354 | if (h < 1) h = 1; | 1354 | if (h < 1) h = 1; | ||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Line(s) | 1508 | if (!noframe) { | |||
1510 | h += borderTop() + borderBottom(); | 1510 | h += borderTop() + borderBottom(); | ||
1511 | } | 1511 | } | ||
1512 | return rules()->checkSize(QSize(w, h)); | 1512 | return rules()->checkSize(QSize(w, h)); | ||
1513 | } | 1513 | } | ||
1514 | 1514 | | |||
1515 | /** | 1515 | /** | ||
1516 | * Gets the client's normal WM hints and reconfigures itself respectively. | 1516 | * Gets the client's normal WM hints and reconfigures itself respectively. | ||
1517 | */ | 1517 | */ | ||
1518 | void Client::getWmNormalHints() | 1518 | void X11Client::getWmNormalHints() | ||
1519 | { | 1519 | { | ||
1520 | const bool hadFixedAspect = m_geometryHints.hasAspect(); | 1520 | const bool hadFixedAspect = m_geometryHints.hasAspect(); | ||
1521 | // roundtrip to X server | 1521 | // roundtrip to X server | ||
1522 | m_geometryHints.fetch(); | 1522 | m_geometryHints.fetch(); | ||
1523 | m_geometryHints.read(); | 1523 | m_geometryHints.read(); | ||
1524 | 1524 | | |||
1525 | if (!hadFixedAspect && m_geometryHints.hasAspect()) { | 1525 | if (!hadFixedAspect && m_geometryHints.hasAspect()) { | ||
1526 | // align to eventual new contraints | 1526 | // align to eventual new contraints | ||
Show All 15 Lines | 1535 | if ((!isSpecialWindow() || isToolbar()) && !isFullScreen()) { | |||
1542 | if (area.contains(origClientGeometry)) | 1542 | if (area.contains(origClientGeometry)) | ||
1543 | keepInArea(area); | 1543 | keepInArea(area); | ||
1544 | } | 1544 | } | ||
1545 | } | 1545 | } | ||
1546 | } | 1546 | } | ||
1547 | updateAllowedActions(); // affects isResizeable() | 1547 | updateAllowedActions(); // affects isResizeable() | ||
1548 | } | 1548 | } | ||
1549 | 1549 | | |||
1550 | QSize Client::minSize() const | 1550 | QSize X11Client::minSize() const | ||
1551 | { | 1551 | { | ||
1552 | return rules()->checkMinSize(m_geometryHints.minSize()); | 1552 | return rules()->checkMinSize(m_geometryHints.minSize()); | ||
1553 | } | 1553 | } | ||
1554 | 1554 | | |||
1555 | QSize Client::maxSize() const | 1555 | QSize X11Client::maxSize() const | ||
1556 | { | 1556 | { | ||
1557 | return rules()->checkMaxSize(m_geometryHints.maxSize()); | 1557 | return rules()->checkMaxSize(m_geometryHints.maxSize()); | ||
1558 | } | 1558 | } | ||
1559 | 1559 | | |||
1560 | QSize Client::basicUnit() const | 1560 | QSize X11Client::basicUnit() const | ||
1561 | { | 1561 | { | ||
1562 | return m_geometryHints.resizeIncrements(); | 1562 | return m_geometryHints.resizeIncrements(); | ||
1563 | } | 1563 | } | ||
1564 | 1564 | | |||
1565 | /** | 1565 | /** | ||
1566 | * Auxiliary function to inform the client about the current window | 1566 | * Auxiliary function to inform the client about the current window | ||
1567 | * configuration. | 1567 | * configuration. | ||
1568 | */ | 1568 | */ | ||
1569 | void Client::sendSyntheticConfigureNotify() | 1569 | void X11Client::sendSyntheticConfigureNotify() | ||
1570 | { | 1570 | { | ||
1571 | xcb_configure_notify_event_t c; | 1571 | xcb_configure_notify_event_t c; | ||
1572 | memset(&c, 0, sizeof(c)); | 1572 | memset(&c, 0, sizeof(c)); | ||
1573 | c.response_type = XCB_CONFIGURE_NOTIFY; | 1573 | c.response_type = XCB_CONFIGURE_NOTIFY; | ||
1574 | c.event = window(); | 1574 | c.event = window(); | ||
1575 | c.window = window(); | 1575 | c.window = window(); | ||
1576 | c.x = x() + clientPos().x(); | 1576 | c.x = x() + clientPos().x(); | ||
1577 | c.y = y() + clientPos().y(); | 1577 | c.y = y() + clientPos().y(); | ||
1578 | c.width = clientSize().width(); | 1578 | c.width = clientSize().width(); | ||
1579 | c.height = clientSize().height(); | 1579 | c.height = clientSize().height(); | ||
1580 | c.border_width = 0; | 1580 | c.border_width = 0; | ||
1581 | c.above_sibling = XCB_WINDOW_NONE; | 1581 | c.above_sibling = XCB_WINDOW_NONE; | ||
1582 | c.override_redirect = 0; | 1582 | c.override_redirect = 0; | ||
1583 | xcb_send_event(connection(), true, c.event, XCB_EVENT_MASK_STRUCTURE_NOTIFY, reinterpret_cast<const char*>(&c)); | 1583 | xcb_send_event(connection(), true, c.event, XCB_EVENT_MASK_STRUCTURE_NOTIFY, reinterpret_cast<const char*>(&c)); | ||
1584 | xcb_flush(connection()); | 1584 | xcb_flush(connection()); | ||
1585 | } | 1585 | } | ||
1586 | 1586 | | |||
1587 | const QPoint Client::calculateGravitation(bool invert, int gravity) const | 1587 | const QPoint X11Client::calculateGravitation(bool invert, int gravity) const | ||
1588 | { | 1588 | { | ||
1589 | int dx, dy; | 1589 | int dx, dy; | ||
1590 | dx = dy = 0; | 1590 | dx = dy = 0; | ||
1591 | 1591 | | |||
1592 | if (gravity == 0) // default (nonsense) value for the argument | 1592 | if (gravity == 0) // default (nonsense) value for the argument | ||
1593 | gravity = m_geometryHints.windowGravity(); | 1593 | gravity = m_geometryHints.windowGravity(); | ||
1594 | 1594 | | |||
1595 | // dx, dy specify how the client window moves to make space for the frame | 1595 | // dx, dy specify how the client window moves to make space for the frame | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 1641 | } else { | |||
1644 | dy = - (borderTop() + borderBottom()) / 2; | 1644 | dy = - (borderTop() + borderBottom()) / 2; | ||
1645 | } | 1645 | } | ||
1646 | if (!invert) | 1646 | if (!invert) | ||
1647 | return QPoint(x() + dx, y() + dy); | 1647 | return QPoint(x() + dx, y() + dy); | ||
1648 | else | 1648 | else | ||
1649 | return QPoint(x() - dx, y() - dy); | 1649 | return QPoint(x() - dx, y() - dy); | ||
1650 | } | 1650 | } | ||
1651 | 1651 | | |||
1652 | void Client::configureRequest(int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool) | 1652 | void X11Client::configureRequest(int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool) | ||
1653 | { | 1653 | { | ||
1654 | const int configurePositionMask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; | 1654 | const int configurePositionMask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; | ||
1655 | const int configureSizeMask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; | 1655 | const int configureSizeMask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; | ||
1656 | const int configureGeometryMask = configurePositionMask | configureSizeMask; | 1656 | const int configureGeometryMask = configurePositionMask | configureSizeMask; | ||
1657 | 1657 | | |||
1658 | // "maximized" is a user setting -> we do not allow the client to resize itself | 1658 | // "maximized" is a user setting -> we do not allow the client to resize itself | ||
1659 | // away from this & against the users explicit wish | 1659 | // away from this & against the users explicit wish | ||
1660 | qCDebug(KWIN_CORE) << this << bool(value_mask & configureGeometryMask) << | 1660 | qCDebug(KWIN_CORE) << this << bool(value_mask & configureGeometryMask) << | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 1700 | if (value_mask & configurePositionMask) { | |||
1738 | QRect area = workspace()->clientArea(WorkArea, this); | 1738 | QRect area = workspace()->clientArea(WorkArea, this); | ||
1739 | if (!from_tool && (!isSpecialWindow() || isToolbar()) && !isFullScreen() | 1739 | if (!from_tool && (!isSpecialWindow() || isToolbar()) && !isFullScreen() | ||
1740 | && area.contains(origClientGeometry)) | 1740 | && area.contains(origClientGeometry)) | ||
1741 | keepInArea(area); | 1741 | keepInArea(area); | ||
1742 | 1742 | | |||
1743 | // this is part of the kicker-xinerama-hack... it should be | 1743 | // this is part of the kicker-xinerama-hack... it should be | ||
1744 | // safe to remove when kicker gets proper ExtendedStrut support; | 1744 | // safe to remove when kicker gets proper ExtendedStrut support; | ||
1745 | // see Workspace::updateClientArea() and | 1745 | // see Workspace::updateClientArea() and | ||
1746 | // Client::adjustedClientArea() | 1746 | // X11Client::adjustedClientArea() | ||
1747 | if (hasStrut()) | 1747 | if (hasStrut()) | ||
1748 | workspace() -> updateClientArea(); | 1748 | workspace() -> updateClientArea(); | ||
1749 | } | 1749 | } | ||
1750 | 1750 | | |||
1751 | if (value_mask & configureSizeMask && !(value_mask & configurePositionMask)) { // pure resize | 1751 | if (value_mask & configureSizeMask && !(value_mask & configurePositionMask)) { // pure resize | ||
1752 | int nw = clientSize().width(); | 1752 | int nw = clientSize().width(); | ||
1753 | int nh = clientSize().height(); | 1753 | int nh = clientSize().height(); | ||
1754 | if (value_mask & XCB_CONFIG_WINDOW_WIDTH) { | 1754 | if (value_mask & XCB_CONFIG_WINDOW_WIDTH) { | ||
Show All 21 Lines | |||||
1776 | } | 1776 | } | ||
1777 | } | 1777 | } | ||
1778 | geom_restore = geometry(); | 1778 | geom_restore = geometry(); | ||
1779 | // No need to send synthetic configure notify event here, either it's sent together | 1779 | // No need to send synthetic configure notify event here, either it's sent together | ||
1780 | // with geometry change, or there's no need to send it. | 1780 | // with geometry change, or there's no need to send it. | ||
1781 | // Handling of the real ConfigureRequest event forces sending it, as there it's necessary. | 1781 | // Handling of the real ConfigureRequest event forces sending it, as there it's necessary. | ||
1782 | } | 1782 | } | ||
1783 | 1783 | | |||
1784 | void Client::resizeWithChecks(int w, int h, xcb_gravity_t gravity, ForceGeometry_t force) | 1784 | void X11Client::resizeWithChecks(int w, int h, xcb_gravity_t gravity, ForceGeometry_t force) | ||
1785 | { | 1785 | { | ||
1786 | Q_ASSERT(!shade_geometry_change); | 1786 | Q_ASSERT(!shade_geometry_change); | ||
1787 | if (isShade()) { | 1787 | if (isShade()) { | ||
1788 | if (h == borderTop() + borderBottom()) { | 1788 | if (h == borderTop() + borderBottom()) { | ||
1789 | qCWarning(KWIN_CORE) << "Shaded geometry passed for size:" ; | 1789 | qCWarning(KWIN_CORE) << "Shaded geometry passed for size:" ; | ||
1790 | } | 1790 | } | ||
1791 | } | 1791 | } | ||
1792 | int newx = x(); | 1792 | int newx = x(); | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 1837 | case XCB_GRAVITY_SOUTH_EAST: // bottom right corner doesn't move | |||
1838 | newx = newx + width() - w; | 1838 | newx = newx + width() - w; | ||
1839 | newy = newy + height() - h; | 1839 | newy = newy + height() - h; | ||
1840 | break; | 1840 | break; | ||
1841 | } | 1841 | } | ||
1842 | setGeometry(newx, newy, w, h, force); | 1842 | setGeometry(newx, newy, w, h, force); | ||
1843 | } | 1843 | } | ||
1844 | 1844 | | |||
1845 | // _NET_MOVERESIZE_WINDOW | 1845 | // _NET_MOVERESIZE_WINDOW | ||
1846 | void Client::NETMoveResizeWindow(int flags, int x, int y, int width, int height) | 1846 | void X11Client::NETMoveResizeWindow(int flags, int x, int y, int width, int height) | ||
1847 | { | 1847 | { | ||
1848 | int gravity = flags & 0xff; | 1848 | int gravity = flags & 0xff; | ||
1849 | int value_mask = 0; | 1849 | int value_mask = 0; | ||
1850 | if (flags & (1 << 8)) { | 1850 | if (flags & (1 << 8)) { | ||
1851 | value_mask |= XCB_CONFIG_WINDOW_X; | 1851 | value_mask |= XCB_CONFIG_WINDOW_X; | ||
1852 | } | 1852 | } | ||
1853 | if (flags & (1 << 9)) { | 1853 | if (flags & (1 << 9)) { | ||
1854 | value_mask |= XCB_CONFIG_WINDOW_Y; | 1854 | value_mask |= XCB_CONFIG_WINDOW_Y; | ||
1855 | } | 1855 | } | ||
1856 | if (flags & (1 << 10)) { | 1856 | if (flags & (1 << 10)) { | ||
1857 | value_mask |= XCB_CONFIG_WINDOW_WIDTH; | 1857 | value_mask |= XCB_CONFIG_WINDOW_WIDTH; | ||
1858 | } | 1858 | } | ||
1859 | if (flags & (1 << 11)) { | 1859 | if (flags & (1 << 11)) { | ||
1860 | value_mask |= XCB_CONFIG_WINDOW_HEIGHT; | 1860 | value_mask |= XCB_CONFIG_WINDOW_HEIGHT; | ||
1861 | } | 1861 | } | ||
1862 | configureRequest(value_mask, x, y, width, height, gravity, true); | 1862 | configureRequest(value_mask, x, y, width, height, gravity, true); | ||
1863 | } | 1863 | } | ||
1864 | 1864 | | |||
1865 | bool Client::isMovable() const | 1865 | bool X11Client::isMovable() const | ||
1866 | { | 1866 | { | ||
1867 | if (!hasNETSupport() && !m_motif.move()) { | 1867 | if (!hasNETSupport() && !m_motif.move()) { | ||
1868 | return false; | 1868 | return false; | ||
1869 | } | 1869 | } | ||
1870 | if (isFullScreen()) | 1870 | if (isFullScreen()) | ||
1871 | return false; | 1871 | return false; | ||
1872 | if (isSpecialWindow() && !isSplash() && !isToolbar()) // allow moving of splashscreens :) | 1872 | if (isSpecialWindow() && !isSplash() && !isToolbar()) // allow moving of splashscreens :) | ||
1873 | return false; | 1873 | return false; | ||
1874 | if (rules()->checkPosition(invalidPoint) != invalidPoint) // forced position | 1874 | if (rules()->checkPosition(invalidPoint) != invalidPoint) // forced position | ||
1875 | return false; | 1875 | return false; | ||
1876 | return true; | 1876 | return true; | ||
1877 | } | 1877 | } | ||
1878 | 1878 | | |||
1879 | bool Client::isMovableAcrossScreens() const | 1879 | bool X11Client::isMovableAcrossScreens() const | ||
1880 | { | 1880 | { | ||
1881 | if (!hasNETSupport() && !m_motif.move()) { | 1881 | if (!hasNETSupport() && !m_motif.move()) { | ||
1882 | return false; | 1882 | return false; | ||
1883 | } | 1883 | } | ||
1884 | if (isSpecialWindow() && !isSplash() && !isToolbar()) // allow moving of splashscreens :) | 1884 | if (isSpecialWindow() && !isSplash() && !isToolbar()) // allow moving of splashscreens :) | ||
1885 | return false; | 1885 | return false; | ||
1886 | if (rules()->checkPosition(invalidPoint) != invalidPoint) // forced position | 1886 | if (rules()->checkPosition(invalidPoint) != invalidPoint) // forced position | ||
1887 | return false; | 1887 | return false; | ||
1888 | return true; | 1888 | return true; | ||
1889 | } | 1889 | } | ||
1890 | 1890 | | |||
1891 | bool Client::isResizable() const | 1891 | bool X11Client::isResizable() const | ||
1892 | { | 1892 | { | ||
1893 | if (!hasNETSupport() && !m_motif.resize()) { | 1893 | if (!hasNETSupport() && !m_motif.resize()) { | ||
1894 | return false; | 1894 | return false; | ||
1895 | } | 1895 | } | ||
1896 | if (isFullScreen()) | 1896 | if (isFullScreen()) | ||
1897 | return false; | 1897 | return false; | ||
1898 | if (isSpecialWindow() || isSplash() || isToolbar()) | 1898 | if (isSpecialWindow() || isSplash() || isToolbar()) | ||
1899 | return false; | 1899 | return false; | ||
1900 | if (rules()->checkSize(QSize()).isValid()) // forced size | 1900 | if (rules()->checkSize(QSize()).isValid()) // forced size | ||
1901 | return false; | 1901 | return false; | ||
1902 | const Position mode = moveResizePointerMode(); | 1902 | const Position mode = moveResizePointerMode(); | ||
1903 | if ((mode == PositionTop || mode == PositionTopLeft || mode == PositionTopRight || | 1903 | if ((mode == PositionTop || mode == PositionTopLeft || mode == PositionTopRight || | ||
1904 | mode == PositionLeft || mode == PositionBottomLeft) && rules()->checkPosition(invalidPoint) != invalidPoint) | 1904 | mode == PositionLeft || mode == PositionBottomLeft) && rules()->checkPosition(invalidPoint) != invalidPoint) | ||
1905 | return false; | 1905 | return false; | ||
1906 | 1906 | | |||
1907 | QSize min = minSize(); | 1907 | QSize min = minSize(); | ||
1908 | QSize max = maxSize(); | 1908 | QSize max = maxSize(); | ||
1909 | return min.width() < max.width() || min.height() < max.height(); | 1909 | return min.width() < max.width() || min.height() < max.height(); | ||
1910 | } | 1910 | } | ||
1911 | 1911 | | |||
1912 | bool Client::isMaximizable() const | 1912 | bool X11Client::isMaximizable() const | ||
1913 | { | 1913 | { | ||
1914 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | 1914 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | ||
1915 | return false; | 1915 | return false; | ||
1916 | if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore && rules()->checkMaximize(MaximizeFull) != MaximizeRestore) | 1916 | if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore && rules()->checkMaximize(MaximizeFull) != MaximizeRestore) | ||
1917 | return true; | 1917 | return true; | ||
1918 | return false; | 1918 | return false; | ||
1919 | } | 1919 | } | ||
1920 | 1920 | | |||
1921 | 1921 | | |||
1922 | /** | 1922 | /** | ||
1923 | * Reimplemented to inform the client about the new window position. | 1923 | * Reimplemented to inform the client about the new window position. | ||
1924 | */ | 1924 | */ | ||
1925 | void Client::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) | 1925 | void X11Client::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) | ||
1926 | { | 1926 | { | ||
1927 | // this code is also duplicated in Client::plainResize() | 1927 | // this code is also duplicated in X11Client::plainResize() | ||
1928 | // Ok, the shading geometry stuff. Generally, code doesn't care about shaded geometry, | 1928 | // Ok, the shading geometry stuff. Generally, code doesn't care about shaded geometry, | ||
1929 | // simply because there are too many places dealing with geometry. Those places | 1929 | // simply because there are too many places dealing with geometry. Those places | ||
1930 | // ignore shaded state and use normal geometry, which they usually should get | 1930 | // ignore shaded state and use normal geometry, which they usually should get | ||
1931 | // from adjustedSize(). Such geometry comes here, and if the window is shaded, | 1931 | // from adjustedSize(). Such geometry comes here, and if the window is shaded, | ||
1932 | // the geometry is used only for client_size, since that one is not used when | 1932 | // the geometry is used only for client_size, since that one is not used when | ||
1933 | // shading. Then the frame geometry is adjusted for the shaded geometry. | 1933 | // shading. Then the frame geometry is adjusted for the shaded geometry. | ||
1934 | // This gets more complicated in the case the code does only something like | 1934 | // This gets more complicated in the case the code does only something like | ||
1935 | // setGeometry( geometry()) - geometry() will return the shaded frame geometry. | 1935 | // setGeometry( geometry()) - geometry() will return the shaded frame geometry. | ||
1936 | // Such code is wrong and should be changed to handle the case when the window is shaded, | 1936 | // Such code is wrong and should be changed to handle the case when the window is shaded, | ||
1937 | // for example using Client::clientSize() | 1937 | // for example using X11Client::clientSize() | ||
1938 | 1938 | | |||
1939 | if (shade_geometry_change) | 1939 | if (shade_geometry_change) | ||
1940 | ; // nothing | 1940 | ; // nothing | ||
1941 | else if (isShade()) { | 1941 | else if (isShade()) { | ||
1942 | if (h == borderTop() + borderBottom()) { | 1942 | if (h == borderTop() + borderBottom()) { | ||
1943 | qCDebug(KWIN_CORE) << "Shaded geometry passed for size:"; | 1943 | qCDebug(KWIN_CORE) << "Shaded geometry passed for size:"; | ||
1944 | } else { | 1944 | } else { | ||
1945 | client_size = QSize(w - borderLeft() - borderRight(), h - borderTop() - borderBottom()); | 1945 | client_size = QSize(w - borderLeft() - borderRight(), h - borderTop() - borderBottom()); | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | |||||
2008 | } | 2008 | } | ||
2009 | emit geometryShapeChanged(this, geometryBeforeUpdateBlocking()); | 2009 | emit geometryShapeChanged(this, geometryBeforeUpdateBlocking()); | ||
2010 | addRepaintDuringGeometryUpdates(); | 2010 | addRepaintDuringGeometryUpdates(); | ||
2011 | updateGeometryBeforeUpdateBlocking(); | 2011 | updateGeometryBeforeUpdateBlocking(); | ||
2012 | // TODO: this signal is emitted too often | 2012 | // TODO: this signal is emitted too often | ||
2013 | emit geometryChanged(); | 2013 | emit geometryChanged(); | ||
2014 | } | 2014 | } | ||
2015 | 2015 | | |||
2016 | void Client::plainResize(int w, int h, ForceGeometry_t force) | 2016 | void X11Client::plainResize(int w, int h, ForceGeometry_t force) | ||
2017 | { | 2017 | { | ||
2018 | // this code is also duplicated in Client::setGeometry(), and it's also commented there | 2018 | // this code is also duplicated in X11Client::setGeometry(), and it's also commented there | ||
2019 | if (shade_geometry_change) | 2019 | if (shade_geometry_change) | ||
2020 | ; // nothing | 2020 | ; // nothing | ||
2021 | else if (isShade()) { | 2021 | else if (isShade()) { | ||
2022 | if (h == borderTop() + borderBottom()) { | 2022 | if (h == borderTop() + borderBottom()) { | ||
2023 | qCDebug(KWIN_CORE) << "Shaded geometry passed for size:"; | 2023 | qCDebug(KWIN_CORE) << "Shaded geometry passed for size:"; | ||
2024 | } else { | 2024 | } else { | ||
2025 | client_size = QSize(w - borderLeft() - borderRight(), h - borderTop() - borderBottom()); | 2025 | client_size = QSize(w - borderLeft() - borderRight(), h - borderTop() - borderBottom()); | ||
2026 | h = borderTop() + borderBottom(); | 2026 | h = borderTop() + borderBottom(); | ||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 2077 | { | |||
2098 | screens()->setCurrent(this); | 2098 | screens()->setCurrent(this); | ||
2099 | workspace()->updateStackingOrder(); | 2099 | workspace()->updateStackingOrder(); | ||
2100 | // client itself is not damaged | 2100 | // client itself is not damaged | ||
2101 | addRepaintDuringGeometryUpdates(); | 2101 | addRepaintDuringGeometryUpdates(); | ||
2102 | updateGeometryBeforeUpdateBlocking(); | 2102 | updateGeometryBeforeUpdateBlocking(); | ||
2103 | emit geometryChanged(); | 2103 | emit geometryChanged(); | ||
2104 | } | 2104 | } | ||
2105 | 2105 | | |||
2106 | void Client::doMove(int x, int y) | 2106 | void X11Client::doMove(int x, int y) | ||
2107 | { | 2107 | { | ||
2108 | m_frame.move(x, y); | 2108 | m_frame.move(x, y); | ||
2109 | sendSyntheticConfigureNotify(); | 2109 | sendSyntheticConfigureNotify(); | ||
2110 | } | 2110 | } | ||
2111 | 2111 | | |||
2112 | void AbstractClient::blockGeometryUpdates(bool block) | 2112 | void AbstractClient::blockGeometryUpdates(bool block) | ||
2113 | { | 2113 | { | ||
2114 | if (block) { | 2114 | if (block) { | ||
Show All 30 Lines | 2137 | { | |||
2145 | if (oldMode != newMode) { | 2145 | if (oldMode != newMode) { | ||
2146 | emit clientMaximizedStateChanged(this, newMode); | 2146 | emit clientMaximizedStateChanged(this, newMode); | ||
2147 | emit clientMaximizedStateChanged(this, vertically, horizontally); | 2147 | emit clientMaximizedStateChanged(this, vertically, horizontally); | ||
2148 | } | 2148 | } | ||
2149 | 2149 | | |||
2150 | } | 2150 | } | ||
2151 | 2151 | | |||
2152 | static bool changeMaximizeRecursion = false; | 2152 | static bool changeMaximizeRecursion = false; | ||
2153 | void Client::changeMaximize(bool horizontal, bool vertical, bool adjust) | 2153 | void X11Client::changeMaximize(bool horizontal, bool vertical, bool adjust) | ||
2154 | { | 2154 | { | ||
2155 | if (changeMaximizeRecursion) | 2155 | if (changeMaximizeRecursion) | ||
2156 | return; | 2156 | return; | ||
2157 | 2157 | | |||
2158 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | 2158 | if (!isResizable() || isToolbar()) // SELI isToolbar() ? | ||
2159 | return; | 2159 | return; | ||
2160 | 2160 | | |||
2161 | QRect clientArea; | 2161 | QRect clientArea; | ||
▲ Show 20 Lines • Show All 235 Lines • ▼ Show 20 Line(s) | 2396 | default: | |||
2397 | break; | 2397 | break; | ||
2398 | } | 2398 | } | ||
2399 | 2399 | | |||
2400 | updateAllowedActions(); | 2400 | updateAllowedActions(); | ||
2401 | updateWindowRules(Rules::MaximizeVert|Rules::MaximizeHoriz|Rules::Position|Rules::Size); | 2401 | updateWindowRules(Rules::MaximizeVert|Rules::MaximizeHoriz|Rules::Position|Rules::Size); | ||
2402 | emit quickTileModeChanged(); | 2402 | emit quickTileModeChanged(); | ||
2403 | } | 2403 | } | ||
2404 | 2404 | | |||
2405 | bool Client::userCanSetFullScreen() const | 2405 | bool X11Client::userCanSetFullScreen() const | ||
2406 | { | 2406 | { | ||
2407 | if (!isFullScreenable()) { | 2407 | if (!isFullScreenable()) { | ||
2408 | return false; | 2408 | return false; | ||
2409 | } | 2409 | } | ||
2410 | return isNormalWindow() || isDialog(); | 2410 | return isNormalWindow() || isDialog(); | ||
2411 | } | 2411 | } | ||
2412 | 2412 | | |||
2413 | void Client::setFullScreen(bool set, bool user) | 2413 | void X11Client::setFullScreen(bool set, bool user) | ||
2414 | { | 2414 | { | ||
2415 | set = rules()->checkFullScreen(set); | 2415 | set = rules()->checkFullScreen(set); | ||
2416 | 2416 | | |||
2417 | const bool wasFullscreen = isFullScreen(); | 2417 | const bool wasFullscreen = isFullScreen(); | ||
2418 | if (wasFullscreen == set) { | 2418 | if (wasFullscreen == set) { | ||
2419 | return; | 2419 | return; | ||
2420 | } | 2420 | } | ||
2421 | if (user && !userCanSetFullScreen()) { | 2421 | if (user && !userCanSetFullScreen()) { | ||
Show All 40 Lines | |||||
2462 | } | 2462 | } | ||
2463 | 2463 | | |||
2464 | updateWindowRules(Rules::Fullscreen | Rules::Position | Rules::Size); | 2464 | updateWindowRules(Rules::Fullscreen | Rules::Position | Rules::Size); | ||
2465 | emit clientFullScreenSet(this, set, user); | 2465 | emit clientFullScreenSet(this, set, user); | ||
2466 | emit fullScreenChanged(); | 2466 | emit fullScreenChanged(); | ||
2467 | } | 2467 | } | ||
2468 | 2468 | | |||
2469 | 2469 | | |||
2470 | void Client::updateFullscreenMonitors(NETFullscreenMonitors topology) | 2470 | void X11Client::updateFullscreenMonitors(NETFullscreenMonitors topology) | ||
2471 | { | 2471 | { | ||
2472 | int nscreens = screens()->count(); | 2472 | int nscreens = screens()->count(); | ||
2473 | 2473 | | |||
2474 | // qDebug() << "incoming request with top: " << topology.top << " bottom: " << topology.bottom | 2474 | // qDebug() << "incoming request with top: " << topology.top << " bottom: " << topology.bottom | ||
2475 | // << " left: " << topology.left << " right: " << topology.right | 2475 | // << " left: " << topology.left << " right: " << topology.right | ||
2476 | // << ", we have: " << nscreens << " screens."; | 2476 | // << ", we have: " << nscreens << " screens."; | ||
2477 | 2477 | | |||
2478 | if (topology.top >= nscreens || | 2478 | if (topology.top >= nscreens || | ||
2479 | topology.bottom >= nscreens || | 2479 | topology.bottom >= nscreens || | ||
2480 | topology.left >= nscreens || | 2480 | topology.left >= nscreens || | ||
2481 | topology.right >= nscreens) { | 2481 | topology.right >= nscreens) { | ||
2482 | qCWarning(KWIN_CORE) << "fullscreenMonitors update failed. request higher than number of screens."; | 2482 | qCWarning(KWIN_CORE) << "fullscreenMonitors update failed. request higher than number of screens."; | ||
2483 | return; | 2483 | return; | ||
2484 | } | 2484 | } | ||
2485 | 2485 | | |||
2486 | info->setFullscreenMonitors(topology); | 2486 | info->setFullscreenMonitors(topology); | ||
2487 | if (isFullScreen()) | 2487 | if (isFullScreen()) | ||
2488 | setGeometry(fullscreenMonitorsArea(topology)); | 2488 | setGeometry(fullscreenMonitorsArea(topology)); | ||
2489 | } | 2489 | } | ||
2490 | 2490 | | |||
2491 | /** | 2491 | /** | ||
2492 | * Calculates the bounding rectangle defined by the 4 monitor indices indicating the | 2492 | * Calculates the bounding rectangle defined by the 4 monitor indices indicating the | ||
2493 | * top, bottom, left, and right edges of the window when the fullscreen state is enabled. | 2493 | * top, bottom, left, and right edges of the window when the fullscreen state is enabled. | ||
2494 | */ | 2494 | */ | ||
2495 | QRect Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) const | 2495 | QRect X11Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) const | ||
2496 | { | 2496 | { | ||
2497 | QRect top, bottom, left, right, total; | 2497 | QRect top, bottom, left, right, total; | ||
2498 | 2498 | | |||
2499 | top = screens()->geometry(requestedTopology.top); | 2499 | top = screens()->geometry(requestedTopology.top); | ||
2500 | bottom = screens()->geometry(requestedTopology.bottom); | 2500 | bottom = screens()->geometry(requestedTopology.bottom); | ||
2501 | left = screens()->geometry(requestedTopology.left); | 2501 | left = screens()->geometry(requestedTopology.left); | ||
2502 | right = screens()->geometry(requestedTopology.right); | 2502 | right = screens()->geometry(requestedTopology.right); | ||
2503 | total = top.united(bottom.united(left.united(right))); | 2503 | total = top.united(bottom.united(left.united(right))); | ||
2504 | 2504 | | |||
2505 | // qDebug() << "top: " << top << " bottom: " << bottom | 2505 | // qDebug() << "top: " << top << " bottom: " << bottom | ||
2506 | // << " left: " << left << " right: " << right; | 2506 | // << " left: " << left << " right: " << right; | ||
2507 | // qDebug() << "returning rect: " << total; | 2507 | // qDebug() << "returning rect: " << total; | ||
2508 | return total; | 2508 | return total; | ||
2509 | } | 2509 | } | ||
2510 | 2510 | | |||
2511 | static GeometryTip* geometryTip = nullptr; | 2511 | static GeometryTip* geometryTip = nullptr; | ||
2512 | 2512 | | |||
2513 | void Client::positionGeometryTip() | 2513 | void X11Client::positionGeometryTip() | ||
2514 | { | 2514 | { | ||
2515 | Q_ASSERT(isMove() || isResize()); | 2515 | Q_ASSERT(isMove() || isResize()); | ||
2516 | // Position and Size display | 2516 | // Position and Size display | ||
2517 | if (effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::GeometryTip)) | 2517 | if (effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::GeometryTip)) | ||
2518 | return; // some effect paints this for us | 2518 | return; // some effect paints this for us | ||
2519 | if (options->showGeometryTip()) { | 2519 | if (options->showGeometryTip()) { | ||
2520 | if (!geometryTip) { | 2520 | if (!geometryTip) { | ||
2521 | geometryTip = new GeometryTip(&m_geometryHints); | 2521 | geometryTip = new GeometryTip(&m_geometryHints); | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 2536 | { | |||
2570 | updateInitialMoveResizeGeometry(); | 2570 | updateInitialMoveResizeGeometry(); | ||
2571 | checkUnrestrictedMoveResize(); | 2571 | checkUnrestrictedMoveResize(); | ||
2572 | emit clientStartUserMovedResized(this); | 2572 | emit clientStartUserMovedResized(this); | ||
2573 | if (ScreenEdges::self()->isDesktopSwitchingMovingClients()) | 2573 | if (ScreenEdges::self()->isDesktopSwitchingMovingClients()) | ||
2574 | ScreenEdges::self()->reserveDesktopSwitching(true, Qt::Vertical|Qt::Horizontal); | 2574 | ScreenEdges::self()->reserveDesktopSwitching(true, Qt::Vertical|Qt::Horizontal); | ||
2575 | return true; | 2575 | return true; | ||
2576 | } | 2576 | } | ||
2577 | 2577 | | |||
2578 | bool Client::doStartMoveResize() | 2578 | bool X11Client::doStartMoveResize() | ||
2579 | { | 2579 | { | ||
2580 | bool has_grab = false; | 2580 | bool has_grab = false; | ||
2581 | // This reportedly improves smoothness of the moveresize operation, | 2581 | // This reportedly improves smoothness of the moveresize operation, | ||
2582 | // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* | 2582 | // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* | ||
2583 | // (https://lists.kde.org/?t=107302193400001&r=1&w=2) | 2583 | // (https://lists.kde.org/?t=107302193400001&r=1&w=2) | ||
2584 | QRect r = workspace()->clientArea(FullArea, this); | 2584 | QRect r = workspace()->clientArea(FullArea, this); | ||
2585 | m_moveResizeGrabWindow.create(r, XCB_WINDOW_CLASS_INPUT_ONLY, 0, nullptr, rootWindow()); | 2585 | m_moveResizeGrabWindow.create(r, XCB_WINDOW_CLASS_INPUT_ONLY, 0, nullptr, rootWindow()); | ||
2586 | m_moveResizeGrabWindow.map(); | 2586 | m_moveResizeGrabWindow.map(); | ||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 2637 | } else if (!cancel) { | |||
2646 | } | 2646 | } | ||
2647 | setGeometryRestore(geom_restore); | 2647 | setGeometryRestore(geom_restore); | ||
2648 | } | 2648 | } | ||
2649 | // FRAME update(); | 2649 | // FRAME update(); | ||
2650 | 2650 | | |||
2651 | emit clientFinishUserMovedResized(this); | 2651 | emit clientFinishUserMovedResized(this); | ||
2652 | } | 2652 | } | ||
2653 | 2653 | | |||
2654 | void Client::leaveMoveResize() | 2654 | void X11Client::leaveMoveResize() | ||
2655 | { | 2655 | { | ||
2656 | if (needsXWindowMove) { | 2656 | if (needsXWindowMove) { | ||
2657 | // Do the deferred move | 2657 | // Do the deferred move | ||
2658 | m_frame.move(geom.topLeft()); | 2658 | m_frame.move(geom.topLeft()); | ||
2659 | needsXWindowMove = false; | 2659 | needsXWindowMove = false; | ||
2660 | } | 2660 | } | ||
2661 | if (!isResize()) | 2661 | if (!isResize()) | ||
2662 | sendSyntheticConfigureNotify(); // tell the client about it's new final position | 2662 | sendSyntheticConfigureNotify(); // tell the client about it's new final position | ||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 2762 | if (rules()->checkMaximize(MaximizeRestore) == MaximizeRestore) | |||
2763 | setMoveResizeGeometry(geom_restore); | 2763 | setMoveResizeGeometry(geom_restore); | ||
2764 | handleMoveResize(local.x(), local.y(), global.x(), global.y()); // fix position | 2764 | handleMoveResize(local.x(), local.y(), global.x(), global.y()); // fix position | ||
2765 | } else if (quickTileMode() == QuickTileMode(QuickTileFlag::None) && isResizable()) { | 2765 | } else if (quickTileMode() == QuickTileMode(QuickTileFlag::None) && isResizable()) { | ||
2766 | checkQuickTilingMaximizationZones(global.x(), global.y()); | 2766 | checkQuickTilingMaximizationZones(global.x(), global.y()); | ||
2767 | } | 2767 | } | ||
2768 | } | 2768 | } | ||
2769 | } | 2769 | } | ||
2770 | 2770 | | |||
2771 | bool Client::isWaitingForMoveResizeSync() const | 2771 | bool X11Client::isWaitingForMoveResizeSync() const | ||
2772 | { | 2772 | { | ||
2773 | return syncRequest.isPending && isResize(); | 2773 | return syncRequest.isPending && isResize(); | ||
2774 | } | 2774 | } | ||
2775 | 2775 | | |||
2776 | void AbstractClient::handleMoveResize(int x, int y, int x_root, int y_root) | 2776 | void AbstractClient::handleMoveResize(int x, int y, int x_root, int y_root) | ||
2777 | { | 2777 | { | ||
2778 | if (isWaitingForMoveResizeSync()) | 2778 | if (isWaitingForMoveResizeSync()) | ||
2779 | return; // we're still waiting for the client or the timeout | 2779 | return; // we're still waiting for the client or the timeout | ||
▲ Show 20 Lines • Show All 309 Lines • ▼ Show 20 Line(s) | |||||
3089 | } else | 3089 | } else | ||
3090 | performMoveResize(); | 3090 | performMoveResize(); | ||
3091 | 3091 | | |||
3092 | if (isMove()) { | 3092 | if (isMove()) { | ||
3093 | ScreenEdges::self()->check(globalPos, QDateTime::fromMSecsSinceEpoch(xTime())); | 3093 | ScreenEdges::self()->check(globalPos, QDateTime::fromMSecsSinceEpoch(xTime())); | ||
3094 | } | 3094 | } | ||
3095 | } | 3095 | } | ||
3096 | 3096 | | |||
3097 | void Client::doResizeSync() | 3097 | void X11Client::doResizeSync() | ||
3098 | { | 3098 | { | ||
3099 | if (!syncRequest.timeout) { | 3099 | if (!syncRequest.timeout) { | ||
3100 | syncRequest.timeout = new QTimer(this); | 3100 | syncRequest.timeout = new QTimer(this); | ||
3101 | connect(syncRequest.timeout, &QTimer::timeout, this, &Client::performMoveResize); | 3101 | connect(syncRequest.timeout, &QTimer::timeout, this, &X11Client::performMoveResize); | ||
3102 | syncRequest.timeout->setSingleShot(true); | 3102 | syncRequest.timeout->setSingleShot(true); | ||
3103 | } | 3103 | } | ||
3104 | if (syncRequest.counter != XCB_NONE) { | 3104 | if (syncRequest.counter != XCB_NONE) { | ||
3105 | syncRequest.timeout->start(250); | 3105 | syncRequest.timeout->start(250); | ||
3106 | sendSyncRequest(); | 3106 | sendSyncRequest(); | ||
3107 | } else { // for clients not supporting the XSYNC protocol, we | 3107 | } else { // for clients not supporting the XSYNC protocol, we | ||
3108 | syncRequest.isPending = true; // limit the resizes to 30Hz to take pointless load from X11 | 3108 | syncRequest.isPending = true; // limit the resizes to 30Hz to take pointless load from X11 | ||
3109 | syncRequest.timeout->start(33); // and the client, the mouse is still moved at full speed | 3109 | syncRequest.timeout->start(33); // and the client, the mouse is still moved at full speed | ||
Show All 10 Lines | 3116 | { | |||
3120 | } | 3120 | } | ||
3121 | doPerformMoveResize(); | 3121 | doPerformMoveResize(); | ||
3122 | if (isResize()) | 3122 | if (isResize()) | ||
3123 | addRepaintFull(); | 3123 | addRepaintFull(); | ||
3124 | positionGeometryTip(); | 3124 | positionGeometryTip(); | ||
3125 | emit clientStepUserMovedResized(this, moveResizeGeom); | 3125 | emit clientStepUserMovedResized(this, moveResizeGeom); | ||
3126 | } | 3126 | } | ||
3127 | 3127 | | |||
3128 | void Client::doPerformMoveResize() | 3128 | void X11Client::doPerformMoveResize() | ||
3129 | { | 3129 | { | ||
3130 | if (syncRequest.counter == XCB_NONE) // client w/o XSYNC support. allow the next resize event | 3130 | if (syncRequest.counter == XCB_NONE) // client w/o XSYNC support. allow the next resize event | ||
3131 | syncRequest.isPending = false; // NEVER do this for clients with a valid counter | 3131 | syncRequest.isPending = false; // NEVER do this for clients with a valid counter | ||
3132 | // (leads to sync request races in some clients) | 3132 | // (leads to sync request races in some clients) | ||
3133 | } | 3133 | } | ||
3134 | 3134 | | |||
3135 | void AbstractClient::setElectricBorderMode(QuickTileMode mode) | 3135 | void AbstractClient::setElectricBorderMode(QuickTileMode mode) | ||
3136 | { | 3136 | { | ||
▲ Show 20 Lines • Show All 257 Lines • Show Last 20 Lines |