Use properties in EffectWindow where possible instead of inheritance
If possible use the property to Toplevel or Client instead of the pure virtual methods. This makes it easier to get a stable ABI. Adding new methods to the class no longer requires to add a pure virtual method. From a performance point of view this change should not matter. Most EffectWindow methods are not invoked during the repaint chain. But only in response to an event like a window got added. There the overhead does not really matter as well the previous implementation made strong use of dynamic casts which are also not knwon for being very fast.
This commit is contained in:
parent
3c59983589
commit
a348df0d34
4 changed files with 160 additions and 386 deletions
282
effects.cpp
282
effects.cpp
|
@ -1371,51 +1371,6 @@ void EffectWindowImpl::addRepaintFull()
|
||||||
toplevel->addRepaintFull();
|
toplevel->addRepaintFull();
|
||||||
}
|
}
|
||||||
|
|
||||||
int EffectWindowImpl::desktop() const
|
|
||||||
{
|
|
||||||
return toplevel->desktop();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isOnActivity(QString activity) const
|
|
||||||
{
|
|
||||||
return toplevel->isOnActivity(activity);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isOnAllActivities() const
|
|
||||||
{
|
|
||||||
return toplevel->isOnAllActivities();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isOnAllDesktops() const
|
|
||||||
{
|
|
||||||
return desktop() == NET::OnAllDesktops;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString EffectWindowImpl::caption() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast<Client*>(toplevel))
|
|
||||||
return c->caption();
|
|
||||||
else
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
QString EffectWindowImpl::windowClass() const
|
|
||||||
{
|
|
||||||
return toplevel->resourceName() + ' ' + toplevel->resourceClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString EffectWindowImpl::windowRole() const
|
|
||||||
{
|
|
||||||
return toplevel->windowRole();
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap EffectWindowImpl::icon() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast<Client*>(toplevel))
|
|
||||||
return c->icon();
|
|
||||||
return QPixmap(); // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
const EffectWindowGroup* EffectWindowImpl::group() const
|
const EffectWindowGroup* EffectWindowImpl::group() const
|
||||||
{
|
{
|
||||||
if (Client* c = dynamic_cast< Client* >(toplevel))
|
if (Client* c = dynamic_cast< Client* >(toplevel))
|
||||||
|
@ -1423,25 +1378,6 @@ const EffectWindowGroup* EffectWindowImpl::group() const
|
||||||
return NULL; // TODO
|
return NULL; // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EffectWindowImpl::isMinimized() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast<Client*>(toplevel))
|
|
||||||
return c->isMinimized();
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
double EffectWindowImpl::opacity() const
|
|
||||||
{
|
|
||||||
return toplevel->opacity();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::hasAlpha() const
|
|
||||||
{
|
|
||||||
return toplevel->hasAlpha();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isDeleted() const
|
bool EffectWindowImpl::isDeleted() const
|
||||||
{
|
{
|
||||||
return (dynamic_cast<Deleted*>(toplevel) != 0);
|
return (dynamic_cast<Deleted*>(toplevel) != 0);
|
||||||
|
@ -1472,72 +1408,16 @@ void EffectWindowImpl::setSceneWindow(Scene::Window* w)
|
||||||
sw = w;
|
sw = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
int EffectWindowImpl::x() const
|
|
||||||
{
|
|
||||||
return toplevel->x();
|
|
||||||
}
|
|
||||||
|
|
||||||
int EffectWindowImpl::y() const
|
|
||||||
{
|
|
||||||
return toplevel->y();
|
|
||||||
}
|
|
||||||
|
|
||||||
int EffectWindowImpl::width() const
|
|
||||||
{
|
|
||||||
return toplevel->width();
|
|
||||||
}
|
|
||||||
|
|
||||||
int EffectWindowImpl::height() const
|
|
||||||
{
|
|
||||||
return toplevel->height();
|
|
||||||
}
|
|
||||||
|
|
||||||
QSize EffectWindowImpl::basicUnit() const
|
|
||||||
{
|
|
||||||
Client *client = dynamic_cast<Client*>(toplevel);
|
|
||||||
return client ? client->basicUnit() : QSize(1,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect EffectWindowImpl::geometry() const
|
|
||||||
{
|
|
||||||
return toplevel->geometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
QRegion EffectWindowImpl::shape() const
|
QRegion EffectWindowImpl::shape() const
|
||||||
{
|
{
|
||||||
return sw ? sw->shape() : geometry();
|
return sw ? sw->shape() : geometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
int EffectWindowImpl::screen() const
|
|
||||||
{
|
|
||||||
return toplevel->screen();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::hasOwnShape() const
|
bool EffectWindowImpl::hasOwnShape() const
|
||||||
{
|
{
|
||||||
return toplevel->shape();
|
return toplevel->shape();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize EffectWindowImpl::size() const
|
|
||||||
{
|
|
||||||
return toplevel->size();
|
|
||||||
}
|
|
||||||
|
|
||||||
QPoint EffectWindowImpl::pos() const
|
|
||||||
{
|
|
||||||
return toplevel->pos();
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect EffectWindowImpl::rect() const
|
|
||||||
{
|
|
||||||
return toplevel->rect();
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect EffectWindowImpl::contentsRect() const
|
|
||||||
{
|
|
||||||
return QRect(toplevel->clientPos(), toplevel->clientSize());
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect EffectWindowImpl::decorationInnerRect() const
|
QRect EffectWindowImpl::decorationInnerRect() const
|
||||||
{
|
{
|
||||||
Client *client = dynamic_cast<Client*>(toplevel);
|
Client *client = dynamic_cast<Client*>(toplevel);
|
||||||
|
@ -1554,152 +1434,11 @@ void EffectWindowImpl::deleteProperty(long int atom) const
|
||||||
deleteWindowProperty(window()->window(), atom);
|
deleteWindowProperty(window()->window(), atom);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EffectWindowImpl::isMovable() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast< Client* >(toplevel))
|
|
||||||
return c->isMovable();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isMovableAcrossScreens() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast< Client* >(toplevel))
|
|
||||||
return c->isMovableAcrossScreens();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isUserMove() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast< Client* >(toplevel))
|
|
||||||
return c->isMove();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isUserResize() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast< Client* >(toplevel))
|
|
||||||
return c->isResize();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect EffectWindowImpl::iconGeometry() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast< Client* >(toplevel))
|
|
||||||
return c->iconGeometry();
|
|
||||||
return QRect();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isDesktop() const
|
|
||||||
{
|
|
||||||
return toplevel->isDesktop();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isDock() const
|
|
||||||
{
|
|
||||||
return toplevel->isDock();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isToolbar() const
|
|
||||||
{
|
|
||||||
return toplevel->isToolbar();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isMenu() const
|
|
||||||
{
|
|
||||||
return toplevel->isMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isNormalWindow() const
|
|
||||||
{
|
|
||||||
return toplevel->isNormalWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isSpecialWindow() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast<Client*>(toplevel))
|
|
||||||
return c->isSpecialWindow();
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isDialog() const
|
|
||||||
{
|
|
||||||
return toplevel->isDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isSplash() const
|
|
||||||
{
|
|
||||||
return toplevel->isSplash();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isUtility() const
|
|
||||||
{
|
|
||||||
return toplevel->isUtility();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isDropdownMenu() const
|
|
||||||
{
|
|
||||||
return toplevel->isDropdownMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isPopupMenu() const
|
|
||||||
{
|
|
||||||
return toplevel->isPopupMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isTooltip() const
|
|
||||||
{
|
|
||||||
return toplevel->isTooltip();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isNotification() const
|
|
||||||
{
|
|
||||||
return toplevel->isNotification();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isComboBox() const
|
|
||||||
{
|
|
||||||
return toplevel->isComboBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isDNDIcon() const
|
|
||||||
{
|
|
||||||
return toplevel->isDNDIcon();
|
|
||||||
}
|
|
||||||
|
|
||||||
NET::WindowType EffectWindowImpl::windowType() const
|
|
||||||
{
|
|
||||||
return toplevel->windowType();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isManaged() const
|
bool EffectWindowImpl::isManaged() const
|
||||||
{
|
{
|
||||||
return dynamic_cast< const Client* >(toplevel) != NULL;
|
return dynamic_cast< const Client* >(toplevel) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EffectWindowImpl::acceptsFocus() const
|
|
||||||
{
|
|
||||||
const Client* client = dynamic_cast< const Client* >(toplevel);
|
|
||||||
if (!client)
|
|
||||||
return true; // We don't actually know...
|
|
||||||
return client->wantsInput();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::keepAbove() const
|
|
||||||
{
|
|
||||||
const Client* client = dynamic_cast< const Client* >(toplevel);
|
|
||||||
if (!client)
|
|
||||||
return true;
|
|
||||||
return client->keepAbove();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectWindowImpl::isModal() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast< Client* >(toplevel))
|
|
||||||
return c->isModal();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
EffectWindow* EffectWindowImpl::findModal()
|
EffectWindow* EffectWindowImpl::findModal()
|
||||||
{
|
{
|
||||||
if (Client* c = dynamic_cast< Client* >(toplevel)) {
|
if (Client* c = dynamic_cast< Client* >(toplevel)) {
|
||||||
|
@ -1721,32 +1460,11 @@ EffectWindowList EffectWindowImpl::mainWindows() const
|
||||||
return EffectWindowList();
|
return EffectWindowList();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EffectWindowImpl::isSkipSwitcher() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast< Client* >(toplevel))
|
|
||||||
return c->skipSwitcher();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
WindowQuadList EffectWindowImpl::buildQuads(bool force) const
|
WindowQuadList EffectWindowImpl::buildQuads(bool force) const
|
||||||
{
|
{
|
||||||
return sceneWindow()->buildQuads(force);
|
return sceneWindow()->buildQuads(force);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectWindowImpl::minimize() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast< Client* >(toplevel)) {
|
|
||||||
c->minimize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EffectWindowImpl::unminimize() const
|
|
||||||
{
|
|
||||||
if (Client* c = dynamic_cast< Client* >(toplevel)) {
|
|
||||||
c->unminimize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EffectWindowImpl::closeWindow() const
|
void EffectWindowImpl::closeWindow() const
|
||||||
{
|
{
|
||||||
if (Client* c = dynamic_cast< Client* >(toplevel)) {
|
if (Client* c = dynamic_cast< Client* >(toplevel)) {
|
||||||
|
|
52
effects.h
52
effects.h
|
@ -242,72 +242,20 @@ public:
|
||||||
virtual void unrefWindow();
|
virtual void unrefWindow();
|
||||||
virtual bool isDeleted() const;
|
virtual bool isDeleted() const;
|
||||||
|
|
||||||
virtual bool isOnActivity(QString id) const;
|
|
||||||
virtual bool isOnAllActivities() const;
|
|
||||||
|
|
||||||
virtual bool isOnAllDesktops() const;
|
|
||||||
virtual int desktop() const; // prefer isOnXXX()
|
|
||||||
virtual bool isMinimized() const;
|
|
||||||
virtual double opacity() const;
|
|
||||||
virtual bool hasAlpha() const;
|
|
||||||
virtual QString caption() const;
|
|
||||||
virtual QPixmap icon() const;
|
|
||||||
virtual QString windowClass() const;
|
|
||||||
virtual QString windowRole() const;
|
|
||||||
virtual const EffectWindowGroup* group() const;
|
virtual const EffectWindowGroup* group() const;
|
||||||
|
|
||||||
virtual int x() const;
|
|
||||||
virtual int y() const;
|
|
||||||
virtual int width() const;
|
|
||||||
virtual int height() const;
|
|
||||||
virtual QSize basicUnit() const;
|
|
||||||
virtual QRect geometry() const;
|
|
||||||
virtual QRegion shape() const;
|
virtual QRegion shape() const;
|
||||||
virtual int screen() const;
|
|
||||||
virtual bool hasOwnShape() const;
|
virtual bool hasOwnShape() const;
|
||||||
virtual QPoint pos() const;
|
|
||||||
virtual QSize size() const;
|
|
||||||
virtual QRect rect() const;
|
|
||||||
virtual bool isMovable() const;
|
|
||||||
virtual bool isMovableAcrossScreens() const;
|
|
||||||
virtual bool isUserMove() const;
|
|
||||||
virtual bool isUserResize() const;
|
|
||||||
virtual QRect iconGeometry() const;
|
|
||||||
virtual QRect contentsRect() const;
|
|
||||||
virtual QRect decorationInnerRect() const;
|
virtual QRect decorationInnerRect() const;
|
||||||
virtual QByteArray readProperty(long atom, long type, int format) const;
|
virtual QByteArray readProperty(long atom, long type, int format) const;
|
||||||
virtual void deleteProperty(long atom) const;
|
virtual void deleteProperty(long atom) const;
|
||||||
|
|
||||||
virtual bool isDesktop() const;
|
|
||||||
virtual bool isDock() const;
|
|
||||||
virtual bool isToolbar() const;
|
|
||||||
virtual bool isMenu() const;
|
|
||||||
virtual bool isNormalWindow() const; // normal as in 'NET::Normal or NET::Unknown non-transient'
|
|
||||||
virtual bool isSpecialWindow() const;
|
|
||||||
virtual bool isDialog() const;
|
|
||||||
virtual bool isSplash() const;
|
|
||||||
virtual bool isUtility() const;
|
|
||||||
virtual bool isDropdownMenu() const;
|
|
||||||
virtual bool isPopupMenu() const; // a context popup, not dropdown, not torn-off
|
|
||||||
virtual bool isTooltip() const;
|
|
||||||
virtual bool isNotification() const;
|
|
||||||
virtual bool isComboBox() const;
|
|
||||||
virtual bool isDNDIcon() const;
|
|
||||||
virtual NET::WindowType windowType() const;
|
|
||||||
virtual bool isManaged() const; // managed or override-redirect
|
virtual bool isManaged() const; // managed or override-redirect
|
||||||
virtual bool acceptsFocus() const;
|
|
||||||
virtual bool keepAbove() const;
|
|
||||||
|
|
||||||
virtual bool isModal() const;
|
|
||||||
virtual EffectWindow* findModal();
|
virtual EffectWindow* findModal();
|
||||||
virtual EffectWindowList mainWindows() const;
|
virtual EffectWindowList mainWindows() const;
|
||||||
|
|
||||||
virtual bool isSkipSwitcher() const;
|
|
||||||
|
|
||||||
virtual WindowQuadList buildQuads(bool force = false) const;
|
virtual WindowQuadList buildQuads(bool force = false) const;
|
||||||
|
|
||||||
virtual void minimize() const;
|
|
||||||
virtual void unminimize() const;
|
|
||||||
virtual void closeWindow() const;
|
virtual void closeWindow() const;
|
||||||
|
|
||||||
virtual bool visibleInClientGroup() const;
|
virtual bool visibleInClientGroup() const;
|
||||||
|
|
|
@ -291,6 +291,109 @@ EffectWindow::~EffectWindow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define WINDOW_HELPER( rettype, prototype, propertyname ) \
|
||||||
|
rettype EffectWindow::prototype ( ) const \
|
||||||
|
{ \
|
||||||
|
return parent()->property( propertyname ).value< rettype >(); \
|
||||||
|
}
|
||||||
|
|
||||||
|
WINDOW_HELPER(double, opacity, "opacity")
|
||||||
|
WINDOW_HELPER(bool, hasAlpha, "alpha")
|
||||||
|
WINDOW_HELPER(int, x, "x")
|
||||||
|
WINDOW_HELPER(int, y, "y")
|
||||||
|
WINDOW_HELPER(int, width, "width")
|
||||||
|
WINDOW_HELPER(int, height, "height")
|
||||||
|
WINDOW_HELPER(QPoint, pos, "pos")
|
||||||
|
WINDOW_HELPER(QSize, size, "size")
|
||||||
|
WINDOW_HELPER(int, screen, "screen")
|
||||||
|
WINDOW_HELPER(QRect, geometry, "geometry")
|
||||||
|
WINDOW_HELPER(QRect, rect, "rect")
|
||||||
|
WINDOW_HELPER(int, desktop, "desktop")
|
||||||
|
WINDOW_HELPER(bool, isDesktop, "desktopWindow")
|
||||||
|
WINDOW_HELPER(bool, isDock, "dock")
|
||||||
|
WINDOW_HELPER(bool, isToolbar, "toolbar")
|
||||||
|
WINDOW_HELPER(bool, isMenu, "menu")
|
||||||
|
WINDOW_HELPER(bool, isNormalWindow, "normalWindow")
|
||||||
|
WINDOW_HELPER(bool, isDialog, "dialog")
|
||||||
|
WINDOW_HELPER(bool, isSplash, "splash")
|
||||||
|
WINDOW_HELPER(bool, isUtility, "utility")
|
||||||
|
WINDOW_HELPER(bool, isDropdownMenu, "dropdownMenu")
|
||||||
|
WINDOW_HELPER(bool, isPopupMenu, "popupMenu")
|
||||||
|
WINDOW_HELPER(bool, isTooltip, "tooltip")
|
||||||
|
WINDOW_HELPER(bool, isNotification, "notification")
|
||||||
|
WINDOW_HELPER(bool, isComboBox, "comboBox")
|
||||||
|
WINDOW_HELPER(bool, isDNDIcon, "dndIcon")
|
||||||
|
WINDOW_HELPER(QString, windowRole, "windowRole")
|
||||||
|
|
||||||
|
QString EffectWindow::windowClass() const
|
||||||
|
{
|
||||||
|
return parent()->property("resourceName").toString() + ' ' + parent()->property("resourceClass").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QRect EffectWindow::contentsRect() const
|
||||||
|
{
|
||||||
|
return QRect(parent()->property("clientPos").toPoint(), parent()->property("clientSize").toSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
NET::WindowType EffectWindow::windowType() const
|
||||||
|
{
|
||||||
|
return static_cast<NET::WindowType>(parent()->property("windowType").toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EffectWindow::isOnActivity(QString activity) const
|
||||||
|
{
|
||||||
|
const QStringList activities = parent()->property("activities").toStringList();
|
||||||
|
return activities.isEmpty() || activities.contains(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EffectWindow::isOnAllActivities() const
|
||||||
|
{
|
||||||
|
return parent()->property("activities").toStringList().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef WINDOW_HELPER
|
||||||
|
|
||||||
|
#define WINDOW_HELPER_DEFAULT( rettype, prototype, propertyname, defaultValue ) \
|
||||||
|
rettype EffectWindow::prototype ( ) const \
|
||||||
|
{ \
|
||||||
|
const QVariant variant = parent()->property( propertyname ); \
|
||||||
|
if (!variant.isValid()) { \
|
||||||
|
return defaultValue; \
|
||||||
|
} \
|
||||||
|
return variant.value< rettype >(); \
|
||||||
|
}
|
||||||
|
|
||||||
|
WINDOW_HELPER_DEFAULT(bool, isMinimized, "minimized", false)
|
||||||
|
WINDOW_HELPER_DEFAULT(bool, isMovable, "moveable", false)
|
||||||
|
WINDOW_HELPER_DEFAULT(bool, isMovableAcrossScreens, "moveableAcrossScreens", false)
|
||||||
|
WINDOW_HELPER_DEFAULT(QString, caption, "caption", "")
|
||||||
|
WINDOW_HELPER_DEFAULT(bool, keepAbove, "keepAbove", true)
|
||||||
|
WINDOW_HELPER_DEFAULT(bool, isModal, "modal", false)
|
||||||
|
WINDOW_HELPER_DEFAULT(QSize, basicUnit, "basicUnit", QSize(1, 1))
|
||||||
|
WINDOW_HELPER_DEFAULT(bool, isUserMove, "move", false)
|
||||||
|
WINDOW_HELPER_DEFAULT(bool, isUserResize, "resize", false)
|
||||||
|
WINDOW_HELPER_DEFAULT(QRect, iconGeometry, "iconGeometry", QRect())
|
||||||
|
WINDOW_HELPER_DEFAULT(bool, isSpecialWindow, "specialWindow", true)
|
||||||
|
WINDOW_HELPER_DEFAULT(bool, acceptsFocus, "wantsInput", true) // We don't actually know...
|
||||||
|
WINDOW_HELPER_DEFAULT(QPixmap, icon, "icon", QPixmap())
|
||||||
|
WINDOW_HELPER_DEFAULT(bool, isSkipSwitcher, "skipSwitcher", false)
|
||||||
|
|
||||||
|
#undef WINDOW_HELPER_DEFAULT
|
||||||
|
|
||||||
|
#define WINDOW_HELPER_SETTER( prototype, propertyname, args, value ) \
|
||||||
|
void EffectWindow::prototype ( args ) \
|
||||||
|
{\
|
||||||
|
const QVariant variant = parent()->property( propertyname ); \
|
||||||
|
if (variant.isValid()) { \
|
||||||
|
parent()->setProperty( propertyname, value ); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
WINDOW_HELPER_SETTER(minimize, "minimized",,true)
|
||||||
|
WINDOW_HELPER_SETTER(unminimize, "minimized",,false)
|
||||||
|
|
||||||
|
#undef WINDOW_HELPER_SETTER
|
||||||
|
|
||||||
bool EffectWindow::isOnCurrentActivity() const
|
bool EffectWindow::isOnCurrentActivity() const
|
||||||
{
|
{
|
||||||
return isOnActivity(effects->currentActivity());
|
return isOnActivity(effects->currentActivity());
|
||||||
|
@ -306,6 +409,11 @@ bool EffectWindow::isOnDesktop(int d) const
|
||||||
return desktop() == d || isOnAllDesktops();
|
return desktop() == d || isOnAllDesktops();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EffectWindow::isOnAllDesktops() const
|
||||||
|
{
|
||||||
|
return desktop() == NET::OnAllDesktops;
|
||||||
|
}
|
||||||
|
|
||||||
bool EffectWindow::hasDecoration() const
|
bool EffectWindow::hasDecoration() const
|
||||||
{
|
{
|
||||||
return contentsRect() != QRect(0, 0, width(), height());
|
return contentsRect() != QRect(0, 0, width(), height());
|
||||||
|
|
|
@ -1101,45 +1101,45 @@ public:
|
||||||
virtual void unrefWindow() = 0;
|
virtual void unrefWindow() = 0;
|
||||||
virtual bool isDeleted() const = 0;
|
virtual bool isDeleted() const = 0;
|
||||||
|
|
||||||
virtual bool isMinimized() const = 0;
|
bool isMinimized() const;
|
||||||
virtual double opacity() const = 0;
|
double opacity() const;
|
||||||
virtual bool hasAlpha() const = 0;
|
bool hasAlpha() const;
|
||||||
|
|
||||||
virtual bool isOnCurrentActivity() const;
|
bool isOnCurrentActivity() const;
|
||||||
virtual bool isOnActivity(QString id) const = 0;
|
bool isOnActivity(QString id) const;
|
||||||
virtual bool isOnAllActivities() const = 0;
|
bool isOnAllActivities() const;
|
||||||
|
|
||||||
virtual bool isOnDesktop(int d) const;
|
bool isOnDesktop(int d) const;
|
||||||
virtual bool isOnCurrentDesktop() const;
|
bool isOnCurrentDesktop() const;
|
||||||
virtual bool isOnAllDesktops() const = 0;
|
bool isOnAllDesktops() const;
|
||||||
virtual int desktop() const = 0; // prefer isOnXXX()
|
int desktop() const; // prefer isOnXXX()
|
||||||
|
|
||||||
virtual int x() const = 0;
|
int x() const;
|
||||||
virtual int y() const = 0;
|
int y() const;
|
||||||
virtual int width() const = 0;
|
int width() const;
|
||||||
virtual int height() const = 0;
|
int height() const;
|
||||||
/**
|
/**
|
||||||
* By how much the window wishes to grow/shrink at least. Usually QSize(1,1).
|
* By how much the window wishes to grow/shrink at least. Usually QSize(1,1).
|
||||||
* MAY BE DISOBEYED BY THE WM! It's only for information, do NOT rely on it at all.
|
* MAY BE DISOBEYED BY THE WM! It's only for information, do NOT rely on it at all.
|
||||||
*/
|
*/
|
||||||
virtual QSize basicUnit() const = 0;
|
QSize basicUnit() const;
|
||||||
virtual QRect geometry() const = 0;
|
QRect geometry() const;
|
||||||
virtual QRegion shape() const = 0;
|
virtual QRegion shape() const = 0;
|
||||||
virtual int screen() const = 0;
|
int screen() const;
|
||||||
/** @internal Do not use */
|
/** @internal Do not use */
|
||||||
virtual bool hasOwnShape() const = 0; // only for shadow effect, for now
|
virtual bool hasOwnShape() const = 0; // only for shadow effect, for now
|
||||||
virtual QPoint pos() const = 0;
|
QPoint pos() const;
|
||||||
virtual QSize size() const = 0;
|
QSize size() const;
|
||||||
virtual QRect rect() const = 0;
|
QRect rect() const;
|
||||||
virtual bool isMovable() const = 0;
|
bool isMovable() const;
|
||||||
virtual bool isMovableAcrossScreens() const = 0;
|
bool isMovableAcrossScreens() const;
|
||||||
virtual bool isUserMove() const = 0;
|
bool isUserMove() const;
|
||||||
virtual bool isUserResize() const = 0;
|
bool isUserResize() const;
|
||||||
virtual QRect iconGeometry() const = 0;
|
QRect iconGeometry() const;
|
||||||
/**
|
/**
|
||||||
* Geometry of the actual window contents inside the whole (including decorations) window.
|
* Geometry of the actual window contents inside the whole (including decorations) window.
|
||||||
*/
|
*/
|
||||||
virtual QRect contentsRect() const = 0;
|
QRect contentsRect() const;
|
||||||
/**
|
/**
|
||||||
* Geometry of the transparent rect in the decoration.
|
* Geometry of the transparent rect in the decoration.
|
||||||
* May be different from contentsRect() if the decoration is extended into the client area.
|
* May be different from contentsRect() if the decoration is extended into the client area.
|
||||||
|
@ -1150,96 +1150,96 @@ public:
|
||||||
virtual QByteArray readProperty(long atom, long type, int format) const = 0;
|
virtual QByteArray readProperty(long atom, long type, int format) const = 0;
|
||||||
virtual void deleteProperty(long atom) const = 0;
|
virtual void deleteProperty(long atom) const = 0;
|
||||||
|
|
||||||
virtual QString caption() const = 0;
|
QString caption() const;
|
||||||
virtual QPixmap icon() const = 0;
|
QPixmap icon() const;
|
||||||
virtual QString windowClass() const = 0;
|
QString windowClass() const;
|
||||||
virtual QString windowRole() const = 0;
|
QString windowRole() const;
|
||||||
virtual const EffectWindowGroup* group() const = 0;
|
virtual const EffectWindowGroup* group() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a desktop background window (the one with wallpaper).
|
* Returns whether the window is a desktop background window (the one with wallpaper).
|
||||||
* See _NET_WM_WINDOW_TYPE_DESKTOP at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_DESKTOP at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isDesktop() const = 0;
|
bool isDesktop() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a dock (i.e. a panel).
|
* Returns whether the window is a dock (i.e. a panel).
|
||||||
* See _NET_WM_WINDOW_TYPE_DOCK at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_DOCK at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isDock() const = 0;
|
bool isDock() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a standalone (detached) toolbar window.
|
* Returns whether the window is a standalone (detached) toolbar window.
|
||||||
* See _NET_WM_WINDOW_TYPE_TOOLBAR at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_TOOLBAR at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isToolbar() const = 0;
|
bool isToolbar() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a torn-off menu.
|
* Returns whether the window is a torn-off menu.
|
||||||
* See _NET_WM_WINDOW_TYPE_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isMenu() const = 0;
|
bool isMenu() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a "normal" window, i.e. an application or any other window
|
* Returns whether the window is a "normal" window, i.e. an application or any other window
|
||||||
* for which none of the specialized window types fit.
|
* for which none of the specialized window types fit.
|
||||||
* See _NET_WM_WINDOW_TYPE_NORMAL at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_NORMAL at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isNormalWindow() const = 0; // normal as in 'NET::Normal or NET::Unknown non-transient'
|
bool isNormalWindow() const; // normal as in 'NET::Normal or NET::Unknown non-transient'
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is any of special windows types (desktop, dock, splash, ...),
|
* Returns whether the window is any of special windows types (desktop, dock, splash, ...),
|
||||||
* i.e. window types that usually don't have a window frame and the user does not use window
|
* i.e. window types that usually don't have a window frame and the user does not use window
|
||||||
* management (moving, raising,...) on them.
|
* management (moving, raising,...) on them.
|
||||||
*/
|
*/
|
||||||
virtual bool isSpecialWindow() const = 0;
|
bool isSpecialWindow() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a dialog window.
|
* Returns whether the window is a dialog window.
|
||||||
* See _NET_WM_WINDOW_TYPE_DIALOG at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_DIALOG at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isDialog() const = 0;
|
bool isDialog() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a splashscreen. Note that many (especially older) applications
|
* Returns whether the window is a splashscreen. Note that many (especially older) applications
|
||||||
* do not support marking their splash windows with this type.
|
* do not support marking their splash windows with this type.
|
||||||
* See _NET_WM_WINDOW_TYPE_SPLASH at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_SPLASH at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isSplash() const = 0;
|
bool isSplash() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a utility window, such as a tool window.
|
* Returns whether the window is a utility window, such as a tool window.
|
||||||
* See _NET_WM_WINDOW_TYPE_UTILITY at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_UTILITY at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isUtility() const = 0;
|
bool isUtility() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a dropdown menu (i.e. a popup directly or indirectly open
|
* Returns whether the window is a dropdown menu (i.e. a popup directly or indirectly open
|
||||||
* from the applications menubar).
|
* from the applications menubar).
|
||||||
* See _NET_WM_WINDOW_TYPE_DROPDOWN_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_DROPDOWN_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isDropdownMenu() const = 0;
|
bool isDropdownMenu() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a popup menu (that is not a torn-off or dropdown menu).
|
* Returns whether the window is a popup menu (that is not a torn-off or dropdown menu).
|
||||||
* See _NET_WM_WINDOW_TYPE_POPUP_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_POPUP_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isPopupMenu() const = 0; // a context popup, not dropdown, not torn-off
|
bool isPopupMenu() const; // a context popup, not dropdown, not torn-off
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a tooltip.
|
* Returns whether the window is a tooltip.
|
||||||
* See _NET_WM_WINDOW_TYPE_TOOLTIP at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_TOOLTIP at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isTooltip() const = 0;
|
bool isTooltip() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a window with a notification.
|
* Returns whether the window is a window with a notification.
|
||||||
* See _NET_WM_WINDOW_TYPE_NOTIFICATION at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_NOTIFICATION at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isNotification() const = 0;
|
bool isNotification() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a combobox popup.
|
* Returns whether the window is a combobox popup.
|
||||||
* See _NET_WM_WINDOW_TYPE_COMBO at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_COMBO at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isComboBox() const = 0;
|
bool isComboBox() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is a Drag&Drop icon.
|
* Returns whether the window is a Drag&Drop icon.
|
||||||
* See _NET_WM_WINDOW_TYPE_DND at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See _NET_WM_WINDOW_TYPE_DND at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual bool isDNDIcon() const = 0;
|
bool isDNDIcon() const;
|
||||||
/**
|
/**
|
||||||
* Returns the NETWM window type
|
* Returns the NETWM window type
|
||||||
* See http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
* See http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
||||||
*/
|
*/
|
||||||
virtual NET::WindowType windowType() const = 0;
|
NET::WindowType windowType() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is managed by KWin (it has control over its placement and other
|
* Returns whether the window is managed by KWin (it has control over its placement and other
|
||||||
* aspects, as opposed to override-redirect windows that are entirely handled by the application).
|
* aspects, as opposed to override-redirect windows that are entirely handled by the application).
|
||||||
|
@ -1248,13 +1248,13 @@ public:
|
||||||
/**
|
/**
|
||||||
* Returns whether or not the window can accept keyboard focus.
|
* Returns whether or not the window can accept keyboard focus.
|
||||||
*/
|
*/
|
||||||
virtual bool acceptsFocus() const = 0;
|
bool acceptsFocus() const;
|
||||||
/**
|
/**
|
||||||
* Returns whether or not the window is kept above all other windows.
|
* Returns whether or not the window is kept above all other windows.
|
||||||
*/
|
*/
|
||||||
virtual bool keepAbove() const = 0;
|
bool keepAbove() const;
|
||||||
|
|
||||||
virtual bool isModal() const = 0;
|
bool isModal() const;
|
||||||
virtual EffectWindow* findModal() = 0;
|
virtual EffectWindow* findModal() = 0;
|
||||||
virtual EffectWindowList mainWindows() const = 0;
|
virtual EffectWindowList mainWindows() const = 0;
|
||||||
|
|
||||||
|
@ -1262,15 +1262,15 @@ public:
|
||||||
* Returns whether the window should be excluded from window switching effects.
|
* Returns whether the window should be excluded from window switching effects.
|
||||||
* @since 4.5
|
* @since 4.5
|
||||||
*/
|
*/
|
||||||
virtual bool isSkipSwitcher() const = 0;
|
bool isSkipSwitcher() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the unmodified window quad list. Can also be used to force rebuilding.
|
* Returns the unmodified window quad list. Can also be used to force rebuilding.
|
||||||
*/
|
*/
|
||||||
virtual WindowQuadList buildQuads(bool force = false) const = 0;
|
virtual WindowQuadList buildQuads(bool force = false) const = 0;
|
||||||
|
|
||||||
virtual void minimize() const = 0;
|
void minimize();
|
||||||
virtual void unminimize() const = 0;
|
void unminimize();
|
||||||
virtual void closeWindow() const = 0;
|
virtual void closeWindow() const = 0;
|
||||||
|
|
||||||
virtual bool visibleInClientGroup() const = 0;
|
virtual bool visibleInClientGroup() const = 0;
|
||||||
|
|
Loading…
Reference in a new issue