2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2020-03-05 09:45:46 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2009 Lucas Murray <lmurray@undefinedfire.com>
|
|
|
|
SPDX-FileCopyrightText: 2020 Cyril Rossi <cyril.rossi@enioka.com>
|
2020-03-05 09:45:46 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2020-03-05 09:45:46 +00:00
|
|
|
|
|
|
|
#ifndef __KWINSCREENEDGE_H__
|
|
|
|
#define __KWINSCREENEDGE_H__
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
#include "kwinglobals.h"
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class Monitor;
|
|
|
|
|
|
|
|
class KWinScreenEdge : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit KWinScreenEdge(QWidget *parent = nullptr);
|
|
|
|
~KWinScreenEdge() override;
|
|
|
|
|
|
|
|
void monitorHideEdge(ElectricBorder border, bool hidden);
|
KCM KWinTouchEdges disable edge if is immutable
Summary:
Disable touch screen edge modification, but allow the user to open an edge context menu and see the settings.
To set an edge immutable, just add `[$i]` right after the entry in `TouchEdges` group, although the edges settings are shared between some `[Effect-something]` group under the key `TouchBorderActivateSomething`.
Since one entry like `TouchBorderActivateSomething` lists all edges that use this effect, it doesn't make sense to set it immutable.
Test Plan:
In `kwinrc`, set the `TouchEdges` group immutable or any entry.
```
[TouchEdges]
Bottom=None
Left=None
Right=None
Top[$i]=None
```
Reviewers: ervin, bport, meven, zzag, #kwin, mart
Reviewed By: ervin, zzag, #kwin, mart
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D28507
2020-04-02 07:55:59 +00:00
|
|
|
void monitorEnableEdge(ElectricBorder border, bool enabled);
|
2020-03-05 09:45:46 +00:00
|
|
|
|
|
|
|
void monitorAddItem(const QString &item);
|
|
|
|
void monitorItemSetEnabled(int index, bool enabled);
|
|
|
|
|
|
|
|
QList<int> monitorCheckEffectHasEdge(int index) const;
|
|
|
|
int selectedEdgeItem(ElectricBorder border) const;
|
|
|
|
|
|
|
|
void monitorChangeEdge(ElectricBorder border, int index);
|
|
|
|
void monitorChangeEdge(const QList<int> &borderList, int index);
|
|
|
|
|
|
|
|
void monitorChangeDefaultEdge(ElectricBorder border, int index);
|
|
|
|
void monitorChangeDefaultEdge(const QList<int> &borderList, int index);
|
|
|
|
|
|
|
|
// revert to reference settings and assess for saveNeeded and default changed
|
2020-03-05 17:03:00 +00:00
|
|
|
virtual void reload();
|
2020-03-05 09:45:46 +00:00
|
|
|
// reset to default settings and assess for saveNeeded and default changed
|
2020-03-05 17:03:00 +00:00
|
|
|
virtual void setDefaults();
|
2020-03-05 09:45:46 +00:00
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void onChanged();
|
|
|
|
void createConnection();
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void saveNeededChanged(bool isNeeded);
|
|
|
|
void defaultChanged(bool isDefault);
|
|
|
|
|
|
|
|
private:
|
|
|
|
virtual Monitor *monitor() const = 0;
|
2020-03-05 17:03:00 +00:00
|
|
|
virtual bool isSaveNeeded() const;
|
|
|
|
virtual bool isDefault() const;
|
2020-03-05 09:45:46 +00:00
|
|
|
|
2020-04-22 16:32:30 +00:00
|
|
|
// internal use, return Monitor::None if border equals ELECTRIC_COUNT or ElectricNone
|
2020-03-05 09:45:46 +00:00
|
|
|
static int electricBorderToMonitorEdge(ElectricBorder border);
|
|
|
|
static ElectricBorder monitorEdgeToElectricBorder(int edge);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QHash<ElectricBorder, int> m_reference; // reference settings
|
|
|
|
QHash<ElectricBorder, int> m_default; // default settings
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|