improve smartness for Unity case layout

--when a vertical view is in busy state and is touching
also a horizontal view that is fully transparent in
SMART mode then the visual result is not that good.
In that case it is better to show the view background.
The horizontal view background in that case can provide
three different states:
a) if the panel style for popups is activated then the
horizontal view will follow the plasma original style
b) if NOT [a] and solid background for touching windows
is enabled then solid background will be offered
c) if NOT [a] and NOT [b] then the isBusy state
transparency will be offered
pull/8/head
Michail Vourlakos 6 years ago
parent ab9fbc3727
commit b078765d5c

@ -655,35 +655,35 @@ void View::setLatteTasksArePresent(bool present)
emit latteTasksArePresentChanged();
}
bool View::touchingBottomViewAndIsBusy() const
bool View::isTouchingBottomViewAndIsBusy() const
{
return m_touchingBottomViewAndIsBusy;
return m_isTouchingBottomViewAndIsBusy;
}
void View::setTouchingBottomViewAndIsBusy(bool touchAndBusy)
void View::setIsTouchingBottomViewAndIsBusy(bool touchAndBusy)
{
if (m_touchingBottomViewAndIsBusy == touchAndBusy) {
if (m_isTouchingBottomViewAndIsBusy == touchAndBusy) {
return;
}
m_touchingBottomViewAndIsBusy = touchAndBusy;
m_isTouchingBottomViewAndIsBusy = touchAndBusy;
emit touchingBottomViewAndIsBusyChanged();
emit isTouchingBottomViewAndIsBusyChanged();
}
bool View::touchingTopViewAndIsBusy() const
bool View::isTouchingTopViewAndIsBusy() const
{
return m_touchingTopViewAndIsBusy;
return m_isTouchingTopViewAndIsBusy;
}
void View::setTouchingTopViewAndIsBusy(bool touchAndBusy)
void View::setIsTouchingTopViewAndIsBusy(bool touchAndBusy)
{
if (m_touchingTopViewAndIsBusy == touchAndBusy) {
if (m_isTouchingTopViewAndIsBusy == touchAndBusy) {
return;
}
m_touchingTopViewAndIsBusy = touchAndBusy;
emit touchingTopViewAndIsBusyChanged();
m_isTouchingTopViewAndIsBusy = touchAndBusy;
emit isTouchingTopViewAndIsBusyChanged();
}
void View::preferredViewForShortcutsChangedSlot(Latte::View *view)

@ -87,8 +87,8 @@ class View : public PlasmaQuick::ContainmentView
Q_PROPERTY(bool onPrimary READ onPrimary WRITE setOnPrimary NOTIFY onPrimaryChanged)
//! values to be used from Smart surrounding Views
Q_PROPERTY(bool touchingBottomViewAndIsBusy READ touchingBottomViewAndIsBusy WRITE setTouchingBottomViewAndIsBusy NOTIFY touchingBottomViewAndIsBusyChanged)
Q_PROPERTY(bool touchingTopViewAndIsBusy READ touchingTopViewAndIsBusy WRITE setTouchingTopViewAndIsBusy NOTIFY touchingTopViewAndIsBusyChanged)
Q_PROPERTY(bool isTouchingBottomViewAndIsBusy READ isTouchingBottomViewAndIsBusy WRITE setIsTouchingBottomViewAndIsBusy NOTIFY isTouchingBottomViewAndIsBusyChanged)
Q_PROPERTY(bool isTouchingTopViewAndIsBusy READ isTouchingTopViewAndIsBusy WRITE setIsTouchingTopViewAndIsBusy NOTIFY isTouchingTopViewAndIsBusyChanged)
Q_PROPERTY(int alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
Q_PROPERTY(int fontPixelSize READ fontPixelSize WRITE setFontPixelSize NOTIFY fontPixelSizeChanged)
@ -153,11 +153,11 @@ public:
bool latteTasksArePresent() const;
void setLatteTasksArePresent(bool present);
bool touchingBottomViewAndIsBusy() const;
void setTouchingBottomViewAndIsBusy(bool touchAndBusy);
bool isTouchingBottomViewAndIsBusy() const;
void setIsTouchingBottomViewAndIsBusy(bool touchAndBusy);
bool touchingTopViewAndIsBusy() const;
void setTouchingTopViewAndIsBusy(bool touchAndBusy);
bool isTouchingTopViewAndIsBusy() const;
void setIsTouchingTopViewAndIsBusy(bool touchAndBusy);
float maxLength() const;
void setMaxLength(float length);
@ -264,6 +264,8 @@ signals:
void inEditModeChanged();
void indicatorChanged();
void isPreferredForShortcutsChanged();
void isTouchingBottomViewAndIsBusyChanged();
void isTouchingTopViewAndIsBusyChanged();
void latteTasksArePresentChanged();
void layoutChanged();
void localGeometryChanged();
@ -274,8 +276,6 @@ signals:
void onPrimaryChanged();
void positionerChanged();
void screenGeometryChanged();
void touchingBottomViewAndIsBusyChanged();
void touchingTopViewAndIsBusyChanged();
void typeChanged();
void visibilityChanged();
void windowsTrackerChanged();
@ -321,8 +321,8 @@ private:
bool m_latteTasksArePresent{false};
bool m_onPrimary{true};
bool m_touchingBottomViewAndIsBusy{false};
bool m_touchingTopViewAndIsBusy{false};
bool m_isTouchingBottomViewAndIsBusy{false};
bool m_isTouchingTopViewAndIsBusy{false};
int m_fontPixelSize{ -1};
int m_editThickness{24};

@ -90,6 +90,12 @@ void CurrentScreenTracker::init()
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::isTouchingBusyVerticalViewChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit isTouchingBusyVerticalViewChanged();
}
});
connect(m_wm->windowsTracker(), &WindowSystem::Tracker::Windows::activeWindowSchemeChanged, this, [&](const Latte::View *view) {
if (m_latteView == view) {
emit activeWindowSchemeChanged();
@ -147,6 +153,11 @@ bool CurrentScreenTracker::existsWindowTouching() const
return m_wm->windowsTracker()->existsWindowTouching(m_latteView);
}
bool CurrentScreenTracker::isTouchingBusyVerticalView() const
{
return m_wm->windowsTracker()->isTouchingBusyVerticalView(m_latteView);
}
WindowSystem::SchemeColors *CurrentScreenTracker::activeWindowScheme() const
{
return m_wm->windowsTracker()->activeWindowScheme(m_latteView);

@ -53,6 +53,7 @@ class CurrentScreenTracker : public QObject {
Q_PROPERTY(bool existsWindowActive READ existsWindowActive NOTIFY existsWindowActiveChanged)
Q_PROPERTY(bool existsWindowMaximized READ existsWindowMaximized NOTIFY existsWindowMaximizedChanged)
Q_PROPERTY(bool existsWindowTouching READ existsWindowTouching NOTIFY existsWindowTouchingChanged)
Q_PROPERTY(bool isTouchingBusyVerticalView READ isTouchingBusyVerticalView NOTIFY isTouchingBusyVerticalViewChanged)
Q_PROPERTY(Latte::WindowSystem::SchemeColors *activeWindowScheme READ activeWindowScheme NOTIFY activeWindowSchemeChanged)
Q_PROPERTY(Latte::WindowSystem::SchemeColors *touchingWindowScheme READ touchingWindowScheme NOTIFY touchingWindowSchemeChanged)
@ -68,6 +69,8 @@ public:
bool existsWindowMaximized() const;
bool existsWindowTouching() const;
bool isTouchingBusyVerticalView() const;
WindowSystem::SchemeColors *activeWindowScheme() const;
WindowSystem::SchemeColors *touchingWindowScheme() const;
@ -83,6 +86,8 @@ signals:
void existsWindowActiveChanged();
void existsWindowMaximizedChanged();
void existsWindowTouchingChanged();
void isTouchingBusyVerticalViewChanged();
void activeWindowSchemeChanged();
void touchingWindowSchemeChanged();

@ -74,6 +74,20 @@ void TrackedViewInfo::setExistsWindowTouching(bool touching)
m_existsWindowTouching = touching;
}
bool TrackedViewInfo::isTouchingBusyVerticalView() const
{
return m_isTouchingBusyVerticalView;
}
void TrackedViewInfo::setIsTouchingBusyVerticalView(bool touching)
{
if (m_isTouchingBusyVerticalView == touching) {
return;
}
m_isTouchingBusyVerticalView = touching;
}
QRect TrackedViewInfo::availableScreenGeometry() const
{
return m_availableScreenGeometry;

@ -56,6 +56,9 @@ public:
bool existsWindowTouching() const;
void setExistsWindowTouching(bool touching);
bool isTouchingBusyVerticalView() const;
void setIsTouchingBusyVerticalView(bool touching);
QRect availableScreenGeometry() const;
void setAvailableScreenGeometry(QRect geometry);
@ -67,8 +70,9 @@ public:
bool isTracking(const WindowInfoWrap &winfo) const override;
private:
bool m_activeWindowTouching;
bool m_existsWindowTouching;
bool m_activeWindowTouching{false};
bool m_existsWindowTouching{false};
bool m_isTouchingBusyVerticalView{false};
QRect m_availableScreenGeometry;

@ -42,6 +42,11 @@ Windows::Windows(AbstractWindowInterface *parent)
{
m_wm = parent;
m_extraViewHintsTimer.setInterval(600);
m_extraViewHintsTimer.setSingleShot(true);
connect(&m_extraViewHintsTimer, &QTimer::timeout, this, &Windows::updateExtraViewHints);
init();
}
@ -143,6 +148,7 @@ void Windows::initViewHints(Latte::View *view)
setExistsWindowActive(view, false);
setExistsWindowTouching(view, false);
setExistsWindowMaximized(view, false);
setIsTouchingBusyVerticalView(view, false);
setActiveWindowScheme(view, nullptr);
setTouchingWindowScheme(view, nullptr);
}
@ -170,6 +176,9 @@ void Windows::addView(Latte::View *view)
addRelevantLayout(view);
});
connect(view, &Latte::View::isTouchingBottomViewAndIsBusy, this, &Windows::updateExtraViewHints);
connect(view, &Latte::View::isTouchingTopViewAndIsBusy, this, &Windows::updateExtraViewHints);
updateAllHints();
emit informationAnnounced(view);
@ -369,6 +378,25 @@ void Windows::setExistsWindowTouching(Latte::View *view, bool windowTouching)
emit existsWindowTouchingChanged(view);
}
bool Windows::isTouchingBusyVerticalView(Latte::View *view) const
{
if (!m_views.contains(view)) {
return false;
}
return m_views[view]->isTouchingBusyVerticalView();
}
void Windows::setIsTouchingBusyVerticalView(Latte::View *view, bool viewTouching)
{
if (!m_views.contains(view) || m_views[view]->isTouchingBusyVerticalView() == viewTouching) {
return;
}
m_views[view]->setIsTouchingBusyVerticalView(viewTouching);
emit isTouchingBusyVerticalViewChanged(view);
}
SchemeColors *Windows::activeWindowScheme(Latte::View *view) const
{
if (!m_views.contains(view)) {
@ -720,6 +748,45 @@ void Windows::updateAllHints()
for (const auto layout : m_layouts.keys()) {
updateHints(layout);
}
if (!m_extraViewHintsTimer.isActive()) {
m_extraViewHintsTimer.start();
}
}
void Windows::updateExtraViewHints()
{
for (const auto horView : m_views.keys()) {
if (!m_views.contains(horView) || !m_views[horView]->enabled() || !m_views[horView]->isTrackingCurrentActivity()) {
continue;
}
if (horView->formFactor() == Plasma::Types::Horizontal) {
bool touchingBusyVerticalView{false};
for (const auto verView : m_views.keys()) {
if (!m_views.contains(verView) || !m_views[verView]->enabled() || !m_views[verView]->isTrackingCurrentActivity()) {
continue;
}
bool sameScreen = (verView->positioner()->currentScreenId() == horView->positioner()->currentScreenId());
if (verView->formFactor() == Plasma::Types::Vertical && sameScreen) {
bool topTouch = verView->isTouchingTopViewAndIsBusy() && horView->location() == Plasma::Types::TopEdge;
bool bottomTouch = verView->isTouchingBottomViewAndIsBusy() && horView->location() == Plasma::Types::BottomEdge;
if (topTouch || bottomTouch) {
touchingBusyVerticalView = true;
break;
}
}
}
//qDebug() << " Touching Busy Vertical View :: " << horView->location() << " - " << horView->positioner()->currentScreenId() << " :: " << touchingBusyVerticalView;
setIsTouchingBusyVerticalView(horView, touchingBusyVerticalView);
}
}
}
void Windows::updateHints(Latte::View *view)

@ -28,6 +28,7 @@
#include <QHash>
#include <QMap>
#include <QTimer>
namespace Latte {
class View;
@ -68,6 +69,7 @@ public:
bool existsWindowActive(Latte::View *view) const;
bool existsWindowMaximized(Latte::View *view) const;
bool existsWindowTouching(Latte::View *view) const;
bool isTouchingBusyVerticalView(Latte::View *view) const;
SchemeColors *activeWindowScheme(Latte::View *view) const;
SchemeColors *touchingWindowScheme(Latte::View *view) const;
LastActiveWindow *lastActiveWindow(Latte::View *view);
@ -98,6 +100,7 @@ signals:
void existsWindowActiveChanged(const Latte::View *view);
void existsWindowMaximizedChanged(const Latte::View *view);
void existsWindowTouchingChanged(const Latte::View *view);
void isTouchingBusyVerticalViewChanged(const Latte::View *view);
void activeWindowSchemeChanged(const Latte::View *view);
void touchingWindowSchemeChanged(const Latte::View *view);
void informationAnnounced(const Latte::View *view);
@ -122,6 +125,7 @@ private slots:
void addRelevantLayout(Latte::View *view);
void updateRelevantLayouts();
void updateExtraViewHints();
private:
void init();
@ -140,6 +144,7 @@ private:
void setExistsWindowActive(Latte::View *view, bool windowActive);
void setExistsWindowMaximized(Latte::View *view, bool windowMaximized);
void setExistsWindowTouching(Latte::View *view, bool windowTouching);
void setIsTouchingBusyVerticalView(Latte::View *view, bool viewTouching);
void setActiveWindowScheme(Latte::View *view, WindowSystem::SchemeColors *scheme);
void setTouchingWindowScheme(Latte::View *view, WindowSystem::SchemeColors *scheme);
@ -159,6 +164,10 @@ private:
bool isTouchingViewEdge(Latte::View *view, const WindowInfoWrap &winfo);
private:
//! a timer in order to not overload the views extra hints checking because it is not
//! really needed that often
QTimer m_extraViewHintsTimer;
AbstractWindowInterface *m_wm;
QHash<Latte::View *, TrackedViewInfo *> m_views;
QHash<Latte::Layout::GenericLayout *, TrackedLayoutInfo *> m_layouts;

@ -366,7 +366,8 @@ Item{
//! When switching from overlaied background to regular one this must be done
//! instantly otherwise the transition is not smooth
readonly property bool paintInstantly: root.hasExpandedApplet && root.plasmaBackgroundForPopups
readonly property bool paintInstantly: (root.hasExpandedApplet && root.plasmaBackgroundForPopups)
|| root.plasmaStyleBusyForTouchingBusyVerticalView
property rect efGeometry: Qt.rect(-1,-1,0,0)

@ -182,7 +182,7 @@ Item{
Binding{
target: latteView
property: "touchingTopViewAndIsBusy"
property: "isTouchingTopViewAndIsBusy"
when: latteView
value: {
var isTouchingTopScreenEdge = (latteView.y === latteView.screenGeometry.y);
@ -194,7 +194,7 @@ Item{
Binding{
target: latteView
property: "touchingBottomViewAndIsBusy"
property: "isTouchingBottomViewAndIsBusy"
when: latteView
value: {
var latteBottom = latteView.y + latteView.height;

@ -91,6 +91,7 @@ Loader{
if (themeExtended) {
if (root.userShowPanelBackground && root.plasmaBackgroundForPopups && root.hasExpandedApplet /*for expanded popups when it is enabled*/
|| root.plasmaStyleBusyForTouchingBusyVerticalView
|| (root.themeColors === Latte.Types.SmartThemeColors /*for Smart theming that Windows colors are not used and the user wants solidness at some cases*/
&& root.windowColors === Latte.Types.NoneWindowColors
&& root.forceSolidPanel) ) {

@ -134,6 +134,8 @@ Item {
&& !(hasExpandedApplet && !plasmaBackgroundForPopups)
&& latteView.windowsTracker.currentScreen.existsWindowTouching)
|| (hasExpandedApplet && plasmaBackgroundForPopups) ))
|| solidBusyForTouchingBusyVerticalView
|| plasmaStyleBusyForTouchingBusyVerticalView
|| !Latte.WindowSystem.compositingActive
property bool forceTransparentPanel: root.backgroundOnlyOnMaximized
@ -144,10 +146,30 @@ Item {
&& !(windowColors === Latte.Types.TouchingWindowColors && latteView.windowsTracker.currentScreen.activeWindowTouching)
&& !(windowColors === Latte.Types.ActiveWindowColors && selectedWindowsTracker.existsWindowActive)
property bool forcePanelForBusyBackground: userShowPanelBackground
&& root.forceTransparentPanel
&& (root.themeColors === Latte.Types.SmartThemeColors)
&& colorizerManager.backgroundIsBusy
property bool forcePanelForBusyBackground: userShowPanelBackground && (root.themeColors === Latte.Types.SmartThemeColors)
&& ( (root.forceTransparentPanel && colorizerManager.backgroundIsBusy)
|| normalBusyForTouchingBusyVerticalView )
property bool normalBusyForTouchingBusyVerticalView: (latteView && latteView.windowsTracker /*is touching a vertical view that is in busy state and the user prefers isBusy transparency*/
&& latteView.windowsTracker.currentScreen.isTouchingBusyVerticalView
&& root.themeColors === Latte.Types.SmartThemeColors
&& plasmoid.configuration.backgroundOnlyOnMaximized
&& !plasmoid.configuration.solidBackgroundForMaximized
&& !plasmaBackgroundForPopups)
property bool solidBusyForTouchingBusyVerticalView: (latteView && latteView.windowsTracker /*is touching a vertical view that is in busy state and the user prefers solidness*/
&& latteView.windowsTracker.currentScreen.isTouchingBusyVerticalView
&& root.themeColors === Latte.Types.SmartThemeColors
&& plasmoid.configuration.backgroundOnlyOnMaximized
&& plasmoid.configuration.solidBackgroundForMaximized
&& !plasmaBackgroundForPopups)
property bool plasmaStyleBusyForTouchingBusyVerticalView: (latteView && latteView.windowsTracker /*is touching a vertical view that is in busy state and the user prefers solidness*/
&& latteView.windowsTracker.currentScreen.isTouchingBusyVerticalView
&& root.themeColors === Latte.Types.SmartThemeColors
&& plasmoid.configuration.backgroundOnlyOnMaximized
&& plasmaBackgroundForPopups)
property int themeColors: plasmoid.configuration.themeColors
property int windowColors: plasmoid.configuration.windowColors

Loading…
Cancel
Save