Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull KWin patches (2024-01-10 - 2024-05-23) #25

Merged
merged 27 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c31e0f5
feat(input): remove the terminate server shortcut
romangg May 23, 2024
b772bf7
refactor: slight code cleanup
alex1701c Jan 10, 2024
0fe01b0
feat: drop "<N>" window caption suffix
zzag Jan 11, 2024
6d00df0
refactor: make NETRootInfo initialization reasonable
zzag Jan 30, 2024
14c07fb
fix: prevent including "show desktop" entry if there are no other win…
zzag Feb 6, 2024
26e375b
fix: discard return value
romangg May 30, 2024
628e951
test: add workaround for race condition
romangg May 30, 2024
277584a
feat: add a placeholder message in the thumbnails grid switcher
zzag Feb 6, 2024
424e549
fix: define decoration spacer button
romangg May 29, 2024
9026e93
build: reduce dependencies
romangg May 29, 2024
af3caec
feat: implement new overview layout algorithm
fanzhuyifan Jan 14, 2024
d2b39ef
fix: don't build SPI support if Qt wasn't build with it
aleixpol Feb 21, 2024
a5348ab
feat(plugin): provide a way to reserve a screen edge for grid mode
zzag Feb 26, 2024
eb1f12a
fix(plugin): search bar can be clicked without closing effect
OrkenWhite Feb 27, 2024
8b47439
feat: adds a border around hovered and selected desktop in desktopGrid
Akselmo Mar 1, 2024
196bed4
build: revamp CMakeLists.txt
zzag Feb 23, 2024
6bb35d9
fix: use correct enum value for `PointerDevice`
Naxdy Mar 4, 2024
a10342a
docs: fix License metadata
zzag Mar 4, 2024
91425cf
fix(plugin): fix autohidden panels blinking when plasmashell launches
zzag Mar 7, 2024
0d476aa
fix: do not take ownership of QuickEffect::delegate
davidedmundson Mar 18, 2024
2b3e7b5
fix(plugin): fix mainscript for declarative effects
zzag Mar 19, 2024
13048ce
fix: fix oversights on shortcut handling within Overview/Grid effect
veggero Mar 22, 2024
5df5385
feat: mark risky KNS content
Pointedstick Apr 1, 2024
3394617
refactor: round all the things consistently
Pointedstick Apr 7, 2024
c8cd868
feat(plugin): remove middle click to close virtual desktop
Pointedstick Apr 11, 2024
0e865d2
fix: clarify strings for inhibition
nclarius May 6, 2024
bb085c7
refactor: optimize saving discarded rules to config
ismailof May 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ ecm_setup_version(PROJECT
# required frameworks by Core
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
Auth
ColorScheme
Config
ConfigWidgets
CoreAddons
Crash
GlobalAccel
Expand Down
2 changes: 1 addition & 1 deletion como-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ find_dependency(wlroots @WLROOTS_MIN_VERSION@)
find_dependency(Qt6Gui @QT_MIN_VERSION@)
find_dependency(KF6 @KF6_MIN_VERSION@ COMPONENTS
Auth
ColorScheme
Config
ConfigWidgets
CoreAddons
GlobalAccel
I18n
Expand Down
1 change: 0 additions & 1 deletion como/input/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ target_sources(input
filters/popup.h
filters/screen_edge.h
filters/tabbox.h
filters/terminate_server.h
filters/virtual_terminal.h
filters/window_action.h
filters/window_selector.h
Expand Down
2 changes: 1 addition & 1 deletion como/input/event_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace como::input
template<typename Filters, typename UnaryPredicate>
void process_filters(Filters const& filters, UnaryPredicate function)
{
std::any_of(filters.cbegin(), filters.cend(), function);
static_cast<void>(std::any_of(filters.cbegin(), filters.cend(), function));
}

/**
Expand Down
39 changes: 0 additions & 39 deletions como/input/filters/terminate_server.h

This file was deleted.

4 changes: 0 additions & 4 deletions como/input/wayland/redirect.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <como/input/filters/move_resize.h>
#include <como/input/filters/popup.h>
#include <como/input/filters/screen_edge.h>
#include <como/input/filters/terminate_server.h>
#include <como/input/filters/virtual_terminal.h>
#include <como/input/filters/window_action.h>
#include <como/input/filters/window_selector.h>
Expand Down Expand Up @@ -357,9 +356,6 @@ class redirect

m_spies.push_back(new activity_spy(*this));
m_spies.push_back(new touch_hide_cursor_spy(*this));
if (has_global_shortcuts) {
m_filters.emplace_back(new terminate_server_filter<type>(*this));
}
m_filters.emplace_back(new drag_and_drop_filter<type>(*this));
m_filters.emplace_back(new lock_screen_filter<type>(*this));
m_filters.emplace_back(new popup_filter<type>(*this));
Expand Down
11 changes: 6 additions & 5 deletions como/render/effect/interface/quick_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
return effect->d.get();
}

std::unique_ptr<QQmlComponent> delegate;
QPointer<QQmlComponent> delegate;
QUrl source;
std::map<EffectScreen const*, std::unique_ptr<QQmlContext>> contexts;
std::map<EffectScreen const*, std::unique_ptr<QQmlIncubator>> incubators;
Expand Down Expand Up @@ -270,7 +270,7 @@
}
if (d->source != url) {
d->source = url;
d->delegate.reset();
d->delegate.clear();

Check warning on line 273 in como/render/effect/interface/quick_scene.cpp

View check run for this annotation

Codecov / codecov/patch

como/render/effect/interface/quick_scene.cpp#L273

Added line #L273 was not covered by tests
}
}

Expand All @@ -287,7 +287,7 @@
}
if (d->delegate.get() != delegate) {
d->source = QUrl();
d->delegate.reset(delegate);
d->delegate = delegate;

Check warning on line 290 in como/render/effect/interface/quick_scene.cpp

View check run for this annotation

Codecov / codecov/patch

como/render/effect/interface/quick_scene.cpp#L290

Added line #L290 was not covered by tests
Q_EMIT delegateChanged();
}
}
Expand Down Expand Up @@ -516,11 +516,12 @@
return;
}

d->delegate = std::make_unique<QQmlComponent>(effects->qmlEngine());
d->delegate = new QQmlComponent(effects->qmlEngine(), this);
d->delegate->loadUrl(d->source);

if (d->delegate->isError()) {
qWarning().nospace() << "Failed to load " << d->source << ": " << d->delegate->errors();
d->delegate.reset();
d->delegate.clear();

Check warning on line 524 in como/render/effect/interface/quick_scene.cpp

View check run for this annotation

Codecov / codecov/patch

como/render/effect/interface/quick_scene.cpp#L524

Added line #L524 was not covered by tests
return;
}
Q_EMIT delegateChanged();
Expand Down
5 changes: 3 additions & 2 deletions como/render/post/night_color_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ inline void night_color_display_inhibit_message(bool inhibit, bool show_day_stat
: show_day_status ? QStringLiteral("redshift-status-day")
: QStringLiteral("redshift-status-on");

auto const text = inhibit ? i18nc("Night Light was disabled", "Night Light Off")
: i18nc("Night Light was enabled", "Night Light On");
auto const text = inhibit
? i18nc("Night Light was temporarily disabled", "Night Light Suspended")
: i18nc("Night Light was reenabled from temporary suspension", "Night Light Resumed");

auto message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.plasmashell"),
QStringLiteral("/org/kde/osdService"),
Expand Down
3 changes: 2 additions & 1 deletion como/render/post/night_color_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ void init_night_color_shortcuts(Input& input, NightColor& manager)
auto toggleAction = new QAction(manager.qobject.get());
toggleAction->setProperty("componentName", "kwin");
toggleAction->setObjectName(QStringLiteral("Toggle Night Color"));
toggleAction->setText(i18n("Toggle Night Light"));
toggleAction->setText(
i18nc("Temporarily disable/reenable Night Light", "Suspend/Resume Night Light"));

input.shortcuts->register_keyboard_default_shortcut(toggleAction, {});
input.shortcuts->register_keyboard_shortcut(toggleAction, {});
Expand Down
4 changes: 2 additions & 2 deletions como/render/qml/frames/plasma/frame_unstyled.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as QQC2

import org.kde.kirigami 2.12 as Kirigami
import org.kde.kirigami as Kirigami

Rectangle {
id: root
Expand All @@ -20,7 +20,7 @@ Rectangle {
implicitHeight: layout.implicitHeight + 2 * layout.anchors.margins

color: Qt.rgba(0, 0, 0, effectFrame.frameOpacity)
radius: layout.anchors.margins
radius: Kirigami.Units.cornerRadius

RowLayout {
id: layout
Expand Down
4 changes: 3 additions & 1 deletion como/win/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ target_link_libraries(win
PUBLIC
KDecoration2::KDecoration
KDecoration2::KDecoration2Private
KF6::ConfigWidgets
KF6::ColorScheme
KF6::ConfigCore
KF6::ConfigGui
KF6::CoreAddons
KF6::I18n
KF6::Package
Expand Down
2 changes: 1 addition & 1 deletion como/win/deco/bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class bridge : public KDecoration2::DecorationBridge
if (!m_theme.isEmpty()) {
args.insert(QStringLiteral("theme"), m_theme);
}
auto deco = m_factory->create<KDecoration2::Decoration>(window, QVariantList({args}));
auto deco = m_factory->create<KDecoration2::Decoration>(window, QVariantList{args});
deco->setSettings(m_settings);
deco->init();
return deco;
Expand Down
1 change: 1 addition & 0 deletions como/win/deco/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class settings : public QObject, public KDecoration2::DecorationSettingsPrivate
s_buttonNames[KDecoration2::DecorationButtonType::KeepAbove] = QChar('F');
s_buttonNames[KDecoration2::DecorationButtonType::KeepBelow] = QChar('B');
s_buttonNames[KDecoration2::DecorationButtonType::Shade] = QChar('L');
s_buttonNames[KDecoration2::DecorationButtonType::Spacer] = QChar('_');
}

QString buttonsToString(QVector<KDecoration2::DecorationButtonType> const& buttons) const
Expand Down
33 changes: 0 additions & 33 deletions como/win/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,39 +91,6 @@ bool is_special_window(Win const* win)
|| is_notification(win) || is_critical_notification(win) || is_on_screen_display(win);
}

/**
* Looks for another window with same captionNormal and captionSuffix.
* If no such window exists @c nullptr is returned.
*/
template<typename Win>
std::optional<typename Win::space_t::window_t> find_client_with_same_caption(Win const* win)
{
for (auto candidate : win->space.windows) {
if (std::visit(overload{[&](auto&& candidate) {
if constexpr (std::is_same_v<std::decay_t<decltype(candidate)>, Win*>) {
if (candidate == win) {
return false;
}
}
if (!candidate->control) {
return false;
}
if (is_special_window(candidate) && !is_toolbar(candidate)) {
return false;
}
if (candidate->meta.caption.normal != win->meta.caption.normal
|| candidate->meta.caption.suffix != win->meta.caption.suffix) {
return false;
}
return true;
}},
candidate)) {
return candidate;
}
}
return {};
}

template<typename Win>
void set_wm_class(Win& win, QByteArray const& res_name, QByteArray const& res_class)
{
Expand Down
24 changes: 7 additions & 17 deletions como/win/rules/book.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <como/base/logging.h>
#include <como/win/control.h>

#include "book_settings.h"
#include "rules_settings.h"

#include <KConfig>
Expand Down Expand Up @@ -46,34 +45,25 @@ void book::load()
{
deleteAll();

if (!config) {
config = KSharedConfig::openConfig(QStringLiteral("kwinrulesrc"), KConfig::NoGlobals);
if (!settings) {
settings = std::make_unique<book_settings>();
} else {
config->reparseConfiguration();
settings->sharedConfig()->reparseConfiguration();
}

book_settings book(config);
book.load();
m_rules = book.rules();
settings->load();
m_rules = settings->rules();
}

void book::save()
{
m_updateTimer->stop();

if (!config) {
if (!settings) {
qCWarning(KWIN_CORE) << "book::save invoked without prior invocation of book::load";
return;
}

std::vector<ruling*> filteredRules;
for (const auto& rule : std::as_const(m_rules)) {
filteredRules.push_back(rule);
}

book_settings settings(config);
settings.setRules(filteredRules);
settings.save();
settings->save();
}

void book::requestDiskStorage()
Expand Down
6 changes: 4 additions & 2 deletions como/win/rules/book.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
*/
#pragma once

#include "window.h"
#include <como/win/rules/book_settings.h>
#include <como/win/rules/window.h>

#include <QTimer>
#include <deque>

namespace como::win::rules
{

class book_settings;
class ruling;

class COMO_EXPORT book_qobject : public QObject
Expand All @@ -38,7 +40,7 @@ class COMO_EXPORT book
void requestDiskStorage();

std::unique_ptr<book_qobject> qobject;
KSharedConfig::Ptr config;
std::unique_ptr<book_settings> settings;
std::deque<ruling*> m_rules;

private:
Expand Down
14 changes: 10 additions & 4 deletions como/win/rules/book_edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,31 @@ namespace como::win::rules
template<typename Book, typename RefWin>
void discard_used_rules(Book& book, RefWin& ref_win, bool withdrawn)
{
auto updated = false;

for (auto it = book.m_rules.begin(); it != book.m_rules.end();) {
if (ref_win.control->rules.contains(*it)) {
auto const index = book.settings->indexForId((*it)->id);

if ((*it)->discardUsed(withdrawn)) {
updated = true;
if (index) {
auto settings = book.settings->ruleSettingsAt(index.value());
(*it)->write(settings);
}
}
if ((*it)->isEmpty()) {
ref_win.control->remove_rule(*it);
auto r = *it;
it = book.m_rules.erase(it);
delete r;
if (index) {
book.settings->removeRuleSettingsAt(index.value());
}
continue;
}
}
++it;
}

if (updated) {
if (book.settings->usrIsSaveNeeded()) {
book.requestDiskStorage();
}
}
Expand Down
Loading