src/gui/kernel/qx11embed_x11.cpp File Reference

#include "qx11embed_x11.h"
#include <qapplication.h>
#include <qevent.h>
#include <qpainter.h>
#include <qlayout.h>
#include <qstyle.h>
#include <qstyleoption.h>
#include <qdatetime.h>
#include <qpointer.h>
#include <qdebug.h>
#include <qx11info_x11.h>
#include <private/qt_x11_p.h>
#include <private/qwidget_p.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/keysymdef.h>
#include <X11/X.h>

Include dependency graph for qx11embed_x11.cpp:

Go to the source code of this file.

Classes

class  QHackWidget
class  QX11EmbedWidgetPrivate
class  QX11EmbedContainerPrivate

Defines

#define XK_MISCELLANY
#define XK_LATIN1
#define None   0
#define XK_ISO_Left_Tab   0xFE20

Enumerations

enum  QX11EmbedMessageType
enum  QX11EmbedFocusInDetail
enum  QX11EmbedFocusInFlags
enum  QX11EmbedInfoFlags
enum  QX11EmbedAccelModifiers
enum  QX11EmbedAccelFlags

Functions

static int x11ErrorHandler (Display *, XErrorEvent *)
static void initXEmbedAtoms (Display *d)
static Time x11Time ()
static unsigned int XEmbedVersion ()
static void sendXEmbedMessage (WId window, Display *display, long message, long detail=0, long data1=0, long data2=0)
static bool x11EventFilter (void *message, long *result)

Variables

const int XButtonPress = ButtonPress
const int XButtonRelease = ButtonRelease
static unsigned int XEMBED_VERSION = 0
static Atom _XEMBED = None
static Atom _XEMBED_INFO = None
static XKeyEvent lastKeyEvent
static QCoreApplication::EventFilter oldX11EventFilter


Define Documentation

#define None   0

Definition at line 40 of file qx11embed_x11.cpp.

Referenced by QX11EmbedContainerPrivate::acceptClient(), Q3DataTable::beginEdit(), QX11EmbedContainerPrivate::checkGrab(), Q3DataManager::confirmEdit(), Q3DataTable::contentsContextMenuEvent(), Q3DataTable::createEditor(), Q3DataTable::doUpdateCurrent(), Q3DataTable::endEdit(), Q3DataTable::endInsert(), Q3DataTable::endUpdate(), Q3DataTable::eventFilter(), QTextStreamPrivate::getReal(), QSpanData::init(), initXEmbedAtoms(), QSystemTrayIconPrivate::isSystemTrayAvailable_sys(), QAbstractSpinBox::mousePressEvent(), Q3DataTable::paintCell(), QAbstractSpinBoxPrivate::reset(), Q3DataTable::reset(), and Q3DataTable::sortColumn().

#define XK_ISO_Left_Tab   0xFE20

Definition at line 48 of file qx11embed_x11.cpp.

#define XK_LATIN1

Definition at line 39 of file qx11embed_x11.cpp.

#define XK_MISCELLANY

Definition at line 38 of file qx11embed_x11.cpp.


Enumeration Type Documentation

enum QX11EmbedAccelFlags

Definition at line 304 of file qx11embed_x11.cpp.

00304                          {
00305     XEMBED_ACCELERATOR_OVERLOADED = (1 << 0)
00306 };

enum QX11EmbedAccelModifiers

Definition at line 296 of file qx11embed_x11.cpp.

00296                              {
00297     XEMBED_MODIFIER_SHIFT = (1 << 0),
00298     XEMBED_MODIFIER_CONTROL = (1 << 1),
00299     XEMBED_MODIFIER_ALT = (1 << 2),
00300     XEMBED_MODIFIER_SUPER = (1 << 3),
00301     XEMBED_MODIFIER_HYPER = (1 << 4)
00302 };

enum QX11EmbedFocusInDetail

Definition at line 281 of file qx11embed_x11.cpp.

00281                             {
00282     XEMBED_FOCUS_CURRENT = 0,
00283     XEMBED_FOCUS_FIRST = 1,
00284     XEMBED_FOCUS_LAST = 2
00285 };

enum QX11EmbedFocusInFlags

Definition at line 287 of file qx11embed_x11.cpp.

00287                            {
00288     XEMBED_FOCUS_OTHER = (0 << 0),
00289     XEMBED_FOCUS_WRAPAROUND = (1 << 0)
00290 };

enum QX11EmbedInfoFlags

Definition at line 292 of file qx11embed_x11.cpp.

00292                         {
00293     XEMBED_MAPPED = (1 << 0)
00294 };

enum QX11EmbedMessageType

Definition at line 265 of file qx11embed_x11.cpp.


Function Documentation

static void initXEmbedAtoms ( Display d  )  [static]

Definition at line 315 of file qx11embed_x11.cpp.

References _XEMBED, _XEMBED_INFO, and None.

Referenced by QX11EmbedContainer::QX11EmbedContainer(), and QX11EmbedWidget::QX11EmbedWidget().

00316 {
00317     if (_XEMBED == None)
00318         _XEMBED = XInternAtom(d, "_XEMBED", false);
00319 
00320     if (_XEMBED_INFO == None)
00321         _XEMBED_INFO = XInternAtom(d, "_XEMBED_INFO", false);
00322 }

static void sendXEmbedMessage ( WId  window,
Display display,
long  message,
long  detail = 0,
long  data1 = 0,
long  data2 = 0 
) [static]

Definition at line 338 of file qx11embed_x11.cpp.

References _XEMBED, c, and x11Time().

Referenced by QX11EmbedContainerPrivate::acceptClient(), QX11EmbedWidgetPrivate::checkActivateWindow(), QX11EmbedWidget::eventFilter(), QX11EmbedContainer::eventFilter(), and QX11EmbedContainer::x11Event().

00340 {
00341     XClientMessageEvent c;
00342     memset(&c, 0, sizeof(c));
00343     c.type = ClientMessage;
00344     c.message_type = _XEMBED;
00345     c.format = 32;
00346     c.display = display;
00347     c.window = window;
00348 
00349     c.data.l[0] = x11Time();
00350     c.data.l[1] = message;
00351     c.data.l[2] = detail;
00352     c.data.l[3] = data1;
00353     c.data.l[4] = data2;
00354 
00355     XSendEvent(display, window, false, NoEventMask, (XEvent *) &c);
00356 }

Here is the call graph for this function:

static int x11ErrorHandler ( Display ,
XErrorEvent *   
) [static]

Definition at line 309 of file qx11embed_x11.cpp.

Referenced by QX11EmbedContainer::QX11EmbedContainer(), and QX11EmbedWidget::QX11EmbedWidget().

00310 {
00311     return 0;
00312 }

static bool x11EventFilter ( void *  message,
long *  result 
) [static]

Definition at line 366 of file qx11embed_x11.cpp.

References a, ATOM, QWidget::find(), oldX11EventFilter, QCoreApplication::sendEvent(), w, QEvent::WindowActivate, X11, XKeyPress, and XKeyRelease.

Referenced by QX11EmbedContainer::QX11EmbedContainer().

00367 {
00368     XEvent *event = reinterpret_cast<XEvent *>(message);
00369     if (event->type == XKeyPress || event->type == XKeyRelease)
00370   lastKeyEvent = event->xkey;
00371 
00372     // Update qt_x_time when a focusin is received. If the widget that
00373     // receives this event is active, send a WindowActivate
00374     // event. This will cause that widget to call XSetInputFocus
00375     // immediately, in which case the timestamp will be correct.
00376     if (event->type == ClientMessage && event->xclient.message_type == ATOM(WM_PROTOCOLS)) {
00377   QWidget *w = QWidget::find(event->xclient.window);
00378   if (w) {
00379       Atom a = event->xclient.data.l[0];
00380       if (a == ATOM(WM_TAKE_FOCUS)) {
00381     if ((ulong) event->xclient.data.l[1] > X11->time )
00382         X11->time = event->xclient.data.l[1];
00383 
00384     if (w->isActiveWindow()) {
00385         QEvent e(QEvent::WindowActivate);
00386         QApplication::sendEvent(w, &e);
00387     }
00388       }
00389   }
00390     }
00391 
00392     if (oldX11EventFilter && oldX11EventFilter != &x11EventFilter)
00393   return oldX11EventFilter(message, result);
00394     else
00395   return false;
00396 }

Here is the call graph for this function:

static Time x11Time (  )  [static]

Definition at line 326 of file qx11embed_x11.cpp.

References qt_x11Data, and QX11Data::time.

Referenced by QX11EmbedContainerPrivate::acceptClient(), QX11EmbedContainer::eventFilter(), QX11EmbedContainerPrivate::moveInputToProxy(), and sendXEmbedMessage().

00327 {
00328     return qt_x11Data->time;
00329 }

static unsigned int XEmbedVersion (  )  [static]

Definition at line 332 of file qx11embed_x11.cpp.

Referenced by QX11EmbedContainerPrivate::acceptClient().

00333 {
00334     return 0;
00335 }


Variable Documentation

Atom _XEMBED = None [static]

Definition at line 262 of file qx11embed_x11.cpp.

Referenced by initXEmbedAtoms(), sendXEmbedMessage(), QX11EmbedWidget::x11Event(), and QX11EmbedContainer::x11Event().

Atom _XEMBED_INFO = None [static]

Definition at line 263 of file qx11embed_x11.cpp.

Referenced by QX11EmbedContainerPrivate::acceptClient(), QX11EmbedContainer::hideEvent(), initXEmbedAtoms(), QX11EmbedWidget::QX11EmbedWidget(), QX11EmbedContainer::showEvent(), and QX11EmbedWidget::x11Event().

XKeyEvent lastKeyEvent [static]

Definition at line 359 of file qx11embed_x11.cpp.

QCoreApplication::EventFilter oldX11EventFilter [static]

Definition at line 361 of file qx11embed_x11.cpp.

Referenced by x11EventFilter().

const int XButtonPress = ButtonPress

Definition at line 246 of file qx11embed_x11.cpp.

Referenced by QX11EmbedContainer::x11Event().

const int XButtonRelease = ButtonRelease

Definition at line 247 of file qx11embed_x11.cpp.

Referenced by QX11EmbedContainer::x11Event().

unsigned int XEMBED_VERSION = 0 [static]

Definition at line 260 of file qx11embed_x11.cpp.

Referenced by QX11EmbedContainer::hideEvent(), QX11EmbedWidget::QX11EmbedWidget(), and QX11EmbedContainer::showEvent().


Generated on Thu Mar 15 13:31:17 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1