File indexing completed on 2024-04-07 07:29:40

0001 /*
0002     SPDX-FileCopyrightText: 2009 Marco Martin <notmart@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef KWINDOWEFFECTS_H
0008 #define KWINDOWEFFECTS_H
0009 
0010 #include "kwindowsystem_export.h"
0011 #include <optional>
0012 
0013 #include <QWidgetList> // for WId, etc.
0014 
0015 #include <QColor>
0016 #include <QRegion>
0017 
0018 /**
0019  * Namespace for common standardized window effects
0020  */
0021 namespace KWindowEffects
0022 {
0023 enum Effect {
0024     Slide = 1,
0025     BlurBehind = 7,
0026     BackgroundContrast = 9,
0027 };
0028 
0029 enum SlideFromLocation {
0030     NoEdge = 0,
0031     TopEdge,
0032     RightEdge,
0033     BottomEdge,
0034     LeftEdge,
0035 };
0036 /**
0037  * @return if an atom property is available
0038  *
0039  * @param effect the effect we want to check
0040  */
0041 KWINDOWSYSTEM_EXPORT bool isEffectAvailable(Effect effect);
0042 
0043 /**
0044  * Instructs the window manager to blur the background
0045  * in the specified region behind the given window.
0046  * The given region will overwrite any previous blur-behind region.
0047  * Passing a null region will enable the blur effect for the whole window.
0048  * The region is relative to the top-left corner of the client area.
0049  *
0050  * If @a enable is @c false, blur will be disabled for the whole window
0051  * (@a region is ignored).
0052  *
0053  * Note that you will usually want to set the region to the shape of the window,
0054  * excluding any shadow or halo.
0055  *
0056  * @param window The window for which to enable the blur effect
0057  * @param enable Enable the effect if @c true, disable it if @c false
0058  * @param region The region within the window where the background will be blurred, specified in logical pixels
0059  *
0060  * @since 5.82
0061  */
0062 KWINDOWSYSTEM_EXPORT void enableBlurBehind(QWindow *window, bool enable = true, const QRegion &region = QRegion());
0063 
0064 /**
0065  * Instructs the window manager to modify the color of the background
0066  * in the specified region behind the given window,
0067  * in order to improve the contrast and readability of any text
0068  * in the translucent window.
0069  * The given region will overwrite any previous backgroundcontrast region.
0070  * Passing a null region will enable the blur effect for the whole window.
0071  * The region is relative to the top-left corner of the client area.
0072  *
0073  * If @a enable is @c false, blur will be disabled for the whole window
0074  * (@a region is ignored).
0075  *
0076  * Note that you will usually want to set the region to the shape of the window,
0077  * excluding any shadow or halo.
0078  *
0079  * @param window The window for which to enable the background contrast effect
0080  * @param enable Enable the effect if @c true, disable it if @c false
0081  * @param brightness How to modify the area brightness: from 0 (make it black) to 2 (make it white), 1 leaves it unchanged
0082  * @param region The region within the window where the background will be modified, specified in logical pixels
0083  *
0084  * @since 5.82
0085  */
0086 KWINDOWSYSTEM_EXPORT void
0087 enableBackgroundContrast(QWindow *window, bool enable = true, qreal contrast = 1, qreal intensity = 1, qreal saturation = 1, const QRegion &region = QRegion());
0088 
0089 /**
0090  * Mark a window as sliding from screen edge
0091  *
0092  * @param id of the window on which we want to apply the effect
0093  * @param location edge of the screen from which we want the sliding effect.
0094  *               Desktop and Floating won't have effect.
0095  * @param offset distance in pixels from the screen edge defined by location
0096  *
0097  * @since 5.82
0098  */
0099 KWINDOWSYSTEM_EXPORT void slideWindow(QWindow *window, SlideFromLocation location, int offset = -1);
0100 }
0101 
0102 #endif