Qt 4.8
Functions | Variables
qxlibscreen.cpp File Reference
#include "qxlibscreen.h"
#include <X11/extensions/Xfixes.h>
#include "qxlibcursor.h"
#include "qxlibwindow.h"
#include "qxlibkeyboard.h"
#include "qxlibstatic.h"
#include "qxlibclipboard.h"
#include "qxlibdisplay.h"
#include <QtCore/QDebug>
#include <QtCore/QSocketNotifier>
#include <QtCore/QElapsedTimer>
#include <private/qapplication_p.h>

Go to the source code of this file.

Functions

static Bool checkForClipboardEvents (Display *, XEvent *e, XPointer)
 
static int qt_x_errhandler (Display *dpy, XErrorEvent *err)
 

Variables

static int(* original_x_errhandler )(Display *dpy, XErrorEvent *)
 
static bool seen_badwindow
 

Function Documentation

◆ checkForClipboardEvents()

static Bool checkForClipboardEvents ( Display ,
XEvent e,
XPointer   
)
static

Definition at line 362 of file qxlibscreen.cpp.

Referenced by QXlibScreen::waitForClipboardEvent().

363 {
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)));
369 }
static QWaylandClipboard * clipboard
static Atom atom(X11Atom atom)

◆ qt_x_errhandler()

static int qt_x_errhandler ( Display dpy,
XErrorEvent *  err 
)
static

defined(QT_NO_XINPUT)

Definition at line 64 of file qxlibscreen.cpp.

Referenced by QXlibScreen::QXlibScreen().

65 {
66 
67 qDebug() << "qt_x_errhandler" << err->error_code;
68 
69  switch (err->error_code) {
70  case BadAtom:
71 #if 0
72  if (err->request_code == 20 /* X_GetProperty */
73  && (err->resourceid == XA_RESOURCE_MANAGER
74  || err->resourceid == XA_RGB_DEFAULT_MAP
75  || err->resourceid == ATOM(_NET_SUPPORTED)
76  || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK)
77  || err->resourceid == ATOM(KDE_FULL_SESSION)
78  || err->resourceid == ATOM(KWIN_RUNNING)
79  || err->resourceid == ATOM(XdndProxy)
80  || err->resourceid == ATOM(XdndAware))
81 
82 
83  ) {
84  // Perhaps we're running under SECURITY reduction? :/
85  return 0;
86  }
87 #endif
88  qDebug() << "BadAtom";
89  break;
90 
91  case BadWindow:
92  if (err->request_code == 2 /* X_ChangeWindowAttributes */
93  || err->request_code == 38 /* X_QueryPointer */) {
94  for (int i = 0; i < ScreenCount(dpy); ++i) {
95  if (err->resourceid == RootWindow(dpy, i)) {
96  // Perhaps we're running under SECURITY reduction? :/
97  return 0;
98  }
99  }
100  }
101  seen_badwindow = true;
102  if (err->request_code == 25 /* X_SendEvent */) {
103  for (int i = 0; i < ScreenCount(dpy); ++i) {
104  if (err->resourceid == RootWindow(dpy, i)) {
105  // Perhaps we're running under SECURITY reduction? :/
106  return 0;
107  }
108  }
109 #if 0
110  if (X11->xdndHandleBadwindow()) {
111  qDebug("xdndHandleBadwindow returned true");
112  return 0;
113  }
114 #endif
115  }
116 #if 0
117  if (X11->ignore_badwindow)
118  return 0;
119 #endif
120  break;
121 
122  case BadMatch:
123  if (err->request_code == 42 /* X_SetInputFocus */)
124  return 0;
125  break;
126 
127  default:
128 #if 0
129  if (err->request_code == X11->xinput_major
130  && err->error_code == (X11->xinput_errorbase + XI_BadDevice)
131  && err->minor_code == 3 /* X_OpenDevice */) {
132  return 0;
133  }
134 #endif
135  break;
136  }
137 
138  char errstr[256];
139  XGetErrorText( dpy, err->error_code, errstr, 256 );
140  char buffer[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) {
145  // X error for a normal protocol request
146  qWarning( "X Error: %s %d\n"
147  " Major opcode: %d (%s)\n"
148  " Resource id: 0x%lx",
149  errstr, err->error_code,
150  err->request_code,
151  request_str,
152  err->resourceid );
153  } else {
154  // X error for an extension request
155  const char *extensionName = 0;
156 #if 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";
165 #endif
166  char minor_str[256];
167  if (extensionName) {
168  qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code);
169  XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256);
170  } else {
171  extensionName = "Uknown extension";
172  qsnprintf(minor_str, 256, "Unknown request");
173  }
174  qWarning( "X Error: %s %d\n"
175  " Extension: %d (%s)\n"
176  " Minor opcode: %d (%s)\n"
177  " Resource id: 0x%lx",
178  errstr, err->error_code,
179  err->request_code,
180  extensionName,
181  err->minor_code,
182  minor_str,
183  err->resourceid );
184  }
185 
186  // ### we really should distinguish between severe, non-severe and
187  // ### application specific errors
188 
189  return 0;
190 }
#define X11
Definition: qt_x11_p.h:724
#define ATOM(x)
Definition: qt_x11_p.h:723
Q_CORE_EXPORT void qDebug(const char *,...)
Q_CORE_EXPORT void qWarning(const char *,...)
int qsnprintf(char *str, size_t n, const char *fmt,...)
A portable snprintf() function, calls qvsnprintf.
Definition: qvsnprintf.cpp:128
static bool seen_badwindow
Definition: qxlibscreen.cpp:62

Variable Documentation

◆ original_x_errhandler

int(* original_x_errhandler) (Display *dpy, XErrorEvent *)
static

Definition at line 61 of file qxlibscreen.cpp.

Referenced by QXlibScreen::QXlibScreen().

◆ seen_badwindow

bool seen_badwindow
static

Definition at line 62 of file qxlibscreen.cpp.

Referenced by qt_x_errhandler().