From 17b142dd646ce4053f4548c0ff7b189531219c32 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 29 Nov 2014 00:33:46 -0600 Subject: Send setActive signal when taking focus in Client::takeFocus This relates to Bug 2189 Clean up minor formatting issues --- twin/activation.cpp | 10 +++++----- twin/client.cpp | 12 ++++++++---- twin/client.h | 4 ++-- twin/clients/keramik/keramik.cpp | 6 ------ twin/events.cpp | 4 ++-- twin/group.cpp | 2 +- twin/placement.cpp | 9 +++++++-- 7 files changed, 25 insertions(+), 22 deletions(-) diff --git a/twin/activation.cpp b/twin/activation.cpp index 2e55b49c2..83ff24edb 100644 --- a/twin/activation.cpp +++ b/twin/activation.cpp @@ -311,14 +311,14 @@ void Workspace::requestFocus( Client* c, bool force ) { takeActivity( c, ActivityFocus | ( force ? ActivityFocusForce : 0 ), false); } - + void Workspace::takeActivity( Client* c, int flags, bool handled ) { - // the 'if( c == active_client ) return;' optimization mustn't be done here + // the 'if( c == active_client ) return;' optimization must not be done here if (!focusChangeEnabled() && ( c != active_client) ) flags &= ~ActivityFocus; - if ( !c ) + if ( !c ) { focusToNull(); return; @@ -328,7 +328,7 @@ void Workspace::takeActivity( Client* c, int flags, bool handled ) { Client* modal = c->findModal(); if( modal != NULL && modal != c ) - { + { next_active_client = modal; if( !modal->isOnDesktop( c->desktop())) { @@ -353,7 +353,7 @@ void Workspace::takeActivity( Client* c, int flags, bool handled ) { if( c->wantsInput() && ( flags & ActivityFocus )) { - // client cannot accept focus, but at least the window should be active (window menu, et. al. ) + // client cannot accept focus, but at least the window should be active (window menu, et. al. ) c->setActive( true ); focusToNull(); } diff --git a/twin/client.cpp b/twin/client.cpp index f32c5064b..4d26bb816 100644 --- a/twin/client.cpp +++ b/twin/client.cpp @@ -612,7 +612,7 @@ void Client::hideClient( bool hide ) hidden = hide; updateVisibility(); } - + /*! Returns whether the window is minimizable or not */ @@ -2200,9 +2200,13 @@ void Client::takeFocus( allowed_t ) if ( rules()->checkAcceptFocus( input )) { XSetInputFocus( tqt_xdisplay(), window(), RevertToPointerRoot, GET_QT_X_TIME() ); + // Signal that we took focus! + setActive( true, true ); } if ( Ptakefocus ) + { sendClientMessage(window(), atoms->wm_protocols, atoms->wm_take_focus); + } workspace()->setShouldGetFocus( this ); } @@ -2745,7 +2749,7 @@ void Client::autoRaise() workspace()->raiseClient( this ); cancelAutoRaise(); } - + void Client::cancelAutoRaise() { delete autoRaiseTimer; @@ -2773,7 +2777,7 @@ void Client::setOpacity(bool translucent, uint opacity) XChangeProperty(tqt_xdisplay(), window(), atoms->net_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L); } } - + void Client::setShadowSize(uint shadowSize) { // ignoring all individual settings - if we control a window, we control it's shadow @@ -2781,7 +2785,7 @@ void Client::setShadowSize(uint shadowSize) long data = shadowSize; XChangeProperty(tqt_xdisplay(), frameId(), atoms->net_wm_window_shadow, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L); } - + void Client::updateOpacity() // extra syncscreen flag allows to avoid double syncs when active state changes (as it will usually change for two windows) { diff --git a/twin/client.h b/twin/client.h index 674251a5a..d3c7e7b13 100644 --- a/twin/client.h +++ b/twin/client.h @@ -122,7 +122,7 @@ class Client : public TQObject, public KDecorationDefines bool isOnCurrentDesktop() const; bool isOnAllDesktops() const; void setOnAllDesktops( bool set ); - + bool isOnScreen( int screen ) const; // true if it's at least partially there int screen() const; // the screen where the center is @@ -274,7 +274,7 @@ class Client : public TQObject, public KDecorationDefines void NETMoveResize( int x_root, int y_root, NET::Direction direction ); void NETMoveResizeWindow( int flags, int x, int y, int width, int height ); void restackWindow( Window above, int detail, NET::RequestSource source, Time timestamp, bool send_event = false ); - + void gotPing( Time timestamp ); static TQCString staticWindowRole(WId); diff --git a/twin/clients/keramik/keramik.cpp b/twin/clients/keramik/keramik.cpp index 55eb5787d..4043e6ee4 100644 --- a/twin/clients/keramik/keramik.cpp +++ b/twin/clients/keramik/keramik.cpp @@ -1156,7 +1156,6 @@ void KeramikClient::updateMask() TQRegion r; register int w, y = 0; - int nrects; if ( TQApplication::reverseLayout() ) { @@ -1168,8 +1167,6 @@ void KeramikClient::updateMask() r += TQRegion( x + 9, y++, w - 15, 1 ); r += TQRegion( x + 7, y++, w - 12, 1 ); } else { - nrects = 8; - // Do we have a large titlebar with a retracted caption bubble? // (i.e. the style is set to use large caption bubbles, we're // not maximized and not active) @@ -1191,15 +1188,12 @@ void KeramikClient::updateMask() // If the caption bubble is visible and extends above the titlebar if ( largeCaption && captionRect.width() >= 25 ) { - nrects = 11; register int x = captionRect.left(); w = captionRect.width(); r += TQRegion( x + 8, y++, w - 19, 1 ); r += TQRegion( x + 6, y++, w - 15, 1 ); r += TQRegion( x + 5, y++, w - 12, 1 ); } else { - nrects = 8; - // Do we have a large titlebar with a retracted caption bubble? // (i.e. the style is set to use large caption bubbles, we're // not maximized and not active) diff --git a/twin/events.cpp b/twin/events.cpp index 68c4be55c..e9f8fd484 100644 --- a/twin/events.cpp +++ b/twin/events.cpp @@ -731,8 +731,8 @@ void Client::destroyNotifyEvent( XDestroyWindowEvent* e ) return; destroyClient(); } - - + + bool blockAnimation = FALSE; /*! diff --git a/twin/group.cpp b/twin/group.cpp index 41c987dbe..62d235d92 100644 --- a/twin/group.cpp +++ b/twin/group.cpp @@ -518,7 +518,7 @@ bool Client::sameAppWindowRoleMatch( const Client* c1, const Client* c2, bool ac || // hacks here // Mozilla has resourceName() and resourceClass() swapped - c1->resourceName() == "mozilla" && c2->resourceName() == "mozilla" ) + ((c1->resourceName() == "mozilla") && (c2->resourceName() == "mozilla")) ) { if( !active_hack ) // without the active hack for focus stealing prevention, return c1 == c2; // different mainwindows are always different apps diff --git a/twin/placement.cpp b/twin/placement.cpp index bea707d1f..8112b7157 100644 --- a/twin/placement.cpp +++ b/twin/placement.cpp @@ -362,12 +362,17 @@ void Placement::placeCascaded (Client* c, TQRect& area, Policy nextPlacement) if ((yp + ch) > H) yp = Y; if ((xp + cw) > W) - if (!yp) + { + if (!yp) { place(c,area,nextPlacement); return; } - else xp = X; + } + else + { + xp = X; + } //if this isn't the first window if (cci[dn].pos.x() != X && cci[dn].pos.y() != Y) -- cgit v1.2.1