44 #include <X11/extensions/Xfixes.h> 53 #include <QtCore/QDebug> 54 #include <QtCore/QSocketNotifier> 55 #include <QtCore/QElapsedTimer> 57 #include <private/qapplication_p.h> 67 qDebug() <<
"qt_x_errhandler" << err->error_code;
69 switch (err->error_code) {
72 if (err->request_code == 20
73 && (err->resourceid == XA_RESOURCE_MANAGER
74 || err->resourceid == XA_RGB_DEFAULT_MAP
77 || err->resourceid ==
ATOM(KDE_FULL_SESSION)
78 || err->resourceid ==
ATOM(KWIN_RUNNING)
92 if (err->request_code == 2
93 || err->request_code == 38 ) {
94 for (
int i = 0; i < ScreenCount(dpy); ++i) {
95 if (err->resourceid == RootWindow(dpy, i)) {
102 if (err->request_code == 25 ) {
103 for (
int i = 0; i < ScreenCount(dpy); ++i) {
104 if (err->resourceid == RootWindow(dpy, i)) {
110 if (
X11->xdndHandleBadwindow()) {
111 qDebug(
"xdndHandleBadwindow returned true");
117 if (
X11->ignore_badwindow)
123 if (err->request_code == 42 )
129 if (err->request_code == X11->xinput_major 130 && err->error_code == (
X11->xinput_errorbase + XI_BadDevice)
131 && err->minor_code == 3 ) {
139 XGetErrorText( dpy, err->error_code, errstr, 256 );
141 char request_str[256];
142 qsnprintf(buffer, 256,
"%d", err->request_code);
143 XGetErrorDatabaseText(dpy,
"XRequest", buffer,
"", request_str, 256);
144 if (err->request_code < 128) {
147 " Major opcode: %d (%s)\n" 148 " Resource id: 0x%lx",
149 errstr, err->error_code,
155 const char *extensionName = 0;
157 if (err->request_code ==
X11->xrender_major)
158 extensionName =
"RENDER";
159 else if (err->request_code ==
X11->xrandr_major)
160 extensionName =
"RANDR";
161 else if (err->request_code ==
X11->xinput_major)
162 extensionName =
"XInputExtension";
163 else if (err->request_code ==
X11->mitshm_major)
164 extensionName =
"MIT-SHM";
168 qsnprintf(buffer, 256,
"%s.%d", extensionName, err->minor_code);
169 XGetErrorDatabaseText(dpy,
"XRequest", buffer,
"", minor_str, 256);
171 extensionName =
"Uknown extension";
172 qsnprintf(minor_str, 256,
"Unknown request");
175 " Extension: %d (%s)\n" 176 " Minor opcode: %d (%s)\n" 177 " Resource id: 0x%lx",
178 errstr, err->error_code,
193 : mFormat(
QImage::Format_RGB32)
198 char *display_name = getenv(
"DISPLAY");
203 #ifndef DONT_USE_MIT_SHM 205 Q_ASSERT(MIT_SHM_extension_supported == True);
226 qDebug() <<
"X socket:"<< xSocketNumber;
269 platformWindow =
static_cast<QXlibWindow *
>(widget->platformWindow());
277 if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) {
278 Atom a = xe->xclient.data.l[0];
279 if (a == wmDeleteWindowAtom)
286 if (xe->xexpose.count == 0)
289 case ConfigureNotify:
341 qDebug() <<
"Selection Clear!!!";
343 case SelectionRequest:
346 case SelectionNotify:
347 qDebug() <<
"Selection Notify!!!!";
354 qDebug() <<
hex << xe->xany.window <<
"Other X event" << xe->type;
365 return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY
366 || e->xselectionrequest.selection == clipboard))
367 || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY
368 || e->xselectionclear.selection == clipboard)));
387 struct timeval usleep_tv;
388 usleep_tv.tv_sec = 0;
389 usleep_tv.tv_usec = 50000;
390 select(0, 0, 0, 0, &usleep_tv);
391 }
while (timer.
elapsed() < timeout);
405 if (event.xany.serial >= marker) {
407 qDebug() <<
"potential livelock averted";
411 qDebug() <<
" with events queued";
429 XWindowAttributes window_attr;
434 w = window_attr.width - x;
436 h = window_attr.height - y;
unsigned long whitePixel()
static QWaylandClipboard * clipboard
void handleSelectionRequest(XEvent *event)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
#define QT_END_NAMESPACE
This macro expands to.
QPointer< QWidget > widget
void handleSelectionRequest(XEvent *event)
Display * nativeDisplay() const
QImage grabWindow(Window window, int x, int y, int w, int h)
void handleMouseEvent(QEvent::Type, XButtonEvent *ev)
static int(* original_x_errhandler)(Display *dpy, XErrorEvent *)
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *)
long ASN1_INTEGER_get ASN1_INTEGER * a
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
void resizeEvent(XConfigureEvent *configure_event)
The QElapsedTimer class provides a fast way to calculate elapsed times.
qint64 elapsed() const
Returns the number of milliseconds since this QElapsedTimer was last started.
void handleFocusInEvent()
Q_CORE_EXPORT QTextStream & hex(QTextStream &s)
The QSocketNotifier class provides support for monitoring activity on a file descriptor.
Q_CORE_EXPORT void qDebug(const char *,...)
static QXlibScreen * testLiteScreenForWidget(QWidget *widget)
#define QT_BEGIN_NAMESPACE
This macro expands to.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
void handleFocusOutEvent()
bool waitForClipboardEvent(Window win, int type, XEvent *event, int timeout)
QXlibKeyboard * keyboard() const
static int toInt(const QByteArray &str)
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
static Atom atom(X11Atom atom)
static int qt_x_errhandler(Display *dpy, XErrorEvent *err)
int xScreenNumber() const
Q_GUI_EXPORT EGLNativeDisplayType nativeDisplay()
bool handleEvent(XEvent *xe)
bool singleShot
This static function calls a slot after a given time interval.
Visual * defaultVisual() const
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
int qsnprintf(char *str, size_t n, const char *fmt,...)
A portable snprintf() function, calls qvsnprintf.
The QSize class defines the size of a two-dimensional object using integer point precision.
QXlibKeyboard * mKeyboard
static bool seen_badwindow
void handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev)
QXlibDisplay * display() const
static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer)
void start()
Starts this timer.
void mousePressEvent(XButtonEvent *)
unsigned long blackPixel()