File indexing completed on 2024-11-10 04:56:36

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2011 Arthur Arlt <a.arlt@stud.uni-heidelberg.de>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "core/overlaywindow.h"
0013 #include "x11eventfilter.h"
0014 
0015 namespace KWin
0016 {
0017 
0018 class X11StandaloneBackend;
0019 
0020 class KWIN_EXPORT OverlayWindowX11 : public OverlayWindow, public X11EventFilter
0021 {
0022 public:
0023     explicit OverlayWindowX11(X11StandaloneBackend *backend);
0024     ~OverlayWindowX11() override;
0025     /// Creates XComposite overlay window, call initOverlay() and resize afterwards
0026     bool create() override;
0027     /// Init overlay and the destination window in it
0028     void setup(xcb_window_t window) override;
0029     void show() override;
0030     void hide() override; // hides and resets overlay window
0031     void setShape(const QRegion &reg);
0032     void resize(const QSize &size) override;
0033     /// Destroys XComposite overlay window
0034     void destroy() override;
0035     xcb_window_t window() const override;
0036     bool isVisible() const override;
0037     void setVisibility(bool visible) override;
0038 
0039     bool event(xcb_generic_event_t *event) override;
0040 
0041 private:
0042     void setNoneBackgroundPixmap(xcb_window_t window);
0043     void setupInputShape(xcb_window_t window);
0044     bool m_visible;
0045     bool m_shown; // For showOverlay()
0046 
0047     X11StandaloneBackend *m_backend;
0048     QSize m_size;
0049     QRegion m_shape;
0050     xcb_window_t m_window;
0051 };
0052 } // namespace