Skip to content

Commit

Permalink
Use visibility signal as driver for focus stack focus
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jan 6, 2025
1 parent 4a9ab89 commit 07832ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions src/core/focusstack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@

void FocusStack::addFocusTaker( QObject *object )
{
QVariant visible = object->property( "visible" );
QVariant opened = object->property( "opened" );
const QVariant visible = object->property( "visible" );
const QVariant opened = object->property( "opened" );
if ( opened.isValid() )
{
connect( object, SIGNAL( opened() ), this, SLOT( popupOpened() ) );
connect( object, SIGNAL( closed() ), this, SLOT( popupClosed() ) );
}
else if ( visible.isValid() )
{
connect( object, SIGNAL( activeFocusChanged( bool ) ), this, SLOT( itemFocusChanged( bool ) ) );
connect( object, SIGNAL( visibleChanged() ), this, SLOT( visibleChanged() ) );
if ( visible.toBool() )
{
mStackList.append( object );
}
}
}

Expand All @@ -40,9 +44,10 @@ void FocusStack::popupClosed()
setUnfocused( sender() );
}

void FocusStack::itemFocusChanged( bool itemActiveFocus )
void FocusStack::visibleChanged()
{
if ( itemActiveFocus )
const QVariant visible = sender()->property( "visible" );
if ( visible.toBool() )
{
setFocused( sender() );
}
Expand All @@ -60,8 +65,8 @@ void FocusStack::setFocused( QObject *object )

void FocusStack::setUnfocused( QObject *object )
{
QVariant visible = object->property( "visible" );
QVariant opened = object->property( "opened" );
const QVariant visible = object->property( "visible" );
const QVariant opened = object->property( "opened" );
if ( opened.isValid() )
{
if ( !opened.toBool() )
Expand Down
2 changes: 1 addition & 1 deletion src/core/focusstack.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FocusStack : public QObject
Q_INVOKABLE void forceActiveFocusOnLastTaker() const;

private slots:
void itemFocusChanged( bool itemActiveFocus );
void visibleChanged();
void popupOpened();
void popupClosed();

Expand Down

0 comments on commit 07832ff

Please sign in to comment.