Changeset View
Changeset View
Standalone View
Standalone View
events.cpp
Show First 20 Lines • Show All 1175 Lines • ▼ Show 20 Line(s) | |||||
1176 | 1176 | | |||
1177 | // performs _NET_WM_MOVERESIZE | 1177 | // performs _NET_WM_MOVERESIZE | ||
1178 | void X11Client::NETMoveResize(int x_root, int y_root, NET::Direction direction) | 1178 | void X11Client::NETMoveResize(int x_root, int y_root, NET::Direction direction) | ||
1179 | { | 1179 | { | ||
1180 | if (direction == NET::Move) { | 1180 | if (direction == NET::Move) { | ||
1181 | // move cursor to the provided position to prevent the window jumping there on first movement | 1181 | // move cursor to the provided position to prevent the window jumping there on first movement | ||
1182 | // the expectation is that the cursor is already at the provided position, | 1182 | // the expectation is that the cursor is already at the provided position, | ||
1183 | // thus it's more a safety measurement | 1183 | // thus it's more a safety measurement | ||
1184 | Cursor::setPos(QPoint(x_root, y_root)); | 1184 | Cursors::self()->mouse()->setPos(QPoint(x_root, y_root)); | ||
1185 | performMouseCommand(Options::MouseMove, QPoint(x_root, y_root)); | 1185 | performMouseCommand(Options::MouseMove, QPoint(x_root, y_root)); | ||
1186 | } else if (isMoveResize() && direction == NET::MoveResizeCancel) { | 1186 | } else if (isMoveResize() && direction == NET::MoveResizeCancel) { | ||
1187 | finishMoveResize(true); | 1187 | finishMoveResize(true); | ||
1188 | setMoveResizePointerButtonDown(false); | 1188 | setMoveResizePointerButtonDown(false); | ||
1189 | updateCursor(); | 1189 | updateCursor(); | ||
1190 | } else if (direction >= NET::TopLeft && direction <= NET::Left) { | 1190 | } else if (direction >= NET::TopLeft && direction <= NET::Left) { | ||
1191 | static const Position convert[] = { | 1191 | static const Position convert[] = { | ||
1192 | PositionTopLeft, | 1192 | PositionTopLeft, | ||
Show All 14 Lines | |||||
1207 | setInvertedMoveOffset(rect().bottomRight() - moveOffset()); | 1207 | setInvertedMoveOffset(rect().bottomRight() - moveOffset()); | ||
1208 | setUnrestrictedMoveResize(false); | 1208 | setUnrestrictedMoveResize(false); | ||
1209 | setMoveResizePointerMode(convert[ direction ]); | 1209 | setMoveResizePointerMode(convert[ direction ]); | ||
1210 | if (!startMoveResize()) | 1210 | if (!startMoveResize()) | ||
1211 | setMoveResizePointerButtonDown(false); | 1211 | setMoveResizePointerButtonDown(false); | ||
1212 | updateCursor(); | 1212 | updateCursor(); | ||
1213 | } else if (direction == NET::KeyboardMove) { | 1213 | } else if (direction == NET::KeyboardMove) { | ||
1214 | // ignore mouse coordinates given in the message, mouse position is used by the moving algorithm | 1214 | // ignore mouse coordinates given in the message, mouse position is used by the moving algorithm | ||
1215 | Cursor::setPos(frameGeometry().center()); | 1215 | Cursors::self()->mouse()->setPos(frameGeometry().center()); | ||
1216 | performMouseCommand(Options::MouseUnrestrictedMove, frameGeometry().center()); | 1216 | performMouseCommand(Options::MouseUnrestrictedMove, frameGeometry().center()); | ||
1217 | } else if (direction == NET::KeyboardSize) { | 1217 | } else if (direction == NET::KeyboardSize) { | ||
1218 | // ignore mouse coordinates given in the message, mouse position is used by the resizing algorithm | 1218 | // ignore mouse coordinates given in the message, mouse position is used by the resizing algorithm | ||
1219 | Cursor::setPos(frameGeometry().bottomRight()); | 1219 | Cursors::self()->mouse()->setPos(frameGeometry().bottomRight()); | ||
1220 | performMouseCommand(Options::MouseUnrestrictedResize, frameGeometry().bottomRight()); | 1220 | performMouseCommand(Options::MouseUnrestrictedResize, frameGeometry().bottomRight()); | ||
1221 | } | 1221 | } | ||
1222 | } | 1222 | } | ||
1223 | 1223 | | |||
1224 | void X11Client::keyPressEvent(uint key_code, xcb_timestamp_t time) | 1224 | void X11Client::keyPressEvent(uint key_code, xcb_timestamp_t time) | ||
1225 | { | 1225 | { | ||
1226 | updateUserTime(time); | 1226 | updateUserTime(time); | ||
1227 | AbstractClient::keyPressEvent(key_code); | 1227 | AbstractClient::keyPressEvent(key_code); | ||
Show All 25 Lines | 1252 | if (dirtyProperties2.testFlag(NET::WM2WindowClass)) { | |||
1253 | getResourceClass(); | 1253 | getResourceClass(); | ||
1254 | } | 1254 | } | ||
1255 | const uint8_t eventType = e->response_type & ~0x80; | 1255 | const uint8_t eventType = e->response_type & ~0x80; | ||
1256 | switch (eventType) { | 1256 | switch (eventType) { | ||
1257 | case XCB_DESTROY_NOTIFY: | 1257 | case XCB_DESTROY_NOTIFY: | ||
1258 | release(ReleaseReason::Destroyed); | 1258 | release(ReleaseReason::Destroyed); | ||
1259 | break; | 1259 | break; | ||
1260 | case XCB_UNMAP_NOTIFY:{ | 1260 | case XCB_UNMAP_NOTIFY:{ | ||
1261 | workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event | 1261 | workspace()->updateFocusMousePosition(Cursors::self()->mouse()->pos()); // may cause leave event | ||
1262 | 1262 | | |||
1263 | // unmap notify might have been emitted due to a destroy notify | 1263 | // unmap notify might have been emitted due to a destroy notify | ||
1264 | // but unmap notify gets emitted before the destroy notify, nevertheless at this | 1264 | // but unmap notify gets emitted before the destroy notify, nevertheless at this | ||
1265 | // point the window is already destroyed. This means any XCB request with the window | 1265 | // point the window is already destroyed. This means any XCB request with the window | ||
1266 | // will cause an error. | 1266 | // will cause an error. | ||
1267 | // To not run into these errors we try to wait for the destroy notify. For this we | 1267 | // To not run into these errors we try to wait for the destroy notify. For this we | ||
1268 | // generate a round trip to the X server and wait a very short time span before | 1268 | // generate a round trip to the X server and wait a very short time span before | ||
1269 | // handling the release. | 1269 | // handling the release. | ||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |