Merge branch 'KDE/4.9'

Conflicts:
	kwin/scene.cpp
	plasma/generic/applets/batterymonitor/metadata.desktop
	plasma/generic/applets/lock_logout/metadata.desktop
This commit is contained in:
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;
for (ClientList::ConstIterator it = group()->members().constBegin(),
end = group()->members().constEnd(); it != end; ++it)
if ((belongs_to_desktop == (*it)->isDesktop()))
if ((belongs_to_desktop = (*it)->isDesktop()))
break;
if (!belongs_to_desktop)

View file

@ -316,7 +316,6 @@ public:
QSize basicUnit() const;
virtual QPoint clientPos() const; // Inside of geometry()
virtual QSize clientSize() const;
virtual QRect visibleRect() const;
QPoint inputPos() const { return input_offset; } // Inside of geometry()
bool windowEvent(XEvent* e);
@ -1200,11 +1199,6 @@ inline QSize Client::clientSize() const
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)
{
setGeometry(r.x(), r.y(), r.width(), r.height(), force);

View file

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

View file

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

View file

@ -885,8 +885,10 @@ void Client::enterNotifyEvent(XCrossingEvent* e)
if (options->focusPolicy() == Options::ClickToFocus || workspace()->userActionsMenu()->isShown())
return;
QPoint currentPos(e->x_root, e->y_root);
if (options->isAutoRaise() && !isDesktop() &&
!isDock() && workspace()->focusChangeEnabled() &&
currentPos != workspace()->focusMousePosition() &&
workspace()->topClientOnDesktop(workspace()->currentDesktop(),
options->isSeparateScreenFocus() ? screen() : -1) != this) {
delete autoRaiseTimer;
@ -896,7 +898,6 @@ void Client::enterNotifyEvent(XCrossingEvent* e)
autoRaiseTimer->start(options->autoRaiseInterval());
}
QPoint currentPos(e->x_root, e->y_root);
if (isDesktop() || isDock())
return;
// 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);
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);
if (size.width() > thumb->width() || size.height() > thumb->height()) {
size = QSizeF(thumb->size());
if (size.width() > visualThumbRect.width() || size.height() > visualThumbRect.height()) {
size = QSizeF(visualThumbRect.size());
}
thumbData.setXScale(size.width() / static_cast<qreal>(thumb->width()));
thumbData.setYScale(size.height() / static_cast<qreal>(thumb->height()));
thumbData.setXScale(size.width() / static_cast<qreal>(visualThumbRect.width()));
thumbData.setYScale(size.height() / static_cast<qreal>(visualThumbRect.height()));
// it can happen in the init/closing phase of the tabbox
// that the corresponding QGraphicsScene is not available
if (item->scene() == 0) {
@ -400,10 +402,15 @@ void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quad
continue;
}
const QPoint point = viewPos + declview->mapFromScene(item->scenePos());
const qreal x = point.x() + w->x() + (item->width() - size.width())/2;
const qreal y = point.y() + w->y() + (item->height() - size.height()) / 2;
thumbData.setXTranslation(x - thumb->x());
thumbData.setYTranslation(y - thumb->y());
qreal x = point.x() + w->x() + (item->width() - size.width())/2;
qreal y = point.y() + w->y() + (item->height() - size.height()) / 2;
x -= thumb->x();
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;
if (thumbData.opacity() == 1.0) {
thumbMask |= PAINT_WINDOW_OPAQUE;

View file

@ -577,17 +577,34 @@ KWin::Scripting::Scripting(QObject *parent)
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
QFutureWatcher<LoadScriptList> *watcher = new QFutureWatcher<LoadScriptList>(this);
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();
QMap<QString,QString> pluginStates = KConfigGroup(_config, "Plugins").entryMap();
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;
foreach (const KService::Ptr & service, offers) {

View file

@ -322,7 +322,7 @@ private Q_SLOTS:
void slotScriptsQueried();
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);
finishCompositing();
workspace()->removeUnmanaged(this, Allowed);
if (!QWidget::find(window())) { // don't affect our own windows
if (Extensions::shapeAvailable())
XShapeSelectInput(display(), window(), NoEventMask);
XSelectInput(display(), window(), NoEventMask);
}
if (!on_shutdown) {
workspace()->removeUnmanaged(this, Allowed);
addWorkspaceRepaint(del->visibleRect());
disownDataPassedToDeleted();
del->unrefWindow();