[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Border snap in kde-workspace-4.11.11-1
From: Thomas_Lübking <thomas.luebking () gmail ! com>
Date: 2015-01-25 11:21:48
Message-ID: 91548562-0c23-4010-b798-97e099273317 () gmail ! com
[Download RAW message or body]
This is a multipart/mixed message in MIME format.
On Samstag, 24. Januar 2015 21:34:49 CEST, Cristian Savu wrote:
> I'm sorry to take your time with this, but I need some help
> finding some places in the sources.
You're certainly not wasting time by asking for assistance.
The problem with that bug was that we kept repeating "it's not to save \
size" and "we can't move due to the freeze" over and over and over again \
and yet the very next comment would ignore that and make contradicting \
claims.
> But there is still one exception: All newly created windows go
> to the left or right desktop edges, and still lose the border on
> that side (the 3 pixels of border fall outside the desktop). As
> soon as I move them, they DO snap the way I want, but at the
> time of creation they DON'T.
>
> So I just want to ask you, where exactly in the sources do I
> have to go and change this last aspect too?
placement.cpp
If you obtain the code from git, revert commits \
6d256b2d149c68fd08888865b8a7fafdad397296 and \
cbfe71e15a11f7fcc9dc919274ef8c204b6b1a16 (latter is for packing, a seldom \
used feature)
Otherwise the relevant patches are attached (you need to "patch -R" to \
reverse-apply them)
Cheers,
Thomas
["0001-align-zero-corner-placement-to-client-not-deco.patch" (text/x-patch)]
From 6d256b2d149c68fd08888865b8a7fafdad397296 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas Lübking?= <thomas.luebking@gmail.com>
Date: Thu, 15 Aug 2013 11:53:02 +0200
Subject: [PATCH] align zero corner placement to client, not deco
BUG: 318107
FIXED-IN: 4.11.1
REVIEW: 112102
---
kwin/manage.cpp | 3 ++-
kwin/placement.cpp | 30 ++++++++++++++++++++++++++----
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/kwin/manage.cpp b/kwin/manage.cpp
index e4faec0..c4206d2d 100644
--- a/kwin/manage.cpp
+++ b/kwin/manage.cpp
@@ -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
diff --git a/kwin/placement.cpp b/kwin/placement.cpp
index 55fcb34..493ae15 100644
--- a/kwin/placement.cpp
+++ b/kwin/placement.cpp
@@ -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*/)
--
2.2.1
["0001-pack-to-client-not-deco.patch" (text/x-patch)]
From cbfe71e15a11f7fcc9dc919274ef8c204b6b1a16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas Lübking?= <thomas.luebking@gmail.com>
Date: Mon, 16 Sep 2013 16:26:21 +0200
Subject: [PATCH] pack to client, not deco
this makes packing following the snapping behavior
REVIEW: 112807
---
kwin/client.cpp | 2 +-
kwin/client.h | 2 +-
kwin/placement.cpp | 29 +++++++++++++++++++++++++++++
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/kwin/client.cpp b/kwin/client.cpp
index e8e20d5..4b88f22 100644
--- a/kwin/client.cpp
+++ b/kwin/client.cpp
@@ -2430,7 +2430,7 @@ QRect Client::decorationRect() const
}
}
-KDecorationDefines::Position Client::titlebarPosition()
+KDecorationDefines::Position Client::titlebarPosition() const
{
Position titlePos = PositionCenter; // PositionTop is returned by the \
default implementation
// this will hint errors in the \
metaobject usage ;-)
diff --git a/kwin/client.h b/kwin/client.h
index 40811f2..a2b3365 100644
--- a/kwin/client.h
+++ b/kwin/client.h
@@ -603,7 +603,7 @@ public:
bool decorationHasAlpha() const;
- Position titlebarPosition();
+ Position titlebarPosition() const;
enum CoordinateMode {
DecorationRelative, // Relative to the top left corner of the \
decoration
diff --git a/kwin/placement.cpp b/kwin/placement.cpp
index 493ae15..2f5f222 100644
--- a/kwin/placement.cpp
+++ b/kwin/placement.cpp
@@ -33,6 +33,7 @@ along with this program. If not, see \
<http://www.gnu.org/licenses/>. #include "client.h"
#include "options.h"
#include "rules.h"
+#include "screens.h"
#endif
namespace KWin
@@ -836,6 +837,13 @@ int Workspace::packPositionLeft(const Client* cl, int \
oldx, bool left_edge) cons if (oldx <= newx) // try another Xinerama \
screen newx = clientArea(MaximizeArea,
QPoint(cl->geometry().left() - 1, \
cl->geometry().center().y()), cl->desktop()).left(); + if \
(cl->titlebarPosition() != KDecorationDefines::PositionLeft) { + \
QRect geo = cl->geometry(); + int rgt = newx - cl->clientPos().x();
+ geo.moveRight(rgt);
+ if (screens()->intersecting(geo) < 2)
+ newx = rgt;
+ }
if (oldx <= newx)
return oldx;
for (ClientList::ConstIterator it = clients.constBegin(), end = \
clients.constEnd(); it != end; ++it) { @@ -856,6 +864,13 @@ int \
Workspace::packPositionRight(const Client* cl, int oldx, bool right_edge) \
co if (oldx >= newx) // try another Xinerama screen
newx = clientArea(MaximizeArea,
QPoint(cl->geometry().right() + 1, \
cl->geometry().center().y()), cl->desktop()).right(); + if \
(cl->titlebarPosition() != KDecorationDefines::PositionRight) { + \
QRect geo = cl->geometry(); + int rgt = newx + cl->width() - \
(cl->clientSize().width() + cl->clientPos().x()); + \
geo.moveRight(rgt); + if (screens()->intersecting(geo) < 2)
+ newx = rgt;
+ }
if (oldx >= newx)
return oldx;
for (ClientList::ConstIterator it = clients.constBegin(), end = \
clients.constEnd(); it != end; ++it) { @@ -876,6 +891,13 @@ int \
Workspace::packPositionUp(const Client* cl, int oldy, bool top_edge) const \
if (oldy <= newy) // try another Xinerama screen newy = \
clientArea(MaximizeArea,
QPoint(cl->geometry().center().x(), \
cl->geometry().top() - 1), cl->desktop()).top(); + if \
(cl->titlebarPosition() != KDecorationDefines::PositionTop) { + \
QRect geo = cl->geometry(); + int top = newy - cl->clientPos().y();
+ geo.moveTop(top);
+ if (screens()->intersecting(geo) < 2)
+ newy = top;
+ }
if (oldy <= newy)
return oldy;
for (ClientList::ConstIterator it = clients.constBegin(), end = \
clients.constEnd(); it != end; ++it) { @@ -896,6 +918,13 @@ int \
Workspace::packPositionDown(const Client* cl, int oldy, bool bottom_edge) \
co if (oldy >= newy) // try another Xinerama screen
newy = clientArea(MaximizeArea,
QPoint(cl->geometry().center().x(), \
cl->geometry().bottom() + 1), cl->desktop()).bottom(); + if \
(cl->titlebarPosition() != KDecorationDefines::PositionBottom) { + \
QRect geo = cl->geometry(); + int btm = newy + cl->height() - \
(cl->clientSize().height() + cl->clientPos().y()); + \
geo.moveBottom(btm); + if (screens()->intersecting(geo) < 2)
+ newy = btm;
+ }
if (oldy >= newy)
return oldy;
for (ClientList::ConstIterator it = clients.constBegin(), end = \
clients.constEnd(); it != end; ++it) {
--
2.2.1
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic