Changeset View
Changeset View
Standalone View
Standalone View
xcbutils.h
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
47 | // forward declaration of methods | 47 | // forward declaration of methods | ||
48 | static void defineCursor(xcb_window_t window, xcb_cursor_t cursor); | 48 | static void defineCursor(xcb_window_t window, xcb_cursor_t cursor); | ||
49 | static void setInputFocus(xcb_window_t window, uint8_t revertTo = XCB_INPUT_FOCUS_POINTER_ROOT, xcb_timestamp_t time = xTime()); | 49 | static void setInputFocus(xcb_window_t window, uint8_t revertTo = XCB_INPUT_FOCUS_POINTER_ROOT, xcb_timestamp_t time = xTime()); | ||
50 | static void moveWindow(xcb_window_t window, const QPoint &pos); | 50 | static void moveWindow(xcb_window_t window, const QPoint &pos); | ||
51 | static void moveWindow(xcb_window_t window, uint32_t x, uint32_t y); | 51 | static void moveWindow(xcb_window_t window, uint32_t x, uint32_t y); | ||
52 | static void lowerWindow(xcb_window_t window); | 52 | static void lowerWindow(xcb_window_t window); | ||
53 | static void selectInput(xcb_window_t window, uint32_t events); | 53 | static void selectInput(xcb_window_t window, uint32_t events); | ||
54 | 54 | | |||
55 | template <typename T> | ||||
56 | static T scX(T arg) | ||||
57 | { | ||||
58 | return arg * kwinApp()->x11Scale(); | ||||
59 | } | ||||
60 | | ||||
61 | template <typename T> | ||||
62 | static T scK(T arg) | ||||
63 | { | ||||
64 | auto ret = arg / (double)kwinApp()->x11Scale() + 0.5; | ||||
zzag: It will return a wrong value if qreal is passed. | |||||
65 | T ret2 = ret; | ||||
66 | return ret2; | ||||
67 | } | ||||
68 | | ||||
69 | template <> | ||||
70 | QSize scK<QSize>(QSize arg) | ||||
71 | { | ||||
72 | return QSize(scK(arg.width()), scK(arg.height())); | ||||
73 | } | ||||
74 | | ||||
75 | template <> | ||||
76 | QRect scX<QRect>(QRect arg) | ||||
77 | { | ||||
78 | return QRect(scX(arg.x()), scX(arg.y()), scX(arg.width()), scX(arg.height())); | ||||
79 | } | ||||
80 | template <> | ||||
81 | QRect scK<QRect>(QRect arg) | ||||
82 | { | ||||
83 | return QRect(scK(arg.x()), scK(arg.y()), scK(arg.width()), scK(arg.height())); | ||||
84 | } | ||||
85 | | ||||
zzag: Please follow coding style, no short names. | |||||
55 | /** | 86 | /** | ||
56 | * @brief Variadic template to wrap an xcb request. | 87 | * @brief Variadic template to wrap an xcb request. | ||
57 | * | 88 | * | ||
58 | * This struct is part of the generic implementation to wrap xcb requests | 89 | * This struct is part of the generic implementation to wrap xcb requests | ||
59 | * and fetching their reply. Each request is represented by two templated | 90 | * and fetching their reply. Each request is represented by two templated | ||
60 | * elements: WrapperData and Wrapper. | 91 | * elements: WrapperData and Wrapper. | ||
61 | * | 92 | * | ||
62 | * The WrapperData defines the following types: | 93 | * The WrapperData defines the following types: | ||
▲ Show 20 Lines • Show All 496 Lines • ▼ Show 20 Line(s) | 589 | public: | |||
559 | WindowGeometry() : Wrapper<GeometryData, xcb_window_t>() {} | 590 | WindowGeometry() : Wrapper<GeometryData, xcb_window_t>() {} | ||
560 | explicit WindowGeometry(xcb_window_t window) : Wrapper<GeometryData, xcb_window_t>(window) {} | 591 | explicit WindowGeometry(xcb_window_t window) : Wrapper<GeometryData, xcb_window_t>(window) {} | ||
561 | 592 | | |||
562 | inline QRect rect() { | 593 | inline QRect rect() { | ||
563 | const xcb_get_geometry_reply_t *geometry = data(); | 594 | const xcb_get_geometry_reply_t *geometry = data(); | ||
564 | if (!geometry) { | 595 | if (!geometry) { | ||
565 | return QRect(); | 596 | return QRect(); | ||
566 | } | 597 | } | ||
567 | return QRect(geometry->x, geometry->y, geometry->width, geometry->height); | 598 | return scK(QRect(geometry->x, geometry->y, geometry->width, geometry->height)); | ||
568 | } | 599 | } | ||
569 | }; | 600 | }; | ||
570 | 601 | | |||
571 | XCB_WRAPPER_DATA(TreeData, xcb_query_tree, xcb_window_t) | 602 | XCB_WRAPPER_DATA(TreeData, xcb_query_tree, xcb_window_t) | ||
572 | class Tree : public Wrapper<TreeData, xcb_window_t> | 603 | class Tree : public Wrapper<TreeData, xcb_window_t> | ||
573 | { | 604 | { | ||
574 | public: | 605 | public: | ||
575 | explicit Tree(WindowId window) : Wrapper<TreeData, xcb_window_t>(window) {} | 606 | explicit Tree(WindowId window) : Wrapper<TreeData, xcb_window_t>(window) {} | ||
▲ Show 20 Lines • Show All 338 Lines • ▼ Show 20 Line(s) | 903 | public: | |||
914 | } | 945 | } | ||
915 | bool hasWindowGravity() const { | 946 | bool hasWindowGravity() const { | ||
916 | return testFlag(NormalHints::SizeHints::WindowGravity); | 947 | return testFlag(NormalHints::SizeHints::WindowGravity); | ||
917 | } | 948 | } | ||
918 | QSize maxSize() const { | 949 | QSize maxSize() const { | ||
919 | if (!hasMaxSize()) { | 950 | if (!hasMaxSize()) { | ||
920 | return QSize(INT_MAX, INT_MAX); | 951 | return QSize(INT_MAX, INT_MAX); | ||
921 | } | 952 | } | ||
922 | return QSize(qMax(m_sizeHints->maxWidth, 1), qMax(m_sizeHints->maxHeight, 1)); | 953 | return scK(QSize(qMax(m_sizeHints->maxWidth, 1), qMax(m_sizeHints->maxHeight, 1))); | ||
923 | } | 954 | } | ||
924 | QSize minSize() const { | 955 | QSize minSize() const { | ||
925 | if (!hasMinSize()) { | 956 | if (!hasMinSize()) { | ||
926 | // according to ICCCM 4.1.23 base size should be used as a fallback | 957 | // according to ICCCM 4.1.23 base size should be used as a fallback | ||
927 | return baseSize(); | 958 | return baseSize(); | ||
928 | } | 959 | } | ||
929 | return QSize(m_sizeHints->minWidth, m_sizeHints->minHeight); | 960 | return scK(QSize(m_sizeHints->minWidth, m_sizeHints->minHeight)); | ||
930 | } | 961 | } | ||
931 | QSize baseSize() const { | 962 | QSize baseSize() const { | ||
932 | // Note: not using minSize as fallback | 963 | // Note: not using minSize as fallback | ||
933 | if (!hasBaseSize()) { | 964 | if (!hasBaseSize()) { | ||
934 | return QSize(0, 0); | 965 | return QSize(0, 0); | ||
935 | } | 966 | } | ||
936 | return QSize(m_sizeHints->baseWidth, m_sizeHints->baseHeight); | 967 | return scK(QSize(m_sizeHints->baseWidth, m_sizeHints->baseHeight)); | ||
937 | } | 968 | } | ||
938 | QSize resizeIncrements() const { | 969 | QSize resizeIncrements() const { | ||
939 | if (!hasResizeIncrements()) { | 970 | if (!hasResizeIncrements()) { | ||
940 | return QSize(1, 1); | 971 | return QSize(1, 1); | ||
941 | } | 972 | } | ||
942 | return QSize(qMax(m_sizeHints->widthInc, 1), qMax(m_sizeHints->heightInc, 1)); | 973 | return scK(QSize(qMax(m_sizeHints->widthInc, 1), qMax(m_sizeHints->heightInc, 1))); | ||
943 | } | 974 | } | ||
944 | xcb_gravity_t windowGravity() const { | 975 | xcb_gravity_t windowGravity() const { | ||
945 | if (!hasWindowGravity()) { | 976 | if (!hasWindowGravity()) { | ||
946 | return XCB_GRAVITY_NORTH_WEST; | 977 | return XCB_GRAVITY_NORTH_WEST; | ||
947 | } | 978 | } | ||
948 | return xcb_gravity_t(m_sizeHints->winGravity); | 979 | return xcb_gravity_t(m_sizeHints->winGravity); | ||
949 | } | 980 | } | ||
950 | QSize minAspect() const { | 981 | QSize minAspect() const { | ||
951 | if (!hasAspect()) { | 982 | if (!hasAspect()) { | ||
952 | return QSize(1, INT_MAX); | 983 | return QSize(1, INT_MAX); | ||
953 | } | 984 | } | ||
954 | // prevent devision by zero | 985 | // prevent devision by zero | ||
955 | return QSize(m_sizeHints->minAspect[0], qMax(m_sizeHints->minAspect[1], 1)); | 986 | return scK(QSize(m_sizeHints->minAspect[0], qMax(m_sizeHints->minAspect[1], 1))); | ||
956 | } | 987 | } | ||
957 | QSize maxAspect() const { | 988 | QSize maxAspect() const { | ||
958 | if (!hasAspect()) { | 989 | if (!hasAspect()) { | ||
959 | return QSize(INT_MAX, 1); | 990 | return QSize(INT_MAX, 1); | ||
960 | } | 991 | } | ||
961 | // prevent devision by zero | 992 | // prevent devision by zero | ||
962 | return QSize(m_sizeHints->maxAspect[0], qMax(m_sizeHints->maxAspect[1], 1)); | 993 | return scK(QSize(m_sizeHints->maxAspect[0], qMax(m_sizeHints->maxAspect[1], 1))); | ||
963 | } | 994 | } | ||
964 | 995 | | |||
965 | private: | 996 | private: | ||
966 | /** | 997 | /** | ||
967 | * NormalHints as specified in ICCCM 4.1.2.3. | 998 | * NormalHints as specified in ICCCM 4.1.2.3. | ||
968 | */ | 999 | */ | ||
969 | class NormalHints : public Property | 1000 | class NormalHints : public Property | ||
970 | { | 1001 | { | ||
▲ Show 20 Lines • Show All 516 Lines • ▼ Show 20 Line(s) | |||||
1487 | { | 1518 | { | ||
1488 | create(geometry, XCB_COPY_FROM_PARENT, mask, values, parent); | 1519 | create(geometry, XCB_COPY_FROM_PARENT, mask, values, parent); | ||
1489 | } | 1520 | } | ||
1490 | 1521 | | |||
1491 | inline | 1522 | inline | ||
1492 | xcb_window_t Window::doCreate(const QRect &geometry, uint16_t windowClass, uint32_t mask, const uint32_t *values, xcb_window_t parent) | 1523 | xcb_window_t Window::doCreate(const QRect &geometry, uint16_t windowClass, uint32_t mask, const uint32_t *values, xcb_window_t parent) | ||
1493 | { | 1524 | { | ||
1494 | m_logicGeometry = geometry; | 1525 | m_logicGeometry = geometry; | ||
1526 | const QRect xGeo = scX(geometry); | ||||
1495 | xcb_window_t w = xcb_generate_id(connection()); | 1527 | xcb_window_t w = xcb_generate_id(connection()); | ||
1496 | xcb_create_window(connection(), XCB_COPY_FROM_PARENT, w, parent, | 1528 | xcb_create_window(connection(), XCB_COPY_FROM_PARENT, w, parent, | ||
1497 | geometry.x(), geometry.y(), geometry.width(), geometry.height(), | 1529 | xGeo.x(), xGeo.y(), xGeo.width(), xGeo.height(), | ||
1498 | 0, windowClass, XCB_COPY_FROM_PARENT, mask, values); | 1530 | 0, windowClass, XCB_COPY_FROM_PARENT, mask, values); | ||
1499 | return w; | 1531 | return w; | ||
1500 | } | 1532 | } | ||
1501 | 1533 | | |||
1502 | inline | 1534 | inline | ||
1503 | void Window::reset(xcb_window_t window, bool shouldDestroy) | 1535 | void Window::reset(xcb_window_t window, bool shouldDestroy) | ||
1504 | { | 1536 | { | ||
1505 | destroy(); | 1537 | destroy(); | ||
Show All 10 Lines | |||||
1516 | inline | 1548 | inline | ||
1517 | void Window::setGeometry(uint32_t x, uint32_t y, uint32_t width, uint32_t height) | 1549 | void Window::setGeometry(uint32_t x, uint32_t y, uint32_t width, uint32_t height) | ||
1518 | { | 1550 | { | ||
1519 | m_logicGeometry.setRect(x, y, width, height); | 1551 | m_logicGeometry.setRect(x, y, width, height); | ||
1520 | if (!isValid()) { | 1552 | if (!isValid()) { | ||
1521 | return; | 1553 | return; | ||
1522 | } | 1554 | } | ||
1523 | const uint16_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; | 1555 | const uint16_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; | ||
1524 | const uint32_t values[] = { x, y, width, height }; | 1556 | const uint32_t values[] = {scX(x), scX(y), scX(width), scX(height) }; | ||
1525 | xcb_configure_window(connection(), m_window, mask, values); | 1557 | xcb_configure_window(connection(), m_window, mask, values); | ||
1526 | } | 1558 | } | ||
1527 | 1559 | | |||
1528 | inline | 1560 | inline | ||
1529 | void Window::move(const QPoint &pos) | 1561 | void Window::move(const QPoint &pos) | ||
1530 | { | 1562 | { | ||
1531 | move(pos.x(), pos.y()); | 1563 | move(pos.x(), pos.y()); | ||
1532 | } | 1564 | } | ||
Show All 17 Lines | |||||
1550 | inline | 1582 | inline | ||
1551 | void Window::resize(uint32_t width, uint32_t height) | 1583 | void Window::resize(uint32_t width, uint32_t height) | ||
1552 | { | 1584 | { | ||
1553 | m_logicGeometry.setSize(QSize(width, height)); | 1585 | m_logicGeometry.setSize(QSize(width, height)); | ||
1554 | if (!isValid()) { | 1586 | if (!isValid()) { | ||
1555 | return; | 1587 | return; | ||
1556 | } | 1588 | } | ||
1557 | const uint16_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; | 1589 | const uint16_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; | ||
1558 | const uint32_t values[] = { width, height }; | 1590 | const uint32_t values[] = { scX(width), scX(height) }; | ||
1559 | xcb_configure_window(connection(), m_window, mask, values); | 1591 | xcb_configure_window(connection(), m_window, mask, values); | ||
1560 | } | 1592 | } | ||
1561 | 1593 | | |||
1562 | inline | 1594 | inline | ||
1563 | void Window::raise() | 1595 | void Window::raise() | ||
1564 | { | 1596 | { | ||
1565 | const uint32_t values[] = { XCB_STACK_MODE_ABOVE }; | 1597 | const uint32_t values[] = { XCB_STACK_MODE_ABOVE }; | ||
1566 | xcb_configure_window(connection(), m_window, XCB_CONFIG_WINDOW_STACK_MODE, values); | 1598 | xcb_configure_window(connection(), m_window, XCB_CONFIG_WINDOW_STACK_MODE, values); | ||
Show All 24 Lines | |||||
1591 | } | 1623 | } | ||
1592 | 1624 | | |||
1593 | inline | 1625 | inline | ||
1594 | void Window::reparent(xcb_window_t parent, int x, int y) | 1626 | void Window::reparent(xcb_window_t parent, int x, int y) | ||
1595 | { | 1627 | { | ||
1596 | if (!isValid()) { | 1628 | if (!isValid()) { | ||
1597 | return; | 1629 | return; | ||
1598 | } | 1630 | } | ||
1599 | xcb_reparent_window(connection(), m_window, parent, x, y); | 1631 | xcb_reparent_window(connection(), m_window, parent, scX(x), scX(y)); | ||
1600 | } | 1632 | } | ||
1601 | 1633 | | |||
1602 | inline | 1634 | inline | ||
1603 | void Window::changeProperty(xcb_atom_t property, xcb_atom_t type, uint8_t format, uint32_t length, const void *data, uint8_t mode) | 1635 | void Window::changeProperty(xcb_atom_t property, xcb_atom_t type, uint8_t format, uint32_t length, const void *data, uint8_t mode) | ||
1604 | { | 1636 | { | ||
1605 | if (!isValid()) { | 1637 | if (!isValid()) { | ||
1606 | return; | 1638 | return; | ||
1607 | } | 1639 | } | ||
Show All 10 Lines | |||||
1618 | } | 1650 | } | ||
1619 | 1651 | | |||
1620 | inline | 1652 | inline | ||
1621 | void Window::setBorderWidth(uint32_t width) | 1653 | void Window::setBorderWidth(uint32_t width) | ||
1622 | { | 1654 | { | ||
1623 | if (!isValid()) { | 1655 | if (!isValid()) { | ||
1624 | return; | 1656 | return; | ||
1625 | } | 1657 | } | ||
1658 | width = scX(width); | ||||
1626 | xcb_configure_window(connection(), m_window, XCB_CONFIG_WINDOW_BORDER_WIDTH, &width); | 1659 | xcb_configure_window(connection(), m_window, XCB_CONFIG_WINDOW_BORDER_WIDTH, &width); | ||
1627 | } | 1660 | } | ||
1628 | 1661 | | |||
1629 | inline | 1662 | inline | ||
1630 | void Window::grabButton(uint8_t pointerMode, uint8_t keyboardmode, uint16_t modifiers, | 1663 | void Window::grabButton(uint8_t pointerMode, uint8_t keyboardmode, uint16_t modifiers, | ||
1631 | uint8_t button, uint16_t eventMask, xcb_window_t confineTo, | 1664 | uint8_t button, uint16_t eventMask, xcb_window_t confineTo, | ||
1632 | xcb_cursor_t cursor, bool ownerEvents) | 1665 | xcb_cursor_t cursor, bool ownerEvents) | ||
1633 | { | 1666 | { | ||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | |||||
1688 | void Window::kill() | 1721 | void Window::kill() | ||
1689 | { | 1722 | { | ||
1690 | xcb_kill_client(connection(), m_window); | 1723 | xcb_kill_client(connection(), m_window); | ||
1691 | } | 1724 | } | ||
1692 | 1725 | | |||
1693 | // helper functions | 1726 | // helper functions | ||
1694 | static inline void moveResizeWindow(WindowId window, const QRect &geometry) | 1727 | static inline void moveResizeWindow(WindowId window, const QRect &geometry) | ||
1695 | { | 1728 | { | ||
1729 | QRect xGeo = scX(geometry); | ||||
1696 | const uint16_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; | 1730 | const uint16_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; | ||
1697 | const uint32_t values[] = { | 1731 | const uint32_t values[] = { | ||
1698 | static_cast<uint32_t>(geometry.x()), | 1732 | static_cast<uint32_t>(xGeo.x()), | ||
1699 | static_cast<uint32_t>(geometry.y()), | 1733 | static_cast<uint32_t>(xGeo.y()), | ||
1700 | static_cast<uint32_t>(geometry.width()), | 1734 | static_cast<uint32_t>(xGeo.width()), | ||
1701 | static_cast<uint32_t>(geometry.height()) | 1735 | static_cast<uint32_t>(xGeo.height()) | ||
1702 | }; | 1736 | }; | ||
1703 | xcb_configure_window(connection(), window, mask, values); | 1737 | xcb_configure_window(connection(), window, mask, values); | ||
1704 | } | 1738 | } | ||
1705 | 1739 | | |||
1706 | static inline void moveWindow(xcb_window_t window, const QPoint& pos) | 1740 | static inline void moveWindow(xcb_window_t window, const QPoint& pos) | ||
1707 | { | 1741 | { | ||
1708 | moveWindow(window, pos.x(), pos.y()); | 1742 | moveWindow(window, pos.x(), pos.y()); | ||
1709 | } | 1743 | } | ||
1710 | 1744 | | |||
1711 | static inline void moveWindow(xcb_window_t window, uint32_t x, uint32_t y) | 1745 | static inline void moveWindow(xcb_window_t window, uint32_t x, uint32_t y) | ||
1712 | { | 1746 | { | ||
1713 | const uint16_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; | 1747 | const uint16_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; | ||
1714 | const uint32_t values[] = { x, y }; | 1748 | const uint32_t values[] = { scX(x), scX(y) }; | ||
1715 | xcb_configure_window(connection(), window, mask, values); | 1749 | xcb_configure_window(connection(), window, mask, values); | ||
1716 | } | 1750 | } | ||
1717 | 1751 | | |||
1718 | static inline void lowerWindow(xcb_window_t window) | 1752 | static inline void lowerWindow(xcb_window_t window) | ||
1719 | { | 1753 | { | ||
1720 | const uint32_t values[] = { XCB_STACK_MODE_BELOW }; | 1754 | const uint32_t values[] = { XCB_STACK_MODE_BELOW }; | ||
1721 | xcb_configure_window(connection(), window, XCB_CONFIG_WINDOW_STACK_MODE, values); | 1755 | xcb_configure_window(connection(), window, XCB_CONFIG_WINDOW_STACK_MODE, values); | ||
1722 | } | 1756 | } | ||
1723 | 1757 | | |||
1724 | static inline WindowId createInputWindow(const QRect &geometry, uint32_t mask, const uint32_t *values) | 1758 | static inline WindowId createInputWindow(const QRect &geometry, uint32_t mask, const uint32_t *values) | ||
1725 | { | 1759 | { | ||
1760 | const QRect xGeo = scX(geometry); | ||||
1726 | WindowId window = xcb_generate_id(connection()); | 1761 | WindowId window = xcb_generate_id(connection()); | ||
1727 | xcb_create_window(connection(), 0, window, rootWindow(), | 1762 | xcb_create_window(connection(), 0, window, rootWindow(), | ||
1728 | geometry.x(), geometry.y(), geometry.width(), geometry.height(), | 1763 | xGeo.x(), xGeo.y(), xGeo.width(), xGeo.height(), | ||
1729 | 0, XCB_WINDOW_CLASS_INPUT_ONLY, | 1764 | 0, XCB_WINDOW_CLASS_INPUT_ONLY, | ||
1730 | XCB_COPY_FROM_PARENT, mask, values); | 1765 | XCB_COPY_FROM_PARENT, mask, values); | ||
1731 | return window; | 1766 | return window; | ||
1732 | } | 1767 | } | ||
1733 | 1768 | | |||
1734 | static inline void restackWindows(const QVector<xcb_window_t> &windows) | 1769 | static inline void restackWindows(const QVector<xcb_window_t> &windows) | ||
1735 | { | 1770 | { | ||
1736 | if (windows.count() < 2) { | 1771 | if (windows.count() < 2) { | ||
Show All 35 Lines | 1805 | if (screen == 0) { | |||
1772 | break; | 1807 | break; | ||
1773 | } | 1808 | } | ||
1774 | } | 1809 | } | ||
1775 | return depth; | 1810 | return depth; | ||
1776 | } | 1811 | } | ||
1777 | 1812 | | |||
1778 | static inline xcb_rectangle_t fromQt(const QRect &rect) | 1813 | static inline xcb_rectangle_t fromQt(const QRect &rect) | ||
1779 | { | 1814 | { | ||
1815 | const QRect rectSc = scX(rect); | ||||
zzag: Please follow coding style. | |||||
1780 | xcb_rectangle_t rectangle; | 1816 | xcb_rectangle_t rectangle; | ||
1781 | rectangle.x = rect.x(); | 1817 | rectangle.x = rectSc.x(); | ||
1782 | rectangle.y = rect.y(); | 1818 | rectangle.y = rectSc.y(); | ||
1783 | rectangle.width = rect.width(); | 1819 | rectangle.width = rectSc.width(); | ||
1784 | rectangle.height = rect.height(); | 1820 | rectangle.height = rectSc.height(); | ||
1785 | return rectangle; | 1821 | return rectangle; | ||
1786 | } | 1822 | } | ||
1787 | 1823 | | |||
1788 | static inline QVector<xcb_rectangle_t> regionToRects(const QRegion ®ion) | 1824 | static inline QVector<xcb_rectangle_t> regionToRects(const QRegion ®ion) | ||
1789 | { | 1825 | { | ||
1790 | QVector<xcb_rectangle_t> rects; | 1826 | QVector<xcb_rectangle_t> rects; | ||
1791 | rects.reserve(region.rectCount()); | 1827 | rects.reserve(region.rectCount()); | ||
1792 | for (const QRect &rect : region) { | 1828 | for (const QRect &rect : region) { | ||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |
It will return a wrong value if qreal is passed.