From 7b12a18bb964683b857ca2250db3919303a99838 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sun, 3 Apr 2011 20:56:33 +0000 Subject: 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 --- kdecore/kapplication.cpp | 24 +++++++++++------------- kdecore/kstartupinfo.cpp | 7 +------ kdecore/kwin.cpp | 6 ++---- kdecore/netwm.cpp | 5 ++--- 4 files changed, 16 insertions(+), 26 deletions(-) (limited to 'kdecore') diff --git a/kdecore/kapplication.cpp b/kdecore/kapplication.cpp index 32091b863..a1df33463 100644 --- a/kdecore/kapplication.cpp +++ b/kdecore/kapplication.cpp @@ -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 } diff --git a/kdecore/kstartupinfo.cpp b/kdecore/kstartupinfo.cpp index a55c82f55..19ba9797f 100644 --- a/kdecore/kstartupinfo.cpp +++ b/kdecore/kstartupinfo.cpp @@ -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; } diff --git a/kdecore/kwin.cpp b/kdecore/kwin.cpp index 706b985fb..01f942aac 100644 --- a/kdecore/kwin.cpp +++ b/kdecore/kwin.cpp @@ -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(); diff --git a/kdecore/netwm.cpp b/kdecore/netwm.cpp index 64c6aab2b..6ca557532 100644 --- a/kdecore/netwm.cpp +++ b/kdecore/netwm.cpp @@ -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 ) -- cgit v1.2.1