From 658ff303fe5d66e32ac18ed76788c8b71f5eca86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 28 Jan 2015 09:46:31 +0100 Subject: [PATCH 1/2] [effects] Support building the effect_builtins without need to link the lib This change allows to include the effect_builtins.cpp into the build of e.g. a kcm without having to link against all effects. The use case for this is when one needs to resolve just the name of an effect without wanting to hard code the name. --- effects/CMakeLists.txt | 2 +- effects/effect_builtins.cpp | 284 ++++++++++++++++++++++++++---------- 2 files changed, 207 insertions(+), 79 deletions(-) diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 3a90b20c21..b8d6f61de8 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -1,5 +1,5 @@ # KI18N Translation Domain for this library -add_definitions(-DTRANSLATION_DOMAIN=\"kwin_effects\") +add_definitions(-DTRANSLATION_DOMAIN=\"kwin_effects\" -DEFFECT_BUILTINS) include_directories(${KWIN_SOURCE_DIR}) # for xcbutils.h diff --git a/effects/effect_builtins.cpp b/effects/effect_builtins.cpp index 7dcf79f07c..be508e6fea 100644 --- a/effects/effect_builtins.cpp +++ b/effects/effect_builtins.cpp @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #include "effect_builtins.h" +#ifdef EFFECT_BUILTINS // common effects #include "backgroundcontrast/contrast.h" #include "blur/blur.h" @@ -60,6 +61,16 @@ along with this program. If not, see . #include "startupfeedback/startupfeedback.h" #include "trackmouse/trackmouse.h" #include "wobblywindows/wobblywindows.h" +#endif + +#include +#include + +#ifndef EFFECT_BUILTINS +#define EFFECT_FALLBACK nullptr, nullptr, nullptr +#else +#define EFFECT_FALLBACK +#endif namespace KWin { @@ -88,472 +99,589 @@ static const QVector s_effectData = { nullptr }, { QStringLiteral("blur"), - i18nc("Name of a KWin Effect", "Blur"), - i18nc("Comment describing the KWin Effect", "Blurs the background behind semi-transparent windows"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Blur"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Blurs the background behind semi-transparent windows"), QStringLiteral("Appearance"), QString(), QUrl(), true, false, +#ifdef EFFECT_BUILTINS &createHelper, &BlurEffect::supported, &BlurEffect::enabledByDefault +#endif +EFFECT_FALLBACK }, { QStringLiteral("contrast"), - i18nc("Name of a KWin Effect", "Background contrast"), - i18nc("Comment describing the KWin Effect", "Improve contrast and readability behind semi-transparent windows"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Background contrast"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Improve contrast and readability behind semi-transparent windows"), QStringLiteral("Appearance"), QString(), QUrl(), true, false, +#ifdef EFFECT_BUILTINS &createHelper, &ContrastEffect::supported, &ContrastEffect::enabledByDefault +#endif +EFFECT_FALLBACK }, { QStringLiteral("coverswitch"), - i18nc("Name of a KWin Effect", "Cover Switch"), - i18nc("Comment describing the KWin Effect", "Display a Cover Flow effect for the alt+tab window switcher"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Cover Switch"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Display a Cover Flow effect for the alt+tab window switcher"), QStringLiteral("Window Management"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/cover_switch.mp4")), false, true, +#ifdef EFFECT_BUILTINS &createHelper, &CoverSwitchEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("cube"), - i18nc("Name of a KWin Effect", "Desktop Cube"), - i18nc("Comment describing the KWin Effect", "Display each virtual desktop on a side of a cube"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Desktop Cube"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Display each virtual desktop on a side of a cube"), QStringLiteral("Window Management"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/desktop_cube.ogv")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, &CubeEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("cubeslide"), - i18nc("Name of a KWin Effect", "Desktop Cube Animation"), - i18nc("Comment describing the KWin Effect", "Animate desktop switching with a cube"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Desktop Cube Animation"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Animate desktop switching with a cube"), QStringLiteral("Virtual Desktop Switching Animation"), QStringLiteral("desktop-animations"), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/desktop_cube_animation.ogv")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, &CubeSlideEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("dashboard"), - i18nc("Name of a KWin Effect", "Dashboard"), - i18nc("Comment describing the KWin Effect", "Desaturate the desktop when displaying the Plasma dashboard"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Dashboard"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Desaturate the desktop when displaying the Plasma dashboard"), QStringLiteral("Appearance"), QString(), QUrl(), true, true, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("desktopgrid"), - i18nc("Name of a KWin Effect", "Desktop Grid"), - i18nc("Comment describing the KWin Effect", "Zoom out so all desktops are displayed side-by-side in a grid"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Desktop Grid"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Zoom out so all desktops are displayed side-by-side in a grid"), QStringLiteral("Window Management"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/desktop_grid.mp4")), true, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("diminactive"), - i18nc("Name of a KWin Effect", "Dim Inactive"), - i18nc("Comment describing the KWin Effect", "Darken inactive windows"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Dim Inactive"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Darken inactive windows"), QStringLiteral("Focus"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/dim_inactive.mp4")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("dimscreen"), - i18nc("Name of a KWin Effect", "Dim Screen for Administrator Mode"), - i18nc("Comment describing the KWin Effect", "Darkens the entire screen when requesting root privileges"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Dim Screen for Administrator Mode"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Darkens the entire screen when requesting root privileges"), QStringLiteral("Focus"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/dim_administration.mp4")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("fallapart"), - i18nc("Name of a KWin Effect", "Fall Apart"), - i18nc("Comment describing the KWin Effect", "Closed windows fall into pieces"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Fall Apart"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Closed windows fall into pieces"), QStringLiteral("Appearance"), QString(), QUrl(), false, false, +#ifdef EFFECT_BUILTINS &createHelper, &FallApartEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("flipswitch"), - i18nc("Name of a KWin Effect", "Flip Switch"), - i18nc("Comment describing the KWin Effect", "Flip through windows that are in a stack for the alt+tab window switcher"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Flip Switch"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Flip through windows that are in a stack for the alt+tab window switcher"), QStringLiteral("Window Management"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/flip_switch.mp4")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, &FlipSwitchEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("glide"), - i18nc("Name of a KWin Effect", "Glide"), - i18nc("Comment describing the KWin Effect", "Windows Glide Effect as they are open and closed"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Glide"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Windows Glide Effect as they are open and closed"), QStringLiteral("Appearance"), QString(), QUrl(), false, false, +#ifdef EFFECT_BUILTINS &createHelper, &GlideEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("highlightwindow"), - i18nc("Name of a KWin Effect", "Highlight Window"), - i18nc("Comment describing the KWin Effect", "Highlight the appropriate window when hovering over taskbar entries"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Highlight Window"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Highlight the appropriate window when hovering over taskbar entries"), QStringLiteral("Appearance"), QString(), QUrl(), true, true, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("invert"), - i18nc("Name of a KWin Effect", "Invert"), - i18nc("Comment describing the KWin Effect", "Inverts the color of the desktop and windows"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Invert"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Inverts the color of the desktop and windows"), QStringLiteral("Accessibility"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/invert.mp4")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, &InvertEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("kscreen"), - i18nc("Name of a KWin Effect", "Kscreen"), - i18nc("Comment describing the KWin Effect", "Helper Effect for KScreen"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Kscreen"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Helper Effect for KScreen"), QStringLiteral("Appearance"), QString(), QUrl(), true, true, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("logout"), - i18nc("Name of a KWin Effect", "Logout"), - i18nc("Comment describing the KWin Effect", "Desaturate the desktop when displaying the logout dialog"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Logout"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Desaturate the desktop when displaying the logout dialog"), QStringLiteral("Appearance"), QString(), QUrl(), true, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("lookingglass"), - i18nc("Name of a KWin Effect", "Looking Glass"), - i18nc("Comment describing the KWin Effect", "A screen magnifier that looks like a fisheye lens"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Looking Glass"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "A screen magnifier that looks like a fisheye lens"), QStringLiteral("Accessibility"), QStringLiteral("magnifiers"), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/looking_glass.ogv")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, &LookingGlassEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("magiclamp"), - i18nc("Name of a KWin Effect", "Magic Lamp"), - i18nc("Comment describing the KWin Effect", "Simulate a magic lamp when minimizing windows"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Magic Lamp"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Simulate a magic lamp when minimizing windows"), QStringLiteral("Appearance"), QStringLiteral("minimize"), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/magic_lamp.ogv")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, &MagicLampEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("magnifier"), - i18nc("Name of a KWin Effect", "Magnifier"), - i18nc("Comment describing the KWin Effect", "Magnify the section of the screen that is near the mouse cursor"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Magnifier"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Magnify the section of the screen that is near the mouse cursor"), QStringLiteral("Accessibility"), QStringLiteral("magnifiers"), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/magnifier.ogv")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, &MagnifierEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("minimizeanimation"), - i18nc("Name of a KWin Effect", "Minimize Animation"), - i18nc("Comment describing the KWin Effect", "Animate the minimizing of windows"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Minimize Animation"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Animate the minimizing of windows"), QStringLiteral("Appearance"), QStringLiteral("minimize"), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/minimize.ogv")), true, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("mouseclick"), - i18nc("Name of a KWin Effect", "Mouse Click Animation"), - i18nc("Comment describing the KWin Effect", "Creates an animation whenever a mouse button is clicked. This is useful for screenrecordings/presentations"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Mouse Click Animation"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Creates an animation whenever a mouse button is clicked. This is useful for screenrecordings/presentations"), QStringLiteral("Accessibility"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/mouse_click.mp4")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("mousemark"), - i18nc("Name of a KWin Effect", "Mouse Mark"), - i18nc("Comment describing the KWin Effect", "Allows you to draw lines on the desktop"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Mouse Mark"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Allows you to draw lines on the desktop"), QStringLiteral("Appearance"), QString(), QUrl(), false, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("presentwindows"), - i18nc("Name of a KWin Effect", "Present Windows"), - i18nc("Comment describing the KWin Effect", "Zoom out until all opened windows can be displayed side-by-side"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Present Windows"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Zoom out until all opened windows can be displayed side-by-side"), QStringLiteral("Window Management"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/present_windows.mp4")), true, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("resize"), - i18nc("Name of a KWin Effect", "Resize Window"), - i18nc("Comment describing the KWin Effect", "Resizes windows with a fast texture scale instead of updating contents"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Resize Window"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Resizes windows with a fast texture scale instead of updating contents"), QStringLiteral("Window Management"), QString(), QUrl(), false, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("screenedge"), - i18nc("Name of a KWin Effect", "Screen Edge"), - i18nc("Comment describing the KWin Effect", "Highlights a screen edge when approaching"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Screen Edge"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Highlights a screen edge when approaching"), QStringLiteral("Appearance"), QString(), QUrl(), true, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("screenshot"), - i18nc("Name of a KWin Effect", "Screenshot"), - i18nc("Comment describing the KWin Effect", "Helper effect for KSnapshot"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Screenshot"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Helper effect for KSnapshot"), QStringLiteral("Appearance"), QString(), QUrl(), true, true, +#ifdef EFFECT_BUILTINS &createHelper, &ScreenShotEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("sheet"), - i18nc("Name of a KWin Effect", "Sheet"), - i18nc("Comment describing the KWin Effect", "Make modal dialogs smoothly fly in and out when they are shown or hidden"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Sheet"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Make modal dialogs smoothly fly in and out when they are shown or hidden"), QStringLiteral("Appearance"), QString(), QUrl(), false, false, +#ifdef EFFECT_BUILTINS &createHelper, &SheetEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("showfps"), - i18nc("Name of a KWin Effect", "Show FPS"), - i18nc("Comment describing the KWin Effect", "Display KWin's performance in the corner of the screen"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Show FPS"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Display KWin's performance in the corner of the screen"), QStringLiteral("Tools"), QString(), QUrl(), false, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("showpaint"), - i18nc("Name of a KWin Effect", "Show Paint"), - i18nc("Comment describing the KWin Effect", "Highlight areas of the desktop that have been recently updated"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Show Paint"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Highlight areas of the desktop that have been recently updated"), QStringLiteral("Tools"), QString(), QUrl(), false, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("slide"), - i18nc("Name of a KWin Effect", "Slide"), - i18nc("Comment describing the KWin Effect", "Slide windows across the screen when switching virtual desktops"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Slide"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Slide windows across the screen when switching virtual desktops"), QStringLiteral("Virtual Desktop Switching Animation"), QStringLiteral("desktop-animations"), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/slide.ogv")), true, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("slideback"), - i18nc("Name of a KWin Effect", "Slide Back"), - i18nc("Comment describing the KWin Effect", "Slide back windows when another window is raised"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Slide Back"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Slide back windows when another window is raised"), QStringLiteral("Focus"), QString(), QUrl(), false, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("slidingpopups"), - i18nc("Name of a KWin Effect", "Sliding popups"), - i18nc("Comment describing the KWin Effect", "Sliding animation for Plasma popups"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Sliding popups"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Sliding animation for Plasma popups"), QStringLiteral("Appearance"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/sliding_popups.mp4")), true, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("snaphelper"), - i18nc("Name of a KWin Effect", "Snap Helper"), - i18nc("Comment describing the KWin Effect", "Help you locate the center of the screen when moving a window"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Snap Helper"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Help you locate the center of the screen when moving a window"), QStringLiteral("Accessibility"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/snap_helper.mp4")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("startupfeedback"), - i18nc("Name of a KWin Effect", "Startup Feedback"), - i18nc("Comment describing the KWin Effect", "Helper effect for startup feedback"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Startup Feedback"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Helper effect for startup feedback"), QStringLiteral("Candy"), QString(), QUrl(), true, true, +#ifdef EFFECT_BUILTINS &createHelper, &StartupFeedbackEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("thumbnailaside"), - i18nc("Name of a KWin Effect", "Thumbnail Aside"), - i18nc("Comment describing the KWin Effect", "Display window thumbnails on the edge of the screen"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Thumbnail Aside"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Display window thumbnails on the edge of the screen"), QStringLiteral("Appearance"), QString(), QUrl(), false, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("trackmouse"), - i18nc("Name of a KWin Effect", "Track Mouse"), - i18nc("Comment describing the KWin Effect", "Display a mouse cursor locating effect when activated"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Track Mouse"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Display a mouse cursor locating effect when activated"), QStringLiteral("Accessibility"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/track_mouse.mp4")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("windowgeometry"), - i18nc("Name of a KWin Effect", "Window Geometry"), - i18nc("Comment describing the KWin Effect", "Display window geometries on move/resize"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Window Geometry"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Display window geometries on move/resize"), QStringLiteral("Appearance"), QString(), QUrl(), false, true, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("wobblywindows"), - i18nc("Name of a KWin Effect", "Wobbly Windows"), - i18nc("Comment describing the KWin Effect", "Deform windows while they are moving"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Wobbly Windows"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Deform windows while they are moving"), QStringLiteral("Appearance"), QString(), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/wobbly_windows.ogv")), false, false, +#ifdef EFFECT_BUILTINS &createHelper, &WobblyWindowsEffect::supported, nullptr +#endif +EFFECT_FALLBACK }, { QStringLiteral("zoom"), - i18nc("Name of a KWin Effect", "Zoom"), - i18nc("Comment describing the KWin Effect", "Magnify the entire desktop"), + i18ndc("kwin_effects", "Name of a KWin Effect", "Zoom"), + i18ndc("kwin_effects", "Comment describing the KWin Effect", "Magnify the entire desktop"), QStringLiteral("Accessibility"), QStringLiteral("magnifiers"), QUrl(QStringLiteral("http://files.kde.org/plasma/kwin/effect-videos/zoom.ogv")), true, false, +#ifdef EFFECT_BUILTINS &createHelper, nullptr, nullptr +#endif +EFFECT_FALLBACK } }; From 62d71bc2470829128cee4cee8e46cc8f28e748f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 26 Jan 2015 11:41:09 +0100 Subject: [PATCH 2/2] [kcmkwin/options] Load/Unload WindowGeometry effect Depending on the state of the show window geometry we need to load or unload the effect. BUG: 343272 FIXED-IN: 5.2.1 REVIEW: 122258 --- kcmkwin/kwinoptions/CMakeLists.txt | 6 ++++-- kcmkwin/kwinoptions/windows.cpp | 14 +++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/kcmkwin/kwinoptions/CMakeLists.txt b/kcmkwin/kwinoptions/CMakeLists.txt index 458139ab68..ea719b391a 100644 --- a/kcmkwin/kwinoptions/CMakeLists.txt +++ b/kcmkwin/kwinoptions/CMakeLists.txt @@ -2,10 +2,12 @@ # KI18N Translation Domain for this library add_definitions(-DTRANSLATION_DOMAIN=\"kcmkwm\") -set(kcm_kwinoptions_PART_SRCS windows.cpp mouse.cpp main.cpp ) +set(kcm_kwinoptions_PART_SRCS windows.cpp mouse.cpp main.cpp ${KWIN_SOURCE_DIR}/effects/effect_builtins.cpp ) ki18n_wrap_ui(kcm_kwinoptions_PART_SRCS actions.ui advanced.ui focus.ui mouse.ui moving.ui) +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) +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/windows.cpp b/kcmkwin/kwinoptions/windows.cpp index 3ca2348d42..2eba5fed0e 100644 --- a/kcmkwin/kwinoptions/windows.cpp +++ b/kcmkwin/kwinoptions/windows.cpp @@ -41,6 +41,8 @@ #include #include "windows.h" +#include +#include // kwin config keywords #define KWIN_FOCUS "FocusPolicy" @@ -585,7 +587,8 @@ void KMovingConfig::save(void) cg.writeEntry(KWM_CNTR_SNAP_ZONE, getCenterSnapZone()); cg.writeEntry("SnapOnlyWhenOverlapping", m_ui->OverlapSnap->isChecked()); - KConfigGroup(config, "Plugins").writeEntry("windowgeometryEnabled", getGeometryTip()); + const bool geometryTip = getGeometryTip(); + KConfigGroup(config, "Plugins").writeEntry("windowgeometryEnabled", geometryTip); if (standAlone) { config->sync(); @@ -594,6 +597,15 @@ void KMovingConfig::save(void) QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); QDBusConnection::sessionBus().send(message); } + // and reconfigure the effect + OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"), + QStringLiteral("/Effects"), + QDBusConnection::sessionBus()); + if (geometryTip) { + interface.loadEffect(KWin::BuiltInEffects::nameForEffect(KWin::BuiltInEffect::WindowGeometry)); + } else { + interface.unloadEffect(KWin::BuiltInEffects::nameForEffect(KWin::BuiltInEffect::WindowGeometry)); + } emit KCModule::changed(false); }