Changeset View
Changeset View
Standalone View
Standalone View
x11client.cpp
Show First 20 Lines • Show All 2210 Lines • ▼ Show 20 Line(s) | 2205 | { | |||
---|---|---|---|---|---|
2211 | if (isResize()) { | 2211 | if (isResize()) { | ||
2212 | if (syncRequest.timeout) | 2212 | if (syncRequest.timeout) | ||
2213 | syncRequest.timeout->stop(); | 2213 | syncRequest.timeout->stop(); | ||
2214 | performMoveResize(); | 2214 | performMoveResize(); | ||
2215 | } else // setReadyForPainting does as well, but there's a small chance for resize syncs after the resize ended | 2215 | } else // setReadyForPainting does as well, but there's a small chance for resize syncs after the resize ended | ||
2216 | addRepaintFull(); | 2216 | addRepaintFull(); | ||
2217 | } | 2217 | } | ||
2218 | 2218 | | |||
2219 | bool X11Client::canUpdatePosition(const QPoint &frame, const QPoint &buffer, ForceGeometry_t force) const | | |||
2220 | { | | |||
2221 | // Obey forced geometry updates. | | |||
2222 | if (force != NormalGeometrySet) { | | |||
2223 | return true; | | |||
2224 | } | | |||
2225 | // Server-side geometry and our geometry are out of sync. | | |||
2226 | if (bufferGeometry().topLeft() != buffer) { | | |||
2227 | return true; | | |||
2228 | } | | |||
2229 | if (frameGeometry().topLeft() != frame) { | | |||
2230 | return true; | | |||
2231 | } | | |||
2232 | return false; | | |||
2233 | } | | |||
2234 | | ||||
2235 | bool X11Client::canUpdateSize(const QSize &frame, const QSize &buffer, ForceGeometry_t force) const | | |||
2236 | { | | |||
2237 | // Obey forced geometry updates. | | |||
2238 | if (force != NormalGeometrySet) { | | |||
2239 | return true; | | |||
2240 | } | | |||
2241 | // Server-side geometry and our geometry are out of sync. | | |||
2242 | if (bufferGeometry().size() != buffer) { | | |||
2243 | return true; | | |||
2244 | } | | |||
2245 | if (frameGeometry().size() != frame) { | | |||
2246 | return true; | | |||
2247 | } | | |||
2248 | return false; | | |||
2249 | } | | |||
2250 | | ||||
2251 | bool X11Client::canUpdateGeometry(const QRect &frame, const QRect &buffer, ForceGeometry_t force) const | | |||
2252 | { | | |||
2253 | if (canUpdatePosition(frame.topLeft(), buffer.topLeft(), force)) { | | |||
2254 | return true; | | |||
2255 | } | | |||
2256 | if (canUpdateSize(frame.size(), buffer.size(), force)) { | | |||
2257 | return true; | | |||
2258 | } | | |||
2259 | return pendingGeometryUpdate() != PendingGeometryNone; | | |||
2260 | } | | |||
2261 | | ||||
2262 | void X11Client::move(int x, int y, ForceGeometry_t force) | 2219 | void X11Client::move(int x, int y, ForceGeometry_t force) | ||
2263 | { | 2220 | { | ||
2264 | const QPoint framePosition(x, y); | 2221 | const QPoint framePosition(x, y); | ||
2265 | m_clientGeometry.moveTopLeft(framePosToClientPos(framePosition)); | 2222 | m_clientGeometry.moveTopLeft(framePosToClientPos(framePosition)); | ||
2266 | const QPoint bufferPosition = isDecorated() ? framePosition : m_clientGeometry.topLeft(); | 2223 | const QPoint bufferPosition = isDecorated() ? framePosition : m_clientGeometry.topLeft(); | ||
2267 | // resuming geometry updates is handled only in setGeometry() | 2224 | // resuming geometry updates is handled only in setGeometry() | ||
2268 | Q_ASSERT(pendingGeometryUpdate() == PendingGeometryNone || areGeometryUpdatesBlocked()); | 2225 | Q_ASSERT(pendingGeometryUpdate() == PendingGeometryNone || areGeometryUpdatesBlocked()); | ||
2269 | if (!areGeometryUpdatesBlocked() && framePosition != rules()->checkPosition(framePosition)) { | 2226 | if (!areGeometryUpdatesBlocked() && framePosition != rules()->checkPosition(framePosition)) { | ||
2270 | qCDebug(KWIN_CORE) << "forced position fail:" << framePosition << ":" << rules()->checkPosition(framePosition); | 2227 | qCDebug(KWIN_CORE) << "forced position fail:" << framePosition << ":" << rules()->checkPosition(framePosition); | ||
2271 | } | 2228 | } | ||
2272 | if (!canUpdatePosition(framePosition, bufferPosition, force)) { | 2229 | geom.moveTopLeft(framePosition); | ||
2230 | if (force == NormalGeometrySet && m_bufferGeometry.topLeft() == bufferPosition) { | ||||
2273 | return; | 2231 | return; | ||
2274 | } | 2232 | } | ||
2275 | m_bufferGeometry.moveTopLeft(bufferPosition); | 2233 | m_bufferGeometry.moveTopLeft(bufferPosition); | ||
2276 | geom.moveTopLeft(framePosition); | | |||
2277 | if (areGeometryUpdatesBlocked()) { | 2234 | if (areGeometryUpdatesBlocked()) { | ||
2278 | if (pendingGeometryUpdate() == PendingGeometryForced) { | 2235 | if (pendingGeometryUpdate() == PendingGeometryForced) { | ||
2279 | // Maximum, nothing needed. | 2236 | // Maximum, nothing needed. | ||
2280 | } else if (force == ForceGeometrySet) { | 2237 | } else if (force == ForceGeometrySet) { | ||
2281 | setPendingGeometryUpdate(PendingGeometryForced); | 2238 | setPendingGeometryUpdate(PendingGeometryForced); | ||
2282 | } else { | 2239 | } else { | ||
2283 | setPendingGeometryUpdate(PendingGeometryNormal); | 2240 | setPendingGeometryUpdate(PendingGeometryNormal); | ||
2284 | } | 2241 | } | ||
2285 | return; | 2242 | return; | ||
2286 | } | 2243 | } | ||
2287 | m_frame.move(m_bufferGeometry.topLeft()); | 2244 | updateServerGeometry(); | ||
2288 | sendSyntheticConfigureNotify(); | | |||
2289 | updateWindowRules(Rules::Position); | 2245 | updateWindowRules(Rules::Position); | ||
2290 | screens()->setCurrent(this); | 2246 | screens()->setCurrent(this); | ||
2291 | workspace()->updateStackingOrder(); | 2247 | workspace()->updateStackingOrder(); | ||
2292 | // client itself is not damaged | 2248 | // client itself is not damaged | ||
2293 | addRepaintDuringGeometryUpdates(); | 2249 | addRepaintDuringGeometryUpdates(); | ||
2294 | updateGeometryBeforeUpdateBlocking(); | 2250 | updateGeometryBeforeUpdateBlocking(); | ||
2295 | emit geometryChanged(); | 2251 | emit geometryChanged(); | ||
2296 | } | 2252 | } | ||
2297 | 2253 | | |||
2298 | } // namespace | 2254 | } // namespace | ||
2299 | 2255 | |