From e057cf9e08ab13e3f6ed139f6b0be3a06c2ec20c Mon Sep 17 00:00:00 2001 From: tpearson Date: Sun, 3 Apr 2011 23:58:37 +0000 Subject: Wean kdebase off of hacky static qt_x_*_tim variables git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1227011 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kwin/activation.cpp | 6 ++---- kwin/client.cpp | 17 ++++++++--------- kwin/events.cpp | 10 ++++++---- kwin/geometry.cpp | 16 +++++++--------- kwin/layers.cpp | 2 -- kwin/main.cpp | 4 +--- kwin/manage.cpp | 6 ++---- kwin/tabbox.cpp | 10 ++++------ kwin/utils.cpp | 10 +--------- kwin/workspace.cpp | 20 +++++++++----------- 10 files changed, 40 insertions(+), 61 deletions(-) (limited to 'kwin') diff --git a/kwin/activation.cpp b/kwin/activation.cpp index e964ed1b9..ad9dc8eba 100644 --- a/kwin/activation.cpp +++ b/kwin/activation.cpp @@ -31,8 +31,6 @@ License. See the file "COPYING" for the exact licensing terms. #include "group.h" #include "rules.h" -extern Time qt_x_time; - namespace KWinInternal { @@ -672,7 +670,7 @@ void Workspace::unfakeActivity( Client* c ) void Client::updateUserTime( Time time ) { // copied in Group::updateUserTime if( time == CurrentTime ) - time = qt_x_time; + time = GET_QT_X_TIME(); if( time != -1U && ( user_time == CurrentTime || timestampCompare( time, user_time ) > 0 )) // time > user_time @@ -997,7 +995,7 @@ void Group::startupIdChanged() void Group::updateUserTime( Time time ) { // copy of Client::updateUserTime if( time == CurrentTime ) - time = qt_x_time; + time = GET_QT_X_TIME(); if( time != -1U && ( user_time == CurrentTime || timestampCompare( time, user_time ) > 0 )) // time > user_time diff --git a/kwin/client.cpp b/kwin/client.cpp index 2b7794748..dfb352408 100644 --- a/kwin/client.cpp +++ b/kwin/client.cpp @@ -38,7 +38,6 @@ License. See the file "COPYING" for the exact licensing terms. // to resolve them properly extern Atom qt_wm_state; -extern Time qt_x_time; extern Atom qt_window_role; extern Atom qt_sm_client_id; @@ -1660,7 +1659,7 @@ void Client::sendClientMessage(Window w, Atom a, Atom protocol, long data1, long ev.xclient.message_type = a; ev.xclient.format = 32; ev.xclient.data.l[0] = protocol; - ev.xclient.data.l[1] = qt_x_time; + ev.xclient.data.l[1] = GET_QT_X_TIME(); ev.xclient.data.l[2] = data1; ev.xclient.data.l[3] = data2; ev.xclient.data.l[4] = data3; @@ -1737,7 +1736,7 @@ void Client::pingWindow() ping_timer = new TQTimer( this ); connect( ping_timer, TQT_SIGNAL( timeout()), TQT_SLOT( pingTimeout())); ping_timer->start( options->killPingTimeout, true ); - ping_timestamp = qt_x_time; + ping_timestamp = GET_QT_X_TIME(); workspace()->sendPingToWindow( window(), ping_timestamp ); } @@ -1919,15 +1918,15 @@ void Client::takeActivity( int flags, bool handled, allowed_t ) #ifndef NDEBUG static Time previous_activity_timestamp; static Client* previous_client; - if( previous_activity_timestamp == qt_x_time && previous_client != this ) + if( previous_activity_timestamp == GET_QT_X_TIME() && previous_client != this ) { kdDebug( 1212 ) << "Repeated use of the same X timestamp for activity" << endl; kdDebug( 1212 ) << kdBacktrace() << endl; } - previous_activity_timestamp = qt_x_time; + previous_activity_timestamp = GET_QT_X_TIME(); previous_client = this; #endif - workspace()->sendTakeActivity( this, qt_x_time, flags ); + workspace()->sendTakeActivity( this, GET_QT_X_TIME(), flags ); } // performs the actual focusing of the window using XSetInputFocus and WM_TAKE_FOCUS @@ -1936,17 +1935,17 @@ void Client::takeFocus( allowed_t ) #ifndef NDEBUG static Time previous_focus_timestamp; static Client* previous_client; - if( previous_focus_timestamp == qt_x_time && previous_client != this ) + if( previous_focus_timestamp == GET_QT_X_TIME() && previous_client != this ) { kdDebug( 1212 ) << "Repeated use of the same X timestamp for focus" << endl; kdDebug( 1212 ) << kdBacktrace() << endl; } - previous_focus_timestamp = qt_x_time; + previous_focus_timestamp = GET_QT_X_TIME(); previous_client = this; #endif if ( rules()->checkAcceptFocus( input )) { - XSetInputFocus( qt_xdisplay(), window(), RevertToPointerRoot, qt_x_time ); + XSetInputFocus( qt_xdisplay(), window(), RevertToPointerRoot, GET_QT_X_TIME() ); } if ( Ptakefocus ) sendClientMessage(window(), atoms->wm_protocols, atoms->wm_take_focus); diff --git a/kwin/events.cpp b/kwin/events.cpp index 74563d3fb..570b41ddb 100644 --- a/kwin/events.cpp +++ b/kwin/events.cpp @@ -30,7 +30,6 @@ License. See the file "COPYING" for the exact licensing terms. #include #include -extern Time qt_x_time; extern Atom qt_window_role; namespace KWinInternal @@ -198,7 +197,7 @@ bool Workspace::workspaceEvent( XEvent * e ) if ( mouse_emulation && (e->type == ButtonPress || e->type == ButtonRelease ) ) { mouse_emulation = FALSE; - XUngrabKeyboard( qt_xdisplay(), qt_x_time ); + XUngrabKeyboard( qt_xdisplay(), GET_QT_X_TIME() ); } if( e->type == PropertyNotify || e->type == ClientMessage ) @@ -293,9 +292,11 @@ bool Workspace::workspaceEvent( XEvent * e ) !e->xcreatewindow.override_redirect ) { // see comments for allowClientActivation() + Time my_qtx_time = GET_QT_X_TIME(); XChangeProperty(qt_xdisplay(), e->xcreatewindow.window, atoms->kde_net_wm_user_creation_time, XA_CARDINAL, - 32, PropModeReplace, (unsigned char *)&qt_x_time, 1); + 32, PropModeReplace, (unsigned char *)&my_qtx_time, 1); + SET_QT_X_TIME(my_qtx_time); } break; @@ -1344,6 +1345,7 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in if( w == wrapperId() || w == frameId() || w == decorationId()) { // FRAME neco s tohohle by se melo zpracovat, nez to dostane dekorace + { // FRAME something out of this would be processed before it gets decorations updateUserTime(); workspace()->setWasUserInteraction(); uint keyModX = (options->keyCmdAllModKey() == Qt::Key_Meta) ? @@ -1548,7 +1550,7 @@ static bool waitingMotionEvent() // of processes events reaches the timestamp of the last suitable // MotionNotify event in the queue. if( next_motion_time != CurrentTime - && timestampCompare( qt_x_time, next_motion_time ) < 0 ) + && timestampCompare( GET_QT_X_TIME(), next_motion_time ) < 0 ) return true; was_motion = false; XSync( qt_xdisplay(), False ); // this helps to discard more MotionNotify events diff --git a/kwin/geometry.cpp b/kwin/geometry.cpp index e69b630a2..3116f16bf 100644 --- a/kwin/geometry.cpp +++ b/kwin/geometry.cpp @@ -29,8 +29,6 @@ License. See the file "COPYING" for the exact licensing terms. #include "geometrytip.h" #include "rules.h" -extern Time qt_x_time; - namespace KWinInternal { @@ -688,7 +686,7 @@ void Workspace::updateTopMenuGeometry( Client* c ) static Atom msg_type_atom = XInternAtom( qt_xdisplay(), "_KDE_TOPMENU_MINSIZE", False ); ev.xclient.message_type = msg_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] = topmenu_space->width(); ev.xclient.data.l[2] = topmenu_space->height(); ev.xclient.data.l[3] = 0; @@ -2319,9 +2317,9 @@ bool Client::startMoveResize() XMapRaised( qt_xdisplay(), move_resize_grab_window ); if( XGrabPointer( qt_xdisplay(), move_resize_grab_window, False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | LeaveWindowMask, - GrabModeAsync, GrabModeAsync, move_resize_grab_window, cursor.handle(), qt_x_time ) == Success ) + GrabModeAsync, GrabModeAsync, move_resize_grab_window, cursor.handle(), GET_QT_X_TIME() ) == Success ) has_grab = true; - if( XGrabKeyboard( qt_xdisplay(), frameId(), False, GrabModeAsync, GrabModeAsync, qt_x_time ) == Success ) + if( XGrabKeyboard( qt_xdisplay(), frameId(), False, GrabModeAsync, GrabModeAsync, GET_QT_X_TIME() ) == Success ) has_grab = true; if( !has_grab ) // at least one grab is necessary in order to be able to finish move/resize { @@ -2389,8 +2387,8 @@ void Client::leaveMoveResize() if ( ( isMove() && rules()->checkMoveResizeMode( options->moveMode ) != Options::Opaque ) || ( isResize() && rules()->checkMoveResizeMode( options->resizeMode ) != Options::Opaque ) ) ungrabXServer(); - XUngrabKeyboard( qt_xdisplay(), qt_x_time ); - XUngrabPointer( qt_xdisplay(), qt_x_time ); + XUngrabKeyboard( qt_xdisplay(), GET_QT_X_TIME() ); + XUngrabPointer( qt_xdisplay(), GET_QT_X_TIME() ); XDestroyWindow( qt_xdisplay(), move_resize_grab_window ); move_resize_grab_window = None; workspace()->setClientIsMoving(0); @@ -2507,7 +2505,7 @@ void Client::handleMoveResize( int x, int y, int x_root, int y_root ) bool update = false; if( isResize()) { - // first resize (without checking constrains), then snap, then check bounds, then check constrains + // first resize (without checking constraints), then snap, then check bounds, then check constraints TQRect orig = initialMoveResizeGeom; Sizemode sizemode = SizemodeAny; switch ( mode ) @@ -2642,7 +2640,7 @@ void Client::handleMoveResize( int x, int y, int x_root, int y_root ) } // so the geometry tip will be painted above the outline } if ( isMove() ) - workspace()->clientMoved(globalPos, qt_x_time); + workspace()->clientMoved(globalPos, GET_QT_X_TIME()); } diff --git a/kwin/layers.cpp b/kwin/layers.cpp index 3151b22e5..e5194ed49 100644 --- a/kwin/layers.cpp +++ b/kwin/layers.cpp @@ -73,8 +73,6 @@ License. See the file "COPYING" for the exact licensing terms. #include "group.h" #include "rules.h" -extern Time qt_x_time; - namespace KWinInternal { diff --git a/kwin/main.cpp b/kwin/main.cpp index ee1f66c68..a65a32431 100644 --- a/kwin/main.cpp +++ b/kwin/main.cpp @@ -36,8 +36,6 @@ License. See the file "COPYING" for the exact licensing terms. #undef INT8 #undef INT32 -extern Time qt_x_time; - namespace KWinInternal { @@ -148,7 +146,7 @@ Application::~Application() delete Workspace::self(); if( owner.ownerWindow() != None ) // if there was no --replace (no new WM) { - XSetInputFocus( qt_xdisplay(), PointerRoot, RevertToPointerRoot, qt_x_time ); + XSetInputFocus( qt_xdisplay(), PointerRoot, RevertToPointerRoot, GET_QT_X_TIME() ); DCOPRef ref( "kded", "kded" ); if( !ref.send( "loadModule", TQCString( "kdetrayproxy" ))) kdWarning( 176 ) << "Loading of kdetrayproxy failed." << endl; diff --git a/kwin/manage.cpp b/kwin/manage.cpp index c50a504d0..3df18027e 100644 --- a/kwin/manage.cpp +++ b/kwin/manage.cpp @@ -25,8 +25,6 @@ License. See the file "COPYING" for the exact licensing terms. #include "rules.h" #include "group.h" -extern Time qt_x_time; - namespace KWinInternal { @@ -522,9 +520,9 @@ bool Client::manage( Window w, bool isMapped ) if( user_time == CurrentTime || user_time == -1U ) // no known user time, set something old { - user_time = qt_x_time - 1000000; + user_time = GET_QT_X_TIME() - 1000000; if( user_time == CurrentTime || user_time == -1U ) // let's be paranoid - user_time = qt_x_time - 1000000 + 10; + user_time = GET_QT_X_TIME() - 1000000 + 10; } updateWorkareaDiffs(); diff --git a/kwin/tabbox.cpp b/kwin/tabbox.cpp index 6d78b4242..f5a9b9f03 100644 --- a/kwin/tabbox.cpp +++ b/kwin/tabbox.cpp @@ -35,8 +35,6 @@ License. See the file "COPYING" for the exact licensing terms. // specify externals before namespace -extern Time qt_x_time; - namespace KWinInternal { @@ -694,7 +692,7 @@ void TabBox::delayedShow() void TabBox::handleMouseEvent( XEvent* e ) { - XAllowEvents( qt_xdisplay(), AsyncPointer, qt_x_time ); + XAllowEvents( qt_xdisplay(), AsyncPointer, GET_QT_X_TIME() ); if( e->type != ButtonPress ) return; TQPoint pos( e->xbutton.x_root, e->xbutton.y_root ); @@ -852,7 +850,7 @@ void Workspace::slotWalkThroughWindows() return; if ( options->altTabStyle == Options::CDE || !options->focusPolicyIsReasonable()) { - //XUngrabKeyboard(qt_xdisplay(), qt_x_time); // need that because of accelerator raw mode + //XUngrabKeyboard(qt_xdisplay(), GET_QT_X_TIME()); // need that because of accelerator raw mode // CDE style raise / lower CDEWalkThroughWindows( true ); } @@ -1319,7 +1317,7 @@ Client* Workspace::previousStaticClient( Client* c ) const bool Workspace::establishTabBoxGrab() { if( XGrabKeyboard( qt_xdisplay(), root, FALSE, - GrabModeAsync, GrabModeAsync, qt_x_time) != GrabSuccess ) + GrabModeAsync, GrabModeAsync, GET_QT_X_TIME()) != GrabSuccess ) return false; // Don't try to establish a global mouse grab using XGrabPointer, as that would prevent // using Alt+Tab while DND (#44972). However force passive grabs on all windows @@ -1335,7 +1333,7 @@ bool Workspace::establishTabBoxGrab() void Workspace::removeTabBoxGrab() { - XUngrabKeyboard(qt_xdisplay(), qt_x_time); + XUngrabKeyboard(qt_xdisplay(), GET_QT_X_TIME()); assert( forced_global_mouse_grab ); forced_global_mouse_grab = false; if( active_client != NULL ) diff --git a/kwin/utils.cpp b/kwin/utils.cpp index 5a8d5ad3c..796c7932b 100644 --- a/kwin/utils.cpp +++ b/kwin/utils.cpp @@ -36,14 +36,6 @@ License. See the file "COPYING" for the exact licensing terms. #include #endif // USE_QT4 -#ifdef USE_QT4 -#define SET_X_TIME(x) QX11Info::setAppTime(x) -#else // USE_QT4 -#define SET_X_TIME(x) qt_x_time = x -#endif // USE_QT4 - -extern Time qt_x_time; - #endif namespace KWinInternal @@ -281,7 +273,7 @@ void updateXTime() XCheckIfEvent( qt_xdisplay(), &dummy, update_x_time_predicate, NULL ); } assert( next_x_time != CurrentTime ); - SET_X_TIME(next_x_time); + SET_QT_X_TIME(next_x_time); XEvent ev; // remove the PropertyNotify event from the events queue XWindowEvent( qt_xdisplay(), w->winId(), PropertyChangeMask, &ev ); } diff --git a/kwin/workspace.cpp b/kwin/workspace.cpp index ac4fcdc3f..48c8494bd 100644 --- a/kwin/workspace.cpp +++ b/kwin/workspace.cpp @@ -45,8 +45,6 @@ License. See the file "COPYING" for the exact licensing terms. #include #include -extern Time qt_x_time; - namespace KWinInternal { @@ -153,8 +151,8 @@ Workspace::Workspace( bool restore ) delayFocusTimer = 0; - electric_time_first = qt_x_time; - electric_time_last = qt_x_time; + electric_time_first = GET_QT_X_TIME(); + electric_time_last = GET_QT_X_TIME(); if ( restore ) loadSessionInfo(); @@ -1855,7 +1853,7 @@ void Workspace::slotMouseEmulation() if ( mouse_emulation ) { - XUngrabKeyboard(qt_xdisplay(), qt_x_time); + XUngrabKeyboard(qt_xdisplay(), GET_QT_X_TIME()); mouse_emulation = FALSE; return; } @@ -1863,7 +1861,7 @@ void Workspace::slotMouseEmulation() if ( XGrabKeyboard(qt_xdisplay(), root, FALSE, GrabModeAsync, GrabModeAsync, - qt_x_time) == GrabSuccess ) + GET_QT_X_TIME()) == GrabSuccess ) { mouse_emulation = TRUE; mouse_emulation_state = 0; @@ -1919,7 +1917,7 @@ unsigned int Workspace::sendFakedMouseEvent( TQPoint pos, WId w, MouseEmulation e.xmotion.window = w; e.xmotion.root = qt_xrootwin(); e.xmotion.subwindow = w; - e.xmotion.time = qt_x_time; + e.xmotion.time = GET_QT_X_TIME(); e.xmotion.x = x; e.xmotion.y = y; e.xmotion.x_root = pos.x(); @@ -1935,7 +1933,7 @@ unsigned int Workspace::sendFakedMouseEvent( TQPoint pos, WId w, MouseEmulation e.xbutton.window = w; e.xbutton.root = qt_xrootwin(); e.xbutton.subwindow = w; - e.xbutton.time = qt_x_time; + e.xbutton.time = GET_QT_X_TIME(); e.xbutton.x = x; e.xbutton.y = y; e.xbutton.x_root = pos.x(); @@ -2061,7 +2059,7 @@ bool Workspace::keyPressMouseEmulation( XKeyEvent& ev ) } // fall through case XK_Escape: - XUngrabKeyboard(qt_xdisplay(), qt_x_time); + XUngrabKeyboard(qt_xdisplay(), GET_QT_X_TIME()); mouse_emulation = FALSE; return TRUE; default: @@ -2356,7 +2354,7 @@ bool Workspace::electricBorder(XEvent *e) || e->xclient.window == electric_right_border )) { updateXTime(); - clientMoved( TQPoint( e->xclient.data.l[2]>>16, e->xclient.data.l[2]&0xffff), qt_x_time ); + clientMoved( TQPoint( e->xclient.data.l[2]>>16, e->xclient.data.l[2]&0xffff), GET_QT_X_TIME() ); return true; } } @@ -2492,7 +2490,7 @@ bool Workspace::checkStartupNotification( Window w, KStartupInfoId& id, KStartup */ void Workspace::focusToNull() { - XSetInputFocus(qt_xdisplay(), null_focus_window, RevertToPointerRoot, qt_x_time ); + XSetInputFocus(qt_xdisplay(), null_focus_window, RevertToPointerRoot, GET_QT_X_TIME() ); } void Workspace::helperDialog( const TQString& message, const Client* c ) -- cgit v1.2.1