Qt 4.8
Public Functions | Public Variables | List of all members
QClipboardINCRTransaction Class Reference

Public Functions

 QClipboardINCRTransaction (Window w, Atom p, Atom t, int f, QByteArray d, unsigned int i)
 
int x11Event (XEvent *event)
 
 ~QClipboardINCRTransaction (void)
 

Public Variables

QByteArray data
 
int format
 
unsigned int increment
 
unsigned int offset
 
Atom property
 
Atom target
 
Window window
 

Detailed Description

Definition at line 257 of file qclipboard_x11.cpp.

Constructors and Destructors

◆ QClipboardINCRTransaction()

QClipboardINCRTransaction::QClipboardINCRTransaction ( Window  w,
Atom  p,
Atom  t,
int  f,
QByteArray  d,
unsigned int  i 
)

Definition at line 304 of file qclipboard_x11.cpp.

306  : window(w), property(p), target(t), format(f), data(d), increment(i), offset(0u)
307 {
308  DEBUG("QClipboard: sending %d bytes (INCR transaction %p)", d.size(), this);
309 
310  XSelectInput(X11->display, window, PropertyChangeMask);
311 
312  if (! transactions) {
313  VDEBUG("QClipboard: created INCR transaction map");
317  }
318  transactions->insert(window, this);
319 }
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
Definition: qobject.cpp:1623
static bool qt_x11_incr_event_filter(void *message, long *result)
static int clipboard_timeout
QMap< Window, QClipboardINCRTransaction * > TransactionMap
static QApplication::EventFilter prev_event_filter
quint16 u
#define X11
Definition: qt_x11_p.h:724
static int incr_timer_id
static TransactionMap * transactions
static QClipboard * clipboard()
Returns a pointer to the application global clipboard.
#define qApp
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
Definition: qmap.h:559
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402
#define DEBUG
#define VDEBUG

◆ ~QClipboardINCRTransaction()

QClipboardINCRTransaction::~QClipboardINCRTransaction ( void  )

Definition at line 321 of file qclipboard_x11.cpp.

322 {
323  VDEBUG("QClipboard: destroyed INCR transacton %p", this);
324 
325  XSelectInput(X11->display, window, NoEventMask);
326 
328  if (transactions->isEmpty()) {
329  VDEBUG("QClipboard: no more INCR transactions");
330  delete transactions;
331  transactions = 0;
332 
333  (void)qApp->setEventFilter(prev_event_filter);
334 
335  if (incr_timer_id != 0) {
337  incr_timer_id = 0;
338  }
339  }
340 }
static QApplication::EventFilter prev_event_filter
#define X11
Definition: qt_x11_p.h:724
static int incr_timer_id
static TransactionMap * transactions
static QClipboard * clipboard()
Returns a pointer to the application global clipboard.
#define qApp
int remove(const Key &key)
Removes all the items that have the key key from the map.
Definition: qmap.h:662
bool isEmpty() const
Returns true if the map contains no items; otherwise returns false.
Definition: qmap.h:203
#define VDEBUG
void killTimer(int id)
Kills the timer with timer identifier, id.
Definition: qobject.cpp:1650

Functions

◆ x11Event()

int QClipboardINCRTransaction::x11Event ( XEvent event)

Definition at line 342 of file qclipboard_x11.cpp.

343 {
344  if (event->type != PropertyNotify
345  || (event->xproperty.state != PropertyDelete
346  || event->xproperty.atom != property))
347  return 0;
348 
349  // restart the INCR timer
352 
353  unsigned int bytes_left = data.size() - offset;
354  if (bytes_left > 0) {
355  unsigned int xfer = qMin(increment, bytes_left);
356  VDEBUG("QClipboard: sending %d bytes, %d remaining (INCR transaction %p)",
357  xfer, bytes_left - xfer, this);
358 
359  XChangeProperty(X11->display, window, property, target, format,
360  PropModeReplace, (uchar *) data.data() + offset, xfer);
361  offset += xfer;
362  } else {
363  // INCR transaction finished...
364  XChangeProperty(X11->display, window, property, target, format,
365  PropModeReplace, (uchar *) data.data(), 0);
366  delete this;
367  }
368 
369  return 1;
370 }
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
Definition: qobject.cpp:1623
static int clipboard_timeout
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
EventRef event
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
#define X11
Definition: qt_x11_p.h:724
static int incr_timer_id
unsigned char uchar
Definition: qglobal.h:994
static QClipboard * clipboard()
Returns a pointer to the application global clipboard.
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402
#define VDEBUG
void killTimer(int id)
Kills the timer with timer identifier, id.
Definition: qobject.cpp:1650

Properties

◆ data

QByteArray QClipboardINCRTransaction::data

Definition at line 268 of file qclipboard_x11.cpp.

Referenced by qt_init_timestamp_scanner(), and x11Event().

◆ format

int QClipboardINCRTransaction::format

Definition at line 267 of file qclipboard_x11.cpp.

◆ increment

unsigned int QClipboardINCRTransaction::increment

Definition at line 269 of file qclipboard_x11.cpp.

Referenced by x11Event().

◆ offset

unsigned int QClipboardINCRTransaction::offset

Definition at line 270 of file qclipboard_x11.cpp.

Referenced by x11Event().

◆ property

Atom QClipboardINCRTransaction::property

Definition at line 266 of file qclipboard_x11.cpp.

Referenced by x11Event().

◆ target

Atom QClipboardINCRTransaction::target

Definition at line 266 of file qclipboard_x11.cpp.

Referenced by x11Event().

◆ window

Window QClipboardINCRTransaction::window

The documentation for this class was generated from the following file: