option to disable creenEdgeMargin for maximized

--improved settings for Floating windows in Behavior
tab and add a new option to hide ALL screen gaps meaning
both length screen and thickness screen gap when there
is a maximized window in the screen

BUG:415630
pull/11/head
Michail Vourlakos 5 years ago
parent 074d9efee1
commit 79705e9753

@ -60,10 +60,10 @@ void Effects::init()
});
connect(m_view, &Latte::View::alignmentChanged, this, &Effects::updateEnabledBorders);
connect(m_view, &Latte::View::screenEdgeMarginChanged, this, &Effects::updateEnabledBorders);
connect(m_view, &Latte::View::behaveAsPlasmaPanelChanged, this, &Effects::updateEffects);
connect(m_view, &Latte::View::behaveAsPlasmaPanelChanged, this, &Effects::updateShadows);
connect(m_view, &Latte::View::configWindowGeometryChanged, this, &Effects::updateMask);
connect(m_view, &Latte::View::screenEdgeMarginEnabledChanged, this, &Effects::updateEnabledBorders);
connect(&m_theme, &Plasma::Theme::themeChanged, this, [&]() {
auto background = m_background;

@ -137,6 +137,12 @@ void Positioner::init()
}
});
connect(m_view, &Latte::View::screenEdgeMarginEnabledChanged, this, [&]() {
if (m_view->behaveAsPlasmaPanel()) {
syncGeometry();
}
});
connect(m_view->effects(), &Latte::ViewPart::Effects::drawShadowsChanged, this, [&]() {
if (!m_view->behaveAsPlasmaPanel()) {
syncGeometry();

@ -815,7 +815,17 @@ void View::setOffset(int offset)
bool View::screenEdgeMarginEnabled() const
{
return (m_screenEdgeMargin > -1);
return m_screenEdgeMarginEnabled;
}
void View::setScreenEdgeMarginEnabled(bool enabled)
{
if (m_screenEdgeMarginEnabled == enabled) {
return;
}
m_screenEdgeMarginEnabled = enabled;
emit screenEdgeMarginEnabledChanged();
}
int View::screenEdgeMargin() const
@ -830,6 +840,8 @@ void View::setScreenEdgeMargin(int margin)
}
m_screenEdgeMargin = margin;
setScreenEdgeMarginEnabled(m_screenEdgeMargin>-1);
emit screenEdgeMarginChanged();
}

@ -286,6 +286,7 @@ signals:
void onPrimaryChanged();
void positionerChanged();
void screenEdgeMarginChanged();
void screenEdgeMarginEnabledChanged();
void screenGeometryChanged();
void typeChanged();
void visibilityChanged();
@ -323,6 +324,7 @@ private:
void updateAppletContainsMethod();
void setContainsDrag(bool contains);
void setScreenEdgeMarginEnabled(bool enabled);
private:
Plasma::Containment *containmentById(uint id);
@ -337,6 +339,7 @@ private:
bool m_isPreferredForShortcuts{false};
bool m_latteTasksArePresent{false};
bool m_onPrimary{true};
bool m_screenEdgeMarginEnabled{false};
bool m_isTouchingBottomViewAndIsBusy{false};
bool m_isTouchingTopViewAndIsBusy{false};

@ -881,27 +881,24 @@ void Windows::updateHints(Latte::View *view)
activeWinId = winfo.wid();
}
//! Maximized windows flags
if ((winfo.isActive() && isMaximizedInViewScreen(view, winfo)) //! active maximized windows have higher priority than the rest maximized windows
|| (!foundMaximizedInCurScreen && isMaximizedInViewScreen(view, winfo))) {
foundMaximizedInCurScreen = true;
maxWinId = winfo.wid();
}
//! Touching windows flags
if (isTouchingViewEdge(view, winfo) || isTouchingView(view, winfo)) {
if (winfo.isActive()) {
//qDebug() << " ACTIVE-TOUCH :: " << winfo.wid() << " _ " << winfo.appName() << " _ " << winfo.geometry() << " _ " << winfo.display();
foundActiveTouchInCurScreen = true;
activeTouchWinId = winfo.wid();
if (isMaximizedInViewScreen(view, winfo)) {
//! active maximized windows have higher priority than the rest maximized windows
foundMaximizedInCurScreen = true;
maxWinId = winfo.wid();
}
} else {
//qDebug() << " TOUCH :: " << winfo.wid() << " _ " << winfo.appName() << " _ " << winfo.geometry() << " _ " << winfo.display();
foundTouchInCurScreen = true;
touchWinId = winfo.wid();
}
if (!foundMaximizedInCurScreen && isMaximizedInViewScreen(view, winfo)) {
foundMaximizedInCurScreen = true;
maxWinId = winfo.wid();
}
}
//qDebug() << "window geometry ::: " << winfo.geometry();

@ -57,6 +57,10 @@
<default>false</default>
<label>floating views require Fitts Law to be applied</label>
</entry>
<entry name="hideScreenGapForMaximized" type="Bool">
<default>false</default>
<label>floating views hide their screen gap for maximized windows</label>
</entry>
<entry name="proportionIconSize" type="Double">
<default>-1</default>
<label>this is a percentage value, -1 means disabled</label>

@ -120,11 +120,11 @@ Window{
}
Text{
text: "Max Length (user)"+space
text: "Max Length"+space
}
Text{
text: plasmoid.configuration.maxLength +"%"
text: root.maxLengthPerCentage +"%"
}
Text{

@ -76,7 +76,7 @@ Item{
}
property int spacing: {
if (root.panelAlignment === Latte.Types.Justify && plasmoid.configuration.maxLength === 100) {
if (root.panelAlignment === Latte.Types.Justify && root.maxLengthPerCentage === 100) {
return 0;
} else if (!Latte.WindowSystem.compositingActive) {
return root.panelEdgeSpacing/2;

@ -165,7 +165,7 @@ Item{
target: latteView
property: "maxLength"
when: latteView
value: root.inConfigureAppletsMode ? 1 : plasmoid.configuration.maxLength/100
value: root.inConfigureAppletsMode ? 1 : maxLengthPerCentage/100
}
Binding{
@ -179,7 +179,7 @@ Item{
target: latteView
property: "screenEdgeMargin"
when: latteView
value: !root.screenEdgeMarginEnabled ? -1 : plasmoid.configuration.screenEdgeMargin
value: !root.screenEdgeMarginEnabled || root.hideThickScreenGap ? -1 : plasmoid.configuration.screenEdgeMargin
}
Binding{
@ -292,6 +292,8 @@ Item{
|| plasmoid.configuration.solidBackgroundForMaximized
|| root.disablePanelShadowMaximized
|| root.windowColors !== Latte.Types.NoneWindowColors))
|| (root.screenEdgeMarginsEnabled /*Dynamic Screen Edge Margin*/
&& plasmoid.configuration.hideScreenGapForMaximized)
}
Connections{

@ -96,7 +96,7 @@ Item {
if (root.panelAlignment === Latte.Types.Justify) {
//! Justify case
if (plasmoid.configuration.maxLength!==100) {
if (root.maxLengthPerCentage!==100) {
return false;
}

@ -174,6 +174,19 @@ Item {
&& plasmoid.configuration.backgroundOnlyOnMaximized
&& plasmaBackgroundForPopups)*/
property bool hideThickScreenGap: screenEdgeMarginEnabled
&& plasmoid.configuration.hideScreenGapForMaximized
&& latteView && latteView.windowsTracker
&& latteView.windowsTracker.currentScreen.existsWindowMaximized
property bool hideLengthScreenGaps: hideThickScreenGap
&& (latteView.visibility.mode === Latte.Types.AlwaysVisible
|| latteView.visibility.mode === Latte.Types.WindowsGoBelow)
&& (plasmoid.configuration.panelPosition === Latte.Types.Justify)
&& maxLengthPerCentage>85
&& !root.editMode
property int themeColors: plasmoid.configuration.themeColors
property int windowColors: plasmoid.configuration.windowColors
@ -199,7 +212,7 @@ Item {
property bool dockIsShownCompletely: !(dockIsHidden || inSlidingIn || inSlidingOut) && !root.editMode
property bool dragActiveWindowEnabled: plasmoid.configuration.dragActiveWindowEnabled
property bool immutable: plasmoid.immutable
property bool inFullJustify: (plasmoid.configuration.panelPosition === Latte.Types.Justify) && (plasmoid.configuration.maxLength===100)
property bool inFullJustify: (plasmoid.configuration.panelPosition === Latte.Types.Justify) && (maxLengthPerCentage===100)
property bool inSlidingIn: visibilityManager ? visibilityManager.inSlidingIn : false
property bool inSlidingOut: visibilityManager ? visibilityManager.inSlidingOut : false
property bool inStartup: true
@ -254,11 +267,13 @@ Item {
}
property int latteAppletPos: -1
property int maxLengthPerCentage: hideLengthScreenGaps ? 100 : plasmoid.configuration.maxLength
property int maxLength: {
if (root.isHorizontal) {
return behaveAsPlasmaPanel ? width : width * (plasmoid.configuration.maxLength/100)
return behaveAsPlasmaPanel ? width : width * (maxLengthPerCentage/100)
} else {
return behaveAsPlasmaPanel ? height : height * (plasmoid.configuration.maxLength/100)
return behaveAsPlasmaPanel ? height : height * (maxLengthPerCentage/100)
}
}
@ -393,8 +408,10 @@ Item {
property int thickMargin: thickMarginFactor * root.iconSize
property bool screenEdgeMarginEnabled: plasmoid.configuration.screenEdgeMargin >= 0 && !plasmoid.configuration.shrinkThickMargins
property int screenEdgeMargin: !screenEdgeMarginEnabled ? 0 : plasmoid.configuration.screenEdgeMargin
property int localScreenEdgeMargin: (screenEdgeMarginEnabled && behaveAsPlasmaPanel) || !screenEdgeMarginEnabled ? 0 : plasmoid.configuration.screenEdgeMargin
property int screenEdgeMargin: !screenEdgeMarginEnabled || hideThickScreenGap ? 0 : plasmoid.configuration.screenEdgeMargin
property int localScreenEdgeMargin: (screenEdgeMarginEnabled && behaveAsPlasmaPanel)
|| !screenEdgeMarginEnabled
|| hideThickScreenGap ? 0 : plasmoid.configuration.screenEdgeMargin
//! thickness margins are always two and equal in order for items
//! to be always correctly centered

@ -718,32 +718,56 @@ PlasmaComponents.Page {
}
}
LatteComponents.CheckBox {
Layout.maximumWidth: dialog.optionsWidth
// Layout.maximumHeight: mouseWheelChk.height
text: i18n("➊ Activate based on position through global shortcuts")
checked: latteView.isPreferredForShortcuts || (!latteView.layout.preferredForShortcutsTouched && latteView.isHighestPriorityView())
tooltip: i18n("This view is used for based on position global shortcuts. Take note that only one view can have that option enabled for each layout")
onClicked: {
latteView.isPreferredForShortcuts = checked
if (!latteView.layout.preferredForShortcutsTouched) {
latteView.layout.preferredForShortcutsTouched = true
}
}
}
}
}
LatteComponents.SubHeader {
id: floatingSubCategory
text: i18n("Floating")
enabled: !plasmoid.configuration.shrinkThickMargins && (plasmoid.configuration.screenEdgeMargin >= 0)
}
LatteComponents.CheckBoxesColumn {
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
enabled: floatingSubCategory.enabled
LatteComponents.CheckBoxesColumn {
LatteComponents.CheckBox {
id: fittsLawChk
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Always use screen gap for floating panel")
text: i18n("Always use screen gap for user interaction")
checked: plasmoid.configuration.fittsLawIsRequested
tooltip: i18n("When the panel is in floating mode, the gap to the screen is also used")
visible: dialog.highLevel
enabled: !plasmoid.configuration.shrinkThickMargins && (plasmoid.configuration.screenEdgeMargin >= 0)
tooltip: i18n("Panels in floating mode use the screen gap for user interaction")
onClicked: {
plasmoid.configuration.fittsLawIsRequested = checked
plasmoid.configuration.fittsLawIsRequested = checked;
}
}
LatteComponents.CheckBox {
id: hideScreenGapForMaximizedChk
Layout.maximumWidth: dialog.optionsWidth
// Layout.maximumHeight: mouseWheelChk.height
text: i18n("➊ Activate based on position through global shortcuts")
checked: latteView.isPreferredForShortcuts || (!latteView.layout.preferredForShortcutsTouched && latteView.isHighestPriorityView())
tooltip: i18n("This view is used for based on position global shortcuts. Take note that only one view can have that option enabled for each layout")
text: i18n("Hide screen gap for maximized windows")
checked: plasmoid.configuration.hideScreenGapForMaximized
tooltip: i18n("Panels in floating mode disable their screen gap for maximized windows")
onClicked: {
latteView.isPreferredForShortcuts = checked
if (!latteView.layout.preferredForShortcutsTouched) {
latteView.layout.preferredForShortcutsTouched = true
}
plasmoid.configuration.hideScreenGapForMaximized = checked;
}
}
}

Loading…
Cancel
Save