fix #355, Request for new visibility policy: Windows Go Below

pull/1/head
Johan Smith Agudelo Rodriguez 8 years ago
parent b48c74ed08
commit adf82df246

@ -48,8 +48,6 @@ DockConfigView::DockConfigView(Plasma::Containment *containment, DockView *dockV
setIcon(qGuiApp->windowIcon());
}
m_previousDockWinBehavior = m_dockView->dockWinBehavior();
m_screenSyncTimer.setSingleShot(true);
m_screenSyncTimer.setInterval(100);
connections << connect(dockView, SIGNAL(screenChanged(QScreen *)), &m_screenSyncTimer, SLOT(start()));
@ -209,28 +207,40 @@ void DockConfigView::showEvent(QShowEvent *ev)
m_screenSyncTimer.start();
QTimer::singleShot(400, this, &DockConfigView::syncGeometry);
m_previousMode = m_dockView->visibility()->mode();
emit showSignal();
}
void DockConfigView::hideEvent(QHideEvent *ev)
{
if (m_dockView && m_dockView->containment())
if (!m_dockView) {
QQuickWindow::hideEvent(ev);
return;
}
if (m_dockView->containment())
m_dockView->containment()->setUserConfiguring(false);
QQuickWindow::hideEvent(ev);
if ((m_dockView && m_dockView->visibility()->mode() != m_previousMode
&& ((m_dockView->visibility()->mode() == Dock::AlwaysVisible)
|| (m_previousMode == Dock::AlwaysVisible)))
|| (m_previousDockWinBehavior != m_dockView->dockWinBehavior())) {
auto recreateDock = [&]() noexcept {
auto *dockCorona = qobject_cast<DockCorona *>(m_dockView->corona());
if (dockCorona) {
dockCorona->recreateDock(m_dockView->containment());
}
};
const auto mode = m_dockView->visibility()->mode();
const auto previousDockWinBehavior = (m_dockView->flags() & Qt::BypassWindowManagerHint) ? false : true;
if (mode == Dock::AlwaysVisible || mode == Dock::WindowsGoBelow) {
if (!previousDockWinBehavior) {
recreateDock();
return;
}
} else if (m_dockView->dockWinBehavior() != previousDockWinBehavior) {
recreateDock();
return;
}
deleteLater();

@ -76,16 +76,10 @@ signals:
private:
bool m_blockFocusLost;
//! it is used to check if we need to recreate the dock window
//! after the configuration window gets closed
bool m_previousDockWinBehavior;
QPointer<DockView> m_dockView;
QTimer m_screenSyncTimer;
QList<QMetaObject::Connection> connections;
Dock::Visibility m_previousMode{Dock::None};
};
}

@ -814,14 +814,15 @@ void DockCorona::addDock(Plasma::Containment *containment)
//! of the window... This of course is also used during
//! recreations of the window between different visibility modes
auto mode = static_cast<Dock::Visibility>(containment->config().readEntry("visibility", static_cast<int>(Dock::DodgeActive)));
bool dockWin = containment->config().readEntry("dockWindowBehavior", false);
bool alwaysVisible{false};
bool dockWin{false};
if (mode == Latte::Dock::AlwaysVisible) {
alwaysVisible = true;
if (mode == Dock::AlwaysVisible || mode == Dock::WindowsGoBelow) {
dockWin = true;
} else {
dockWin = containment->config().readEntry("dockWindowBehavior", false);
}
auto dockView = new DockView(this, nextScreen, alwaysVisible, dockWin);
auto dockView = new DockView(this, nextScreen, dockWin);
dockView->init();
dockView->setContainment(containment);

@ -50,7 +50,7 @@ namespace Latte {
//! both alwaysVisible and dockWinBehavior are passed through corona because
//! during the dock window creation containment hasnt been set, but these variables
//! are needed in order for window flags to be set correctly
DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen, bool alwaysVisible, bool dockWindowBehavior)
DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen, bool dockWindowBehavior)
: PlasmaQuick::ContainmentView(corona),
m_contextMenu(nullptr)
{
@ -61,17 +61,16 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen, bool alwaysVis
setColor(QColor(Qt::transparent));
setClearBeforeRendering(true);
if (!alwaysVisible && !dockWindowBehavior) {
setFlags(Qt::BypassWindowManagerHint
| Qt::FramelessWindowHint
const auto flags = Qt::FramelessWindowHint
| Qt::WindowStaysOnTopHint
| Qt::NoDropShadowWindowHint
| Qt::WindowDoesNotAcceptFocus);
| Qt::WindowDoesNotAcceptFocus;
if (dockWindowBehavior) {
setFlags(flags);
} else {
setFlags(Qt::FramelessWindowHint
| Qt::WindowStaysOnTopHint
| Qt::NoDropShadowWindowHint
| Qt::WindowDoesNotAcceptFocus);
setFlags(flags | Qt::BypassWindowManagerHint);
}
KWindowSystem::setOnAllDesktops(winId(), true);

@ -78,7 +78,7 @@ class DockView : public PlasmaQuick::ContainmentView {
Q_PROPERTY(Latte::Dock::SessionType session READ session WRITE setSession NOTIFY sessionChanged)
public:
DockView(Plasma::Corona *corona, QScreen *targetScreen = nullptr, bool alwaysVisible = false, bool dockWindowBehavior = false);
DockView(Plasma::Corona *corona, QScreen *targetScreen = nullptr, bool dockWindowBehavior = false);
virtual ~DockView();
void init();

@ -170,6 +170,9 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
timerCheckWindows.start();
}
break;
case Dock::WindowsGoBelow: {
//
}
}
view->containment()->config().writeEntry("visibility", static_cast<int>(mode));

@ -40,7 +40,8 @@ public:
AutoHide,
DodgeActive,
DodgeMaximized,
DodgeAllWindows
DodgeAllWindows,
WindowsGoBelow
};
Q_ENUM(Visibility)

@ -352,7 +352,7 @@ PlasmaComponents.Page {
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("Always Visible")
checked: dock.visibility.mode === mode
checked: parent.mode === mode
checkable: true
exclusiveGroup: visibilityGroup
@ -361,7 +361,7 @@ PlasmaComponents.Page {
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("Auto Hide")
checked: dock.visibility.mode === mode
checked: parent.mode === mode
checkable: true
exclusiveGroup: visibilityGroup
@ -370,7 +370,7 @@ PlasmaComponents.Page {
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("Dodge Active")
checked: dock.visibility.mode === mode
checked: parent.mode === mode
checkable: true
exclusiveGroup: visibilityGroup
@ -379,7 +379,7 @@ PlasmaComponents.Page {
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("Dodge Maximized")
checked: dock.visibility.mode === mode
checked: parent.mode === mode
checkable: true
exclusiveGroup: visibilityGroup
@ -388,12 +388,21 @@ PlasmaComponents.Page {
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("Dodge All Windows")
checked: dock.visibility.mode === mode
checked: parent.mode === mode
checkable: true
exclusiveGroup: visibilityGroup
property int mode: Latte.Dock.DodgeAllWindows
}
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("Windows Go Below")
checked: parent.mode === mode
checkable: true
exclusiveGroup: visibilityGroup
property int mode: Latte.Dock.WindowsGoBelow
}
}
}
//! END: Visibility
@ -403,6 +412,9 @@ PlasmaComponents.Page {
Layout.fillWidth: true
spacing: units.smallSpacing
enabled: !(dock.visibility.mode === Latte.Dock.AlwaysVisible
|| dock.visibility.mode === Latte.Dock.WindowsGoBelow)
Header {
Layout.fillWidth: true
text: i18n("Delay")
@ -424,8 +436,6 @@ PlasmaComponents.Page {
}
LatteTextField {
Layout.preferredWidth: width
enabled: dock.visibility.mode !== Latte.Dock.AlwaysVisible
text: dock.visibility.timerShow
onValueChanged: {
@ -441,8 +451,6 @@ PlasmaComponents.Page {
}
LatteTextField{
Layout.preferredWidth: width
enabled: dock.visibility.mode !== Latte.Dock.AlwaysVisible
text: dock.visibility.timerHide
onValueChanged: {

@ -116,10 +116,12 @@ PlasmaComponents.Page {
Layout.leftMargin: units.smallSpacing * 2
text: i18n("Behave as a normal dock window")
checked: dock.dockWinBehavior
enabled: dock.visibility.mode !== Latte.Dock.AlwaysVisible
enabled: !(dock.visibility.mode === Latte.Dock.AlwaysVisible
|| dock.visibility.mode === Latte.Dock.WindowsGoBelow)
// tooltip: i18n("Remove the BypassWindowManagerHint flag from the window")
onClicked: {
onCheckedChanged: {
dock.dockWinBehavior = checked
}
}

Loading…
Cancel
Save