Storing active virtual desktop in a variable is more reliable

as a widget can lose its focus.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/8/head
Mavridis Philippe 3 years ago
parent b5e39bb95f
commit 24c6b74209
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -281,7 +281,9 @@ void KomposeFullscreenWidget::keyReleaseEvent ( TQKeyEvent *e )
bool KomposeFullscreenWidget::focusNeighbourDesk( int direction ) bool KomposeFullscreenWidget::focusNeighbourDesk( int direction )
{ {
bool successfull = false; bool successfull = false;
if ( !children()->containsRef(focusWidget()) ) static TQWidget* activeDesktop;
if ( activeDesktop == NULL )
{ {
kdDebug() << "KomposeFullscreenWidget::keyReleaseEvent - No widget focussed. Focussing first" << endl; kdDebug() << "KomposeFullscreenWidget::keyReleaseEvent - No widget focussed. Focussing first" << endl;
const TQObjectList *lst = children(); const TQObjectList *lst = children();
@ -296,6 +298,7 @@ bool KomposeFullscreenWidget::focusNeighbourDesk( int direction )
{ {
kdDebug() << "KomposeFullscreenWidget::keyReleaseEvent - Focussing " << widget->className() << endl; kdDebug() << "KomposeFullscreenWidget::keyReleaseEvent - Focussing " << widget->className() << endl;
widget->setFocus(); widget->setFocus();
activeDesktop = widget;
successfull = true; successfull = true;
break; break;
} }
@ -306,10 +309,11 @@ bool KomposeFullscreenWidget::focusNeighbourDesk( int direction )
else else
{ {
KomposeWidget *widget; KomposeWidget *widget;
if ( ( widget = layout->getNeighbour( dynamic_cast<KomposeWidget*>(focusWidget()), direction, WLAYOUT_BOTH ) ) != 0 ) if ( ( widget = layout->getNeighbour( dynamic_cast<KomposeWidget*>(activeDesktop), direction, WLAYOUT_BOTH ) ) != 0 )
{ {
kdDebug() << "KomposeFullscreenWidget::keyReleaseEvent - Focussing " << widget->className() << endl; kdDebug() << "KomposeFullscreenWidget::keyReleaseEvent - Focussing " << widget->className() << endl;
widget->setFocus(); widget->setFocus();
activeDesktop = widget;
successfull = true; successfull = true;
} }
} }

Loading…
Cancel
Save