Merge branch 'KDE/4.9'

Conflicts:
	kwin/scene.cpp
	plasma/generic/applets/batterymonitor/metadata.desktop
	plasma/generic/applets/lock_logout/metadata.desktop
icc-effect-5.14.5
Thomas Lübking 2012-09-19 20:21:18 +02:00
commit 24cf0e75f3
9 changed files with 57 additions and 32 deletions

View File

@ -1228,7 +1228,7 @@ void Client::resetShowingDesktop(bool keep_hidden)
bool belongs_to_desktop = false; bool belongs_to_desktop = false;
for (ClientList::ConstIterator it = group()->members().constBegin(), for (ClientList::ConstIterator it = group()->members().constBegin(),
end = group()->members().constEnd(); it != end; ++it) end = group()->members().constEnd(); it != end; ++it)
if ((belongs_to_desktop == (*it)->isDesktop())) if ((belongs_to_desktop = (*it)->isDesktop()))
break; break;
if (!belongs_to_desktop) if (!belongs_to_desktop)

View File

@ -316,7 +316,6 @@ public:
QSize basicUnit() const; QSize basicUnit() const;
virtual QPoint clientPos() const; // Inside of geometry() virtual QPoint clientPos() const; // Inside of geometry()
virtual QSize clientSize() const; virtual QSize clientSize() const;
virtual QRect visibleRect() const;
QPoint inputPos() const { return input_offset; } // Inside of geometry() QPoint inputPos() const { return input_offset; } // Inside of geometry()
bool windowEvent(XEvent* e); bool windowEvent(XEvent* e);
@ -1200,11 +1199,6 @@ inline QSize Client::clientSize() const
return client_size; return client_size;
} }
inline QRect Client::visibleRect() const
{
return Toplevel::visibleRect().adjusted(-padding_left, -padding_top, padding_right, padding_bottom);
}
inline void Client::setGeometry(const QRect& r, ForceGeometry_t force) inline void Client::setGeometry(const QRect& r, ForceGeometry_t force)
{ {
setGeometry(r.x(), r.y(), r.width(), r.height(), force); setGeometry(r.x(), r.y(), r.width(), r.height(), force);

View File

@ -379,7 +379,7 @@ void DesktopGridEffect::slotWindowAdded(EffectWindow* w)
if (!activated) if (!activated)
return; return;
if (isUsingPresentWindows()) { if (isUsingPresentWindows()) {
if (w->isDesktop() || w->isDock() || !w->isCurrentTab()) if (!isRelevantWithPresentWindows(w))
return; // don't add return; // don't add
if (w->isOnAllDesktops()) { if (w->isOnAllDesktops()) {
for (int i = 0; i < effects->numberOfDesktops(); i++) { for (int i = 0; i < effects->numberOfDesktops(); i++) {
@ -1101,8 +1101,7 @@ void DesktopGridEffect::setup()
for (int j = 0; j < effects->numScreens(); j++) { for (int j = 0; j < effects->numScreens(); j++) {
WindowMotionManager manager; WindowMotionManager manager;
foreach (EffectWindow * w, effects->stackingOrder()) { foreach (EffectWindow * w, effects->stackingOrder()) {
if (w->isOnDesktop(i) && w->screen() == j && !w->isDesktop() && !w->isDock() && if (w->isOnDesktop(i) && w->screen() == j &&isRelevantWithPresentWindows(w)) {
w->isCurrentTab() && !w->isSkipSwitcher() && w->isOnCurrentActivity()) {
manager.manage(w); manager.manage(w);
} }
} }
@ -1313,12 +1312,11 @@ void DesktopGridEffect::desktopsAdded(int old)
} }
if (isUsingPresentWindows()) { if (isUsingPresentWindows()) {
for (int i = old; i <= effects->numberOfDesktops(); i++) { for (int i = old+1; i <= effects->numberOfDesktops(); ++i) {
for (int j = 0; j < effects->numScreens(); j++) { for (int j = 0; j < effects->numScreens(); ++j) {
WindowMotionManager manager; WindowMotionManager manager;
foreach (EffectWindow * w, effects->stackingOrder()) { foreach (EffectWindow * w, effects->stackingOrder()) {
if (w->isOnDesktop(i) && w->screen() == j && !w->isDesktop() && !w->isDock() && if (w->isOnDesktop(i) && w->screen() == j &&isRelevantWithPresentWindows(w)) {
w->isCurrentTab()) {
manager.manage(w); manager.manage(w);
} }
} }
@ -1356,8 +1354,9 @@ void DesktopGridEffect::desktopsRemoved(int old)
for (int j = 0; j < effects->numScreens(); ++j) { for (int j = 0; j < effects->numScreens(); ++j) {
WindowMotionManager& manager = m_managers[(desktop-1)*(effects->numScreens())+j ]; WindowMotionManager& manager = m_managers[(desktop-1)*(effects->numScreens())+j ];
foreach (EffectWindow * w, effects->stackingOrder()) { foreach (EffectWindow * w, effects->stackingOrder()) {
if (!manager.isManaging(w) && w->isOnDesktop(desktop) && w->screen() == j && if (manager.isManaging(w))
!w->isDesktop() && !w->isDock() && w->isCurrentTab()) { continue;
if (w->isOnDesktop(desktop) && w->screen() == j && isRelevantWithPresentWindows(w)) {
manager.manage(w); manager.manage(w);
} }
} }
@ -1376,6 +1375,12 @@ bool DesktopGridEffect::isActive() const
return timeline.currentValue() != 0 || activated || (isUsingPresentWindows() && isMotionManagerMovingWindows()); return timeline.currentValue() != 0 || activated || (isUsingPresentWindows() && isMotionManagerMovingWindows());
} }
bool DesktopGridEffect::isRelevantWithPresentWindows(EffectWindow *w) const
{
return !(w->isDesktop() || w->isDock() || w->isSkipSwitcher()) &&
w->isCurrentTab() && w->isOnCurrentActivity();
}
/************************************************ /************************************************
* DesktopButtonView * DesktopButtonView
************************************************/ ************************************************/

View File

@ -134,6 +134,7 @@ private:
void setupGrid(); void setupGrid();
void finish(); void finish();
bool isMotionManagerMovingWindows() const; bool isMotionManagerMovingWindows() const;
bool isRelevantWithPresentWindows(EffectWindow *w) const;
bool isUsingPresentWindows() const; bool isUsingPresentWindows() const;
QRectF moveGeometryToDesktop(int desktop) const; QRectF moveGeometryToDesktop(int desktop) const;
void desktopsAdded(int old); void desktopsAdded(int old);

View File

@ -885,8 +885,10 @@ void Client::enterNotifyEvent(XCrossingEvent* e)
if (options->focusPolicy() == Options::ClickToFocus || workspace()->userActionsMenu()->isShown()) if (options->focusPolicy() == Options::ClickToFocus || workspace()->userActionsMenu()->isShown())
return; return;
QPoint currentPos(e->x_root, e->y_root);
if (options->isAutoRaise() && !isDesktop() && if (options->isAutoRaise() && !isDesktop() &&
!isDock() && workspace()->focusChangeEnabled() && !isDock() && workspace()->focusChangeEnabled() &&
currentPos != workspace()->focusMousePosition() &&
workspace()->topClientOnDesktop(workspace()->currentDesktop(), workspace()->topClientOnDesktop(workspace()->currentDesktop(),
options->isSeparateScreenFocus() ? screen() : -1) != this) { options->isSeparateScreenFocus() ? screen() : -1) != this) {
delete autoRaiseTimer; delete autoRaiseTimer;
@ -896,7 +898,6 @@ void Client::enterNotifyEvent(XCrossingEvent* e)
autoRaiseTimer->start(options->autoRaiseInterval()); autoRaiseTimer->start(options->autoRaiseInterval());
} }
QPoint currentPos(e->x_root, e->y_root);
if (isDesktop() || isDock()) if (isDesktop() || isDock())
return; return;
// for FocusFollowsMouse, change focus only if the mouse has actually been moved, not if the focus // for FocusFollowsMouse, change focus only if the mouse has actually been moved, not if the focus

View File

@ -358,13 +358,15 @@ void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quad
WindowPaintData thumbData(thumb); WindowPaintData thumbData(thumb);
thumbData.setOpacity(data.opacity()); thumbData.setOpacity(data.opacity());
QSizeF size = QSizeF(thumb->size()); const QRect visualThumbRect(thumb->expandedGeometry());
QSizeF size = QSizeF(visualThumbRect.size());
size.scale(QSizeF(item->width(), item->height()), Qt::KeepAspectRatio); size.scale(QSizeF(item->width(), item->height()), Qt::KeepAspectRatio);
if (size.width() > thumb->width() || size.height() > thumb->height()) { if (size.width() > visualThumbRect.width() || size.height() > visualThumbRect.height()) {
size = QSizeF(thumb->size()); size = QSizeF(visualThumbRect.size());
} }
thumbData.setXScale(size.width() / static_cast<qreal>(thumb->width())); thumbData.setXScale(size.width() / static_cast<qreal>(visualThumbRect.width()));
thumbData.setYScale(size.height() / static_cast<qreal>(thumb->height())); thumbData.setYScale(size.height() / static_cast<qreal>(visualThumbRect.height()));
// it can happen in the init/closing phase of the tabbox // it can happen in the init/closing phase of the tabbox
// that the corresponding QGraphicsScene is not available // that the corresponding QGraphicsScene is not available
if (item->scene() == 0) { if (item->scene() == 0) {
@ -400,10 +402,15 @@ void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quad
continue; continue;
} }
const QPoint point = viewPos + declview->mapFromScene(item->scenePos()); const QPoint point = viewPos + declview->mapFromScene(item->scenePos());
const qreal x = point.x() + w->x() + (item->width() - size.width())/2; qreal x = point.x() + w->x() + (item->width() - size.width())/2;
const qreal y = point.y() + w->y() + (item->height() - size.height()) / 2; qreal y = point.y() + w->y() + (item->height() - size.height()) / 2;
thumbData.setXTranslation(x - thumb->x()); x -= thumb->x();
thumbData.setYTranslation(y - thumb->y()); y -= thumb->y();
// compensate shadow topleft padding
thumbData.xTranslate += (thumb->x()-visualThumbRect.x())*thumbData.xScale();
thumbData.yTranslate += (thumb->y()-visualThumbRect.y())*thumbData.yScale();
thumbData.setXTranslation(x);
thumbData.setYTranslation(y);
int thumbMask = PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_LANCZOS; int thumbMask = PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_LANCZOS;
if (thumbData.opacity() == 1.0) { if (thumbData.opacity() == 1.0) {
thumbMask |= PAINT_WINDOW_OPAQUE; thumbMask |= PAINT_WINDOW_OPAQUE;

View File

@ -577,17 +577,34 @@ KWin::Scripting::Scripting(QObject *parent)
void KWin::Scripting::start() void KWin::Scripting::start()
{ {
#if 0
// TODO make this threaded again once KConfigGroup is sufficiently thread safe, bug #305361 and friends
// perform querying for the services in a thread // perform querying for the services in a thread
QFutureWatcher<LoadScriptList> *watcher = new QFutureWatcher<LoadScriptList>(this); QFutureWatcher<LoadScriptList> *watcher = new QFutureWatcher<LoadScriptList>(this);
connect(watcher, SIGNAL(finished()), this, SLOT(slotScriptsQueried())); connect(watcher, SIGNAL(finished()), this, SLOT(slotScriptsQueried()));
watcher->setFuture(QtConcurrent::run(this, &KWin::Scripting::queryScriptsToLoad, pluginStates, offers));
#else
LoadScriptList scriptsToLoad = queryScriptsToLoad();
for (LoadScriptList::const_iterator it = scriptsToLoad.constBegin();
it != scriptsToLoad.constEnd();
++it) {
if (it->first) {
loadScript(it->second.first, it->second.second);
} else {
loadDeclarativeScript(it->second.first, it->second.second);
}
}
runScripts();
#endif
}
LoadScriptList KWin::Scripting::queryScriptsToLoad()
{
KSharedConfig::Ptr _config = KGlobal::config(); KSharedConfig::Ptr _config = KGlobal::config();
QMap<QString,QString> pluginStates = KConfigGroup(_config, "Plugins").entryMap(); QMap<QString,QString> pluginStates = KConfigGroup(_config, "Plugins").entryMap();
KService::List offers = KServiceTypeTrader::self()->query("KWin/Script"); KService::List offers = KServiceTypeTrader::self()->query("KWin/Script");
watcher->setFuture(QtConcurrent::run(this, &KWin::Scripting::queryScriptsToLoad, pluginStates, offers));
}
LoadScriptList KWin::Scripting::queryScriptsToLoad(QMap<QString,QString> &pluginStates, KService::List &offers)
{
LoadScriptList scriptsToLoad; LoadScriptList scriptsToLoad;
foreach (const KService::Ptr & service, offers) { foreach (const KService::Ptr & service, offers) {

View File

@ -322,7 +322,7 @@ private Q_SLOTS:
void slotScriptsQueried(); void slotScriptsQueried();
private: private:
LoadScriptList queryScriptsToLoad(QMap<QString,QString> &pluginStates, KService::List &); LoadScriptList queryScriptsToLoad();
}; };
} }

View File

@ -88,13 +88,13 @@ void Unmanaged::release(bool on_shutdown)
} }
emit windowClosed(this, del); emit windowClosed(this, del);
finishCompositing(); finishCompositing();
workspace()->removeUnmanaged(this, Allowed);
if (!QWidget::find(window())) { // don't affect our own windows if (!QWidget::find(window())) { // don't affect our own windows
if (Extensions::shapeAvailable()) if (Extensions::shapeAvailable())
XShapeSelectInput(display(), window(), NoEventMask); XShapeSelectInput(display(), window(), NoEventMask);
XSelectInput(display(), window(), NoEventMask); XSelectInput(display(), window(), NoEventMask);
} }
if (!on_shutdown) { if (!on_shutdown) {
workspace()->removeUnmanaged(this, Allowed);
addWorkspaceRepaint(del->visibleRect()); addWorkspaceRepaint(del->visibleRect());
disownDataPassedToDeleted(); disownDataPassedToDeleted();
del->unrefWindow(); del->unrefWindow();