Changeset View
Changeset View
Standalone View
Standalone View
x11client.cpp
Show First 20 Lines • Show All 2858 Lines • ▼ Show 20 Line(s) | 2853 | { | |||
---|---|---|---|---|---|
2859 | if (isResize()) { | 2859 | if (isResize()) { | ||
2860 | if (syncRequest.timeout) | 2860 | if (syncRequest.timeout) | ||
2861 | syncRequest.timeout->stop(); | 2861 | syncRequest.timeout->stop(); | ||
2862 | performMoveResize(); | 2862 | performMoveResize(); | ||
2863 | } else // setReadyForPainting does as well, but there's a small chance for resize syncs after the resize ended | 2863 | } else // setReadyForPainting does as well, but there's a small chance for resize syncs after the resize ended | ||
2864 | addRepaintFull(); | 2864 | addRepaintFull(); | ||
2865 | } | 2865 | } | ||
2866 | 2866 | | |||
2867 | bool X11Client::canUpdatePosition(const QPoint &frame, const QPoint &buffer, ForceGeometry_t force) const | | |||
2868 | { | | |||
2869 | // Obey forced geometry updates. | | |||
2870 | if (force != NormalGeometrySet) { | | |||
2871 | return true; | | |||
2872 | } | | |||
2873 | // Server-side geometry and our geometry are out of sync. | | |||
2874 | if (bufferGeometry().topLeft() != buffer) { | | |||
2875 | return true; | | |||
2876 | } | | |||
2877 | if (frameGeometry().topLeft() != frame) { | | |||
2878 | return true; | | |||
2879 | } | | |||
2880 | return false; | | |||
2881 | } | | |||
2882 | | ||||
2883 | bool X11Client::canUpdateSize(const QSize &frame, const QSize &buffer, ForceGeometry_t force) const | | |||
2884 | { | | |||
2885 | // Obey forced geometry updates. | | |||
2886 | if (force != NormalGeometrySet) { | | |||
2887 | return true; | | |||
2888 | } | | |||
2889 | // Server-side geometry and our geometry are out of sync. | | |||
2890 | if (bufferGeometry().size() != buffer) { | | |||
2891 | return true; | | |||
2892 | } | | |||
2893 | if (frameGeometry().size() != frame) { | | |||
2894 | return true; | | |||
2895 | } | | |||
2896 | return false; | | |||
2897 | } | | |||
2898 | | ||||
2899 | bool X11Client::canUpdateGeometry(const QRect &frame, const QRect &buffer, ForceGeometry_t force) const | | |||
2900 | { | | |||
2901 | if (canUpdatePosition(frame.topLeft(), buffer.topLeft(), force)) { | | |||
2902 | return true; | | |||
2903 | } | | |||
2904 | if (canUpdateSize(frame.size(), buffer.size(), force)) { | | |||
2905 | return true; | | |||
2906 | } | | |||
2907 | return pendingGeometryUpdate() != PendingGeometryNone; | | |||
2908 | } | | |||
2909 | | ||||
2910 | void X11Client::move(int x, int y, ForceGeometry_t force) | 2867 | void X11Client::move(int x, int y, ForceGeometry_t force) | ||
2911 | { | 2868 | { | ||
2912 | const QPoint framePosition(x, y); | 2869 | const QPoint framePosition(x, y); | ||
2913 | m_clientGeometry.moveTopLeft(framePosToClientPos(framePosition)); | 2870 | m_clientGeometry.moveTopLeft(framePosToClientPos(framePosition)); | ||
2914 | const QPoint bufferPosition = isDecorated() ? framePosition : m_clientGeometry.topLeft(); | 2871 | const QPoint bufferPosition = isDecorated() ? framePosition : m_clientGeometry.topLeft(); | ||
2915 | // resuming geometry updates is handled only in setGeometry() | 2872 | // resuming geometry updates is handled only in setGeometry() | ||
2916 | Q_ASSERT(pendingGeometryUpdate() == PendingGeometryNone || areGeometryUpdatesBlocked()); | 2873 | Q_ASSERT(pendingGeometryUpdate() == PendingGeometryNone || areGeometryUpdatesBlocked()); | ||
2917 | if (!areGeometryUpdatesBlocked() && framePosition != rules()->checkPosition(framePosition)) { | 2874 | if (!areGeometryUpdatesBlocked() && framePosition != rules()->checkPosition(framePosition)) { | ||
2918 | qCDebug(KWIN_CORE) << "forced position fail:" << framePosition << ":" << rules()->checkPosition(framePosition); | 2875 | qCDebug(KWIN_CORE) << "forced position fail:" << framePosition << ":" << rules()->checkPosition(framePosition); | ||
2919 | } | 2876 | } | ||
2920 | if (!canUpdatePosition(framePosition, bufferPosition, force)) { | 2877 | geom.moveTopLeft(framePosition); | ||
2878 | if (force == NormalGeometrySet && m_bufferGeometry.topLeft() == bufferPosition) { | ||||
2921 | return; | 2879 | return; | ||
2922 | } | 2880 | } | ||
2923 | m_bufferGeometry.moveTopLeft(bufferPosition); | 2881 | m_bufferGeometry.moveTopLeft(bufferPosition); | ||
2924 | geom.moveTopLeft(framePosition); | | |||
2925 | if (areGeometryUpdatesBlocked()) { | 2882 | if (areGeometryUpdatesBlocked()) { | ||
2926 | if (pendingGeometryUpdate() == PendingGeometryForced) { | 2883 | if (pendingGeometryUpdate() == PendingGeometryForced) { | ||
2927 | // Maximum, nothing needed. | 2884 | // Maximum, nothing needed. | ||
2928 | } else if (force == ForceGeometrySet) { | 2885 | } else if (force == ForceGeometrySet) { | ||
2929 | setPendingGeometryUpdate(PendingGeometryForced); | 2886 | setPendingGeometryUpdate(PendingGeometryForced); | ||
2930 | } else { | 2887 | } else { | ||
2931 | setPendingGeometryUpdate(PendingGeometryNormal); | 2888 | setPendingGeometryUpdate(PendingGeometryNormal); | ||
2932 | } | 2889 | } | ||
2933 | return; | 2890 | return; | ||
2934 | } | 2891 | } | ||
2935 | m_frame.move(m_bufferGeometry.topLeft()); | 2892 | updateServerGeometry(); | ||
2936 | sendSyntheticConfigureNotify(); | | |||
2937 | updateWindowRules(Rules::Position); | 2893 | updateWindowRules(Rules::Position); | ||
2938 | screens()->setCurrent(this); | 2894 | screens()->setCurrent(this); | ||
2939 | workspace()->updateStackingOrder(); | 2895 | workspace()->updateStackingOrder(); | ||
2940 | // client itself is not damaged | 2896 | // client itself is not damaged | ||
2941 | addRepaintDuringGeometryUpdates(); | 2897 | addRepaintDuringGeometryUpdates(); | ||
2942 | updateGeometryBeforeUpdateBlocking(); | 2898 | updateGeometryBeforeUpdateBlocking(); | ||
2943 | emit geometryChanged(); | 2899 | emit geometryChanged(); | ||
2944 | } | 2900 | } | ||
▲ Show 20 Lines • Show All 646 Lines • Show Last 20 Lines |