Wean kdelibs off of the qt_x_*_time static variables

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1226986 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent b1960071ca
commit 7b12a18bb9

@ -172,8 +172,6 @@ bool KApplication::s_dcopClientNeedsPostInit = false;
#ifdef Q_WS_X11
static Atom atom_DesktopWindow;
static Atom atom_NetSupported;
extern Time qt_x_time;
extern Time qt_x_user_time;
static Atom kde_xdnd_drop;
#endif
@ -1750,18 +1748,18 @@ bool KApplication::x11EventFilter( XEvent *_event )
&& _event->xclient.data.l[ 4 ] == 0
&& _event->xclient.data.l[ 3 ] != 0 )
{
if( qt_x_user_time == 0
|| NET::timestampCompare( _event->xclient.data.l[ 3 ], qt_x_user_time ) > 0 )
if( GET_QT_X_USER_TIME() == 0
|| NET::timestampCompare( _event->xclient.data.l[ 3 ], GET_QT_X_USER_TIME() ) > 0 )
{ // and the timestamp looks reasonable
qt_x_user_time = _event->xclient.data.l[ 3 ]; // update our qt_x_user_time from it
SET_QT_X_USER_TIME(_event->xclient.data.l[ 3 ]); // update our qt_x_user_time from it
}
}
else // normal DND, only needed until Qt updates qt_x_user_time from XdndDrop
{
if( qt_x_user_time == 0
|| NET::timestampCompare( _event->xclient.data.l[ 2 ], qt_x_user_time ) > 0 )
if( GET_QT_X_USER_TIME() == 0
|| NET::timestampCompare( _event->xclient.data.l[ 2 ], GET_QT_X_USER_TIME() ) > 0 )
{ // the timestamp looks reasonable
qt_x_user_time = _event->xclient.data.l[ 2 ]; // update our qt_x_user_time from it
SET_QT_X_USER_TIME(_event->xclient.data.l[ 2 ]); // update our qt_x_user_time from it
}
}
}
@ -1879,16 +1877,16 @@ void KApplication::updateUserTimestamp( unsigned long time )
time = ev.xproperty.time;
XDestroyWindow( qt_xdisplay(), w );
}
if( qt_x_user_time == 0
|| NET::timestampCompare( time, qt_x_user_time ) > 0 ) // check time > qt_x_user_time
qt_x_user_time = time;
if( GET_QT_X_USER_TIME() == 0
|| NET::timestampCompare( time, GET_QT_X_USER_TIME() ) > 0 ) // check time > qt_x_user_time
SET_QT_X_USER_TIME(time);
#endif
}
unsigned long KApplication::userTimestamp() const
{
#if defined Q_WS_X11
return qt_x_user_time;
return GET_QT_X_USER_TIME();
#else
return 0;
#endif
@ -1898,7 +1896,7 @@ void KApplication::updateRemoteUserTimestamp( const TQCString& dcopId, unsigned
{
#if defined Q_WS_X11
if( time == 0 )
time = qt_x_user_time;
time = GET_QT_X_USER_TIME();
DCOPRef( dcopId, "MainApplication-Interface" ).call( "updateUserTimestamp", time );
#endif
}

@ -934,13 +934,8 @@ TQCString KStartupInfo::createNewStartupId()
hostname[ 0 ] = '\0';
if (!gethostname( hostname, 255 ))
hostname[sizeof(hostname)-1] = '\0';
#ifdef Q_WS_X11
extern Time qt_x_user_time;
#else
unsigned long qt_x_user_time = 0;
#endif
TQCString id = TQString(TQString( "%1;%2;%3;%4_TIME%5" ).arg( hostname ).arg( tm.tv_sec )
.arg( tm.tv_usec ).arg( getpid()).arg( qt_x_user_time )).utf8();
.arg( tm.tv_usec ).arg( getpid()).arg( GET_QT_X_USER_TIME() )).utf8();
kdDebug( 172 ) << "creating: " << id << ":" << tqAppName() << endl;
return id;
}

@ -57,8 +57,6 @@
static bool atoms_created = false;
extern Atom qt_wm_protocols;
extern Time qt_x_time;
extern Time qt_x_user_time;
static Atom net_wm_context_help;
static Atom kde_wm_change_state;
@ -241,7 +239,7 @@ void KWin::activateWindow( WId win, long time )
#ifdef Q_WS_X11
NETRootInfo info( qt_xdisplay(), 0 );
if( time == 0 )
time = qt_x_user_time;
time = GET_QT_X_USER_TIME();
info.setActiveWindow( win, NET::FromApplication, time,
kapp->activeWindow() ? kapp->activeWindow()->winId() : 0 );
#endif // Q_WS_X11 ...
@ -253,7 +251,7 @@ void KWin::forceActiveWindow( WId win, long time )
#ifdef Q_WS_X11
NETRootInfo info( qt_xdisplay(), 0 );
if( time == 0 )
time = qt_x_time;
time = GET_QT_X_TIME();
info.setActiveWindow( win, NET::FromTool, time, 0 );
#endif // Q_WS_X11
KUniqueApplication::setHandleAutoStarted();

@ -1600,9 +1600,8 @@ void NETRootInfo::updateSupportedProperties( Atom atom )
p->properties[ PROTOCOLS2 ] |= WM2FullPlacement;
}
extern Time qt_x_user_time;
void NETRootInfo::setActiveWindow(Window window) {
setActiveWindow( window, FromUnknown, qt_x_user_time, None );
setActiveWindow( window, FromUnknown, GET_QT_X_USER_TIME(), None );
}
void NETRootInfo::setActiveWindow(Window window, NET::RequestSource src,
@ -1811,7 +1810,7 @@ void NETRootInfo::moveResizeWindowRequest(Window window, int flags, int x, int y
void NETRootInfo::restackRequest(Window window, Window above, int detail)
{
restackRequest( window, FromTool, above, detail, qt_x_user_time );
restackRequest( window, FromTool, above, detail, GET_QT_X_USER_TIME() );
}
void NETRootInfo::restackRequest(Window window, RequestSource src, Window above, int detail, Time timestamp )

@ -48,8 +48,6 @@ Atom KDETrayProxy::makeSelectionAtom()
return XInternAtom( qt_xdisplay(), "_NET_SYSTEM_TRAY_S" + TQCString().setNum( qt_xscreen()), False );
}
extern Time qt_x_time;
void KDETrayProxy::windowAdded( WId w )
{
NETWinInfo ni( qt_xdisplay(), w, qt_xrootwin(), NET::WMKDESystemTrayWinFor );
@ -145,7 +143,7 @@ void KDETrayProxy::dockWindow( Window w, Window owner )
ev.xclient.window = owner;
ev.xclient.message_type = atom;
ev.xclient.format = 32;
ev.xclient.data.l[ 0 ] = qt_x_time;
ev.xclient.data.l[ 0 ] = GET_QT_X_TIME();
ev.xclient.data.l[ 1 ] = 0; // SYSTEM_TRAY_REQUEST_DOCK
ev.xclient.data.l[ 2 ] = w;
ev.xclient.data.l[ 3 ] = 0; // unused

@ -101,7 +101,6 @@ extern Atom qt_wm_protocols;
extern Atom qt_wm_delete_window;
extern Atom qt_wm_take_focus;
extern Atom qt_wm_state;
extern Time qt_x_time;
// L0006: X11 atoms private to QXEmbed
static Atom xembed = 0;
@ -200,7 +199,7 @@ static void sendXEmbedMessage( WId window, long message, long detail = 0,
ev.xclient.window = window;
ev.xclient.message_type = xembed;
ev.xclient.format = 32;
ev.xclient.data.l[0] = qt_x_time;
ev.xclient.data.l[0] = GET_QT_X_TIME();
ev.xclient.data.l[1] = message;
ev.xclient.data.l[2] = detail;
ev.xclient.data.l[3] = data1;
@ -220,7 +219,7 @@ static void sendClientMessage(Window window, Atom a, long x)
ev.xclient.message_type = a;
ev.xclient.format = 32;
ev.xclient.data.l[0] = x;
ev.xclient.data.l[1] = qt_x_time;
ev.xclient.data.l[1] = GET_QT_X_TIME();
XSendEvent(qt_xdisplay(), window, false, NoEventMask, &ev);
}
@ -436,8 +435,8 @@ static int qxembed_x11_event_filter( XEvent* e)
long message = e->xclient.data.l[1];
long detail = e->xclient.data.l[2];
// L0671: Keep Qt message time up to date
if ( msgtime > qt_x_time )
qt_x_time = msgtime;
if ( msgtime > GET_QT_X_TIME() )
SET_QT_X_TIME(msgtime);
TQWidget* w = TQT_TQWIDGET(TQWidget::find( e->xclient.window ));
if ( !w )
break;
@ -570,8 +569,8 @@ static int qxembed_x11_event_filter( XEvent* e)
Atom a = e->xclient.data.l[0];
if ( a == qt_wm_take_focus ) {
// L0695: update Qt message time variable
if ( (ulong) e->xclient.data.l[1] > qt_x_time )
qt_x_time = e->xclient.data.l[1];
if ( (ulong) e->xclient.data.l[1] > GET_QT_X_TIME() )
SET_QT_X_TIME(e->xclient.data.l[1]);
// L0696: There is no problem when the window is not active.
// Qt will generate a WindowActivate event that will
// do the job (L1310). This does not happen if the
@ -695,7 +694,7 @@ QXEmbed::QXEmbed(TQWidget *parent, const char *name, WFlags f)
if ( tqApp->activeWindow() == tqtopLevelWidget() )
if ( !((QPublicWidget*) tqtopLevelWidget())->topData()->embedded )
XSetInputFocus( qt_xdisplay(), d->focusProxy->winId(),
RevertToParent, qt_x_time );
RevertToParent, GET_QT_X_TIME() );
// L0915: ??? [drag&drop?]
setAcceptDrops( true );
}
@ -747,7 +746,7 @@ QXEmbed::~QXEmbed()
int revert;
XGetInputFocus( qt_xdisplay(), &focus, &revert );
if( focus == d->focusProxy->winId())
XSetInputFocus( qt_xdisplay(), tqtopLevelWidget()->winId(), RevertToParent, qt_x_time );
XSetInputFocus( qt_xdisplay(), tqtopLevelWidget()->winId(), RevertToParent, GET_QT_X_TIME() );
// L01045: Delete our private data.
delete d;
}
@ -817,7 +816,7 @@ bool QXEmbed::eventFilter( TQObject *o, TQEvent * e)
if ( !((QPublicWidget*) tqtopLevelWidget())->topData()->embedded )
if (! hasFocus() )
XSetInputFocus( qt_xdisplay(), d->focusProxy->winId(),
RevertToParent, qt_x_time );
RevertToParent, GET_QT_X_TIME() );
if (d->xplain)
// L1311: Activation has changed. Grab state might change. See L2800.
checkGrab();
@ -901,7 +900,7 @@ void QXEmbed::focusInEvent( TQFocusEvent * e ){
// This is dual safety here because FocusIn implies this.
// But see L1581 for an example where this really matters.
XSetInputFocus( qt_xdisplay(), d->focusProxy->winId(),
RevertToParent, qt_x_time );
RevertToParent, GET_QT_X_TIME() );
if (d->xplain) {
// L1520: Qt focus has changed. Grab state might change. See L2800.
checkGrab();
@ -951,7 +950,7 @@ void QXEmbed::focusOutEvent( TQFocusEvent * ){
// Function isActiveWindow() also returns true when a modal
// dialog child of this window is active.
XSetInputFocus( qt_xdisplay(), d->focusProxy->winId(),
RevertToParent, qt_x_time );
RevertToParent, GET_QT_X_TIME() );
}

Loading…
Cancel
Save