From 5babf52df454cf312ea5ff65b745d1fa24ddf84d Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Fri, 21 Feb 2020 23:31:39 +0100 Subject: [PATCH] [kcm/effects] Clip ListView Summary: Otherwise the content overflows the frame when scrolling. QQC2 scrollview docs say "ScrollView does not automatically clip its contents. If it is not used as a full-screen item, you should consider setting the clip property to true" Test Plan: Before: {F8121150} After: {F8121152} Reviewers: #kwin, #plasma, ngraham Reviewed By: ngraham Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D27558 --- CMakeLists.txt | 53 ++-- HACKING.md | 3 + abstract_client.cpp | 197 +++++++++---- abstract_client.h | 60 ++-- autotests/CMakeLists.txt | 2 +- autotests/integration/activation_test.cpp | 24 +- .../effects/maximize_animation_test.cpp | 12 +- autotests/integration/maximize_test.cpp | 28 +- .../integration/move_resize_window_test.cpp | 44 ++- autotests/integration/plasma_surface_test.cpp | 6 +- autotests/integration/quick_tiling_test.cpp | 37 ++- autotests/integration/struts_test.cpp | 6 +- autotests/integration/transient_placement.cpp | 29 +- .../integration/xdgshellclient_rules_test.cpp | 44 +-- autotests/integration/xdgshellclient_test.cpp | 90 +++--- autotests/tabbox/CMakeLists.txt | 2 +- colorcorrection/manager.h | 2 +- decorations/decoratedclient.cpp | 2 +- doc/coding-conventions.md | 86 ++++++ effects.cpp | 10 + effects.h | 1 + effects/CMakeLists.txt | 2 +- effects/Messages.sh | 2 +- effects/desktopgrid/desktopgrid.cpp | 175 +++-------- effects/desktopgrid/desktopgrid.h | 29 +- effects/desktopgrid/main.qml | 40 +-- effects/invert/invert_config.cpp | 2 +- effects/login/package/metadata.desktop | 1 + effects/logout/package/metadata.desktop | 1 + effects/lookingglass/lookingglass_config.cpp | 2 +- effects/magiclamp/magiclamp_config.desktop | 1 + effects/magnifier/magnifier_config.cpp | 2 +- .../package/contents/code/maximize.js | 2 +- effects/maximize/package/metadata.desktop | 1 + .../package/contents/code/morphingpopups.js | 11 +- effects/mouseclick/mouseclick_config.desktop | 1 + effects/presentwindows/presentwindows.cpp | 4 +- effects/presentwindows/presentwindows.h | 2 +- .../presentwindows_config.desktop | 1 + effects/resize/resize_config.desktop | 1 + effects/showpaint/showpaint_config.cpp | 2 +- effects/slide/slide_config.desktop | 2 +- effects/snaphelper/snaphelper.cpp | 4 +- effects/snaphelper/snaphelper.h | 2 +- effects/thumbnailaside/thumbnailaside.cpp | 4 +- effects/thumbnailaside/thumbnailaside.h | 2 +- .../windowaperture/package/metadata.desktop | 1 + .../windowgeometry/windowgeometry_config.cpp | 2 +- .../wobblywindows_config.desktop | 1 + effects/zoom/zoom_config.desktop | 1 + events.cpp | 2 +- input.cpp | 14 +- internal_client.cpp | 66 +---- internal_client.h | 11 - kcmkwin/common/CMakeLists.txt | 4 +- kcmkwin/kwincompositing/CMakeLists.txt | 2 +- .../kwincompositing/kwincompositing.desktop | 2 +- kcmkwin/kwindecoration/Messages.sh | 2 - .../kcm_kwin_virtualdesktops.desktop | 1 + kcmkwin/kwindesktop/package/metadata.desktop | 1 + kcmkwin/kwineffects/kcm_kwin_effects.desktop | 2 +- .../kwineffects/package/contents/ui/main.qml | 2 + kcmkwin/kwinoptions/CMakeLists.txt | 6 +- kcmkwin/kwinoptions/advanced.ui | 14 +- kcmkwin/kwinoptions/kwinoptions_settings.kcfg | 62 ++++ .../kwinoptions/kwinoptions_settings.kcfgc | 6 + kcmkwin/kwinoptions/main.cpp | 26 +- kcmkwin/kwinoptions/moving.ui | 20 +- kcmkwin/kwinoptions/windows.cpp | 243 ++-------------- kcmkwin/kwinoptions/windows.h | 43 +-- kcmkwin/kwinrules/CMakeLists.txt | 9 +- kcmkwin/kwinrules/main.cpp | 3 +- kcmkwin/kwinscreenedges/CMakeLists.txt | 4 +- .../kwinscreenedges/kwintouchscreen.desktop | 1 + kcmkwin/kwintabbox/CMakeLists.txt | 7 +- kcmkwin/kwintabbox/kwinpluginssettings.kcfg | 18 ++ kcmkwin/kwintabbox/kwinpluginssettings.kcfgc | 7 + .../kwintabbox/kwinswitcheffectsettings.kcfg | 17 ++ .../kwintabbox/kwinswitcheffectsettings.kcfgc | 6 + kcmkwin/kwintabbox/kwintabboxsettings.kcfg | 41 +++ kcmkwin/kwintabbox/kwintabboxsettings.kcfgc | 7 + kcmkwin/kwintabbox/main.cpp | 275 ++++++++---------- kcmkwin/kwintabbox/main.h | 20 +- layers.cpp | 14 +- libkwineffects/kwineffectquickview.cpp | 5 +- libkwineffects/kwineffects.h | 7 + main_x11.cpp | 3 +- placement.cpp | 14 +- .../themes/plastik/package/metadata.desktop | 1 + plugins/platforms/drm/drm.json | 1 + plugins/platforms/fbdev/fbdev.json | 1 + plugins/platforms/virtual/virtual.json | 1 + plugins/platforms/wayland/wayland.json | 1 + plugins/scenes/qpainter/scene_qpainter.cpp | 15 +- plugins/windowsystem/CMakeLists.txt | 1 + plugins/windowsystem/plugin.cpp | 13 +- plugins/windowsystem/plugin.h | 2 + plugins/windowsystem/windowshadow.cpp | 95 ++++++ plugins/windowsystem/windowshadow.h | 42 +++ pointer_input.cpp | 33 ++- shadow.cpp | 80 ++++- shadow.h | 3 + tests/CMakeLists.txt | 14 +- toplevel.cpp | 9 +- toplevel.h | 15 +- touch_input.cpp | 2 +- unmanaged.cpp | 1 - virtualkeyboard.cpp | 4 + x11client.cpp | 143 +++++---- x11client.h | 18 +- xdgshellclient.cpp | 122 ++++---- xdgshellclient.h | 3 - 112 files changed, 1443 insertions(+), 1203 deletions(-) create mode 100644 doc/coding-conventions.md mode change 100755 => 100644 kcmkwin/kwindecoration/Messages.sh create mode 100644 kcmkwin/kwinoptions/kwinoptions_settings.kcfg create mode 100644 kcmkwin/kwinoptions/kwinoptions_settings.kcfgc create mode 100644 kcmkwin/kwintabbox/kwinpluginssettings.kcfg create mode 100644 kcmkwin/kwintabbox/kwinpluginssettings.kcfgc create mode 100644 kcmkwin/kwintabbox/kwinswitcheffectsettings.kcfg create mode 100644 kcmkwin/kwintabbox/kwinswitcheffectsettings.kcfgc create mode 100644 kcmkwin/kwintabbox/kwintabboxsettings.kcfg create mode 100644 kcmkwin/kwintabbox/kwintabboxsettings.kcfgc create mode 100644 plugins/windowsystem/windowshadow.cpp create mode 100644 plugins/windowsystem/windowshadow.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a5f62234fb..41fb0fbf99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) -project(KWIN) -set(PROJECT_VERSION "5.18.1") +project(KWin) +set(PROJECT_VERSION "5.18.80") set(PROJECT_VERSION_MAJOR 5) set(QT_MIN_VERSION "5.12.0") @@ -70,7 +70,6 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n IconThemes IdleTime - Init Notifications Package Plasma @@ -312,7 +311,6 @@ cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kacti set(KWIN_NAME "kwin") set(KWIN_INTERNAL_NAME_X11 "kwin_x11") set(KWIN_INTERNAL_NAME_WAYLAND "kwin_wayland") -set(KWIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available: may be disabled if (KWIN_BUILD_XRENDER_COMPOSITING) @@ -392,7 +390,7 @@ add_subdirectory(helpers) ########### next target ############### -set(kwin_KDEINIT_SRCS +set(kwin_SRCS abstract_client.cpp abstract_opengl_context_attribute_builder.cpp abstract_output.cpp @@ -504,14 +502,14 @@ set(kwin_KDEINIT_SRCS ) if (CMAKE_SYSTEM_NAME MATCHES "Linux") - set(kwin_KDEINIT_SRCS - ${kwin_KDEINIT_SRCS} + set(kwin_SRCS + ${kwin_SRCS} colorcorrection/clockskewnotifierengine_linux.cpp ) endif() include(ECMQtDeclareLoggingCategory) -ecm_qt_declare_logging_category(kwin_KDEINIT_SRCS +ecm_qt_declare_logging_category(kwin_SRCS HEADER colorcorrect_logging.h IDENTIFIER @@ -524,7 +522,7 @@ ecm_qt_declare_logging_category(kwin_KDEINIT_SRCS if (KWIN_BUILD_TABBOX) include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS}) - set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} + set(kwin_SRCS ${kwin_SRCS} tabbox/clientmodel.cpp tabbox/desktopchain.cpp tabbox/desktopmodel.cpp @@ -538,33 +536,33 @@ if (KWIN_BUILD_TABBOX) endif() if (KWIN_BUILD_ACTIVITIES) - set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} + set(kwin_SRCS ${kwin_SRCS} activities.cpp ) endif() if (HAVE_LINUX_VT_H) - set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} + set(kwin_SRCS ${kwin_SRCS} virtual_terminal.cpp ) endif() -kconfig_add_kcfg_files(kwin_KDEINIT_SRCS settings.kcfgc) -kconfig_add_kcfg_files(kwin_KDEINIT_SRCS colorcorrection/colorcorrect_settings.kcfgc) +kconfig_add_kcfg_files(kwin_SRCS settings.kcfgc) +kconfig_add_kcfg_files(kwin_SRCS colorcorrection/colorcorrect_settings.kcfgc) -qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface) -qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.kwin.Compositing.xml dbusinterface.h KWin::CompositorDBusInterface) -qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.kwin.ColorCorrect.xml colorcorrection/colorcorrectdbusinterface.h KWin::ColorCorrect::ColorCorrectDBusInterface) -qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS ${kwin_effects_dbus_xml} effects.h KWin::EffectsHandlerImpl) -qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.kwin.OrientationSensor.xml orientation_sensor.h KWin::OrientationSensor) -qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.KWin.VirtualDesktopManager.xml dbusinterface.h KWin::VirtualDesktopManagerDBusInterface) -qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.KWin.Session.xml sm.h KWin::SessionManager) +qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface) +qt5_add_dbus_adaptor(kwin_SRCS org.kde.kwin.Compositing.xml dbusinterface.h KWin::CompositorDBusInterface) +qt5_add_dbus_adaptor(kwin_SRCS org.kde.kwin.ColorCorrect.xml colorcorrection/colorcorrectdbusinterface.h KWin::ColorCorrect::ColorCorrectDBusInterface) +qt5_add_dbus_adaptor(kwin_SRCS ${kwin_effects_dbus_xml} effects.h KWin::EffectsHandlerImpl) +qt5_add_dbus_adaptor(kwin_SRCS org.kde.kwin.OrientationSensor.xml orientation_sensor.h KWin::OrientationSensor) +qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.VirtualDesktopManager.xml dbusinterface.h KWin::VirtualDesktopManagerDBusInterface) +qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.Session.xml sm.h KWin::SessionManager) -qt5_add_dbus_interface(kwin_KDEINIT_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf5_org.freedesktop.ScreenSaver.xml screenlocker_interface) -qt5_add_dbus_interface(kwin_KDEINIT_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_interface) -qt5_add_dbus_interface(kwin_KDEINIT_SRCS org.kde.kappmenu.xml appmenu_interface) +qt5_add_dbus_interface(kwin_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf5_org.freedesktop.ScreenSaver.xml screenlocker_interface) +qt5_add_dbus_interface(kwin_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_interface) +qt5_add_dbus_interface(kwin_SRCS org.kde.kappmenu.xml appmenu_interface) -ki18n_wrap_ui(kwin_KDEINIT_SRCS +ki18n_wrap_ui(kwin_SRCS debug_console.ui shortcutdialog.ui ) @@ -647,7 +645,7 @@ set(kwinLibs Libinput::Libinput ) -add_library(kwin SHARED ${kwin_KDEINIT_SRCS}) +add_library(kwin SHARED ${kwin_SRCS}) set_target_properties(kwin PROPERTIES VERSION ${PROJECT_VERSION} @@ -659,11 +657,10 @@ generate_export_header(kwin EXPORT_FILE_NAME kwin_export.h) target_link_libraries(kwin kwinglutils ${epoxy_LIBRARY}) -kf5_add_kdeinit_executable(kwin_x11 main_x11.cpp) -target_link_libraries(kdeinit_kwin_x11 kwin KF5::Crash Qt5::X11Extras) +add_executable(kwin_x11 main_x11.cpp) +target_link_libraries(kwin_x11 kwin KF5::Crash Qt5::X11Extras) install(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) -install(TARGETS kdeinit_kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS}) set(kwin_XWAYLAND_SRCS diff --git a/HACKING.md b/HACKING.md index 749c9b506a..4aace2c7d8 100644 --- a/HACKING.md +++ b/HACKING.md @@ -91,5 +91,8 @@ KWin uses [KDE's phabricator instance](https://phabricator.kde.org) for code rev More complete documentation can be found in [KDE's wiki](https://community.kde.org/Infrastructure/Phabricator). Please add "#KWin" as reviewers. Please run KWin's automated test suite prior to uploading a patch to ensure that the change does not break existing code. +# Coding conventions +KWin's coding conventions are explained in document [coding-conventions.md](doc/coding-conventions.md). + # Coding style KWin code follows the [Frameworks coding style](https://techbase.kde.org/Policies/Frameworks_Coding_Style). diff --git a/abstract_client.cpp b/abstract_client.cpp index ca6c422e61..c2c865a476 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -64,10 +64,6 @@ AbstractClient::AbstractClient() #endif , m_colorScheme(QStringLiteral("kdeglobals")) { - connect(this, &AbstractClient::geometryShapeChanged, this, &AbstractClient::geometryChanged); - auto signalMaximizeChanged = static_cast(&AbstractClient::clientMaximizedStateChanged); - connect(this, signalMaximizeChanged, this, &AbstractClient::geometryChanged); - connect(this, &AbstractClient::clientStepUserMovedResized, this, &AbstractClient::geometryChanged); connect(this, &AbstractClient::clientStartUserMovedResized, this, &AbstractClient::moveResizedChanged); connect(this, &AbstractClient::clientFinishUserMovedResized, this, &AbstractClient::moveResizedChanged); connect(this, &AbstractClient::clientStartUserMovedResized, this, &AbstractClient::removeCheckScreenConnection); @@ -89,7 +85,7 @@ AbstractClient::AbstractClient() }); // replace on-screen-display on size changes - connect(this, &AbstractClient::geometryShapeChanged, this, + connect(this, &AbstractClient::frameGeometryChanged, this, [this] (Toplevel *c, const QRect &old) { Q_UNUSED(c) if (isOnScreenDisplay() && !frameGeometry().isEmpty() && old.size() != frameGeometry().size() && !isInitialPositionSet()) { @@ -135,11 +131,6 @@ void AbstractClient::setClientShown(bool shown) Q_UNUSED(shown) } -MaximizeMode AbstractClient::requestedMaximizeMode() const -{ - return maximizeMode(); -} - xcb_timestamp_t AbstractClient::userTime() const { return XCB_TIME_CURRENT_TIME; @@ -326,19 +317,13 @@ void AbstractClient::setKeepAbove(bool b) if (b && !rules()->checkKeepBelow(false)) setKeepBelow(false); if (b == keepAbove()) { - // force hint change if different - if (info && bool(info->state() & NET::KeepAbove) != keepAbove()) - info->setState(keepAbove() ? NET::KeepAbove : NET::States(), NET::KeepAbove); return; } m_keepAbove = b; - if (info) { - info->setState(keepAbove() ? NET::KeepAbove : NET::States(), NET::KeepAbove); - } + doSetKeepAbove(); workspace()->updateClientLayer(this); updateWindowRules(Rules::Above); - doSetKeepAbove(); emit keepAboveChanged(m_keepAbove); } @@ -352,19 +337,13 @@ void AbstractClient::setKeepBelow(bool b) if (b && !rules()->checkKeepAbove(false)) setKeepAbove(false); if (b == keepBelow()) { - // force hint change if different - if (info && bool(info->state() & NET::KeepBelow) != keepBelow()) - info->setState(keepBelow() ? NET::KeepBelow : NET::States(), NET::KeepBelow); return; } m_keepBelow = b; - if (info) { - info->setState(keepBelow() ? NET::KeepBelow : NET::States(), NET::KeepBelow); - } + doSetKeepBelow(); workspace()->updateClientLayer(this); updateWindowRules(Rules::Below); - doSetKeepBelow(); emit keepBelowChanged(m_keepBelow); } @@ -411,13 +390,15 @@ void AbstractClient::demandAttention(bool set) if (m_demandsAttention == set) return; m_demandsAttention = set; - if (info) { - info->setState(set ? NET::DemandsAttention : NET::States(), NET::DemandsAttention); - } + doSetDemandsAttention(); workspace()->clientAttentionChanged(this, set); emit demandsAttentionChanged(); } +void AbstractClient::doSetDemandsAttention() +{ +} + void AbstractClient::setDesktop(int desktop) { const int numberOfDesktops = VirtualDesktopManager::self()->count(); @@ -489,7 +470,7 @@ void AbstractClient::setDesktops(QVector desktops) c2->setDesktops(desktops); } - doSetDesktop(desktop(), was_desk); + doSetDesktop(); FocusChain::self()->update(this, FocusChain::MakeFirst); updateWindowRules(Rules::Desktop); @@ -500,10 +481,8 @@ void AbstractClient::setDesktops(QVector desktops) emit x11DesktopIdsChanged(); } -void AbstractClient::doSetDesktop(int desktop, int was_desk) +void AbstractClient::doSetDesktop() { - Q_UNUSED(desktop) - Q_UNUSED(was_desk) } void AbstractClient::enterDesktop(VirtualDesktop *virtualDesktop) @@ -619,11 +598,7 @@ void AbstractClient::minimize(bool avoid_animation) if (!isMinimizable() || isMinimized()) return; - if (isShade() && info) // NETWM restriction - KWindowInfo::isMinimized() == Hidden && !Shaded - info->setState(NET::States(), NET::Shaded); - m_minimized = true; - doMinimize(); updateWindowRules(Rules::Minimize); @@ -643,11 +618,7 @@ void AbstractClient::unminimize(bool avoid_animation) return; } - if (isShade() && info) // NETWM restriction - KWindowInfo::isMinimized() == Hidden && !Shaded - info->setState(NET::Shaded, NET::Shaded); - m_minimized = false; - doMinimize(); updateWindowRules(Rules::Minimize); @@ -822,9 +793,9 @@ void AbstractClient::move(int x, int y, ForceGeometry_t force) screens()->setCurrent(this); workspace()->updateStackingOrder(); // client itself is not damaged + emit frameGeometryChanged(this, frameGeometryBeforeUpdateBlocking()); addRepaintDuringGeometryUpdates(); updateGeometryBeforeUpdateBlocking(); - emit geometryChanged(); } bool AbstractClient::startMoveResize() @@ -1081,8 +1052,8 @@ void AbstractClient::handleMoveResize(int x, int y, int x_root, int y_root) bool update = false; if (isResize()) { QRect orig = initialMoveResizeGeometry(); - Sizemode sizemode = SizemodeAny; - auto calculateMoveResizeGeom = [this, &topleft, &bottomright, &orig, &sizemode, &mode]() { + SizeMode sizeMode = SizeModeAny; + auto calculateMoveResizeGeom = [this, &topleft, &bottomright, &orig, &sizeMode, &mode]() { switch(mode) { case PositionTopLeft: setMoveResizeGeometry(QRect(topleft, orig.bottomRight())); @@ -1098,19 +1069,19 @@ void AbstractClient::handleMoveResize(int x, int y, int x_root, int y_root) break; case PositionTop: setMoveResizeGeometry(QRect(QPoint(orig.left(), topleft.y()), orig.bottomRight())); - sizemode = SizemodeFixedH; // try not to affect height + sizeMode = SizeModeFixedH; // try not to affect height break; case PositionBottom: setMoveResizeGeometry(QRect(orig.topLeft(), QPoint(orig.right(), bottomright.y()))); - sizemode = SizemodeFixedH; + sizeMode = SizeModeFixedH; break; case PositionLeft: setMoveResizeGeometry(QRect(QPoint(topleft.x(), orig.top()), orig.bottomRight())); - sizemode = SizemodeFixedW; + sizeMode = SizeModeFixedW; break; case PositionRight: setMoveResizeGeometry(QRect(orig.topLeft(), QPoint(bottomright.x(), orig.bottom()))); - sizemode = SizemodeFixedW; + sizeMode = SizeModeFixedW; break; case PositionCenter: default: @@ -1211,7 +1182,7 @@ void AbstractClient::handleMoveResize(int x, int y, int x_root, int y_root) } // Always obey size hints, even when in "unrestricted" mode - QSize size = adjustedSize(moveResizeGeometry().size(), sizemode); + QSize size = adjustedSize(moveResizeGeometry().size(), sizeMode); // the new topleft and bottomright corners (after checking size constrains), if they'll be needed topleft = QPoint(moveResizeGeometry().right() - size.width() + 1, moveResizeGeometry().bottom() - size.height() + 1); bottomright = QPoint(moveResizeGeometry().left() + size.width() - 1, moveResizeGeometry().top() + size.height() - 1); @@ -1220,9 +1191,9 @@ void AbstractClient::handleMoveResize(int x, int y, int x_root, int y_root) // if aspect ratios are specified, both dimensions may change. // Therefore grow to the right/bottom if needed. // TODO it should probably obey gravity rather than always using right/bottom ? - if (sizemode == SizemodeFixedH) + if (sizeMode == SizeModeFixedH) orig.setRight(bottomright.x()); - else if (sizemode == SizemodeFixedW) + else if (sizeMode == SizeModeFixedW) orig.setBottom(bottomright.y()); calculateMoveResizeGeom(); @@ -1238,7 +1209,7 @@ void AbstractClient::handleMoveResize(int x, int y, int x_root, int y_root) setMoveResizeGeometry(workspace()->clientArea(FullScreenArea, screen, 0)); else { QRect moveResizeGeom = workspace()->clientArea(MaximizeArea, screen, 0); - QSize adjSize = adjustedSize(moveResizeGeom.size(), SizemodeMax); + QSize adjSize = adjustedSize(moveResizeGeom.size(), SizeModeMax); if (adjSize != moveResizeGeom.size()) { QRect r(moveResizeGeom); moveResizeGeom.setSize(adjSize); @@ -1342,8 +1313,6 @@ void AbstractClient::performMoveResize() setFrameGeometry(moveResizeGeom); } doPerformMoveResize(); - if (isResize()) - addRepaintFull(); positionGeometryTip(); emit clientStepUserMovedResized(this, moveResizeGeom); } @@ -1433,7 +1402,7 @@ void AbstractClient::setupWindowManagementInterface() w->setParentWindow(transientFor() ? transientFor()->windowManagementInterface() : nullptr); } ); - connect(this, &AbstractClient::geometryChanged, w, + connect(this, &AbstractClient::frameGeometryChanged, w, [w, this] { w->setGeometry(frameGeometry()); } @@ -1882,7 +1851,7 @@ BORDER(Right) BORDER(Top) #undef BORDER -QSize AbstractClient::sizeForClientSize(const QSize &wsize, Sizemode mode, bool noframe) const +QSize AbstractClient::sizeForClientSize(const QSize &wsize, SizeMode mode, bool noframe) const { Q_UNUSED(mode) Q_UNUSED(noframe) @@ -3126,7 +3095,7 @@ void AbstractClient::checkOffscreenPosition(QRect* geom, const QRect& screenArea } } -QSize AbstractClient::adjustedSize(const QSize& frame, Sizemode mode) const +QSize AbstractClient::adjustedSize(const QSize& frame, SizeMode mode) const { // first, get the window size for the given frame size s QSize wsize = frameSizeToClientSize(frame); @@ -3143,4 +3112,122 @@ QSize AbstractClient::adjustedSize() const return sizeForClientSize(clientSize()); } +/** + * Returns @c true if the AbstractClient can be shown in full screen mode; otherwise @c false. + * + * Default implementation returns @c false. + */ +bool AbstractClient::isFullScreenable() const +{ + return false; +} + +/** + * Returns @c true if the AbstractClient is currently being shown in full screen mode; otherwise @c false. + * + * A client in full screen mode occupies the entire screen with no window frame around it. + * + * Default implementation returns @c false. + */ +bool AbstractClient::isFullScreen() const +{ + return false; +} + +/** + * Returns whether requests initiated by the user to enter or leave full screen mode are honored. + * + * Default implementation returns @c false. + */ +bool AbstractClient::userCanSetFullScreen() const +{ + return false; +} + +/** + * Asks the AbstractClient to enter or leave full screen mode. + * + * Default implementation does nothing. + * + * @param set @c true if the AbstractClient has to be shown in full screen mode, otherwise @c false + * @param user @c true if the request is initiated by the user, otherwise @c false + */ +void AbstractClient::setFullScreen(bool set, bool user) +{ + Q_UNUSED(set) + Q_UNUSED(user) +} + +/** + * Returns @c true if the AbstractClient can be minimized; otherwise @c false. + * + * Default implementation returns @c false. + */ +bool AbstractClient::isMinimizable() const +{ + return false; +} + +/** + * Returns @c true if the AbstractClient can be maximized; otherwise @c false. + * + * Default implementation returns @c false. + */ +bool AbstractClient::isMaximizable() const +{ + return false; +} + +/** + * Returns the currently applied maximize mode. + * + * Default implementation returns MaximizeRestore. + */ +MaximizeMode AbstractClient::maximizeMode() const +{ + return MaximizeRestore; +} + +/** + * Returns the last requested maximize mode. + * + * On X11, this method always matches maximizeMode(). On Wayland, it is asynchronous. + * + * Default implementation matches maximizeMode(). + */ +MaximizeMode AbstractClient::requestedMaximizeMode() const +{ + return maximizeMode(); +} + +/** + * Returns the geometry of the AbstractClient before it was maximized or quick tiled. + */ +QRect AbstractClient::geometryRestore() const +{ + return m_maximizeGeometryRestore; +} + +/** + * Sets the geometry of the AbstractClient before it was maximized or quick tiled to @p rect. + */ +void AbstractClient::setGeometryRestore(const QRect &rect) +{ + m_maximizeGeometryRestore = rect; +} + +/** + * Toggles the maximized state along specified dimensions @p horizontal and @p vertical. + * + * If @p adjust is @c true, only frame geometry will be updated to match requestedMaximizeMode(). + * + * Default implementation does nothing. + */ +void AbstractClient::changeMaximize(bool horizontal, bool vertical, bool adjust) +{ + Q_UNUSED(horizontal) + Q_UNUSED(vertical) + Q_UNUSED(adjust) +} + } diff --git a/abstract_client.h b/abstract_client.h index bcacd8dc7e..93ad3dc19d 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -220,8 +220,8 @@ class KWIN_EXPORT AbstractClient : public Toplevel Q_PROPERTY(bool modal READ isModal NOTIFY modalChanged) /** - * The geometry of this Client. Be aware that depending on resize mode the geometryChanged signal - * might be emitted at each resize step or only at the end of the resize operation. + * The geometry of this Client. Be aware that depending on resize mode the frameGeometryChanged + * signal might be emitted at each resize step or only at the end of the resize operation. */ Q_PROPERTY(QRect geometry READ frameGeometry WRITE setFrameGeometry) @@ -416,8 +416,8 @@ public: virtual bool isHiddenInternal() const = 0; // TODO: remove boolean trap virtual void hideClient(bool hide) = 0; - virtual bool isFullScreenable() const = 0; - virtual bool isFullScreen() const = 0; + virtual bool isFullScreenable() const; + virtual bool isFullScreen() const; // TODO: remove boolean trap virtual AbstractClient *findModal(bool allow_itself = false) = 0; virtual bool isTransient() const; @@ -484,20 +484,12 @@ public: bool isMinimized() const { return m_minimized; } - virtual void setFullScreen(bool set, bool user = true) = 0; + virtual void setFullScreen(bool set, bool user = true); virtual void setClientShown(bool shown); - virtual QRect geometryRestore() const = 0; - /** - * The currently applied maximize mode - */ - virtual MaximizeMode maximizeMode() const = 0; - /** - * The maximise mode requested by the server. - * For X this always matches maximizeMode, for wayland clients it - * is asynchronous - */ + QRect geometryRestore() const; + virtual MaximizeMode maximizeMode() const; virtual MaximizeMode requestedMaximizeMode() const; void maximize(MaximizeMode); /** @@ -540,13 +532,10 @@ public: * Whether the Client can be shaded. Default implementation returns @c false. */ virtual bool isShadeable() const; - /** - * Returns whether the window is maximizable or not. - */ - virtual bool isMaximizable() const = 0; - virtual bool isMinimizable() const = 0; + virtual bool isMaximizable() const; + virtual bool isMinimizable() const; virtual QRect iconGeometry() const; - virtual bool userCanSetFullScreen() const = 0; + virtual bool userCanSetFullScreen() const; virtual bool userCanSetNoBorder() const = 0; virtual void checkNoBorder(); virtual void setOnActivities(QStringList newActivitiesList); @@ -634,12 +623,15 @@ public: virtual QSize maxSize() const; virtual void setFrameGeometry(int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet) = 0; void setFrameGeometry(const QRect &rect, ForceGeometry_t force = NormalGeometrySet); - /// How to resize the window in order to obey constains (mainly aspect ratios) - enum Sizemode { - SizemodeAny, - SizemodeFixedW, ///< Try not to affect width - SizemodeFixedH, ///< Try not to affect height - SizemodeMax ///< Try not to make it larger in either direction + + /** + * How to resize the window in order to obey constraints (mainly aspect ratios). + */ + enum SizeMode { + SizeModeAny, + SizeModeFixedW, ///< Try not to affect width + SizeModeFixedH, ///< Try not to affect height + SizeModeMax ///< Try not to make it larger in either direction }; /** * Calculates the appropriate frame size for the given client size @p wsize. @@ -648,12 +640,12 @@ public: * * Default implementation returns the passed in @p wsize. */ - virtual QSize sizeForClientSize(const QSize &wsize, Sizemode mode = SizemodeAny, bool noframe = false) const; + virtual QSize sizeForClientSize(const QSize &wsize, SizeMode mode = SizeModeAny, bool noframe = false) const; /** * Adjust the frame size @p frame according to the window's size hints. */ - QSize adjustedSize(const QSize&, Sizemode mode = SizemodeAny) const; + QSize adjustedSize(const QSize&, SizeMode mode = SizeModeAny) const; QSize adjustedSize() const; /** @@ -965,10 +957,8 @@ protected: * is emitted. * * Default implementation does nothing. - * @param desktop The new desktop the Client is on - * @param was_desk The desktop the Client was on before */ - virtual void doSetDesktop(int desktop, int was_desk); + virtual void doSetDesktop(); /** * Called from @ref minimize and @ref unminimize once the minimized value got updated, but before the * changed signal is emitted. @@ -981,6 +971,7 @@ protected: virtual void doSetSkipTaskbar(); virtual void doSetSkipPager(); virtual void doSetSkipSwitcher(); + virtual void doSetDemandsAttention(); void setupWindowManagementInterface(); void destroyWindowManagementInterface(); @@ -1025,8 +1016,8 @@ protected: int borderRight() const; int borderTop() const; int borderBottom() const; - virtual void changeMaximize(bool horizontal, bool vertical, bool adjust) = 0; - virtual void setGeometryRestore(const QRect &geo) = 0; + virtual void changeMaximize(bool horizontal, bool vertical, bool adjust); + void setGeometryRestore(const QRect &rect); /** * Called from move after updating the geometry. Can be reimplemented to perform specific tasks. @@ -1267,6 +1258,7 @@ private: QRect m_frameGeometryBeforeUpdateBlocking; QRect m_virtualKeyboardGeometry; QRect m_keyboardGeometryRestore; + QRect m_maximizeGeometryRestore; struct { bool enabled = false; diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index bfb0f78940..5ce2807040 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -164,7 +164,7 @@ ecm_mark_as_test(testBuiltInEffectLoader) ######################################################## # Test ScriptedEffectLoader ######################################################## -include_directories(${KWIN_SOURCE_DIR}) +include_directories(${KWin_SOURCE_DIR}) set(testScriptedEffectLoader_SRCS ../effectloader.cpp ../orientation_sensor.cpp diff --git a/autotests/integration/activation_test.cpp b/autotests/integration/activation_test.cpp index e0e74c238c..fc93140360 100644 --- a/autotests/integration/activation_test.cpp +++ b/autotests/integration/activation_test.cpp @@ -381,11 +381,11 @@ void ActivationTest::testSwitchToWindowMaximized() QVERIFY(configureRequestedSpy1.wait()); workspace()->slotWindowMaximize(); QVERIFY(configureRequestedSpy1.wait()); - QSignalSpy geometryChangedSpy1(client1, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy1.isValid()); + QSignalSpy frameGeometryChangedSpy1(client1, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy1.isValid()); shellSurface1->ackConfigure(configureRequestedSpy1.last().at(2).value()); Test::render(surface1.data(), configureRequestedSpy1.last().at(0).toSize(), Qt::red); - QVERIFY(geometryChangedSpy1.wait()); + QVERIFY(frameGeometryChangedSpy1.wait()); QScopedPointer surface2(Test::createSurface()); QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); @@ -396,11 +396,11 @@ void ActivationTest::testSwitchToWindowMaximized() QVERIFY(configureRequestedSpy2.wait()); workspace()->slotWindowMaximize(); QVERIFY(configureRequestedSpy2.wait()); - QSignalSpy geometryChangedSpy2(client2, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy2.isValid()); + QSignalSpy frameGeometryChangedSpy2(client2, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy2.isValid()); shellSurface2->ackConfigure(configureRequestedSpy2.last().at(2).value()); Test::render(surface2.data(), configureRequestedSpy2.last().at(0).toSize(), Qt::red); - QVERIFY(geometryChangedSpy2.wait()); + QVERIFY(frameGeometryChangedSpy2.wait()); const QList stackingOrder = workspace()->stackingOrder(); QVERIFY(stackingOrder.indexOf(client1) < stackingOrder.indexOf(client2)); @@ -466,11 +466,11 @@ void ActivationTest::testSwitchToWindowFullScreen() QVERIFY(configureRequestedSpy1.wait()); workspace()->slotWindowFullScreen(); QVERIFY(configureRequestedSpy1.wait()); - QSignalSpy geometryChangedSpy1(client1, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy1.isValid()); + QSignalSpy frameGeometryChangedSpy1(client1, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy1.isValid()); shellSurface1->ackConfigure(configureRequestedSpy1.last().at(2).value()); Test::render(surface1.data(), configureRequestedSpy1.last().at(0).toSize(), Qt::red); - QVERIFY(geometryChangedSpy1.wait()); + QVERIFY(frameGeometryChangedSpy1.wait()); QScopedPointer surface2(Test::createSurface()); QScopedPointer shellSurface2(Test::createXdgShellStableSurface(surface2.data())); @@ -481,11 +481,11 @@ void ActivationTest::testSwitchToWindowFullScreen() QVERIFY(configureRequestedSpy2.wait()); workspace()->slotWindowFullScreen(); QVERIFY(configureRequestedSpy2.wait()); - QSignalSpy geometryChangedSpy2(client2, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy2.isValid()); + QSignalSpy frameGeometryChangedSpy2(client2, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy2.isValid()); shellSurface2->ackConfigure(configureRequestedSpy2.last().at(2).value()); Test::render(surface2.data(), configureRequestedSpy2.last().at(0).toSize(), Qt::red); - QVERIFY(geometryChangedSpy2.wait()); + QVERIFY(frameGeometryChangedSpy2.wait()); const QList stackingOrder = workspace()->stackingOrder(); QVERIFY(stackingOrder.indexOf(client1) < stackingOrder.indexOf(client2)); diff --git a/autotests/integration/effects/maximize_animation_test.cpp b/autotests/integration/effects/maximize_animation_test.cpp index bccb41198d..5d0f75607f 100644 --- a/autotests/integration/effects/maximize_animation_test.cpp +++ b/autotests/integration/effects/maximize_animation_test.cpp @@ -157,8 +157,8 @@ void MaximizeAnimationTest::testMaximizeRestore() QVERIFY(!effect->isActive()); // Maximize the client. - QSignalSpy geometryChangedSpy(client, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QSignalSpy maximizeChangedSpy(client, qOverload(&XdgShellClient::clientMaximizedStateChanged)); QVERIFY(maximizeChangedSpy.isValid()); @@ -173,8 +173,8 @@ void MaximizeAnimationTest::testMaximizeRestore() // Draw contents of the maximized client. shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(1280, 1024), Qt::red); - QVERIFY(geometryChangedSpy.wait()); - QCOMPARE(geometryChangedSpy.count(), 2); + QVERIFY(frameGeometryChangedSpy.wait()); + QCOMPARE(frameGeometryChangedSpy.count(), 1); QCOMPARE(maximizeChangedSpy.count(), 1); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); QVERIFY(effect->isActive()); @@ -194,8 +194,8 @@ void MaximizeAnimationTest::testMaximizeRestore() // Draw contents of the restored client. shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(100, 50), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); - QCOMPARE(geometryChangedSpy.count(), 4); + QVERIFY(frameGeometryChangedSpy.wait()); + QCOMPARE(frameGeometryChangedSpy.count(), 2); QCOMPARE(maximizeChangedSpy.count(), 2); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); QVERIFY(effect->isActive()); diff --git a/autotests/integration/maximize_test.cpp b/autotests/integration/maximize_test.cpp index 1dd1ab22e4..4f3a164877 100644 --- a/autotests/integration/maximize_test.cpp +++ b/autotests/integration/maximize_test.cpp @@ -133,8 +133,8 @@ void TestMaximized::testMaximizedPassedToDeco() QVERIFY(bordersChangedSpy.isValid()); QSignalSpy maximizedChangedSpy(decoration->client().data(), &KDecoration2::DecoratedClient::maximizedChanged); QVERIFY(maximizedChangedSpy.isValid()); - QSignalSpy geometryShapeChangedSpy(client, &AbstractClient::geometryShapeChanged); - QVERIFY(geometryShapeChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); workspace()->slotWindowMaximize(); QVERIFY(configureRequestedSpy.wait()); @@ -142,10 +142,10 @@ void TestMaximized::testMaximizedPassedToDeco() QCOMPARE(configureRequestedSpy.last().at(0).toSize(), QSize(1280, 1024 - decoration->borderTop())); shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), configureRequestedSpy.last().at(0).toSize(), Qt::red); - QVERIFY(geometryShapeChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); // If no borders, there is only the initial geometry shape change, but none through border resizing. - QCOMPARE(geometryShapeChangedSpy.count(), hasBorders ? 2 : 1); + QCOMPARE(frameGeometryChangedSpy.count(), hasBorders ? 2 : 1); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); QCOMPARE(maximizedChangedSpy.count(), 1); QCOMPARE(maximizedChangedSpy.last().first().toBool(), true); @@ -163,8 +163,8 @@ void TestMaximized::testMaximizedPassedToDeco() shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(100, 50), Qt::red); - QVERIFY(geometryShapeChangedSpy.wait()); - QCOMPARE(geometryShapeChangedSpy.count(), hasBorders ? 4 : 2); + QVERIFY(frameGeometryChangedSpy.wait()); + QCOMPARE(frameGeometryChangedSpy.count(), hasBorders ? 4 : 2); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); QCOMPARE(maximizedChangedSpy.count(), 2); QCOMPARE(maximizedChangedSpy.last().first().toBool(), false); @@ -273,11 +273,11 @@ void TestMaximized::testBorderlessMaximizedWindow() QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(1280, 1024), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->frameGeometry(), QRect(0, 0, 1280, 1024)); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); @@ -294,7 +294,7 @@ void TestMaximized::testBorderlessMaximizedWindow() shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(100, 50), Qt::red); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->frameGeometry(), maximizeRestoreGeometry); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); @@ -326,8 +326,8 @@ void TestMaximized::testBorderlessMaximizedWindowNoClientSideDecoration() auto client = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); - QSignalSpy geometryChangedSpy(client, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QSignalSpy sizeChangeRequestedSpy(xdgShellSurface.data(), &XdgShellSurface::sizeChanged); QVERIFY(sizeChangeRequestedSpy.isValid()); QSignalSpy configureRequestedSpy(xdgShellSurface.data(), &XdgShellSurface::configureRequested); @@ -348,7 +348,7 @@ void TestMaximized::testBorderlessMaximizedWindowNoClientSideDecoration() xdgShellSurface->ackConfigure(it[2].toInt()); } Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); // no deco QVERIFY(!client->isDecorated()); @@ -365,7 +365,7 @@ void TestMaximized::testBorderlessMaximizedWindowNoClientSideDecoration() xdgShellSurface->ackConfigure(it[2].toInt()); } Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QVERIFY(client->isDecorated()); QVERIFY(!client->noBorder()); diff --git a/autotests/integration/move_resize_window_test.cpp b/autotests/integration/move_resize_window_test.cpp index b36deed8e9..f7ef81f54e 100644 --- a/autotests/integration/move_resize_window_test.cpp +++ b/autotests/integration/move_resize_window_test.cpp @@ -138,8 +138,6 @@ void MoveResizeWindowTest::testMove() QVERIFY(c); QCOMPARE(workspace()->activeClient(), c); QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50)); - QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); QSignalSpy startMoveResizedSpy(c, &AbstractClient::clientStartUserMovedResized); QVERIFY(startMoveResizedSpy.isValid()); QSignalSpy moveResizedChangedSpy(c, &AbstractClient::moveResizedChanged); @@ -243,8 +241,8 @@ void MoveResizeWindowTest::testResize() QVERIFY(c); QCOMPARE(workspace()->activeClient(), c); QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50)); - QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QSignalSpy startMoveResizedSpy(c, &AbstractClient::clientStartUserMovedResized); QVERIFY(startMoveResizedSpy.isValid()); QSignalSpy moveResizedChangedSpy(c, &AbstractClient::moveResizedChanged); @@ -289,7 +287,7 @@ void MoveResizeWindowTest::testResize() // Now render new size. shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(108, 50), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(c->frameGeometry(), QRect(0, 0, 108, 50)); QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); @@ -310,7 +308,7 @@ void MoveResizeWindowTest::testResize() // Now render new size. shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(108, 58), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(c->frameGeometry(), QRect(0, 0, 108, 58)); QCOMPARE(clientStepUserMovedResizedSpy.count(), 2); @@ -487,10 +485,10 @@ void MoveResizeWindowTest::testGrowShrink() QVERIFY(sizeChangeSpy.wait()); Test::render(surface.data(), shellSurface->size(), Qt::red); - QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); m_connection->flush(); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QTEST(c->frameGeometry(), "expectedGeometry"); } @@ -920,8 +918,8 @@ void MoveResizeWindowTest::testResizeForVirtualKeyboard() QVERIFY(configureRequestedSpy.wait()); client->move(100, 300); - QSignalSpy geometryChangedSpy(client, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QCOMPARE(client->frameGeometry(), QRect(100, 300, 500, 800)); client->setVirtualKeyboardGeometry(QRect(0, 100, 1280, 500)); @@ -930,7 +928,7 @@ void MoveResizeWindowTest::testResizeForVirtualKeyboard() shellSurface->ackConfigure(configureRequestedSpy.last()[2].toInt()); // render at the new size Test::render(surface.data(), configureRequestedSpy.last().first().toSize(), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->frameGeometry(), QRect(100, 0, 500, 101)); client->setVirtualKeyboardGeometry(QRect()); @@ -939,7 +937,7 @@ void MoveResizeWindowTest::testResizeForVirtualKeyboard() shellSurface->ackConfigure(configureRequestedSpy.last()[2].toInt()); // render at the new size Test::render(surface.data(), configureRequestedSpy.last().first().toSize(), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->frameGeometry(), QRect(100, 300, 500, 800)); } @@ -963,8 +961,8 @@ void MoveResizeWindowTest::testResizeForVirtualKeyboardWithMaximize() QVERIFY(configureRequestedSpy.wait()); client->move(100, 300); - QSignalSpy geometryChangedSpy(client, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QCOMPARE(client->frameGeometry(), QRect(100, 300, 500, 800)); client->setVirtualKeyboardGeometry(QRect(0, 100, 1280, 500)); @@ -973,14 +971,14 @@ void MoveResizeWindowTest::testResizeForVirtualKeyboardWithMaximize() shellSurface->ackConfigure(configureRequestedSpy.last()[2].toInt()); // render at the new size Test::render(surface.data(), configureRequestedSpy.last().first().toSize(), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->frameGeometry(), QRect(100, 0, 500, 101)); client->setMaximize(true, true); QVERIFY(configureRequestedSpy.wait()); shellSurface->ackConfigure(configureRequestedSpy.last()[2].toInt()); Test::render(surface.data(), configureRequestedSpy.last().first().toSize(), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->frameGeometry(), QRect(0, 0, 1280, 1024)); client->setVirtualKeyboardGeometry(QRect()); @@ -988,7 +986,7 @@ void MoveResizeWindowTest::testResizeForVirtualKeyboardWithMaximize() // render at the size of the configureRequested.. it won't have changed Test::render(surface.data(), configureRequestedSpy.last().first().toSize(), Qt::blue); - QVERIFY(!geometryChangedSpy.wait(10)); + QVERIFY(!frameGeometryChangedSpy.wait(10)); // Size will NOT be restored QCOMPARE(client->frameGeometry(), QRect(0, 0, 1280, 1024)); @@ -1014,8 +1012,8 @@ void MoveResizeWindowTest::testResizeForVirtualKeyboardWithFullScreen() QVERIFY(configureRequestedSpy.wait()); client->move(100, 300); - QSignalSpy geometryChangedSpy(client, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QCOMPARE(client->frameGeometry(), QRect(100, 300, 500, 800)); client->setVirtualKeyboardGeometry(QRect(0, 100, 1280, 500)); @@ -1024,14 +1022,14 @@ void MoveResizeWindowTest::testResizeForVirtualKeyboardWithFullScreen() shellSurface->ackConfigure(configureRequestedSpy.last()[2].toInt()); // render at the new size Test::render(surface.data(), configureRequestedSpy.last().first().toSize(), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->frameGeometry(), QRect(100, 0, 500, 101)); client->setFullScreen(true, true); QVERIFY(configureRequestedSpy.wait()); shellSurface->ackConfigure(configureRequestedSpy.last()[2].toInt()); Test::render(surface.data(), configureRequestedSpy.last().first().toSize(), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->frameGeometry(), QRect(0, 0, 1280, 1024)); client->setVirtualKeyboardGeometry(QRect()); @@ -1039,7 +1037,7 @@ void MoveResizeWindowTest::testResizeForVirtualKeyboardWithFullScreen() // render at the size of the configureRequested.. it won't have changed Test::render(surface.data(), configureRequestedSpy.last().first().toSize(), Qt::blue); - QVERIFY(!geometryChangedSpy.wait(10)); + QVERIFY(!frameGeometryChangedSpy.wait(10)); // Size will NOT be restored QCOMPARE(client->frameGeometry(), QRect(0, 0, 1280, 1024)); } diff --git a/autotests/integration/plasma_surface_test.cpp b/autotests/integration/plasma_surface_test.cpp index faf2e905ea..60aef48fcd 100644 --- a/autotests/integration/plasma_surface_test.cpp +++ b/autotests/integration/plasma_surface_test.cpp @@ -241,10 +241,10 @@ void PlasmaSurfaceTest::testOSDPlacement() QCOMPARE(c->frameGeometry(), QRect(590, 649, 100, 50)); // change size of window - QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryShapeChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); Test::render(surface.data(), QSize(200, 100), Qt::red); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(c->frameGeometry(), QRect(540, 616, 200, 100)); } diff --git a/autotests/integration/quick_tiling_test.cpp b/autotests/integration/quick_tiling_test.cpp index 15016c570f..7bbc0c7ee4 100644 --- a/autotests/integration/quick_tiling_test.cpp +++ b/autotests/integration/quick_tiling_test.cpp @@ -180,8 +180,8 @@ void QuickTilingTest::testQuickTiling() QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); QVERIFY(quickTileChangedSpy.isValid()); - QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QFETCH(QuickTileMode, mode); QFETCH(QRect, expectedGeometry); @@ -202,9 +202,8 @@ void QuickTilingTest::testQuickTiling() shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), expectedGeometry.size(), Qt::red); - QVERIFY(geometryChangedSpy.wait()); - QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); - QCOMPARE(geometryChangedSpy.count(), 1); + QVERIFY(frameGeometryChangedSpy.wait()); + QCOMPARE(frameGeometryChangedSpy.count(), 1); QCOMPARE(c->frameGeometry(), expectedGeometry); // send window to other screen @@ -257,8 +256,8 @@ void QuickTilingTest::testQuickMaximizing() QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); QVERIFY(quickTileChangedSpy.isValid()); - QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QSignalSpy maximizeChangedSpy1(c, qOverload(&AbstractClient::clientMaximizedStateChanged)); QVERIFY(maximizeChangedSpy1.isValid()); QSignalSpy maximizeChangedSpy2(c, qOverload(&AbstractClient::clientMaximizedStateChanged)); @@ -283,8 +282,8 @@ void QuickTilingTest::testQuickMaximizing() shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(1280, 1024), Qt::red); - QVERIFY(geometryChangedSpy.wait()); - QCOMPARE(geometryChangedSpy.count(), 2); + QVERIFY(frameGeometryChangedSpy.wait()); + QCOMPARE(frameGeometryChangedSpy.count(), 1); QCOMPARE(c->frameGeometry(), QRect(0, 0, 1280, 1024)); QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); @@ -316,8 +315,8 @@ void QuickTilingTest::testQuickMaximizing() shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(100, 50), Qt::yellow); - QVERIFY(geometryChangedSpy.wait()); - QCOMPARE(geometryChangedSpy.count(), 4); + QVERIFY(frameGeometryChangedSpy.wait()); + QCOMPARE(frameGeometryChangedSpy.count(), 2); QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50)); QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); QCOMPARE(maximizeChangedSpy1.count(), 2); @@ -782,14 +781,14 @@ void QuickTilingTest::testShortcut() QCOMPARE(configureRequestedSpy.last().at(0).toSize(), expectedGeometry.size()); // attach a new image - QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), expectedGeometry.size(), Qt::red); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); - QCOMPARE(geometryChangedSpy.count(), 1); + QCOMPARE(frameGeometryChangedSpy.count(), 1); QCOMPARE(c->frameGeometry(), expectedGeometry); } @@ -837,8 +836,8 @@ void QuickTilingTest::testScript() QSignalSpy quickTileChangedSpy(c, &AbstractClient::quickTileModeChanged); QVERIFY(quickTileChangedSpy.isValid()); - QSignalSpy geometryChangedSpy(c, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(c, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QVERIFY(Scripting::self()); QTemporaryFile tmpFile; @@ -881,9 +880,9 @@ void QuickTilingTest::testScript() shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), expectedGeometry.size(), Qt::red); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QEXPECT_FAIL("maximize", "Geometry changed called twice for maximize", Continue); - QCOMPARE(geometryChangedSpy.count(), 1); + QCOMPARE(frameGeometryChangedSpy.count(), 1); QCOMPARE(c->frameGeometry(), expectedGeometry); } diff --git a/autotests/integration/struts_test.cpp b/autotests/integration/struts_test.cpp index a1b887ff97..8a2a7d9903 100644 --- a/autotests/integration/struts_test.cpp +++ b/autotests/integration/struts_test.cpp @@ -246,10 +246,10 @@ void StrutsTest::testMoveWaylandPanel() QCOMPARE(workspace()->clientArea(MaximizeArea, 1, 1), QRect(1280, 0, 1280, 1024)); QCOMPARE(workspace()->clientArea(WorkArea, 0, 1), QRect(0, 0, 2560, 1000)); - QSignalSpy geometryChangedSpy(c, &XdgShellClient::geometryShapeChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(c, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); plasmaSurface->setPosition(QPoint(1280, 1000)); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(c->frameGeometry(), QRect(1280, 1000, 1280, 24)); QCOMPARE(workspace()->clientArea(PlacementArea, 0, 1), QRect(0, 0, 1280, 1024)); QCOMPARE(workspace()->clientArea(MaximizeArea, 0, 1), QRect(0, 0, 1280, 1024)); diff --git a/autotests/integration/transient_placement.cpp b/autotests/integration/transient_placement.cpp index a0aa9417d5..368395714b 100644 --- a/autotests/integration/transient_placement.cpp +++ b/autotests/integration/transient_placement.cpp @@ -209,6 +209,27 @@ void TransientPlacementTest::testXdgPopup_data() positioner.setGravity(Qt::TopEdge); positioner.setInitialSize(QSize(300, 200)); QTest::newRow("constraintFlipRightNoGravity") << QSize(500, 500) << QPoint(700, 80) << positioner << QRect(700 + 50 - 150, 130, 300, 200); + + // ---------------------------------------------------------------- + // resize + positioner.setConstraints(XdgPositioner::Constraint::ResizeX | XdgPositioner::Constraint::ResizeY); + positioner.setInitialSize(QSize(200, 200)); + + positioner.setAnchorEdge(Qt::TopEdge); + positioner.setGravity(Qt::TopEdge); + QTest::newRow("resizeTop") << QSize(500, 500) << QPoint(80, 80) << positioner << QRect(80 + 250 - 100, 0, 200, 130); + + positioner.setAnchorEdge(Qt::LeftEdge); + positioner.setGravity(Qt::LeftEdge); + QTest::newRow("resizeLeft") << QSize(500, 500) << QPoint(80, 80) << positioner << QRect(0, 80 + 250 - 100, 130, 200); + + positioner.setAnchorEdge(Qt::RightEdge); + positioner.setGravity(Qt::RightEdge); + QTest::newRow("resizeRight") << QSize(500, 500) << QPoint(700, 80) << positioner << QRect(700 + 50 + 400, 80 + 250 - 100, 130, 200); + + positioner.setAnchorEdge(Qt::BottomEdge); + positioner.setGravity(Qt::BottomEdge); + QTest::newRow("resizeBottom") << QSize(500, 500) << QPoint(80, 500) << positioner << QRect(80 + 250 - 100, 500 + 50 + 400, 200, 74); } void TransientPlacementTest::testXdgPopup() @@ -249,7 +270,7 @@ void TransientPlacementTest::testXdgPopup() QCOMPARE(configureRequestedSpy.first()[0].value(), expectedRelativeGeometry); popup->ackConfigure(configureRequestedSpy.first()[1].toUInt()); - auto transient = Test::renderAndWaitForShown(transientSurface, positioner.initialSize(), Qt::red); + auto transient = Test::renderAndWaitForShown(transientSurface, expectedRelativeGeometry.size(), Qt::red); QVERIFY(transient); QVERIFY(!transient->isDecorated()); @@ -319,10 +340,10 @@ void TransientPlacementTest::testXdgPopupWithPanel() parent->setFullScreen(true); QVERIFY(fullscreenSpy.wait()); parentShellSurface->ackConfigure(fullscreenSpy.first().at(2).value()); - QSignalSpy geometryShapeChangedSpy{parent, &XdgShellClient::geometryShapeChanged}; - QVERIFY(geometryShapeChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy{parent, &XdgShellClient::frameGeometryChanged}; + QVERIFY(frameGeometryChangedSpy.isValid()); Test::render(parentSurface, fullscreenSpy.first().at(0).toSize(), Qt::red); - QVERIFY(geometryShapeChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(parent->frameGeometry(), screens()->geometry(0)); QVERIFY(parent->isFullScreen()); diff --git a/autotests/integration/xdgshellclient_rules_test.cpp b/autotests/integration/xdgshellclient_rules_test.cpp index 52bd1c4ad0..46dfc81b13 100644 --- a/autotests/integration/xdgshellclient_rules_test.cpp +++ b/autotests/integration/xdgshellclient_rules_test.cpp @@ -579,10 +579,10 @@ void TestXdgShellClientRules::testPositionApplyNow() RuleBook::self()->setConfig(config); // The client should be moved to the position specified by the rule. - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); workspace()->slotReconfigure(); - QCOMPARE(geometryChangedSpy.count(), 1); + QCOMPARE(frameGeometryChangedSpy.count(), 1); QCOMPARE(client->pos(), QPoint(42, 42)); // We still have to be able to move the client around. @@ -792,8 +792,8 @@ void TestXdgShellClientRules::testSizeApply() QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); // One still should be able to resize the client. - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); QVERIFY(clientStartMoveResizedSpy.isValid()); QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); @@ -832,7 +832,7 @@ void TestXdgShellClientRules::testSizeApply() QCOMPARE(clientStepUserMovedResizedSpy.count(), 0); shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value()); Test::render(surface.data(), QSize(488, 640), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->size(), QSize(488, 640)); QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); @@ -930,8 +930,8 @@ void TestXdgShellClientRules::testSizeRemember() QVERIFY(!states.testFlag(XdgShellSurface::State::Resizing)); // One should still be able to resize the client. - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QSignalSpy clientStartMoveResizedSpy(client, &AbstractClient::clientStartUserMovedResized); QVERIFY(clientStartMoveResizedSpy.isValid()); QSignalSpy clientStepUserMovedResizedSpy(client, &AbstractClient::clientStepUserMovedResized); @@ -970,7 +970,7 @@ void TestXdgShellClientRules::testSizeRemember() QCOMPARE(clientStepUserMovedResizedSpy.count(), 0); shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value()); Test::render(surface.data(), QSize(488, 640), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->size(), QSize(488, 640)); QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); @@ -1154,11 +1154,11 @@ void TestXdgShellClientRules::testSizeApplyNow() QCOMPARE(configureRequestedSpy->last().first().toSize(), QSize(480, 640)); // Draw the surface with the new size. - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value()); Test::render(surface.data(), QSize(480, 640), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->size(), QSize(480, 640)); QVERIFY(!configureRequestedSpy->wait(100)); @@ -1387,11 +1387,11 @@ void TestXdgShellClientRules::testMaximizeApply() QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value()); Test::render(surface.data(), QSize(100, 50), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->size(), QSize(100, 50)); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); @@ -1499,11 +1499,11 @@ void TestXdgShellClientRules::testMaximizeRemember() QVERIFY(states.testFlag(XdgShellSurface::State::Activated)); QVERIFY(!states.testFlag(XdgShellSurface::State::Maximized)); - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value()); Test::render(surface.data(), QSize(100, 50), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->size(), QSize(100, 50)); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); @@ -1713,11 +1713,11 @@ void TestXdgShellClientRules::testMaximizeApplyNow() QVERIFY(states.testFlag(XdgShellSurface::State::Maximized)); // Draw contents of the maximized client. - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value()); Test::render(surface.data(), QSize(1280, 1024), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->size(), QSize(1280, 1024)); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull); QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeFull); @@ -1736,7 +1736,7 @@ void TestXdgShellClientRules::testMaximizeApplyNow() shellSurface->ackConfigure(configureRequestedSpy->last().at(2).value()); Test::render(surface.data(), QSize(100, 50), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->size(), QSize(100, 50)); QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore); QCOMPARE(client->requestedMaximizeMode(), MaximizeMode::MaximizeRestore); diff --git a/autotests/integration/xdgshellclient_test.cpp b/autotests/integration/xdgshellclient_test.cpp index 25234b9a91..4593066352 100644 --- a/autotests/integration/xdgshellclient_test.cpp +++ b/autotests/integration/xdgshellclient_test.cpp @@ -461,8 +461,8 @@ void TestXdgShellClient::testFullscreen() QCOMPARE(c->sizeForClientSize(c->clientSize()), c->frameGeometry().size()); QSignalSpy fullscreenChangedSpy(c, &XdgShellClient::fullScreenChanged); QVERIFY(fullscreenChangedSpy.isValid()); - QSignalSpy geometryChangedSpy(c, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(c, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); QVERIFY(sizeChangeRequestedSpy.isValid()); QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); @@ -476,12 +476,12 @@ void TestXdgShellClient::testFullscreen() // TODO: should switch to fullscreen once it's updated QVERIFY(c->isFullScreen()); QCOMPARE(c->clientSize(), QSize(100, 50)); - QVERIFY(geometryChangedSpy.isEmpty()); + QVERIFY(frameGeometryChangedSpy.isEmpty()); shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), sizeChangeRequestedSpy.first().first().toSize(), Qt::red); - QVERIFY(geometryChangedSpy.wait()); - QCOMPARE(geometryChangedSpy.count(), 1); + QVERIFY(frameGeometryChangedSpy.wait()); + QCOMPARE(frameGeometryChangedSpy.count(), 1); QVERIFY(c->isFullScreen()); QVERIFY(!c->isDecorated()); QCOMPARE(c->frameGeometry(), QRect(QPoint(0, 0), sizeChangeRequestedSpy.first().first().toSize())); @@ -537,8 +537,8 @@ void TestXdgShellClient::testFullscreenRestore() QSignalSpy fullscreenChangedSpy(c, &XdgShellClient::fullScreenChanged); QVERIFY(fullscreenChangedSpy.isValid()); - QSignalSpy geometryChangedSpy(c, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(c, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); // swap back to normal configureRequestedSpy.clear(); @@ -554,8 +554,8 @@ void TestXdgShellClient::testFullscreenRestore() } Test::render(surface.data(), QSize(100, 50), Qt::red); - QVERIFY(geometryChangedSpy.wait()); - QCOMPARE(geometryChangedSpy.count(), 1); + QVERIFY(frameGeometryChangedSpy.wait()); + QCOMPARE(frameGeometryChangedSpy.count(), 1); QVERIFY(!c->isFullScreen()); QCOMPARE(c->frameGeometry().size(), QSize(100, 50)); } @@ -680,8 +680,8 @@ void TestXdgShellClient::testMaximizedToFullscreen() QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); QSignalSpy fullscreenChangedSpy(c, &XdgShellClient::fullScreenChanged); QVERIFY(fullscreenChangedSpy.isValid()); - QSignalSpy geometryChangedSpy(c, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(c, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); QVERIFY(sizeChangeRequestedSpy.isValid()); QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); @@ -692,11 +692,11 @@ void TestXdgShellClient::testMaximizedToFullscreen() shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), sizeChangeRequestedSpy.last().first().toSize(), Qt::red); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(c->maximizeMode(), MaximizeFull); - QCOMPARE(geometryChangedSpy.isEmpty(), false); - geometryChangedSpy.clear(); + QCOMPARE(frameGeometryChangedSpy.isEmpty(), false); + frameGeometryChangedSpy.clear(); // fullscreen the window shellSurface->setFullscreen(true); @@ -1318,10 +1318,10 @@ void TestXdgShellClient::testXdgWindowGeometryIsntSet() const QPoint oldPosition = client->pos(); - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); Test::render(surface.data(), QSize(100, 50), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->frameGeometry().topLeft(), oldPosition); QCOMPARE(client->frameGeometry().size(), QSize(100, 50)); QCOMPARE(client->bufferGeometry().topLeft(), oldPosition); @@ -1333,7 +1333,7 @@ void TestXdgShellClient::testXdgWindowGeometryIsntSet() subSurface->setPosition(QPoint(-20, -10)); Test::render(childSurface.data(), QSize(100, 50), Qt::blue); surface->commit(Surface::CommitFlag::None); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->frameGeometry().topLeft(), oldPosition); QCOMPARE(client->frameGeometry().size(), QSize(120, 60)); QCOMPARE(client->bufferGeometry().topLeft(), oldPosition + QPoint(20, 10)); @@ -1356,27 +1356,29 @@ void TestXdgShellClient::testXdgWindowGeometryAttachBuffer() const QPoint oldPosition = client->pos(); - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); surface->commit(Surface::CommitFlag::None); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); + QCOMPARE(frameGeometryChangedSpy.count(), 1); QCOMPARE(client->frameGeometry().topLeft(), oldPosition); QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); Test::render(surface.data(), QSize(100, 50), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); + QCOMPARE(frameGeometryChangedSpy.count(), 2); QCOMPARE(client->frameGeometry().topLeft(), oldPosition); - QEXPECT_FAIL("", "Ask on wayland-devel what effective window geometry should be here", Continue); - QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); + QCOMPARE(client->frameGeometry().size(), QSize(100, 50)); QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); QCOMPARE(client->bufferGeometry().size(), QSize(100, 50)); shellSurface->setWindowGeometry(QRect(5, 5, 90, 40)); surface->commit(Surface::CommitFlag::None); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); + QCOMPARE(frameGeometryChangedSpy.count(), 3); QCOMPARE(client->frameGeometry().topLeft(), oldPosition); QCOMPARE(client->frameGeometry().size(), QSize(90, 40)); QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(5, 5)); @@ -1401,11 +1403,11 @@ void TestXdgShellClient::testXdgWindowGeometryAttachSubSurface() const QPoint oldPosition = client->pos(); - QSignalSpy geometryChangedSpy(client, &XdgShellClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &XdgShellClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); surface->commit(Surface::CommitFlag::None); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->frameGeometry().topLeft(), oldPosition); QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(10, 10)); @@ -1424,7 +1426,7 @@ void TestXdgShellClient::testXdgWindowGeometryAttachSubSurface() shellSurface->setWindowGeometry(QRect(-15, -15, 50, 40)); surface->commit(Surface::CommitFlag::None); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->frameGeometry().topLeft(), oldPosition); QCOMPARE(client->frameGeometry().size(), QSize(50, 40)); QCOMPARE(client->bufferGeometry().topLeft(), oldPosition - QPoint(-15, -15)); @@ -1449,11 +1451,11 @@ void TestXdgShellClient::testXdgWindowGeometryInteractiveResize() QVERIFY(configureRequestedSpy.wait()); QCOMPARE(configureRequestedSpy.count(), 1); - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); surface->commit(Surface::CommitFlag::None); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); @@ -1487,7 +1489,7 @@ void TestXdgShellClient::testXdgWindowGeometryInteractiveResize() shellSurface->setWindowGeometry(QRect(10, 10, 188, 80)); shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(208, 100), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); QCOMPARE(client->bufferGeometry().size(), QSize(208, 100)); QCOMPARE(client->frameGeometry().size(), QSize(188, 80)); @@ -1505,7 +1507,7 @@ void TestXdgShellClient::testXdgWindowGeometryInteractiveResize() shellSurface->setWindowGeometry(QRect(10, 10, 188, 88)); shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(208, 108), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(clientStepUserMovedResizedSpy.count(), 2); QCOMPARE(client->bufferGeometry().size(), QSize(208, 108)); QCOMPARE(client->frameGeometry().size(), QSize(188, 88)); @@ -1544,11 +1546,11 @@ void TestXdgShellClient::testXdgWindowGeometryFullScreen() QVERIFY(configureRequestedSpy.wait()); QCOMPARE(configureRequestedSpy.count(), 1); - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); surface->commit(Surface::CommitFlag::None); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); @@ -1561,7 +1563,7 @@ void TestXdgShellClient::testXdgWindowGeometryFullScreen() shellSurface->setWindowGeometry(QRect(0, 0, 1280, 1024)); shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(1280, 1024), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->bufferGeometry().size(), QSize(1280, 1024)); QCOMPARE(client->frameGeometry().size(), QSize(1280, 1024)); @@ -1574,7 +1576,7 @@ void TestXdgShellClient::testXdgWindowGeometryFullScreen() shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(200, 100), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); @@ -1600,11 +1602,11 @@ void TestXdgShellClient::testXdgWindowGeometryMaximize() QVERIFY(configureRequestedSpy.wait()); QCOMPARE(configureRequestedSpy.count(), 1); - QSignalSpy geometryChangedSpy(client, &AbstractClient::geometryChanged); - QVERIFY(geometryChangedSpy.isValid()); + QSignalSpy frameGeometryChangedSpy(client, &AbstractClient::frameGeometryChanged); + QVERIFY(frameGeometryChangedSpy.isValid()); shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); surface->commit(Surface::CommitFlag::None); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); @@ -1617,7 +1619,7 @@ void TestXdgShellClient::testXdgWindowGeometryMaximize() shellSurface->setWindowGeometry(QRect(0, 0, 1280, 1024)); shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(1280, 1024), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->bufferGeometry().size(), QSize(1280, 1024)); QCOMPARE(client->frameGeometry().size(), QSize(1280, 1024)); @@ -1630,7 +1632,7 @@ void TestXdgShellClient::testXdgWindowGeometryMaximize() shellSurface->setWindowGeometry(QRect(10, 10, 180, 80)); shellSurface->ackConfigure(configureRequestedSpy.last().at(2).value()); Test::render(surface.data(), QSize(200, 100), Qt::blue); - QVERIFY(geometryChangedSpy.wait()); + QVERIFY(frameGeometryChangedSpy.wait()); QCOMPARE(client->bufferGeometry().size(), QSize(200, 100)); QCOMPARE(client->frameGeometry().size(), QSize(180, 80)); diff --git a/autotests/tabbox/CMakeLists.txt b/autotests/tabbox/CMakeLists.txt index 413c52d1c5..1f148bca87 100644 --- a/autotests/tabbox/CMakeLists.txt +++ b/autotests/tabbox/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(${KWIN_SOURCE_DIR}) +include_directories(${KWin_SOURCE_DIR}) add_definitions(-DKWIN_UNIT_TEST) ######################################################## # Test TabBox::ClientModel diff --git a/colorcorrection/manager.h b/colorcorrection/manager.h index 51c5bc0413..a5f34dea34 100644 --- a/colorcorrection/manager.h +++ b/colorcorrection/manager.h @@ -283,7 +283,7 @@ private: ClockSkewNotifier *m_skewNotifier; // Specifies whether Night Color is enabled. - bool m_active; + bool m_active = false; // Specifies whether Night Color is currently running. bool m_running = false; diff --git a/decorations/decoratedclient.cpp b/decorations/decoratedclient.cpp index 6e150d8043..3637f3a41f 100644 --- a/decorations/decoratedclient.cpp +++ b/decorations/decoratedclient.cpp @@ -54,7 +54,7 @@ DecoratedClientImpl::DecoratedClientImpl(AbstractClient *client, KDecoration2::D emit decoratedClient->activeChanged(client->isActive()); } ); - connect(client, &AbstractClient::geometryChanged, this, + connect(client, &AbstractClient::frameGeometryChanged, this, [decoratedClient, this]() { if (m_client->clientSize() == m_clientSize) { return; diff --git a/doc/coding-conventions.md b/doc/coding-conventions.md new file mode 100644 index 0000000000..42bb4bfbd4 --- /dev/null +++ b/doc/coding-conventions.md @@ -0,0 +1,86 @@ +# Coding Conventions + +This document describes some of the recommended coding conventions that should be followed in KWin. + +For KWin, it is recommended to follow the KDE Frameworks Coding Style. + + +## `auto` Keyword + +Optionally, you can use the `auto` keyword in the following cases. If in doubt, for example if using +`auto` could make the code less readable, do not use `auto`. Keep in mind that code is read much more +often than written. + +* When it avoids repetition of a type in the same statement. + + ``` + auto something = new MyCustomType; + auto keyEvent = static_cast(event); + auto myList = QStringList({ "FooThing", "BarThing" }); + ``` + +* When assigning iterator types. + + ``` + auto it = myList.const_iterator(); + ``` + + +## `QRect::right()` and `QRect::bottom()` + +For historical reasons, the `QRect::right()` and `QRect::bottom()` functions deviate from the true +bottom-right corner of the rectangle. Note that this is not the case for the `QRectF` class. + +As a general rule, avoid using `QRect::right()` and `QRect::bottom()` as well methods that operate +on them. There are exceptions, though. + +Exception 1: you can use `QRect::moveRight()` and `QRect::moveBottom()` to snap a `QRect` to +another `QRect` as long as the corresponding borders match, for example + +``` +// Ok +rect.moveRight(anotherRect.right()); +rect.moveBottom(anotherRect.bottom()); +rect.moveBottomRight(anotherRect.bottomRight()); + +// Bad +rect.moveRight(anotherRect.left() - 1); // must be rect.moveLeft(anotherRect.left() - rect.width()); +rect.moveBottom(anotherRect.top() - 1); // must be rect.moveTop(anotherRect.top() - rect.height()); +rect.moveBottomRight(anotherRect.topLeft() - QPoint(1, 1)); +``` + +Exception 2: you can use `QRect::setRight()` and `QRect::setBottom()` to clip a `QRect` by another +`QRect` as long as the corresponding borders match, for example + +``` +// Ok +rect.setRight(anotherRect.right()); +rect.setBottom(anotherRect.bottom()); +rect.setBottomRight(anotherRect.bottomRight()); + +// Bad +rect.setRight(anotherRect.left()); +rect.setBottom(anotherRect.top()); +rect.setBottomRight(anotherRect.topLeft()); +``` + +Exception 3: you can use `QRect::right()` and `QRect::bottom()` in conditional statements as long +as the compared borders are the same, for example + +``` +// Ok +if (rect.right() > anotherRect.right()) { + return; +} +if (rect.bottom() > anotherRect.bottom()) { + return; +} + +// Bad +if (rect.right() > anotherRect.left()) { + return; +} +if (rect.bottom() > anotherRect.top()) { + return; +} +``` diff --git a/effects.cpp b/effects.cpp index 9f765aa782..730e9a15d3 100644 --- a/effects.cpp +++ b/effects.cpp @@ -334,6 +334,7 @@ void EffectsHandlerImpl::setupAbstractClientConnections(AbstractClient* c) ); connect(c, &AbstractClient::modalChanged, this, &EffectsHandlerImpl::slotClientModalityChanged); connect(c, &AbstractClient::geometryShapeChanged, this, &EffectsHandlerImpl::slotGeometryShapeChanged); + connect(c, &AbstractClient::frameGeometryChanged, this, &EffectsHandlerImpl::slotFrameGeometryChanged); connect(c, &AbstractClient::damaged, this, &EffectsHandlerImpl::slotWindowDamaged); connect(c, &AbstractClient::unresponsiveChanged, this, [this, c](bool unresponsive) { @@ -380,6 +381,7 @@ void EffectsHandlerImpl::setupUnmanagedConnections(Unmanaged* u) connect(u, &Unmanaged::windowClosed, this, &EffectsHandlerImpl::slotWindowClosed); connect(u, &Unmanaged::opacityChanged, this, &EffectsHandlerImpl::slotOpacityChanged); connect(u, &Unmanaged::geometryShapeChanged, this, &EffectsHandlerImpl::slotGeometryShapeChanged); + connect(u, &Unmanaged::frameGeometryChanged, this, &EffectsHandlerImpl::slotFrameGeometryChanged); connect(u, &Unmanaged::paddingChanged, this, &EffectsHandlerImpl::slotPaddingChanged); connect(u, &Unmanaged::damaged, this, &EffectsHandlerImpl::slotWindowDamaged); } @@ -637,6 +639,14 @@ void EffectsHandlerImpl::slotGeometryShapeChanged(Toplevel* t, const QRect& old) emit windowGeometryShapeChanged(t->effectWindow(), old); } +void EffectsHandlerImpl::slotFrameGeometryChanged(Toplevel *toplevel, const QRect &oldGeometry) +{ + // effectWindow() might be nullptr during tear down of the client. + if (toplevel->effectWindow()) { + emit windowFrameGeometryChanged(toplevel->effectWindow(), oldGeometry); + } +} + void EffectsHandlerImpl::slotPaddingChanged(Toplevel* t, const QRect& old) { // during late cleanup effectWindow() may be already NULL diff --git a/effects.h b/effects.h index 299bd80e4c..589977eb61 100644 --- a/effects.h +++ b/effects.h @@ -303,6 +303,7 @@ protected Q_SLOTS: void slotOpacityChanged(KWin::Toplevel *t, qreal oldOpacity); void slotClientModalityChanged(); void slotGeometryShapeChanged(KWin::Toplevel *t, const QRect &old); + void slotFrameGeometryChanged(Toplevel *toplevel, const QRect &oldGeometry); void slotPaddingChanged(KWin::Toplevel *t, const QRect &old); void slotWindowDamaged(KWin::Toplevel *t, const QRect& r); diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index bbd7220399..f56c39dad5 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -1,7 +1,7 @@ # KI18N Translation Domain for this library add_definitions(-DTRANSLATION_DOMAIN=\"kwin_effects\" -DEFFECT_BUILTINS) -include_directories(${KWIN_SOURCE_DIR}) # for xcbutils.h +include_directories(${KWin_SOURCE_DIR}) # for xcbutils.h set(kwin_effect_OWN_LIBS kwineffects diff --git a/effects/Messages.sh b/effects/Messages.sh index 22814c309b..70d65f73e3 100644 --- a/effects/Messages.sh +++ b/effects/Messages.sh @@ -1,4 +1,4 @@ #! /usr/bin/env bash $EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11 -$XGETTEXT `find . -name \*.cpp` -o $podir/kwin_effects.pot +$XGETTEXT `find . -name \*.cpp -o -name \*.h` -o $podir/kwin_effects.pot rm -f rc.cpp diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index ca3a05d564..3f9343b821 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -36,10 +36,10 @@ along with this program. If not, see . #include #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -85,7 +85,7 @@ DesktopGridEffect::DesktopGridEffect() connect(effects, &EffectsHandler::windowClosed, this, &DesktopGridEffect::slotWindowClosed); connect(effects, &EffectsHandler::windowDeleted, this, &DesktopGridEffect::slotWindowDeleted); connect(effects, &EffectsHandler::numberDesktopsChanged, this, &DesktopGridEffect::slotNumberDesktopsChanged); - connect(effects, &EffectsHandler::windowGeometryShapeChanged, this, &DesktopGridEffect::slotWindowGeometryShapeChanged); + connect(effects, &EffectsHandler::windowFrameGeometryChanged, this, &DesktopGridEffect::slotWindowFrameGeometryChanged); connect(effects, &EffectsHandler::numberScreensChanged, this, &DesktopGridEffect::setup); connect(effects, &EffectsHandler::screenAboutToLock, this, [this]() { @@ -102,9 +102,6 @@ DesktopGridEffect::DesktopGridEffect() DesktopGridEffect::~DesktopGridEffect() { - foreach (DesktopButtonsView *view, m_desktopButtonsViews) - view->deleteLater(); - m_desktopButtonsViews.clear(); } void DesktopGridEffect::reconfigure(ReconfigureFlags) @@ -194,19 +191,9 @@ void DesktopGridEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaint } // paint the add desktop button - foreach (DesktopButtonsView *view, m_desktopButtonsViews) { - if (!view->effectWindow) { - EffectWindow *viewWindow = effects->findWindow(view->winId()); - if (viewWindow) { - viewWindow->setData(WindowForceBlurRole, QVariant(true)); - view->effectWindow = viewWindow; - } - } - if (view->effectWindow) { - WindowPaintData d(view->effectWindow); - d.multiplyOpacity(timeline.currentValue()); - effects->drawWindow(view->effectWindow, PAINT_WINDOW_TRANSLUCENT, infiniteRegion(), d); - } + for (EffectQuickScene *view : m_desktopButtons) { + view->rootItem()->setOpacity(timeline.currentValue()); + effects->renderEffectQuickView(view); } if (isUsingPresentWindows() && windowMove && wasWindowMove) { @@ -313,14 +300,6 @@ void DesktopGridEffect::paintWindow(EffectWindow* w, int mask, QRegion region, W (sourceDesktop != highlightedDesktop && highlightedDesktop == paintingDesktop))) { return; // will be painted on top of all other windows } - foreach (DesktopButtonsView *view, m_desktopButtonsViews) { - if (view->effectWindow == w) { - if (!activated && timeline.currentValue() < 0.05) { - view->hide(); - } - return; // will be painted on top of all other windows - } - } qreal xScale = data.xScale(); qreal yScale = data.yScale(); @@ -444,12 +423,6 @@ void DesktopGridEffect::slotWindowDeleted(EffectWindow* w) { if (w == windowMove) windowMove = nullptr; - foreach (DesktopButtonsView *view, m_desktopButtonsViews) { - if (view->effectWindow && view->effectWindow == w) { - view->effectWindow = nullptr; - break; - } - } if (isUsingPresentWindows()) { for (QList::iterator it = m_managers.begin(), end = m_managers.end(); it != end; ++it) { @@ -458,7 +431,7 @@ void DesktopGridEffect::slotWindowDeleted(EffectWindow* w) } } -void DesktopGridEffect::slotWindowGeometryShapeChanged(EffectWindow* w, const QRect& old) +void DesktopGridEffect::slotWindowFrameGeometryChanged(EffectWindow* w, const QRect& old) { Q_UNUSED(old) if (!activated) @@ -482,11 +455,9 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e) return; QMouseEvent* me = static_cast< QMouseEvent* >(e); if (!(wasWindowMove || wasDesktopMove)) { - foreach (DesktopButtonsView *view, m_desktopButtonsViews) { - if (view->geometry().contains(me->pos())) { - const QPoint widgetPos = view->mapFromGlobal(me->pos()); - QMouseEvent event(me->type(), widgetPos, me->pos(), me->button(), me->buttons(), me->modifiers()); - view->windowInputMouseEvent(&event); + for (EffectQuickScene *view : m_desktopButtons) { + view->forwardMouseEvent(me); + if (e->isAccepted()) { return; } } @@ -1060,7 +1031,7 @@ void DesktopGridEffect::setActive(bool active) [this] { if (activated) return; - foreach (DesktopButtonsView *view, m_desktopButtonsViews) { + for (EffectQuickScene *view : m_desktopButtons) { view->hide(); } } @@ -1125,33 +1096,46 @@ void DesktopGridEffect::setup() } } } - bool enableAdd = effects->numberOfDesktops() < 20; - bool enableRemove = effects->numberOfDesktops() > 1; - QVector::iterator it = m_desktopButtonsViews.begin(); + auto it = m_desktopButtons.begin(); const int n = DesktopGridConfig::showAddRemove() ? effects->numScreens() : 0; for (int i = 0; i < n; ++i) { - DesktopButtonsView *view; - if (it == m_desktopButtonsViews.end()) { - view = new DesktopButtonsView(); - m_desktopButtonsViews.append(view); - it = m_desktopButtonsViews.end(); // changed through insert! - connect(view, &DesktopButtonsView::addDesktop, this, &DesktopGridEffect::slotAddDesktop); - connect(view, &DesktopButtonsView::removeDesktop, this, &DesktopGridEffect::slotRemoveDesktop); + EffectQuickScene *view; + QSize size; + if (it == m_desktopButtons.end()) { + view = new EffectQuickScene(this); + + connect(view, &EffectQuickView::repaintNeeded, this, []() { + effects->addRepaintFull(); + }); + + view->rootContext()->setContextProperty("effects", effects); + view->setSource(QUrl(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/desktopgrid/main.qml")))); + + QQuickItem *rootItem = view->rootItem(); + if (!rootItem) { + delete view; + continue; + } + + m_desktopButtons.append(view); + it = m_desktopButtons.end(); // changed through insert! + + size = QSize(rootItem->implicitWidth(), rootItem->implicitHeight()); } else { view = *it; ++it; + size = view->size(); } - view->setAddDesktopEnabled(enableAdd); - view->setRemoveDesktopEnabled(enableRemove); const QRect screenRect = effects->clientArea(FullScreenArea, i, 1); view->show(); // pseudo show must happen before geometry changes - view->setPosition(screenRect.right() - border/3 - view->width(), - screenRect.bottom() - border/3 - view->height()); + const QPoint position(screenRect.right() - border/3 - size.width(), + screenRect.bottom() - border/3 - size.height()); + view->setGeometry(QRect(position, size)); } - while (it != m_desktopButtonsViews.end()) { + while (it != m_desktopButtons.end()) { (*it)->deleteLater(); - it = m_desktopButtonsViews.erase(it); + it = m_desktopButtons.erase(it); } } @@ -1297,12 +1281,6 @@ void DesktopGridEffect::slotNumberDesktopsChanged(uint old) if (!activated) return; const uint desktop = effects->numberOfDesktops(); - bool enableAdd = desktop < 20; - bool enableRemove = desktop > 1; - foreach (DesktopButtonsView *view, m_desktopButtonsViews) { - view->setAddDesktopEnabled(enableAdd); - view->setRemoveDesktopEnabled(enableRemove); - } if (old < desktop) desktopsAdded(old); else @@ -1443,76 +1421,5 @@ bool DesktopGridEffect::isRelevantWithPresentWindows(EffectWindow *w) const return true; } -/************************************************ -* DesktopButtonView -************************************************/ -DesktopButtonsView::DesktopButtonsView(QWindow *parent) - : QQuickView(parent) - , effectWindow(nullptr) - , m_visible(false) - , m_posIsValid(false) -{ - setFlags(Qt::X11BypassWindowManagerHint | Qt::FramelessWindowHint); - setColor(Qt::transparent); - - rootContext()->setContextProperty(QStringLiteral("add"), QVariant(true)); - rootContext()->setContextProperty(QStringLiteral("remove"), QVariant(true)); - setSource(QUrl(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/desktopgrid/main.qml")))); - if (QObject *item = rootObject()->findChild(QStringLiteral("addButton"))) { - connect(item, SIGNAL(clicked()), SIGNAL(addDesktop())); - } - if (QObject *item = rootObject()->findChild(QStringLiteral("removeButton"))) { - connect(item, SIGNAL(clicked()), SIGNAL(removeDesktop())); - } -} - -void DesktopButtonsView::windowInputMouseEvent(QMouseEvent *e) -{ - if (e->type() == QEvent::MouseMove) { - mouseMoveEvent(e); - } else if (e->type() == QEvent::MouseButtonPress) { - mousePressEvent(e); - } else if (e->type() == QEvent::MouseButtonDblClick) { - mouseDoubleClickEvent(e); - } else if (e->type() == QEvent::MouseButtonRelease) { - mouseReleaseEvent(e); - } -} - -void DesktopButtonsView::setAddDesktopEnabled(bool enable) -{ - rootContext()->setContextProperty(QStringLiteral("add"), QVariant(enable)); -} - -void DesktopButtonsView::setRemoveDesktopEnabled(bool enable) -{ - rootContext()->setContextProperty(QStringLiteral("remove"), QVariant(enable)); -} - -bool DesktopButtonsView::isVisible() const -{ - return m_visible; -} - -void DesktopButtonsView::show() -{ - if (!m_visible && m_posIsValid) { - setPosition(m_pos); - m_posIsValid = false; - } - m_visible = true; - QQuickView::show(); -} - -void DesktopButtonsView::hide() -{ - if (!m_posIsValid) { - m_pos = position(); - m_posIsValid = true; - setPosition(-width(), -height()); - } - m_visible = false; -} - } // namespace diff --git a/effects/desktopgrid/desktopgrid.h b/effects/desktopgrid/desktopgrid.h index 6ff14cf9ce..034bcc5b0c 100644 --- a/effects/desktopgrid/desktopgrid.h +++ b/effects/desktopgrid/desktopgrid.h @@ -25,35 +25,14 @@ along with this program. If not, see . #include #include #include -#include + +#include "kwineffectquickview.h" namespace KWin { class PresentWindowsEffectProxy; -class DesktopButtonsView : public QQuickView -{ - Q_OBJECT -public: - explicit DesktopButtonsView(QWindow *parent = nullptr); - void windowInputMouseEvent(QMouseEvent* e); - void setAddDesktopEnabled(bool enable); - void setRemoveDesktopEnabled(bool enable); - bool isVisible() const; - void show(); - void hide(); -public: - EffectWindow *effectWindow; -Q_SIGNALS: - void addDesktop(); - void removeDesktop(); -private: - bool m_visible; - QPoint m_pos; - bool m_posIsValid; -}; - class DesktopGridEffect : public Effect { @@ -115,7 +94,7 @@ private Q_SLOTS: void slotWindowClosed(KWin::EffectWindow *w); void slotWindowDeleted(KWin::EffectWindow *w); void slotNumberDesktopsChanged(uint old); - void slotWindowGeometryShapeChanged(KWin::EffectWindow *w, const QRect &old); + void slotWindowFrameGeometryChanged(KWin::EffectWindow *w, const QRect &old); private: QPointF scalePos(const QPoint& pos, int desktop, int screen = -1) const; @@ -182,7 +161,7 @@ private: QRect m_windowMoveGeometry; QPoint m_windowMoveStartPoint; - QVector m_desktopButtonsViews; + QVector m_desktopButtons; QAction *m_activateAction; diff --git a/effects/desktopgrid/main.qml b/effects/desktopgrid/main.qml index 568a2964a8..750a6de5d9 100644 --- a/effects/desktopgrid/main.qml +++ b/effects/desktopgrid/main.qml @@ -18,32 +18,20 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ import QtQuick 2.0 -import org.kde.plasma.components 2.0 as Plasma +import QtQuick.Layouts 1.2 +import org.kde.plasma.components 3.0 as Plasma -Item { - width: childrenRect.width - height: childrenRect.height - Plasma.ButtonRow { - exclusive: false - width: childrenRect.width - height: childrenRect.height - Plasma.Button { - id: removeButton - objectName: "removeButton" - enabled: remove - width: height - font.bold: true - font.pointSize: 20 - text: "-" - } - Plasma.Button { - id: addButton - objectName: "addButton" - enabled: add - font.bold: true - font.pointSize: 20 - width: height - text: "+" - } +RowLayout { + Plasma.Button { + objectName: "removeButton" + enabled: effects.desktops > 1 + icon.name: "list-remove" + onClicked: effects.desktops-- + } + Plasma.Button { + objectName: "addButton" + enabled: effects.desktops < 20 + icon.name: "list-add" + onClicked: effects.desktops++ } } diff --git a/effects/invert/invert_config.cpp b/effects/invert/invert_config.cpp index 01bd05051a..efd53e1a86 100644 --- a/effects/invert/invert_config.cpp +++ b/effects/invert/invert_config.cpp @@ -62,7 +62,7 @@ InvertEffectConfig::InvertEffectConfig(QWidget* parent, const QVariantList& args mShortcutEditor = new KShortcutsEditor(actionCollection, this, KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed); - connect(mShortcutEditor, &KShortcutsEditor::keyChange, this, qOverload<>(&InvertEffectConfig::changed)); + connect(mShortcutEditor, &KShortcutsEditor::keyChange, this, &InvertEffectConfig::markAsChanged); layout->addWidget(mShortcutEditor); load(); diff --git a/effects/login/package/metadata.desktop b/effects/login/package/metadata.desktop index 24fa6f42f2..caa1fedf31 100644 --- a/effects/login/package/metadata.desktop +++ b/effects/login/package/metadata.desktop @@ -2,6 +2,7 @@ Name=Login Name[af]=Aanteken Name[ar]=ولوج +Name[ast]=Aniciu de sesión Name[be]=Уваход Name[be@latin]=Uvachod Name[bg]=Вход diff --git a/effects/logout/package/metadata.desktop b/effects/logout/package/metadata.desktop index 21cc8a3b6a..9f171a3394 100644 --- a/effects/logout/package/metadata.desktop +++ b/effects/logout/package/metadata.desktop @@ -1,5 +1,6 @@ [Desktop Entry] Name=Logout +Name[ast]=Zarru de sesión Name[ca]=Sortida Name[ca@valencia]=Eixida Name[cs]=Odhlášení diff --git a/effects/lookingglass/lookingglass_config.cpp b/effects/lookingglass/lookingglass_config.cpp index 494083dc47..b802ae27fe 100644 --- a/effects/lookingglass/lookingglass_config.cpp +++ b/effects/lookingglass/lookingglass_config.cpp @@ -61,7 +61,7 @@ LookingGlassEffectConfig::LookingGlassEffectConfig(QWidget* parent, const QVaria LookingGlassConfig::instance(KWIN_CONFIG); addConfig(LookingGlassConfig::self(), m_ui); - connect(m_ui->editor, &KShortcutsEditor::keyChange, this, qOverload<>(&LookingGlassEffectConfig::changed)); + connect(m_ui->editor, &KShortcutsEditor::keyChange, this, &LookingGlassEffectConfig::markAsChanged); // Shortcut config. The shortcut belongs to the component "kwin"! m_actionCollection = new KActionCollection(this, QStringLiteral("kwin")); diff --git a/effects/magiclamp/magiclamp_config.desktop b/effects/magiclamp/magiclamp_config.desktop index c0b7a0ad1d..491f8a1c6d 100644 --- a/effects/magiclamp/magiclamp_config.desktop +++ b/effects/magiclamp/magiclamp_config.desktop @@ -7,6 +7,7 @@ X-KDE-ParentComponents=magiclamp Name=Magic Lamp Name[ar]=المصباح السحري +Name[ast]=Llámpara máxica Name[be@latin]=Mahičnaja lampa Name[bg]=Вълшебна лампа Name[bs]=Magična lampa diff --git a/effects/magnifier/magnifier_config.cpp b/effects/magnifier/magnifier_config.cpp index 93dc8c13d1..a5e77ef0dc 100644 --- a/effects/magnifier/magnifier_config.cpp +++ b/effects/magnifier/magnifier_config.cpp @@ -61,7 +61,7 @@ MagnifierEffectConfig::MagnifierEffectConfig(QWidget* parent, const QVariantList MagnifierConfig::instance(KWIN_CONFIG); addConfig(MagnifierConfig::self(), m_ui); - connect(m_ui->editor, &KShortcutsEditor::keyChange, this, qOverload<>(&MagnifierEffectConfig::changed)); + connect(m_ui->editor, &KShortcutsEditor::keyChange, this, &MagnifierEffectConfig::markAsChanged); // Shortcut config. The shortcut belongs to the component "kwin"! m_actionCollection = new KActionCollection(this, QStringLiteral("kwin")); diff --git a/effects/maximize/package/contents/code/maximize.js b/effects/maximize/package/contents/code/maximize.js index 24f94ecf7b..f8bf5b7e91 100644 --- a/effects/maximize/package/contents/code/maximize.js +++ b/effects/maximize/package/contents/code/maximize.js @@ -93,7 +93,7 @@ var maximizeEffect = { }, init: function () { effect.configChanged.connect(maximizeEffect.loadConfig); - effects.windowGeometryShapeChanged.connect(maximizeEffect.geometryChange); + effects.windowFrameGeometryChanged.connect(maximizeEffect.geometryChange); effects.windowMaximizedStateChanged.connect(maximizeEffect.maximizeChanged); effect.animationEnded.connect(maximizeEffect.restoreForceBlurState); } diff --git a/effects/maximize/package/metadata.desktop b/effects/maximize/package/metadata.desktop index 5cdf9ee1a1..68c2474234 100644 --- a/effects/maximize/package/metadata.desktop +++ b/effects/maximize/package/metadata.desktop @@ -47,6 +47,7 @@ Comment[zh_CN]=窗口最大化/从最大化恢复时显示动画 Comment[zh_TW]=視窗最大化/回復時的動畫 Icon=preferences-system-windows-effect-maximize Name=Maximize +Name[ast]=Maximización Name[bs]=Maksimiziraj Name[ca]=Maximitza Name[ca@valencia]=Maximitza diff --git a/effects/morphingpopups/package/contents/code/morphingpopups.js b/effects/morphingpopups/package/contents/code/morphingpopups.js index 98c167d666..2eec1ef213 100644 --- a/effects/morphingpopups/package/contents/code/morphingpopups.js +++ b/effects/morphingpopups/package/contents/code/morphingpopups.js @@ -26,7 +26,7 @@ var morphingEffect = { morphingEffect.duration = animationTime(150); }, - geometryChange: function (window, oldGeometry) { + handleFrameGeometryChanged: function (window, oldGeometry) { //only tooltips and notifications if (!window.tooltip && !window.notification && !window.criticalNotification) { return; @@ -38,13 +38,6 @@ var morphingEffect = { //don't cross the whole screen: ugly var distance = Math.abs(oldGeometry.x - newGeometry.x) + Math.abs(oldGeometry.y - newGeometry.y); - if (newGeometry.x == oldGeometry.x && - newGeometry.y == oldGeometry.y && - newGeometry.width == oldGeometry.width && - newGeometry.height == oldGeometry.height) { - return; - } - if (distance > (newGeometry.width + newGeometry.height) * 2) { if (window.moveAnimation) { delete window.moveAnimation; @@ -137,7 +130,7 @@ var morphingEffect = { init: function () { effect.configChanged.connect(morphingEffect.loadConfig); - effects.windowGeometryShapeChanged.connect(morphingEffect.geometryChange); + effects.windowFrameGeometryChanged.connect(morphingEffect.handleFrameGeometryChanged); } }; morphingEffect.init(); diff --git a/effects/mouseclick/mouseclick_config.desktop b/effects/mouseclick/mouseclick_config.desktop index 4a27490344..b50908a869 100644 --- a/effects/mouseclick/mouseclick_config.desktop +++ b/effects/mouseclick/mouseclick_config.desktop @@ -6,6 +6,7 @@ X-KDE-Library=kwin_mouseclick_config X-KDE-ParentComponents=mouseclick Name=Mouse Click Animation +Name[ast]=Animación al calcar col mur Name[bs]=Animacija klika mišem Name[ca]=Animació en fer clic amb el ratolí Name[ca@valencia]=Animació de clic de ratolí diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index ee1e526aa7..16bc75766c 100644 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -101,7 +101,7 @@ PresentWindowsEffect::PresentWindowsEffect() connect(effects, &EffectsHandler::windowAdded, this, &PresentWindowsEffect::slotWindowAdded); connect(effects, &EffectsHandler::windowClosed, this, &PresentWindowsEffect::slotWindowClosed); connect(effects, &EffectsHandler::windowDeleted, this, &PresentWindowsEffect::slotWindowDeleted); - connect(effects, &EffectsHandler::windowGeometryShapeChanged, this, &PresentWindowsEffect::slotWindowGeometryShapeChanged); + connect(effects, &EffectsHandler::windowFrameGeometryChanged, this, &PresentWindowsEffect::slotWindowFrameGeometryChanged); connect(effects, &EffectsHandler::propertyNotify, this, &PresentWindowsEffect::slotPropertyNotify); connect(effects, &EffectsHandler::numberScreensChanged, this, [this] { @@ -497,7 +497,7 @@ void PresentWindowsEffect::slotWindowDeleted(EffectWindow *w) m_motionManager.unmanage(w); } -void PresentWindowsEffect::slotWindowGeometryShapeChanged(EffectWindow* w, const QRect& old) +void PresentWindowsEffect::slotWindowFrameGeometryChanged(EffectWindow* w, const QRect& old) { Q_UNUSED(old) if (!m_activated) diff --git a/effects/presentwindows/presentwindows.h b/effects/presentwindows/presentwindows.h index ede10ba338..c81e48bf6b 100644 --- a/effects/presentwindows/presentwindows.h +++ b/effects/presentwindows/presentwindows.h @@ -208,7 +208,7 @@ public Q_SLOTS: void slotWindowAdded(KWin::EffectWindow *w); void slotWindowClosed(KWin::EffectWindow *w); void slotWindowDeleted(KWin::EffectWindow *w); - void slotWindowGeometryShapeChanged(KWin::EffectWindow *w, const QRect &old); + void slotWindowFrameGeometryChanged(KWin::EffectWindow *w, const QRect &old); // atoms void slotPropertyNotify(KWin::EffectWindow* w, long atom); diff --git a/effects/presentwindows/presentwindows_config.desktop b/effects/presentwindows/presentwindows_config.desktop index 04a3485026..b3cff08068 100644 --- a/effects/presentwindows/presentwindows_config.desktop +++ b/effects/presentwindows/presentwindows_config.desktop @@ -8,6 +8,7 @@ X-KDE-ParentComponents=presentwindows Name=Present Windows Name[af]=Wys vensters Name[ar]=النوافذ الحاضرة +Name[ast]=Presentación de ventanes Name[be]=Існуючыя вокны Name[be@latin]=Najaŭnyja vokny Name[bg]=Представяне на прозорци diff --git a/effects/resize/resize_config.desktop b/effects/resize/resize_config.desktop index e5a817ba8e..65c43e5723 100644 --- a/effects/resize/resize_config.desktop +++ b/effects/resize/resize_config.desktop @@ -7,6 +7,7 @@ X-KDE-ParentComponents=resize Name=Resize Window Name[ar]=غير حجم النافذة +Name[ast]=Redimensión de ventanes Name[bg]=Преоразмеряване на прозорци Name[bs]=Preuveličanje prozora Name[ca]=Redimensionament de les finestres diff --git a/effects/showpaint/showpaint_config.cpp b/effects/showpaint/showpaint_config.cpp index db45a161ff..6094299fa9 100644 --- a/effects/showpaint/showpaint_config.cpp +++ b/effects/showpaint/showpaint_config.cpp @@ -57,7 +57,7 @@ ShowPaintEffectConfig::ShowPaintEffectConfig(QWidget *parent, const QVariantList m_ui->shortcutsEditor->addCollection(actionCollection); connect(m_ui->shortcutsEditor, &KShortcutsEditor::keyChange, - this, qOverload<>(&ShowPaintEffectConfig::changed)); + this, &ShowPaintEffectConfig::markAsChanged); load(); } diff --git a/effects/slide/slide_config.desktop b/effects/slide/slide_config.desktop index 13ae321d6c..cd280da114 100644 --- a/effects/slide/slide_config.desktop +++ b/effects/slide/slide_config.desktop @@ -40,7 +40,7 @@ Name[km]=ស្លាយ Name[kn]=ಜಾರು Name[ko]=슬라이드 Name[ku]=Xîş Bike -Name[lt]=Slidimas +Name[lt]=Slydimas Name[lv]=Slīdēt Name[mai]=स्लाइड Name[ml]=തെന്നിമാറുക diff --git a/effects/snaphelper/snaphelper.cpp b/effects/snaphelper/snaphelper.cpp index 39b7e76b0e..3c0f41487c 100644 --- a/effects/snaphelper/snaphelper.cpp +++ b/effects/snaphelper/snaphelper.cpp @@ -81,7 +81,7 @@ SnapHelperEffect::SnapHelperEffect() connect(effects, &EffectsHandler::windowClosed, this, &SnapHelperEffect::slotWindowClosed); connect(effects, &EffectsHandler::windowStartUserMovedResized, this, &SnapHelperEffect::slotWindowStartUserMovedResized); connect(effects, &EffectsHandler::windowFinishUserMovedResized, this, &SnapHelperEffect::slotWindowFinishUserMovedResized); - connect(effects, &EffectsHandler::windowGeometryShapeChanged, this, &SnapHelperEffect::slotWindowGeometryShapeChanged); + connect(effects, &EffectsHandler::windowFrameGeometryChanged, this, &SnapHelperEffect::slotWindowFrameGeometryChanged); } SnapHelperEffect::~SnapHelperEffect() @@ -316,7 +316,7 @@ void SnapHelperEffect::slotWindowFinishUserMovedResized(EffectWindow *w) effects->addRepaint(computeDirtyRegion(m_geometry)); } -void SnapHelperEffect::slotWindowGeometryShapeChanged(EffectWindow *w, const QRect &old) +void SnapHelperEffect::slotWindowFrameGeometryChanged(EffectWindow *w, const QRect &old) { if (w != m_window) { return; diff --git a/effects/snaphelper/snaphelper.h b/effects/snaphelper/snaphelper.h index c67af96ce6..c8b2d28059 100644 --- a/effects/snaphelper/snaphelper.h +++ b/effects/snaphelper/snaphelper.h @@ -47,7 +47,7 @@ private Q_SLOTS: void slotWindowClosed(EffectWindow *w); void slotWindowStartUserMovedResized(EffectWindow *w); void slotWindowFinishUserMovedResized(EffectWindow *w); - void slotWindowGeometryShapeChanged(EffectWindow *w, const QRect &old); + void slotWindowFrameGeometryChanged(EffectWindow *w, const QRect &old); private: QRect m_geometry; diff --git a/effects/thumbnailaside/thumbnailaside.cpp b/effects/thumbnailaside/thumbnailaside.cpp index eb05497c7e..0b99b3fe9e 100644 --- a/effects/thumbnailaside/thumbnailaside.cpp +++ b/effects/thumbnailaside/thumbnailaside.cpp @@ -44,7 +44,7 @@ ThumbnailAsideEffect::ThumbnailAsideEffect() connect(a, &QAction::triggered, this, &ThumbnailAsideEffect::toggleCurrentThumbnail); connect(effects, &EffectsHandler::windowClosed, this, &ThumbnailAsideEffect::slotWindowClosed); - connect(effects, &EffectsHandler::windowGeometryShapeChanged, this, &ThumbnailAsideEffect::slotWindowGeometryShapeChanged); + connect(effects, &EffectsHandler::windowFrameGeometryChanged, this, &ThumbnailAsideEffect::slotWindowFrameGeometryChanged); connect(effects, &EffectsHandler::windowDamaged, this, &ThumbnailAsideEffect::slotWindowDamaged); connect(effects, &EffectsHandler::screenLockingChanged, this, &ThumbnailAsideEffect::repaintAll); reconfigure(ReconfigureAll); @@ -92,7 +92,7 @@ void ThumbnailAsideEffect::slotWindowDamaged(EffectWindow* w, const QRect&) } } -void ThumbnailAsideEffect::slotWindowGeometryShapeChanged(EffectWindow* w, const QRect& old) +void ThumbnailAsideEffect::slotWindowFrameGeometryChanged(EffectWindow* w, const QRect& old) { foreach (const Data & d, windows) { if (d.window == w) { diff --git a/effects/thumbnailaside/thumbnailaside.h b/effects/thumbnailaside/thumbnailaside.h index 04b6f4684c..dc46c7866c 100644 --- a/effects/thumbnailaside/thumbnailaside.h +++ b/effects/thumbnailaside/thumbnailaside.h @@ -65,7 +65,7 @@ public: private Q_SLOTS: void toggleCurrentThumbnail(); void slotWindowClosed(KWin::EffectWindow *w); - void slotWindowGeometryShapeChanged(KWin::EffectWindow *w, const QRect &old); + void slotWindowFrameGeometryChanged(KWin::EffectWindow *w, const QRect &old); void slotWindowDamaged(KWin::EffectWindow* w, const QRect& damage); bool isActive() const override; void repaintAll(); diff --git a/effects/windowaperture/package/metadata.desktop b/effects/windowaperture/package/metadata.desktop index 00fc5c44f8..a84a2d024e 100644 --- a/effects/windowaperture/package/metadata.desktop +++ b/effects/windowaperture/package/metadata.desktop @@ -1,5 +1,6 @@ [Desktop Entry] Name=Window Aperture +Name[ast]=Apertura de ventanes Name[ca]=Obertura de la finestra Name[ca@valencia]=Obertura de la finestra Name[cs]=Mřížka oken diff --git a/effects/windowgeometry/windowgeometry_config.cpp b/effects/windowgeometry/windowgeometry_config.cpp index b2b58417e3..20bd7c83bf 100644 --- a/effects/windowgeometry/windowgeometry_config.cpp +++ b/effects/windowgeometry/windowgeometry_config.cpp @@ -62,7 +62,7 @@ WindowGeometryConfig::WindowGeometryConfig(QWidget* parent, const QVariantList& KGlobalAccel::self()->setShortcut(a, QList() << Qt::CTRL + Qt::SHIFT + Qt::Key_F11); myUi->shortcuts->addCollection(myActionCollection); - connect(myUi->shortcuts, &KShortcutsEditor::keyChange, this, qOverload<>(&WindowGeometryConfig::changed)); + connect(myUi->shortcuts, &KShortcutsEditor::keyChange, this, &WindowGeometryConfig::markAsChanged); addConfig(WindowGeometryConfiguration::self(), myUi); diff --git a/effects/wobblywindows/wobblywindows_config.desktop b/effects/wobblywindows/wobblywindows_config.desktop index 6246249a3c..92f09d35e5 100644 --- a/effects/wobblywindows/wobblywindows_config.desktop +++ b/effects/wobblywindows/wobblywindows_config.desktop @@ -8,6 +8,7 @@ X-KDE-ParentComponents=wobblywindows Name=Wobbly Windows Name[af]=Wobbly Windows Name[ar]=نوافذ متذبذبة +Name[ast]=Ventanes cimblantes Name[be@latin]=Skryŭleńnie akon Name[bg]=Желирани прозорци Name[bs]=Lelujavi prozori diff --git a/effects/zoom/zoom_config.desktop b/effects/zoom/zoom_config.desktop index 0908821de6..43d0343ce3 100644 --- a/effects/zoom/zoom_config.desktop +++ b/effects/zoom/zoom_config.desktop @@ -9,6 +9,7 @@ Name=Zoom Name[af]=Zoem Name[ar]=تكبير Name[as]=ডাঙৰকৈ প্ৰদৰ্শন +Name[ast]=Zoom Name[be]=Маштабаванне Name[be@latin]=Maštab Name[bg]=Мащабиране diff --git a/events.cpp b/events.cpp index 0b919646fa..0cd659a58c 100644 --- a/events.cpp +++ b/events.cpp @@ -1312,7 +1312,7 @@ void Unmanaged::configureNotifyEvent(xcb_configure_notify_event_t *e) addWorkspaceRepaint(visibleRect()); // damage old area QRect old = m_frameGeometry; m_frameGeometry = newgeom; - emit geometryChanged(); // update shadow region + emit frameGeometryChanged(this, old); // update shadow region addRepaintFull(); if (old.size() != m_frameGeometry.size()) discardWindowPixmap(); diff --git a/input.cpp b/input.cpp index 27d1e926d2..b2032cf3ee 100644 --- a/input.cpp +++ b/input.cpp @@ -759,7 +759,16 @@ public: return input()->shortcuts()->processAxis(event->modifiers(), direction); } bool keyEvent(QKeyEvent *event) override { - if (event->type() == QEvent::KeyPress) { + if (event->key() == Qt::Key_PowerOff) { + if (event->type() == QEvent::KeyPress) { + m_powerOffPress = event->timestamp(); + } else if (event->type() == QEvent::KeyRelease) { + const uint duration = (event->timestamp() - m_powerOffPress); + const Qt::Key key = duration > 1000 ? Qt::Key_PowerDown : Qt::Key_PowerOff; + const auto shortcuts = static_cast(event)->modifiersRelevantForGlobalShortcuts(); + return input()->shortcuts()->processKey(shortcuts, key | (event->key() & ~Qt::KeyboardModifierMask)); + } + } else if (event->type() == QEvent::KeyPress) { return input()->shortcuts()->processKey(static_cast(event)->modifiersRelevantForGlobalShortcuts(), event->key()); } return false; @@ -784,6 +793,9 @@ public: input()->shortcuts()->processSwipeEnd(); return false; } + +private: + uint m_powerOffPress; }; diff --git a/internal_client.cpp b/internal_client.cpp index b3dee3b1ad..8f2221f69c 100644 --- a/internal_client.cpp +++ b/internal_client.cpp @@ -31,6 +31,7 @@ along with this program. If not, see . Q_DECLARE_METATYPE(NET::WindowType) static const QByteArray s_skipClosePropertyName = QByteArrayLiteral("KWIN_SKIP_CLOSE_ANIMATION"); +static const QByteArray s_shadowEnabledPropertyName = QByteArrayLiteral("kwin_shadow_enabled"); namespace KWin { @@ -62,6 +63,7 @@ InternalClient::InternalClient(QWindow *window) setOpacity(m_internalWindow->opacity()); setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool()); + // Create scene window, effect window, and update server-side shadow. setupCompositing(); updateColorScheme(); @@ -86,6 +88,9 @@ bool InternalClient::eventFilter(QObject *watched, QEvent *event) if (pe->propertyName() == s_skipClosePropertyName) { setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool()); } + if (pe->propertyName() == s_shadowEnabledPropertyName) { + updateShadow(); + } if (pe->propertyName() == "kwin_windowType") { m_windowType = m_internalWindow->property("kwin_windowType").value(); workspace()->updateClientArea(); @@ -203,26 +208,6 @@ bool InternalClient::isCloseable() const return true; } -bool InternalClient::isFullScreenable() const -{ - return false; -} - -bool InternalClient::isFullScreen() const -{ - return false; -} - -bool InternalClient::isMaximizable() const -{ - return false; -} - -bool InternalClient::isMinimizable() const -{ - return false; -} - bool InternalClient::isMovable() const { return true; @@ -287,16 +272,6 @@ quint32 InternalClient::windowId() const return m_windowId; } -MaximizeMode InternalClient::maximizeMode() const -{ - return MaximizeRestore; -} - -QRect InternalClient::geometryRestore() const -{ - return m_maximizeRestoreGeometry; -} - bool InternalClient::isShown(bool shaded_is_shown) const { Q_UNUSED(shaded_is_shown) @@ -365,11 +340,6 @@ void InternalClient::setFrameGeometry(int x, int y, int w, int h, ForceGeometry_ } } -void InternalClient::setGeometryRestore(const QRect &rect) -{ - m_maximizeRestoreGeometry = rect; -} - bool InternalClient::supportsWindowRules() const { return false; @@ -392,17 +362,6 @@ void InternalClient::takeFocus() { } -bool InternalClient::userCanSetFullScreen() const -{ - return false; -} - -void InternalClient::setFullScreen(bool set, bool user) -{ - Q_UNUSED(set) - Q_UNUSED(user) -} - void InternalClient::setNoBorder(bool set) { if (!userCanSetNoBorder()) { @@ -527,15 +486,6 @@ bool InternalClient::belongsToSameApplication(const AbstractClient *other, SameA return qobject_cast(other) != nullptr; } -void InternalClient::changeMaximize(bool horizontal, bool vertical, bool adjust) -{ - Q_UNUSED(horizontal) - Q_UNUSED(vertical) - Q_UNUSED(adjust) - - // Internal clients are not maximizable. -} - void InternalClient::destroyDecoration() { if (!isDecorated()) { @@ -623,9 +573,11 @@ void InternalClient::commitGeometry(const QRect &rect) addWorkspaceRepaint(visibleRect()); syncGeometryToInternalWindow(); - const QRect oldGeometry = frameGeometryBeforeUpdateBlocking(); + if (frameGeometryBeforeUpdateBlocking() != frameGeometry()) { + emit frameGeometryChanged(this, frameGeometryBeforeUpdateBlocking()); + } + emit geometryShapeChanged(this, frameGeometryBeforeUpdateBlocking()); updateGeometryBeforeUpdateBlocking(); - emit geometryShapeChanged(this, oldGeometry); if (isResize()) { performMoveResize(); diff --git a/internal_client.h b/internal_client.h index 140e87d69f..5766af714d 100644 --- a/internal_client.h +++ b/internal_client.h @@ -53,10 +53,6 @@ public: QByteArray windowRole() const override; void closeWindow() override; bool isCloseable() const override; - bool isFullScreenable() const override; - bool isFullScreen() const override; - bool isMaximizable() const override; - bool isMinimizable() const override; bool isMovable() const override; bool isMovableAcrossScreens() const override; bool isResizable() const override; @@ -68,8 +64,6 @@ public: bool isInputMethod() const override; bool isOutline() const override; quint32 windowId() const override; - MaximizeMode maximizeMode() const override; - QRect geometryRestore() const override; bool isShown(bool shaded_is_shown) const override; bool isHiddenInternal() const override; void hideClient(bool hide) override; @@ -77,13 +71,10 @@ public: void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override; using AbstractClient::setFrameGeometry; void setFrameGeometry(int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet) override; - void setGeometryRestore(const QRect &rect) override; bool supportsWindowRules() const override; AbstractClient *findModal(bool allow_itself = false) override; void setOnAllActivities(bool set) override; void takeFocus() override; - bool userCanSetFullScreen() const override; - void setFullScreen(bool set, bool user = true) override; void setNoBorder(bool set) override; void updateDecoration(bool check_workspace_pos, bool force = false) override; void updateColorScheme() override; @@ -97,7 +88,6 @@ public: protected: bool acceptsFocus() const override; bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const override; - void changeMaximize(bool horizontal, bool vertical, bool adjust) override; void destroyDecoration() override; void doMove(int x, int y) override; void doResizeSync() override; @@ -113,7 +103,6 @@ private: void updateInternalWindowGeometry(); QWindow *m_internalWindow = nullptr; - QRect m_maximizeRestoreGeometry; QSize m_clientSize = QSize(0, 0); QString m_captionNormal; QString m_captionSuffix; diff --git a/kcmkwin/common/CMakeLists.txt b/kcmkwin/common/CMakeLists.txt index f6e211a543..b41eab6768 100644 --- a/kcmkwin/common/CMakeLists.txt +++ b/kcmkwin/common/CMakeLists.txt @@ -1,14 +1,14 @@ # KI18N Translation Domain for this library add_definitions(-DTRANSLATION_DOMAIN=\"kcmkwincommon\") -include_directories(${KWIN_SOURCE_DIR}/effects) +include_directories(${KWin_SOURCE_DIR}/effects) set(kcmkwincommon_SRC effectsmodel.cpp ) qt5_add_dbus_interface(kcmkwincommon_SRC - ${KWIN_SOURCE_DIR}/org.kde.kwin.Effects.xml kwin_effects_interface + ${KWin_SOURCE_DIR}/org.kde.kwin.Effects.xml kwin_effects_interface ) add_library(kcmkwincommon SHARED ${kcmkwincommon_SRC}) diff --git a/kcmkwin/kwincompositing/CMakeLists.txt b/kcmkwin/kwincompositing/CMakeLists.txt index 0a9b230b5c..d759e202b6 100644 --- a/kcmkwin/kwincompositing/CMakeLists.txt +++ b/kcmkwin/kwincompositing/CMakeLists.txt @@ -14,7 +14,7 @@ set(kwincomposing_SRC ) qt5_add_dbus_interface(kwincomposing_SRC - ${KWIN_SOURCE_DIR}/org.kde.kwin.Compositing.xml kwin_compositing_interface + ${KWin_SOURCE_DIR}/org.kde.kwin.Compositing.xml kwin_compositing_interface ) ki18n_wrap_ui(kwincomposing_SRC compositing.ui) diff --git a/kcmkwin/kwincompositing/kwincompositing.desktop b/kcmkwin/kwincompositing/kwincompositing.desktop index a99043df96..cdb7f81567 100644 --- a/kcmkwin/kwincompositing/kwincompositing.desktop +++ b/kcmkwin/kwincompositing/kwincompositing.desktop @@ -13,6 +13,7 @@ X-KDE-System-Settings-Parent-Category=display X-KDE-Weight=60 Name=Compositor +Name[ast]=Compositor Name[bs]=Compositor Name[ca]=Compositor Name[ca@valencia]=Compositor @@ -110,7 +111,6 @@ X-KDE-Keywords[et]=kwin,aken,haldur,komposiit,komposiitor,efekt,3D efektid,ruumi X-KDE-Keywords[eu]=kwin,leihoa,kudeatzailea,konposatzailea,efektua,3Dtako efektuak,2Dtako efektuak,OpenGL,XRender,bideo ezarpenak,efektu grafikoak,mahaigaineko efektuak X-KDE-Keywords[fi]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,ikkunointiohjelma,ikkunaohjelma,ikkunanhallinta,tehoste,3D-tehosteet,2D-tehosteet,videoasetukset,graafiset tehosteet,työpöytätehosteet X-KDE-Keywords[fr]=Gestionnaire de fenêtres KWin, kwin,window,manager,compositeur, effet, effets 3D,effets 2D,OpenGL,XRender,paramétrage video,effets graphiques ,effects du bureau -X-KDE-Keywords[ia]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects X-KDE-Keywords[it]=kwin,finestra,gestore,composizione,effetto,effetti 3D,effetti 2D,OpenGL,XRender,impostazioni video,effetti grafici,effetti del desktop X-KDE-Keywords[ko]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,3D 효과,2D 효과,비디오 설정,그래픽 설정,그래픽 효과,데스크톱 효과 X-KDE-Keywords[lt]=kwin,langas,langai,tvarkytuvė,tvarkytuve,komponavimas,kompozicionavimas,efektas,efektai,3D efektai,2D efektai,trimačiai efektai,trimaciai efektai,dvimačiai efektai,dvimaciai efektai,OpenGL,XRender,vaizdo nustatymai,vaizdo nuostatos,video nustatymai,video nuostatos,grafiniai efektai,grafikos efektai,darbalaukio efektai,darbastalio efektai diff --git a/kcmkwin/kwindecoration/Messages.sh b/kcmkwin/kwindecoration/Messages.sh old mode 100755 new mode 100644 index 6271947c32..97ccd22454 --- a/kcmkwin/kwindecoration/Messages.sh +++ b/kcmkwin/kwindecoration/Messages.sh @@ -1,4 +1,2 @@ #! /usr/bin/env bash -$EXTRACTRC `find . -name "*.ui"` >> rc.cpp || exit 11 $XGETTEXT `find . -name "*.cpp" -o -name "*.qml"` -o $podir/kcm_kwindecoration.pot -rm -f rc.cpp diff --git a/kcmkwin/kwindesktop/kcm_kwin_virtualdesktops.desktop b/kcmkwin/kwindesktop/kcm_kwin_virtualdesktops.desktop index 3af3e5a6f1..933905a5d7 100644 --- a/kcmkwin/kwindesktop/kcm_kwin_virtualdesktops.desktop +++ b/kcmkwin/kwindesktop/kcm_kwin_virtualdesktops.desktop @@ -14,6 +14,7 @@ X-KDE-Weight=60 Name=Virtual Desktops Name[ar]=أسطح المكتب الافتراضية +Name[ast]=Escritorios virtuales Name[bg]=Виртуални работни плотове Name[bs]=Virtuelne površi Name[ca]=Escriptoris virtuals diff --git a/kcmkwin/kwindesktop/package/metadata.desktop b/kcmkwin/kwindesktop/package/metadata.desktop index 7165031b6d..e7e3fc7d3d 100644 --- a/kcmkwin/kwindesktop/package/metadata.desktop +++ b/kcmkwin/kwindesktop/package/metadata.desktop @@ -1,6 +1,7 @@ [Desktop Entry] Name=Virtual Desktops Name[ar]=أسطح المكتب الافتراضية +Name[ast]=Escritorios virtuales Name[bg]=Виртуални работни плотове Name[bs]=Virtuelne površi Name[ca]=Escriptoris virtuals diff --git a/kcmkwin/kwineffects/kcm_kwin_effects.desktop b/kcmkwin/kwineffects/kcm_kwin_effects.desktop index 42cca2845b..ee78f454fd 100644 --- a/kcmkwin/kwineffects/kcm_kwin_effects.desktop +++ b/kcmkwin/kwineffects/kcm_kwin_effects.desktop @@ -107,7 +107,7 @@ X-KDE-Keywords[hu]=kwin,ablak,kezelő,hatás,3D hatás,2D hatás,grafikai hatás X-KDE-Keywords[id]=kwin,window,pengelola,efek,efek 3D,efek 2D,efek grafik,efek desktop,animasi,beragam animasi,efek pengelola window,efek beralih window,efek beralih desktop,animasi,animasi desktop,driver,pengaturan driver,rendering,render,efek kebalikan,efek seperti gelas,efek kaca pembesar,efek penunjang jepret,efek lacak mouse,efek pembesaran,efek buram,efek lesap,efek desktop lesap,efek hancur,efek petak,efek window sorot,efek login,efek logout,efek lampu ajaib,efek animasi minimalkan,efek tanda mouse,efek skala,efek cuplikan layar,efek lembar,efek geser,efek sembul geser,efek gambar-mini disamping,translusensi,efek translusensi,transparan,efek geometri window,efek window goyang,efek feedback pemulaian,efek induk dialog,efek layar suram,efek geser mundur,eye candy,candy,efek tampilkan FPS,efek tampilkan lukisan,efek alih kotak,efek alih sampul,efek kubus desktop,efek animasi kubus desktop,efek kisi desktop,efek alih lipat,efek window hadir,efek ubah ukuran window,efek kontras latarbelakang X-KDE-Keywords[it]=kwin,finestra,gestore,effetto,effetti 3D,effetti 2D,effetti grafici,effetti del desktop,animazioni,animazioni varie, effetti del gestore delle finestre,effetto dello scambiafinestre,effetto dello scambiatore di desktop,animazioni,animazioni del desktop,driver,impostazioni driver,rendering,render,effetto invertito,effetto vetro,effetto lente,effetto snap helper,effetto traccia mouse,effetto ingrandimento, effetto sfocatura,effetto dissolvenza,effetto dissolvenza desktop,effetto caduta,effetto planatura,effetto evidenziazione finestra,effetto schermata di accesso, effetto disconnessione,effetto lampada magica,effetto animazione di minimizzazione,effetto marcatura mouse, effetto scalatura,effetto schermata,effetto foglio,effetto diapositiva,effetto scivolamento,effetto miniature nella barra delle applicazioni,effetto miniatura su un lato,translucenza,effetto translucenza, trasparenza,effetto geometria finestra,effetto finestre tremolanti,effetto segnale di avvio,effetto finestra madre,effetto oscura finestra inattiva,effetto oscura schermo,effetto scivola all'indietro,gradevole,effetto gradevole,effetto mostra FPS,effetto ridisegno,effetto scambio cubi,effetto scambio copertina,effetto cubi del desktop,effetto animazione cubi del desktop,effetto griglia desktop,effetto scambiatore con inversione,effetto riquadro,effetto finestra presente,effetto ridimensionamento finestra,effetto contrasto dello sfondo X-KDE-Keywords[ko]=kwin,window,manager,effect,3D effects,2D effects,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,magic lamp effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop cube effect,desktop cube animation effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect,창,관리자,효과,3D 효과,2D 효과,그래픽 효과,데스크톱 효과,애니메이션,창 관리자,창 관리자 효과,데스크톱 전환,데스크톱 전환 효과,드라이버,드라이버 설정,렌더링,렌더링 설정,애니메이션 속도,투명 유리 효과,확대 축소 효과,흐림 효과,대시보드 효과,페이드 효과,로그인 효과,창 강조 효과,글라이드 효과,로그아웃 효과,램프 효과,시트 효과,최소화 효과,최대화 효과,팝업 효과 -X-KDE-Keywords[lt]=kwin,langas,langai,langų,langu,tvarkytuvė,tvarkytuve,efektas,efektai,3D efektai,2D efektai,trimačiai efektai,trimaciai efektai,dvimačiai efektai,dvimaciai efektai,grafiniai efektai,grafikos efektai,darbalaukio efektai,darbastalio efektai,animacijos,įvairios animacijos,ivairios animacijos,langų tvarkymo efektai,langu tvarkymo efektai,langų valdymo efektai,langu valdymo efektai,langų perjungimo efektai,langu perjungimo efektai,langų perjungiklio efektai,langu perjungiklio efektai,darbalaukio perjungimo efektai,darbastalio perjungimo efektai,darbalaukio perjungiklio efektai,darbastalio perjungiklio efektai,animacijos,darbalaukio animacijos,darbastalio animacijos,tvarkyklės,tvarkykles,tvarkyklė,tvarkykle,tvarkyklės nustatymai,tvarkykles nustatymai,tvarkyklės nuostatos,tvarkykles nuostatos,vaizdavimas,atvaizdavimas,invertavimo efektas,invertavimas,didinamojo stiklo efektas,didinamasis stiklas,didintuvo efektas,didintuvas,pritraukimo pagelbiklio efektas,traukimo pagelbiklio efektas,pritraukimo pagelbiklis,traukimo pagelbiklis,sekti pelę,sekti pele,pelės sekimas,peles sekimas,didinimo efektas,didinimas,suliejimo efektas,suliejimas,išblukimo efektas,išblukimas,isblukimo efektas,isblukimas,atsiradimo efektas,atsiradimas,išnykimo efektas,isnykimo efektas,išnykimas,isnykimas,darbalaukio išblukimo efektas,darbalaukio isblukimo efektas,darbastalio išblukimo efektas,darbastalio isblukimo efektas,subyrėjimo efektas,subyrejimo efektas,subyrėjimas,subyrejimas,byrėjimas,byrejimas,sklandymo efektas,sklandymas,lango paryškinimo efektas,lango paryskinimo efektas,langų paryškinimo efektas,langu paryskinimo efektas,lango paryškinimas,lango paryskinimas,langų paryškinimas,langu paryskinimas,prisijungimo efektas,atsijungimo efektas,magiškos lempos efektas,magiskos lempos efektas,magiška lempa,magiska lempa,suskleidimo animacijos efektas,sumažinimo animacijos efektas,sumazinimo animacijos efektas,suskleidimas,sumažinimas,sumazinimas,žymėjimo pele efektas,zymejimo pele efektas,žymėjimas pele,zymejimas pele,mastelio keitimo efektas,mastelio keitimas,ekrano kopijos efektas,ekrano kopija,ekranvaizdžio efektas,ekranvaizdzio efektas,lapo efektas,lapas,slidimo efektas,slidimas,slystančių iškylančiųjų langų efektas,slystanciu iskylanciuju langu efektas,slystantys iškylantieji langai,slystantys iskylantieji langai,miniatiūros šone efektas,miniatiuros sone efektas,dalinis permatomumas,dalinio permatomumo efektas,permatomumas,skaidrumas,lango geometrijos efektas,lango geometrija,svirduliuojančių langų efektas,svirduliuojanciu langu efektas,svirduliuojantys langai,paleidimo grįžtamojo ryšio efektas,paleidimo griztamojo rysio efektas,paleidimo grįžtamasis ryšys,paleidimo griztamasis rysys,paleisties grįžtamasis ryšys,paleisties griztamasis rysys,dialogo viršesnio efektas,dialogo virsesnio efektas,dialogo viršesnis,dialogo virsesnis,pasyviųjų pritemdymo efektas,pasyviuju pritemdymo efektas,pasyviųjų pritemdymas,pasyviuju pritemdymas,pasyvių pritemdymo efektas,pasyviu pritemdymo efektas,pasyvių pritemdymas,pasyviu pritemdymas,ekrano pritemdymo efektas,ekrano pritemdymas,slydimo atgal efektas,slydimas atgal,grožybės,grozybes,gražu,grazu,FPS rodymo efektas,FPS rodymas,kadr./sek.,kadr/sek,kadr./s,kadr/s,kadr./sek. rodymas,piešimo rodymo efektas,piesimo rodymo efektas,piešimo rodymas,piesimo rodymas,viršelių perjungiklio efektas,viršelio perjungiklio efektas,virseliu perjungiklio efektas,viršelių perjungiklis,virseliu perjungiklis,višelių perjungimas,virseliu perjungimas,darbalaukio kubo efektas,darbastalio kubo efektas,darbalaukio kubas,darbastalio kubas,darbalaukio kubo animacijos efektas,darbastalio kubo animacijos efektas,darbalaukio kubo animacija,darbastalio kubo animacija,darbalaukio tinklelio efektas,darbastalio tinklelio efektas,darbalaukio tinklelis,darbastalio tinklelis,kartotekos pavidalo langų perjungiklio efektas,kartotekos pavidalo langu perjungiklio efektas,kartotekos pavidalo langų perjungiklis,kartotekos pavidalo langu perjungiklis,langų pateikimo efektas,langu pateikimo efektas,langų pateikimas,langu pateikimas,langų dydžio keitimo efektas,lango dydžio keitimo efektas,langu dydzio keitimo efektas,lango dydzio keitimo efektas,fono kontrasto efektas,fono kontrastas +X-KDE-Keywords[lt]=kwin,langas,langai,langų,langu,tvarkytuvė,tvarkytuve,efektas,efektai,3D efektai,2D efektai,trimačiai efektai,trimaciai efektai,dvimačiai efektai,dvimaciai efektai,grafiniai efektai,grafikos efektai,darbalaukio efektai,darbastalio efektai,animacijos,įvairios animacijos,ivairios animacijos,langų tvarkymo efektai,langu tvarkymo efektai,langų valdymo efektai,langu valdymo efektai,langų perjungimo efektai,langu perjungimo efektai,langų perjungiklio efektai,langu perjungiklio efektai,darbalaukio perjungimo efektai,darbastalio perjungimo efektai,darbalaukio perjungiklio efektai,darbastalio perjungiklio efektai,animacijos,darbalaukio animacijos,darbastalio animacijos,tvarkyklės,tvarkykles,tvarkyklė,tvarkykle,tvarkyklės nustatymai,tvarkykles nustatymai,tvarkyklės nuostatos,tvarkykles nuostatos,vaizdavimas,atvaizdavimas,invertavimo efektas,invertavimas,didinamojo stiklo efektas,didinamasis stiklas,didintuvo efektas,didintuvas,pritraukimo pagelbiklio efektas,traukimo pagelbiklio efektas,pritraukimo pagelbiklis,traukimo pagelbiklis,sekti pelę,sekti pele,pelės sekimas,peles sekimas,didinimo efektas,didinimas,suliejimo efektas,suliejimas,išblukimo efektas,išblukimas,isblukimo efektas,isblukimas,atsiradimo efektas,atsiradimas,išnykimo efektas,isnykimo efektas,išnykimas,isnykimas,darbalaukio išblukimo efektas,darbalaukio isblukimo efektas,darbastalio išblukimo efektas,darbastalio isblukimo efektas,subyrėjimo efektas,subyrejimo efektas,subyrėjimas,subyrejimas,byrėjimas,byrejimas,sklandymo efektas,sklandymas,lango paryškinimo efektas,lango paryskinimo efektas,langų paryškinimo efektas,langu paryskinimo efektas,lango paryškinimas,lango paryskinimas,langų paryškinimas,langu paryskinimas,prisijungimo efektas,atsijungimo efektas,magiškos lempos efektas,magiskos lempos efektas,magiška lempa,magiska lempa,suskleidimo animacijos efektas,sumažinimo animacijos efektas,sumazinimo animacijos efektas,suskleidimas,sumažinimas,sumazinimas,žymėjimo pele efektas,zymejimo pele efektas,žymėjimas pele,zymejimas pele,mastelio keitimo efektas,mastelio keitimas,ekrano kopijos efektas,ekrano kopija,ekranvaizdžio efektas,ekranvaizdzio efektas,lapo efektas,lapas,slydimo efektas,slydimas,slidimas,slystančių iškylančiųjų langų efektas,slystanciu iskylanciuju langu efektas,slystantys iškylantieji langai,slystantys iskylantieji langai,miniatiūros šone efektas,miniatiuros sone efektas,dalinis permatomumas,dalinio permatomumo efektas,permatomumas,skaidrumas,lango geometrijos efektas,lango geometrija,svirduliuojančių langų efektas,svirduliuojanciu langu efektas,svirduliuojantys langai,paleidimo grįžtamojo ryšio efektas,paleidimo griztamojo rysio efektas,paleidimo grįžtamasis ryšys,paleidimo griztamasis rysys,paleisties grįžtamasis ryšys,paleisties griztamasis rysys,dialogo viršesnio efektas,dialogo virsesnio efektas,dialogo viršesnis,dialogo virsesnis,pasyviųjų pritemdymo efektas,pasyviuju pritemdymo efektas,pasyviųjų pritemdymas,pasyviuju pritemdymas,pasyvių pritemdymo efektas,pasyviu pritemdymo efektas,pasyvių pritemdymas,pasyviu pritemdymas,ekrano pritemdymo efektas,ekrano pritemdymas,slydimo atgal efektas,slydimas atgal,grožybės,grozybes,gražu,grazu,FPS rodymo efektas,FPS rodymas,kadr./sek.,kadr/sek,kadr./s,kadr/s,kadr./sek. rodymas,piešimo rodymo efektas,piesimo rodymo efektas,piešimo rodymas,piesimo rodymas,viršelių perjungiklio efektas,viršelio perjungiklio efektas,virseliu perjungiklio efektas,viršelių perjungiklis,virseliu perjungiklis,višelių perjungimas,virseliu perjungimas,darbalaukio kubo efektas,darbastalio kubo efektas,darbalaukio kubas,darbastalio kubas,darbalaukio kubo animacijos efektas,darbastalio kubo animacijos efektas,darbalaukio kubo animacija,darbastalio kubo animacija,darbalaukio tinklelio efektas,darbastalio tinklelio efektas,darbalaukio tinklelis,darbastalio tinklelis,kartotekos pavidalo langų perjungiklio efektas,kartotekos pavidalo langu perjungiklio efektas,kartotekos pavidalo langų perjungiklis,kartotekos pavidalo langu perjungiklis,langų pateikimo efektas,langu pateikimo efektas,langų pateikimas,langu pateikimas,langų dydžio keitimo efektas,lango dydžio keitimo efektas,langu dydzio keitimo efektas,lango dydzio keitimo efektas,fono kontrasto efektas,fono kontrastas X-KDE-Keywords[nl]=kwin,venster,beheerder,effect,3D effecten,2D effecten,grafische effecten,bureaubladeffecten,animaties,verrschillende animaties,vensterbeheereffecten,vensteromschakeleffect,bureaublad-omschakeleffect,animaties,bureaubladanimaties,stuurprogramma's,stuurprogramma-instellingen,rendering,render,inversieeffect,vergrootglaseffect,vergrotingseffect,snaphelpereffect,trackmuiseffect,zoomeffect,vervagingseffect,uitvaageffect,uitvaagbureaubladeffect,uiteenvaleffect,glijeffect,vensteraccentueringseffect,aanmeldeffect,afmeldeffect,magische lampeffect,animatie-effect minimaliseren,muismarkeringseffect,schaaleffect,schermafdrukeffect,bladeneffect,dia-effect,glijdende pop-upseffect,miniatuur-opzijeffect,doorzichtigheid,doorzichtigheidseffect,transparantie,vensterafmetingeneffect,wiebelende vensterseffect,opstartterugkoppeleffect,dialoogoudereffect,dim bij inactiviteitseffect,dim het schermeffect,schuif terugeffect,oogstrelend,snoepgoed,FPS toneneffect,verf toneneffect,vak deksel schakelaareffect,bureaublad kubuseffect,bureaublad kubus animatie-effect,bureaubladrastereffect,omschakeleffect,huidig venstereffect, wijzig grootte van venstereffect, achtergrondcontrasteffect X-KDE-Keywords[nn]=kwin,vindauge,handsamar,vindaugshandsamar,effekt,3D-effektar,2D-effektar,grafiske effektar,skrivebordeffektar,animasjonar,ymse animasjonar,vindaugsbyteeffektar,effektar ved skrivebordbyte,animasjonar,skrivebordsanimasjonar,drivarar,drivarinnstillingar,oppteikning,oppteiknar,inverteringseffekt,spegeleffekt,lupeeffekt,gripehjelpareffekt,musmerkeeffekt,forstørringseffekt,zoomeffekt,sløringseffekt,uklar-effekt,kontrollpulteffekt,uttoningseffekt,skrivebordtoningseffekt,gå-i-knas-effekt,glidareffekt,framhev vindauge-effekt,innloggingseffekt,utloggingsefffekt,magisk lampe-effekt,animasjonseffekt ved vindaugsminimering,musmerkeeffekt,skaleringseffekt,skjermdumpeffekt,ark-effekt,lysbileteffekt,glidande sprettopp-effekt,effekt for minibilete på sida,gjennomsiktseffekt,gjennomsikt,vindaugsgeometri-effekt,vaklande vindauge-effekt,effekt for oppstartsmelding,effekt for forelderdialog,effekt for mørk inaktiv,effekt for mørk skjerm,gli tilbake-effekt,augesnop,vis FPS-effekt,vis målingseffekt,omslagsbyteeffekt,skrivebordskube-effekt,effekt for animert skrivebordskube,effekt for skrivebordrutenett,effekt for flipp-byte,presenter vindauge-effekt,vindaugsskaleringseffekt,bakgrunnskontrast-effekt X-KDE-Keywords[pl]=kwin,okno,menadżer,efekt,efekty 3D,efekty 2D,efekty graficzne,efekty pulpitu,animacje,różne animacje,efekty zarządzania oknami,efekty przełączania okien,efekty przełączania pulpitów,animacje,animacje pulpitu,sterowniki,ustawienia sterowników,renderowania, efekt odwrócenia,szkło powiększające,efekt powiększenia,efekt pomocnika przyciągania, efekt śledzenia myszy,efekt przybliżenia,rozmycie,tablica,efekt eksplozji,efekt zanikania,efekt zanikania pulpitu,efekt rozpadania,efekt slajdu,efekt podświetlania okna, efekt logowania,efekt wylogowywania,efekt magicznej lampy,efekt animacji minimalizacji, efekt znacznika myszy,efekt skalowania,efekt zrzutu ekranu,efekt arkusza,efekt slajdu,efekt wysuwających się elementów wyskakujących,efekt prześwitywania,przezroczystość,efekt geometrii okna,efekt chwiejnych okien,efekt odczuć przy starcie,efekt okna rodzica,efekt przyciemniania nieaktywnych,efekt przyciemniania ekranu,efekt przesuwania do tył,efekt pokazania ilości klatek na sekundę diff --git a/kcmkwin/kwineffects/package/contents/ui/main.qml b/kcmkwin/kwineffects/package/contents/ui/main.qml index 03967cc234..51d55c1f54 100644 --- a/kcmkwin/kwineffects/package/contents/ui/main.qml +++ b/kcmkwin/kwineffects/package/contents/ui/main.qml @@ -86,6 +86,8 @@ ScrollViewKCM { property var _buttonGroups: [] + clip: true + model: Private.EffectsFilterProxyModel { id: searchModel diff --git a/kcmkwin/kwinoptions/CMakeLists.txt b/kcmkwin/kwinoptions/CMakeLists.txt index dd7551fd72..a5f0ccf420 100644 --- a/kcmkwin/kwinoptions/CMakeLists.txt +++ b/kcmkwin/kwinoptions/CMakeLists.txt @@ -3,7 +3,7 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kcmkwm\") set(kcm_kwinoptions_PART_SRCS - ${KWIN_SOURCE_DIR}/effects/effect_builtins.cpp + ${KWin_SOURCE_DIR}/effects/effect_builtins.cpp main.cpp mouse.cpp windows.cpp @@ -17,7 +17,9 @@ ki18n_wrap_ui(kcm_kwinoptions_PART_SRCS moving.ui ) -qt5_add_dbus_interface(kcm_kwinoptions_PART_SRCS ${KWIN_SOURCE_DIR}/org.kde.kwin.Effects.xml kwin_effects_interface) +kconfig_add_kcfg_files(kcm_kwinoptions_PART_SRCS kwinoptions_settings.kcfgc GENERATE_MOC) + +qt5_add_dbus_interface(kcm_kwinoptions_PART_SRCS ${KWin_SOURCE_DIR}/org.kde.kwin.Effects.xml kwin_effects_interface) add_library(kcm_kwinoptions MODULE ${kcm_kwinoptions_PART_SRCS}) target_link_libraries(kcm_kwinoptions Qt5::DBus KF5::Completion KF5::I18n KF5::ConfigWidgets KF5::Service KF5::WindowSystem) install(TARGETS kcm_kwinoptions DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/kcmkwin/kwinoptions/advanced.ui b/kcmkwin/kwinoptions/advanced.ui index 9d9211084b..76c2f51144 100644 --- a/kcmkwin/kwinoptions/advanced.ui +++ b/kcmkwin/kwinoptions/advanced.ui @@ -20,14 +20,14 @@ Window &unshading: - shadeHoverOn + kcfg_ShadeHover - + <html><head/><body><p>If this option is enabled, a shaded window will unshade automatically when the mouse pointer has been over the titlebar for some time.</p></body></html> @@ -37,7 +37,7 @@ - + Sets the time in milliseconds before the window unshades when the mouse pointer goes over the shaded window. @@ -66,12 +66,12 @@ Window &placement: - placementCombo + kcfg_Placement - + <html><head/><body><p>The placement policy determines where a new window will appear on the desktop.</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Smart</span> will try to achieve a minimum overlap of windows</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Maximizing</span> will try to maximize every window to fill the whole screen. It might be useful to selectively affect placement of some windows using the window-specific settings.</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Cascade</span> will cascade the windows</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Random</span> will use a random position</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Centered</span> will place the window centered</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Zero-cornered</span> will place the window in the top-left corner</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Under mouse</span> will place the window under the pointer</li></ul></body></html> @@ -118,12 +118,12 @@ &Special windows: - hideUtilityWindowsForInactive + kcfg_HideUtilityWindowsForInactive - + When turned on, utility windows (tool windows, torn-off menus,...) of inactive applications will be hidden and will be shown only when the application becomes active. Note that applications have to mark the windows with the proper window type for this feature to work. diff --git a/kcmkwin/kwinoptions/kwinoptions_settings.kcfg b/kcmkwin/kwinoptions/kwinoptions_settings.kcfg new file mode 100644 index 0000000000..8a3a124aae --- /dev/null +++ b/kcmkwin/kwinoptions/kwinoptions_settings.kcfg @@ -0,0 +1,62 @@ + + + + + + + false + + + + 10 + 0 + 100 + + + + 10 + 0 + 100 + + + + 0 + 0 + 100 + + + + false + + + + false + + + + 250 + 0 + + + + + + + + + + + + + 0 + + + + true + + + + diff --git a/kcmkwin/kwinoptions/kwinoptions_settings.kcfgc b/kcmkwin/kwinoptions/kwinoptions_settings.kcfgc new file mode 100644 index 0000000000..7135009fb2 --- /dev/null +++ b/kcmkwin/kwinoptions/kwinoptions_settings.kcfgc @@ -0,0 +1,6 @@ +File=kwinoptions_settings.kcfg +ClassName=KWinOptionsSettings +Mutators=true +DefaultValueGetters=true +ParentInConstructor=true +Singleton=true diff --git a/kcmkwin/kwinoptions/main.cpp b/kcmkwin/kwinoptions/main.cpp index 66c03124d5..9c0b317e42 100644 --- a/kcmkwin/kwinoptions/main.cpp +++ b/kcmkwin/kwinoptions/main.cpp @@ -50,7 +50,7 @@ class KMovingConfigStandalone : public KMovingConfig Q_OBJECT public: KMovingConfigStandalone(QWidget* parent, const QVariantList &) - : KMovingConfig(true, new KConfig("kwinrc"), parent) + : KMovingConfig(true, parent) {} }; @@ -59,7 +59,7 @@ class KAdvancedConfigStandalone : public KAdvancedConfig Q_OBJECT public: KAdvancedConfigStandalone(QWidget* parent, const QVariantList &) - : KAdvancedConfig(true, new KConfig("kwinrc"), parent) + : KAdvancedConfig(true, parent) {} }; @@ -76,27 +76,29 @@ KWinOptions::KWinOptions(QWidget *parent, const QVariantList &) mFocus = new KFocusConfig(false, mConfig, this); mFocus->setObjectName(QLatin1String("KWin Focus Config")); tab->addTab(mFocus, i18n("&Focus")); - connect(mFocus, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool))); + connect(mFocus, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, this); mTitleBarActions->setObjectName(QLatin1String("KWin TitleBar Actions")); tab->addTab(mTitleBarActions, i18n("Titlebar A&ctions")); - connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool))); + connect(mTitleBarActions, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); mWindowActions = new KWindowActionsConfig(false, mConfig, this); mWindowActions->setObjectName(QLatin1String("KWin Window Actions")); tab->addTab(mWindowActions, i18n("W&indow Actions")); - connect(mWindowActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool))); + connect(mWindowActions, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); - mMoving = new KMovingConfig(false, mConfig, this); + mMoving = new KMovingConfig(false, this); mMoving->setObjectName(QLatin1String("KWin Moving")); tab->addTab(mMoving, i18n("Mo&vement")); - connect(mMoving, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool))); + connect(mMoving, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); + connect(mMoving, qOverload(&KCModule::defaulted), this, qOverload(&KCModule::defaulted)); - mAdvanced = new KAdvancedConfig(false, mConfig, this); + mAdvanced = new KAdvancedConfig(false, this); mAdvanced->setObjectName(QLatin1String("KWin Advanced")); tab->addTab(mAdvanced, i18n("Adva&nced")); - connect(mAdvanced, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool))); + connect(mAdvanced, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); + connect(mAdvanced, qOverload(&KCModule::defaulted), this, qOverload(&KCModule::defaulted)); KAboutData *about = new KAboutData(QStringLiteral("kcmkwinoptions"), i18n("Window Behavior Configuration Module"), @@ -189,12 +191,12 @@ KActionsOptions::KActionsOptions(QWidget *parent, const QVariantList &) mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, this); mTitleBarActions->setObjectName(QLatin1String("KWin TitleBar Actions")); tab->addTab(mTitleBarActions, i18n("&Titlebar Actions")); - connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool))); + connect(mTitleBarActions, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); mWindowActions = new KWindowActionsConfig(false, mConfig, this); mWindowActions->setObjectName(QLatin1String("KWin Window Actions")); tab->addTab(mWindowActions, i18n("Window Actio&ns")); - connect(mWindowActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool))); + connect(mWindowActions, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); } KActionsOptions::~KActionsOptions() @@ -230,6 +232,8 @@ void KActionsOptions::defaults() { mTitleBarActions->defaults(); mWindowActions->defaults(); + + emit defaulted(true); } void KActionsOptions::moduleChanged(bool state) diff --git a/kcmkwin/kwinoptions/moving.ui b/kcmkwin/kwinoptions/moving.ui index 97f38a8bdb..69019b3379 100644 --- a/kcmkwin/kwinoptions/moving.ui +++ b/kcmkwin/kwinoptions/moving.ui @@ -20,12 +20,12 @@ Window &geometry: - geometryTipOn + kcfg_GeometryTip - + Enable this option if you want a window's geometry to be displayed while it is being moved or resized. The window position relative to the top-left corner of the screen is displayed together with its size. @@ -40,12 +40,12 @@ Screen &edge snap zone: - borderSnap + kcfg_BorderSnapZone - + Here you can set the snap zone for screen edges, i.e. the 'strength' of the magnetic field which will make windows snap to the border when moved near it. @@ -67,7 +67,7 @@ - + Here you can set the snap zone for windows, i.e. the 'strength' of the magnetic field which will make windows snap to each other when they are moved near another window. @@ -89,7 +89,7 @@ - + Here you can set the snap zone for the screen center, i.e. the 'strength' of the magnetic field which will make windows snap to the center of the screen when moved near it. @@ -108,7 +108,7 @@ - + Here you can set that windows will be only snapped if you try to overlap them, i.e. they will not be snapped if the windows comes only near another window or border. @@ -123,7 +123,7 @@ &Window snap zone: - windowSnap + kcfg_WindowSnapZone @@ -133,7 +133,7 @@ &Center snap zone: - centerSnap + kcfg_CenterSnapZone @@ -143,7 +143,7 @@ &Snap windows: - OverlapSnap + kcfg_SnapOnlyWhenOverlapping diff --git a/kcmkwin/kwinoptions/windows.cpp b/kcmkwin/kwinoptions/windows.cpp index 559b9d796e..a05015031f 100644 --- a/kcmkwin/kwinoptions/windows.cpp +++ b/kcmkwin/kwinoptions/windows.cpp @@ -37,38 +37,21 @@ #include #include "windows.h" +#include "kwinoptions_settings.h" #include #include // kwin config keywords #define KWIN_FOCUS "FocusPolicy" -#define KWIN_PLACEMENT "Placement" -#define KWIN_GEOMETRY "GeometryTip" #define KWIN_AUTORAISE_INTERVAL "AutoRaiseInterval" #define KWIN_AUTORAISE "AutoRaise" #define KWIN_DELAYFOCUS_INTERVAL "DelayFocusInterval" #define KWIN_CLICKRAISE "ClickRaise" -#define KWIN_SHADEHOVER "ShadeHover" -#define KWIN_SHADEHOVER_INTERVAL "ShadeHoverInterval" #define KWIN_FOCUS_STEALING "FocusStealingPreventionLevel" -#define KWIN_HIDE_UTILITY "HideUtilityWindowsForInactive" #define KWIN_INACTIVE_SKIP_TASKBAR "InactiveTabsSkipTaskbar" #define KWIN_SEPARATE_SCREEN_FOCUS "SeparateScreenFocus" #define KWIN_ACTIVE_MOUSE_SCREEN "ActiveMouseScreen" -//CT 15mar 98 - magics -#define KWM_BRDR_SNAP_ZONE "BorderSnapZone" -#define KWM_BRDR_SNAP_ZONE_DEFAULT 10 -#define KWM_WNDW_SNAP_ZONE "WindowSnapZone" -#define KWM_WNDW_SNAP_ZONE_DEFAULT 10 -#define KWM_CNTR_SNAP_ZONE "CenterSnapZone" -#define KWM_CNTR_SNAP_ZONE_DEFAULT 0 - -#define MAX_BRDR_SNAP 100 -#define MAX_WNDW_SNAP 100 -#define MAX_CNTR_SNAP 100 -#define MAX_EDGE_RES 1000 - #define CLICK_TO_FOCUS 0 #define FOCUS_FOLLOWS_MOUSE 2 #define FOCUS_UNDER_MOUSE 4 @@ -169,22 +152,22 @@ void KFocusConfig::focusPolicyChanged() { switch (m_ui->windowFocusPolicyCombo->currentIndex()) { case 0: - m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("

Click to focus: A window becomes active when you click into it. This behavior is common on other operating systems and likely what you want.

")); + m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("Click to focus: A window becomes active when you click into it. This behavior is common on other operating systems and likely what you want.")); break; case 1: - m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("

Click to focus (mouse precedence): Mostly the same as Click to focus. If an active window has to be chosen by the system (eg. because the currently active one was closed) the window under the mouse is the preferred candidate. Unusual, but possible variant of Click to focus.

")); + m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("Click to focus (mouse precedence): Mostly the same as Click to focus. If an active window has to be chosen by the system (eg. because the currently active one was closed) the window under the mouse is the preferred candidate. Unusual, but possible variant of Click to focus.")); break; case 2: - m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("

Focus follows mouse: Moving the mouse onto a window will activate it. Eg. windows randomly appearing under the mouse will not gain the focus. Focus stealing prevention takes place as usual. Think as Click to focus just without having to actually click.

")); + m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("Focus follows mouse: Moving the mouse onto a window will activate it. Eg. windows randomly appearing under the mouse will not gain the focus. Focus stealing prevention takes place as usual. Think as Click to focus just without having to actually click.")); break; case 3: - m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("

This is mostly the same as Focus follows mouse. If an active window has to be chosen by the system (eg. because the currently active one was closed) the window under the mouse is the preferred candidate. Choose this, if you want a hover controlled focus.

")); + m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("This is mostly the same as Focus follows mouse. If an active window has to be chosen by the system (eg. because the currently active one was closed) the window under the mouse is the preferred candidate. Choose this, if you want a hover controlled focus.")); break; case 4: - m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("

Focus under mouse: The focus always remains on the window under the mouse.
Warning: Focus stealing prevention and the tabbox ('Alt+Tab') contradict the activation policy and will not work. You very likely want to use Focus follows mouse (mouse precedence) instead!

")); + m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("Focus under mouse: The focus always remains on the window under the mouse.
Warning: Focus stealing prevention and the tabbox ('Alt+Tab') contradict the activation policy and will not work. You very likely want to use Focus follows mouse (mouse precedence) instead!")); break; case 5: - m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("

Focus strictly under mouse: The focus is always on the window under the mouse (in doubt nowhere) very much like the focus behavior in an unmanaged legacy X11 environment.
Warning: Focus stealing prevention and the tabbox ('Alt+Tab') contradict the activation policy and will not work. You very likely want to use Focus follows mouse (mouse precedence) instead!

")); + m_ui->windowFocusPolicyDescriptionLabel->setText(i18n("Focus strictly under mouse: The focus is always on the window under the mouse (in doubt nowhere) very much like the focus behavior in an unmanaged legacy X11 environment.
Warning: Focus stealing prevention and the tabbox ('Alt+Tab') contradict the activation policy and will not work. You very likely want to use Focus follows mouse (mouse precedence) instead!")); break; } @@ -370,51 +353,22 @@ KWinAdvancedConfigForm::KWinAdvancedConfigForm(QWidget* parent) KAdvancedConfig::~KAdvancedConfig() { - if (standAlone) - delete config; } -KAdvancedConfig::KAdvancedConfig(bool _standAlone, KConfig *_config, QWidget *parent) - : KCModule(parent), config(_config), standAlone(_standAlone) +KAdvancedConfig::KAdvancedConfig(bool _standAlone, QWidget *parent) + : KCModule(parent), m_config(KWinOptionsSettings::self()), standAlone(_standAlone) , m_ui(new KWinAdvancedConfigForm(this)) { - m_ui->placementCombo->setItemData(0, "Smart"); - m_ui->placementCombo->setItemData(1, "Maximizing"); - m_ui->placementCombo->setItemData(2, "Cascade"); - m_ui->placementCombo->setItemData(3, "Random"); - m_ui->placementCombo->setItemData(4, "Centered"); - m_ui->placementCombo->setItemData(5, "ZeroCornered"); - m_ui->placementCombo->setItemData(6, "UnderMouse"); + addConfig(m_config, this); - connect(m_ui->shadeHoverOn, SIGNAL(toggled(bool)), this, SLOT(shadeHoverChanged(bool))); - connect(m_ui->shadeHoverOn, SIGNAL(toggled(bool)), SLOT(changed())); - connect(m_ui->shadeHover, SIGNAL(valueChanged(int)), SLOT(changed())); - connect(m_ui->placementCombo, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->hideUtilityWindowsForInactive, SIGNAL(toggled(bool)), SLOT(changed())); + m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Smart, "Smart"); + m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Maximizing, "Maximizing"); + m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Cascade, "Cascade"); + m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Random, "Random"); + m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Centered, "Centered"); + m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::ZeroCornered, "ZeroCornered"); + m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::UnderMouse, "UnderMouse"); load(); - -} - -void KAdvancedConfig::setShadeHover(bool on) -{ - m_ui->shadeHoverOn->setChecked(on); - m_ui->shadeHover->setEnabled(on); -} - -void KAdvancedConfig::setShadeHoverInterval(int k) -{ - m_ui->shadeHover->setValue(k); -} - -int KAdvancedConfig::getShadeHoverInterval() -{ - - return m_ui->shadeHover->value(); -} - -void KAdvancedConfig::shadeHoverChanged(bool a) -{ - m_ui->shadeHover->setEnabled(a); } void KAdvancedConfig::showEvent(QShowEvent *ev) @@ -426,62 +380,17 @@ void KAdvancedConfig::showEvent(QShowEvent *ev) KCModule::showEvent(ev); } -void KAdvancedConfig::load(void) -{ - KConfigGroup cg(config, "Windows"); - - setShadeHover(cg.readEntry(KWIN_SHADEHOVER, false)); - setShadeHoverInterval(cg.readEntry(KWIN_SHADEHOVER_INTERVAL, 250)); - - QString key; - key = cg.readEntry(KWIN_PLACEMENT); - int idx = m_ui->placementCombo->findData(key); - if (idx < 0) - idx = m_ui->placementCombo->findData("Smart"); - m_ui->placementCombo->setCurrentIndex(idx); - - setHideUtilityWindowsForInactive(cg.readEntry(KWIN_HIDE_UTILITY, true)); - - emit KCModule::changed(false); -} - void KAdvancedConfig::save(void) { - int v; - - KConfigGroup cg(config, "Windows"); - cg.writeEntry(KWIN_SHADEHOVER, m_ui->shadeHoverOn->isChecked()); - - v = getShadeHoverInterval(); - if (v < 0) v = 0; - cg.writeEntry(KWIN_SHADEHOVER_INTERVAL, v); - cg.writeEntry(KWIN_PLACEMENT, m_ui->placementCombo->itemData(m_ui->placementCombo->currentIndex()).toString()); - cg.writeEntry(KWIN_HIDE_UTILITY, m_ui->hideUtilityWindowsForInactive->isChecked()); + KCModule::save(); if (standAlone) { - config->sync(); // Send signal to all kwin instances QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); QDBusConnection::sessionBus().send(message); } - emit KCModule::changed(false); -} - -void KAdvancedConfig::defaults() -{ - setShadeHover(false); - setShadeHoverInterval(250); - m_ui->placementCombo->setCurrentIndex(0); // default to Smart - setHideUtilityWindowsForInactive(true); - emit KCModule::changed(true); -} - - -void KAdvancedConfig::setHideUtilityWindowsForInactive(bool s) -{ - m_ui->hideUtilityWindowsForInactive->setChecked(s); } KWinMovingConfigForm::KWinMovingConfigForm(QWidget* parent) @@ -492,34 +401,16 @@ KWinMovingConfigForm::KWinMovingConfigForm(QWidget* parent) KMovingConfig::~KMovingConfig() { - if (standAlone) - delete config; } -KMovingConfig::KMovingConfig(bool _standAlone, KConfig *_config, QWidget *parent) - : KCModule(parent), config(_config), standAlone(_standAlone) +KMovingConfig::KMovingConfig(bool _standAlone, QWidget *parent) + : KCModule(parent), m_config(KWinOptionsSettings::self()), standAlone(_standAlone) , m_ui(new KWinMovingConfigForm(this)) { - // Any changes goes to slotChanged() - connect(m_ui->geometryTipOn, SIGNAL(clicked()), SLOT(changed())); - connect(m_ui->borderSnap, SIGNAL(valueChanged(int)), SLOT(changed())); - connect(m_ui->windowSnap, SIGNAL(valueChanged(int)), SLOT(changed())); - connect(m_ui->centerSnap, SIGNAL(valueChanged(int)), SLOT(changed())); - connect(m_ui->OverlapSnap, SIGNAL(clicked()), SLOT(changed())); - + addConfig(m_config, this); load(); } -void KMovingConfig::setGeometryTip(bool showGeometryTip) -{ - m_ui->geometryTipOn->setChecked(showGeometryTip); -} - -bool KMovingConfig::getGeometryTip() -{ - return m_ui->geometryTipOn->isChecked(); -} - void KMovingConfig::showEvent(QShowEvent *ev) { if (!standAlone) { @@ -529,54 +420,11 @@ void KMovingConfig::showEvent(QShowEvent *ev) KCModule::showEvent(ev); } -void KMovingConfig::load(void) -{ - QString key; - - KConfigGroup cg(config, "Windows"); - - //KS 10Jan2003 - Geometry Tip during window move/resize - bool showGeomTip = cg.readEntry(KWIN_GEOMETRY, false); - setGeometryTip(showGeomTip); - - - int v; - - v = cg.readEntry(KWM_BRDR_SNAP_ZONE, KWM_BRDR_SNAP_ZONE_DEFAULT); - if (v > MAX_BRDR_SNAP) setBorderSnapZone(MAX_BRDR_SNAP); - else if (v < 0) setBorderSnapZone(0); - else setBorderSnapZone(v); - - v = cg.readEntry(KWM_WNDW_SNAP_ZONE, KWM_WNDW_SNAP_ZONE_DEFAULT); - if (v > MAX_WNDW_SNAP) setWindowSnapZone(MAX_WNDW_SNAP); - else if (v < 0) setWindowSnapZone(0); - else setWindowSnapZone(v); - - v = cg.readEntry(KWM_CNTR_SNAP_ZONE, KWM_CNTR_SNAP_ZONE_DEFAULT); - if (v > MAX_CNTR_SNAP) setCenterSnapZone(MAX_CNTR_SNAP); - else if (v < 0) setCenterSnapZone(0); - else setCenterSnapZone(v); - - m_ui->OverlapSnap->setChecked(cg.readEntry("SnapOnlyWhenOverlapping", false)); - emit KCModule::changed(false); -} - void KMovingConfig::save(void) { - KConfigGroup cg(config, "Windows"); - cg.writeEntry(KWIN_GEOMETRY, getGeometryTip()); - - - cg.writeEntry(KWM_BRDR_SNAP_ZONE, getBorderSnapZone()); - cg.writeEntry(KWM_WNDW_SNAP_ZONE, getWindowSnapZone()); - cg.writeEntry(KWM_CNTR_SNAP_ZONE, getCenterSnapZone()); - cg.writeEntry("SnapOnlyWhenOverlapping", m_ui->OverlapSnap->isChecked()); - - const bool geometryTip = getGeometryTip(); - KConfigGroup(config, "Plugins").writeEntry("windowgeometryEnabled", geometryTip); + m_config->save(); if (standAlone) { - config->sync(); // Send signal to all kwin instances QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); @@ -586,54 +434,9 @@ void KMovingConfig::save(void) OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"), QStringLiteral("/Effects"), QDBusConnection::sessionBus()); - if (geometryTip) { + if (m_config->geometryTip()) { interface.loadEffect(KWin::BuiltInEffects::nameForEffect(KWin::BuiltInEffect::WindowGeometry)); } else { interface.unloadEffect(KWin::BuiltInEffects::nameForEffect(KWin::BuiltInEffect::WindowGeometry)); } - emit KCModule::changed(false); } - -void KMovingConfig::defaults() -{ - setGeometryTip(false); - - //copied from kcontrol/konq/kwindesktop, aleXXX - setWindowSnapZone(KWM_WNDW_SNAP_ZONE_DEFAULT); - setBorderSnapZone(KWM_BRDR_SNAP_ZONE_DEFAULT); - setCenterSnapZone(KWM_CNTR_SNAP_ZONE_DEFAULT); - m_ui->OverlapSnap->setChecked(false); - - emit KCModule::changed(true); -} - -int KMovingConfig::getBorderSnapZone() -{ - return m_ui->borderSnap->value(); -} - -void KMovingConfig::setBorderSnapZone(int pxls) -{ - m_ui->borderSnap->setValue(pxls); -} - -int KMovingConfig::getWindowSnapZone() -{ - return m_ui->windowSnap->value(); -} - -void KMovingConfig::setWindowSnapZone(int pxls) -{ - m_ui->windowSnap->setValue(pxls); -} - -int KMovingConfig::getCenterSnapZone() -{ - return m_ui->centerSnap->value(); -} - -void KMovingConfig::setCenterSnapZone(int pxls) -{ - m_ui->centerSnap->setValue(pxls); -} - diff --git a/kcmkwin/kwinoptions/windows.h b/kcmkwin/kwinoptions/windows.h index 5e917beb25..80f6ac3d6c 100644 --- a/kcmkwin/kwinoptions/windows.h +++ b/kcmkwin/kwinoptions/windows.h @@ -41,6 +41,7 @@ class QSpinBox; class KColorButton; +class KWinOptionsSettings; class KWinFocusConfigForm : public QWidget, public Ui::KWinFocusConfigForm { @@ -118,71 +119,37 @@ class KMovingConfig : public KCModule { Q_OBJECT public: - KMovingConfig(bool _standAlone, KConfig *config, QWidget *parent); + KMovingConfig(bool _standAlone, QWidget *parent); ~KMovingConfig() override; - void load() override; void save() override; - void defaults() override; protected: void showEvent(QShowEvent *ev) override; -private Q_SLOTS: - void changed() { - emit KCModule::changed(true); - } - private: - bool getGeometryTip(void); //KS - - void setGeometryTip(bool); //KS - - KConfig *config; + KWinOptionsSettings *m_config; bool standAlone; KWinMovingConfigForm *m_ui; - - int getBorderSnapZone(); - void setBorderSnapZone(int); - int getWindowSnapZone(); - void setWindowSnapZone(int); - int getCenterSnapZone(); - void setCenterSnapZone(int); - }; class KAdvancedConfig : public KCModule { Q_OBJECT public: - KAdvancedConfig(bool _standAlone, KConfig *config, QWidget *parent); + KAdvancedConfig(bool _standAlone, QWidget *parent); ~KAdvancedConfig() override; - void load() override; void save() override; - void defaults() override; protected: void showEvent(QShowEvent *ev) override; -private Q_SLOTS: - void shadeHoverChanged(bool); - - void changed() { - emit KCModule::changed(true); - } - private: - int getShadeHoverInterval(void); - void setShadeHover(bool); - void setShadeHoverInterval(int); - - KConfig *config; + KWinOptionsSettings *m_config; bool standAlone; KWinAdvancedConfigForm *m_ui; - - void setHideUtilityWindowsForInactive(bool); }; #endif // KKWMWINDOWS_H diff --git a/kcmkwin/kwinrules/CMakeLists.txt b/kcmkwin/kwinrules/CMakeLists.txt index d8839c03d0..bee3e2ee27 100644 --- a/kcmkwin/kwinrules/CMakeLists.txt +++ b/kcmkwin/kwinrules/CMakeLists.txt @@ -6,13 +6,11 @@ add_definitions(-DKCMRULES) include_directories(../../) set(kwinrules_MOC_HDRS yesnobox.h ../../cursor.h ../../plugins/platforms/x11/standalone/x11cursor.h) qt5_wrap_cpp(kwinrules_MOC_SRCS ${kwinrules_MOC_HDRS}) -set(kwinrules_SRCS ruleswidget.cpp ruleslist.cpp kwinsrc.cpp detectwidget.cpp ${kwinrules_MOC_SRCS}) +set(kwinrules_SRCS ruleswidget.cpp ruleslist.cpp kwinsrc.cpp detectwidget.cpp main.cpp ${kwinrules_MOC_SRCS}) ki18n_wrap_ui(kwinrules_SRCS ruleslist.ui detectwidget.ui editshortcut.ui ruleswidgetbase.ui) -set(kwin_rules_dialog_KDEINIT_SRCS main.cpp ${kwinrules_SRCS}) - -kf5_add_kdeinit_executable(kwin_rules_dialog ${kwin_rules_dialog_KDEINIT_SRCS}) +add_executable(kwin_rules_dialog ${kwinrules_SRCS}) set(kwin_kcm_rules_XCB_LIBS XCB::CURSOR @@ -36,9 +34,8 @@ if (KWIN_BUILD_ACTIVITIES) set(kcm_libs ${kcm_libs} KF5::Activities) endif() -target_link_libraries(kdeinit_kwin_rules_dialog ${kcm_libs} ${kwin_kcm_rules_XCB_LIBS}) +target_link_libraries(kwin_rules_dialog ${kcm_libs} ${kwin_kcm_rules_XCB_LIBS}) -install(TARGETS kdeinit_kwin_rules_dialog ${INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS kwin_rules_dialog DESTINATION ${LIBEXEC_INSTALL_DIR}) ########### next target ############### diff --git a/kcmkwin/kwinrules/main.cpp b/kcmkwin/kwinrules/main.cpp index 02663ab476..f27a856337 100644 --- a/kcmkwin/kwinrules/main.cpp +++ b/kcmkwin/kwinrules/main.cpp @@ -233,8 +233,7 @@ static void edit(const QVariantMap &data, bool whole_app) } // namespace -extern "C" -KWIN_EXPORT int kdemain(int argc, char* argv[]) +int main(int argc, char* argv[]) { QApplication app(argc, argv); app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); diff --git a/kcmkwin/kwinscreenedges/CMakeLists.txt b/kcmkwin/kwinscreenedges/CMakeLists.txt index 6b8b6817b3..4210ad157c 100644 --- a/kcmkwin/kwinscreenedges/CMakeLists.txt +++ b/kcmkwin/kwinscreenedges/CMakeLists.txt @@ -1,12 +1,12 @@ # KI18N Translation Domain for this library add_definitions(-DTRANSLATION_DOMAIN=\"kcmkwinscreenedges\") -include_directories(${KWIN_SOURCE_DIR}/effects) +include_directories(${KWin_SOURCE_DIR}/effects) set(kcm_screenedges_SRCS monitor.cpp screenpreviewwidget.cpp ) -qt5_add_dbus_interface(kcm_screenedges_SRCS ${KWIN_SOURCE_DIR}/org.kde.kwin.Effects.xml kwin_effects_interface) +qt5_add_dbus_interface(kcm_screenedges_SRCS ${KWin_SOURCE_DIR}/org.kde.kwin.Effects.xml kwin_effects_interface) set(kcm_kwinscreenedges_PART_SRCS main.cpp ${kcm_screenedges_SRCS}) ki18n_wrap_ui(kcm_kwinscreenedges_PART_SRCS main.ui) diff --git a/kcmkwin/kwinscreenedges/kwintouchscreen.desktop b/kcmkwin/kwinscreenedges/kwintouchscreen.desktop index 84ef21262c..2099988fac 100644 --- a/kcmkwin/kwinscreenedges/kwintouchscreen.desktop +++ b/kcmkwin/kwinscreenedges/kwintouchscreen.desktop @@ -11,6 +11,7 @@ X-KDE-System-Settings-Parent-Category=desktopbehavior X-KDE-Weight=50 Name=Touch Screen +Name[ast]=Pantalla táutil Name[ca]=Pantalla tàctil Name[ca@valencia]=Pantalla tàctil Name[cs]=Dotyková obrazovka diff --git a/kcmkwin/kwintabbox/CMakeLists.txt b/kcmkwin/kwintabbox/CMakeLists.txt index 34a41731e3..da71fdcf14 100644 --- a/kcmkwin/kwintabbox/CMakeLists.txt +++ b/kcmkwin/kwintabbox/CMakeLists.txt @@ -1,20 +1,21 @@ # KI18N Translation Domain for this library add_definitions(-DTRANSLATION_DOMAIN=\"kcm_kwintabbox\") -include_directories(${KWIN_SOURCE_DIR}/effects ${KWIN_SOURCE_DIR}/tabbox ${KWIN_SOURCE_DIR}) +include_directories(${KWin_SOURCE_DIR}/effects ${KWin_SOURCE_DIR}/tabbox ${KWin_SOURCE_DIR}) ########### next target ############### set(kcm_kwintabbox_PART_SRCS - ${KWIN_SOURCE_DIR}/tabbox/tabboxconfig.cpp + ${KWin_SOURCE_DIR}/tabbox/tabboxconfig.cpp layoutpreview.cpp main.cpp thumbnailitem.cpp ) ki18n_wrap_ui(kcm_kwintabbox_PART_SRCS main.ui) -qt5_add_dbus_interface(kcm_kwintabbox_PART_SRCS ${KWIN_SOURCE_DIR}/org.kde.kwin.Effects.xml kwin_effects_interface) +qt5_add_dbus_interface(kcm_kwintabbox_PART_SRCS ${KWin_SOURCE_DIR}/org.kde.kwin.Effects.xml kwin_effects_interface) +kconfig_add_kcfg_files(kcm_kwintabbox_PART_SRCS kwintabboxsettings.kcfgc kwinswitcheffectsettings.kcfgc kwinpluginssettings.kcfgc) add_library(kcm_kwintabbox MODULE ${kcm_kwintabbox_PART_SRCS}) target_link_libraries(kcm_kwintabbox diff --git a/kcmkwin/kwintabbox/kwinpluginssettings.kcfg b/kcmkwin/kwintabbox/kwinpluginssettings.kcfg new file mode 100644 index 0000000000..26415ef7eb --- /dev/null +++ b/kcmkwin/kwintabbox/kwinpluginssettings.kcfg @@ -0,0 +1,18 @@ + + + + + + BuiltInEffects::enabledByDefault(BuiltInEffect::CoverSwitch) + + + BuiltInEffects::enabledByDefault(BuiltInEffect::FlipSwitch) + + + false + + + diff --git a/kcmkwin/kwintabbox/kwinpluginssettings.kcfgc b/kcmkwin/kwintabbox/kwinpluginssettings.kcfgc new file mode 100644 index 0000000000..93564cdb6c --- /dev/null +++ b/kcmkwin/kwintabbox/kwinpluginssettings.kcfgc @@ -0,0 +1,7 @@ +File=kwinpluginssettings.kcfg +NameSpace=KWin::TabBox +ClassName=PluginsSettings +IncludeFiles=effect_builtins.h +Mutators=true +DefaultValueGetters=true +ParentInConstructor=true diff --git a/kcmkwin/kwintabbox/kwinswitcheffectsettings.kcfg b/kcmkwin/kwintabbox/kwinswitcheffectsettings.kcfg new file mode 100644 index 0000000000..ac7450b3c7 --- /dev/null +++ b/kcmkwin/kwintabbox/kwinswitcheffectsettings.kcfg @@ -0,0 +1,17 @@ + + + + + + + + false + + + false + + + diff --git a/kcmkwin/kwintabbox/kwinswitcheffectsettings.kcfgc b/kcmkwin/kwintabbox/kwinswitcheffectsettings.kcfgc new file mode 100644 index 0000000000..3ee296287f --- /dev/null +++ b/kcmkwin/kwintabbox/kwinswitcheffectsettings.kcfgc @@ -0,0 +1,6 @@ +File=kwinswitcheffectsettings.kcfg +NameSpace=KWin::TabBox +ClassName=SwitchEffectSettings +Mutators=true +DefaultValueGetters=true +ParentInConstructor=true diff --git a/kcmkwin/kwintabbox/kwintabboxsettings.kcfg b/kcmkwin/kwintabbox/kwintabboxsettings.kcfg new file mode 100644 index 0000000000..01cf73b754 --- /dev/null +++ b/kcmkwin/kwintabbox/kwintabboxsettings.kcfg @@ -0,0 +1,41 @@ + + + + + + + + TabBoxConfig::defaultDesktopMode() + + + TabBoxConfig::defaultActivitiesMode() + + + TabBoxConfig::defaultApplicationsMode() + + + TabBoxConfig::defaultMinimizedMode() + + + TabBoxConfig::defaultShowDesktopMode() + + + TabBoxConfig::defaultMultiScreenMode() + + + TabBoxConfig::defaultSwitchingMode() + + + TabBoxConfig::defaultLayoutName() + + + TabBoxConfig::defaultShowTabBox() + + + TabBoxConfig::defaultHighlightWindow() + + + diff --git a/kcmkwin/kwintabbox/kwintabboxsettings.kcfgc b/kcmkwin/kwintabbox/kwintabboxsettings.kcfgc new file mode 100644 index 0000000000..2f570c90b8 --- /dev/null +++ b/kcmkwin/kwintabbox/kwintabboxsettings.kcfgc @@ -0,0 +1,7 @@ +File=kwintabboxsettings.kcfg +NameSpace=KWin::TabBox +ClassName=TabBoxSettings +IncludeFiles=\"tabboxconfig.h\" +Mutators=true +DefaultValueGetters=true +ParentInConstructor=true diff --git a/kcmkwin/kwintabbox/main.cpp b/kcmkwin/kwintabbox/main.cpp index e20060803b..84d41ef1f0 100644 --- a/kcmkwin/kwintabbox/main.cpp +++ b/kcmkwin/kwintabbox/main.cpp @@ -3,6 +3,7 @@ This file is part of the KDE project. Copyright (C) 2009 Martin Gräßlin +Copyright (C) 2020 Cyril Rossi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,8 +49,10 @@ along with this program. If not, see . #include // own -#include "tabboxconfig.h" #include "layoutpreview.h" +#include "kwintabboxsettings.h" +#include "kwinswitcheffectsettings.h" +#include "kwinpluginssettings.h" K_PLUGIN_FACTORY(KWinTabBoxConfigFactory, registerPlugin();) @@ -67,6 +70,11 @@ KWinTabBoxConfigForm::KWinTabBoxConfigForm(QWidget* parent) KWinTabBoxConfig::KWinTabBoxConfig(QWidget* parent, const QVariantList& args) : KCModule(parent, args) , m_config(KSharedConfig::openConfig("kwinrc")) + , m_tabBoxConfig(new TabBoxSettings(QStringLiteral("TabBox"), this)) + , m_tabBoxAlternativeConfig(new TabBoxSettings(QStringLiteral("TabBoxAlternative"), this)) + , m_coverSwitchConfig(new SwitchEffectSettings(QStringLiteral("Effect-CoverSwitch"), this)) + , m_flipSwitchConfig(new SwitchEffectSettings(QStringLiteral("Effect-FlipSwitch"), this)) + , m_pluginsConfig(new PluginsSettings(this)) { QTabWidget* tabWidget = new QTabWidget(this); m_primaryTabBoxUi = new KWinTabBoxConfigForm(tabWidget); @@ -163,8 +171,9 @@ KWinTabBoxConfig::KWinTabBoxConfig(QWidget* parent, const QVariantList& args) if ((policy == "FocusUnderMouse") || (policy == "FocusStrictlyUnderMouse")) { tabWidget->setEnabled(false); infoLabel->show(); - } else + } else { infoLabel->hide(); + } } KWinTabBoxConfig::~KWinTabBoxConfig() @@ -263,22 +272,36 @@ void KWinTabBoxConfig::load() { KCModule::load(); - const QString group[2] = { "TabBox", "TabBoxAlternative" }; + m_tabBoxConfig->load(); + m_tabBoxAlternativeConfig->load(); + + m_coverSwitchConfig->load(); + m_flipSwitchConfig->load(); + + m_pluginsConfig->load(); + + updateUiFromConfig(m_primaryTabBoxUi, m_tabBoxConfig); + updateUiFromConfig(m_alternativeTabBoxUi , m_tabBoxAlternativeConfig); + + if (m_pluginsConfig->coverswitchEnabled()) { + if (m_coverSwitchConfig->tabBox()) { + m_primaryTabBoxUi->effectCombo->setCurrentIndex(CoverSwitch); + } + if (m_coverSwitchConfig->tabBoxAlternative()) { + m_alternativeTabBoxUi->effectCombo->setCurrentIndex(CoverSwitch); + } + } + if (m_pluginsConfig->flipswitchEnabled()) { + if (m_flipSwitchConfig->tabBox()) { + m_primaryTabBoxUi->effectCombo->setCurrentIndex(FlipSwitch); + } + if (m_flipSwitchConfig->tabBoxAlternative()) { + m_alternativeTabBoxUi->effectCombo->setCurrentIndex(FlipSwitch); + } + } + KWinTabBoxConfigForm* ui[2] = { m_primaryTabBoxUi, m_alternativeTabBoxUi }; - TabBoxConfig *tabBoxConfig[2] = { &m_tabBoxConfig, &m_tabBoxAlternativeConfig }; - for (int i = 0; i < 2; ++i) { - KConfigGroup config(m_config, group[i]); - loadConfig(config, *(tabBoxConfig[i])); - - updateUiFromConfig(ui[i], *(tabBoxConfig[i])); - - KConfigGroup effectconfig(m_config, "Plugins"); - if (effectEnabled(BuiltInEffect::CoverSwitch, effectconfig) && KConfigGroup(m_config, "Effect-CoverSwitch").readEntry(group[i], false)) - ui[i]->effectCombo->setCurrentIndex(CoverSwitch); - else if (effectEnabled(BuiltInEffect::FlipSwitch, effectconfig) && KConfigGroup(m_config, "Effect-FlipSwitch").readEntry(group[i], false)) - ui[i]->effectCombo->setCurrentIndex(FlipSwitch); - QString action; #define LOAD_SHORTCUT(_BTN_)\ action = ui[i]->_BTN_->property("shortcutAction").toString();\ @@ -297,59 +320,15 @@ void KWinTabBoxConfig::load() emit changed(false); } -void KWinTabBoxConfig::loadConfig(const KConfigGroup& config, KWin::TabBox::TabBoxConfig& tabBoxConfig) -{ - tabBoxConfig.setClientDesktopMode(TabBoxConfig::ClientDesktopMode( - config.readEntry("DesktopMode", TabBoxConfig::defaultDesktopMode()))); - tabBoxConfig.setClientActivitiesMode(TabBoxConfig::ClientActivitiesMode( - config.readEntry("ActivitiesMode", TabBoxConfig::defaultActivitiesMode()))); - tabBoxConfig.setClientApplicationsMode(TabBoxConfig::ClientApplicationsMode( - config.readEntry("ApplicationsMode", TabBoxConfig::defaultApplicationsMode()))); - tabBoxConfig.setClientMinimizedMode(TabBoxConfig::ClientMinimizedMode( - config.readEntry("MinimizedMode", TabBoxConfig::defaultMinimizedMode()))); - tabBoxConfig.setShowDesktopMode(TabBoxConfig::ShowDesktopMode( - config.readEntry("ShowDesktopMode", TabBoxConfig::defaultShowDesktopMode()))); - tabBoxConfig.setClientMultiScreenMode(TabBoxConfig::ClientMultiScreenMode( - config.readEntry("MultiScreenMode", TabBoxConfig::defaultMultiScreenMode()))); - tabBoxConfig.setClientSwitchingMode(TabBoxConfig::ClientSwitchingMode( - config.readEntry("SwitchingMode", TabBoxConfig::defaultSwitchingMode()))); - - tabBoxConfig.setShowTabBox(config.readEntry("ShowTabBox", TabBoxConfig::defaultShowTabBox())); - tabBoxConfig.setHighlightWindows(config.readEntry("HighlightWindows", TabBoxConfig::defaultHighlightWindow())); - - tabBoxConfig.setLayoutName(config.readEntry("LayoutName", TabBoxConfig::defaultLayoutName())); -} - -void KWinTabBoxConfig::saveConfig(KConfigGroup& config, const KWin::TabBox::TabBoxConfig& tabBoxConfig) -{ - // combo boxes - config.writeEntry("DesktopMode", int(tabBoxConfig.clientDesktopMode())); - config.writeEntry("ActivitiesMode", int(tabBoxConfig.clientActivitiesMode())); - config.writeEntry("ApplicationsMode", int(tabBoxConfig.clientApplicationsMode())); - config.writeEntry("MinimizedMode", int(tabBoxConfig.clientMinimizedMode())); - config.writeEntry("ShowDesktopMode", int(tabBoxConfig.showDesktopMode())); - config.writeEntry("MultiScreenMode", int(tabBoxConfig.clientMultiScreenMode())); - config.writeEntry("SwitchingMode", int(tabBoxConfig.clientSwitchingMode())); - config.writeEntry("LayoutName", tabBoxConfig.layoutName()); - - // check boxes - config.writeEntry("ShowTabBox", tabBoxConfig.isShowTabBox()); - config.writeEntry("HighlightWindows", tabBoxConfig.isHighlightWindows()); - - config.sync(); -} - void KWinTabBoxConfig::save() { KCModule::save(); - KConfigGroup config(m_config, "TabBox"); // sync ui to config updateConfigFromUi(m_primaryTabBoxUi, m_tabBoxConfig); updateConfigFromUi(m_alternativeTabBoxUi, m_tabBoxAlternativeConfig); - saveConfig(config, m_tabBoxConfig); - config = KConfigGroup(m_config, "TabBoxAlternative"); - saveConfig(config, m_tabBoxAlternativeConfig); + m_tabBoxConfig->save(); + m_tabBoxAlternativeConfig->save(); // effects bool highlightWindows = m_primaryTabBoxUi->highlightWindowCheck->isChecked() || @@ -364,22 +343,24 @@ void KWinTabBoxConfig::save() m_alternativeTabBoxUi->effectCombo->currentIndex() == FlipSwitch; // activate effects if not active - KConfigGroup effectconfig(m_config, "Plugins"); - if (coverSwitch || coverSwitchAlternative) - effectconfig.writeEntry("coverswitchEnabled", true); - if (flipSwitch || flipSwitchAlternative) - effectconfig.writeEntry("flipswitchEnabled", true); - if (highlightWindows) - effectconfig.writeEntry("highlightwindowEnabled", true); - effectconfig.sync(); - KConfigGroup coverswitchconfig(m_config, "Effect-CoverSwitch"); - coverswitchconfig.writeEntry("TabBox", coverSwitch); - coverswitchconfig.writeEntry("TabBoxAlternative", coverSwitchAlternative); - coverswitchconfig.sync(); - KConfigGroup flipswitchconfig(m_config, "Effect-FlipSwitch"); - flipswitchconfig.writeEntry("TabBox", flipSwitch); - flipswitchconfig.writeEntry("TabBoxAlternative", flipSwitchAlternative); - flipswitchconfig.sync(); + if (coverSwitch || coverSwitchAlternative) { + m_pluginsConfig->setCoverswitchEnabled(true); + } + if (flipSwitch || flipSwitchAlternative) { + m_pluginsConfig->setFlipswitchEnabled(true); + } + if (highlightWindows) { + m_pluginsConfig->setHighlightwindowEnabled(true); + } + m_pluginsConfig->save(); + + m_coverSwitchConfig->setTabBox(coverSwitch); + m_coverSwitchConfig->setTabBoxAlternative(coverSwitchAlternative); + m_coverSwitchConfig->save(); + + m_flipSwitchConfig->setTabBox(flipSwitch); + m_flipSwitchConfig->setTabBoxAlternative(flipSwitchAlternative); + m_flipSwitchConfig->save(); // Reload KWin. QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); @@ -396,35 +377,17 @@ void KWinTabBoxConfig::save() void KWinTabBoxConfig::defaults() { - const KWinTabBoxConfigForm* ui[2] = { m_primaryTabBoxUi, m_alternativeTabBoxUi}; - for (int i = 0; i < 2; ++i) { - // combo boxes -#define CONFIGURE(SETTING, MODE, IS, VALUE) \ - ui[i]->SETTING->setChecked(TabBoxConfig::default##MODE##Mode() IS TabBoxConfig::VALUE) - CONFIGURE(filterDesktops, Desktop, !=, AllDesktopsClients); - CONFIGURE(currentDesktop, Desktop, ==, OnlyCurrentDesktopClients); - CONFIGURE(otherDesktops, Desktop, ==, ExcludeCurrentDesktopClients); - CONFIGURE(filterActivities, Activities, !=, AllActivitiesClients); - CONFIGURE(currentActivity, Activities, ==, OnlyCurrentActivityClients); - CONFIGURE(otherActivities, Activities, ==, ExcludeCurrentActivityClients); - CONFIGURE(filterScreens, MultiScreen, !=, IgnoreMultiScreen); - CONFIGURE(currentScreen, MultiScreen, ==, OnlyCurrentScreenClients); - CONFIGURE(otherScreens, MultiScreen, ==, ExcludeCurrentScreenClients); - CONFIGURE(oneAppWindow, Applications, ==, OneWindowPerApplication); - CONFIGURE(filterMinimization, Minimized, !=, IgnoreMinimizedStatus); - CONFIGURE(visibleWindows, Minimized, ==, ExcludeMinimizedClients); - CONFIGURE(hiddenWindows, Minimized, ==, OnlyMinimizedClients); + KCModule::defaults(); - ui[i]->switchingModeCombo->setCurrentIndex(TabBoxConfig::defaultSwitchingMode()); + m_tabBoxConfig->setDefaults(); + m_tabBoxAlternativeConfig->setDefaults(); - // checkboxes - ui[i]->showTabBox->setChecked(TabBoxConfig::defaultShowTabBox()); - ui[i]->highlightWindowCheck->setChecked(TabBoxConfig::defaultHighlightWindow()); - CONFIGURE(showDesktop, ShowDesktop, ==, ShowDesktopClient); -#undef CONFIGURE - // effects - ui[i]->effectCombo->setCurrentIndex(ui[i]->effectCombo->findData("sidebar")); - } + m_pluginsConfig->setDefaults(); + m_coverSwitchConfig->setDefaults(); + m_flipSwitchConfig->setDefaults(); + + updateUiFromConfig(m_primaryTabBoxUi, m_tabBoxConfig); + updateUiFromConfig(m_alternativeTabBoxUi, m_tabBoxAlternativeConfig); QString action; auto RESET_SHORTCUT = [this](KKeySequenceWidget *widget, const QKeySequence &sequence = QKeySequence()) { @@ -444,66 +407,65 @@ void KWinTabBoxConfig::defaults() emit changed(true); } -bool KWinTabBoxConfig::effectEnabled(const BuiltInEffect& effect, const KConfigGroup& cfg) const +void KWinTabBoxConfig::updateUiFromConfig(KWinTabBoxConfigForm *ui, const KWin::TabBox::TabBoxSettings *config) { - return cfg.readEntry(BuiltInEffects::nameForEffect(effect) + "Enabled", BuiltInEffects::enabledByDefault(effect)); -} +#define CONFIGURE(SETTING, MODE, IS, VALUE) ui->SETTING->setChecked(config->MODE##Mode() IS TabBoxConfig::VALUE) + CONFIGURE(filterDesktops, desktop, !=, AllDesktopsClients); + CONFIGURE(currentDesktop, desktop, ==, OnlyCurrentDesktopClients); + CONFIGURE(otherDesktops, desktop, ==, ExcludeCurrentDesktopClients); + CONFIGURE(filterActivities, activities, !=, AllActivitiesClients); + CONFIGURE(currentActivity, activities, ==, OnlyCurrentActivityClients); + CONFIGURE(otherActivities, activities, ==, ExcludeCurrentActivityClients); + CONFIGURE(filterScreens, multiScreen, !=, IgnoreMultiScreen); + CONFIGURE(currentScreen, multiScreen, ==, OnlyCurrentScreenClients); + CONFIGURE(otherScreens, multiScreen, ==, ExcludeCurrentScreenClients); + CONFIGURE(oneAppWindow, applications, ==, OneWindowPerApplication); + CONFIGURE(filterMinimization, minimized, !=, IgnoreMinimizedStatus); + CONFIGURE(visibleWindows, minimized, ==, ExcludeMinimizedClients); + CONFIGURE(hiddenWindows, minimized, ==, OnlyMinimizedClients); -void KWinTabBoxConfig::updateUiFromConfig(KWinTabBoxConfigForm* ui, const KWin::TabBox::TabBoxConfig& config) -{ -#define CONFIGURE(SETTING, MODE, IS, VALUE) ui->SETTING->setChecked(config.MODE##Mode() IS TabBoxConfig::VALUE) - CONFIGURE(filterDesktops, clientDesktop, !=, AllDesktopsClients); - CONFIGURE(currentDesktop, clientDesktop, ==, OnlyCurrentDesktopClients); - CONFIGURE(otherDesktops, clientDesktop, ==, ExcludeCurrentDesktopClients); - CONFIGURE(filterActivities, clientActivities, !=, AllActivitiesClients); - CONFIGURE(currentActivity, clientActivities, ==, OnlyCurrentActivityClients); - CONFIGURE(otherActivities, clientActivities, ==, ExcludeCurrentActivityClients); - CONFIGURE(filterScreens, clientMultiScreen, !=, IgnoreMultiScreen); - CONFIGURE(currentScreen, clientMultiScreen, ==, OnlyCurrentScreenClients); - CONFIGURE(otherScreens, clientMultiScreen, ==, ExcludeCurrentScreenClients); - CONFIGURE(oneAppWindow, clientApplications, ==, OneWindowPerApplication); - CONFIGURE(filterMinimization, clientMinimized, !=, IgnoreMinimizedStatus); - CONFIGURE(visibleWindows, clientMinimized, ==, ExcludeMinimizedClients); - CONFIGURE(hiddenWindows, clientMinimized, ==, OnlyMinimizedClients); - - ui->switchingModeCombo->setCurrentIndex(config.clientSwitchingMode()); + ui->switchingModeCombo->setCurrentIndex(config->switchingMode()); // check boxes - ui->showTabBox->setChecked(config.isShowTabBox()); - ui->highlightWindowCheck->setChecked(config.isHighlightWindows()); - ui->effectCombo->setCurrentIndex(ui->effectCombo->findData(config.layoutName())); + ui->showTabBox->setChecked(config->showTabBox()); + ui->highlightWindowCheck->setChecked(config->highlightWindows()); + ui->effectCombo->setCurrentIndex(ui->effectCombo->findData(config->layoutName())); CONFIGURE(showDesktop, showDesktop, ==, ShowDesktopClient); #undef CONFIGURE } -void KWinTabBoxConfig::updateConfigFromUi(const KWin::KWinTabBoxConfigForm* ui, TabBox::TabBoxConfig& config) +void KWinTabBoxConfig::updateConfigFromUi(const KWin::KWinTabBoxConfigForm *ui, TabBoxSettings *config) { - if (ui->filterDesktops->isChecked()) - config.setClientDesktopMode(ui->currentDesktop->isChecked() ? TabBoxConfig::OnlyCurrentDesktopClients : TabBoxConfig::ExcludeCurrentDesktopClients); - else - config.setClientDesktopMode(TabBoxConfig::AllDesktopsClients); - if (ui->filterActivities->isChecked()) - config.setClientActivitiesMode(ui->currentActivity->isChecked() ? TabBoxConfig::OnlyCurrentActivityClients : TabBoxConfig::ExcludeCurrentActivityClients); - else - config.setClientActivitiesMode(TabBoxConfig::AllActivitiesClients); - if (ui->filterScreens->isChecked()) - config.setClientMultiScreenMode(ui->currentScreen->isChecked() ? TabBoxConfig::OnlyCurrentScreenClients : TabBoxConfig::ExcludeCurrentScreenClients); - else - config.setClientMultiScreenMode(TabBoxConfig::IgnoreMultiScreen); - config.setClientApplicationsMode(ui->oneAppWindow->isChecked() ? TabBoxConfig::OneWindowPerApplication : TabBoxConfig::AllWindowsAllApplications); - if (ui->filterMinimization->isChecked()) - config.setClientMinimizedMode(ui->visibleWindows->isChecked() ? TabBoxConfig::ExcludeMinimizedClients : TabBoxConfig::OnlyMinimizedClients); - else - config.setClientMinimizedMode(TabBoxConfig::IgnoreMinimizedStatus); - - config.setClientSwitchingMode(TabBoxConfig::ClientSwitchingMode(ui->switchingModeCombo->currentIndex())); - - config.setShowTabBox(ui->showTabBox->isChecked()); - config.setHighlightWindows(ui->highlightWindowCheck->isChecked()); - if (ui->effectCombo->currentIndex() >= Layout) { - config.setLayoutName(ui->effectCombo->itemData(ui->effectCombo->currentIndex()).toString()); + if (ui->filterDesktops->isChecked()) { + config->setDesktopMode(ui->currentDesktop->isChecked() ? TabBoxConfig::OnlyCurrentDesktopClients : TabBoxConfig::ExcludeCurrentDesktopClients); + } else { + config->setDesktopMode(TabBoxConfig::AllDesktopsClients); } - config.setShowDesktopMode(ui->showDesktop->isChecked() ? TabBoxConfig::ShowDesktopClient : TabBoxConfig::DoNotShowDesktopClient); + if (ui->filterActivities->isChecked()) { + config->setActivitiesMode(ui->currentActivity->isChecked() ? TabBoxConfig::OnlyCurrentActivityClients : TabBoxConfig::ExcludeCurrentActivityClients); + } else { + config->setActivitiesMode(TabBoxConfig::AllActivitiesClients); + } + if (ui->filterScreens->isChecked()) { + config->setMultiScreenMode(ui->currentScreen->isChecked() ? TabBoxConfig::OnlyCurrentScreenClients : TabBoxConfig::ExcludeCurrentScreenClients); + } else { + config->setMultiScreenMode(TabBoxConfig::IgnoreMultiScreen); + } + config->setApplicationsMode(ui->oneAppWindow->isChecked() ? TabBoxConfig::OneWindowPerApplication : TabBoxConfig::AllWindowsAllApplications); + if (ui->filterMinimization->isChecked()) { + config->setMinimizedMode(ui->visibleWindows->isChecked() ? TabBoxConfig::ExcludeMinimizedClients : TabBoxConfig::OnlyMinimizedClients); + } else { + config->setMinimizedMode(TabBoxConfig::IgnoreMinimizedStatus); + } + + config->setSwitchingMode(TabBoxConfig::ClientSwitchingMode(ui->switchingModeCombo->currentIndex())); + + config->setShowTabBox(ui->showTabBox->isChecked()); + config->setHighlightWindows(ui->highlightWindowCheck->isChecked()); + if (ui->effectCombo->currentIndex() >= Layout) { + config->setLayoutName(ui->effectCombo->itemData(ui->effectCombo->currentIndex()).toString()); + } + config->setShowDesktopMode(ui->showDesktop->isChecked() ? TabBoxConfig::ShowDesktopClient : TabBoxConfig::DoNotShowDesktopClient); } #define CHECK_CURRENT_TABBOX_UI \ @@ -523,7 +485,8 @@ void KWinTabBoxConfig::effectSelectionChanged(int index) ui->highlightWindowCheck->setEnabled(index >= Layout); } -void KWinTabBoxConfig::tabBoxToggled(bool on) { +void KWinTabBoxConfig::tabBoxToggled(bool on) +{ CHECK_CURRENT_TABBOX_UI on = !on || ui->effectCombo->currentIndex() >= Layout; ui->highlightWindowCheck->setEnabled(on); diff --git a/kcmkwin/kwintabbox/main.h b/kcmkwin/kwintabbox/main.h index e167e83459..a6d9629620 100644 --- a/kcmkwin/kwintabbox/main.h +++ b/kcmkwin/kwintabbox/main.h @@ -3,6 +3,7 @@ This file is part of the KDE project. Copyright (C) 2009 Martin Gräßlin +Copyright (C) 2020 Cyril Rossi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +24,6 @@ along with this program. If not, see . #include #include -#include "tabboxconfig.h" #include "ui_main.h" @@ -35,7 +35,9 @@ namespace KWin enum class BuiltInEffect; namespace TabBox { - +class TabBoxSettings; +class SwitchEffectSettings; +class PluginsSettings; } @@ -68,10 +70,8 @@ private Q_SLOTS: void shortcutChanged(const QKeySequence &seq); void slotGHNS(); private: - void updateUiFromConfig(KWinTabBoxConfigForm* ui, const TabBox::TabBoxConfig& config); - void updateConfigFromUi(const KWinTabBoxConfigForm* ui, TabBox::TabBoxConfig& config); - void loadConfig(const KConfigGroup& config, KWin::TabBox::TabBoxConfig& tabBoxConfig); - void saveConfig(KConfigGroup& config, const KWin::TabBox::TabBoxConfig& tabBoxConfig); + void updateUiFromConfig(KWinTabBoxConfigForm *ui, const TabBox::TabBoxSettings *config); + void updateConfigFromUi(const KWinTabBoxConfigForm *ui, TabBox::TabBoxSettings *config); void initLayoutLists(); private: @@ -85,10 +85,12 @@ private: KSharedConfigPtr m_config; KActionCollection* m_actionCollection; KShortcutsEditor* m_editor; - TabBox::TabBoxConfig m_tabBoxConfig; - TabBox::TabBoxConfig m_tabBoxAlternativeConfig; + TabBox::TabBoxSettings *m_tabBoxConfig; + TabBox::TabBoxSettings *m_tabBoxAlternativeConfig; + TabBox::SwitchEffectSettings *m_coverSwitchConfig; + TabBox::SwitchEffectSettings *m_flipSwitchConfig; + TabBox::PluginsSettings *m_pluginsConfig; - bool effectEnabled(const BuiltInEffect& effect, const KConfigGroup& cfg) const; }; } // namespace diff --git a/layers.cpp b/layers.cpp index 151ff9dfc5..3b68f84d28 100644 --- a/layers.cpp +++ b/layers.cpp @@ -222,8 +222,10 @@ void Workspace::propagateClients(bool propagate_new_clients) cl = new xcb_window_t[ manual_overlays.count() + stacking_order.count()]; pos = 0; for (auto it = stacking_order.constBegin(); it != stacking_order.constEnd(); ++it) { - if ((*it)->isClient()) - cl[pos++] = (*it)->window(); + X11Client *client = qobject_cast(*it); + if (client) { + cl[pos++] = client->window(); + } } for (const auto win : manual_overlays) { cl[pos++] = win; @@ -851,14 +853,6 @@ void X11Client::restackWindow(xcb_window_t above, int detail, NET::RequestSource sendSyntheticConfigureNotify(); } -void X11Client::doSetKeepAbove() -{ -} - -void X11Client::doSetKeepBelow() -{ -} - bool X11Client::belongsToDesktop() const { foreach (const X11Client *c, group()->members()) { diff --git a/libkwineffects/kwineffectquickview.cpp b/libkwineffects/kwineffectquickview.cpp index b57d69e102..0e7390f478 100644 --- a/libkwineffects/kwineffectquickview.cpp +++ b/libkwineffects/kwineffectquickview.cpp @@ -346,12 +346,14 @@ EffectQuickScene::EffectQuickScene(QObject *parent) : EffectQuickView(parent) , d(new EffectQuickScene::Private) { + d->qmlObject = new KDeclarative::QmlObjectSharedEngine(this); } EffectQuickScene::EffectQuickScene(QObject *parent, EffectQuickView::ExportMode exportMode) : EffectQuickView(parent, exportMode) , d(new EffectQuickScene::Private) { + d->qmlObject = new KDeclarative::QmlObjectSharedEngine(this); } EffectQuickScene::~EffectQuickScene() @@ -360,9 +362,6 @@ EffectQuickScene::~EffectQuickScene() void EffectQuickScene::setSource(const QUrl &source) { - if (!d->qmlObject) { - d->qmlObject = new KDeclarative::QmlObjectSharedEngine(this); - } d->qmlObject->setSource(source); QQuickItem *item = rootItem(); diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 7bac73f49a..e82612b0af 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -1519,6 +1519,13 @@ Q_SIGNALS: * @since 4.7 */ void windowGeometryShapeChanged(KWin::EffectWindow *w, const QRect &old); + /** + * This signal is emitted when the frame geometry of a window changed. + * @param window The window whose geometry changed + * @param oldGeometry The previous geometry + * @since 5.19 + */ + void windowFrameGeometryChanged(KWin::EffectWindow *window, const QRect &oldGeometry); /** * Signal emitted when the padding of a window changed. (eg. shadow size) * @param w The window whose geometry changed diff --git a/main_x11.cpp b/main_x11.cpp index ff6184fe31..4349a7e8da 100644 --- a/main_x11.cpp +++ b/main_x11.cpp @@ -340,8 +340,7 @@ void ApplicationX11::crashHandler(int signal) } // namespace -extern "C" -KWIN_EXPORT int kdemain(int argc, char * argv[]) +int main(int argc, char * argv[]) { KWin::Application::setupMalloc(); KWin::Application::setupLocalizedString(); diff --git a/placement.cpp b/placement.cpp index 4d12cccd84..060981a61c 100644 --- a/placement.cpp +++ b/placement.cpp @@ -748,7 +748,7 @@ void AbstractClient::growHorizontal() return; QRect geom = frameGeometry(); geom.setRight(workspace()->packPositionRight(this, geom.right(), true)); - QSize adjsize = adjustedSize(geom.size(), SizemodeFixedW); + QSize adjsize = adjustedSize(geom.size(), SizeModeFixedW); if (frameGeometry().size() == adjsize && geom.size() != adjsize && resizeIncrements().width() > 1) { // take care of size increments int newright = workspace()->packPositionRight(this, geom.right() + resizeIncrements().width() - 1, true); // check that it hasn't grown outside of the area, due to size increments @@ -757,8 +757,8 @@ void AbstractClient::growHorizontal() QPoint((x() + newright) / 2, frameGeometry().center().y()), desktop()).right() >= newright) geom.setRight(newright); } - geom.setSize(adjustedSize(geom.size(), SizemodeFixedW)); - geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); + geom.setSize(adjustedSize(geom.size(), SizeModeFixedW)); + geom.setSize(adjustedSize(geom.size(), SizeModeFixedH)); workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; setFrameGeometry(geom); } @@ -777,7 +777,7 @@ void AbstractClient::shrinkHorizontal() geom.setRight(workspace()->packPositionLeft(this, geom.right(), false)); if (geom.width() <= 1) return; - geom.setSize(adjustedSize(geom.size(), SizemodeFixedW)); + geom.setSize(adjustedSize(geom.size(), SizeModeFixedW)); if (geom.width() > 20) { workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; setFrameGeometry(geom); @@ -796,7 +796,7 @@ void AbstractClient::growVertical() return; QRect geom = frameGeometry(); geom.setBottom(workspace()->packPositionDown(this, geom.bottom(), true)); - QSize adjsize = adjustedSize(geom.size(), SizemodeFixedH); + QSize adjsize = adjustedSize(geom.size(), SizeModeFixedH); if (frameGeometry().size() == adjsize && geom.size() != adjsize && resizeIncrements().height() > 1) { // take care of size increments int newbottom = workspace()->packPositionDown(this, geom.bottom() + resizeIncrements().height() - 1, true); // check that it hasn't grown outside of the area, due to size increments @@ -804,7 +804,7 @@ void AbstractClient::growVertical() QPoint(frameGeometry().center().x(), (y() + newbottom) / 2), desktop()).bottom() >= newbottom) geom.setBottom(newbottom); } - geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); + geom.setSize(adjustedSize(geom.size(), SizeModeFixedH)); workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; setFrameGeometry(geom); } @@ -824,7 +824,7 @@ void AbstractClient::shrinkVertical() geom.setBottom(workspace()->packPositionUp(this, geom.bottom(), false)); if (geom.height() <= 1) return; - geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); + geom.setSize(adjustedSize(geom.size(), SizeModeFixedH)); if (geom.height() > 20) { workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; setFrameGeometry(geom); diff --git a/plugins/kdecorations/aurorae/themes/plastik/package/metadata.desktop b/plugins/kdecorations/aurorae/themes/plastik/package/metadata.desktop index 6ea9ddf2db..0b8313705d 100644 --- a/plugins/kdecorations/aurorae/themes/plastik/package/metadata.desktop +++ b/plugins/kdecorations/aurorae/themes/plastik/package/metadata.desktop @@ -88,6 +88,7 @@ Name[zh_CN]=Plastik Name[zh_TW]=Plastik Comment=The classic theme known from KDE 3 Comment[ar]=السّمة الكلاسيكيّة المعروفة من كدي 3 +Comment[ast]=El tema clásicu y conocíu de KDE 3 Comment[bs]=Klasična tema iz KDE 3 Comment[ca]=El tema clàssic conegut des del KDE 3 Comment[ca@valencia]=El tema clàssic conegut des de KDE 3 diff --git a/plugins/platforms/drm/drm.json b/plugins/platforms/drm/drm.json index e2c0ab022e..9b4ea0c61e 100644 --- a/plugins/platforms/drm/drm.json +++ b/plugins/platforms/drm/drm.json @@ -52,6 +52,7 @@ "Name[fr]": "drm", "Name[gl]": "drm", "Name[hu]": "drm", + "Name[ia]": "drm", "Name[id]": "drm", "Name[it]": "drm", "Name[ko]": "drm", diff --git a/plugins/platforms/fbdev/fbdev.json b/plugins/platforms/fbdev/fbdev.json index 8dc156966e..d022f4b44a 100644 --- a/plugins/platforms/fbdev/fbdev.json +++ b/plugins/platforms/fbdev/fbdev.json @@ -52,6 +52,7 @@ "Name[fr]": "framebuffer", "Name[gl]": "framebuffer", "Name[hu]": "framebuffer", + "Name[ia]": "framebuffer", "Name[id]": "framebuffer", "Name[it]": "framebuffer", "Name[ko]": "framebuffer", diff --git a/plugins/platforms/virtual/virtual.json b/plugins/platforms/virtual/virtual.json index 83a8594e6d..e1f9e301ed 100644 --- a/plugins/platforms/virtual/virtual.json +++ b/plugins/platforms/virtual/virtual.json @@ -52,6 +52,7 @@ "Name[fr]": "virtual", "Name[gl]": "virtual", "Name[hu]": "virtuális", + "Name[ia]": "virtual", "Name[id]": "virtual", "Name[it]": "virtual", "Name[ko]": "virtual", diff --git a/plugins/platforms/wayland/wayland.json b/plugins/platforms/wayland/wayland.json index e99b25dd8b..d7c3b51f9e 100644 --- a/plugins/platforms/wayland/wayland.json +++ b/plugins/platforms/wayland/wayland.json @@ -52,6 +52,7 @@ "Name[fr]": "wayland", "Name[gl]": "wayland", "Name[hu]": "wayland", + "Name[ia]": "wayland", "Name[id]": "wayland", "Name[it]": "wayland", "Name[ko]": "wayland", diff --git a/plugins/scenes/qpainter/scene_qpainter.cpp b/plugins/scenes/qpainter/scene_qpainter.cpp index 93b6c49c1e..5f77465558 100644 --- a/plugins/scenes/qpainter/scene_qpainter.cpp +++ b/plugins/scenes/qpainter/scene_qpainter.cpp @@ -243,6 +243,19 @@ static void paintSubSurface(QPainter *painter, const QPoint &pos, QPainterWindow } } +static bool isXwaylandClient(Toplevel *toplevel) +{ + X11Client *client = qobject_cast(toplevel); + if (client) { + return true; + } + Deleted *deleted = qobject_cast(toplevel); + if (deleted) { + return deleted->wasX11Client(); + } + return false; +} + void SceneQPainter::Window::performPaint(int mask, QRegion region, WindowPaintData data) { if (!(mask & (PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED))) @@ -289,7 +302,7 @@ void SceneQPainter::Window::performPaint(int mask, QRegion region, WindowPaintDa // render content QRect source; QRect target; - if (toplevel->isClient()) { + if (isXwaylandClient(toplevel)) { // special case for XWayland windows source = QRect(toplevel->clientPos(), toplevel->clientSize()); target = source; diff --git a/plugins/windowsystem/CMakeLists.txt b/plugins/windowsystem/CMakeLists.txt index 68305c955a..bb27ea4df0 100644 --- a/plugins/windowsystem/CMakeLists.txt +++ b/plugins/windowsystem/CMakeLists.txt @@ -1,6 +1,7 @@ set(kwindowsystem_plugin_SRCS plugin.cpp windoweffects.cpp + windowshadow.cpp windowsystem.cpp ) diff --git a/plugins/windowsystem/plugin.cpp b/plugins/windowsystem/plugin.cpp index e374ee1a76..6125f6a620 100644 --- a/plugins/windowsystem/plugin.cpp +++ b/plugins/windowsystem/plugin.cpp @@ -18,8 +18,9 @@ * along with this program. If not, see . */ #include "plugin.h" -#include "windowsystem.h" #include "windoweffects.h" +#include "windowshadow.h" +#include "windowsystem.h" KWindowSystemKWinPlugin::KWindowSystemKWinPlugin(QObject *parent) : KWindowSystemPluginInterface(parent) @@ -39,3 +40,13 @@ KWindowSystemPrivate *KWindowSystemKWinPlugin::createWindowSystem() { return new KWin::WindowSystem(); } + +KWindowShadowTilePrivate *KWindowSystemKWinPlugin::createWindowShadowTile() +{ + return new KWin::WindowShadowTile(); +} + +KWindowShadowPrivate *KWindowSystemKWinPlugin::createWindowShadow() +{ + return new KWin::WindowShadow(); +} diff --git a/plugins/windowsystem/plugin.h b/plugins/windowsystem/plugin.h index c1de4950cd..04fd03e099 100644 --- a/plugins/windowsystem/plugin.h +++ b/plugins/windowsystem/plugin.h @@ -33,4 +33,6 @@ public: KWindowEffectsPrivate *createEffects() override; KWindowSystemPrivate *createWindowSystem() override; + KWindowShadowTilePrivate *createWindowShadowTile() override; + KWindowShadowPrivate *createWindowShadow() override; }; diff --git a/plugins/windowsystem/windowshadow.cpp b/plugins/windowsystem/windowshadow.cpp new file mode 100644 index 0000000000..556c70f8d2 --- /dev/null +++ b/plugins/windowsystem/windowshadow.cpp @@ -0,0 +1,95 @@ +/* + * Copyright 2020 Vlad Zahorodnii + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "windowshadow.h" + +#include + +Q_DECLARE_METATYPE(QMargins) + +namespace KWin +{ + +bool WindowShadowTile::create() +{ + return true; +} + +void WindowShadowTile::destroy() +{ +} + +bool WindowShadow::create() +{ + // TODO: Perhaps we set way too many properties here. Alternatively we could put all shadow tiles + // in one big image and attach it rather than 8 separate images. + if (leftTile) { + window->setProperty("kwin_shadow_left_tile", QVariant::fromValue(leftTile->image())); + } + if (topLeftTile) { + window->setProperty("kwin_shadow_top_left_tile", QVariant::fromValue(topLeftTile->image())); + } + if (topTile) { + window->setProperty("kwin_shadow_top_tile", QVariant::fromValue(topTile->image())); + } + if (topRightTile) { + window->setProperty("kwin_shadow_top_right_tile", QVariant::fromValue(topRightTile->image())); + } + if (rightTile) { + window->setProperty("kwin_shadow_right_tile", QVariant::fromValue(rightTile->image())); + } + if (bottomRightTile) { + window->setProperty("kwin_shadow_bottom_right_tile", QVariant::fromValue(bottomRightTile->image())); + } + if (bottomTile) { + window->setProperty("kwin_shadow_bottom_tile", QVariant::fromValue(bottomTile->image())); + } + if (bottomLeftTile) { + window->setProperty("kwin_shadow_bottom_left_tile", QVariant::fromValue(bottomLeftTile->image())); + } + window->setProperty("kwin_shadow_padding", QVariant::fromValue(padding)); + + // Notice that the enabled property must be set last. + window->setProperty("kwin_shadow_enabled", QVariant::fromValue(true)); + + return true; +} + +void WindowShadow::destroy() +{ + // Attempting to uninstall the shadow after the decorated window has been destroyed. It's doomed. + if (!window) { + return; + } + + // Remove relevant shadow properties. + window->setProperty("kwin_shadow_left_tile", {}); + window->setProperty("kwin_shadow_top_left_tile", {}); + window->setProperty("kwin_shadow_top_tile", {}); + window->setProperty("kwin_shadow_top_right_tile", {}); + window->setProperty("kwin_shadow_right_tile", {}); + window->setProperty("kwin_shadow_bottom_right_tile", {}); + window->setProperty("kwin_shadow_bottom_tile", {}); + window->setProperty("kwin_shadow_bottom_left_tile", {}); + window->setProperty("kwin_shadow_padding", {}); + window->setProperty("kwin_shadow_enabled", {}); +} + +} // namespace KWin diff --git a/plugins/windowsystem/windowshadow.h b/plugins/windowsystem/windowshadow.h new file mode 100644 index 0000000000..2574341f63 --- /dev/null +++ b/plugins/windowsystem/windowshadow.h @@ -0,0 +1,42 @@ +/* + * Copyright 2020 Vlad Zahorodnii + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include + +namespace KWin +{ + +class WindowShadowTile final : public KWindowShadowTilePrivate +{ +public: + bool create() override; + void destroy() override; +}; + +class WindowShadow final : public KWindowShadowPrivate +{ +public: + bool create() override; + void destroy() override; +}; + +} // namespace KWin diff --git a/pointer_input.cpp b/pointer_input.cpp index 64d7558312..386a0238e0 100644 --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -51,6 +51,7 @@ along with this program. If not, see . #include #include +#include // Wayland #include @@ -502,7 +503,7 @@ void PointerInputRedirection::cleanupDecoration(Decoration::DecoratedClientImpl QCoreApplication::instance()->sendEvent(now->decoration(), &event); now->client()->processDecorationMove(pos.toPoint(), m_pos.toPoint()); - m_decorationGeometryConnection = connect(decoration()->client(), &AbstractClient::geometryChanged, this, + m_decorationGeometryConnection = connect(decoration()->client(), &AbstractClient::frameGeometryChanged, this, [this] { // ensure maximize button gets the leave event when maximizing/restore a window, see BUG 385140 const auto oldDeco = decoration(); @@ -564,7 +565,7 @@ void PointerInputRedirection::focusUpdate(Toplevel *focusOld, Toplevel *focusNow seat->setPointerPos(m_pos.toPoint()); seat->setFocusedPointerSurface(focusNow->surface(), focusNow->inputTransformation()); - m_focusGeometryConnection = connect(focusNow, &Toplevel::geometryChanged, this, + m_focusGeometryConnection = connect(focusNow, &Toplevel::frameGeometryChanged, this, [this] { // TODO: why no assert possible? if (!focus()) { @@ -1221,6 +1222,7 @@ void CursorImage::updateDragCursor() if (auto dragIcon = ddi->icon()) { if (auto buffer = dragIcon->buffer()) { additionalIcon = buffer->data().copy(); + additionalIcon.setOffset(dragIcon->offset()); } } } @@ -1253,7 +1255,32 @@ void CursorImage::updateDragCursor() return; } m_drag.cursor.hotSpot = c->hotspot(); - m_drag.cursor.image = buffer->data().copy(); + + if (additionalIcon.isNull()) { + m_drag.cursor.image = buffer->data().copy(); + } else { + QRect cursorRect = buffer->data().rect(); + QRect iconRect = additionalIcon.rect(); + + if (-m_drag.cursor.hotSpot.x() < additionalIcon.offset().x()) { + iconRect.moveLeft(m_drag.cursor.hotSpot.x() - additionalIcon.offset().x()); + } else { + cursorRect.moveLeft(-additionalIcon.offset().x() - m_drag.cursor.hotSpot.x()); + } + if (-m_drag.cursor.hotSpot.y() < additionalIcon.offset().y()) { + iconRect.moveTop(m_drag.cursor.hotSpot.y() - additionalIcon.offset().y()); + } else { + cursorRect.moveTop(-additionalIcon.offset().y() - m_drag.cursor.hotSpot.y()); + } + + m_drag.cursor.image = QImage(cursorRect.united(iconRect).size(), QImage::Format_ARGB32_Premultiplied); + m_drag.cursor.image.fill(Qt::transparent); + QPainter p(&m_drag.cursor.image); + p.drawImage(iconRect, additionalIcon); + p.drawImage(cursorRect, buffer->data()); + p.end(); + } + if (needsEmit) { emit changed(); } diff --git a/shadow.cpp b/shadow.cpp index 5f1175bcd8..85e9b2f46b 100644 --- a/shadow.cpp +++ b/shadow.cpp @@ -3,6 +3,7 @@ This file is part of the KDE project. Copyright (C) 2011 Martin Gräßlin +Copyright (C) 2020 Vlad Zahorodnii This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,6 +24,7 @@ along with this program. If not, see . #include "abstract_client.h" #include "composite.h" #include "effects.h" +#include "internal_client.h" #include "toplevel.h" #include "wayland_server.h" @@ -33,6 +35,10 @@ along with this program. If not, see . #include #include +#include + +Q_DECLARE_METATYPE(QMargins) + namespace KWin { @@ -41,7 +47,7 @@ Shadow::Shadow(Toplevel *toplevel) , m_cachedSize(toplevel->size()) , m_decorationShadow(nullptr) { - connect(m_topLevel, SIGNAL(geometryChanged()), SLOT(geometryChanged())); + connect(m_topLevel, &Toplevel::frameGeometryChanged, this, &Shadow::geometryChanged); } Shadow::~Shadow() @@ -60,6 +66,9 @@ Shadow *Shadow::createShadow(Toplevel *toplevel) if (!shadow && kwinApp()->x11Connection()) { shadow = createShadowFromX11(toplevel); } + if (!shadow) { + shadow = createShadowFromInternalWindow(toplevel); + } if (!shadow) { return nullptr; } @@ -121,6 +130,24 @@ Shadow *Shadow::createShadowFromWayland(Toplevel *toplevel) return shadow; } +Shadow *Shadow::createShadowFromInternalWindow(Toplevel *toplevel) +{ + const InternalClient *client = qobject_cast(toplevel); + if (!client) { + return nullptr; + } + const QWindow *window = client->internalWindow(); + if (!window) { + return nullptr; + } + Shadow *shadow = Compositor::self()->scene()->createShadow(toplevel); + if (!shadow->init(window)) { + delete shadow; + return nullptr; + } + return shadow; +} + QVector< uint32_t > Shadow::readX11ShadowProperty(xcb_window_t id) { QVector ret; @@ -240,6 +267,49 @@ bool Shadow::init(const QPointer< KWayland::Server::ShadowInterface > &shadow) return true; } +bool Shadow::init(const QWindow *window) +{ + const bool isEnabled = window->property("kwin_shadow_enabled").toBool(); + if (!isEnabled) { + return false; + } + + const QImage leftTile = window->property("kwin_shadow_left_tile").value(); + const QImage topLeftTile = window->property("kwin_shadow_top_left_tile").value(); + const QImage topTile = window->property("kwin_shadow_top_tile").value(); + const QImage topRightTile = window->property("kwin_shadow_top_right_tile").value(); + const QImage rightTile = window->property("kwin_shadow_right_tile").value(); + const QImage bottomRightTile = window->property("kwin_shadow_bottom_right_tile").value(); + const QImage bottomTile = window->property("kwin_shadow_bottom_tile").value(); + const QImage bottomLeftTile = window->property("kwin_shadow_bottom_left_tile").value(); + + m_shadowElements[ShadowElementLeft] = QPixmap::fromImage(leftTile); + m_shadowElements[ShadowElementTopLeft] = QPixmap::fromImage(topLeftTile); + m_shadowElements[ShadowElementTop] = QPixmap::fromImage(topTile); + m_shadowElements[ShadowElementTopRight] = QPixmap::fromImage(topRightTile); + m_shadowElements[ShadowElementRight] = QPixmap::fromImage(rightTile); + m_shadowElements[ShadowElementBottomRight] = QPixmap::fromImage(bottomRightTile); + m_shadowElements[ShadowElementBottom] = QPixmap::fromImage(bottomTile); + m_shadowElements[ShadowElementBottomLeft] = QPixmap::fromImage(bottomLeftTile); + + const QMargins padding = window->property("kwin_shadow_padding").value(); + + m_leftOffset = padding.left(); + m_topOffset = padding.top(); + m_rightOffset = padding.right(); + m_bottomOffset = padding.bottom(); + + updateShadowRegion(); + + if (!prepareBackend()) { + return false; + } + + buildQuads(); + + return true; +} + void Shadow::updateShadowRegion() { const QRect top(0, - m_topOffset, m_topLevel->width(), m_topOffset); @@ -356,6 +426,12 @@ bool Shadow::updateShadow() } } + if (InternalClient *client = qobject_cast(m_topLevel)) { + if (init(client->internalWindow())) { + return true; + } + } + auto data = Shadow::readX11ShadowProperty(m_topLevel->window()); if (data.isEmpty()) { return false; @@ -369,7 +445,7 @@ bool Shadow::updateShadow() void Shadow::setToplevel(Toplevel *topLevel) { m_topLevel = topLevel; - connect(m_topLevel, SIGNAL(geometryChanged()), SLOT(geometryChanged())); + connect(m_topLevel, &Toplevel::frameGeometryChanged, this, &Shadow::geometryChanged); } void Shadow::geometryChanged() { diff --git a/shadow.h b/shadow.h index 953f28f687..9214ef760f 100644 --- a/shadow.h +++ b/shadow.h @@ -3,6 +3,7 @@ This file is part of the KDE project. Copyright (C) 2011 Martin Gräßlin +Copyright (C) 2020 Vlad Zahorodnii This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -168,10 +169,12 @@ private: static Shadow *createShadowFromX11(Toplevel *toplevel); static Shadow *createShadowFromDecoration(Toplevel *toplevel); static Shadow *createShadowFromWayland(Toplevel *toplevel); + static Shadow *createShadowFromInternalWindow(Toplevel *toplevel); static QVector readX11ShadowProperty(xcb_window_t id); bool init(const QVector &data); bool init(KDecoration2::Decoration *decoration); bool init(const QPointer &shadow); + bool init(const QWindow *window); Toplevel *m_topLevel; // shadow pixmaps QPixmap m_shadowElements[ShadowElementsCount]; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a0f9a1aaaa..1304e40b00 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,13 +10,13 @@ add_executable(screenedgeshowtest ${screenedgeshowtest_SRCS}) target_link_libraries(screenedgeshowtest Qt5::Widgets Qt5::X11Extras KF5::ConfigCore KF5::WindowSystem KF5::WaylandClient ${XCB_XCB_LIBRARY}) set(libinputtest_SRCS - ${KWIN_SOURCE_DIR}/libinput/connection.cpp - ${KWIN_SOURCE_DIR}/libinput/context.cpp - ${KWIN_SOURCE_DIR}/libinput/device.cpp - ${KWIN_SOURCE_DIR}/libinput/events.cpp - ${KWIN_SOURCE_DIR}/libinput/libinput_logging.cpp - ${KWIN_SOURCE_DIR}/logind.cpp - ${KWIN_SOURCE_DIR}/udev.cpp + ${KWin_SOURCE_DIR}/libinput/connection.cpp + ${KWin_SOURCE_DIR}/libinput/context.cpp + ${KWin_SOURCE_DIR}/libinput/device.cpp + ${KWin_SOURCE_DIR}/libinput/events.cpp + ${KWin_SOURCE_DIR}/libinput/libinput_logging.cpp + ${KWin_SOURCE_DIR}/logind.cpp + ${KWin_SOURCE_DIR}/udev.cpp libinputtest.cpp ) add_executable(libinputtest ${libinputtest_SRCS}) diff --git a/toplevel.cpp b/toplevel.cpp index 56d4668f9e..387a8a50f4 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -59,6 +59,9 @@ Toplevel::Toplevel() connect(screens(), SIGNAL(changed()), SLOT(checkScreen())); connect(screens(), SIGNAL(countChanged(int,int)), SLOT(checkScreen())); setupCheckScreenConnection(); + + // Only for compatibility reasons, drop in the next major release. + connect(this, &Toplevel::frameGeometryChanged, this, &Toplevel::geometryChanged); } Toplevel::~Toplevel() @@ -517,15 +520,13 @@ void Toplevel::checkScreen() void Toplevel::setupCheckScreenConnection() { - connect(this, SIGNAL(geometryShapeChanged(KWin::Toplevel*,QRect)), SLOT(checkScreen())); - connect(this, SIGNAL(geometryChanged()), SLOT(checkScreen())); + connect(this, &Toplevel::frameGeometryChanged, this, &Toplevel::checkScreen); checkScreen(); } void Toplevel::removeCheckScreenConnection() { - disconnect(this, SIGNAL(geometryShapeChanged(KWin::Toplevel*,QRect)), this, SLOT(checkScreen())); - disconnect(this, SIGNAL(geometryChanged()), this, SLOT(checkScreen())); + disconnect(this, &Toplevel::frameGeometryChanged, this, &Toplevel::checkScreen); } int Toplevel::screen() const diff --git a/toplevel.h b/toplevel.h index 2cf6bbc0ee..b5c43dab64 100644 --- a/toplevel.h +++ b/toplevel.h @@ -78,20 +78,20 @@ class KWIN_EXPORT Toplevel : public QObject * * @deprecated Use frameGeometry property instead. */ - Q_PROPERTY(QRect geometry READ frameGeometry NOTIFY geometryChanged) + Q_PROPERTY(QRect geometry READ frameGeometry NOTIFY frameGeometryChanged) /** * This property holds rectangle that the pixmap or buffer of this Toplevel * occupies on the screen. This rectangle includes invisible portions of the * client, e.g. client-side drop shadows, etc. */ - Q_PROPERTY(QRect bufferGeometry READ bufferGeometry NOTIFY geometryChanged) + Q_PROPERTY(QRect bufferGeometry READ bufferGeometry) /** * This property holds the geometry of the Toplevel, excluding invisible * portions, e.g. server-side and client-side drop-shadows, etc. */ - Q_PROPERTY(QRect frameGeometry READ frameGeometry NOTIFY geometryChanged) + Q_PROPERTY(QRect frameGeometry READ frameGeometry NOTIFY frameGeometryChanged) /** * This property holds the position of the Toplevel's frame geometry. @@ -589,6 +589,10 @@ public: Q_SIGNALS: void opacityChanged(KWin::Toplevel* toplevel, qreal oldOpacity); void damaged(KWin::Toplevel* toplevel, const QRect& damage); + /** + * This signal is emitted when the Toplevel's frame geometry changes. + * @deprecated since 5.19, use frameGeometryChanged instead + */ void geometryChanged(); void geometryShapeChanged(KWin::Toplevel* toplevel, const QRect& old); void paddingChanged(KWin::Toplevel* toplevel, const QRect& old); @@ -652,6 +656,11 @@ Q_SIGNALS: */ void shadowChanged(); + /** + * This signal is emitted when the Toplevel's frame geometry changes. + */ + void frameGeometryChanged(KWin::Toplevel *toplevel, const QRect &oldGeometry); + protected Q_SLOTS: /** * Checks whether the screen number for this Toplevel changed and updates if needed. diff --git a/touch_input.cpp b/touch_input.cpp index eec38e772f..22ff287e91 100644 --- a/touch_input.cpp +++ b/touch_input.cpp @@ -118,7 +118,7 @@ void TouchInputRedirection::focusUpdate(Toplevel *focusOld, Toplevel *focusNow) // FIXME: add input transformation API to KWayland::Server::SeatInterface for touch input seat->setFocusedTouchSurface(focusNow->surface(), -1 * focusNow->inputTransformation().map(focusNow->pos()) + focusNow->pos()); - m_focusGeometryConnection = connect(focusNow, &Toplevel::geometryChanged, this, + m_focusGeometryConnection = connect(focusNow, &Toplevel::frameGeometryChanged, this, [this] { if (focus().isNull()) { return; diff --git a/unmanaged.cpp b/unmanaged.cpp index bc89874947..529eb5f1b3 100644 --- a/unmanaged.cpp +++ b/unmanaged.cpp @@ -45,7 +45,6 @@ const NET::WindowTypes SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK = NET::NormalMask | Unmanaged::Unmanaged() : Toplevel() { - connect(this, SIGNAL(geometryShapeChanged(KWin::Toplevel*,QRect)), SIGNAL(geometryChanged())); QTimer::singleShot(50, this, SLOT(setReadyForPainting())); } diff --git a/virtualkeyboard.cpp b/virtualkeyboard.cpp index 5533e8d602..fd624f427d 100644 --- a/virtualkeyboard.cpp +++ b/virtualkeyboard.cpp @@ -27,6 +27,7 @@ along with this program. If not, see . #include "workspace.h" #include "xkb.h" #include "xdgshellclient.h" +#include "screenlockerwatcher.h" #include #include @@ -87,6 +88,8 @@ void VirtualKeyboard::init() } m_inputWindow->setProperty("__kwin_input_method", true); + connect(ScreenLockerWatcher::self(), &ScreenLockerWatcher::aboutToLock, this, &VirtualKeyboard::hide); + if (waylandServer()) { m_enabled = !input()->hasAlphaNumericKeyboard(); qCDebug(KWIN_VIRTUALKEYBOARD) << "enabled by default: " << m_enabled; @@ -289,6 +292,7 @@ void VirtualKeyboard::hide() if (m_inputWindow.isNull()) { return; } + m_inputWindow->hide(); qApp->inputMethod()->hide(); } diff --git a/x11client.cpp b/x11client.cpp index ba7f103de0..f6b10d48d0 100644 --- a/x11client.cpp +++ b/x11client.cpp @@ -653,7 +653,7 @@ bool X11Client::manage(xcb_window_t w, bool isMapped) // TODO: get KMainWindow a correct state storage what will allow to store the restore size as well. if (!session) { // has a better handling of this - geom_restore = frameGeometry(); // Remember restore geometry + setGeometryRestore(frameGeometry()); // Remember restore geometry if (isMaximizable() && (width() >= area.width() || height() >= area.height())) { // Window is too large for the screen, maximize in the // directions necessary @@ -689,15 +689,16 @@ bool X11Client::manage(xcb_window_t w, bool isMapped) maximize((MaximizeMode)pseudo_max); // from now on, care about maxmode, since the maximization call will override mode for fix aspects dontKeepInArea |= (max_mode == MaximizeFull); - geom_restore = QRect(); // Use placement when unmaximizing ... + QRect savedGeometry; // Use placement when unmaximizing ... if (!(max_mode & MaximizeVertical)) { - geom_restore.setY(y()); // ...but only for horizontal direction - geom_restore.setHeight(height()); + savedGeometry.setY(y()); // ...but only for horizontal direction + savedGeometry.setHeight(height()); } if (!(max_mode & MaximizeHorizontal)) { - geom_restore.setX(x()); // ...but only for vertical direction - geom_restore.setWidth(width()); + savedGeometry.setX(x()); // ...but only for vertical direction + savedGeometry.setWidth(width()); } + setGeometryRestore(savedGeometry); } if (keepInFsArea) keepInArea(fsa, partial_keep_in_area); @@ -752,7 +753,7 @@ bool X11Client::manage(xcb_window_t w, bool isMapped) setSkipSwitcher(session->skipSwitcher); setShade(session->shaded ? ShadeNormal : ShadeNone); setOpacity(session->opacity); - geom_restore = session->restore; + setGeometryRestore(session->restore); if (session->maximized != MaximizeRestore) { maximize(MaximizeMode(session->maximized)); } @@ -760,8 +761,10 @@ bool X11Client::manage(xcb_window_t w, bool isMapped) setFullScreen(true, false); geom_fs_restore = session->fsrestore; } - checkOffscreenPosition(&geom_restore, area); + QRect checkedGeometryRestore = geometryRestore(); + checkOffscreenPosition(&checkedGeometryRestore, area); checkOffscreenPosition(&geom_fs_restore, area); + setGeometryRestore(checkedGeometryRestore); } else { // Window may want to be maximized // done after checking that the window isn't larger than the workarea, so that @@ -1250,7 +1253,7 @@ bool X11Client::isFullScreenable() const if (rules()->checkStrictGeometry(true)) { // check geometry constraints (rule to obey is set) const QRect fsarea = workspace()->clientArea(FullScreenArea, this); - if (sizeForClientSize(fsarea.size(), SizemodeAny, true) != fsarea.size()) { + if (sizeForClientSize(fsarea.size(), SizeModeAny, true) != fsarea.size()) { return false; // the app wouldn't fit exactly fullscreen geometry due to its strict geometry requirements } } @@ -1427,6 +1430,10 @@ bool X11Client::isMinimizable() const void X11Client::doMinimize() { + if (isShade()) { + // NETWM restriction - KWindowInfo::isMinimized() == Hidden && !Shaded + info->setState(isMinimized() ? NET::States() : NET::Shaded, NET::Shaded); + } updateVisibility(); updateAllowedActions(); workspace()->updateMinimizedOfTransients(this); @@ -1896,6 +1903,16 @@ void X11Client::killProcess(bool ask, xcb_timestamp_t timestamp) } } +void X11Client::doSetKeepAbove() +{ + info->setState(keepAbove() ? NET::KeepAbove : NET::States(), NET::KeepAbove); +} + +void X11Client::doSetKeepBelow() +{ + info->setState(keepBelow() ? NET::KeepBelow : NET::States(), NET::KeepBelow); +} + void X11Client::doSetSkipTaskbar() { info->setState(skipTaskbar() ? NET::SkipTaskbar : NET::States(), NET::SkipTaskbar); @@ -1911,13 +1928,16 @@ void X11Client::doSetSkipSwitcher() info->setState(skipSwitcher() ? NET::SkipSwitcher : NET::States(), NET::SkipSwitcher); } -void X11Client::doSetDesktop(int desktop, int was_desk) +void X11Client::doSetDesktop() { - Q_UNUSED(desktop) - Q_UNUSED(was_desk) updateVisibility(); } +void X11Client::doSetDemandsAttention() +{ + info->setState(isDemandingAttention() ? NET::DemandsAttention : NET::States(), NET::DemandsAttention); +} + /** * Sets whether the client is on @p activity. * If you remove it from its last activity, then it's on all activities. @@ -2778,7 +2798,7 @@ void X11Client::readShowOnScreenEdge(Xcb::Property &property) hideClient(true); successfullyHidden = isHiddenInternal(); - m_edgeGeometryTrackingConnection = connect(this, &X11Client::geometryChanged, this, [this, border](){ + m_edgeGeometryTrackingConnection = connect(this, &X11Client::frameGeometryChanged, this, [this, border](){ hideClient(true); ScreenEdges::self()->reserve(this, border); }); @@ -2924,9 +2944,11 @@ void X11Client::move(int x, int y, ForceGeometry_t force) screens()->setCurrent(this); workspace()->updateStackingOrder(); // client itself is not damaged + if (frameGeometryBeforeUpdateBlocking() != frameGeometry()) { + emit frameGeometryChanged(this, frameGeometryBeforeUpdateBlocking()); + } addRepaintDuringGeometryUpdates(); updateGeometryBeforeUpdateBlocking(); - emit geometryChanged(); } bool X11Client::belongToSameApplication(const X11Client *c1, const X11Client *c2, SameApplicationChecks checks) @@ -3579,7 +3601,7 @@ void X11Client::checkActiveModal() * \a wsize is adapted according to the window's size hints (minimum, * maximum and incremental size changes). */ -QSize X11Client::sizeForClientSize(const QSize& wsize, Sizemode mode, bool noframe) const +QSize X11Client::sizeForClientSize(const QSize& wsize, SizeMode mode, bool noframe) const { int w = wsize.width(); int h = wsize.height(); @@ -3693,8 +3715,8 @@ QSize X11Client::sizeForClientSize(const QSize& wsize, Sizemode mode, bool nofra } \ } switch(mode) { - case SizemodeAny: -#if 0 // make SizemodeAny equal to SizemodeFixedW - prefer keeping fixed width, + case SizeModeAny: +#if 0 // make SizeModeAny equal to SizeModeFixedW - prefer keeping fixed width, // so that changing aspect ratio to a different value and back keeps the same size (#87298) { ASPECT_CHECK_SHRINK_H_GROW_W @@ -3704,7 +3726,7 @@ QSize X11Client::sizeForClientSize(const QSize& wsize, Sizemode mode, bool nofra break; } #endif - case SizemodeFixedW: { + case SizeModeFixedW: { // the checks are order so that attempts to modify height are first ASPECT_CHECK_GROW_H ASPECT_CHECK_SHRINK_H_GROW_W @@ -3712,14 +3734,14 @@ QSize X11Client::sizeForClientSize(const QSize& wsize, Sizemode mode, bool nofra ASPECT_CHECK_GROW_W break; } - case SizemodeFixedH: { + case SizeModeFixedH: { ASPECT_CHECK_GROW_W ASPECT_CHECK_SHRINK_W_GROW_H ASPECT_CHECK_SHRINK_H_GROW_W ASPECT_CHECK_GROW_H break; } - case SizemodeMax: { + case SizeModeMax: { // first checks that try to shrink ASPECT_CHECK_SHRINK_H_GROW_W ASPECT_CHECK_SHRINK_W_GROW_H @@ -4019,7 +4041,7 @@ void X11Client::configureRequest(int value_mask, int rx, int ry, int rw, int rh, } } } - geom_restore = frameGeometry(); + setGeometryRestore(frameGeometry()); // No need to send synthetic configure notify event here, either it's sent together // with geometry change, or there's no need to send it. // Handling of the real ConfigureRequest event forces sending it, as there it's necessary. @@ -4224,11 +4246,12 @@ void X11Client::setFrameGeometry(int x, int y, int w, int h, ForceGeometry_t for if (bufferGeometryBeforeUpdateBlocking().size() != m_bufferGeometry.size()) { discardWindowPixmap(); } + if (frameGeometryBeforeUpdateBlocking() != m_frameGeometry) { + emit frameGeometryChanged(this, frameGeometryBeforeUpdateBlocking()); + } emit geometryShapeChanged(this, frameGeometryBeforeUpdateBlocking()); addRepaintDuringGeometryUpdates(); updateGeometryBeforeUpdateBlocking(); - // TODO: this signal is emitted too often - emit geometryChanged(); } void X11Client::plainResize(int w, int h, ForceGeometry_t force) @@ -4280,11 +4303,12 @@ void X11Client::plainResize(int w, int h, ForceGeometry_t force) if (bufferGeometryBeforeUpdateBlocking().size() != m_bufferGeometry.size()) { discardWindowPixmap(); } + if (frameGeometryBeforeUpdateBlocking() != frameGeometry()) { + emit frameGeometryChanged(this, frameGeometryBeforeUpdateBlocking()); + } emit geometryShapeChanged(this, frameGeometryBeforeUpdateBlocking()); addRepaintDuringGeometryUpdates(); updateGeometryBeforeUpdateBlocking(); - // TODO: this signal is emitted too often - emit geometryChanged(); } void X11Client::updateServerGeometry() @@ -4391,14 +4415,16 @@ void X11Client::changeMaximize(bool horizontal, bool vertical, bool adjust) sz = size(); if (quickTileMode() == QuickTileMode(QuickTileFlag::None)) { + QRect savedGeometry = geometryRestore(); if (!adjust && !(old_mode & MaximizeVertical)) { - geom_restore.setTop(y()); - geom_restore.setHeight(sz.height()); + savedGeometry.setTop(y()); + savedGeometry.setHeight(sz.height()); } if (!adjust && !(old_mode & MaximizeHorizontal)) { - geom_restore.setLeft(x()); - geom_restore.setWidth(sz.width()); + savedGeometry.setLeft(x()); + savedGeometry.setWidth(sz.width()); } + setGeometryRestore(savedGeometry); } // call into decoration update borders @@ -4430,7 +4456,7 @@ void X11Client::changeMaximize(bool horizontal, bool vertical, bool adjust) // Conditional quick tiling exit points if (quickTileMode() != QuickTileMode(QuickTileFlag::None)) { if (old_mode == MaximizeFull && - !clientArea.contains(geom_restore.center())) { + !clientArea.contains(geometryRestore().center())) { // Not restoring on the same screen // TODO: The following doesn't work for some reason //quick_tile_mode = QuickTileFlag::None; // And exit quick tile mode manually @@ -4445,18 +4471,18 @@ void X11Client::changeMaximize(bool horizontal, bool vertical, bool adjust) case MaximizeVertical: { if (old_mode & MaximizeHorizontal) { // actually restoring from MaximizeFull - if (geom_restore.width() == 0 || !clientArea.contains(geom_restore.center())) { + if (geometryRestore().width() == 0 || !clientArea.contains(geometryRestore().center())) { // needs placement - plainResize(adjustedSize(QSize(width() * 2 / 3, clientArea.height()), SizemodeFixedH), geom_mode); + plainResize(adjustedSize(QSize(width() * 2 / 3, clientArea.height()), SizeModeFixedH), geom_mode); Placement::self()->placeSmart(this, clientArea); } else { - setFrameGeometry(QRect(QPoint(geom_restore.x(), clientArea.top()), - adjustedSize(QSize(geom_restore.width(), clientArea.height()), SizemodeFixedH)), geom_mode); + setFrameGeometry(QRect(QPoint(geometryRestore().x(), clientArea.top()), + adjustedSize(QSize(geometryRestore().width(), clientArea.height()), SizeModeFixedH)), geom_mode); } } else { QRect r(x(), clientArea.top(), width(), clientArea.height()); r.setTopLeft(rules()->checkPosition(r.topLeft())); - r.setSize(adjustedSize(r.size(), SizemodeFixedH)); + r.setSize(adjustedSize(r.size(), SizeModeFixedH)); setFrameGeometry(r, geom_mode); } info->setState(NET::MaxVert, NET::Max); @@ -4465,18 +4491,18 @@ void X11Client::changeMaximize(bool horizontal, bool vertical, bool adjust) case MaximizeHorizontal: { if (old_mode & MaximizeVertical) { // actually restoring from MaximizeFull - if (geom_restore.height() == 0 || !clientArea.contains(geom_restore.center())) { + if (geometryRestore().height() == 0 || !clientArea.contains(geometryRestore().center())) { // needs placement - plainResize(adjustedSize(QSize(clientArea.width(), height() * 2 / 3), SizemodeFixedW), geom_mode); + plainResize(adjustedSize(QSize(clientArea.width(), height() * 2 / 3), SizeModeFixedW), geom_mode); Placement::self()->placeSmart(this, clientArea); } else { - setFrameGeometry(QRect(QPoint(clientArea.left(), geom_restore.y()), - adjustedSize(QSize(clientArea.width(), geom_restore.height()), SizemodeFixedW)), geom_mode); + setFrameGeometry(QRect(QPoint(clientArea.left(), geometryRestore().y()), + adjustedSize(QSize(clientArea.width(), geometryRestore().height()), SizeModeFixedW)), geom_mode); } } else { QRect r(clientArea.left(), y(), clientArea.width(), height()); r.setTopLeft(rules()->checkPosition(r.topLeft())); - r.setSize(adjustedSize(r.size(), SizemodeFixedW)); + r.setSize(adjustedSize(r.size(), SizeModeFixedW)); setFrameGeometry(r, geom_mode); } info->setState(NET::MaxHoriz, NET::Max); @@ -4487,34 +4513,39 @@ void X11Client::changeMaximize(bool horizontal, bool vertical, bool adjust) QRect restore = frameGeometry(); // when only partially maximized, geom_restore may not have the other dimension remembered if (old_mode & MaximizeVertical) { - restore.setTop(geom_restore.top()); - restore.setBottom(geom_restore.bottom()); + restore.setTop(geometryRestore().top()); + restore.setBottom(geometryRestore().bottom()); } if (old_mode & MaximizeHorizontal) { - restore.setLeft(geom_restore.left()); - restore.setRight(geom_restore.right()); + restore.setLeft(geometryRestore().left()); + restore.setRight(geometryRestore().right()); } if (!restore.isValid()) { QSize s = QSize(clientArea.width() * 2 / 3, clientArea.height() * 2 / 3); - if (geom_restore.width() > 0) - s.setWidth(geom_restore.width()); - if (geom_restore.height() > 0) - s.setHeight(geom_restore.height()); + if (geometryRestore().width() > 0) { + s.setWidth(geometryRestore().width()); + } + if (geometryRestore().height() > 0) { + s.setHeight(geometryRestore().height()); + } plainResize(adjustedSize(s)); Placement::self()->placeSmart(this, clientArea); restore = frameGeometry(); - if (geom_restore.width() > 0) - restore.moveLeft(geom_restore.x()); - if (geom_restore.height() > 0) - restore.moveTop(geom_restore.y()); - geom_restore = restore; // relevant for mouse pos calculation, bug #298646 + if (geometryRestore().width() > 0) { + restore.moveLeft(geometryRestore().x()); + } + if (geometryRestore().height() > 0) { + restore.moveTop(geometryRestore().y()); + } + setGeometryRestore(restore); // relevant for mouse pos calculation, bug #298646 } if (m_geometryHints.hasAspect()) { - restore.setSize(adjustedSize(restore.size(), SizemodeAny)); + restore.setSize(adjustedSize(restore.size(), SizeModeAny)); } setFrameGeometry(restore, geom_mode); - if (!clientArea.contains(geom_restore.center())) // Not restoring to the same screen + if (!clientArea.contains(geometryRestore().center())) { // Not restoring to the same screen Placement::self()->place(this, clientArea); + } info->setState(NET::States(), NET::Max); updateQuickTileMode(QuickTileFlag::None); break; @@ -4523,7 +4554,7 @@ void X11Client::changeMaximize(bool horizontal, bool vertical, bool adjust) case MaximizeFull: { QRect r(clientArea); r.setTopLeft(rules()->checkPosition(r.topLeft())); - r.setSize(adjustedSize(r.size(), SizemodeMax)); + r.setSize(adjustedSize(r.size(), SizeModeMax)); if (r.size() != clientArea.size()) { // to avoid off-by-one errors... if (isElectricBorderMaximizing() && r.width() < clientArea.width()) { r.moveLeft(qMax(clientArea.left(), Cursor::pos().x() - r.width()/2)); diff --git a/x11client.h b/x11client.h index fdf3691537..4bed4075f3 100644 --- a/x11client.h +++ b/x11client.h @@ -147,7 +147,6 @@ public: bool isShadeable() const override; bool isMaximizable() const override; - QRect geometryRestore() const override; MaximizeMode maximizeMode() const override; bool isMinimizable() const override; @@ -198,7 +197,7 @@ public: void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override; void resizeWithChecks(int w, int h, xcb_gravity_t gravity, ForceGeometry_t force = NormalGeometrySet); void resizeWithChecks(const QSize& s, xcb_gravity_t gravity, ForceGeometry_t force = NormalGeometrySet); - QSize sizeForClientSize(const QSize&, Sizemode mode = SizemodeAny, bool noframe = false) const override; + QSize sizeForClientSize(const QSize&, SizeMode mode = SizeModeAny, bool noframe = false) const override; bool providesContextHelp() const override; @@ -363,13 +362,13 @@ protected: void doSetActive() override; void doSetKeepAbove() override; void doSetKeepBelow() override; - void doSetDesktop(int desktop, int was_desk) override; + void doSetDesktop() override; void doMinimize() override; void doSetSkipPager() override; void doSetSkipTaskbar() override; void doSetSkipSwitcher() override; + void doSetDemandsAttention() override; bool belongsToDesktop() const override; - void setGeometryRestore(const QRect &geo) override; bool doStartMoveResize() override; void doPerformMoveResize() override; bool isWaitingForMoveResizeSync() const override; @@ -525,7 +524,6 @@ private: MaximizeMode max_mode; QRect m_bufferGeometry = QRect(0, 0, 100, 100); QRect m_clientGeometry = QRect(0, 0, 100, 100); - QRect geom_restore; QRect geom_fs_restore; QTimer* shadeHoverTimer; xcb_colormap_t m_colormap; @@ -617,16 +615,6 @@ inline ShadeMode X11Client::shadeMode() const return shade_mode; } -inline QRect X11Client::geometryRestore() const -{ - return geom_restore; -} - -inline void X11Client::setGeometryRestore(const QRect &geo) -{ - geom_restore = geo; -} - inline MaximizeMode X11Client::maximizeMode() const { return max_mode; diff --git a/xdgshellclient.cpp b/xdgshellclient.cpp index 1e3ca9458c..72865ac9f8 100644 --- a/xdgshellclient.cpp +++ b/xdgshellclient.cpp @@ -153,7 +153,7 @@ void XdgShellClient::init() connect(this, &AbstractClient::clientStartUserMovedResized, this, configure); connect(this, &AbstractClient::clientFinishUserMovedResized, this, configure); - connect(this, &XdgShellClient::geometryChanged, this, &XdgShellClient::updateClientOutputs); + connect(this, &XdgShellClient::frameGeometryChanged, this, &XdgShellClient::updateClientOutputs); connect(screens(), &Screens::changed, this, &XdgShellClient::updateClientOutputs); } else if (m_xdgShellPopup) { connect(m_xdgShellPopup, &XdgShellPopupInterface::configureAcknowledged, this, &XdgShellClient::handleConfigureAcknowledged); @@ -569,9 +569,9 @@ void XdgShellClient::doSetGeometry(const QRect &rect) return; } - if (m_unmapped && m_geomMaximizeRestore.isEmpty() && !m_frameGeometry.isEmpty()) { + if (m_unmapped && geometryRestore().isEmpty() && !m_frameGeometry.isEmpty()) { // use first valid geometry as restore geometry - m_geomMaximizeRestore = m_frameGeometry; + setGeometryRestore(m_frameGeometry); } if (frameGeometryIsChanged) { @@ -579,12 +579,13 @@ void XdgShellClient::doSetGeometry(const QRect &rect) workspace()->updateClientArea(); } updateWindowRules(Rules::Position | Rules::Size); + emit frameGeometryChanged(this, frameGeometryBeforeUpdateBlocking()); } - const auto old = frameGeometryBeforeUpdateBlocking(); + emit geometryShapeChanged(this, frameGeometryBeforeUpdateBlocking()); + addRepaintDuringGeometryUpdates(); updateGeometryBeforeUpdateBlocking(); - emit geometryShapeChanged(this, old); if (isResize()) { performMoveResize(); @@ -833,7 +834,7 @@ void XdgShellClient::changeMaximize(bool horizontal, bool vertical, bool adjust) const auto oldQuickTileMode = quickTileMode(); if (quickTileMode() != QuickTileMode(QuickTileFlag::None)) { if (oldMode == MaximizeFull && - !clientArea.contains(m_geomMaximizeRestore.center())) { + !clientArea.contains(geometryRestore().center())) { // Not restoring on the same screen // TODO: The following doesn't work for some reason //quick_tile_mode = QuickTileNone; // And exit quick tile mode manually @@ -845,7 +846,7 @@ void XdgShellClient::changeMaximize(bool horizontal, bool vertical, bool adjust) } if (m_requestedMaximizeMode == MaximizeFull) { - m_geomMaximizeRestore = oldGeometry; + setGeometryRestore(oldGeometry); // TODO: Client has more checks if (options->electricBorderMaximize()) { updateQuickTileMode(QuickTileFlag::Maximize); @@ -865,19 +866,14 @@ void XdgShellClient::changeMaximize(bool horizontal, bool vertical, bool adjust) emit quickTileModeChanged(); } - if (m_geomMaximizeRestore.isValid()) { - setFrameGeometry(m_geomMaximizeRestore); + if (geometryRestore().isValid()) { + setFrameGeometry(geometryRestore()); } else { setFrameGeometry(workspace()->clientArea(PlacementArea, this)); } } } -void XdgShellClient::setGeometryRestore(const QRect &geo) -{ - m_geomMaximizeRestore = geo; -} - MaximizeMode XdgShellClient::maximizeMode() const { return m_maximizeMode; @@ -888,11 +884,6 @@ MaximizeMode XdgShellClient::requestedMaximizeMode() const return m_requestedMaximizeMode; } -QRect XdgShellClient::geometryRestore() const -{ - return m_geomMaximizeRestore; -} - bool XdgShellClient::noBorder() const { if (m_serverDecoration) { @@ -1443,7 +1434,7 @@ void XdgShellClient::installPlasmaShellSurface(PlasmaShellSurfaceInterface *surf updatePosition(); updateRole(); updateShowOnScreenEdge(); - connect(this, &XdgShellClient::geometryChanged, this, &XdgShellClient::updateShowOnScreenEdge); + connect(this, &XdgShellClient::frameGeometryChanged, this, &XdgShellClient::updateShowOnScreenEdge); setSkipTaskbar(surface->skipTaskbar()); connect(surface, &PlasmaShellSurfaceInterface::skipTaskbarChanged, this, [this] { @@ -1632,6 +1623,8 @@ bool XdgShellClient::hasTransientPlacementHint() const QRect XdgShellClient::transientPlacement(const QRect &bounds) const { + Q_ASSERT(m_xdgShellPopup); + QRect anchorRect; Qt::Edges anchorEdge; Qt::Edges gravity; @@ -1640,7 +1633,6 @@ QRect XdgShellClient::transientPlacement(const QRect &bounds) const QSize size = frameGeometry().size(); const QPoint parentClientPos = transientFor()->pos() + transientFor()->clientPos(); - QRect popupPosition; // returns if a target is within the supplied bounds, optional edges argument states which side to check auto inBounds = [bounds](const QRect &target, Qt::Edges edges = Qt::LeftEdge | Qt::RightEdge | Qt::TopEdge | Qt::BottomEdge) -> bool { @@ -1660,31 +1652,25 @@ QRect XdgShellClient::transientPlacement(const QRect &bounds) const return true; }; - if (m_xdgShellPopup) { - anchorRect = m_xdgShellPopup->anchorRect(); - anchorEdge = m_xdgShellPopup->anchorEdge(); - gravity = m_xdgShellPopup->gravity(); - offset = m_xdgShellPopup->anchorOffset(); - constraintAdjustments = m_xdgShellPopup->constraintAdjustments(); - if (!size.isValid()) { - size = m_xdgShellPopup->initialSize(); - } - } else { - Q_UNREACHABLE(); + anchorRect = m_xdgShellPopup->anchorRect(); + anchorEdge = m_xdgShellPopup->anchorEdge(); + gravity = m_xdgShellPopup->gravity(); + offset = m_xdgShellPopup->anchorOffset(); + constraintAdjustments = m_xdgShellPopup->constraintAdjustments(); + if (!size.isValid()) { + size = m_xdgShellPopup->initialSize(); } - - //initial position - popupPosition = QRect(popupOffset(anchorRect, anchorEdge, gravity, size) + offset + parentClientPos, size); + QRect popupRect(popupOffset(anchorRect, anchorEdge, gravity, size) + offset + parentClientPos, size); //if that fits, we don't need to do anything - if (inBounds(popupPosition)) { - return popupPosition; + if (inBounds(popupRect)) { + return popupRect; } //otherwise apply constraint adjustment per axis in order XDG Shell Popup states if (constraintAdjustments & PositionerConstraint::FlipX) { - if (!inBounds(popupPosition, Qt::LeftEdge | Qt::RightEdge)) { + if (!inBounds(popupRect, Qt::LeftEdge | Qt::RightEdge)) { //flip both edges (if either bit is set, XOR both) auto flippedAnchorEdge = anchorEdge; if (flippedAnchorEdge & (Qt::LeftEdge | Qt::RightEdge)) { @@ -1694,30 +1680,39 @@ QRect XdgShellClient::transientPlacement(const QRect &bounds) const if (flippedGravity & (Qt::LeftEdge | Qt::RightEdge)) { flippedGravity ^= (Qt::LeftEdge | Qt::RightEdge); } - auto flippedPopupPosition = QRect(popupOffset(anchorRect, flippedAnchorEdge, flippedGravity, size) + offset + parentClientPos, size); + auto flippedPopupRect = QRect(popupOffset(anchorRect, flippedAnchorEdge, flippedGravity, size) + offset + parentClientPos, size); //if it still doesn't fit we should continue with the unflipped version - if (inBounds(flippedPopupPosition, Qt::LeftEdge | Qt::RightEdge)) { - popupPosition.moveLeft(flippedPopupPosition.x()); + if (inBounds(flippedPopupRect, Qt::LeftEdge | Qt::RightEdge)) { + popupRect.moveLeft(flippedPopupRect.left()); } } } if (constraintAdjustments & PositionerConstraint::SlideX) { - if (!inBounds(popupPosition, Qt::LeftEdge)) { - popupPosition.moveLeft(bounds.x()); + if (!inBounds(popupRect, Qt::LeftEdge)) { + popupRect.moveLeft(bounds.left()); } - if (!inBounds(popupPosition, Qt::RightEdge)) { - // moveRight suffers from the classic QRect off by one issue - popupPosition.moveLeft(bounds.x() + bounds.width() - size.width()); + if (!inBounds(popupRect, Qt::RightEdge)) { + popupRect.moveRight(bounds.right()); } } if (constraintAdjustments & PositionerConstraint::ResizeX) { - //TODO - //but we need to sort out when this is run as resize should only happen before first configure + QRect unconstrainedRect = popupRect; + + if (!inBounds(unconstrainedRect, Qt::LeftEdge)) { + unconstrainedRect.setLeft(bounds.left()); + } + if (!inBounds(unconstrainedRect, Qt::RightEdge)) { + unconstrainedRect.setRight(bounds.right()); + } + + if (unconstrainedRect.isValid()) { + popupRect = unconstrainedRect; + } } if (constraintAdjustments & PositionerConstraint::FlipY) { - if (!inBounds(popupPosition, Qt::TopEdge | Qt::BottomEdge)) { + if (!inBounds(popupRect, Qt::TopEdge | Qt::BottomEdge)) { //flip both edges (if either bit is set, XOR both) auto flippedAnchorEdge = anchorEdge; if (flippedAnchorEdge & (Qt::TopEdge | Qt::BottomEdge)) { @@ -1727,27 +1722,38 @@ QRect XdgShellClient::transientPlacement(const QRect &bounds) const if (flippedGravity & (Qt::TopEdge | Qt::BottomEdge)) { flippedGravity ^= (Qt::TopEdge | Qt::BottomEdge); } - auto flippedPopupPosition = QRect(popupOffset(anchorRect, flippedAnchorEdge, flippedGravity, size) + offset + parentClientPos, size); + auto flippedPopupRect = QRect(popupOffset(anchorRect, flippedAnchorEdge, flippedGravity, size) + offset + parentClientPos, size); //if it still doesn't fit we should continue with the unflipped version - if (inBounds(flippedPopupPosition, Qt::TopEdge | Qt::BottomEdge)) { - popupPosition.moveTop(flippedPopupPosition.y()); + if (inBounds(flippedPopupRect, Qt::TopEdge | Qt::BottomEdge)) { + popupRect.moveTop(flippedPopupRect.top()); } } } if (constraintAdjustments & PositionerConstraint::SlideY) { - if (!inBounds(popupPosition, Qt::TopEdge)) { - popupPosition.moveTop(bounds.y()); + if (!inBounds(popupRect, Qt::TopEdge)) { + popupRect.moveTop(bounds.top()); } - if (!inBounds(popupPosition, Qt::BottomEdge)) { - popupPosition.moveTop(bounds.y() + bounds.height() - size.height()); + if (!inBounds(popupRect, Qt::BottomEdge)) { + popupRect.moveBottom(bounds.bottom()); } } if (constraintAdjustments & PositionerConstraint::ResizeY) { - //TODO + QRect unconstrainedRect = popupRect; + + if (!inBounds(unconstrainedRect, Qt::TopEdge)) { + unconstrainedRect.setTop(bounds.top()); + } + if (!inBounds(unconstrainedRect, Qt::BottomEdge)) { + unconstrainedRect.setBottom(bounds.bottom()); + } + + if (unconstrainedRect.isValid()) { + popupRect = unconstrainedRect; + } } - return popupPosition; + return popupRect; } QPoint XdgShellClient::popupOffset(const QRect &anchorRect, const Qt::Edges anchorEdge, const Qt::Edges gravity, const QSize popupSize) const diff --git a/xdgshellclient.h b/xdgshellclient.h index aa5bac43e9..41c59bbbef 100644 --- a/xdgshellclient.h +++ b/xdgshellclient.h @@ -87,7 +87,6 @@ public: void hideClient(bool hide) override; MaximizeMode maximizeMode() const override; MaximizeMode requestedMaximizeMode() const override; - QRect geometryRestore() const override; bool noBorder() const override; void setFullScreen(bool set, bool user = true) override; void setNoBorder(bool set) override; @@ -136,7 +135,6 @@ protected: bool belongsToDesktop() const override; Layer layerForDock() const override; void changeMaximize(bool horizontal, bool vertical, bool adjust) override; - void setGeometryRestore(const QRect &geo) override; void doResizeSync() override; bool acceptsFocus() const override; void doMinimize() override; @@ -225,7 +223,6 @@ private: bool m_closing = false; quint32 m_windowId = 0; bool m_unmapped = true; - QRect m_geomMaximizeRestore; // size and position of the window before it was set to maximize NET::WindowType m_windowType = NET::Normal; QPointer m_plasmaShellSurface; QPointer m_appMenuInterface;