Changeset View
Changeset View
Standalone View
Standalone View
geometry.cpp
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | |||||
68 | /** | 68 | /** | ||
69 | * Resizes the workspace after an XRANDR screen size change | 69 | * Resizes the workspace after an XRANDR screen size change | ||
70 | */ | 70 | */ | ||
71 | void Workspace::desktopResized() | 71 | void Workspace::desktopResized() | ||
72 | { | 72 | { | ||
73 | QRect geom = screens()->geometry(); | 73 | QRect geom = screens()->geometry(); | ||
74 | if (rootInfo()) { | 74 | if (rootInfo()) { | ||
75 | NETSize desktop_geometry; | 75 | NETSize desktop_geometry; | ||
76 | desktop_geometry.width = geom.width(); | 76 | desktop_geometry.width = Xcb::scX(geom.width()); | ||
77 | desktop_geometry.height = geom.height(); | 77 | desktop_geometry.height = Xcb::scX(geom.height()); | ||
78 | rootInfo()->setDesktopGeometry(desktop_geometry); | 78 | rootInfo()->setDesktopGeometry(desktop_geometry); | ||
79 | } | 79 | } | ||
80 | 80 | | |||
81 | updateClientArea(); | 81 | updateClientArea(); | ||
82 | saveOldScreenSizes(); // after updateClientArea(), so that one still uses the previous one | 82 | saveOldScreenSizes(); // after updateClientArea(), so that one still uses the previous one | ||
83 | 83 | | |||
84 | // TODO: emit a signal instead and remove the deep function calls into edges and effects | 84 | // TODO: emit a signal instead and remove the deep function calls into edges and effects | ||
85 | ScreenEdges::self()->recreateEdges(); | 85 | ScreenEdges::self()->recreateEdges(); | ||
▲ Show 20 Lines • Show All 219 Lines • ▼ Show 20 Line(s) | 282 | #endif | |||
305 | if (changed) { | 305 | if (changed) { | ||
306 | workarea = new_wareas; | 306 | workarea = new_wareas; | ||
307 | oldrestrictedmovearea = restrictedmovearea; | 307 | oldrestrictedmovearea = restrictedmovearea; | ||
308 | restrictedmovearea = new_rmoveareas; | 308 | restrictedmovearea = new_rmoveareas; | ||
309 | screenarea = new_sareas; | 309 | screenarea = new_sareas; | ||
310 | if (rootInfo()) { | 310 | if (rootInfo()) { | ||
311 | NETRect r; | 311 | NETRect r; | ||
312 | for (int i = 1; i <= numberOfDesktops; i++) { | 312 | for (int i = 1; i <= numberOfDesktops; i++) { | ||
313 | r.pos.x = workarea[ i ].x(); | 313 | const QRect xWorkarea = Xcb::scX(workarea[i]); | ||
314 | r.pos.y = workarea[ i ].y(); | 314 | r.pos.x = xWorkarea.x(); | ||
315 | r.size.width = workarea[ i ].width(); | 315 | r.pos.y = xWorkarea.y(); | ||
316 | r.size.height = workarea[ i ].height(); | 316 | r.size.width = xWorkarea.width(); | ||
317 | r.size.height = xWorkarea.height(); | ||||
317 | rootInfo()->setWorkArea(i, r); | 318 | rootInfo()->setWorkArea(i, r); | ||
318 | } | 319 | } | ||
319 | } | 320 | } | ||
320 | 321 | | |||
321 | for (auto it = m_allClients.constBegin(); | 322 | for (auto it = m_allClients.constBegin(); | ||
322 | it != m_allClients.constEnd(); | 323 | it != m_allClients.constEnd(); | ||
323 | ++it) | 324 | ++it) | ||
324 | (*it)->checkWorkspacePosition(); | 325 | (*it)->checkWorkspacePosition(); | ||
▲ Show 20 Lines • Show All 568 Lines • ▼ Show 20 Line(s) | |||||
893 | { | 894 | { | ||
894 | NETWinInfo i(connection(), w, rootWindow(), NET::WMFrameExtents, NET::Properties2()); | 895 | NETWinInfo i(connection(), w, rootWindow(), NET::WMFrameExtents, NET::Properties2()); | ||
895 | NETStrut frame = i.frameExtents(); | 896 | NETStrut frame = i.frameExtents(); | ||
896 | 897 | | |||
897 | if (frame.left != 0 || frame.top != 0) { | 898 | if (frame.left != 0 || frame.top != 0) { | ||
898 | // left and top needed due to narrowing conversations restrictions in C++11 | 899 | // left and top needed due to narrowing conversations restrictions in C++11 | ||
899 | const uint32_t left = frame.left; | 900 | const uint32_t left = frame.left; | ||
900 | const uint32_t top = frame.top; | 901 | const uint32_t top = frame.top; | ||
901 | const uint32_t values[] = { geometry->x - left, geometry->y - top }; | 902 | const uint32_t values[] = { Xcb::scX(geometry->x - left), Xcb::scX(geometry->y - top) }; | ||
902 | xcb_configure_window(connection(), w, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values); | 903 | xcb_configure_window(connection(), w, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values); | ||
903 | } | 904 | } | ||
904 | } | 905 | } | ||
905 | 906 | | |||
906 | //******************************************** | 907 | //******************************************** | ||
907 | // Client | 908 | // Client | ||
908 | //******************************************** | 909 | //******************************************** | ||
909 | 910 | | |||
▲ Show 20 Lines • Show All 658 Lines • ▼ Show 20 Line(s) | |||||
1568 | */ | 1569 | */ | ||
1569 | void Client::sendSyntheticConfigureNotify() | 1570 | void Client::sendSyntheticConfigureNotify() | ||
1570 | { | 1571 | { | ||
1571 | xcb_configure_notify_event_t c; | 1572 | xcb_configure_notify_event_t c; | ||
1572 | memset(&c, 0, sizeof(c)); | 1573 | memset(&c, 0, sizeof(c)); | ||
1573 | c.response_type = XCB_CONFIGURE_NOTIFY; | 1574 | c.response_type = XCB_CONFIGURE_NOTIFY; | ||
1574 | c.event = window(); | 1575 | c.event = window(); | ||
1575 | c.window = window(); | 1576 | c.window = window(); | ||
1576 | c.x = x() + clientPos().x(); | 1577 | c.x = Xcb::scX(x() + clientPos().x()); | ||
1577 | c.y = y() + clientPos().y(); | 1578 | c.y = Xcb::scX(y() + clientPos().y()); | ||
1578 | c.width = clientSize().width(); | 1579 | c.width = Xcb::scX(clientSize().width()); | ||
1579 | c.height = clientSize().height(); | 1580 | c.height = Xcb::scX(clientSize().height()); | ||
1580 | c.border_width = 0; | 1581 | c.border_width = 0; | ||
1581 | c.above_sibling = XCB_WINDOW_NONE; | 1582 | c.above_sibling = XCB_WINDOW_NONE; | ||
1582 | c.override_redirect = 0; | 1583 | c.override_redirect = 0; | ||
1583 | xcb_send_event(connection(), true, c.event, XCB_EVENT_MASK_STRUCTURE_NOTIFY, reinterpret_cast<const char*>(&c)); | 1584 | xcb_send_event(connection(), true, c.event, XCB_EVENT_MASK_STRUCTURE_NOTIFY, reinterpret_cast<const char*>(&c)); | ||
1584 | xcb_flush(connection()); | 1585 | xcb_flush(connection()); | ||
1585 | } | 1586 | } | ||
1586 | 1587 | | |||
1587 | const QPoint Client::calculateGravitation(bool invert, int gravity) const | 1588 | const QPoint Client::calculateGravitation(bool invert, int gravity) const | ||
▲ Show 20 Lines • Show All 989 Lines • ▼ Show 20 Line(s) | |||||
2577 | 2578 | | |||
2578 | bool Client::doStartMoveResize() | 2579 | bool Client::doStartMoveResize() | ||
2579 | { | 2580 | { | ||
2580 | bool has_grab = false; | 2581 | bool has_grab = false; | ||
2581 | // This reportedly improves smoothness of the moveresize operation, | 2582 | // This reportedly improves smoothness of the moveresize operation, | ||
2582 | // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* | 2583 | // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* | ||
2583 | // (https://lists.kde.org/?t=107302193400001&r=1&w=2) | 2584 | // (https://lists.kde.org/?t=107302193400001&r=1&w=2) | ||
2584 | QRect r = workspace()->clientArea(FullArea, this); | 2585 | QRect r = workspace()->clientArea(FullArea, this); | ||
2585 | m_moveResizeGrabWindow.create(r, XCB_WINDOW_CLASS_INPUT_ONLY, 0, nullptr, rootWindow()); | 2586 | m_moveResizeGrabWindow.create(Xcb::scX(r), XCB_WINDOW_CLASS_INPUT_ONLY, 0, nullptr, rootWindow()); | ||
2586 | m_moveResizeGrabWindow.map(); | 2587 | m_moveResizeGrabWindow.map(); | ||
2587 | m_moveResizeGrabWindow.raise(); | 2588 | m_moveResizeGrabWindow.raise(); | ||
2588 | updateXTime(); | 2589 | updateXTime(); | ||
2589 | const xcb_grab_pointer_cookie_t cookie = xcb_grab_pointer_unchecked(connection(), false, m_moveResizeGrabWindow, | 2590 | const xcb_grab_pointer_cookie_t cookie = xcb_grab_pointer_unchecked(connection(), false, m_moveResizeGrabWindow, | ||
2590 | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | | 2591 | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | | ||
2591 | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, | 2592 | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, | ||
2592 | XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, m_moveResizeGrabWindow, Cursor::x11Cursor(cursor()), xTime()); | 2593 | XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, m_moveResizeGrabWindow, Cursor::x11Cursor(cursor()), xTime()); | ||
2593 | ScopedCPointer<xcb_grab_pointer_reply_t> pointerGrab(xcb_grab_pointer_reply(connection(), cookie, nullptr)); | 2594 | ScopedCPointer<xcb_grab_pointer_reply_t> pointerGrab(xcb_grab_pointer_reply(connection(), cookie, nullptr)); | ||
▲ Show 20 Lines • Show All 800 Lines • Show Last 20 Lines |