Changeset View
Changeset View
Standalone View
Standalone View
scene.h
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | 63 | public: | |||
---|---|---|---|---|---|
82 | // Used to mainly discard cached data. | 82 | // Used to mainly discard cached data. | ||
83 | 83 | | |||
84 | // a new window has been created | 84 | // a new window has been created | ||
85 | void windowAdded(Toplevel*); | 85 | void windowAdded(Toplevel*); | ||
86 | /** | 86 | /** | ||
87 | * @brief Creates the Scene backend of an EffectFrame. | 87 | * @brief Creates the Scene backend of an EffectFrame. | ||
88 | * | 88 | * | ||
89 | * @param frame The EffectFrame this Scene::EffectFrame belongs to. | 89 | * @param frame The EffectFrame this Scene::EffectFrame belongs to. | ||
90 | */ | 90 | **/ | ||
91 | virtual Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame) = 0; | 91 | virtual Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame) = 0; | ||
92 | /** | 92 | /** | ||
93 | * @brief Creates the Scene specific Shadow subclass. | 93 | * @brief Creates the Scene specific Shadow subclass. | ||
94 | * | 94 | * | ||
95 | * An implementing class has to create a proper instance. It is not allowed to | 95 | * An implementing class has to create a proper instance. It is not allowed to | ||
96 | * return @c null. | 96 | * return @c null. | ||
97 | * | 97 | * | ||
98 | * @param toplevel The Toplevel for which the Shadow needs to be created. | 98 | * @param toplevel The Toplevel for which the Shadow needs to be created. | ||
99 | */ | 99 | **/ | ||
100 | virtual Shadow *createShadow(Toplevel *toplevel) = 0; | 100 | virtual Shadow *createShadow(Toplevel *toplevel) = 0; | ||
101 | /** | 101 | /** | ||
102 | * Method invoked when the screen geometry is changed. | 102 | * Method invoked when the screen geometry is changed. | ||
103 | * Reimplementing classes should also invoke the parent method | 103 | * Reimplementing classes should also invoke the parent method | ||
104 | * as it takes care of resizing the overlay window. | 104 | * as it takes care of resizing the overlay window. | ||
105 | * @param size The new screen geometry size | 105 | * @param size The new screen geometry size | ||
106 | **/ | 106 | **/ | ||
107 | virtual void screenGeometryChanged(const QSize &size); | 107 | virtual void screenGeometryChanged(const QSize &size); | ||
Show All 29 Lines | |||||
137 | 137 | | |||
138 | virtual bool makeOpenGLContextCurrent(); | 138 | virtual bool makeOpenGLContextCurrent(); | ||
139 | virtual void doneOpenGLContextCurrent(); | 139 | virtual void doneOpenGLContextCurrent(); | ||
140 | 140 | | |||
141 | virtual QMatrix4x4 screenProjectionMatrix() const; | 141 | virtual QMatrix4x4 screenProjectionMatrix() const; | ||
142 | 142 | | |||
143 | /** | 143 | /** | ||
144 | * Whether the Scene uses an X11 overlay window to perform compositing. | 144 | * Whether the Scene uses an X11 overlay window to perform compositing. | ||
145 | */ | 145 | **/ | ||
146 | virtual bool usesOverlayWindow() const = 0; | 146 | virtual bool usesOverlayWindow() const = 0; | ||
147 | 147 | | |||
148 | virtual void triggerFence(); | 148 | virtual void triggerFence(); | ||
149 | 149 | | |||
150 | virtual Decoration::Renderer *createDecorationRenderer(Decoration::DecoratedClientImpl *) = 0; | 150 | virtual Decoration::Renderer *createDecorationRenderer(Decoration::DecoratedClientImpl *) = 0; | ||
151 | 151 | | |||
152 | /** | 152 | /** | ||
153 | * Whether the Scene is able to drive animations. | 153 | * Whether the Scene is able to drive animations. | ||
▲ Show 20 Lines • Show All 189 Lines • ▼ Show 20 Line(s) | 334 | protected: | |||
343 | * | 343 | * | ||
344 | * @note This method can return @c NULL as there might neither be a valid previous nor current WindowPixmap | 344 | * @note This method can return @c NULL as there might neither be a valid previous nor current WindowPixmap | ||
345 | * around. | 345 | * around. | ||
346 | * | 346 | * | ||
347 | * The WindowPixmap gets casted to the type passed in as a template parameter. That way this class does not | 347 | * The WindowPixmap gets casted to the type passed in as a template parameter. That way this class does not | ||
348 | * need to know the actual WindowPixmap subclass used by the concrete Scene implementations. | 348 | * need to know the actual WindowPixmap subclass used by the concrete Scene implementations. | ||
349 | * | 349 | * | ||
350 | * @return The WindowPixmap casted to T* or @c NULL if there is no valid window pixmap. | 350 | * @return The WindowPixmap casted to T* or @c NULL if there is no valid window pixmap. | ||
351 | */ | 351 | **/ | ||
352 | template<typename T> T *windowPixmap(); | 352 | template<typename T> T *windowPixmap(); | ||
353 | template<typename T> T *previousWindowPixmap(); | 353 | template<typename T> T *previousWindowPixmap(); | ||
354 | /** | 354 | /** | ||
355 | * @brief Factory method to create a WindowPixmap. | 355 | * @brief Factory method to create a WindowPixmap. | ||
356 | * | 356 | * | ||
357 | * The inheriting classes need to implement this method to create a new instance of their WindowPixmap subclass. | 357 | * The inheriting classes need to implement this method to create a new instance of their WindowPixmap subclass. | ||
358 | * @note Do not use WindowPixmap::create on the created instance. The Scene will take care of that. | 358 | * @note Do not use WindowPixmap::create on the created instance. The Scene will take care of that. | ||
359 | */ | 359 | **/ | ||
360 | virtual WindowPixmap *createWindowPixmap() = 0; | 360 | virtual WindowPixmap *createWindowPixmap() = 0; | ||
361 | Toplevel* toplevel; | 361 | Toplevel* toplevel; | ||
362 | ImageFilterType filter; | 362 | ImageFilterType filter; | ||
363 | Shadow *m_shadow; | 363 | Shadow *m_shadow; | ||
364 | private: | 364 | private: | ||
365 | QScopedPointer<WindowPixmap> m_currentPixmap; | 365 | QScopedPointer<WindowPixmap> m_currentPixmap; | ||
366 | QScopedPointer<WindowPixmap> m_previousPixmap; | 366 | QScopedPointer<WindowPixmap> m_previousPixmap; | ||
367 | int m_referencePixmapCounter; | 367 | int m_referencePixmapCounter; | ||
Show All 14 Lines | |||||
382 | * | 382 | * | ||
383 | * This class is not intended to be updated when the pixmap is no longer valid due to e.g. resizing the window. | 383 | * This class is not intended to be updated when the pixmap is no longer valid due to e.g. resizing the window. | ||
384 | * Instead a new instance of this class should be instantiated. The idea behind this is that a valid pixmap does not | 384 | * Instead a new instance of this class should be instantiated. The idea behind this is that a valid pixmap does not | ||
385 | * get destroyed, but can continue to be used. To indicate that a newer pixmap should in generally be around, one can | 385 | * get destroyed, but can continue to be used. To indicate that a newer pixmap should in generally be around, one can | ||
386 | * use markAsDiscarded. | 386 | * use markAsDiscarded. | ||
387 | * | 387 | * | ||
388 | * This class is intended to be inherited for the needs of the compositor backends which need further mapping from | 388 | * This class is intended to be inherited for the needs of the compositor backends which need further mapping from | ||
389 | * the native pixmap to the respective rendering format. | 389 | * the native pixmap to the respective rendering format. | ||
390 | */ | 390 | **/ | ||
391 | class KWIN_EXPORT WindowPixmap | 391 | class KWIN_EXPORT WindowPixmap | ||
392 | { | 392 | { | ||
393 | public: | 393 | public: | ||
394 | virtual ~WindowPixmap(); | 394 | virtual ~WindowPixmap(); | ||
395 | /** | 395 | /** | ||
396 | * @brief Tries to create the mapping between the Window and the pixmap. | 396 | * @brief Tries to create the mapping between the Window and the pixmap. | ||
397 | * | 397 | * | ||
398 | * In case this method succeeds in creating the pixmap for the window, isValid will return @c true otherwise | 398 | * In case this method succeeds in creating the pixmap for the window, isValid will return @c true otherwise | ||
399 | * @c false. | 399 | * @c false. | ||
400 | * | 400 | * | ||
401 | * Inheriting classes should re-implement this method in case they need to add further functionality for mapping the | 401 | * Inheriting classes should re-implement this method in case they need to add further functionality for mapping the | ||
402 | * native pixmap to the rendering format. | 402 | * native pixmap to the rendering format. | ||
403 | */ | 403 | **/ | ||
404 | virtual void create(); | 404 | virtual void create(); | ||
405 | /** | 405 | /** | ||
406 | * @return @c true if the pixmap has been created and is valid, @c false otherwise | 406 | * @return @c true if the pixmap has been created and is valid, @c false otherwise | ||
407 | */ | 407 | **/ | ||
408 | virtual bool isValid() const; | 408 | virtual bool isValid() const; | ||
409 | /** | 409 | /** | ||
410 | * @return The native X11 pixmap handle | 410 | * @return The native X11 pixmap handle | ||
411 | */ | 411 | **/ | ||
412 | xcb_pixmap_t pixmap() const; | 412 | xcb_pixmap_t pixmap() const; | ||
413 | /** | 413 | /** | ||
414 | * @return The Wayland BufferInterface for this WindowPixmap. | 414 | * @return The Wayland BufferInterface for this WindowPixmap. | ||
415 | **/ | 415 | **/ | ||
416 | QPointer<KWayland::Server::BufferInterface> buffer() const; | 416 | QPointer<KWayland::Server::BufferInterface> buffer() const; | ||
417 | const QSharedPointer<QOpenGLFramebufferObject> &fbo() const; | 417 | const QSharedPointer<QOpenGLFramebufferObject> &fbo() const; | ||
418 | /** | 418 | /** | ||
419 | * @brief Whether this WindowPixmap is considered as discarded. This means the window has changed in a way that a new | 419 | * @brief Whether this WindowPixmap is considered as discarded. This means the window has changed in a way that a new | ||
420 | * WindowPixmap should have been created already. | 420 | * WindowPixmap should have been created already. | ||
421 | * | 421 | * | ||
422 | * @return @c true if this WindowPixmap is considered as discarded, @c false otherwise. | 422 | * @return @c true if this WindowPixmap is considered as discarded, @c false otherwise. | ||
423 | * @see markAsDiscarded | 423 | * @see markAsDiscarded | ||
424 | */ | 424 | **/ | ||
425 | bool isDiscarded() const; | 425 | bool isDiscarded() const; | ||
426 | /** | 426 | /** | ||
427 | * @brief Marks this WindowPixmap as discarded. From now on isDiscarded will return @c true. This method should | 427 | * @brief Marks this WindowPixmap as discarded. From now on isDiscarded will return @c true. This method should | ||
428 | * only be used by the Window when it changes in a way that a new pixmap is required. | 428 | * only be used by the Window when it changes in a way that a new pixmap is required. | ||
429 | * | 429 | * | ||
430 | * @see isDiscarded | 430 | * @see isDiscarded | ||
431 | */ | 431 | **/ | ||
432 | void markAsDiscarded(); | 432 | void markAsDiscarded(); | ||
433 | /** | 433 | /** | ||
434 | * The size of the pixmap. | 434 | * The size of the pixmap. | ||
435 | */ | 435 | **/ | ||
436 | const QSize &size() const; | 436 | const QSize &size() const; | ||
437 | /** | 437 | /** | ||
438 | * The geometry of the Client's content inside the pixmap. In case of a decorated Client the | 438 | * The geometry of the Client's content inside the pixmap. In case of a decorated Client the | ||
439 | * pixmap also contains the decoration which is not rendered into this pixmap, though. This | 439 | * pixmap also contains the decoration which is not rendered into this pixmap, though. This | ||
440 | * contentsRect tells where inside the complete pixmap the real content is. | 440 | * contentsRect tells where inside the complete pixmap the real content is. | ||
441 | */ | 441 | **/ | ||
442 | const QRect &contentsRect() const; | 442 | const QRect &contentsRect() const; | ||
443 | /** | 443 | /** | ||
444 | * @brief Returns the Toplevel this WindowPixmap belongs to. | 444 | * @brief Returns the Toplevel this WindowPixmap belongs to. | ||
445 | * Note: the Toplevel can change over the lifetime of the WindowPixmap in case the Toplevel is copied to Deleted. | 445 | * Note: the Toplevel can change over the lifetime of the WindowPixmap in case the Toplevel is copied to Deleted. | ||
446 | */ | 446 | **/ | ||
447 | Toplevel *toplevel() const; | 447 | Toplevel *toplevel() const; | ||
448 | 448 | | |||
449 | /** | 449 | /** | ||
450 | * @returns the parent WindowPixmap in the sub-surface tree | 450 | * @returns the parent WindowPixmap in the sub-surface tree | ||
451 | **/ | 451 | **/ | ||
452 | WindowPixmap *parent() const { | 452 | WindowPixmap *parent() const { | ||
453 | return m_parent; | 453 | return m_parent; | ||
454 | } | 454 | } | ||
Show All 18 Lines | |||||
473 | KWayland::Server::SurfaceInterface *surface() const; | 473 | KWayland::Server::SurfaceInterface *surface() const; | ||
474 | 474 | | |||
475 | protected: | 475 | protected: | ||
476 | explicit WindowPixmap(Scene::Window *window); | 476 | explicit WindowPixmap(Scene::Window *window); | ||
477 | explicit WindowPixmap(const QPointer<KWayland::Server::SubSurfaceInterface> &subSurface, WindowPixmap *parent); | 477 | explicit WindowPixmap(const QPointer<KWayland::Server::SubSurfaceInterface> &subSurface, WindowPixmap *parent); | ||
478 | virtual WindowPixmap *createChild(const QPointer<KWayland::Server::SubSurfaceInterface> &subSurface); | 478 | virtual WindowPixmap *createChild(const QPointer<KWayland::Server::SubSurfaceInterface> &subSurface); | ||
479 | /** | 479 | /** | ||
480 | * @return The Window this WindowPixmap belongs to | 480 | * @return The Window this WindowPixmap belongs to | ||
481 | */ | 481 | **/ | ||
482 | Scene::Window *window(); | 482 | Scene::Window *window(); | ||
483 | 483 | | |||
484 | /** | 484 | /** | ||
485 | * Should be called by the implementing subclasses when the Wayland Buffer changed and needs | 485 | * Should be called by the implementing subclasses when the Wayland Buffer changed and needs | ||
486 | * updating. | 486 | * updating. | ||
487 | **/ | 487 | **/ | ||
488 | virtual void updateBuffer(); | 488 | virtual void updateBuffer(); | ||
489 | 489 | | |||
▲ Show 20 Lines • Show All 188 Lines • Show Last 20 Lines |