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 "atoms.h" | ||||
30 | #include "x11client.h" | 31 | #include "x11client.h" | ||
31 | #include "composite.h" | 32 | #include "composite.h" | ||
32 | #include "cursor.h" | 33 | #include "cursor.h" | ||
33 | #include "netinfo.h" | 34 | #include "netinfo.h" | ||
34 | #include "workspace.h" | 35 | #include "workspace.h" | ||
35 | 36 | | |||
36 | #include "placement.h" | 37 | #include "placement.h" | ||
37 | #include "geometrytip.h" | 38 | #include "geometrytip.h" | ||
▲ Show 20 Lines • Show All 1533 Lines • ▼ Show 20 Line(s) | |||||
1571 | { | 1572 | { | ||
1572 | xcb_configure_notify_event_t c; | 1573 | xcb_configure_notify_event_t c; | ||
1573 | memset(&c, 0, sizeof(c)); | 1574 | memset(&c, 0, sizeof(c)); | ||
1574 | c.response_type = XCB_CONFIGURE_NOTIFY; | 1575 | c.response_type = XCB_CONFIGURE_NOTIFY; | ||
1575 | c.event = window(); | 1576 | c.event = window(); | ||
1576 | c.window = window(); | 1577 | c.window = window(); | ||
1577 | c.x = m_clientGeometry.x(); | 1578 | c.x = m_clientGeometry.x(); | ||
1578 | c.y = m_clientGeometry.y(); | 1579 | c.y = m_clientGeometry.y(); | ||
1580 | | ||||
1581 | auto getEmulatedXWaylandSize = [this]() { | ||||
1582 | auto property = Xcb::Property(false, window(), | ||||
1583 | atoms->xwayland_randr_emu_monitor_rects, XCB_ATOM_CARDINAL, | ||||
1584 | 0, 1000); | ||||
1585 | if (!property) { | ||||
1586 | return QSize(); | ||||
1587 | } | ||||
1588 | uint32_t *rects = property.value<uint32_t*>(); | ||||
1589 | | ||||
1590 | if (property->value_len % 4) { | ||||
1591 | return QSize(); | ||||
1592 | } | ||||
1593 | | ||||
1594 | for (uint32_t i = 0; i < property->value_len / 4; i++) { | ||||
1595 | uint32_t *r = &rects[i]; | ||||
1596 | if (r[0] - m_clientGeometry.x() == 0 && r[1] - m_clientGeometry.y() == 0) { | ||||
1597 | return QSize(r[2], r[3]); | ||||
1598 | } | ||||
1599 | } | ||||
1600 | return QSize(); | ||||
1601 | }; | ||||
1602 | | ||||
1579 | c.width = m_clientGeometry.width(); | 1603 | c.width = m_clientGeometry.width(); | ||
1580 | c.height = m_clientGeometry.height(); | 1604 | c.height = m_clientGeometry.height(); | ||
1605 | | ||||
1606 | if (isFullScreen()) { | ||||
1607 | // Workaround for XWayland clients setting fullscreen | ||||
1608 | const QSize emulatedSize = getEmulatedXWaylandSize(); | ||||
1609 | if (emulatedSize.isValid()) { | ||||
1610 | c.width = emulatedSize.width(); | ||||
1611 | c.height = emulatedSize.height(); | ||||
1612 | const uint32_t values[] = { c.width, c.height }; | ||||
1613 | ScopedCPointer<xcb_generic_error_t> error(xcb_request_check(connection(), | ||||
1614 | xcb_configure_window_checked(connection(), c.window, | ||||
1615 | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, | ||||
1616 | values))); | ||||
1617 | if (!error.isNull()) { | ||||
1618 | qCDebug(KWIN_CORE) << "Error on emulating XWayland size: " << error->error_code; | ||||
1619 | } | ||||
1620 | } | ||||
1621 | } | ||||
1622 | | ||||
1581 | c.border_width = 0; | 1623 | c.border_width = 0; | ||
1582 | c.above_sibling = XCB_WINDOW_NONE; | 1624 | c.above_sibling = XCB_WINDOW_NONE; | ||
1583 | c.override_redirect = 0; | 1625 | c.override_redirect = 0; | ||
1584 | xcb_send_event(connection(), true, c.event, XCB_EVENT_MASK_STRUCTURE_NOTIFY, reinterpret_cast<const char*>(&c)); | 1626 | xcb_send_event(connection(), true, c.event, XCB_EVENT_MASK_STRUCTURE_NOTIFY, reinterpret_cast<const char*>(&c)); | ||
1585 | xcb_flush(connection()); | 1627 | xcb_flush(connection()); | ||
1586 | } | 1628 | } | ||
1587 | 1629 | | |||
1588 | QPoint X11Client::gravityAdjustment(xcb_gravity_t gravity) const | 1630 | QPoint X11Client::gravityAdjustment(xcb_gravity_t gravity) const | ||
▲ Show 20 Lines • Show All 1818 Lines • Show Last 20 Lines |