Merge branch 'KDE/4.11'

This commit is contained in:
Thomas Lübking 2013-08-27 08:11:11 +02:00
commit 5f1d913a11
10 changed files with 74 additions and 11 deletions

View file

@ -122,6 +122,7 @@ CubeEffect::CubeEffect()
connect(effects, SIGNAL(tabBoxAdded(int)), this, SLOT(slotTabBoxAdded(int)));
connect(effects, SIGNAL(tabBoxClosed()), this, SLOT(slotTabBoxClosed()));
connect(effects, SIGNAL(tabBoxUpdated()), this, SLOT(slotTabBoxUpdated()));
connect(effects, SIGNAL(screenGeometryChanged(const QSize&)), this, SLOT(slotResetShaders()));
reconfigure(ReconfigureAll);
}
@ -290,6 +291,14 @@ void CubeEffect::slotWallPaperLoaded()
watcher->deleteLater();
}
void CubeEffect::slotResetShaders()
{
ShaderManager::instance()->resetShader(m_capShader, ShaderManager::GenericShader);
ShaderManager::instance()->resetShader(m_reflectionShader, ShaderManager::GenericShader);
ShaderManager::instance()->resetShader(cylinderShader, ShaderManager::GenericShader);
ShaderManager::instance()->resetShader(sphereShader, ShaderManager::GenericShader);
}
bool CubeEffect::loadShader()
{
if (!(GLPlatform::instance()->supports(GLSL) &&

View file

@ -139,6 +139,7 @@ private slots:
void slotTabBoxClosed();
void slotCubeCapLoaded();
void slotWallPaperLoaded();
void slotResetShaders();
private:
enum RotationDirection {
Left,

View file

@ -383,13 +383,16 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
{
QSize borderSnapZone(options->borderSnapZone(), options->borderSnapZone());
QRect maxRect;
int guideMaximized = MaximizeRestore;
if (c->maximizeMode() != MaximizeRestore) {
maxRect = clientArea(MovementArea, pos + c->rect().center(), c->desktop());
QRect geo = c->geometry();
if (c->maximizeMode() & MaximizeHorizontal && (geo.x() == maxRect.left() || geo.right() == maxRect.right())) {
guideMaximized |= MaximizeHorizontal;
borderSnapZone.setWidth(qMax(borderSnapZone.width() + 2, maxRect.width() / 16));
}
if (c->maximizeMode() & MaximizeVertical && (geo.y() == maxRect.top() || geo.bottom() == maxRect.bottom())) {
guideMaximized |= MaximizeVertical;
borderSnapZone.setHeight(qMax(borderSnapZone.height() + 2, maxRect.height() / 16));
}
}
@ -478,7 +481,8 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
lrx = lx + (*l)->width();
lry = ly + (*l)->height();
if (((cy <= lry) && (cy >= ly)) || ((ry >= ly) && (ry <= lry)) || ((cy <= ly) && (ry >= lry))) {
if (!(guideMaximized & MaximizeHorizontal) &&
(((cy <= lry) && (cy >= ly)) || ((ry >= ly) && (ry <= lry)) || ((cy <= ly) && (ry >= lry)))) {
if ((sOWO ? (cx < lrx) : true) && (qAbs(lrx - cx) < snap) && (qAbs(lrx - cx) < deltaX)) {
deltaX = qAbs(lrx - cx);
nx = lrx;
@ -489,7 +493,8 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
}
}
if (((cx <= lrx) && (cx >= lx)) || ((rx >= lx) && (rx <= lrx)) || ((cx <= lx) && (rx >= lrx))) {
if (!(guideMaximized & MaximizeVertical) &&
(((cx <= lrx) && (cx >= lx)) || ((rx >= lx) && (rx <= lrx)) || ((cx <= lx) && (rx >= lrx)))) {
if ((sOWO ? (cy < lry) : true) && (qAbs(lry - cy) < snap) && (qAbs(lry - cy) < deltaY)) {
deltaY = qAbs(lry - cy);
ny = lry;
@ -502,7 +507,7 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
}
// Corner snapping
if (nx == lrx || nx + cw == lx) {
if (!(guideMaximized & MaximizeVertical) && (nx == lrx || nx + cw == lx)) {
if ((sOWO ? (ry > lry) : true) && (qAbs(lry - ry) < snap) && (qAbs(lry - ry) < deltaY)) {
deltaY = qAbs(lry - ry);
ny = lry - ch;
@ -512,7 +517,7 @@ QPoint Workspace::adjustClientPosition(Client* c, QPoint pos, bool unrestricted,
ny = ly;
}
}
if (ny == lry || ny + ch == ly) {
if (!(guideMaximized & MaximizeHorizontal) && (ny == lry || ny + ch == ly)) {
if ((sOWO ? (rx > lrx) : true) && (qAbs(lrx - rx) < snap) && (qAbs(lrx - rx) < deltaX)) {
deltaX = qAbs(lrx - rx);
nx = lrx - cw;

View file

@ -54,6 +54,7 @@ KWinScreenEdgesConfig::KWinScreenEdgesConfig(QWidget* parent, const QVariantList
connect(m_ui->monitor, SIGNAL(changed()), this, SLOT(changed()));
connect(m_ui->desktopSwitchCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_ui->activationDelaySpin, SIGNAL(valueChanged(int)), this, SLOT(sanitizeCooldown()));
connect(m_ui->activationDelaySpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->triggerCooldownSpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->quickMaximizeBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
@ -66,6 +67,8 @@ KWinScreenEdgesConfig::KWinScreenEdgesConfig(QWidget* parent, const QVariantList
connect(m_ui->quickTileBox, SIGNAL(stateChanged(int)), this, SLOT(groupChanged()));
load();
sanitizeCooldown();
}
KWinScreenEdgesConfig::~KWinScreenEdgesConfig()
@ -147,6 +150,11 @@ void KWinScreenEdgesConfig::showEvent(QShowEvent* e)
monitorShowEvent();
}
void KWinScreenEdgesConfig::sanitizeCooldown()
{
m_ui->triggerCooldownSpin->setMinimum(m_ui->activationDelaySpin->value() + 50);
}
// Copied from kcmkwin/kwincompositing/main.cpp
bool KWinScreenEdgesConfig::effectEnabled(const QString& effect, const KConfigGroup& cfg) const
{

View file

@ -56,7 +56,8 @@ public slots:
virtual void defaults();
protected:
virtual void showEvent(QShowEvent* e);
private slots:
void sanitizeCooldown();
private:
KWinScreenEdgesConfigForm* m_ui;
KSharedConfigPtr m_config;

View file

@ -787,6 +787,16 @@ void ShaderManager::resetAllShaders()
}
}
void ShaderManager::resetShader(GLShader *shader, ShaderType type)
{
if (!(shader && shader->isValid()))
return;
pushShader(shader);
resetShader(type);
popShader();
}
void ShaderManager::pushShader(GLShader *shader)
{

View file

@ -352,6 +352,12 @@ public:
**/
void resetAllShaders();
/**
* Resets ShaderType @p type uniforms of a custom shader
* @since 4.11.1
*/
void resetShader(GLShader *shader, ShaderType type);
/**
* Creates a GLShader with a built-in vertex shader and a custom fragment shader.
* @param vertex The generic vertex shader

View file

@ -377,6 +377,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
if (!placementDone) {
// Placement needs to be after setting size
Placement::self()->place(this, area);
dontKeepInArea = true;
placementDone = true;
}
@ -419,7 +420,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
if (pseudo_max != Client::MaximizeRestore) {
maximize((MaximizeMode)pseudo_max);
// from now on, care about maxmode, since the maximization call will override mode for fix aspects
dontKeepInArea = (max_mode == Client::MaximizeFull);
dontKeepInArea |= (max_mode == Client::MaximizeFull);
geom_restore = QRect(); // Use placement when unmaximizing ...
if (!(max_mode & Client::MaximizeVertical)) {
geom_restore.setY(y()); // ...but only for horizontal direction

View file

@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QTextStream>
#ifndef KCMRULES
#include <kdecoration.h>
#include "workspace.h"
#include "client.h"
#include "options.h"
@ -96,6 +97,30 @@ void Placement::place(Client* c, QRect& area, Policy policy, Policy nextPlacemen
placeMaximizing(c, area, nextPlacement);
else
placeSmart(c, area, nextPlacement);
if (options->borderSnapZone()) {
// snap to titlebar / snap to window borders on inner screen edges
const QRect geo(c->geometry());
QPoint corner = geo.topLeft();
const QPoint cp = c->clientPos();
const QSize cs = geo.size() - c->clientSize();
KDecorationDefines::Position titlePos = c->titlebarPosition();
const QRect fullRect = workspace()->clientArea(FullArea, c);
if (!(c->maximizeMode() & KDecorationDefines::MaximizeHorizontal)) {
if (titlePos != KDecorationDefines::PositionRight && geo.right() == fullRect.right())
corner.rx() += cs.width() - cp.x();
if (titlePos != KDecorationDefines::PositionLeft && geo.x() == fullRect.x())
corner.rx() -= cp.x();
}
if (!(c->maximizeMode() & KDecorationDefines::MaximizeVertical)) {
if (titlePos != KDecorationDefines::PositionBottom && geo.bottom() == fullRect.bottom())
corner.ry() += cs.height() - cp.y();
if (titlePos != KDecorationDefines::PositionTop && geo.y() == fullRect.y())
corner.ry() -= cp.y();
}
c->move(corner);
}
}
/*!
@ -442,10 +467,7 @@ void Placement::placeCentered(Client* c, const QRect& area, Policy /*next*/)
void Placement::placeZeroCornered(Client* c, const QRect& area, Policy /*next*/)
{
// get the maximum allowed windows space and desk's origin
const QRect maxRect = checkArea(c, area);
// place the window
c->move(QPoint(maxRect.left(), maxRect.top()));
c->move(checkArea(c, area).topLeft());
}
void Placement::placeUtility(Client* c, QRect& area, Policy /*next*/)

View file

@ -591,7 +591,7 @@ void ScreenEdges::reconfigure()
// TODO: migrate settings to a group ScreenEdges
KConfigGroup windowsConfig = m_config->group("Windows");
setTimeThreshold(windowsConfig.readEntry("ElectricBorderDelay", 150));
setReActivationThreshold(windowsConfig.readEntry("ElectricBorderCooldown", 350));
setReActivationThreshold(qMax(timeThreshold() + 50, windowsConfig.readEntry("ElectricBorderCooldown", 350)));
int desktopSwitching = windowsConfig.readEntry("ElectricBorders", static_cast<int>(ElectricDisabled));
if (desktopSwitching == ElectricDisabled) {
setDesktopSwitching(false);