summaryrefslogtreecommitdiffstats
path: root/src/kernel/tqclipboard_x11.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/tqclipboard_x11.cpp')
-rw-r--r--src/kernel/tqclipboard_x11.cpp136
1 files changed, 68 insertions, 68 deletions
diff --git a/src/kernel/tqclipboard_x11.cpp b/src/kernel/tqclipboard_x11.cpp
index 685837650..3ab6ec5f0 100644
--- a/src/kernel/tqclipboard_x11.cpp
+++ b/src/kernel/tqclipboard_x11.cpp
@@ -44,13 +44,13 @@
#ifdef TQCLIPBOARD_DEBUG
# define TQDEBUG tqDebug
#else
-# define TQDEBUG if (FALSE) tqDebug
+# define TQDEBUG if (false) tqDebug
#endif
#ifdef TQCLIPBOARD_DEBUG_VERBOSE
# define VTQDEBUG tqDebug
#else
-# define VTQDEBUG if (FALSE) tqDebug
+# define VTQDEBUG if (false) tqDebug
#endif
#include "qplatformdefs.h"
@@ -104,19 +104,19 @@ static int clipboard_timeout = 5000; // 5s timeout on clipboard operations
static TQWidget * owner = 0;
static TQWidget *requestor = 0;
-static bool inSelectionMode_obsolete = FALSE; // ### remove 4.0
-static bool timer_event_clear = FALSE;
+static bool inSelectionMode_obsolete = false; // ### remove 4.0
+static bool timer_event_clear = false;
static int timer_id = 0;
static int pending_timer_id = 0;
-static bool pending_clipboard_changed = FALSE;
-static bool pending_selection_changed = FALSE;
+static bool pending_clipboard_changed = false;
+static bool pending_selection_changed = false;
TQ_EXPORT bool tqt_qclipboard_bailout_hack = false;
// event capture mechanism for qt_xclb_wait_for_event
-static bool waiting_for_data = FALSE;
-static bool has_captured_event = FALSE;
+static bool waiting_for_data = false;
+static bool has_captured_event = false;
static Window capture_event_win = None;
static int capture_event_type = -1;
static XEvent captured_event;
@@ -179,7 +179,7 @@ public:
void setSource(TQMimeSource* s)
{
- clear(TRUE);
+ clear(true);
src = s;
}
@@ -197,7 +197,7 @@ public:
transferred[1] = TQPixmap();
}
- void clear(bool destruct=TRUE);
+ void clear(bool destruct=true);
TQMimeSource *src;
Time timestamp;
@@ -247,7 +247,7 @@ static TQClipboardData *clipboardData()
void tqt_clipboard_cleanup_mime_source(TQMimeSource *src)
{
if(internalCbData && internalCbData->source() == src)
- internalCbData->clear(FALSE);
+ internalCbData->clear(false);
}
static void cleanupSelectionData()
@@ -391,23 +391,23 @@ void TQClipboard::clear( Mode mode )
/*!
- Returns TRUE if the clipboard supports mouse selection; otherwise
- returns FALSE.
+ Returns true if the clipboard supports mouse selection; otherwise
+ returns false.
*/
bool TQClipboard::supportsSelection() const
-{ return TRUE; }
+{ return true; }
/*!
- Returns TRUE if this clipboard object owns the mouse selection
- data; otherwise returns FALSE.
+ Returns true if this clipboard object owns the mouse selection
+ data; otherwise returns false.
*/
bool TQClipboard::ownsSelection() const
{ return selectionData()->timestamp != CurrentTime; }
/*!
- Returns TRUE if this clipboard object owns the clipboard data;
- otherwise returns FALSE.
+ Returns true if this clipboard object owns the clipboard data;
+ otherwise returns false.
*/
bool TQClipboard::ownsClipboard() const
{ return clipboardData()->timestamp != CurrentTime; }
@@ -418,7 +418,7 @@ bool TQClipboard::ownsClipboard() const
Use the TQClipboard::data(), TQClipboard::setData() and related functions
which take a TQClipboard::Mode argument.
- Sets the clipboard selection mode. If \a enable is TRUE, then
+ Sets the clipboard selection mode. If \a enable is true, then
subsequent calls to TQClipboard::setData() and other functions
which put data into the clipboard will put the data into the mouse
selection, otherwise the data will be put into the clipboard.
@@ -449,7 +449,7 @@ static int qt_xclb_event_filter(XEvent *event)
if (event->xany.type == capture_event_type &&
event->xany.window == capture_event_win) {
VTQDEBUG( "TQClipboard: event_filter(): caught event type %d", event->type );
- has_captured_event = TRUE;
+ has_captured_event = true;
captured_event = *event;
return 1;
}
@@ -484,8 +484,8 @@ bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, XEvent *event,
if ( waiting_for_data )
tqFatal( "TQClipboard: internal error, qt_xclb_wait_for_event recursed" );
- waiting_for_data = TRUE;
- has_captured_event = FALSE;
+ waiting_for_data = true;
+ has_captured_event = false;
capture_event_win = win;
capture_event_type = type;
@@ -493,9 +493,9 @@ bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, XEvent *event,
do {
if ( XCheckTypedWindowEvent(dpy,win,type,event) ) {
- waiting_for_data = FALSE;
+ waiting_for_data = false;
tqt_set_x11_event_filter(old_event_filter);
- return TRUE;
+ return true;
}
now = TQTime::currentTime();
@@ -508,30 +508,30 @@ bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, XEvent *event,
TQEventLoop::ExcludeTimers);
if ( has_captured_event ) {
- waiting_for_data = FALSE;
+ waiting_for_data = false;
*event = captured_event;
tqt_set_x11_event_filter(old_event_filter);
- return TRUE;
+ return true;
}
} while ( started.msecsTo(now) < timeout );
- waiting_for_data = FALSE;
+ waiting_for_data = false;
tqt_set_x11_event_filter(old_event_filter);
- return FALSE;
+ return false;
}
- bool flushed = FALSE;
+ bool flushed = false;
do {
if ( XCheckTypedWindowEvent(dpy,win,type,event) )
- return TRUE;
+ return true;
if( tqt_qclipboard_bailout_hack ) {
XEvent dummy;
selection_request_pending = false;
if ( owner != NULL )
XCheckIfEvent(dpy,&dummy,check_selection_request_pending,NULL);
if( selection_request_pending )
- return TRUE;
+ return true;
}
// process other clipboard events, since someone is probably requesting data from us
@@ -545,7 +545,7 @@ bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, XEvent *event,
if(!flushed) {
XFlush( dpy );
- flushed = TRUE;
+ flushed = true;
}
// sleep 50ms, so we don't use up CPU cycles all the time.
@@ -555,7 +555,7 @@ bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, XEvent *event,
select(0, 0, 0, 0, &usleep_tv);
} while ( started.msecsTo(now) < timeout );
- return FALSE;
+ return false;
}
@@ -588,7 +588,7 @@ bool qt_xclb_read_property( Display *dpy, Window win, Atom property,
&length, &bytes_left, &data );
if (r != Success || (type && *type == None)) {
buffer->resize( 0 );
- return FALSE;
+ return false;
}
XFree( (char*)data );
@@ -699,7 +699,7 @@ TQByteArray qt_xclb_read_incremental_property( Display *dpy, Window win,
TQByteArray buf;
TQByteArray tmp_buf;
- bool alloc_error = FALSE;
+ bool alloc_error = false;
int length;
int offset = 0;
@@ -717,8 +717,8 @@ TQByteArray qt_xclb_read_incremental_property( Display *dpy, Window win,
if ( event.xproperty.atom != property ||
event.xproperty.state != PropertyNewValue )
continue;
- if ( qt_xclb_read_property(dpy, win, property, TRUE, &tmp_buf,
- &length,0, 0, FALSE) ) {
+ if ( qt_xclb_read_property(dpy, win, property, true, &tmp_buf,
+ &length,0, 0, false) ) {
if ( length == 0 ) { // no more data, we're done
if ( nullterm ) {
buf.resize( offset+1 );
@@ -730,7 +730,7 @@ TQByteArray qt_xclb_read_incremental_property( Display *dpy, Window win,
} else if ( !alloc_error ) {
if ( offset+length > (int)buf.size() ) {
if ( !buf.resize(offset+length+65535) ) {
- alloc_error = TRUE;
+ alloc_error = true;
length = buf.size() - offset;
}
}
@@ -966,44 +966,44 @@ bool TQClipboard::event( TQEvent *e )
TQTimerEvent *te = (TQTimerEvent *) e;
if ( waiting_for_data ) // should never happen
- return FALSE;
+ return false;
if (te->timerId() == timer_id) {
killTimer(timer_id);
timer_id = 0;
- timer_event_clear = TRUE;
+ timer_event_clear = true;
if ( selection_watcher ) // clear selection
selectionData()->clear();
if ( clipboard_watcher ) // clear clipboard
clipboardData()->clear();
- timer_event_clear = FALSE;
+ timer_event_clear = false;
- return TRUE;
+ return true;
} else if ( te->timerId() == pending_timer_id ) {
// I hate klipper
killTimer( pending_timer_id );
pending_timer_id = 0;
if ( pending_clipboard_changed ) {
- pending_clipboard_changed = FALSE;
+ pending_clipboard_changed = false;
clipboardData()->clear();
emit dataChanged();
}
if ( pending_selection_changed ) {
- pending_selection_changed = FALSE;
+ pending_selection_changed = false;
selectionData()->clear();
emit selectionChanged();
}
- return TRUE;
+ return true;
} else if (te->timerId() == incr_timer_id) {
killTimer(incr_timer_id);
incr_timer_id = 0;
qt_xclb_incr_timeout();
- return TRUE;
+ return true;
} else {
return TQObject::event( e );
}
@@ -1015,7 +1015,7 @@ bool TQClipboard::event( TQEvent *e )
Display *dpy = TQPaintDevice::x11AppDisplay();
if ( !xevent )
- return TRUE;
+ return true;
switch ( xevent->type ) {
@@ -1036,7 +1036,7 @@ bool TQClipboard::event( TQEvent *e )
d->clear();
emit selectionChanged();
} else {
- pending_selection_changed = TRUE;
+ pending_selection_changed = true;
if ( ! pending_timer_id )
pending_timer_id = TQApplication::clipboard()->startTimer( 0 );
}
@@ -1055,7 +1055,7 @@ bool TQClipboard::event( TQEvent *e )
d->clear();
emit dataChanged();
} else {
- pending_clipboard_changed = TRUE;
+ pending_clipboard_changed = true;
if ( ! pending_timer_id )
pending_timer_id = TQApplication::clipboard()->startTimer( 0 );
}
@@ -1063,7 +1063,7 @@ bool TQClipboard::event( TQEvent *e )
#ifdef QT_CHECK_STATE
tqWarning("TQClipboard: Unknown SelectionClear event received.");
#endif
- return FALSE;
+ return false;
}
break;
@@ -1147,13 +1147,13 @@ bool TQClipboard::event( TQEvent *e )
int multi_format = 0;
int nmulti = 0;
int imulti = -1;
- bool multi_writeback = FALSE;
+ bool multi_writeback = false;
if ( req->target == xa_multiple ) {
TQByteArray multi_data;
if (req->property == None
|| !qt_xclb_read_property(dpy, req->requestor, req->property,
- FALSE, &multi_data, 0, &multi_type, &multi_format, 0)
+ false, &multi_data, 0, &multi_type, &multi_format, 0)
|| multi_format != 32) {
// MULTIPLE property not formatted correctly
XSendEvent(dpy, req->requestor, False, NoEventMask, &event);
@@ -1210,7 +1210,7 @@ bool TQClipboard::event( TQEvent *e )
if (nmulti > 0) {
if (ret == None) {
multi[imulti].property = None;
- multi_writeback = TRUE;
+ multi_writeback = true;
}
} else {
event.xselection.property = ret;
@@ -1241,7 +1241,7 @@ bool TQClipboard::event( TQEvent *e )
break;
}
- return TRUE;
+ return true;
}
@@ -1286,7 +1286,7 @@ bool TQClipboardWatcher::empty() const
#ifdef QT_CHECK_STATE
if( win == requestor->winId()) {
tqWarning( "TQClipboardWatcher::empty: internal error, app owns the selection" );
- return TRUE;
+ return true;
}
#endif // QT_CHECK_STATE
@@ -1432,7 +1432,7 @@ TQByteArray TQClipboardWatcher::getDataInFormat(Atom fmtatom) const
XDeleteProperty(dpy, win, qt_selection_property);
XConvertSelection(dpy, atom, fmtatom, qt_selection_property, win, tqt_x_time);
- XSync(dpy, FALSE);
+ XSync(dpy, false);
VTQDEBUG("TQClipboardWatcher::getDataInFormat: waiting for SelectionNotify event");
@@ -1448,13 +1448,13 @@ TQByteArray TQClipboardWatcher::getDataInFormat(Atom fmtatom) const
Atom type;
XSelectInput(dpy, win, PropertyChangeMask);
- if ( qt_xclb_read_property(dpy,win,qt_selection_property,TRUE,
- &buf,0,&type,0,FALSE) ) {
+ if ( qt_xclb_read_property(dpy,win,qt_selection_property,true,
+ &buf,0,&type,0,false) ) {
if ( type == qt_x_incr ) {
int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0;
buf = qt_xclb_read_incremental_property( dpy, win,
qt_selection_property,
- nbytes, FALSE );
+ nbytes, false );
}
}
@@ -1577,13 +1577,13 @@ void TQClipboard::setData( TQMimeSource* src, Mode mode )
/*
Called by the main event loop in tqapplication_x11.cpp when the
_QT_SELECTION_SENTINEL property has been changed (i.e. when some TQt
- process has performed TQClipboard::setData(). If it returns TRUE, the
+ process has performed TQClipboard::setData(). If it returns true, the
TQClipBoard dataChanged() signal should be emitted.
*/
bool qt_check_selection_sentinel()
{
- bool doIt = TRUE;
+ bool doIt = true;
if ( owner ) {
/*
Since the X selection mechanism cannot give any signal when
@@ -1610,7 +1610,7 @@ bool qt_check_selection_sentinel()
if ( actualType == XA_WINDOW && actualFormat == 32 && nitems == 2 ) {
Window win = owner->winId();
if ( owners[0] == win || owners[1] == win )
- doIt = FALSE;
+ doIt = false;
}
XFree( owners );
@@ -1619,10 +1619,10 @@ bool qt_check_selection_sentinel()
if (doIt) {
if ( waiting_for_data ) {
- pending_selection_changed = TRUE;
+ pending_selection_changed = true;
if ( ! pending_timer_id )
pending_timer_id = TQApplication::clipboard()->startTimer( 0 );
- doIt = FALSE;
+ doIt = false;
} else {
selectionData()->clear();
}
@@ -1634,7 +1634,7 @@ bool qt_check_selection_sentinel()
bool qt_check_clipboard_sentinel()
{
- bool doIt = TRUE;
+ bool doIt = true;
if (owner) {
Window *owners;
Atom actualType;
@@ -1649,7 +1649,7 @@ bool qt_check_clipboard_sentinel()
if (actualType == XA_WINDOW && actualFormat == 32 && nitems == 2) {
Window win = owner->winId();
if (owners[0] == win || owners[1] == win)
- doIt = FALSE;
+ doIt = false;
}
XFree(owners);
@@ -1658,10 +1658,10 @@ bool qt_check_clipboard_sentinel()
if (doIt) {
if ( waiting_for_data ) {
- pending_clipboard_changed = TRUE;
+ pending_clipboard_changed = true;
if ( ! pending_timer_id )
pending_timer_id = TQApplication::clipboard()->startTimer( 0 );
- doIt = FALSE;
+ doIt = false;
} else {
clipboardData()->clear();
}