mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
folio: Ensure y anim signals don't get emitted if value didn't change
This ensures extraneous signals from being emitted when values don't change in y animations. This fixes the vkbd in the search widget getting in a weird stuck state due to multiple focuses on the search widget.
This commit is contained in:
parent
147e949ee7
commit
6af5d97595
3 changed files with 37 additions and 11 deletions
|
|
@ -572,6 +572,16 @@ qreal HomeScreenState::appDrawerOpenProgress()
|
|||
return m_appDrawerOpenProgress;
|
||||
}
|
||||
|
||||
void HomeScreenState::setAppDrawerOpenProgress(qreal appDrawerOpenProgress)
|
||||
{
|
||||
if (appDrawerOpenProgress == m_appDrawerOpenProgress) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_appDrawerOpenProgress = appDrawerOpenProgress;
|
||||
Q_EMIT appDrawerOpenProgressChanged();
|
||||
}
|
||||
|
||||
qreal HomeScreenState::appDrawerY()
|
||||
{
|
||||
return m_appDrawerY;
|
||||
|
|
@ -579,10 +589,12 @@ qreal HomeScreenState::appDrawerY()
|
|||
|
||||
void HomeScreenState::setAppDrawerY(qreal appDrawerY)
|
||||
{
|
||||
m_appDrawerY = appDrawerY;
|
||||
m_appDrawerOpenProgress = 1 - qBound(0.0, m_appDrawerY, APP_DRAWER_OPEN_DIST) / APP_DRAWER_OPEN_DIST;
|
||||
Q_EMIT appDrawerYChanged();
|
||||
Q_EMIT appDrawerOpenProgressChanged();
|
||||
if (m_appDrawerY != appDrawerY) {
|
||||
m_appDrawerY = appDrawerY;
|
||||
Q_EMIT appDrawerYChanged();
|
||||
}
|
||||
|
||||
setAppDrawerOpenProgress(1 - qBound(0.0, m_appDrawerY, APP_DRAWER_OPEN_DIST) / APP_DRAWER_OPEN_DIST);
|
||||
}
|
||||
|
||||
qreal HomeScreenState::searchWidgetOpenProgress()
|
||||
|
|
@ -590,17 +602,29 @@ qreal HomeScreenState::searchWidgetOpenProgress()
|
|||
return m_searchWidgetOpenProgress;
|
||||
}
|
||||
|
||||
void HomeScreenState::setSearchWidgetOpenProgress(qreal progress)
|
||||
{
|
||||
if (m_searchWidgetOpenProgress == progress) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_searchWidgetOpenProgress = progress;
|
||||
Q_EMIT searchWidgetOpenProgressChanged();
|
||||
}
|
||||
|
||||
qreal HomeScreenState::searchWidgetY()
|
||||
{
|
||||
return m_searchWidgetOpenProgress;
|
||||
return m_searchWidgetY;
|
||||
}
|
||||
|
||||
void HomeScreenState::setSearchWidgetY(qreal searchWidgetY)
|
||||
{
|
||||
m_searchWidgetY = searchWidgetY;
|
||||
m_searchWidgetOpenProgress = 1 - qBound(0.0, m_searchWidgetY, SEARCH_WIDGET_OPEN_DIST) / SEARCH_WIDGET_OPEN_DIST;
|
||||
Q_EMIT searchWidgetYChanged();
|
||||
Q_EMIT searchWidgetOpenProgressChanged();
|
||||
if (m_searchWidgetY != searchWidgetY) {
|
||||
m_searchWidgetY = searchWidgetY;
|
||||
Q_EMIT searchWidgetYChanged();
|
||||
}
|
||||
|
||||
setSearchWidgetOpenProgress(1 - qBound(0.0, m_searchWidgetY, SEARCH_WIDGET_OPEN_DIST) / SEARCH_WIDGET_OPEN_DIST);
|
||||
}
|
||||
|
||||
qreal HomeScreenState::delegateDragX()
|
||||
|
|
|
|||
|
|
@ -348,6 +348,9 @@ private:
|
|||
void setViewState(ViewState viewState);
|
||||
void setSwipeState(SwipeState swipeState);
|
||||
|
||||
void setAppDrawerOpenProgress(qreal progress);
|
||||
void setSearchWidgetOpenProgress(qreal progress);
|
||||
|
||||
void startDelegateDrag(qreal startX, qreal startY, qreal pointerOffsetX, qreal pointerOffsetY);
|
||||
|
||||
void cancelAppDrawerAnimations();
|
||||
|
|
|
|||
|
|
@ -468,8 +468,7 @@ Item {
|
|||
function onSearchWidgetOpenProgressChanged() {
|
||||
if (homeScreenState.searchWidgetOpenProgress === 1.0) {
|
||||
searchWidget.requestFocus();
|
||||
} else {
|
||||
// TODO this gets called a lot, can we have a more performant way?
|
||||
} else if (!root.activeFocus) {
|
||||
root.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue