summaryrefslogtreecommitdiffstats
path: root/kdeui/qxembed.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-02 21:21:15 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-02 21:21:15 +0000
commit96900dbce3aaa1fcac74a07a71482c5c6fcd3cab (patch)
treebf3fc68d0dcc660fce0e21171373a2d4e2395707 /kdeui/qxembed.cpp
parent5f99bff82d3413803bcc652999f4f631058179d6 (diff)
downloadtdelibs-96900dbce3aaa1fcac74a07a71482c5c6fcd3cab.tar.gz
tdelibs-96900dbce3aaa1fcac74a07a71482c5c6fcd3cab.zip
* Large set of SuSE patches to fix bugs and add functionality
* kdemm is included but not used by knotify as it does not work out of the box git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1171141 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeui/qxembed.cpp')
-rw-r--r--kdeui/qxembed.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/kdeui/qxembed.cpp b/kdeui/qxembed.cpp
index 6403f9d8a..7ec1db3a2 100644
--- a/kdeui/qxembed.cpp
+++ b/kdeui/qxembed.cpp
@@ -314,8 +314,8 @@ bool QXEmbedAppFilter::eventFilter( TQObject *o, TQEvent * e)
if ( qApp->focusWidget() == o &&
((QPublicWidget*)qApp->focusWidget()->topLevelWidget())->topData()->embedded ) {
TQFocusEvent* fe = (TQFocusEvent*) e;
- if ( obeyFocus || fe->reason() == TQFocusEvent::Mouse ||
- fe->reason() == TQFocusEvent::Shortcut ) {
+ if ( obeyFocus || fe->reason() != TQFocusEvent::ActiveWindow /*|| fe->reason() == TQFocusEvent::Mouse ||
+ fe->reason() == TQFocusEvent::Shortcut*/ ) {
// L0614: A widget in the embedded client was just given the Qt focus.
// Variable `obeyFocus' suggests that this is the result of mouse
// activity in the client. The XEMBED_REQUEST_FOCUS message causes
@@ -478,8 +478,11 @@ static int qxembed_x11_event_filter( XEvent* e)
switch ( detail ) {
case XEMBED_FOCUS_CURRENT:
// L0683: Set focus on saved focus widget
- if ( focusCurrent )
+ if ( focusCurrent ) {
focusCurrent->setFocus();
+ if( QXEmbed* emb = dynamic_cast< QXEmbed* >( focusCurrent ))
+ emb->updateEmbeddedFocus( true );
+ }
else if ( !w->topLevelWidget()->focusWidget() )
w->topLevelWidget()->setFocus();
break;
@@ -511,6 +514,8 @@ static int qxembed_x11_event_filter( XEvent* e)
// We first record what the focus widget was
// and clear the Qt focus.
if ( w->topLevelWidget()->focusWidget() ) {
+ if( QXEmbed* emb = dynamic_cast< QXEmbed* >( w->topLevelWidget()->focusWidget()))
+ emb->updateEmbeddedFocus( false );
focusMap->insert( w->topLevelWidget(),
new TQGuardedPtr<TQWidget>(w->topLevelWidget()->focusWidget() ) );
w->topLevelWidget()->focusWidget()->clearFocus();
@@ -919,6 +924,17 @@ void QXEmbed::focusOutEvent( TQFocusEvent * ){
}
+// When QXEmbed has TQt focus and gets/loses X focus, make sure the client knows
+// about the state of the focus.
+void QXEmbed::updateEmbeddedFocus( bool hasfocus ){
+ if (!window || d->xplain)
+ return;
+ if( hasfocus )
+ sendXEmbedMessage( window, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT);
+ else
+ sendXEmbedMessage( window, XEMBED_FOCUS_OUT);
+}
+
// L1600: Helper for QXEmbed::embed()
// Check whether a window is in withdrawn state.
static bool wstate_withdrawn( WId winid )
@@ -1161,6 +1177,8 @@ bool QXEmbed::x11Event( XEvent* e)
// L2085: The client asks for the focus.
case XEMBED_REQUEST_FOCUS:
if( ((QPublicWidget*)topLevelWidget())->topData()->embedded ) {
+ focusMap->remove( topLevelWidget() );
+ focusMap->insert( topLevelWidget(), new TQGuardedPtr<TQWidget>( this ));
WId window = ((QPublicWidget*)topLevelWidget())->topData()->parentWinId;
sendXEmbedMessage( window, XEMBED_REQUEST_FOCUS );
} else {