Drop window type rule

Practically all code assumes that the window type is static and fixing
it would bring extra complexity, which may not be worth given that there
are window rules to control position, focus, layer, etc.

BUG: 466016
wilder/Plasma/6.2
Vlad Zahorodnii 2 years ago
parent 5c4acbdddd
commit 176ae6e692
  1. 2
      src/inputpanelv1window.cpp
  2. 2
      src/inputpanelv1window.h
  3. 2
      src/internalwindow.cpp
  4. 2
      src/internalwindow.h
  5. 7
      src/kcms/rules/rulesmodel.cpp
  6. 2
      src/layershellv1window.cpp
  7. 2
      src/layershellv1window.h
  8. 12
      src/rules.cpp
  9. 4
      src/rules.h
  10. 11
      src/rulesettings.kcfg
  11. 2
      src/window.h
  12. 10
      src/x11window.cpp
  13. 2
      src/x11window.h
  14. 2
      src/xdgshellwindow.cpp
  15. 2
      src/xdgshellwindow.h

@ -171,7 +171,7 @@ void InputPanelV1Window::destroyWindow()
unref();
}
NET::WindowType InputPanelV1Window::windowType(bool direct) const
NET::WindowType InputPanelV1Window::windowType() const
{
return NET::Utility;
}

@ -70,7 +70,7 @@ public:
{
return true;
}
NET::WindowType windowType(bool direct = false) const override;
NET::WindowType windowType() const override;
QRectF frameRectToBufferRect(const QRectF &rect) const override;
Mode mode() const

@ -145,7 +145,7 @@ QSizeF InternalWindow::maxSize() const
return m_handle->maximumSize();
}
NET::WindowType InternalWindow::windowType(bool direct) const
NET::WindowType InternalWindow::windowType() const
{
return NET::Normal;
}

@ -36,7 +36,7 @@ public:
QString captionSuffix() const override;
QSizeF minSize() const override;
QSizeF maxSize() const override;
NET::WindowType windowType(bool direct = false) const override;
NET::WindowType windowType() const override;
void killWindow() override;
bool isClient() const override;
bool isPopupWindow() const override;

@ -704,12 +704,6 @@ void RulesModel::populateRuleList()
i18n("Closeable"), i18n("Appearance & Fixes"),
QIcon::fromTheme("dialog-close")));
auto type = addRule(new RuleItem(QLatin1String("type"),
RulePolicy::ForceRule, RuleItem::Option,
i18n("Set window type"), i18n("Appearance & Fixes"),
QIcon::fromTheme("window-duplicate")));
type->setOptionsData(windowTypesModelData());
addRule(new RuleItem(QLatin1String("desktopfile"),
RulePolicy::SetRule, RuleItem::String,
i18n("Desktop file name"), i18n("Appearance & Fixes"),
@ -744,7 +738,6 @@ const QHash<QString, QString> RulesModel::x11PropertyHash()
{"skipTaskbar", "skiptaskbar"},
{"skipPager", "skippager"},
{"skipSwitcher", "skipswitcher"},
{"type", "type"},
{"desktopFile", "desktopfile"},
{"desktops", "desktops"},
{"layer", "layer"},

@ -93,7 +93,7 @@ void LayerShellV1Window::scheduleRearrange()
m_integration->scheduleRearrange();
}
NET::WindowType LayerShellV1Window::windowType(bool) const
NET::WindowType LayerShellV1Window::windowType() const
{
return m_windowType;
}

@ -28,7 +28,7 @@ public:
LayerSurfaceV1Interface *shellSurface() const;
Output *desiredOutput() const;
NET::WindowType windowType(bool direct = false) const override;
NET::WindowType windowType() const override;
bool isPlaceable() const override;
bool isCloseable() const override;
bool isMovable() const override;

@ -51,7 +51,6 @@ Rules::Rules()
, desktopsrule(UnusedSetRule)
, screenrule(UnusedSetRule)
, activityrule(UnusedSetRule)
, typerule(UnusedForceRule)
, maximizevertrule(UnusedSetRule)
, maximizehorizrule(UnusedSetRule)
, minimizerule(UnusedSetRule)
@ -128,10 +127,6 @@ void Rules::readFromSettings(const RuleSettings *settings)
READ_SET_RULE(desktops);
READ_SET_RULE(screen);
READ_SET_RULE(activity);
READ_FORCE_RULE(type, static_cast<NET::WindowType>);
if (type == NET::Unknown) {
typerule = UnusedForceRule;
}
READ_SET_RULE(maximizevert);
READ_SET_RULE(maximizehoriz);
READ_SET_RULE(minimize);
@ -208,7 +203,6 @@ void Rules::write(RuleSettings *settings) const
WRITE_SET_RULE(desktops, Desktops, );
WRITE_SET_RULE(screen, Screen, );
WRITE_SET_RULE(activity, Activity, );
WRITE_FORCE_RULE(type, Type, );
WRITE_SET_RULE(maximizevert, Maximizevert, );
WRITE_SET_RULE(maximizehoriz, Maximizehoriz, );
WRITE_SET_RULE(minimize, Minimize, );
@ -261,7 +255,6 @@ bool Rules::isEmpty() const
&& desktopsrule == UnusedSetRule
&& screenrule == UnusedSetRule
&& activityrule == UnusedSetRule
&& typerule == UnusedForceRule
&& maximizevertrule == UnusedSetRule
&& maximizehorizrule == UnusedSetRule
&& minimizerule == UnusedSetRule
@ -399,7 +392,7 @@ bool Rules::matchClientMachine(const QString &match_machine, bool local) const
#ifndef KCMRULES
bool Rules::match(const Window *c) const
{
if (!matchType(c->windowType(true))) {
if (!matchType(c->windowType())) {
return false;
}
if (!matchWMClass(c->resourceClass(), c->resourceName())) {
@ -578,7 +571,6 @@ APPLY_RULE(ignoregeometry, IgnoreGeometry, bool)
APPLY_RULE(screen, Screen, int)
APPLY_RULE(activity, Activity, QStringList)
APPLY_FORCE_RULE(type, Type, NET::WindowType)
APPLY_FORCE_RULE(layer, Layer, enum Layer)
bool Rules::applyDesktops(QList<VirtualDesktop *> &vds, bool init) const
@ -678,7 +670,6 @@ bool Rules::discardUsed(bool withdrawn)
DISCARD_USED_SET_RULE(desktops);
DISCARD_USED_SET_RULE(screen);
DISCARD_USED_SET_RULE(activity);
DISCARD_USED_FORCE_RULE(type);
DISCARD_USED_SET_RULE(maximizevert);
DISCARD_USED_SET_RULE(maximizehoriz);
DISCARD_USED_SET_RULE(minimize);
@ -803,7 +794,6 @@ CHECK_RULE(IgnoreGeometry, bool)
CHECK_RULE(Desktops, QList<VirtualDesktop *>)
CHECK_RULE(Activity, QStringList)
CHECK_FORCE_RULE(Type, NET::WindowType)
CHECK_RULE(MaximizeVert, MaximizeMode)
CHECK_RULE(MaximizeHoriz, MaximizeMode)

@ -53,7 +53,6 @@ public:
QList<VirtualDesktop *> checkDesktops(QList<VirtualDesktop *> desktops, bool init = false) const;
Output *checkOutput(Output *output, bool init = false) const;
QStringList checkActivity(QStringList activity, bool init = false) const;
NET::WindowType checkType(NET::WindowType type) const;
MaximizeMode checkMaximize(MaximizeMode mode, bool init = false) const;
bool checkMinimize(bool minimized, bool init = false) const;
ShadeMode checkShade(ShadeMode shade, bool init = false) const;
@ -161,7 +160,6 @@ public:
bool applyDesktops(QList<VirtualDesktop *> &desktops, bool init) const;
bool applyScreen(int &desktop, bool init) const;
bool applyActivity(QStringList &activity, bool init) const;
bool applyType(NET::WindowType &type) const;
bool applyMaximizeVert(MaximizeMode &mode, bool init) const;
bool applyMaximizeHoriz(MaximizeMode &mode, bool init) const;
bool applyMinimize(bool &minimized, bool init) const;
@ -242,8 +240,6 @@ private:
SetRule screenrule;
QStringList activity;
SetRule activityrule;
NET::WindowType type; // type for setting
ForceRule typerule;
bool maximizevert;
SetRule maximizevertrule;
bool maximizehoriz;

@ -179,17 +179,6 @@
<default code="true">Rules::UnusedSetRule</default>
</entry>
<entry name="type" type="Int">
<label>Set window type to</label>
<min code="true">NET::Normal</min>
<max code="true">NET::CriticalNotification</max>
<default code="true">NET::Unknown</default>
</entry>
<entry name="typerule" type="Int">
<label>Set window type rule type</label>
<default code="true">Rules::UnusedForceRule</default>
</entry>
<entry name="maximizevert" type="Bool">
<label>Maximized vertically</label>
<default>false</default>

@ -693,7 +693,7 @@ public:
QRectF keepInArea(QRectF geometry, QRectF area, bool partial = false);
// prefer isXXX() instead
virtual NET::WindowType windowType(bool direct = false) const = 0;
virtual NET::WindowType windowType() const = 0;
bool hasNETSupport() const;
bool isDesktop() const;
bool isDock() const;

@ -2758,21 +2758,13 @@ bool X11Window::isOutline() const
return m_outline;
}
NET::WindowType X11Window::windowType(bool direct) const
NET::WindowType X11Window::windowType() const
{
if (m_unmanaged) {
return info->windowType(SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK);
}
NET::WindowType wt = info->windowType(SUPPORTED_MANAGED_WINDOW_TYPES_MASK);
if (direct) {
return wt;
}
NET::WindowType wt2 = rules()->checkType(wt);
if (wt != wt2) {
wt = wt2;
info->setWindowType(wt); // force hint change
}
// hacks here
if (wt == NET::Unknown) { // this is more or less suggested in NETWM spec
wt = isTransient() ? NET::Dialog : NET::Normal;

@ -131,7 +131,7 @@ public:
} // Inside of geometry()
bool windowEvent(xcb_generic_event_t *e);
NET::WindowType windowType(bool direct = false) const override;
NET::WindowType windowType() const override;
bool track(xcb_window_t w);
bool manage(xcb_window_t w, bool isMapped);

@ -88,7 +88,7 @@ XdgSurfaceWindow::~XdgSurfaceWindow()
{
}
NET::WindowType XdgSurfaceWindow::windowType(bool direct) const
NET::WindowType XdgSurfaceWindow::windowType() const
{
return m_windowType;
}

@ -56,7 +56,7 @@ public:
explicit XdgSurfaceWindow(XdgSurfaceInterface *shellSurface);
~XdgSurfaceWindow() override;
NET::WindowType windowType(bool direct = false) const override;
NET::WindowType windowType() const override;
QRectF frameRectToBufferRect(const QRectF &rect) const override;
void destroyWindow() override;

Loading…
Cancel
Save