Changeset View
Changeset View
Standalone View
Standalone View
xcbutils.h
Show First 20 Lines • Show All 257 Lines • ▼ Show 20 Line(s) | 239 | public: | |||
---|---|---|---|---|---|
258 | } | 258 | } | ||
259 | 259 | | |||
260 | inline const Reply *operator->() { | 260 | inline const Reply *operator->() { | ||
261 | getReply(); | 261 | getReply(); | ||
262 | return m_reply; | 262 | return m_reply; | ||
263 | } | 263 | } | ||
264 | inline bool isNull() { | 264 | inline bool isNull() { | ||
265 | getReply(); | 265 | getReply(); | ||
266 | return m_reply == NULL; | 266 | return m_reply == nullptr; | ||
267 | } | 267 | } | ||
268 | inline bool isNull() const { | 268 | inline bool isNull() const { | ||
269 | const_cast<AbstractWrapper*>(this)->getReply(); | 269 | const_cast<AbstractWrapper*>(this)->getReply(); | ||
270 | return m_reply == NULL; | 270 | return m_reply == NULL; | ||
271 | } | 271 | } | ||
272 | inline operator bool() { | 272 | inline operator bool() { | ||
273 | return !isNull(); | 273 | return !isNull(); | ||
274 | } | 274 | } | ||
Show All 19 Lines | |||||
294 | * this object will be reset to null. Calling any method which requires the reply to be valid | 294 | * this object will be reset to null. Calling any method which requires the reply to be valid | ||
295 | * will crash. | 295 | * will crash. | ||
296 | * | 296 | * | ||
297 | * Callers of this function take ownership of the pointer. | 297 | * Callers of this function take ownership of the pointer. | ||
298 | */ | 298 | */ | ||
299 | inline Reply *take() { | 299 | inline Reply *take() { | ||
300 | getReply(); | 300 | getReply(); | ||
301 | Reply *ret = m_reply; | 301 | Reply *ret = m_reply; | ||
302 | m_reply = NULL; | 302 | m_reply = nullptr; | ||
303 | m_window = XCB_WINDOW_NONE; | 303 | m_window = XCB_WINDOW_NONE; | ||
304 | return ret; | 304 | return ret; | ||
305 | } | 305 | } | ||
306 | 306 | | |||
307 | protected: | 307 | protected: | ||
308 | AbstractWrapper() | 308 | AbstractWrapper() | ||
309 | : m_retrieved(false) | 309 | : m_retrieved(false) | ||
310 | , m_window(XCB_WINDOW_NONE) | 310 | , m_window(XCB_WINDOW_NONE) | ||
311 | , m_reply(NULL) | 311 | , m_reply(nullptr) | ||
312 | { | 312 | { | ||
313 | m_cookie.sequence = 0; | 313 | m_cookie.sequence = 0; | ||
314 | } | 314 | } | ||
315 | explicit AbstractWrapper(WindowId window, Cookie cookie) | 315 | explicit AbstractWrapper(WindowId window, Cookie cookie) | ||
316 | : m_retrieved(false) | 316 | : m_retrieved(false) | ||
317 | , m_cookie(cookie) | 317 | , m_cookie(cookie) | ||
318 | , m_window(window) | 318 | , m_window(window) | ||
319 | , m_reply(NULL) | 319 | , m_reply(nullptr) | ||
320 | { | 320 | { | ||
321 | } | 321 | } | ||
322 | explicit AbstractWrapper(const AbstractWrapper &other) | 322 | explicit AbstractWrapper(const AbstractWrapper &other) | ||
323 | : m_retrieved(other.m_retrieved) | 323 | : m_retrieved(other.m_retrieved) | ||
324 | , m_cookie(other.m_cookie) | 324 | , m_cookie(other.m_cookie) | ||
325 | , m_window(other.m_window) | 325 | , m_window(other.m_window) | ||
326 | , m_reply(NULL) | 326 | , m_reply(nullptr) | ||
327 | { | 327 | { | ||
328 | takeFromOther(const_cast<AbstractWrapper&>(other)); | 328 | takeFromOther(const_cast<AbstractWrapper&>(other)); | ||
329 | } | 329 | } | ||
330 | void getReply() { | 330 | void getReply() { | ||
331 | if (m_retrieved || !m_cookie.sequence) { | 331 | if (m_retrieved || !m_cookie.sequence) { | ||
332 | return; | 332 | return; | ||
333 | } | 333 | } | ||
334 | m_reply = Data::replyFunc(connection(), m_cookie, nullptr); | 334 | m_reply = Data::replyFunc(connection(), m_cookie, nullptr); | ||
▲ Show 20 Lines • Show All 992 Lines • ▼ Show 20 Line(s) | 1313 | public: | |||
1327 | /** | 1327 | /** | ||
1328 | * Creates an xcb_window_t and manages it. It's a convenient method to create a window with | 1328 | * Creates an xcb_window_t and manages it. It's a convenient method to create a window with | ||
1329 | * depth, class and visual being copied from parent and border being @c 0. | 1329 | * depth, class and visual being copied from parent and border being @c 0. | ||
1330 | * @param geometry The geometry for the window to be created | 1330 | * @param geometry The geometry for the window to be created | ||
1331 | * @param mask The mask for the values | 1331 | * @param mask The mask for the values | ||
1332 | * @param values The values to be passed to xcb_create_window | 1332 | * @param values The values to be passed to xcb_create_window | ||
1333 | * @param parent The parent window | 1333 | * @param parent The parent window | ||
1334 | */ | 1334 | */ | ||
1335 | Window(const QRect &geometry, uint32_t mask = 0, const uint32_t *values = NULL, xcb_window_t parent = rootWindow()); | 1335 | Window(const QRect &geometry, uint32_t mask = 0, const uint32_t *values = nullptr, xcb_window_t parent = rootWindow()); | ||
1336 | /** | 1336 | /** | ||
1337 | * Creates an xcb_window_t and manages it. It's a convenient method to create a window with | 1337 | * Creates an xcb_window_t and manages it. It's a convenient method to create a window with | ||
1338 | * depth and visual being copied from parent and border being @c 0. | 1338 | * depth and visual being copied from parent and border being @c 0. | ||
1339 | * @param geometry The geometry for the window to be created | 1339 | * @param geometry The geometry for the window to be created | ||
1340 | * @param windowClass The window class | 1340 | * @param windowClass The window class | ||
1341 | * @param mask The mask for the values | 1341 | * @param mask The mask for the values | ||
1342 | * @param values The values to be passed to xcb_create_window | 1342 | * @param values The values to be passed to xcb_create_window | ||
1343 | * @param parent The parent window | 1343 | * @param parent The parent window | ||
1344 | */ | 1344 | */ | ||
1345 | Window(const QRect &geometry, uint16_t windowClass, uint32_t mask = 0, const uint32_t *values = NULL, xcb_window_t parent = rootWindow()); | 1345 | Window(const QRect &geometry, uint16_t windowClass, uint32_t mask = 0, const uint32_t *values = nullptr, xcb_window_t parent = rootWindow()); | ||
1346 | Window(const Window &other) = delete; | 1346 | Window(const Window &other) = delete; | ||
1347 | ~Window(); | 1347 | ~Window(); | ||
1348 | 1348 | | |||
1349 | /** | 1349 | /** | ||
1350 | * Creates a new window for which the responsibility is taken over. If a window had been managed | 1350 | * Creates a new window for which the responsibility is taken over. If a window had been managed | ||
1351 | * before it is freed. | 1351 | * before it is freed. | ||
1352 | * | 1352 | * | ||
1353 | * Depth, class and visual are being copied from parent and border is @c 0. | 1353 | * Depth, class and visual are being copied from parent and border is @c 0. | ||
1354 | * @param geometry The geometry for the window to be created | 1354 | * @param geometry The geometry for the window to be created | ||
1355 | * @param mask The mask for the values | 1355 | * @param mask The mask for the values | ||
1356 | * @param values The values to be passed to xcb_create_window | 1356 | * @param values The values to be passed to xcb_create_window | ||
1357 | * @param parent The parent window | 1357 | * @param parent The parent window | ||
1358 | */ | 1358 | */ | ||
1359 | void create(const QRect &geometry, uint32_t mask = 0, const uint32_t *values = NULL, xcb_window_t parent = rootWindow()); | 1359 | void create(const QRect &geometry, uint32_t mask = 0, const uint32_t *values = nullptr, xcb_window_t parent = rootWindow()); | ||
1360 | /** | 1360 | /** | ||
1361 | * Creates a new window for which the responsibility is taken over. If a window had been managed | 1361 | * Creates a new window for which the responsibility is taken over. If a window had been managed | ||
1362 | * before it is freed. | 1362 | * before it is freed. | ||
1363 | * | 1363 | * | ||
1364 | * Depth and visual are being copied from parent and border is @c 0. | 1364 | * Depth and visual are being copied from parent and border is @c 0. | ||
1365 | * @param geometry The geometry for the window to be created | 1365 | * @param geometry The geometry for the window to be created | ||
1366 | * @param windowClass The window class | 1366 | * @param windowClass The window class | ||
1367 | * @param mask The mask for the values | 1367 | * @param mask The mask for the values | ||
1368 | * @param values The values to be passed to xcb_create_window | 1368 | * @param values The values to be passed to xcb_create_window | ||
1369 | * @param parent The parent window | 1369 | * @param parent The parent window | ||
1370 | */ | 1370 | */ | ||
1371 | void create(const QRect &geometry, uint16_t windowClass, uint32_t mask = 0, const uint32_t *values = NULL, xcb_window_t parent = rootWindow()); | 1371 | void create(const QRect &geometry, uint16_t windowClass, uint32_t mask = 0, const uint32_t *values = nullptr, xcb_window_t parent = rootWindow()); | ||
1372 | /** | 1372 | /** | ||
1373 | * Frees the existing window and starts to manage the new @p window. | 1373 | * Frees the existing window and starts to manage the new @p window. | ||
1374 | * If @p destroy is @c true the new managed window will be destroyed together with this | 1374 | * If @p destroy is @c true the new managed window will be destroyed together with this | ||
1375 | * object or when reset is called again. If @p destroy is @c false the window will not | 1375 | * object or when reset is called again. If @p destroy is @c false the window will not | ||
1376 | * be destroyed. It is then the responsibility of the caller to destroy the window. | 1376 | * be destroyed. It is then the responsibility of the caller to destroy the window. | ||
1377 | */ | 1377 | */ | ||
1378 | void reset(xcb_window_t window = XCB_WINDOW_NONE, bool destroy = true); | 1378 | void reset(xcb_window_t window = XCB_WINDOW_NONE, bool destroy = true); | ||
1379 | /** | 1379 | /** | ||
Show All 34 Lines | |||||
1414 | void clear(); | 1414 | void clear(); | ||
1415 | void setBackgroundPixmap(xcb_pixmap_t pixmap); | 1415 | void setBackgroundPixmap(xcb_pixmap_t pixmap); | ||
1416 | void defineCursor(xcb_cursor_t cursor); | 1416 | void defineCursor(xcb_cursor_t cursor); | ||
1417 | void focus(uint8_t revertTo = XCB_INPUT_FOCUS_POINTER_ROOT, xcb_timestamp_t time = XCB_TIME_CURRENT_TIME); | 1417 | void focus(uint8_t revertTo = XCB_INPUT_FOCUS_POINTER_ROOT, xcb_timestamp_t time = XCB_TIME_CURRENT_TIME); | ||
1418 | void selectInput(uint32_t events); | 1418 | void selectInput(uint32_t events); | ||
1419 | void kill(); | 1419 | void kill(); | ||
1420 | operator xcb_window_t() const; | 1420 | operator xcb_window_t() const; | ||
1421 | private: | 1421 | private: | ||
1422 | xcb_window_t doCreate(const QRect &geometry, uint16_t windowClass, uint32_t mask = 0, const uint32_t *values = NULL, xcb_window_t parent = rootWindow()); | 1422 | xcb_window_t doCreate(const QRect &geometry, uint16_t windowClass, uint32_t mask = 0, const uint32_t *values = nullptr, xcb_window_t parent = rootWindow()); | ||
1423 | void destroy(); | 1423 | void destroy(); | ||
1424 | xcb_window_t m_window; | 1424 | xcb_window_t m_window; | ||
1425 | bool m_destroy; | 1425 | bool m_destroy; | ||
1426 | QRect m_logicGeometry; | 1426 | QRect m_logicGeometry; | ||
1427 | }; | 1427 | }; | ||
1428 | 1428 | | |||
1429 | inline | 1429 | inline | ||
1430 | Window::Window(xcb_window_t window, bool destroy) | 1430 | Window::Window(xcb_window_t window, bool destroy) | ||
▲ Show 20 Lines • Show All 455 Lines • Show Last 20 Lines |