Changeset View
Changeset View
Standalone View
Standalone View
geometry.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | |||||
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 = Xcb::scX(geom.width()); | ||
76 | desktop_geometry.height = geom.height(); | 76 | desktop_geometry.height = Xcb::scX(geom.height()); | ||
77 | rootInfo()->setDesktopGeometry(desktop_geometry); | 77 | rootInfo()->setDesktopGeometry(desktop_geometry); | ||
78 | } | 78 | } | ||
79 | 79 | | |||
80 | updateClientArea(); | 80 | updateClientArea(); | ||
81 | saveOldScreenSizes(); // after updateClientArea(), so that one still uses the previous one | 81 | saveOldScreenSizes(); // after updateClientArea(), so that one still uses the previous one | ||
82 | 82 | | |||
83 | // TODO: emit a signal instead and remove the deep function calls into edges and effects | 83 | // TODO: emit a signal instead and remove the deep function calls into edges and effects | ||
84 | ScreenEdges::self()->recreateEdges(); | 84 | ScreenEdges::self()->recreateEdges(); | ||
▲ Show 20 Lines • Show All 224 Lines • ▼ Show 20 Line(s) | 286 | #endif | |||
309 | if (changed) { | 309 | if (changed) { | ||
310 | workarea = new_wareas; | 310 | workarea = new_wareas; | ||
311 | oldrestrictedmovearea = restrictedmovearea; | 311 | oldrestrictedmovearea = restrictedmovearea; | ||
312 | restrictedmovearea = new_rmoveareas; | 312 | restrictedmovearea = new_rmoveareas; | ||
313 | screenarea = new_sareas; | 313 | screenarea = new_sareas; | ||
314 | if (rootInfo()) { | 314 | if (rootInfo()) { | ||
315 | NETRect r; | 315 | NETRect r; | ||
316 | for (int i = 1; i <= numberOfDesktops; i++) { | 316 | for (int i = 1; i <= numberOfDesktops; i++) { | ||
317 | r.pos.x = workarea[ i ].x(); | 317 | const QRect xWorkarea = Xcb::scX(workarea[i]); | ||
318 | r.pos.y = workarea[ i ].y(); | 318 | r.pos.x = xWorkarea.x(); | ||
319 | r.size.width = workarea[ i ].width(); | 319 | r.pos.y = xWorkarea.y(); | ||
320 | r.size.height = workarea[ i ].height(); | 320 | r.size.width = xWorkarea.width(); | ||
321 | r.size.height = xWorkarea.height(); | ||||
321 | rootInfo()->setWorkArea(i, r); | 322 | rootInfo()->setWorkArea(i, r); | ||
322 | } | 323 | } | ||
323 | } | 324 | } | ||
324 | 325 | | |||
325 | for (auto it = m_allClients.constBegin(); | 326 | for (auto it = m_allClients.constBegin(); | ||
326 | it != m_allClients.constEnd(); | 327 | it != m_allClients.constEnd(); | ||
327 | ++it) | 328 | ++it) | ||
328 | (*it)->checkWorkspacePosition(); | 329 | (*it)->checkWorkspacePosition(); | ||
▲ Show 20 Lines • Show All 577 Lines • ▼ Show 20 Line(s) | |||||
906 | { | 907 | { | ||
907 | NETWinInfo i(connection(), w, rootWindow(), NET::WMFrameExtents, 0); | 908 | NETWinInfo i(connection(), w, rootWindow(), NET::WMFrameExtents, 0); | ||
908 | NETStrut frame = i.frameExtents(); | 909 | NETStrut frame = i.frameExtents(); | ||
909 | 910 | | |||
910 | if (frame.left != 0 || frame.top != 0) { | 911 | if (frame.left != 0 || frame.top != 0) { | ||
911 | // left and top needed due to narrowing conversations restrictions in C++11 | 912 | // left and top needed due to narrowing conversations restrictions in C++11 | ||
912 | const uint32_t left = frame.left; | 913 | const uint32_t left = frame.left; | ||
913 | const uint32_t top = frame.top; | 914 | const uint32_t top = frame.top; | ||
914 | const uint32_t values[] = { geometry->x - left, geometry->y - top }; | 915 | const uint32_t values[] = { Xcb::scX(geometry->x - left), Xcb::scX(geometry->y - top) }; | ||
915 | xcb_configure_window(connection(), w, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values); | 916 | xcb_configure_window(connection(), w, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values); | ||
916 | } | 917 | } | ||
917 | } | 918 | } | ||
918 | 919 | | |||
919 | //******************************************** | 920 | //******************************************** | ||
920 | // Client | 921 | // Client | ||
921 | //******************************************** | 922 | //******************************************** | ||
922 | 923 | | |||
▲ Show 20 Lines • Show All 672 Lines • ▼ Show 20 Line(s) | |||||
1595 | */ | 1596 | */ | ||
1596 | void Client::sendSyntheticConfigureNotify() | 1597 | void Client::sendSyntheticConfigureNotify() | ||
1597 | { | 1598 | { | ||
1598 | xcb_configure_notify_event_t c; | 1599 | xcb_configure_notify_event_t c; | ||
1599 | memset(&c, 0, sizeof(c)); | 1600 | memset(&c, 0, sizeof(c)); | ||
1600 | c.response_type = XCB_CONFIGURE_NOTIFY; | 1601 | c.response_type = XCB_CONFIGURE_NOTIFY; | ||
1601 | c.event = window(); | 1602 | c.event = window(); | ||
1602 | c.window = window(); | 1603 | c.window = window(); | ||
1603 | c.x = x() + clientPos().x(); | 1604 | c.x = Xcb::scX(x() + clientPos().x()); | ||
1604 | c.y = y() + clientPos().y(); | 1605 | c.y = Xcb::scX(y() + clientPos().y()); | ||
1605 | c.width = clientSize().width(); | 1606 | c.width = Xcb::scX(clientSize().width()); | ||
1606 | c.height = clientSize().height(); | 1607 | c.height = Xcb::scX(clientSize().height()); | ||
1607 | c.border_width = 0; | 1608 | c.border_width = 0; | ||
1608 | c.above_sibling = XCB_WINDOW_NONE; | 1609 | c.above_sibling = XCB_WINDOW_NONE; | ||
1609 | c.override_redirect = 0; | 1610 | c.override_redirect = 0; | ||
1610 | xcb_send_event(connection(), true, c.event, XCB_EVENT_MASK_STRUCTURE_NOTIFY, reinterpret_cast<const char*>(&c)); | 1611 | xcb_send_event(connection(), true, c.event, XCB_EVENT_MASK_STRUCTURE_NOTIFY, reinterpret_cast<const char*>(&c)); | ||
1611 | xcb_flush(connection()); | 1612 | xcb_flush(connection()); | ||
1612 | } | 1613 | } | ||
1613 | 1614 | | |||
1614 | const QPoint Client::calculateGravitation(bool invert, int gravity) const | 1615 | const QPoint Client::calculateGravitation(bool invert, int gravity) const | ||
▲ Show 20 Lines • Show All 1102 Lines • ▼ Show 20 Line(s) | |||||
2717 | 2718 | | |||
2718 | bool Client::doStartMoveResize() | 2719 | bool Client::doStartMoveResize() | ||
2719 | { | 2720 | { | ||
2720 | bool has_grab = false; | 2721 | bool has_grab = false; | ||
2721 | // This reportedly improves smoothness of the moveresize operation, | 2722 | // This reportedly improves smoothness of the moveresize operation, | ||
2722 | // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* | 2723 | // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* | ||
2723 | // (http://lists.kde.org/?t=107302193400001&r=1&w=2) | 2724 | // (http://lists.kde.org/?t=107302193400001&r=1&w=2) | ||
2724 | QRect r = workspace()->clientArea(FullArea, this); | 2725 | QRect r = workspace()->clientArea(FullArea, this); | ||
2725 | m_moveResizeGrabWindow.create(r, XCB_WINDOW_CLASS_INPUT_ONLY, 0, NULL, rootWindow()); | 2726 | m_moveResizeGrabWindow.create(Xcb::scX(r), XCB_WINDOW_CLASS_INPUT_ONLY, 0, NULL, rootWindow()); | ||
2726 | m_moveResizeGrabWindow.map(); | 2727 | m_moveResizeGrabWindow.map(); | ||
2727 | m_moveResizeGrabWindow.raise(); | 2728 | m_moveResizeGrabWindow.raise(); | ||
2728 | updateXTime(); | 2729 | updateXTime(); | ||
2729 | const xcb_grab_pointer_cookie_t cookie = xcb_grab_pointer_unchecked(connection(), false, m_moveResizeGrabWindow, | 2730 | const xcb_grab_pointer_cookie_t cookie = xcb_grab_pointer_unchecked(connection(), false, m_moveResizeGrabWindow, | ||
2730 | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | | 2731 | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | | ||
2731 | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, | 2732 | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, | ||
2732 | XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, m_moveResizeGrabWindow, Cursor::x11Cursor(cursor()), xTime()); | 2733 | XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, m_moveResizeGrabWindow, Cursor::x11Cursor(cursor()), xTime()); | ||
2733 | ScopedCPointer<xcb_grab_pointer_reply_t> pointerGrab(xcb_grab_pointer_reply(connection(), cookie, NULL)); | 2734 | ScopedCPointer<xcb_grab_pointer_reply_t> pointerGrab(xcb_grab_pointer_reply(connection(), cookie, NULL)); | ||
▲ Show 20 Lines • Show All 806 Lines • Show Last 20 Lines |