KWindowSystem

kwindoweffects.h
1/*
2 SPDX-FileCopyrightText: 2009 Marco Martin <notmart@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef KWINDOWEFFECTS_H
8#define KWINDOWEFFECTS_H
9
10#include "kwindowsystem_export.h"
11#include <optional>
12
13#include <QWidgetList> // for WId, etc.
14
15#include <QColor>
16#include <QRegion>
17
18/**
19 * Namespace for common standardized window effects
20 */
21namespace KWindowEffects
22{
23enum Effect {
24 Slide = 1,
25 BlurBehind = 7,
26 BackgroundContrast = 9,
27};
28
29enum SlideFromLocation {
30 NoEdge = 0,
31 TopEdge,
35};
36/**
37 * @return if an atom property is available
38 *
39 * @param effect the effect we want to check
40 */
41KWINDOWSYSTEM_EXPORT bool isEffectAvailable(Effect effect);
42
43/**
44 * Instructs the window manager to blur the background
45 * in the specified region behind the given window.
46 * The given region will overwrite any previous blur-behind region.
47 * Passing a null region will enable the blur effect for the whole window.
48 * The region is relative to the top-left corner of the client area.
49 *
50 * If @a enable is @c false, blur will be disabled for the whole window
51 * (@a region is ignored).
52 *
53 * Note that you will usually want to set the region to the shape of the window,
54 * excluding any shadow or halo.
55 *
56 * @param window The window for which to enable the blur effect
57 * @param enable Enable the effect if @c true, disable it if @c false
58 * @param region The region within the window where the background will be blurred, specified in logical pixels
59 *
60 * @since 5.82
61 */
62KWINDOWSYSTEM_EXPORT void enableBlurBehind(QWindow *window, bool enable = true, const QRegion &region = QRegion());
63
64/**
65 * Instructs the window manager to modify the color of the background
66 * in the specified region behind the given window,
67 * in order to improve the contrast and readability of any text
68 * in the translucent window.
69 * The given region will overwrite any previous backgroundcontrast region.
70 * Passing a null region will enable the blur effect for the whole window.
71 * The region is relative to the top-left corner of the client area.
72 *
73 * If @a enable is @c false, blur will be disabled for the whole window
74 * (@a region is ignored).
75 *
76 * Note that you will usually want to set the region to the shape of the window,
77 * excluding any shadow or halo.
78 *
79 * @param window The window for which to enable the background contrast effect
80 * @param enable Enable the effect if @c true, disable it if @c false
81 * @param brightness How to modify the area brightness: from 0 (make it black) to 2 (make it white), 1 leaves it unchanged
82 * @param region The region within the window where the background will be modified, specified in logical pixels
83 *
84 * @since 5.82
85 */
86KWINDOWSYSTEM_EXPORT void
87enableBackgroundContrast(QWindow *window, bool enable = true, qreal contrast = 1, qreal intensity = 1, qreal saturation = 1, const QRegion &region = QRegion());
88
89/**
90 * Mark a window as sliding from screen edge
91 *
92 * @param id of the window on which we want to apply the effect
93 * @param location edge of the screen from which we want the sliding effect.
94 * Desktop and Floating won't have effect.
95 * @param offset distance in pixels from the screen edge defined by location
96 *
97 * @since 5.82
98 */
99KWINDOWSYSTEM_EXPORT void slideWindow(QWindow *window, SlideFromLocation location, int offset = -1);
100}
101
102#endif
Namespace for common standardized window effects.
void slideWindow(QWindow *window, SlideFromLocation location, int offset)
Mark a window as sliding from screen edge.
void enableBlurBehind(QWindow *window, bool enable, const QRegion &region)
Instructs the window manager to blur the background in the specified region behind the given window.
void enableBackgroundContrast(QWindow *window, bool enable, qreal contrast, qreal intensity, qreal saturation, const QRegion &region)
Instructs the window manager to modify the color of the background in the specified region behind the...
bool isEffectAvailable(Effect effect)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.