diff --git a/effects/eyeonscreen/package/metadata.desktop b/effects/eyeonscreen/package/metadata.desktop index 60e1123ec..bd4811c6d 100644 --- a/effects/eyeonscreen/package/metadata.desktop +++ b/effects/eyeonscreen/package/metadata.desktop @@ -1,64 +1,65 @@ [Desktop Entry] Name=Eye on Screen Name[ca]=Ull a la pantalla Name[cs]=Oko na obrazovce Name[en_GB]=Eye on Screen Name[es]=Ojo a la pantalla Name[et]=Eye on Screen Name[eu]=Begirada pantailan Name[fr]=Jeter un oeil sur le bureau Name[ia]=Eye On Screen (Oculo sur schermo) Name[id]=Mata di Layar Name[it]=Eye On Screen Name[ko]=화면 위의 눈 Name[lt]=Akis ekrane Name[nl]=Oog op scherm Name[nn]=Auge på skjerm Name[pt]=Olho no Ecrã Name[pt_BR]=Olho na tela Name[ru]=Втягивание окон в центр экрана +Name[sk]=Oko na obrazovke Name[sl]=Oko na zaslonu Name[sv]=Ögat på skärmen Name[uk]=Око на екрані Name[x-test]=xxEye on Screenxx Name[zh_CN]=关注屏幕 Name[zh_TW]=螢幕之眼 Icon=preferences-system-windows-effect-eyeonscreen Comment=Suck windows into the desktop Comment[ca]=Enganxa les finestres a l'escriptori Comment[en_GB]=Suck windows into the desktop Comment[es]=Aspirar las ventanas en el escritorio Comment[et]=Akende imemine töölauale Comment[eu]=Mahaigainak leihoak xurgatu Comment[fr]=Faire disparaître les fenêtres dans le bureau Comment[ia]=Suger fenestras in le scriptorio Comment[id]=Sedot window ke desktop Comment[it]=Risucchia le finestre nel desktop Comment[ko]=창을 바탕 화면으로 흡수 Comment[lt]=Įtraukti langus į darbalaukį Comment[nl]=Zuig vensters in het bureaublad Comment[nn]=Sug vindauge inn i skrivebordet Comment[pt]=Aspira as janelas para o ecrã Comment[pt_BR]=Suga as janelas para a área de trabalho Comment[ru]=Втягивание окон в центр рабочего стола Comment[sl]=Prisesa okna na namizje Comment[sv]=Sug in fönster i skrivbordet Comment[uk]=Засмоктування вікон до стільниці Comment[x-test]=xxSuck windows into the desktopxx Comment[zh_CN]=将窗口吸收到桌面 Comment[zh_TW]=將視窗吸進桌面 Type=Service X-Plasma-API=javascript X-Plasma-MainScript=code/main.js X-KDE-ServiceTypes=KWin/Effect X-KDE-PluginInfo-Author=Thomas Lübking X-KDE-PluginInfo-Email=thomas.luebking@gmail.com X-KDE-PluginInfo-Name=kwin4_effect_eyeonscreen X-KDE-PluginInfo-Version=0.1.0 X-KDE-PluginInfo-Category=Show Desktop Animation X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Ordering=50 X-KWin-Exclusive-Category=show-desktop diff --git a/effects/windowaperture/package/metadata.desktop b/effects/windowaperture/package/metadata.desktop index ba9b3063f..635b22dd7 100644 --- a/effects/windowaperture/package/metadata.desktop +++ b/effects/windowaperture/package/metadata.desktop @@ -1,82 +1,83 @@ [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 Name[da]=Vinduesblænding Name[de]=Fensteröffnung Name[el]=Διάφραγμα παραθύρου Name[en_GB]=Window Aperture Name[es]=Apertura de ventanas Name[et]=Aknaava Name[eu]=Leihoa irekitzea Name[fi]=Ikkunoiden siirto näytön kulmiin Name[fr]=Ouverture de la fenêtre Name[gl]=Apertura das xanelas Name[hu]=Ablakrekeszek Name[ia]=Aperturas de fenestra Name[id]=Window Melubang Name[it]=Apertura delle finestre Name[ko]=조리개 모양 배치 Name[lt]=Lango anga Name[nb]=Vindusåpning Name[nl]=Vensteropening Name[nn]=Vindaugsflukt Name[pl]=Przesłona okna Name[pt]=Aperto das Janelas Name[pt_BR]=Aperto das janelas Name[ro]=Diafragmă fereastră Name[ru]=Разбрасывание окон в стороны Name[sk]=Otvor okien Name[sl]=Zaslonka okna Name[sr]=Бленда прозора Name[sr@ijekavian]=Бленда прозора Name[sr@ijekavianlatin]=Blenda prozora Name[sr@latin]=Blenda prozora Name[sv]=Fönsteröppning Name[tr]=Pencere Açıklığı Name[uk]=Апертура вікна Name[x-test]=xxWindow Aperturexx Name[zh_CN]=窗口光圈 Name[zh_TW]=視窗光圈 Icon=preferences-system-windows-effect-windowaperture Comment=Move windows into screen corners Comment[ca]=Mou les finestres cap a les cantonades de la pantalla Comment[cs]=Přesunout okna do rohů obrazovky Comment[en_GB]=Move windows into screen corners Comment[es]=Mover las ventanas a las esquinas de la pantalla Comment[et]=Akende liigutamine ekraani nurkadesse Comment[eu]=Eraman leihoak pantailako bazterretara Comment[fr]=Déplace les fenêtres dans les coins de l'écran Comment[ia]=Move fenestra in angulos de schermo Comment[id]=Pindahkan window ke sudut layar Comment[it]=Sposta le finestre negli angoli dello schermo Comment[ko]=창을 화면 꼭짓점으로 이동 Comment[lt]=Perkelti langus į kampus Comment[nl]=Verplaats vensters in de hoeken van het scherm Comment[nn]=Flytt vindauge til skjermhjørne Comment[pt]=Mover as janelas para os cantos do ecrã Comment[pt_BR]=Move as janelas para os cantos da tela Comment[ru]=Перемещение окон в углы экрана +Comment[sk]=Presunúť okna do rohov obrazovky Comment[sl]=Pomakne okna v kote zaslona Comment[sv]=Flytta fönster till skärmhörn Comment[uk]=Пересування вікон до кутів екрана Comment[x-test]=xxMove windows into screen cornersxx Comment[zh_CN]=将窗口移动到屏幕角 Comment[zh_TW]=將視窗移至螢幕角落 Type=Service X-Plasma-API=javascript X-Plasma-MainScript=code/main.js X-KDE-ServiceTypes=KWin/Effect X-KDE-PluginInfo-Author=Thomas Lübking X-KDE-PluginInfo-Email=thomas.luebking@gmail.com X-KDE-PluginInfo-Name=kwin4_effect_windowaperture X-KDE-PluginInfo-Version=0.1.0 X-KDE-PluginInfo-Category=Show Desktop Animation X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Ordering=50 X-KWin-Exclusive-Category=show-desktop diff --git a/kcmkwin/kwincompositing/kwincompositing.desktop b/kcmkwin/kwincompositing/kwincompositing.desktop index b81cf4afb..0dbc8074d 100644 --- a/kcmkwin/kwincompositing/kwincompositing.desktop +++ b/kcmkwin/kwincompositing/kwincompositing.desktop @@ -1,130 +1,131 @@ [Desktop Entry] Exec=kcmshell5 kwincompositing Icon=preferences-desktop Type=Service X-KDE-ServiceTypes=KCModule X-DocPath=https://userbase.kde.org/Desktop_Effects_Performance#Advanced_Desktop_Effects_Settings X-KDE-Library=kwincompositing X-KDE-PluginKeyword=compositing X-KDE-ParentApp=kcontrol 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 Name[cs]=Kompozitor Name[da]=Compositor Name[de]=Compositor Name[el]=Συνθέτης Name[en_GB]=Compositor Name[es]=Compositor Name[et]=Komposiitor Name[eu]=Konposatzailea Name[fi]=Koostin Name[fr]=Compositeur Name[gl]=Compositor Name[hu]=Kompozitor Name[ia]=Compositor Name[id]=Kompositor Name[it]=Compositore Name[ja]=コンポジタ Name[ko]=컴포지터 Name[lt]=Kompozitorius Name[nb]=Sammensetter Name[nds]=Tosamensetten Name[nl]=Compositor Name[nn]=Samansetjar Name[pa]=ਕੰਪੋਜੀਟਰ Name[pl]=Kompozytor Name[pt]=Compositor Name[pt_BR]=Compositor Name[ro]=Compozitor Name[ru]=Обеспечение эффектов Name[sk]=Kompozítor Name[sl]=Upravljalnik skladnje Name[sr]=Слагач Name[sr@ijekavian]=Слагач Name[sr@ijekavianlatin]=Slagač Name[sr@latin]=Slagač Name[sv]=Sammansättning Name[tr]=Dizgici Name[uk]=Засіб композиції Name[vi]=Compositor Name[x-test]=xxCompositorxx Name[zh_CN]=混成器 Name[zh_TW]=組合器 Comment=Compositor Settings for Desktop Effects Comment[bs]=Postavke Compositor-a za Desktop Efekte Comment[ca]=Arranjament del compositor per als efectes de l'escriptori Comment[ca@valencia]=Arranjament del compositor pels efectes d'escriptori Comment[cs]=Nastavení kompozitoru pro efekty pracovní plochy Comment[da]=Compositor-indstillinger til skrivebordseffekter Comment[de]=Compositor-Einstellungen für Arbeitsflächen-Effekte Comment[el]=Ρυθμίσεις συνθέτη για τα εφέ επιφάνειας εργασίας Comment[en_GB]=Compositor Settings for Desktop Effects Comment[es]=Configurar las preferencias del compositor para los efectos del escritorio Comment[et]=Komposiitori seadistused töölauaefektide tarbeks Comment[eu]=Konposatzailearen ezarpenak mahaigaineko efektuetarako Comment[fi]=Koostimen asetukset työpöytätehosteita varten Comment[fr]=Paramétrage du compositeur pour les effets de bureau Comment[gl]=Configuración do compositor para os efectos de escritorio Comment[hu]=A kompozitor beállításai az asztali effektusokhoz Comment[ia]=Preferentias de compositor pro le effectos de scriptorio Comment[id]=Pengaturan Kompositor untuk Efek Window Comment[it]=Impostazioni del compositore per gli effetti del desktop Comment[ja]=デスクトップ効果のためのコンポジタの設定 Comment[ko]=데스크톱 효과에 사용되는 컴포지터 설정 Comment[lt]=Darbalaukio efektų kompozitoriaus nuostatos Comment[nb]=Sammensetter-innstillinger for skrivebordseffekter Comment[nds]=Tosamensettoptschonen för de Schriefdischeffekten instellen Comment[nl]=Instellingen van compositor configureren voor bureaubladeffecten Comment[nn]=Samansetjarinnstillingar for skrivebordseffektar Comment[pa]=ਡੈਸਕਟਾਪ ਪਰਭਾਵ ਲਈ ਕੰਪੋਜੀਟਰ ਸੈਟਿੰਗਾਂ Comment[pl]=Ustawienia kompozytora dla efektów pulpitu Comment[pt]=Configuração do Compositor para os Efeitos do Ecrã Comment[pt_BR]=Definições do Compositor para os efeitos da área de trabalho Comment[ru]=Настройка движка эффектов рабочего стола Comment[sk]=Nastavenia kompozítora pre efekty plochy Comment[sl]=Nastavitve upravljalnika skladnje za učinke namizja Comment[sr]=Поставке слагача за ефекте површи Comment[sr@ijekavian]=Поставке слагача за ефекте површи Comment[sr@ijekavianlatin]=Postavke slagača za efekte površi Comment[sr@latin]=Postavke slagača za efekte površi Comment[sv]=Sammansättningsinställningar för skrivbordseffekter Comment[tr]=Masaüstü Efektleri için Dizgici Ayarları Comment[uk]=Параметри засобу композиції для ефектів стільниці Comment[vi]=Thiết lập Compositor cho hiệu ứng màn hình Comment[x-test]=xxCompositor Settings for Desktop Effectsxx Comment[zh_CN]=桌面特效混成器设置 Comment[zh_TW]=桌面效果使用的組合器設定 X-KDE-Keywords=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects X-KDE-Keywords[ca]=kwin,finestra,gestor,composició,efecte,efectes 3D,efectes 2D,OpenGL,XRender,arranjament de vídeo,efectes gràfics,efectes de l'escriptori X-KDE-Keywords[da]=kwin,vindue,håndtering,window,manager,compositing,effekt,3D effekter,2D effekter,OpenGL,XRender,video-indstillinger,grafiske effekter,skrivebordseffekter,desktop effects X-KDE-Keywords[en_GB]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects X-KDE-Keywords[es]=kwin,ventana,gestor,composición,efecto,efectos 3D,efectos 2D,OpenGL,XRender,preferencias de vídeo,efectos gráficos,efectos del escritorio X-KDE-Keywords[et]=kwin,aken,haldur,komposiit,komposiitor,efekt,3D efektid,ruumilised efektid,2D efektid,OpenGL,XRender,videoseadistused,graafilised efektid,töölauaefektid 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[id]=kwin,window,pengelola,kompositing,efek,efek 3D,efek 2D,OpenGL,XRender,pengaturan video,efek grafis,efek desktop 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 X-KDE-Keywords[nl]=kwin,window,manager,beheerder,compositing,effecten,3D-effecten,2D-effecten,OpenGL,XRender,video-instellingen,grafische effecten,bureaubladeffecten X-KDE-Keywords[nn]=kwin,vindauge,vindaugshandsamar,samansetjing,effekt,3D-effektar,2D-effektar,OpenGL,XRender,videoinnstillingar,grafiske effektar,skrivebordseffektar X-KDE-Keywords[pt]=kwin,janela,gestor,composição,efeito,efeitos 3D,efeitos 2D,OpenGL,XRender,configuração do vídeo,efeitos gráficos,efeitos do ecrã X-KDE-Keywords[pt_BR]=kwin,janela,gerenciador,composição,efeito,efeitos 3D,efeitos 2D,OpenGL,XRender,configurações de vídeo,efeitos gráficos,efeitos da área de trabalho X-KDE-Keywords[ru]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,композитинг,композитный диспетчер окон,эффекты рабочего стола,графические эффекты,рендеринг,параметры видео,настройка видео +X-KDE-Keywords[sk]=kwin,okno,správca,kompozícia,efekt,3D efekty,2D efekty,OpenGL,XRender,video nastavenia,grafické efekty,efekty plochy X-KDE-Keywords[sl]=kwin,okna,upravljalnik,skladnja,učinek,3D učinki,2D učinki,OpenGL,XRender,nastavitve videa,video,grafični učinki,hitrost animacije,učinki namizja X-KDE-Keywords[sv]=kwin,fönster,hantering,sammansättning,effekt,3D effekter,2D effekter,OpenGL,XRender,videoinställningar,grafiska effekter,skrivbordseffekter X-KDE-Keywords[uk]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,вікно,керування,композитне,композиція,ефект,просторовий,ефекти,плоскі,параметри відео,графічні ефекти,ефекти стільниці X-KDE-Keywords[x-test]=xxkwinxx,xxwindowxx,xxmanagerxx,xxcompositingxx,xxeffectxx,xx3D effectsxx,xx2D effectsxx,xxOpenGLxx,xxXRenderxx,xxvideo settingsxx,xxgraphical effectsxx,xxdesktop effectsxx X-KDE-Keywords[zh_CN]=kwin,窗口,管理器,混成,特效,3D 特效,2D 特效,OpenGL,XRender,视频设置,图形特效,桌面特效 X-KDE-Keywords[zh_TW]=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,桌面特效,圖形特效,視訊設定,特效,3D,2D,合成,視窗,管理器 diff --git a/scene.h b/scene.h index a8f714528..fdeb10e30 100644 --- a/scene.h +++ b/scene.h @@ -1,728 +1,730 @@ /******************************************************************** KWin - the KDE window manager This file is part of the KDE project. Copyright (C) 2006 Lubos Lunak 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) any later version. 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 . *********************************************************************/ #ifndef KWIN_SCENE_H #define KWIN_SCENE_H #include "toplevel.h" #include "utils.h" #include "kwineffects.h" #include #include class QOpenGLFramebufferObject; namespace KWaylandServer { class BufferInterface; class SubSurfaceInterface; } namespace KWin { namespace Decoration { class DecoratedClientImpl; class Renderer; } class AbstractThumbnailItem; class Deleted; class EffectFrameImpl; class EffectWindowImpl; class OverlayWindow; class Shadow; class WindowPixmap; // The base class for compositing backends. class KWIN_EXPORT Scene : public QObject { Q_OBJECT public: explicit Scene(QObject *parent = nullptr); ~Scene() override = 0; class EffectFrame; class Window; // Returns true if the ctor failed to properly initialize. virtual bool initFailed() const = 0; virtual CompositingType compositingType() const = 0; virtual bool hasPendingFlush() const { return false; } // Repaints the given screen areas, windows provides the stacking order. // The entry point for the main part of the painting pass. // returns the time since the last vblank signal - if there's one // ie. "what of this frame is lost to painting" virtual qint64 paint(const QRegion &damage, const QList &windows) = 0; /** * Adds the Toplevel to the Scene. * * If the toplevel gets deleted, then the scene will try automatically * to re-bind an underlying scene window to the corresponding Deleted. * * @param toplevel The window to be added. * @note You can add a toplevel to scene only once. */ void addToplevel(Toplevel *toplevel); /** * Removes the Toplevel from the Scene. * * @param toplevel The window to be removed. * @note You can remove a toplevel from the scene only once. */ void removeToplevel(Toplevel *toplevel); /** * @brief Creates the Scene backend of an EffectFrame. * * @param frame The EffectFrame this Scene::EffectFrame belongs to. */ virtual Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame) = 0; /** * @brief Creates the Scene specific Shadow subclass. * * An implementing class has to create a proper instance. It is not allowed to * return @c null. * * @param toplevel The Toplevel for which the Shadow needs to be created. */ virtual Shadow *createShadow(Toplevel *toplevel) = 0; /** * Method invoked when the screen geometry is changed. * Reimplementing classes should also invoke the parent method * as it takes care of resizing the overlay window. * @param size The new screen geometry size */ virtual void screenGeometryChanged(const QSize &size); // Flags controlling how painting is done. enum { // Window (or at least part of it) will be painted opaque. PAINT_WINDOW_OPAQUE = 1 << 0, // Window (or at least part of it) will be painted translucent. PAINT_WINDOW_TRANSLUCENT = 1 << 1, // Window will be painted with transformed geometry. PAINT_WINDOW_TRANSFORMED = 1 << 2, // Paint only a region of the screen (can be optimized, cannot // be used together with TRANSFORMED flags). PAINT_SCREEN_REGION = 1 << 3, // Whole screen will be painted with transformed geometry. PAINT_SCREEN_TRANSFORMED = 1 << 4, // At least one window will be painted with transformed geometry. PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS = 1 << 5, // Clear whole background as the very first step, without optimizing it PAINT_SCREEN_BACKGROUND_FIRST = 1 << 6, // PAINT_DECORATION_ONLY = 1 << 7 has been removed // Window will be painted with a lanczos filter. PAINT_WINDOW_LANCZOS = 1 << 8 // PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS = 1 << 9 has been removed }; // types of filtering available enum ImageFilterType { ImageFilterFast, ImageFilterGood }; // there's nothing to paint (adjust time_diff later) virtual void idle(); virtual bool blocksForRetrace() const; virtual bool syncsToVBlank() const; virtual OverlayWindow* overlayWindow() const = 0; virtual bool makeOpenGLContextCurrent(); virtual void doneOpenGLContextCurrent(); virtual QMatrix4x4 screenProjectionMatrix() const; /** * Whether the Scene uses an X11 overlay window to perform compositing. */ virtual bool usesOverlayWindow() const = 0; virtual void triggerFence(); virtual Decoration::Renderer *createDecorationRenderer(Decoration::DecoratedClientImpl *) = 0; /** * Whether the Scene is able to drive animations. * This is used as a hint to the effects system which effects can be supported. * If the Scene performs software rendering it is supposed to return @c false, * if rendering is hardware accelerated it should return @c true. */ virtual bool animationsSupported() const = 0; /** * The render buffer used by an XRender based compositor scene. * Default implementation returns XCB_RENDER_PICTURE_NONE */ virtual xcb_render_picture_t xrenderBufferPicture() const; /** * The QPainter used by a QPainter based compositor scene. * Default implementation returns @c nullptr; */ virtual QPainter *scenePainter() const; /** * The render buffer used by a QPainter based compositor. * Default implementation returns @c nullptr. */ virtual QImage *qpainterRenderBuffer() const; /** * The backend specific extensions (e.g. EGL/GLX extensions). * * Not the OpenGL (ES) extension! * * Default implementation returns empty list */ virtual QVector openGLPlatformInterfaceExtensions() const; Q_SIGNALS: void frameRendered(); void resetCompositing(); public Q_SLOTS: // shape/size of a window changed void windowGeometryShapeChanged(KWin::Toplevel* c); // a window has been closed void windowClosed(KWin::Toplevel* c, KWin::Deleted* deleted); protected: virtual Window *createWindow(Toplevel *toplevel) = 0; void createStackingOrder(const QList &toplevels); void clearStackingOrder(); // shared implementation, starts painting the screen void paintScreen(int *mask, const QRegion &damage, const QRegion &repaint, QRegion *updateRegion, QRegion *validRegion, const QMatrix4x4 &projection = QMatrix4x4(), const QRect &outputGeometry = QRect(), const qreal screenScale = 1.0); // Render cursor texture in case hardware cursor is disabled/non-applicable virtual void paintCursor() = 0; friend class EffectsHandlerImpl; // called after all effects had their paintScreen() called void finalPaintScreen(int mask, const QRegion ®ion, ScreenPaintData& data); // shared implementation of painting the screen in the generic // (unoptimized) way virtual void paintGenericScreen(int mask, const ScreenPaintData &data); // shared implementation of painting the screen in an optimized way virtual void paintSimpleScreen(int mask, const QRegion ®ion); // paint the background (not the desktop background - the whole background) virtual void paintBackground(const QRegion ®ion) = 0; // called after all effects had their paintWindow() called void finalPaintWindow(EffectWindowImpl* w, int mask, const QRegion ®ion, WindowPaintData& data); // shared implementation, starts painting the window virtual void paintWindow(Window* w, int mask, const QRegion ®ion, const WindowQuadList &quads); // called after all effects had their drawWindow() called virtual void finalDrawWindow(EffectWindowImpl* w, int mask, const QRegion ®ion, WindowPaintData& data); // let the scene decide whether it's better to paint more of the screen, eg. in order to allow a buffer swap // the default is NOOP virtual void extendPaintRegion(QRegion ®ion, bool opaqueFullscreen); virtual void paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data); virtual void paintEffectQuickView(EffectQuickView *w) = 0; // compute time since the last repaint void updateTimeDiff(); // saved data for 2nd pass of optimized screen painting struct Phase2Data { Window *window = nullptr; QRegion region; QRegion clip; int mask = 0; WindowQuadList quads; }; // The region which actually has been painted by paintScreen() and should be // copied from the buffer to the screen. I.e. the region returned from Scene::paintScreen(). // Since prePaintWindow() can extend areas to paint, these changes would have to propagate // up all the way from paintSimpleScreen() up to paintScreen(), so save them here rather // than propagate them up in arguments. QRegion painted_region; // Additional damage that needs to be repaired to bring a reused back buffer up to date QRegion repaint_region; // The dirty region before it was unioned with repaint_region QRegion damaged_region; // time since last repaint int time_diff; QElapsedTimer last_time; private: void paintWindowThumbnails(Scene::Window *w, const QRegion ®ion, qreal opacity, qreal brightness, qreal saturation); void paintDesktopThumbnails(Scene::Window *w); QHash< Toplevel*, Window* > m_windows; // windows in their stacking order QVector< Window* > stacking_order; }; /** * Factory class to create a Scene. Needs to be implemented by the plugins. */ class KWIN_EXPORT SceneFactory : public QObject { Q_OBJECT public: ~SceneFactory() override; /** * @returns The created Scene, may be @c nullptr. */ virtual Scene *create(QObject *parent = nullptr) const = 0; protected: explicit SceneFactory(QObject *parent); }; // The base class for windows representations in composite backends class Scene::Window { public: Window(Toplevel* c); virtual ~Window(); // perform the actual painting of the window virtual void performPaint(int mask, const QRegion ®ion, const WindowPaintData &data) = 0; // do any cleanup needed when the window's composite pixmap is discarded void discardPixmap(); void updatePixmap(); int x() const; int y() const; int width() const; int height() const; QRect geometry() const; QPoint pos() const; QSize size() const; QRect rect() const; // access to the internal window class // TODO eventually get rid of this Toplevel* window() const; // should the window be painted bool isPaintingEnabled() const; void resetPaintingEnabled(); // Flags explaining why painting should be disabled enum { // Window will not be painted PAINT_DISABLED = 1 << 0, // Window will not be painted because it is deleted PAINT_DISABLED_BY_DELETE = 1 << 1, // Window will not be painted because of which desktop it's on PAINT_DISABLED_BY_DESKTOP = 1 << 2, // Window will not be painted because it is minimized PAINT_DISABLED_BY_MINIMIZE = 1 << 3, // Window will not be painted because it's not on the current activity PAINT_DISABLED_BY_ACTIVITY = 1 << 5 }; void enablePainting(int reason); void disablePainting(int reason); // is the window visible at all bool isVisible() const; // is the window fully opaque bool isOpaque() const; // is the window shaded bool isShaded() const; // shape of the window QRegion bufferShape() const; QRegion clientShape() const; QRegion decorationShape() const; QPoint bufferOffset() const; void discardShape(); void updateToplevel(Toplevel* c); // creates initial quad list for the window virtual WindowQuadList buildQuads(bool force = false) const; void updateShadow(Shadow* shadow); const Shadow* shadow() const; Shadow* shadow(); void referencePreviousPixmap(); void unreferencePreviousPixmap(); void invalidateQuadsCache(); void preprocess(); protected: WindowQuadList makeDecorationQuads(const QRect *rects, const QRegion ®ion, qreal textureScale = 1.0) const; WindowQuadList makeContentsQuads() const; /** * @brief Returns the WindowPixmap for this Window. * * If the WindowPixmap does not yet exist, this method will invoke createWindowPixmap. * If the WindowPixmap is not valid it tries to create it, in case this succeeds the WindowPixmap is * returned. In case it fails, the previous (and still valid) WindowPixmap is returned. * * @note This method can return @c NULL as there might neither be a valid previous nor current WindowPixmap * around. * * The WindowPixmap gets casted to the type passed in as a template parameter. That way this class does not * need to know the actual WindowPixmap subclass used by the concrete Scene implementations. * * @return The WindowPixmap casted to T* or @c NULL if there is no valid window pixmap. */ template T *windowPixmap() const; template T *previousWindowPixmap() const; /** * @brief Factory method to create a WindowPixmap. * * The inheriting classes need to implement this method to create a new instance of their WindowPixmap subclass. * @note Do not use WindowPixmap::create on the created instance. The Scene will take care of that. */ virtual WindowPixmap *createWindowPixmap() = 0; Toplevel* toplevel; ImageFilterType filter; Shadow *m_shadow; private: QScopedPointer m_currentPixmap; QScopedPointer m_previousPixmap; int m_referencePixmapCounter; int disable_painting; mutable QRegion m_bufferShape; mutable bool m_bufferShapeIsValid = false; mutable QScopedPointer cached_quad_list; Q_DISABLE_COPY(Window) }; /** * @brief Wrapper for a pixmap of the Scene::Window. * * This class encapsulates the functionality to get the pixmap for a window. When initialized the pixmap is not yet * mapped to the window and isValid will return @c false. The pixmap mapping to the window can be established * through @ref create. If it succeeds isValid will return @c true, otherwise it will keep in the non valid * state and it can be tried to create the pixmap mapping again (e.g. in the next frame). * * This class is not intended to be updated when the pixmap is no longer valid due to e.g. resizing the window. * Instead a new instance of this class should be instantiated. The idea behind this is that a valid pixmap does not * get destroyed, but can continue to be used. To indicate that a newer pixmap should in generally be around, one can * use markAsDiscarded. * * This class is intended to be inherited for the needs of the compositor backends which need further mapping from * the native pixmap to the respective rendering format. */ class KWIN_EXPORT WindowPixmap { public: virtual ~WindowPixmap(); /** * @brief Tries to create the mapping between the Window and the pixmap. * * In case this method succeeds in creating the pixmap for the window, isValid will return @c true otherwise * @c false. * * Inheriting classes should re-implement this method in case they need to add further functionality for mapping the * native pixmap to the rendering format. */ virtual void create(); /** * @brief Recursively updates the mapping between the WindowPixmap and the buffer. */ virtual void update(); /** * @return @c true if the pixmap has been created and is valid, @c false otherwise */ virtual bool isValid() const; /** * Returns @c true if this is the root window pixmap; otherwise returns @c false. */ bool isRoot() const; /** * @return The native X11 pixmap handle */ xcb_pixmap_t pixmap() const; /** * @return The Wayland BufferInterface for this WindowPixmap. */ QPointer buffer() const; const QSharedPointer &fbo() const; QImage internalImage() const; /** * @brief Whether this WindowPixmap is considered as discarded. This means the window has changed in a way that a new * WindowPixmap should have been created already. * * @return @c true if this WindowPixmap is considered as discarded, @c false otherwise. * @see markAsDiscarded */ bool isDiscarded() const; /** * @brief Marks this WindowPixmap as discarded. From now on isDiscarded will return @c true. This method should * only be used by the Window when it changes in a way that a new pixmap is required. * * @see isDiscarded */ void markAsDiscarded(); /** * Returns the position of the WindowPixmap relative to the upper left corner of the parent. * * This method returns the position of the WindowPixmap relative to the upper left corner * of the window pixmap if parent() is @c null. * * The upper left corner of the parent window pixmap corresponds to (0, 0). */ QPoint position() const; /** * Returns the position of the WindowPixmap relative to the upper left corner of the window * frame. Note that position() returns the position relative to the parent WindowPixmap. * * The upper left corner of the window frame corresponds to (0, 0). */ QPoint framePosition() const; /** * The size of the pixmap. */ const QSize &size() const; /** * Returns the device pixel ratio for the attached buffer. This is the ratio between device * pixels and logical pixels. */ qreal scale() const; /** * Returns the region that specifies the area inside the attached buffer with the actual * client's contents. * * The upper left corner of the attached buffer corresponds to (0, 0). */ QRegion shape() const; /** * The geometry of the Client's content inside the pixmap. In case of a decorated Client the * pixmap also contains the decoration which is not rendered into this pixmap, though. This * contentsRect tells where inside the complete pixmap the real content is. */ const QRect &contentsRect() const; /** * @brief Returns the Toplevel this WindowPixmap belongs to. * Note: the Toplevel can change over the lifetime of the WindowPixmap in case the Toplevel is copied to Deleted. */ Toplevel *toplevel() const; /** * Returns @c true if the attached buffer has an alpha channel; otherwise returns @c false. */ bool hasAlphaChannel() const; /** * @returns the parent WindowPixmap in the sub-surface tree */ WindowPixmap *parent() const { return m_parent; } /** * @returns the current sub-surface tree */ QVector children() const { return m_children; } /** * @returns the subsurface this WindowPixmap is for if it is not for a root window */ QPointer subSurface() const { return m_subSurface; } /** * @returns the surface this WindowPixmap references, might be @c null. */ KWaylandServer::SurfaceInterface *surface() const; protected: explicit WindowPixmap(Scene::Window *window); explicit WindowPixmap(const QPointer &subSurface, WindowPixmap *parent); virtual WindowPixmap *createChild(const QPointer &subSurface); /** * @return The Window this WindowPixmap belongs to */ Scene::Window *window(); /** * Sets the sub-surface tree to @p children. */ void setChildren(const QVector &children) { m_children = children; } private: Scene::Window *m_window; xcb_pixmap_t m_pixmap; QSize m_pixmapSize; bool m_discarded; QRect m_contentsRect; QPointer m_buffer; QSharedPointer m_fbo; QImage m_internalImage; WindowPixmap *m_parent = nullptr; QVector m_children; QPointer m_subSurface; }; class Scene::EffectFrame { public: EffectFrame(EffectFrameImpl* frame); virtual ~EffectFrame(); virtual void render(const QRegion ®ion, double opacity, double frameOpacity) = 0; virtual void free() = 0; virtual void freeIconFrame() = 0; virtual void freeTextFrame() = 0; virtual void freeSelection() = 0; virtual void crossFadeIcon() = 0; virtual void crossFadeText() = 0; protected: EffectFrameImpl* m_effectFrame; }; inline int Scene::Window::x() const { return toplevel->x(); } inline int Scene::Window::y() const { return toplevel->y(); } inline int Scene::Window::width() const { return toplevel->width(); } inline int Scene::Window::height() const { return toplevel->height(); } inline QRect Scene::Window::geometry() const { return toplevel->frameGeometry(); } inline QSize Scene::Window::size() const { return toplevel->size(); } inline QPoint Scene::Window::pos() const { return toplevel->pos(); } inline QRect Scene::Window::rect() const { return toplevel->rect(); } inline Toplevel* Scene::Window::window() const { return toplevel; } inline void Scene::Window::updateToplevel(Toplevel* c) { toplevel = c; } inline const Shadow* Scene::Window::shadow() const { return m_shadow; } inline Shadow* Scene::Window::shadow() { return m_shadow; } inline QPointer WindowPixmap::buffer() const { return m_buffer; } inline const QSharedPointer &WindowPixmap::fbo() const { return m_fbo; } inline QImage WindowPixmap::internalImage() const { return m_internalImage; } template inline T *Scene::Window::windowPixmap() const { - if (m_currentPixmap->isValid()) { + if (m_currentPixmap && m_currentPixmap->isValid()) { return static_cast(m_currentPixmap.data()); - } else { + } + if (m_previousPixmap && m_previousPixmap->isValid()) { return static_cast(m_previousPixmap.data()); } + return nullptr; } template inline T *Scene::Window::previousWindowPixmap() const { return static_cast(m_previousPixmap.data()); } inline Toplevel* WindowPixmap::toplevel() const { return m_window->window(); } inline xcb_pixmap_t WindowPixmap::pixmap() const { return m_pixmap; } inline bool WindowPixmap::isDiscarded() const { return m_discarded; } inline void WindowPixmap::markAsDiscarded() { m_discarded = true; m_window->referencePreviousPixmap(); } inline const QRect &WindowPixmap::contentsRect() const { return m_contentsRect; } inline const QSize &WindowPixmap::size() const { return m_pixmapSize; } } // namespace Q_DECLARE_INTERFACE(KWin::SceneFactory, "org.kde.kwin.Scene") #endif