Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use visibility signal as driver for focus stack focus #5933

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading