Commit graph

108 commits

Author SHA1 Message Date
David Edmundson
7014a33992 [wayland] Handle sizes in ShellClient::transientPlacement
Summary:
placeIn did not handle the case for a popup not having had the size
already set and only being available via
m_xdgShellPopup->initialSize(). This is needed if we want to call placeIn
at the correct time, before the window is mapped.

There was also a logic bug when sliding popups. We called the
confusingly named setX thinking it would be move the popup keeping the
width the same. In practice it moves the left edge keeping the right
position the same. This wasn't an issue as the size was
discarded.

Handling the resize constraint is not yet done, but it should now be
even more trivial.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18956
2019-02-22 14:08:47 +00: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
Martin Flöser
792d840455 Honor struts when placing Wayland transients
Summary:
So far transients were placed anywhere on the screen. This behavior was
inspired from X11 where context menus were able to overlap any other
window and use the complete screen area. On X11 context menus and
similar windows are override redirect and thus above all windows managed
by KWin.

On Wayland, though, context menus and similar and windows just like any
other window and thus follow stacking constraints like the parent
window. A context menu is stacked just above it's parent and is
(normally) below any panels. This resulted in problems that context menu
are stacked behind the panel with unreachable options.

This change changes the placement for transients to use the
PlacementArea instead of a screen geometry. Thus the transient does not
render behind the panel. Only in case of a fullscreen the struts are
ignored.

BUG: 389222
FIXED-IN: 5.15

Test Plan: New test case

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17826
2018-12-31 07:58:50 +01:00
David Edmundson
bdf348c603 [wayland] Set better placement for XDG Toplevels
Summary:
XDG Popups will have a transient parent and positional information.
XDG Toplevels can have a transient parent without having positional
information.

Currently we set that we have a transient placement hint of 0,0 which
means the newly opened children go to the top left of the parent.

This new code paths treat child top levels as dialogs centering them to
the parent.

BUG: 393167

Test Plan:
Dolphin help->about
Appeared where it does on X

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16293
2018-10-23 12:37:10 +01:00
David Edmundson
8ef363cc21 [wayland] XdgPopup Positioning
Summary:
Support XDGShell Positioning. This gives a client a lot more control
over where the popup will be placed as well as control over how to
handle constraints. i.e what to do if the popup doesn't fit.

trasientOffset was replaced with a method on the client as semantically
it's the role of the client to handle constraints.

Both slide and flip constraint adjustments are implemented. Resize
constraint adjustment will be handled in a future patch.

WlShell is handled by treating it as 1x1 sized anchor with slide
constraint adjustment.

Test Plan:
Manual test of a client implementing xdgpopup exists in kwayland
Extensive unit test here

Existing WlShell test passes (after D16314 which fixes the original)
XdgPopup has a new unit test suite against manually calculated values

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16325
2018-10-20 17:17:59 +01:00
David Edmundson
d70c3568e6 [wayland] Fix Placement::placeTransient keeping screens in bound.
Summary:
If a window flows off the left, we move left of the popup to the left
edge of the screen.

Currently if a window flows off the right, we move the window back by
it's own width, leaving it floating at a random point.
For consistency we should be setting it so the right edge of the popup is on the right
edge of the screen.

So in the auto test for the "right border" case:
The screen is 1280 wide, and we open a 10px popup at 1279  the final X
should be 1270.

Test Plan: Unit test

Reviewers: #kwin, zzag, graesslin

Reviewed By: #kwin, zzag, graesslin

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16314
2018-10-20 17:17:58 +01: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
92207be904 Use AbstractClient instead of Client in placement
Summary:
There were a few places where we still used Client instead of
AbstractClient. By changing this the placement also works for
Wayland windows in those cases.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6274
2017-06-20 07:11:41 +02:00
Martin Gräßlin
c8b3f71cc6 Fix typo 2016-03-03 17:01:52 +01:00
Martin Gräßlin
04fdecdd59 Implement sanity checks when placing transients
A transient window should always be visible on the current screen.
This change ensures that a transient is always placed in a way that
the transient window is visible on the screen ignoring the transient
offset hint if it has to be.

Unfortunately QtWayland doesn't set the transient hint correctly:
a sub menu is a transient to the main window and not to the parent
menu resulting in quite off positioned menus, see:
https://bugreports.qt.io/browse/QTBUG-51640
2016-03-03 15:57:55 +01:00
Martin Gräßlin
fa774230f3 Fix transient placement for decorated parents
Need to add client pos to the transient's position. The offset is
relative to the parent surface, but the client doesn't know about the
size of the decoration, thus KWin needs to add it.
2016-03-03 15:57:55 +01:00
Martin Gräßlin
f1215e44d4 Move implementation of (shrow|grow)(Horizontal|Vertical) to AbstractClient
Methods are no longer virtual. The only x11 specific usage in these
methods (resizeInc) is replaced by a virtual method. Default resize
increments is QSize(1,1) for AbstractClient.
2015-10-26 15:49:03 +01:00
Martin Gräßlin
45fb1680fc Consider all client in Workspace::packPositionFoo
We need to use m_allClients (AbstractClient) instead of clients (just
Client). Thus packing against another AbstractClient works.
2015-10-26 13:25:47 +01:00
Martin Gräßlin
b19da3cb14 Move implementation of Client::packTo to AbstractClient
Method no longer virtual and only implemented in AbstractClient.
The implementaton works in a generic way nowadyas.

Added an autotest for the basic packTo behavior for packing against
a screen border. Packing towards other clients still needs adjustments
in the Placement code.
2015-10-26 11:30:34 +01:00
Martin Gräßlin
1d242d9daf Move mainClients() and allMainClients from Client to AbstractClient
AbstractClient::mainClients is virtual and overriden in Client,
allMainClients has only a common implementation in AbstractClient.

In activation.cpp we still need one case where a temporary ClientList
needs to be constructed. Once transients are fully migrated that should
be removable again.
2015-09-16 13:54:47 +02:00
Martin Gräßlin
a86a7e7b3c Add a placement strategy for transient ShellClients
A transient ShellClient has an offset position to the parent surface.
Use this to position the ShellClient properly.

This fixes the random placement of menus.
2015-09-16 13:52:25 +02:00
Martin Gräßlin
1a89fc55b5 Placement fully operates on AbstractClient
Remaining methods had to be adjusted in one go as they called back
into place method.
2015-05-27 14:20:12 +02:00
Martin Gräßlin
ffd6f9ceba Placement::placeUnderMouse operates on AbstractClient 2015-05-27 14:20:12 +02:00
Martin Gräßlin
670787086b Placement::placeOnScreenDisplay operates on AbstractClient 2015-05-27 10:36:59 +02:00
Martin Gräßlin
aaca122902 Placement::placeAtRandom operates on AbstractClient 2015-05-27 10:34:15 +02:00
Martin Gräßlin
4d077c42b6 Placement::placeSmart operates on AbstractClient 2015-05-27 10:32:42 +02:00
Martin Gräßlin
a261b1c253 Placement::placeCentered operates on AbstractClient 2015-05-27 10:28:23 +02:00
Martin Gräßlin
b971749f1d Placement::placeZeroCornered operates on AbstractClient 2015-05-27 10:25:04 +02:00
Martin Gräßlin
78700e23fd Placement::checkArea operates on AbstractClient 2015-05-27 10:22:43 +02:00
Martin Gräßlin
683fc0613f Workspace::packPosition* operates on AbstractClient 2015-05-08 12:43:46 +02:00
Martin Gräßlin
7a85ee5309 Make helper method isIrrelevant operate on AbstractClient 2015-05-08 12:43:46 +02:00
Martin Gräßlin
bfa4e1cec1 Workspace::cascadeOffset operates on AbstractClient 2015-05-08 12:43:45 +02:00
Mika Allan Rauhala
2217c1038f Add Quick Tile Window to the Top and Bottom shortcuts
This adds "Quick Tile Window to the Top" and "Quick Title Window to the Bottom" shortcuts. These are
useful for those using displays that are in portrait orientation.

CCBUG: 310005
REVIEW: 123153
2015-03-31 11:10:13 +02:00
Thomas Lübking
93fb58aa88 Merge branch 'Plasma/5.2' 2015-02-06 00:29:55 +01:00
Thomas Lübking
ff700a8db5 fix e3768b4355
accidentally picked the patch from the wrong branch
just about comments
2015-02-06 00:27:31 +01:00
Thomas Lübking
956941bc95 correctly handle virtual desktop on packing
copy approach from smart placement

REVIEW: 122417
2015-02-05 21:37:34 +01:00
Thomas Lübking
f496a91e59 updateFocusMousePosition() before some actions
in particular artificial geometry updates that should not
update the focus and are prone to a static cursor

BUG: 343319
REVIEW: 122299
FIXED-IN: 5.2.1
2015-02-05 21:37:33 +01:00
Thomas Lübking
fa1368cb9e correctly handle virtual desktop on packing
copy approach from smart placement

REVIEW: 122417
2015-02-05 17:14:23 +01:00
Thomas Lübking
e3768b4355 updateFocusMousePosition() before some actions
in particular artificial geometry updates that should not
update the focus and are prone to a static cursor

BUG: 343319
REVIEW: 122299
FIXED-IN: 5.2.1
2015-02-05 17:05:34 +01:00
Martin Gräßlin
2076e458d3 Use Xcb::GeometryHints instead of XGetWMNormalHints
Xcb::GeometryHints is a convenient wrapper around the size hints
as described in ICCCM combined with the sanity checks so far applied
by KWin after reading the property.

Instead of accessing the members of the property structure, we are
now using the convenience methods.

During ::manage no further actions are triggered when reading the
size hints. Only when they are read later on the previous checks
are applied. During ::manage they can be ignored as it had a dedicated
isManaged check.

The method ::resizeWithCheck got a new argument of type xcb_gravity_t
which defaults to 0. This is needed from ::configureRequest which so
far temporarily changed the xSizeHints structure. By passing as an
argument this is no longer needed.

REVIEW: 122185
2015-01-27 12:48:03 +01:00
Kai Uwe Broulik
2153174dc0 Add OnScreenDisplayLayer which is placed even ontop of the active fullscreen window
It is to be used for volume change feedback and similar confirmation popups

REVIEW: 121300
2015-01-02 12:11:54 +01:00
Martin Gräßlin
3d9a035312 Move MaximizeMode from KDecorationDefines to utils.h
Unfortunately it cannot be a enum defined in Client as client.h
depends on rules.h and with it in Client rules.h would depend on
client.h.
2014-12-02 13:49:08 +01:00
Martin Gräßlin
50019b4a31 Drop kdecoration.h include from placement.cpp 2014-12-02 11:48:51 +01:00
Martin Gräßlin
fa4332754c Move Position from KDecorationDefines to Client 2014-12-02 11:15:54 +01:00
Martin Gräßlin
e38d56b0dd Move QuickTileMode from KDecorationDefines to Client 2014-12-02 10:52:16 +01:00
Martin Gräßlin
9075b5e2d6 [kwin] Remove cursorPos() from utils.h
Only delegated to Cursor::pos() anyway, so let's just use that directly.
Fixes the annoyances of having to mock it in the unit tests which include
utils.cpp.

REVIEW: 116900
2014-03-25 15:25:40 +01:00
Martin Klapetek
404fc2144c [kwin] Make KWin place the OSD
REVIEW: 115334
2014-02-12 10:53:10 +01:00
Thomas Lübking
26febda4a0 Merge branch 'KDE/4.11'
Conflicts:
	ksmserver/screenlocker/greeter/greeterapp.cpp
	ksmserver/screenlocker/greeter/greeterapp.h
	ksmserver/screenlocker/greeter/themes/org.kde.passworddialog/contents/ui/main.qml
	kwin/libkwineffects/kwineffects.cpp
	kwin/useractions.cpp
	plasma/desktop/applets/window-list/metadata.desktop
	plasma/desktop/containments/panel/plasma-containment-panel.desktop
	plasma/desktop/toolboxes/plasma-toolbox-paneltoolbox.desktop
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
2013-11-24 15:35:17 +01:00
Thomas Lübking
6e56dcd60a remove false noop breaking branches
BUG: 328007
FIXED-IN: 4.11.4
2013-11-24 14:21:35 +01:00
Thomas Lübking
3594550b14 Merge branch 'KDE/4.11'
Conflicts:
	kwin/eglonxbackend.cpp
	kwin/glxbackend.cpp
2013-09-25 23:21:36 +02:00
Thomas Lübking
06b482f725 pack to client, not deco
this makes packing following the snapping behavior

REVIEW: 112807
2013-09-25 23:09:08 +02:00
Martin Gräßlin
969e6b85e7 Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/client.cpp
	kwin/effects/highlightwindow/highlightwindow.cpp
	kwin/libkwineffects/kwingltexture.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/scene_opengl.cpp
	kwin/workspace.cpp
	plasma/desktop/applets/kickoff/CMakeLists.txt
	plasma/desktop/applets/taskmanager/package/contents/code/tools.js
	plasma/desktop/applets/taskmanager/package/contents/ui/Task.qml
	plasma/desktop/applets/taskmanager/package/contents/ui/main.qml
	plasma/desktop/applets/taskmanager/package/metadata.desktop
	plasma/desktop/applets/taskmanager/plugin/textlabel.h
	plasma/desktop/applets/tasks/CMakeLists.txt
	plasma/desktop/applets/tasks/package/metadata.desktop
	plasma/desktop/applets/tasks/tasks.cpp
	plasma/desktop/toolboxes/plasma-toolbox-desktoptoolbox.desktop
	plasma/generic/applets/activitybar/activitybar.cpp
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-09-24 11:28:38 +02:00
Thomas Lübking
7d6d80351c align zero corner placement to client, not deco
BUG: 318107
FIXED-IN: 4.11.1
REVIEW: 112102
2013-08-27 07:53:02 +02:00
Martin Gräßlin
9291b18cee Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/effects.cpp
	kwin/effects/logout/logout.cpp
	kwin/effects/presentwindows/main.qml
	kwin/effects/presentwindows/presentwindows.cpp
	kwin/effects/presentwindows/presentwindows.h
	kwin/effects/zoom/zoom_config.cpp
	kwin/libkwineffects/kwinglutils_funcs.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/nvidiahack.cpp
	kwin/xcbutils.h
	plasma/desktop/containments/desktop/plasma-containment-desktop.desktop
	plasma/generic/wallpapers/image/image.cpp
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-08-07 10:10:06 +02:00
Thomas Lübking
f4827fbac9 update packing logics to honor activities and tabs
at the same time using MaximizeArea instead MoveArea

ratio:
movearea allows to pack windows under panels and while
one can expect users of packing to know alt+lmb, we usually
do not allow to loose the titlebar

Moreover this relies on packing against dock windows what
fails with "virtual" struts as input shaping panels
(eg. cairo-dock?) might use (ie. we we would also have packed
against plasma panel shadows - back then ;-)

BUG: 180084
REVIEW: 111603
FIXED-IN: 4.11
2013-08-02 22:00:45 +02:00