Changeset View
Changeset View
Standalone View
Standalone View
geometry.cpp
Show First 20 Lines • Show All 890 Lines • ▼ Show 20 Line(s) | 890 | else | |||
---|---|---|---|---|---|
891 | --block_focus; | 891 | --block_focus; | ||
892 | } | 892 | } | ||
893 | 893 | | |||
894 | // When kwin crashes, windows will not be gravitated back to their original position | 894 | // When kwin crashes, windows will not be gravitated back to their original position | ||
895 | // and will remain offset by the size of the decoration. So when restarting, fix this | 895 | // and will remain offset by the size of the decoration. So when restarting, fix this | ||
896 | // (the property with the size of the frame remains on the window after the crash). | 896 | // (the property with the size of the frame remains on the window after the crash). | ||
897 | void Workspace::fixPositionAfterCrash(xcb_window_t w, const xcb_get_geometry_reply_t *geometry) | 897 | void Workspace::fixPositionAfterCrash(xcb_window_t w, const xcb_get_geometry_reply_t *geometry) | ||
898 | { | 898 | { | ||
899 | NETWinInfo i(connection(), w, rootWindow(), NET::WMFrameExtents, 0); | 899 | NETWinInfo i(connection(), w, rootWindow(), NET::WMFrameExtents, nullptr); | ||
900 | NETStrut frame = i.frameExtents(); | 900 | NETStrut frame = i.frameExtents(); | ||
901 | 901 | | |||
902 | if (frame.left != 0 || frame.top != 0) { | 902 | if (frame.left != 0 || frame.top != 0) { | ||
903 | // left and top needed due to narrowing conversations restrictions in C++11 | 903 | // left and top needed due to narrowing conversations restrictions in C++11 | ||
904 | const uint32_t left = frame.left; | 904 | const uint32_t left = frame.left; | ||
905 | const uint32_t top = frame.top; | 905 | const uint32_t top = frame.top; | ||
906 | const uint32_t values[] = { geometry->x - left, geometry->y - top }; | 906 | const uint32_t values[] = { geometry->x - left, geometry->y - top }; | ||
907 | xcb_configure_window(connection(), w, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values); | 907 | xcb_configure_window(connection(), w, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values); | ||
▲ Show 20 Lines • Show All 1266 Lines • ▼ Show 20 Line(s) | 2173 | { | |||
2174 | syncNow(); | 2174 | syncNow(); | ||
2175 | } | 2175 | } | ||
2176 | void syncNow() | 2176 | void syncNow() | ||
2177 | { | 2177 | { | ||
2178 | if (m_client && m_client->tabGroup()) { | 2178 | if (m_client && m_client->tabGroup()) { | ||
2179 | m_client->tabGroup()->blockStateUpdates(false); | 2179 | m_client->tabGroup()->blockStateUpdates(false); | ||
2180 | m_client->tabGroup()->updateStates(dynamic_cast<Client*>(m_client), m_states); | 2180 | m_client->tabGroup()->updateStates(dynamic_cast<Client*>(m_client), m_states); | ||
2181 | } | 2181 | } | ||
2182 | m_client = 0; | 2182 | m_client = nullptr; | ||
2183 | } | 2183 | } | ||
2184 | private: | 2184 | private: | ||
2185 | AbstractClient *m_client; | 2185 | AbstractClient *m_client; | ||
2186 | TabGroup::States m_states; | 2186 | TabGroup::States m_states; | ||
2187 | }; | 2187 | }; | ||
2188 | 2188 | | |||
2189 | 2189 | | |||
2190 | static bool changeMaximizeRecursion = false; | 2190 | static bool changeMaximizeRecursion = false; | ||
▲ Show 20 Lines • Show All 355 Lines • ▼ Show 20 Line(s) | 2539 | { | |||
2546 | total = top.united(bottom.united(left.united(right))); | 2546 | total = top.united(bottom.united(left.united(right))); | ||
2547 | 2547 | | |||
2548 | // qDebug() << "top: " << top << " bottom: " << bottom | 2548 | // qDebug() << "top: " << top << " bottom: " << bottom | ||
2549 | // << " left: " << left << " right: " << right; | 2549 | // << " left: " << left << " right: " << right; | ||
2550 | // qDebug() << "returning rect: " << total; | 2550 | // qDebug() << "returning rect: " << total; | ||
2551 | return total; | 2551 | return total; | ||
2552 | } | 2552 | } | ||
2553 | 2553 | | |||
2554 | static GeometryTip* geometryTip = 0; | 2554 | static GeometryTip* geometryTip = nullptr; | ||
2555 | 2555 | | |||
2556 | void Client::positionGeometryTip() | 2556 | void Client::positionGeometryTip() | ||
2557 | { | 2557 | { | ||
2558 | Q_ASSERT(isMove() || isResize()); | 2558 | Q_ASSERT(isMove() || isResize()); | ||
2559 | // Position and Size display | 2559 | // Position and Size display | ||
2560 | if (effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::GeometryTip)) | 2560 | if (effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::GeometryTip)) | ||
2561 | return; // some effect paints this for us | 2561 | return; // some effect paints this for us | ||
2562 | if (options->showGeometryTip()) { | 2562 | if (options->showGeometryTip()) { | ||
Show All 10 Lines | 2572 | if (!geometryTip->isVisible()) | |||
2573 | geometryTip->show(); | 2573 | geometryTip->show(); | ||
2574 | geometryTip->raise(); | 2574 | geometryTip->raise(); | ||
2575 | } | 2575 | } | ||
2576 | } | 2576 | } | ||
2577 | 2577 | | |||
2578 | bool AbstractClient::startMoveResize() | 2578 | bool AbstractClient::startMoveResize() | ||
2579 | { | 2579 | { | ||
2580 | Q_ASSERT(!isMoveResize()); | 2580 | Q_ASSERT(!isMoveResize()); | ||
2581 | Q_ASSERT(QWidget::keyboardGrabber() == NULL); | 2581 | Q_ASSERT(QWidget::keyboardGrabber() == nullptr); | ||
2582 | Q_ASSERT(QWidget::mouseGrabber() == NULL); | 2582 | Q_ASSERT(QWidget::mouseGrabber() == nullptr); | ||
2583 | stopDelayedMoveResize(); | 2583 | stopDelayedMoveResize(); | ||
2584 | if (QApplication::activePopupWidget() != NULL) | 2584 | if (QApplication::activePopupWidget() != nullptr) | ||
2585 | return false; // popups have grab | 2585 | return false; // popups have grab | ||
2586 | if (isFullScreen() && (screens()->count() < 2 || !isMovableAcrossScreens())) | 2586 | if (isFullScreen() && (screens()->count() < 2 || !isMovableAcrossScreens())) | ||
2587 | return false; | 2587 | return false; | ||
2588 | if (!doStartMoveResize()) { | 2588 | if (!doStartMoveResize()) { | ||
2589 | return false; | 2589 | return false; | ||
2590 | } | 2590 | } | ||
2591 | 2591 | | |||
2592 | invalidateDecorationDoubleClickTimer(); | 2592 | invalidateDecorationDoubleClickTimer(); | ||
Show All 27 Lines | |||||
2620 | 2620 | | |||
2621 | bool Client::doStartMoveResize() | 2621 | bool Client::doStartMoveResize() | ||
2622 | { | 2622 | { | ||
2623 | bool has_grab = false; | 2623 | bool has_grab = false; | ||
2624 | // This reportedly improves smoothness of the moveresize operation, | 2624 | // This reportedly improves smoothness of the moveresize operation, | ||
2625 | // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* | 2625 | // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* | ||
2626 | // (https://lists.kde.org/?t=107302193400001&r=1&w=2) | 2626 | // (https://lists.kde.org/?t=107302193400001&r=1&w=2) | ||
2627 | QRect r = workspace()->clientArea(FullArea, this); | 2627 | QRect r = workspace()->clientArea(FullArea, this); | ||
2628 | m_moveResizeGrabWindow.create(r, XCB_WINDOW_CLASS_INPUT_ONLY, 0, NULL, rootWindow()); | 2628 | m_moveResizeGrabWindow.create(r, XCB_WINDOW_CLASS_INPUT_ONLY, 0, nullptr, rootWindow()); | ||
2629 | m_moveResizeGrabWindow.map(); | 2629 | m_moveResizeGrabWindow.map(); | ||
2630 | m_moveResizeGrabWindow.raise(); | 2630 | m_moveResizeGrabWindow.raise(); | ||
2631 | updateXTime(); | 2631 | updateXTime(); | ||
2632 | const xcb_grab_pointer_cookie_t cookie = xcb_grab_pointer_unchecked(connection(), false, m_moveResizeGrabWindow, | 2632 | const xcb_grab_pointer_cookie_t cookie = xcb_grab_pointer_unchecked(connection(), false, m_moveResizeGrabWindow, | ||
2633 | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | | 2633 | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | | ||
2634 | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, | 2634 | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, | ||
2635 | XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, m_moveResizeGrabWindow, Cursor::x11Cursor(cursor()), xTime()); | 2635 | XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, m_moveResizeGrabWindow, Cursor::x11Cursor(cursor()), xTime()); | ||
2636 | ScopedCPointer<xcb_grab_pointer_reply_t> pointerGrab(xcb_grab_pointer_reply(connection(), cookie, NULL)); | 2636 | ScopedCPointer<xcb_grab_pointer_reply_t> pointerGrab(xcb_grab_pointer_reply(connection(), cookie, nullptr)); | ||
2637 | if (!pointerGrab.isNull() && pointerGrab->status == XCB_GRAB_STATUS_SUCCESS) { | 2637 | if (!pointerGrab.isNull() && pointerGrab->status == XCB_GRAB_STATUS_SUCCESS) { | ||
2638 | has_grab = true; | 2638 | has_grab = true; | ||
2639 | } | 2639 | } | ||
2640 | if (!has_grab && grabXKeyboard(frameId())) | 2640 | if (!has_grab && grabXKeyboard(frameId())) | ||
2641 | has_grab = move_resize_has_keyboard_grab = true; | 2641 | has_grab = move_resize_has_keyboard_grab = true; | ||
2642 | if (!has_grab) { // at least one grab is necessary in order to be able to finish move/resize | 2642 | if (!has_grab) { // at least one grab is necessary in order to be able to finish move/resize | ||
2643 | m_moveResizeGrabWindow.reset(); | 2643 | m_moveResizeGrabWindow.reset(); | ||
2644 | return false; | 2644 | return false; | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 2699 | if (needsXWindowMove) { | |||
2701 | m_frame.move(geom.topLeft()); | 2701 | m_frame.move(geom.topLeft()); | ||
2702 | needsXWindowMove = false; | 2702 | needsXWindowMove = false; | ||
2703 | } | 2703 | } | ||
2704 | if (!isResize()) | 2704 | if (!isResize()) | ||
2705 | sendSyntheticConfigureNotify(); // tell the client about it's new final position | 2705 | sendSyntheticConfigureNotify(); // tell the client about it's new final position | ||
2706 | if (geometryTip) { | 2706 | if (geometryTip) { | ||
2707 | geometryTip->hide(); | 2707 | geometryTip->hide(); | ||
2708 | delete geometryTip; | 2708 | delete geometryTip; | ||
2709 | geometryTip = NULL; | 2709 | geometryTip = nullptr; | ||
2710 | } | 2710 | } | ||
2711 | if (move_resize_has_keyboard_grab) | 2711 | if (move_resize_has_keyboard_grab) | ||
2712 | ungrabXKeyboard(); | 2712 | ungrabXKeyboard(); | ||
2713 | move_resize_has_keyboard_grab = false; | 2713 | move_resize_has_keyboard_grab = false; | ||
2714 | xcb_ungrab_pointer(connection(), xTime()); | 2714 | xcb_ungrab_pointer(connection(), xTime()); | ||
2715 | m_moveResizeGrabWindow.reset(); | 2715 | m_moveResizeGrabWindow.reset(); | ||
2716 | if (syncRequest.counter == XCB_NONE) // don't forget to sanitize since the timeout will no more fire | 2716 | if (syncRequest.counter == XCB_NONE) // don't forget to sanitize since the timeout will no more fire | ||
2717 | syncRequest.isPending = false; | 2717 | syncRequest.isPending = false; | ||
2718 | delete syncRequest.timeout; | 2718 | delete syncRequest.timeout; | ||
2719 | syncRequest.timeout = NULL; | 2719 | syncRequest.timeout = nullptr; | ||
2720 | AbstractClient::leaveMoveResize(); | 2720 | AbstractClient::leaveMoveResize(); | ||
2721 | } | 2721 | } | ||
2722 | 2722 | | |||
2723 | // This function checks if it actually makes sense to perform a restricted move/resize. | 2723 | // This function checks if it actually makes sense to perform a restricted move/resize. | ||
2724 | // If e.g. the titlebar is already outside of the workarea, there's no point in performing | 2724 | // If e.g. the titlebar is already outside of the workarea, there's no point in performing | ||
2725 | // a restricted move resize, because then e.g. resize would also move the window (#74555). | 2725 | // a restricted move resize, because then e.g. resize would also move the window (#74555). | ||
2726 | // NOTE: Most of it is duplicated from handleMoveResize(). | 2726 | // NOTE: Most of it is duplicated from handleMoveResize(). | ||
2727 | void AbstractClient::checkUnrestrictedMoveResize() | 2727 | void AbstractClient::checkUnrestrictedMoveResize() | ||
▲ Show 20 Lines • Show All 715 Lines • Show Last 20 Lines |