2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
2007-11-27 19:40:25 +00:00
|
|
|
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 <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_SCENE_H
|
|
|
|
#define KWIN_SCENE_H
|
|
|
|
|
|
|
|
#include "toplevel.h"
|
|
|
|
#include "utils.h"
|
|
|
|
#include "kwineffects.h"
|
|
|
|
|
2013-04-26 09:27:30 +00:00
|
|
|
#include <QElapsedTimer>
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2012-03-29 18:17:57 +00:00
|
|
|
class AbstractThumbnailItem;
|
2007-04-29 17:35:43 +00:00
|
|
|
class Workspace;
|
|
|
|
class Deleted;
|
2010-07-18 16:32:37 +00:00
|
|
|
class EffectFrameImpl;
|
2007-04-29 17:35:43 +00:00
|
|
|
class EffectWindowImpl;
|
2011-07-06 09:58:23 +00:00
|
|
|
class OverlayWindow;
|
2011-04-03 09:31:33 +00:00
|
|
|
class Shadow;
|
2013-05-10 10:07:56 +00:00
|
|
|
class WindowPixmap;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
// The base class for compositing backends.
|
2011-06-15 16:35:00 +00:00
|
|
|
class Scene : public QObject
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-15 16:35:00 +00:00
|
|
|
Q_OBJECT
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
2012-12-29 06:34:38 +00:00
|
|
|
explicit Scene(Workspace* ws);
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual ~Scene() = 0;
|
|
|
|
class EffectFrame;
|
|
|
|
class Window;
|
|
|
|
|
|
|
|
// Returns true if the ctor failed to properly initialize.
|
|
|
|
virtual bool initFailed() const = 0;
|
|
|
|
virtual CompositingType compositingType() const = 0;
|
2012-08-23 14:51:40 +00:00
|
|
|
|
|
|
|
virtual bool hasPendingFlush() const { return false; }
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
// Repaints the given screen areas, windows provides the stacking order.
|
|
|
|
// The entry point for the main part of the painting pass.
|
2012-03-29 20:11:28 +00:00
|
|
|
// returns the time since the last vblank signal - if there's one
|
|
|
|
// ie. "what of this frame is lost to painting"
|
2013-03-28 20:53:25 +00:00
|
|
|
virtual qint64 paint(QRegion damage, ToplevelList windows) = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
// Notification function - KWin core informs about changes.
|
|
|
|
// Used to mainly discard cached data.
|
|
|
|
|
|
|
|
// a new window has been created
|
|
|
|
virtual void windowAdded(Toplevel*) = 0;
|
2011-11-26 15:15:46 +00:00
|
|
|
/**
|
|
|
|
* 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);
|
2011-01-30 14:34:42 +00:00
|
|
|
// 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,
|
2012-01-10 17:56:14 +00:00
|
|
|
// PAINT_DECORATION_ONLY = 1 << 7 has been removed
|
2011-01-30 14:34:42 +00:00
|
|
|
// Window will be painted with a lanczos filter.
|
2012-03-02 13:03:05 +00:00
|
|
|
PAINT_WINDOW_LANCZOS = 1 << 8
|
2012-01-29 16:25:20 +00:00
|
|
|
// PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS = 1 << 9 has been removed
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
2011-01-30 14:34:42 +00:00
|
|
|
// types of filtering available
|
|
|
|
enum ImageFilterType { ImageFilterFast, ImageFilterGood };
|
|
|
|
// there's nothing to paint (adjust time_diff later)
|
2012-03-29 20:11:28 +00:00
|
|
|
virtual void idle();
|
2013-03-28 20:52:26 +00:00
|
|
|
virtual bool blocksForRetrace() const;
|
|
|
|
virtual bool syncsToVBlank() const;
|
2012-08-26 15:14:23 +00:00
|
|
|
virtual OverlayWindow* overlayWindow() = 0;
|
2011-06-19 20:18:21 +00:00
|
|
|
public Q_SLOTS:
|
2012-08-16 19:19:54 +00:00
|
|
|
// a window has been destroyed
|
|
|
|
virtual void windowDeleted(KWin::Deleted*) = 0;
|
2011-06-15 17:13:56 +00:00
|
|
|
// opacity of a window changed
|
|
|
|
virtual void windowOpacityChanged(KWin::Toplevel* c) = 0;
|
2011-06-19 20:07:19 +00:00
|
|
|
// shape/size of a window changed
|
|
|
|
virtual void windowGeometryShapeChanged(KWin::Toplevel* c) = 0;
|
2011-06-21 10:30:42 +00:00
|
|
|
// a window has been closed
|
|
|
|
virtual void windowClosed(KWin::Toplevel* c, KWin::Deleted* deleted) = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
protected:
|
|
|
|
// shared implementation, starts painting the screen
|
|
|
|
void paintScreen(int* mask, QRegion* region);
|
|
|
|
friend class EffectsHandlerImpl;
|
|
|
|
// called after all effects had their paintScreen() called
|
|
|
|
void finalPaintScreen(int mask, QRegion region, ScreenPaintData& data);
|
|
|
|
// shared implementation of painting the screen in the generic
|
|
|
|
// (unoptimized) way
|
|
|
|
virtual void paintGenericScreen(int mask, ScreenPaintData data);
|
|
|
|
// shared implementation of painting the screen in an optimized way
|
|
|
|
virtual void paintSimpleScreen(int mask, QRegion region);
|
|
|
|
// paint the background (not the desktop background - the whole background)
|
|
|
|
virtual void paintBackground(QRegion region) = 0;
|
|
|
|
// called after all effects had their paintWindow() called
|
|
|
|
void finalPaintWindow(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data);
|
|
|
|
// shared implementation, starts painting the window
|
|
|
|
virtual void paintWindow(Window* w, int mask, QRegion region, WindowQuadList quads);
|
|
|
|
// called after all effects had their drawWindow() called
|
2012-11-13 20:41:02 +00:00
|
|
|
virtual void finalDrawWindow(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data);
|
2013-02-18 22:17:46 +00:00
|
|
|
// 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);
|
2012-03-29 18:17:57 +00:00
|
|
|
virtual void paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data);
|
2011-01-30 14:34:42 +00:00
|
|
|
// compute time since the last repaint
|
|
|
|
void updateTimeDiff();
|
|
|
|
// saved data for 2nd pass of optimized screen painting
|
|
|
|
struct Phase2Data {
|
|
|
|
Phase2Data(Window* w, QRegion r, QRegion c, int m, const WindowQuadList& q)
|
|
|
|
: window(w), region(r), clip(c), mask(m), quads(q) {}
|
|
|
|
Phase2Data() {
|
|
|
|
window = 0;
|
|
|
|
mask = 0;
|
|
|
|
}
|
|
|
|
Window* window;
|
|
|
|
QRegion region;
|
|
|
|
QRegion clip;
|
|
|
|
int mask;
|
|
|
|
WindowQuadList quads;
|
|
|
|
};
|
|
|
|
// windows in their stacking order
|
|
|
|
QVector< Window* > stacking_order;
|
|
|
|
// 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;
|
|
|
|
// time since last repaint
|
|
|
|
int time_diff;
|
2011-08-29 04:47:07 +00:00
|
|
|
QElapsedTimer last_time;
|
2011-01-30 14:34:42 +00:00
|
|
|
Workspace* wspace;
|
2012-03-29 18:17:57 +00:00
|
|
|
private:
|
|
|
|
void paintWindowThumbnails(Scene::Window *w, QRegion region, qreal opacity, qreal brightness, qreal saturation);
|
|
|
|
void paintDesktopThumbnails(Scene::Window *w);
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
// The base class for windows representations in composite backends
|
|
|
|
class Scene::Window
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
Window(Toplevel* c);
|
|
|
|
virtual ~Window();
|
|
|
|
// perform the actual painting of the window
|
|
|
|
virtual void performPaint(int mask, QRegion region, WindowPaintData data) = 0;
|
|
|
|
// do any cleanup needed when the window's composite pixmap is discarded
|
2013-05-10 10:07:56 +00:00
|
|
|
void pixmapDiscarded();
|
2011-01-30 14:34:42 +00:00
|
|
|
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();
|
|
|
|
// 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 is not the active window in a client group
|
2012-01-12 06:42:55 +00:00
|
|
|
PAINT_DISABLED_BY_TAB_GROUP = 1 << 4,
|
2011-01-30 14:34:42 +00:00
|
|
|
// Window will not be painted because it's not on the current activity
|
|
|
|
PAINT_DISABLED_BY_ACTIVITY = 1 << 5
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
2011-01-30 14:34:42 +00:00
|
|
|
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;
|
|
|
|
// shape of the window
|
2012-09-07 07:40:44 +00:00
|
|
|
const QRegion &shape() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
QRegion clientShape() const;
|
|
|
|
void discardShape();
|
|
|
|
void updateToplevel(Toplevel* c);
|
|
|
|
// creates initial quad list for the window
|
|
|
|
virtual WindowQuadList buildQuads(bool force = false) const;
|
|
|
|
void suspendUnredirect(bool suspend);
|
2011-04-03 09:31:33 +00:00
|
|
|
void updateShadow(Shadow* shadow);
|
|
|
|
const Shadow* shadow() const;
|
|
|
|
Shadow* shadow();
|
2013-05-10 10:07:56 +00:00
|
|
|
void referencePreviousPixmap();
|
|
|
|
void unreferencePreviousPixmap();
|
2011-01-30 14:34:42 +00:00
|
|
|
protected:
|
|
|
|
WindowQuadList makeQuads(WindowQuadType type, const QRegion& reg) const;
|
2013-03-16 11:21:59 +00:00
|
|
|
WindowQuadList makeDecorationQuads(const QRect *rects, const QRegion ®ion) const;
|
2013-05-10 10:07:56 +00:00
|
|
|
/**
|
|
|
|
* @brief Returns the WindowPixmap for this Window.
|
|
|
|
*
|
|
|
|
* If the WindowPixmap does not yet exist, this method will invoke @link 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<typename T> T *windowPixmap();
|
2013-05-13 06:17:28 +00:00
|
|
|
template<typename T> T *previousWindowPixmap();
|
2013-05-10 10:07:56 +00:00
|
|
|
/**
|
|
|
|
* @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 @link WindowPixmap::create on the created instance. The Scene will take care of that.
|
|
|
|
*/
|
|
|
|
virtual WindowPixmap *createWindowPixmap() = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
Toplevel* toplevel;
|
|
|
|
ImageFilterType filter;
|
2011-04-03 09:31:33 +00:00
|
|
|
Shadow *m_shadow;
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
2013-05-10 10:07:56 +00:00
|
|
|
QScopedPointer<WindowPixmap> m_currentPixmap;
|
|
|
|
QScopedPointer<WindowPixmap> m_previousPixmap;
|
|
|
|
int m_referencePixmapCounter;
|
2011-01-30 14:34:42 +00:00
|
|
|
int disable_painting;
|
|
|
|
mutable QRegion shape_region;
|
|
|
|
mutable bool shape_valid;
|
|
|
|
mutable WindowQuadList* cached_quad_list;
|
|
|
|
Q_DISABLE_COPY(Window)
|
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-05-10 10:07:56 +00:00
|
|
|
/**
|
|
|
|
* @brief Wrapper for a pixmap of the @link 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 @link isValid will return @c false. The pixmap mapping to the window can be established
|
|
|
|
* through @link create. If it succeeds @link 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 @link 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 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, @link 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();
|
|
|
|
/**
|
|
|
|
* @return @c true if the pixmap has been created and is valid, @c false otherwise
|
|
|
|
*/
|
|
|
|
bool isValid() const;
|
|
|
|
/**
|
|
|
|
* @return The native X11 pixmap handle
|
|
|
|
*/
|
|
|
|
xcb_pixmap_t pixmap() 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 @link 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();
|
2013-05-13 06:17:28 +00:00
|
|
|
/**
|
|
|
|
* The size of the pixmap.
|
|
|
|
*/
|
|
|
|
const QSize &size() 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;
|
2013-05-10 10:07:56 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
explicit WindowPixmap(Scene::Window *window);
|
|
|
|
/**
|
|
|
|
* @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();
|
|
|
|
/**
|
|
|
|
* @return The Window this WindowPixmap belongs to
|
|
|
|
*/
|
|
|
|
Scene::Window *window();
|
|
|
|
private:
|
|
|
|
Scene::Window *m_window;
|
|
|
|
xcb_pixmap_t m_pixmap;
|
|
|
|
QSize m_pixmapSize;
|
|
|
|
bool m_discarded;
|
2013-05-13 06:17:28 +00:00
|
|
|
QRect m_contentsRect;
|
2013-05-10 10:07:56 +00:00
|
|
|
};
|
|
|
|
|
2010-07-18 16:32:37 +00:00
|
|
|
class Scene::EffectFrame
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
EffectFrame(EffectFrameImpl* frame);
|
|
|
|
virtual ~EffectFrame();
|
|
|
|
virtual void render(QRegion region, 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;
|
|
|
|
};
|
2010-07-18 16:32:37 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline
|
|
|
|
int Scene::Window::x() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return toplevel->x();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline
|
|
|
|
int Scene::Window::y() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return toplevel->y();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline
|
|
|
|
int Scene::Window::width() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return toplevel->width();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline
|
|
|
|
int Scene::Window::height() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return toplevel->height();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline
|
|
|
|
QRect Scene::Window::geometry() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return toplevel->geometry();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline
|
|
|
|
QSize Scene::Window::size() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return toplevel->size();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline
|
|
|
|
QPoint Scene::Window::pos() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return toplevel->pos();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline
|
|
|
|
QRect Scene::Window::rect() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return toplevel->rect();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline
|
|
|
|
Toplevel* Scene::Window::window()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return toplevel;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline
|
2011-01-30 14:34:42 +00:00
|
|
|
void Scene::Window::updateToplevel(Toplevel* c)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
toplevel = c;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-08-24 13:32:57 +00:00
|
|
|
inline
|
2011-01-30 14:34:42 +00:00
|
|
|
void Scene::Window::suspendUnredirect(bool suspend)
|
|
|
|
{
|
|
|
|
toplevel->suspendUnredirect(suspend);
|
|
|
|
}
|
2008-08-24 13:32:57 +00:00
|
|
|
|
2011-04-03 09:31:33 +00:00
|
|
|
inline
|
|
|
|
void Scene::Window::updateShadow(Shadow* shadow)
|
|
|
|
{
|
|
|
|
m_shadow = shadow;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
const Shadow* Scene::Window::shadow() const
|
|
|
|
{
|
|
|
|
return m_shadow;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
Shadow* Scene::Window::shadow()
|
|
|
|
{
|
|
|
|
return m_shadow;
|
|
|
|
}
|
|
|
|
|
2013-05-10 10:07:56 +00:00
|
|
|
inline
|
|
|
|
bool WindowPixmap::isValid() const
|
|
|
|
{
|
|
|
|
return m_pixmap != XCB_PIXMAP_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
inline
|
|
|
|
T* Scene::Window::windowPixmap()
|
|
|
|
{
|
|
|
|
if (m_currentPixmap.isNull()) {
|
|
|
|
m_currentPixmap.reset(createWindowPixmap());
|
|
|
|
}
|
|
|
|
if (m_currentPixmap->isValid()) {
|
|
|
|
return static_cast<T*>(m_currentPixmap.data());
|
|
|
|
}
|
|
|
|
m_currentPixmap->create();
|
|
|
|
if (m_currentPixmap->isValid()) {
|
|
|
|
return static_cast<T*>(m_currentPixmap.data());
|
|
|
|
} else {
|
|
|
|
return static_cast<T*>(m_previousPixmap.data());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-13 06:17:28 +00:00
|
|
|
template <typename T>
|
|
|
|
inline
|
|
|
|
T* Scene::Window::previousWindowPixmap()
|
|
|
|
{
|
|
|
|
return static_cast<T*>(m_previousPixmap.data());
|
|
|
|
}
|
|
|
|
|
2013-05-10 10:07:56 +00:00
|
|
|
inline
|
|
|
|
Toplevel* WindowPixmap::toplevel()
|
|
|
|
{
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2013-05-13 06:17:28 +00:00
|
|
|
inline
|
|
|
|
const QRect &WindowPixmap::contentsRect() const
|
|
|
|
{
|
|
|
|
return m_contentsRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
const QSize &WindowPixmap::size() const
|
|
|
|
{
|
|
|
|
return m_pixmapSize;
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|