Merge branch 'Plasma/5.19'
This commit is contained in:
commit
6caad6ee2f
7 changed files with 75 additions and 24 deletions
|
@ -11,6 +11,7 @@ set(kwinrules_SRCS
|
|||
../../rules.cpp
|
||||
../../placement.cpp
|
||||
../../utils.cpp
|
||||
../../virtualdesktopsdbustypes.cpp
|
||||
kwinsrc.cpp
|
||||
optionsmodel.cpp
|
||||
ruleitem.cpp
|
||||
|
|
|
@ -119,7 +119,7 @@ RuleItem::Type RuleItem::type() const
|
|||
|
||||
QVariant RuleItem::value() const
|
||||
{
|
||||
if (m_type == Option) {
|
||||
if (m_options && m_type == Option) {
|
||||
return m_options->value();
|
||||
}
|
||||
return m_value;
|
||||
|
@ -127,7 +127,7 @@ QVariant RuleItem::value() const
|
|||
|
||||
void RuleItem::setValue(QVariant value)
|
||||
{
|
||||
if (m_type == Option) {
|
||||
if (m_options && m_type == Option) {
|
||||
m_options->setValue(value);
|
||||
}
|
||||
m_value = typedValue(value, m_type);
|
||||
|
|
|
@ -45,6 +45,9 @@ RulesModel::RulesModel(QObject *parent)
|
|||
qmlRegisterUncreatableType<RulesModel>("org.kde.kcms.kwinrules", 1, 0, "RulesModel",
|
||||
QStringLiteral("Do not create objects of type RulesModel"));
|
||||
|
||||
qDBusRegisterMetaType<KWin::DBusDesktopDataStruct>();
|
||||
qDBusRegisterMetaType<KWin::DBusDesktopDataVector>();
|
||||
|
||||
populateRuleList();
|
||||
}
|
||||
|
||||
|
@ -421,6 +424,10 @@ void RulesModel::populateRuleList()
|
|||
QIcon::fromTheme("virtual-desktops")));
|
||||
desktop->setOptionsData(virtualDesktopsModelData());
|
||||
|
||||
connect(this, &RulesModel::virtualDesktopsUpdated,
|
||||
this, [this] { m_rules["desktop"]->setOptionsData(virtualDesktopsModelData()); });
|
||||
updateVirtualDesktops();
|
||||
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
m_activities = new KActivities::Consumer(this);
|
||||
|
||||
|
@ -700,10 +707,10 @@ QList<OptionsModel::Data> RulesModel::windowTypesModelData() const
|
|||
QList<OptionsModel::Data> RulesModel::virtualDesktopsModelData() const
|
||||
{
|
||||
QList<OptionsModel::Data> modelData;
|
||||
for (int desktopId = 1; desktopId <= KWindowSystem::numberOfDesktops(); ++desktopId) {
|
||||
for (const DBusDesktopDataStruct &desktop : m_virtualDesktops) {
|
||||
modelData << OptionsModel::Data{
|
||||
desktopId,
|
||||
QString::number(desktopId).rightJustified(2) + QStringLiteral(": ") + KWindowSystem::desktopName(desktopId),
|
||||
desktop.position + 1, // "desktop" setting uses the desktop position (int) starting at 1
|
||||
QString::number(desktop.position + 1).rightJustified(2) + QStringLiteral(": ") + desktop.name,
|
||||
QIcon::fromTheme("virtual-desktops")
|
||||
};
|
||||
}
|
||||
|
@ -740,18 +747,17 @@ QList<OptionsModel::Data> RulesModel::activitiesModelData() const
|
|||
|
||||
QList<OptionsModel::Data> RulesModel::placementModelData() const
|
||||
{
|
||||
// From "placement.h" : Placement rule is stored as a string, not the enum value
|
||||
static const auto modelData = QList<OptionsModel::Data> {
|
||||
{ Placement::policyToString(Placement::Default), i18n("Default") },
|
||||
{ Placement::policyToString(Placement::NoPlacement), i18n("No Placement") },
|
||||
{ Placement::policyToString(Placement::Smart), i18n("Minimal Overlapping") },
|
||||
{ Placement::policyToString(Placement::Maximizing), i18n("Maximized") },
|
||||
{ Placement::policyToString(Placement::Cascade), i18n("Cascaded") },
|
||||
{ Placement::policyToString(Placement::Centered), i18n("Centered") },
|
||||
{ Placement::policyToString(Placement::Random), i18n("Random") },
|
||||
{ Placement::policyToString(Placement::ZeroCornered), i18n("In Top-Left Corner") },
|
||||
{ Placement::policyToString(Placement::UnderMouse), i18n("Under Mouse") },
|
||||
{ Placement::policyToString(Placement::OnMainWindow), i18n("On Main Window") }
|
||||
{ Placement::Default, i18n("Default") },
|
||||
{ Placement::NoPlacement, i18n("No Placement") },
|
||||
{ Placement::Smart, i18n("Minimal Overlapping") },
|
||||
{ Placement::Maximizing, i18n("Maximized") },
|
||||
{ Placement::Cascade, i18n("Cascaded") },
|
||||
{ Placement::Centered, i18n("Centered") },
|
||||
{ Placement::Random, i18n("Random") },
|
||||
{ Placement::ZeroCornered, i18n("In Top-Left Corner") },
|
||||
{ Placement::UnderMouse, i18n("Under Mouse") },
|
||||
{ Placement::OnMainWindow, i18n("On Main Window") }
|
||||
};
|
||||
return modelData;
|
||||
}
|
||||
|
@ -816,4 +822,32 @@ void RulesModel::selectX11Window()
|
|||
);
|
||||
}
|
||||
|
||||
void RulesModel::updateVirtualDesktops()
|
||||
{
|
||||
QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KWin"),
|
||||
QStringLiteral("/VirtualDesktopManager"),
|
||||
QStringLiteral("org.freedesktop.DBus.Properties"),
|
||||
QStringLiteral("Get"));
|
||||
message.setArguments(QVariantList{
|
||||
QStringLiteral("org.kde.KWin.VirtualDesktopManager"),
|
||||
QStringLiteral("desktops")
|
||||
});
|
||||
|
||||
QDBusPendingReply<QVariant> async = QDBusConnection::sessionBus().asyncCall(message);
|
||||
|
||||
QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(async, this);
|
||||
connect(callWatcher, &QDBusPendingCallWatcher::finished, this,
|
||||
[this](QDBusPendingCallWatcher *self) {
|
||||
QDBusPendingReply<QVariant> reply = *self;
|
||||
self->deleteLater();
|
||||
if (!reply.isValid()) {
|
||||
return;
|
||||
}
|
||||
m_virtualDesktops = qdbus_cast<KWin::DBusDesktopDataVector>(reply.value());
|
||||
emit virtualDesktopsUpdated();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
} //namespace
|
||||
|
|
|
@ -22,8 +22,9 @@
|
|||
#define KWIN_RULES_MODEL_H
|
||||
|
||||
#include "ruleitem.h"
|
||||
#include "rulesettings.h"
|
||||
#include <rules.h>
|
||||
#include <rulesettings.h>
|
||||
#include <virtualdesktopsdbustypes.h>
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
@ -96,6 +97,8 @@ signals:
|
|||
void warningMessageChanged();
|
||||
void suggestionsChanged();
|
||||
|
||||
void virtualDesktopsUpdated();
|
||||
|
||||
private:
|
||||
void populateRuleList();
|
||||
bool wmclassWarning() const;
|
||||
|
@ -103,6 +106,7 @@ private:
|
|||
QString defaultDescription() const;
|
||||
|
||||
static const QHash<QString, QString> x11PropertyHash();
|
||||
void updateVirtualDesktops();
|
||||
|
||||
QList<OptionsModel::Data> windowTypesModelData() const;
|
||||
QList<OptionsModel::Data> virtualDesktopsModelData() const;
|
||||
|
@ -117,6 +121,7 @@ private slots:
|
|||
private:
|
||||
QList<RuleItem *> m_ruleList;
|
||||
QHash<QString, RuleItem *> m_rules;
|
||||
DBusDesktopDataVector m_virtualDesktops;
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
KActivities::Consumer *m_activities;
|
||||
#endif
|
||||
|
|
|
@ -132,6 +132,10 @@ public:
|
|||
|
||||
QString supportInformation() const override;
|
||||
|
||||
bool isCursorEnabled() const {
|
||||
return m_cursorEnabled;
|
||||
};
|
||||
|
||||
public Q_SLOTS:
|
||||
void turnOutputsOn();
|
||||
|
||||
|
|
|
@ -709,9 +709,12 @@ void DrmOutput::updateTransform(Transform transform)
|
|||
}
|
||||
m_modesetRequested = true;
|
||||
|
||||
// the cursor might need to get rotated
|
||||
updateCursor();
|
||||
showCursor();
|
||||
// show cursor only if is enabled, i.e if pointer device is presentP
|
||||
if (m_backend->isCursorEnabled()) {
|
||||
// the cursor might need to get rotated
|
||||
updateCursor();
|
||||
showCursor();
|
||||
}
|
||||
}
|
||||
|
||||
void DrmOutput::updateMode(int modeIndex)
|
||||
|
@ -867,9 +870,11 @@ bool DrmOutput::presentAtomically(DrmBuffer *buffer)
|
|||
m_primaryPlane->setTransformation(m_lastWorkingState.planeTransformations);
|
||||
}
|
||||
m_modesetRequested = true;
|
||||
// the cursor might need to get rotated
|
||||
updateCursor();
|
||||
showCursor();
|
||||
if (m_backend->isCursorEnabled()) {
|
||||
// the cursor might need to get rotated
|
||||
updateCursor();
|
||||
showCursor();
|
||||
}
|
||||
// TODO: forward to OutputInterface and OutputDeviceInterface
|
||||
setWaylandMode();
|
||||
emit screens()->changed();
|
||||
|
|
|
@ -1132,8 +1132,9 @@ void WindowPixmap::create()
|
|||
if (kwinApp()->shouldUseWaylandForCompositing()) {
|
||||
// use Buffer
|
||||
update();
|
||||
if (!isRoot() && isValid()) {
|
||||
if (isRoot() && isValid()) {
|
||||
m_window->unreferencePreviousPixmap();
|
||||
m_window->invalidateQuadsCache();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1164,6 +1165,7 @@ void WindowPixmap::create()
|
|||
m_pixmapSize = bufferGeometry.size();
|
||||
m_contentsRect = QRect(toplevel()->clientPos(), toplevel()->clientSize());
|
||||
m_window->unreferencePreviousPixmap();
|
||||
m_window->invalidateQuadsCache();
|
||||
}
|
||||
|
||||
void WindowPixmap::update()
|
||||
|
|
Loading…
Reference in a new issue