Qt 4.8
qxcbwindow.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QXCBWINDOW_H
43 #define QXCBWINDOW_H
44 
45 #include <QtGui/QPlatformWindow>
46 #include <QtGui/QPlatformWindowFormat>
47 #include <QtGui/QImage>
48 
49 #include <xcb/xcb.h>
50 #include <xcb/sync.h>
51 
52 #include "qxcbobject.h"
53 
54 class QXcbScreen;
55 
56 class QXcbWindow : public QXcbObject, public QPlatformWindow
57 {
58 public:
59  QXcbWindow(QWidget *tlw);
60  ~QXcbWindow();
61 
62  void setGeometry(const QRect &rect);
63 
64  void setVisible(bool visible);
65  Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
66  WId winId() const;
67  void setParent(const QPlatformWindow *window);
68 
69  void setWindowTitle(const QString &title);
70  void raise();
71  void lower();
72 
73  void requestActivateWindow();
74 
76 
77  xcb_window_t window() const { return m_window; }
78  uint depth() const { return m_depth; }
79  QImage::Format format() const { return m_format; }
80 
81  void handleExposeEvent(const xcb_expose_event_t *event);
82  void handleClientMessageEvent(const xcb_client_message_event_t *event);
83  void handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event);
84  void handleButtonPressEvent(const xcb_button_press_event_t *event);
85  void handleButtonReleaseEvent(const xcb_button_release_event_t *event);
86  void handleMotionNotifyEvent(const xcb_motion_notify_event_t *event);
87 
88  void handleEnterNotifyEvent(const xcb_enter_notify_event_t *event);
89  void handleLeaveNotifyEvent(const xcb_leave_notify_event_t *event);
90  void handleFocusInEvent(const xcb_focus_in_event_t *event);
91  void handleFocusOutEvent(const xcb_focus_out_event_t *event);
92 
93  void handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global);
94 
96 
97 private:
98  void setNetWmWindowTypes(Qt::WindowFlags flags);
99 
101 
102  xcb_window_t m_window;
104 
107 
108  xcb_sync_int64_t m_syncValue;
109  xcb_sync_counter_t m_syncCounter;
110 
112 };
113 
114 #endif
bool m_hasReceivedSyncRequest
Definition: qxcbwindow.h:111
void handleFocusOutEvent(const xcb_focus_out_event_t *event)
Definition: qxcbwindow.cpp:700
Format
The following image formats are available in Qt.
Definition: qimage.h:91
unsigned long WId
Definition: qwindowdefs.h:119
EventRef event
QPlatformGLContext * m_context
Definition: qxcbwindow.h:103
void handleButtonPressEvent(const xcb_button_press_event_t *event)
Definition: qxcbwindow.cpp:637
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void setWindowTitle(const QString &title)
Reimplement to set the window title to title.
Definition: qxcbwindow.cpp:491
QPlatformGLContext * glContext() const
Reimplement to return the glContext associated with the window.
Definition: qxcbwindow.cpp:524
void handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event)
Definition: qxcbwindow.cpp:587
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QPlatformWindow class provides an abstraction for top-level windows.
Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags)
Requests setting the window flags of this surface to type.
Definition: qxcbwindow.cpp:335
void handleMotionNotifyEvent(const xcb_motion_notify_event_t *event)
Definition: qxcbwindow.cpp:667
void handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global)
Definition: qxcbwindow.cpp:675
void handleFocusInEvent(const xcb_focus_in_event_t *event)
Definition: qxcbwindow.cpp:695
uint m_depth
Definition: qxcbwindow.h:105
xcb_sync_int64_t m_syncValue
Definition: qxcbwindow.h:108
QXcbScreen * m_screen
Definition: qxcbwindow.h:100
unsigned int uint
Definition: qglobal.h:996
void handleClientMessageEvent(const xcb_client_message_event_t *event)
Definition: qxcbwindow.cpp:563
void setVisible(bool visible)
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false...
Definition: qxcbwindow.cpp:274
void setGeometry(const QRect &rect)
This function is called by Qt whenever a window is moved or the window is resized.
Definition: qxcbwindow.cpp:264
void setNetWmWindowTypes(Qt::WindowFlags flags)
Definition: qxcbwindow.cpp:444
QImage::Format format() const
Definition: qxcbwindow.h:79
void handleButtonReleaseEvent(const xcb_button_release_event_t *event)
Definition: qxcbwindow.cpp:659
void handleEnterNotifyEvent(const xcb_enter_notify_event_t *event)
Definition: qxcbwindow.cpp:685
void requestActivateWindow()
Reimplement to let Qt be able to request activation/focus for a window.
Definition: qxcbwindow.cpp:518
void handleExposeEvent(const xcb_expose_event_t *event)
Definition: qxcbwindow.cpp:553
xcb_sync_counter_t m_syncCounter
Definition: qxcbwindow.h:109
WId winId() const
Reimplement in subclasses to return a handle to the native window.
Definition: qxcbwindow.cpp:480
The QPlatformGLContext class provides an abstraction for native GL contexts.
void setParent(const QPlatformWindow *window)
This function is called to enable native child widgets in QPA.
Definition: qxcbwindow.cpp:485
xcb_window_t window() const
Definition: qxcbwindow.h:77
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void lower()
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
Definition: qxcbwindow.cpp:511
uint depth() const
Definition: qxcbwindow.h:78
QImage::Format m_format
Definition: qxcbwindow.h:106
void handleLeaveNotifyEvent(const xcb_leave_notify_event_t *event)
Definition: qxcbwindow.cpp:690
xcb_window_t m_window
Definition: qxcbwindow.h:102
QXcbWindow(QWidget *tlw)
Definition: qxcbwindow.cpp:113
void updateSyncRequestCounter()
Definition: qxcbwindow.cpp:705