Commit graph

592 commits

Author SHA1 Message Date
Vlad Zagorodniy
67b2746ecd Compute correct boundaries in checkWorkspacePosition
Summary:
When a client sets a strut, checkWorkspacePosition will be called to
bump clients that touch corresponding screen edge.

In order to do that, checkWorkspacePosition needs to calculate client
boundaries before and after the restricted move area was changed. As it
turns out, if the client reserves space "between" screens, calculated
boundaries can be incorrect, which may lead to some funky results, e.g.
shrunken clients.

For example, let's say that there is a dual-monitor setup. If a client
reserves some amount of space at the right border of the left screen,
then clients on the right monitor will have rightMax which is equal to
the x coordinate of screenArea.

To fix that, this change ensures that only restricted areas belonging
to the same screen as the client are taken into account when computing
the boundaries.

BUG: 404837
BUG: 406573

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20987
2019-05-15 11:07:14 +03:00
Vlad Zagorodniy
b37743d8b1 Delete noop code
Summary:
checkWorkspacePosition has a guard again desktop clients right at the
top, so the for loop is basically a no-op.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20777
2019-04-25 11:14:48 +03:00
Vlad Zagorodniy
32863aac9b Use AbstractClient::Position instead of Client::Position
Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20778
2019-04-24 02:26:56 +03:00
Vlad Zagorodniy
abe128818c Use more accurate name for Workspace::getMovingClient method
Summary:
The name of Workspace::getMovingClient() method implies that the
returned value is a client that is currently being moved around
by the user, but this is of course incorrect.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20663
2019-04-22 11:12:22 +03:00
Volker Krause
008143c9db Update URLs to use https
Summary: Largely done automatically using the tools from D19996.

Reviewers: yurchor, zzag

Reviewed By: yurchor, zzag

Subscribers: zzag, yurchor, kwin, kde-doc-english

Tags: #kwin, #documentation

Differential Revision: https://phabricator.kde.org/D20017
2019-03-25 19:26:23 +01:00
Vlad Zagorodniy
7b20e1f66f Overhaul doxygen comments
Summary:
We have a mix of different doxygen comment styles, e.g.

    /*!
      Foo bar.
     */

    /**
     * Foo bar.
     */

    /** Foo bar.
     */

    /**
     * Foo bar.
     */

    /**
     * Foo bar.
     **/

To make the code more consistent, this change updates the style of all
doxygen comments to the last one.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18683
2019-02-12 19:29:33 +02:00
Yuri Chornoivan
bf58da3e9a Fix minor EBN issues 2018-08-29 21:02:16 +03:00
Martin Flöser
aefa11f11a Block geometry updates on move resize finish and don't configure xdg shell surfaces while blocked
Summary:
We send out too many configure requests when finishing move resize which
also triggers quick tiling. This change addresses the problem of the too
many configure requests by making the configure method check whether
geometry updates are blocked. And to make this work properly for the end
of finish move resize the complete method is wrapped in a geometry
update blocker.

BUG: 388072
FIXED-IN: 5.12.1

Test Plan:
Quick tiling test passes, both Wayland and X11 windows are
quick tiled correctly.

Reviewers: #kwin, #plasma, jgrulich

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10156
2018-02-04 14:59:56 +01:00
Martin Flöser
8a2796d280 Fix regression from KWin 5.9 regarding quick tiling
Summary:
The regression got introduced with 9934f5b575.
The order when setMaximize(false, false) was called changed in regard to
when the quick tiling mode was adjusted. But just changing the ordering
back was no solution as that would cause regressions in other areas
(unit tests fail).

This change builds up on the support for geometry update blocker on
Wayland to be able to better support this situation without causing
further regressions.

Also this change rethinks the code area. There is an idea behind
temporarily setting the quick tile mode to none and that is even
documented in a comment: it should not confuse maximize. So let's do
exactly that: call the maximize in the block where the quick tile
mode is temporarily wrong. As that is only one branch the else branch
performs the same steps.

BUG: 376104
FIXED-IN: 5.12.0

Test Plan: Confirmation in bug report that patch fixes issue

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D9178
2017-12-04 17:25:40 +01:00
Martin Flöser
188491d392 Support user fullscreen for XdgShellSurfaces
Summary:
So far ShellClient did not support that the user can set a window to
fullscreen. This was omitted in the initial implementation as WlShell
doesn't support passing the state back to the surface.

With XdgShell this problem doesn't exist any more and we can implement
it. The implementation is mostly based on the one for Client and
adjusted for the Wayland world.

Test Plan:
New test cases and manual testing (send kate and kwrite to
fullscreen through alt+f3 menu)

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8169
2017-11-14 18:00:47 +01:00
Martin Flöser
d3eccada62 Implement Apply desktop rule for ShellClient
Summary:
This change sets up ShellClient for supporting window rules by reading
in the rules once it gets created. As a first rule the Apply initially
rule for desktop is implemented.

Currently it is not yet possible to set window rules through the
configuration menu. So far only injecting rules through the test
framework (temporary rules) is implemented. The idea is to first
implement all rules then to expose them to the UI.

Test Plan: New test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8177
2017-10-19 18:00:06 +02:00
Martin Gräßlin
1e13deaa1d Port some displayWidth/displayHeight usages to Screens::size()
Summary:
KWin::displayWidth and KWin::displayHeight are bound to X11 which
doesn't make much sense on X11. In addition KWin internally knows
the overall display dimensions through the Screens singleton class.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D1798
2017-09-01 17:11:10 +02:00
Martin Flöser
8794fe548a Guard every remaining access to rootInfo
Summary:
For a future XFree KWin. Only remaining not guarded usages are in
Workspace::init, but that one needs to be refactored anyway for
becoming X free.

Test Plan: Compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7173
2017-08-07 21:19:04 +02:00
Martin Flöser
64da6c8d1e Replace Workspace::slotWindowQuickTileFoo by a quickTileWindow with argument
Summary:
Thanks to std::bind we don't need that many different slots to setup the
global shortcut connections. Instead we can have one shared
implementation which takes the argument and passes it to the window.

To support std::bind arguments in kwinbindings the initShortcut method
and dependencies are adjusted as well as a new macro is added.

As I don't want to include abstract_client.h in workspace.h a new enum
is created for the quick tiling flags used in Workspace. This caused a
larger refactoring as the change to an enum class also caused quite some
changes.

Test Plan: Affected test cases still pass

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6783
2017-07-29 17:40:03 +02:00
Martin Flöser
8e2805ce9d Merge branch 'Plasma/5.10' 2017-07-17 16:53:08 +02:00
Martin Flöser
139b4dc82a Properly swap the quick tile side when pressing the shortcut again
Summary:
The quick tile shortcuts have a feature of moving the window to the next
screen if one presses the same shortcut again.
E.g. if a window is quick tiled to the left on the right most screen,
quick tile again to left should move it to the left screen and quick tile
right. Thus it swaps the borders.

This wasn't handled correctly, especially not for modes like top and
bottom. If a window is quick tiled to the top an impossible mode was
generated: Left | Right. Doesn't make sense.

This change fixes the mode swapping and extends our quick tile testing
to cover the situation.

BUG: 382313
FIXED-IN: 5.10.4

Test Plan: Extended test case

Reviewers: #plasma, #kwin

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6708
2017-07-17 16:51:31 +02:00
Martin Flöser
672cae9a7d Implement support for restricted move area on Wayland
Summary:
This change implements a missing TODO to generate the restricted move
area for windows with struts (aka panel) on Wayland.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6611
2017-07-11 17:52:01 +02:00
Martin Flöser
14c8440f11 Restrict move resize area only on the screen the strut window is on
Summary:
By allowing panels between screens in 5.8 to have a strut we created a
"regression" in KWin. KWin always was wrong, just we didn't notice as
neither Plasma nor previously Kicker set a strut on panels between shared
screen edges.

The strut is created from the edge of the overall screen setup. This
means a panel on the left edge of a screen on the right has the strut
starting from the left screen. KWin uses the strut to restrict the move
resize area: a window decoration is not allowed to go below a strut. Thus
it becomes impossible to move the window from the right to the left
screen.

This change tries to solve this problem by only restricting the move area
on the screen the window with the strut is on. E.g. if the window is on
the right screen, the left screen is not affected. Thus it's possible
again to move a window from one screen to the other as the added test
case shows.

Unfortunately there are still corner cases where this won't work
correctly. If the window is on both screens this won't work. It is also a
rather heavy change for KWin and thus it's targeted for master and not
for the 5.10 or the 5.8 branch. If we notice that the patch works well
and doesn't create further issues, it should be considered for
backporting.

BUG: 371199
CCBUG: 370510
FIXED-IN: 5.11

Test Plan: Added test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6562
2017-07-11 17:51:39 +02:00
Marco Martin
8190927eaf geometry shape changes also with no resize
Summary:
the morphingpopup effect was working with notifications only
in wayland. looking at what the codepath is, the signal
geometryShapeChanged was not emitted as it was checking for
resized, but it's supposed to come at every geometry
update, not only resizes

Test Plan:
notification with D6216 are correctly animated, other
animated things liketooltips are unaffected

Reviewers: #plasma, #kwin, graesslin, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6229
2017-06-15 19:08:19 +02:00
Kai Uwe Broulik
eaf41cb6c5 Animate quick tiling outline
When quick tiling animate the outline from the window geometry to the position it would have afterwards.
This provides a visual hint to from where to where the window will go.

Differential Revision: https://phabricator.kde.org/D5262
2017-04-25 16:38:52 +02:00
Martin Gräßlin
9934f5b575 Properly implement maximize of ShellClient
Summary:
This brings some more checks from Client to ShellClient. Thus the
states are better adjusted.

Unfortunately the X11 implementation is also slightly adjusted, so could
create regressions in worst case.

BUG: 368393

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3507
2016-11-29 12:35:59 +01:00
Martin Gräßlin
679e417808 Don't snap to auto-hidden panels
Summary:
When moving windows we don't want to snap against not visible windows
like auto-hidden panels.

BUG: 365892
FIXED-IN: 5.8.4

Test Plan: So far only auto-test, manual test will follow.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3225
2016-11-03 08:35:25 +01:00
Martin Gräßlin
996ee34e14 Remove the unredirect fullscreen windows functionality
Summary:
Rational: unredirect fullscreen windows is a weird beast. It's intended
to make fullscreen windows "faster" by not compositing that screen. But
that doesn't really work as KWin jumps out of that condition pretty
quickly. E.g. whenever a tooltip window is shown. KWin itself has a
better functionality by supporting to block compositing completely.
The complete code was full of hacks around it to try to ensure that
things don't break.

Overall unredirect fullscreen has always been the odd one. We had it
because a compositor needs to have it, but it never got truly integrated.
E.g. effects don't interact with it properly so that some things randomly
work, others don't. Will it trigger the screenedge, probably yes, but
will it show the highlight: properly no.

By removing the functionality we finally acknowledge that this mode is
not maintained and has not been maintained for years and that we do not
intend to support it better in future. Over the years we tried to make
it more and more hidden: it's disabled for Intel GPUs, because it used
to crash KWin. It's marked as an "expert" option, etc.

It's clearly something we tried to hide from the user that it exists.

For Wayland the whole unredirect infrastructure doesn't make sense
either. There is no such thing as "unredirecting". We might make use
of passing buffers directly to the underlying stack, but that will be
done automatically when we know it can be done, not by some magic is
this a window of specific size.

Test Plan:
Compiles, cannot really test as I am an Intel user who never
had that working.

Reviewers: #kwin, #plasma, #vdg

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2180
2016-08-04 14:48:35 +02:00
Bhushan Shah
3ec8e5ce75 Remove completely useless output
This was being repeated everytime a window is created/resized/closed.

Reviewed-by: Martin Gräßlin <mgraesslin@kde.org>
2016-06-29 11:56:18 +05:30
Martin Gräßlin
e5fe3137b8 Fix the ignore struts multi-screen handling
Summary:
The checks in Client::adjustedClientArea were a little bit too
agressive, excluding also valid setups.

This change addresses the regression by keeping the actual intended
improvements in place.

The check in Client::adjustedClientArea is now only done for the
special case of desktopArea == area. This ensures that a strut excluding
a complete screen won't affect the overall workarea.

In addition new checks are introduced in Workspace::updateClientArea.
When calculating the new sareas a check is performed whether the
intersection with the adjustedClientArea would result in the sarea
becoming empty (thus a screen being completely removed). If that's the
case the geometry is ignored to not exclude a complete screen.

Interestingly I should have noticed that something with the logic is
odd. As the test case had two commented geometries which we now get.

BUG: 363804

Reviewers: #plasma, apol, lbeltrame

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1744
2016-06-15 14:48:13 +02:00
Martin Gräßlin
58db477796 Fix the strut handling for wayland clients
Summary:
The implementation was broken as it transformed the QRects into QRegions,
subtracted the geometries and took the bounding rect again. In several
setups this could result in the strut getting ignored.

This change improves the calculation of the struts by creating a QMargin
which describes the area which needs to be subtracted from a screen rect.
The QMargin is only adjusted for the edge the window borders. We can
assume that a window with a strut needs to border a screen on Wayland.

With this change we are also able to support panels between screens.
On Wayland a panel placed on the right of a left screen affects the
maximization area of the left screen, but does not affect the overall
workarea.

CCBUG: 167852

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1803
2016-06-10 12:36:15 +02:00
Martin Gräßlin
bc25677caf Strut sanity checking: ignore struts which would exclude a complete screen
Summary:
Mostly meant for multi-screen setups: we don't want that a strut set on
a window on screen 0 results in screen 1 completely being excluded. Even
if that's strictly seen a client bug, it's better to just ignore the
strut from KWin's side.

The sanity check is implemented in Client::adjustedClientArea.

From a pure standard point of view this change is a EWMH violation and
thus can cause regressions: struts by clients no longer working.

A test case for struts is added, including some invalid combinations
whose strut is ignored with this change.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1386
2016-04-12 16:55:19 +02:00
Martin Gräßlin
7777f0c507 Invalidate double click timer when start move resize
A press, move, release, press cycle should not trigger the double
click action.
2016-03-11 12:47:17 +01:00
Thomas Lübking
9d09cf6dc9 respect motif and rules on unmaximizing
when restoring a borderless maximized, the window shall
not suddenly be decorated

BUG: 359797
FIXED-IN: 5.6
REVIEW: 127198
2016-02-29 09:48:59 +01:00
Martin Gräßlin
4c7450a1f6 Add nullptr check in AbstractClient::checkWorkspacePosition for workspace()
If a decorated ShellClient is still around after Workspace got destroyed
this method is still invoked and can lead to a crash. As we have a
workspace initing test there already it makes sense to combine it with
a workspace being down check.
2016-02-04 11:16:55 +01:00
Martin Gräßlin
ebe2989649 Move the KDecoration2::Decoration to AbstractClient
This includes the methods:
* decoration()
* decoration() const
* isDecorated() const

In addition new protected methods are added to destroy the Decoration
and to set it.

Usage of m_decoration in Client code is adjusted.
2015-12-18 16:41:49 +01:00
Thomas Lübking
fab806df92 avoid pointless kbd grab on moveresize
This makes (Qt5?) clients believe they lost input, ie. are no longer
active and change their visual representation.

REVIEW: 126266
2015-12-08 20:32:32 +01:00
Martin Gräßlin
f5848d9405 Move implementation of updateMoveResize to AbstractClient
No longer virtual.
2015-10-26 09:21:36 +01:00
Martin Gräßlin
f4b02d5a8c Move handleMoveResize to AbstractClient
Sync related code is split out into dedicated virtual methods so that
Client can provide the X11 specific implementation. General handling,
though is completely in AbstractClient.
2015-10-26 09:21:36 +01:00
Martin Gräßlin
7e23860957 Move performMoveResize to AbstractClient
As there is X11 specific code, this is moved into a virtual
doPerformMoveResize method.
2015-10-26 09:21:36 +01:00
Martin Gräßlin
c83f041005 Move startMoveResize() to AbstractClient
The implementation calls a virtual doStartMoveResize() which allows
Client to do it's X11 specific tasks (creating moveResizeWindow, grabbing
input).

The base implementation is no longer virtual.
2015-10-26 09:21:36 +01:00
Martin Gräßlin
9e323227a1 Move (start|stop)DelayedMoveResize to AbstractClient
Also requires to add startMoveResized() as a virtual method. Not
yet implemented in AbstractClient.
2015-10-26 09:21:36 +01:00
Martin Gräßlin
95a99d337a Move s_haveResizeEffect from Client to AbstractClient 2015-10-26 09:21:36 +01:00
Martin Gräßlin
ba53407b52 Move finishMoveResize(bool) to AbstractClient 2015-10-26 09:21:36 +01:00
Martin Gräßlin
1c40e809ea Provide leaveMoveResize() as virtual method in AbstractClient
The non X11 specific code is split out into a base implementation
which is called from the Client.
2015-10-26 09:21:36 +01:00
Martin Gräßlin
dc04cdef64 Move moveResizeStartScreen from Client to AbstractClient
Initialized in updateInitialMoveResizeGeometry().
2015-10-26 09:21:36 +01:00
Martin Gräßlin
dcb5e29316 Move updateCursor() functionality to AbstractClient
Includes moving the m_cursor and Qt::CursorShape cursor() method to
AbstractClient. In addition AbstractClient now emits a signal whenever
the shape changes allowing Client to react on it (update the low level
cursor) and also hopefully the Wayland Backends to react to it, so that
we have the cursor.
2015-10-26 09:21:36 +01:00
Martin Gräßlin
b8e68307bb Move buttonDown from Client to AbstractClient
Bundled together with other moveResize functionality. We might need
to investigate whether this variable is needed at all.
2015-10-26 09:21:36 +01:00
Martin Gräßlin
605acaf60e Move checkUnrestrictedMoveResize() from Client to AbstractClient 2015-10-26 09:21:36 +01:00
Martin Gräßlin
8a3be2bacd Move the Position mode from Client to AbstractClient 2015-10-26 09:21:36 +01:00
Martin Gräßlin
c3f14521c1 Move moveResizeGeom to AbstractClient
Biggest impact on Client::handleMoveResize which directly manipulated
the variable in various parts. I tried to keep the impact low.
2015-10-26 09:21:36 +01:00
Martin Gräßlin
b4fc4d7235 Move initialMoveResizeGeometry to AbstractClient 2015-10-26 09:21:36 +01:00
Martin Gräßlin
84c7575cbf Move (inverted)MoveOffset to AbstractClient 2015-10-26 09:21:36 +01:00
Martin Gräßlin
3514b4d691 Track whehter moveResize is unrestricted in AbstractClient 2015-10-26 09:21:36 +01:00
Martin Gräßlin
b5e8e3511e Track whether Client is in moveResizeMode in AbstractClient
Variable moveResizeMode replaced by protected methods isMoveResize()
and setMoveResize().
2015-10-26 09:21:36 +01:00