Commit Graph

18 Commits (2c169e4bca46289536eb96ed105e63d0b5714772)

Author SHA1 Message Date
Daniel Pastushchak 0d997b1093 Introduce categorized logging for kwin core
Done by Daniel Pastushchak for KDE during GCI-2014.
2014-12-05 14:27:15 +01:00
Martin Gräßlin bc0a9cb53a [kwin] Use std::find_if and lambda functions for Workspace::findClient
Instead of passing the macro based Predicate to findClient it now
expects a function which can be passed to std::find_if.

Existing code like:
xcb_window_t window; // our test window
Client *c = findClient(WindowMatchPredicated(window));

becomes:
Client *c = findClient([window](const Client *c) {
    return c->window() == window;
});

The advantage is that it is way more flexible and has the logic what
to check for directly with the code and not hidden in the macro
definition.

In addition there is a simplified overload for the very common case of
matching a window id against one of Client's windows. This overloaded
method takes a Predicate and the window id.

Above example becomes:
Client *c = findClient(Predicate::WindowMatch, w);

Existing code is migrated to use the simplified method taking
MatchPredicate and window id. The very few cases where a more complex
condition is tested the lambda function is used. As these are very
local tests only used in one function it's not worthwhile to add further
overloads to the findClient method in Workspace.

With this change all the Predicate macro definitions are removed from
utils.h as they are now completely unused.

REVIEW: 116916
2014-03-25 15:17:11 +01:00
Martin Gräßlin 2372e02752 [kwin] Use a QIcon in Client for the icons instead of Pixmaps
Client used to have dedicated methods for different icon sizes instead
of combining all pixmaps into one QIcon. This resulted in various parts
of KWin having different access to the icons:
* effects only got one pixmap of size 32x32
* decorations only got the 16x16 and 32x32 pixmaps combined into a QIcon
* tabbox could request all icon sizes, but only as pixmap

Now all sizes are available in one QIcon allowing to easily access the
best fitting icon in a given UI.
2013-12-06 14:41:23 +01:00
Martin Gräßlin 57905c0cc2 And we got rid of KDebug
Usages of kBacktrace got dropped.
2013-09-02 13:14:39 +02:00
Martin Gräßlin 416b881a00 Remove parent window id from ThumbnailItem
Luckily a QQuickItem contains the pointer to the QQuickWindow which
holds the item. This means we no longer need the hack to find the
parent window.
2013-08-13 09:57:51 +02:00
Martin Gräßlin 69b109b5b9 Adjust the ThumbnailItems to QtQuick2
AbstractThumbnailItem inherits from QQuickPaintedItem using QPainter to
do the fallback painting of icons.

The scene is adjusted to get the information from QQuickItem instead of
QDeclarativeItem. Clipping got a little bit more complex as the clip
path does not exist any more. To get it right the ThumbnailItem needs to
specify the parent it wants to be clipped to with the clipTo property.
E.g.:
clipTo: listView

The scene uses this clipTo parent item to correctly calculate the clip
region. Also the ThumbnailItem needs to have clipping enabled.

Note: this commit currently breaks TabBox as the qml and view are not
yet adjusted. In scripting the export of the item is disabled, but any
qml script using a ThumbnailItem would obviously also fail.
2013-08-09 11:47:17 +02:00
Martin Gräßlin 330d40f425 Fix no cast to/from ASCII intrduced issues
* "" needs to be wrapped in QStringLiteral
* QString::fromUtf8 needed for const char* and QByteArray
* QByteArray::constData() needed to get to the const char*
2013-07-24 09:58:33 +02:00
Martin Gräßlin 466bef3a6d Adding a DesktopThumbnailItem declarative item
Similar to WindowThumbnailItem for rendering a desktop thumbnail.
Uses the new paintDesktop hook.

FEATURE: 296067
FIXED-IN: 4.11.0
REVIEW: 104441
2013-04-24 11:45:47 +02:00
Martin Gräßlin 8037e6529c Rename ThumbnailItem to WindowThumbnailItem
This is for discrimination from the to be added DesktopThumbnailItem.
The name for QML is unchanged to keep the public API stable.
2013-04-24 11:43:22 +02:00
Martin Gräßlin db91db3a4f Refactoring: break out a base class for ThumbnailItem
Everything that has nothing to do with rendering the window thumbnail
goes into an AbstractThumbnailItem.

This is a preparation step for adding a DesktopThumbnailItem.
2013-04-24 11:43:22 +02:00
Martin Gräßlin 6351472d28 Add a client property to ThumbnailItem
Makes it a little bit easier to use a ThumbnailItem for a Client. E.g.
ThumbnailItem {
    client: model.client
}

instead of mapping the windowIds, which is rather uncomfty.
2013-04-08 10:30:45 +02:00
Martin Gräßlin 15b84c54f8 Support saturation/brightness in ThumbnailItem
Two new properties saturation and brightness are added to the
ThumbnailItem which can be set from QML.

The properties are honoured by the Scene when rendering the thumbnail.
2013-04-08 10:30:45 +02:00
Martin Gräßlin 5891133111 Connect ThumbnailItem to Compositor::compositingToggled
If a KWin script uses a ThumbnailItem which gets created before the
Compositor is fully initialized the thumbnail is not shown at all because
the connect to windowAdded etc. will never happen.

Therefore connect to Compositor::compositingToggled to re-connect
whenever the compositing state changes.

REVIEW: 109310
2013-03-12 09:28:16 +01:00
Martin Gräßlin 483ad7db66 Support specifying the parent window on which the thumbnail is shown
ThumbnailItem tries to find the window where it is embedded in
through a context propery containing the window id of the declarative
view. This works fine for e.g. TabBox but not for Plasma.Dialog as
that opens a new window.

REVIEW: 104394
2012-03-25 13:04:18 +02:00
Martin Gräßlin da76386fb0 Repaint Thumbnail Item on window damage
Allows to have live updates for thumbnails in tabbox.
BUG: 296066
FIXED-IN: 4.9.0
REVIEW: 104301
2012-03-22 06:48:42 +01:00
Martin Gräßlin fdc917d469 Fix QML thumbnail item by using correct signal 2012-03-12 21:37:40 +01:00
Martin Gräßlin b57ef77bf7 Adding a clip property to the ThumbnailItem
By default clip is enabled. This means that if the thumbnail would
overlap the "parent" window, it does not get rendered at all. If set
to false it will always be rendered. This is required for window strip
where the complete screen width is used, so overlap does not matter.
2011-11-29 07:15:32 +01:00
Martin Gräßlin f98593d3fb Window Thumbnail support for QML
A new QML item "ThumbnailItem" is registered to the TabBox. The
C++ implementation finds the EffectWindow of the TabBox and adds
itself to the EffectWindow.

While rendering the EffectWindow the information for all registered
ThumbnailItems are extracted and the thumbnail is rendered on top
of the EffectWindow.

This has obvious limitations like you cannot put other QML items
on top of the thumbnail. Nevertheless it works well enough to
be a possible replacement for e.g. BoxSwitch effect.

When compositing is disabled an icon is rendered instead of the
Thumbnail.

One TabBox Layout inspired by BoxSwitch Effect is added. For the
KCM small pre-rendered items are used.

REVIEW: 103039
2011-11-10 14:28:06 +01:00