diff options
Diffstat (limited to 'twin/client.cpp')
-rw-r--r-- | twin/client.cpp | 142 |
1 files changed, 76 insertions, 66 deletions
diff --git a/twin/client.cpp b/twin/client.cpp index 8c303ec15..028c32c12 100644 --- a/twin/client.cpp +++ b/twin/client.cpp @@ -18,9 +18,9 @@ License. See the file "COPYING" for the exact licensing terms. #include <tqdatetime.h> #include <tqimage.h> #include <tqfile.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <unistd.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tqwhatsthis.h> #include <twin.h> #include <kiconloader.h> @@ -99,6 +99,7 @@ Client::Client( Workspace *ws ) decoration( NULL ), wspace( ws ), bridge( new Bridge( this )), + inhibitConfigureRequests(false), move_faked_activity( false ), move_resize_grab_window( None ), transient_for( NULL ), @@ -128,35 +129,38 @@ Client::Client( Workspace *ws ) autoRaiseTimer = 0; shadeHoverTimer = 0; + configureRequestTimer = new TQTimer(this); + connect(configureRequestTimer, TQ_SIGNAL(timeout()), TQ_SLOT(configureRequestTimeout())); + shadowDelayTimer = new TQTimer(this); opacityCache = &activeOpacityCache; shadowAfterClient = NULL; shadowWidget = NULL; shadowMe = true; - connect(shadowDelayTimer, TQT_SIGNAL(timeout()), TQT_SLOT(drawShadow())); + connect(shadowDelayTimer, TQ_SIGNAL(timeout()), TQ_SLOT(drawShadow())); // set the initial mapping state mapping_state = WithdrawnState; desk = 0; // no desktop yet mode = PositionCenter; - buttonDown = FALSE; - moveResizeMode = FALSE; + buttonDown = false; + moveResizeMode = false; info = NULL; shade_mode = ShadeNone; - active = FALSE; + active = false; deleting = false; - keep_above = FALSE; - keep_below = FALSE; - is_shape = FALSE; + keep_above = false; + keep_below = false; + is_shape = false; motif_noborder = false; - motif_may_move = TRUE; - motif_may_resize = TRUE; - motif_may_close = TRUE; + motif_may_move = true; + motif_may_resize = true; + motif_may_close = true; fullscreen_mode = FullScreenNone; - skip_taskbar = FALSE; + skip_taskbar = false; original_skip_taskbar = false; minimized = false; hidden = false; @@ -173,8 +177,8 @@ Client::Client( Workspace *ws ) Ptakeactivity = 0; Pcontexthelp = 0; Pping = 0; - input = FALSE; - skip_pager = FALSE; + input = false; + skip_pager = false; max_mode = MaximizeRestore; maxmode_restore = MaximizeRestore; @@ -220,7 +224,7 @@ void Client::releaseWindow( bool on_shutdown ) deleting = true; workspace()->discardUsedWindowRules( this, true ); // remove ForceTemporarily rules StackingUpdatesBlocker blocker( workspace()); - if (!custom_opacity) setOpacity(FALSE); + if (!custom_opacity) setOpacity(false); if (moveResizeMode) leaveMoveResize(); removeShadow(); @@ -441,7 +445,7 @@ void Client::detectShapable() case NET::Menu : case NET::Dialog : case NET::Utility : - setShapable(FALSE); + setShapable(false); break; default: assert( false ); @@ -518,9 +522,9 @@ bool Client::isModalSystemNotification() const result = XGetWindowProperty(tqt_xdisplay(), window(), atoms->net_wm_system_modal_notification, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, /*(unsigned char **)*/ &data); if (result == Success && data && format == 32 ) { - return TRUE; + return true; } - return FALSE; + return false; } void Client::updateShape() @@ -537,7 +541,7 @@ void Client::updateShape() XShapeCombineShape(tqt_xdisplay(), frameId(), ShapeBounding, clientPos().x(), clientPos().y(), window(), ShapeBounding, ShapeSet); - setShapable(TRUE); + setShapable(true); } // !shape() mask setting is done in setMask() when the decoration // calls it or when the decoration is created/destroyed @@ -705,7 +709,7 @@ void Client::unminimize( bool avoid_animation ) if( isOnCurrentDesktop() && isShown( true )) { if( mainClients().isEmpty() && !avoid_animation ) - animateMinimizeOrUnminimize( FALSE ); + animateMinimizeOrUnminimize( false ); } updateVisibility(); updateAllowedActions(); @@ -774,7 +778,7 @@ void Client::animateMinimizeOrUnminimize( bool minimize ) float diff; TQPainter p ( workspace()->desktopWidget() ); - bool need_to_clear = FALSE; + bool need_to_clear = false; TQPixmap pm3; do { @@ -786,7 +790,7 @@ void Client::animateMinimizeOrUnminimize( bool minimize ) if ( need_to_clear ) { p.drawPixmap( area2.x(), area2.y(), pm3 ); - need_to_clear = FALSE; + need_to_clear = false; } area2 = area; } @@ -806,7 +810,7 @@ void Client::animateMinimizeOrUnminimize( bool minimize ) else { // no overlap, we can clear later to avoid flicker pm3 = pm2; - need_to_clear = TRUE; + need_to_clear = true; } } } while ( t.elapsed() < step); @@ -893,10 +897,10 @@ void Client::setShade( ShadeMode mode ) XSelectInput( tqt_xdisplay(), wrapper, ClientWinMask | SubstructureNotifyMask ); //as we hid the unmap event, xcompmgr didn't recognize the client wid has vanished, so we'll extra inform it //done xcompmgr workaround -// FRAME repaint( FALSE ); +// FRAME repaint( false ); // bool wasStaticContents = testWFlags( WStaticContents ); // setWFlags( WStaticContents ); - int step = TQMAX( 4, QABS( h - s.height() ) / as )+1; + int step = TQMAX( 4, TQABS( h - s.height() ) / as )+1; do { h -= step; @@ -926,7 +930,7 @@ void Client::setShade( ShadeMode mode ) TQSize s( sizeForClientSize( clientSize())); // FRAME bool wasStaticContents = testWFlags( WStaticContents ); // setWFlags( WStaticContents ); - int step = TQMAX( 4, QABS( h - s.height() ) / as )+1; + int step = TQMAX( 4, TQABS( h - s.height() ) / as )+1; do { h += step; @@ -934,7 +938,7 @@ void Client::setShade( ShadeMode mode ) resizeDecoration( TQSize( s.width(), h )); // assume a border // we do not have time to wait for X to send us paint events -// FRAME repaint( 0, h - step-5, width(), step+5, TRUE); +// FRAME repaint( 0, h - step-5, width(), step+5, true); TQApplication::syncX(); } while ( h < s.height() - step ); // if ( !wasStaticContents ) @@ -942,7 +946,7 @@ void Client::setShade( ShadeMode mode ) shade_geometry_change = false; plainResize( s ); if( shade_mode == ShadeHover || shade_mode == ShadeActivated ) - setActive( TRUE ); + setActive( true ); XMapWindow( tqt_xdisplay(), wrapperId()); XMapWindow( tqt_xdisplay(), window()); XDeleteProperty (tqt_xdisplay(), client, atoms->net_wm_window_shade); @@ -969,6 +973,12 @@ void Client::setShade( ShadeMode mode ) updateWindowRules(); } +void Client::configureRequestTimeout() + { + inhibitConfigureRequests = false; + sendSyntheticConfigureNotify(); + } + void Client::shadeHover() { setShade( ShadeHover ); @@ -1200,7 +1210,7 @@ void Client::drawDelayedShadow() void Client::drawShadowAfter(Client *after) { shadowAfterClient = after; - connect(after, TQT_SIGNAL(shadowDrawn()), TQT_SLOT(drawShadow())); + connect(after, TQ_SIGNAL(shadowDrawn()), TQ_SLOT(drawShadow())); } /*! @@ -1214,7 +1224,7 @@ void Client::drawShadow() // If we are waiting for another Client's shadow to be drawn, stop waiting now if (shadowAfterClient != NULL) { - disconnect(shadowAfterClient, TQT_SIGNAL(shadowDrawn()), this, TQT_SLOT(drawShadow())); + disconnect(shadowAfterClient, TQ_SIGNAL(shadowDrawn()), this, TQ_SLOT(drawShadow())); shadowAfterClient = NULL; } @@ -1260,7 +1270,7 @@ void Client::drawShadow() removeShadow(); - TQMemArray<QRgb> pixelData; + TQMemArray<TQRgb> pixelData; TQPixmap shadowPixmap; TQRect shadow; TQRegion exposedRegion; @@ -1433,7 +1443,7 @@ TQRegion Client::getExposedRegion(TQRegion occludedRegion, int x, int y, int w, */ void Client::imposeCachedShadow(TQPixmap &pixmap, TQRegion exposed) { - QRgb pixel; + TQRgb pixel; double opacity; int red, green, blue, pixelRed, pixelGreen, pixelBlue; int subW, subH, w, x, y, zeroX, zeroY; @@ -1490,7 +1500,7 @@ void Client::imposeRegionShadow(TQPixmap &pixmap, TQRegion occluded, TQRegion exposed, int thickness, double maxOpacity) { int distance, intersectCount, i, j, x, y; - QRgb pixel; + TQRgb pixel; double decay, factor, opacity; int red, green, blue, pixelRed, pixelGreen, pixelBlue; int lineIntersects, maxIntersects, maxY; @@ -1704,7 +1714,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] = GET_QT_X_TIME(); + ev.xclient.data.l[1] = get_tqt_x_time(); ev.xclient.data.l[2] = data1; ev.xclient.data.l[3] = data2; ev.xclient.data.l[4] = data3; @@ -1781,9 +1791,9 @@ void Client::pingWindow() if( ping_timer != NULL ) return; // pinging already ping_timer = new TQTimer( this ); - connect( ping_timer, TQT_SIGNAL( timeout()), TQT_SLOT( pingTimeout())); + connect( ping_timer, TQ_SIGNAL( timeout()), TQ_SLOT( pingTimeout())); ping_timer->start( options->killPingTimeout, true ); - ping_timestamp = GET_QT_X_TIME(); + ping_timestamp = get_tqt_x_time(); workspace()->sendPingToWindow( window(), ping_timestamp ); } @@ -1840,8 +1850,8 @@ void Client::killProcess( bool ask, Time timestamp ) << "--applicationname" << resourceClass() << "--wid" << TQCString().setNum( window()) << "--timestamp" << TQCString().setNum( timestamp ); - connect( process_killer, TQT_SIGNAL( processExited( TDEProcess* )), - TQT_SLOT( processKillerExited())); + connect( process_killer, TQ_SIGNAL( processExited( TDEProcess* )), + TQ_SLOT( processKillerExited())); if( !process_killer->start( TDEProcess::NotifyOnExit )) { delete process_killer; @@ -1887,7 +1897,7 @@ bool Client::isSuspendable() const tcomm = basename(tbuf); #else /* default */ TQString statString(statRaw); - TQStringList statFields = TQStringList::split(" ", statString, TRUE); + TQStringList statFields = TQStringList::split(" ", statString, true); TQString tcomm = statFields[1]; TQString state = statFields[2]; #endif /* default */ @@ -1957,7 +1967,7 @@ bool Client::isResumeable() const TQString state(TQChar(inf->pr_sname)); #else /* default */ TQString statString(statRaw); - TQStringList statFields = TQStringList::split(" ", statString, TRUE); + TQStringList statFields = TQStringList::split(" ", statString, true); TQString tcomm = statFields[1]; TQString state = statFields[2]; #endif /* default */ @@ -1992,8 +2002,8 @@ bool Client::queryUserSuspendedResume() << "--windowname" << caption().utf8() << "--applicationname" << resourceClass() << "--wid" << TQCString().setNum( window()); - connect( process_resumer, TQT_SIGNAL( processExited( TDEProcess* )), - TQT_SLOT( processResumerExited())); + connect( process_resumer, TQ_SIGNAL( processExited( TDEProcess* )), + TQ_SLOT( processResumerExited())); if( !process_resumer->start( TDEProcess::NotifyOnExit )) { delete process_resumer; @@ -2203,15 +2213,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 == GET_QT_X_TIME() && previous_client != this ) + if( previous_activity_timestamp == get_tqt_x_time() && previous_client != this ) { kdDebug( 1212 ) << "Repeated use of the same X timestamp for activity" << endl; kdDebug( 1212 ) << kdBacktrace() << endl; } - previous_activity_timestamp = GET_QT_X_TIME(); + previous_activity_timestamp = get_tqt_x_time(); previous_client = this; #endif - workspace()->sendTakeActivity( this, GET_QT_X_TIME(), flags ); + workspace()->sendTakeActivity( this, get_tqt_x_time(), flags ); } // performs the actual focusing of the window using XSetInputFocus and WM_TAKE_FOCUS @@ -2220,17 +2230,17 @@ void Client::takeFocus( allowed_t ) #ifndef NDEBUG static Time previous_focus_timestamp; static Client* previous_client; - if( previous_focus_timestamp == GET_QT_X_TIME() && previous_client != this ) + if( previous_focus_timestamp == get_tqt_x_time() && previous_client != this ) { kdDebug( 1212 ) << "Repeated use of the same X timestamp for focus" << endl; kdDebug( 1212 ) << kdBacktrace() << endl; } - previous_focus_timestamp = GET_QT_X_TIME(); + previous_focus_timestamp = get_tqt_x_time(); previous_client = this; #endif if ( rules()->checkAcceptFocus( input )) { - XSetInputFocus( tqt_xdisplay(), window(), RevertToPointerRoot, GET_QT_X_TIME() ); + XSetInputFocus( tqt_xdisplay(), window(), RevertToPointerRoot, get_tqt_x_time() ); // Work around opacity bug bool activePrev = active; active = true; @@ -2412,11 +2422,11 @@ void Client::readIcons( Window win, TQPixmap* icon, TQPixmap* miniicon ) { // get the icons, allow scaling if( icon != NULL ) - *icon = KWin::icon( win, 32, 32, TRUE, KWin::NETWM | KWin::WMHints ); + *icon = KWin::icon( win, 32, 32, true, KWin::NETWM | KWin::WMHints ); if( miniicon != NULL ) { if( icon == NULL || !icon->isNull()) - *miniicon = KWin::icon( win, 16, 16, TRUE, KWin::NETWM | KWin::WMHints ); + *miniicon = KWin::icon( win, 16, 16, true, KWin::NETWM | KWin::WMHints ); else *miniicon = TQPixmap(); } @@ -2444,8 +2454,8 @@ void Client::getIcons() } if( icon_pix.isNull()) { // and if nothing else, load icon from classhint or xapp icon - icon_pix = KWin::icon( window(), 32, 32, TRUE, KWin::ClassHint | KWin::XApp ); - miniicon_pix = KWin::icon( window(), 16, 16, TRUE, KWin::ClassHint | KWin::XApp ); + icon_pix = KWin::icon( window(), 32, 32, true, KWin::ClassHint | KWin::XApp ); + miniicon_pix = KWin::icon( window(), 16, 16, true, KWin::ClassHint | KWin::XApp ); } if( isManaged() && decoration != NULL ) decoration->iconChange(); @@ -2707,25 +2717,25 @@ void Client::setCursor( Position m ) { case PositionTopLeft: case PositionBottomRight: - setCursor( tqsizeFDiagCursor ); + setCursor( TQt::sizeFDiagCursor ); break; case PositionBottomLeft: case PositionTopRight: - setCursor( tqsizeBDiagCursor ); + setCursor( TQt::sizeBDiagCursor ); break; case PositionTop: case PositionBottom: - setCursor( tqsizeVerCursor ); + setCursor( TQt::sizeVerCursor ); break; case PositionLeft: case PositionRight: - setCursor( tqsizeHorCursor ); + setCursor( TQt::sizeHorCursor ); break; default: if( buttonDown && isMovable()) - setCursor( tqsizeAllCursor ); + setCursor( TQt::sizeAllCursor ); else - setCursor( tqarrowCursor ); + setCursor( TQt::arrowCursor ); break; } } @@ -3012,9 +3022,9 @@ bool Client::getWindowOpacity() //query translucency settings from X, returns tr custom_opacity = true; // setOpacity(opacity_ < 0xFFFFFFFF, opacity_); XFree ((char*)data); - return TRUE; + return true; } - return FALSE; + return false; } void Client::setCustomOpacityFlag(bool custom) @@ -3036,14 +3046,14 @@ bool Client::touches(const Client* c) // checks if this client borders c, needed to test beep media player window state { if (y() == c->y() + c->height()) // this bottom to c - return TRUE; + return true; if (y() + height() == c->y()) // this top to c - return TRUE; + return true; if (x() == c->x() + c->width()) // this right to c - return TRUE; + return true; if (x() + width() == c->x()) // this left to c - return TRUE; - return FALSE; + return true; + return false; } void Client::setDecoHashProperty(uint topHeight, uint rightWidth, uint bottomHeight, uint leftWidth) |