Commit Graph

244 Commits (master)

Author SHA1 Message Date
Vlad Zagorodniy 684b4b635e Use more traditional doxygen style
Summary:
So far we were following a bit unique and rare doxygen comment style:

    /**
     * Contents of the comment.
     **/

Doxygen comments with this style look balanced and neat, but many people
that contribute to KWin don't follow this style. Instead, they prefer
more traditional doxygen comment style, i.e.

    /**
     * Contents of the comment.
     */

Reviewing such changes has been a bit frustrating for me (so selfish!)
and for other contributors.

This change switches doxygen comment style in KWin to a more traditional
style. The main reason for doing this is to make code review process easier
for new contributors as well us.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22812
2019-07-29 22:06:19 +03:00
Vlad Zagorodniy 8af2fa73dc Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.

The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.

Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.

A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!

The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.

The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, apol, romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 20:03:22 +03:00
Vlad Zagorodniy 18844f5925 [wayland] Apply window rules only to xdg-shell clients
Summary:
There are rules that have to be applied only once, e.g. every Remember
and Apply Initially rule, as well rules that need to configure the client,
e.g. size, etc. In the best scenario the compositor would evaluate such
rules when the client is about to be mapped.

This change limits window rules only to xdg-shell clients because right
now only this protocol lets compositors to intervene in the client
initialization process. Also, it makes things a bit easier for us on the
compositor side.

xdg-shell protocol satisfies most of ours requirements to implement window
rules, but not all of them. If the client is about to be mapped for the
second time and its size is forced by a rule, then compositor may need
to configure it. Currently, xdg-shell protocol doesn't have any mechanism
that a client could use to notify the compositor about its intent to map.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: fmonteiro, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19411
2019-07-09 15:13:49 +03:00
Roman Gilg 787c22ec4c Split up fullscreen able check into AbstractClient subclasses
Summary:
Most parts of this function are only relevant for X clients, in particular
the "fullscreen hack". Therefore split up the function into the AbstractClient
subclasses.

Test Plan: Manually and autotests still pass.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: graesslin, zzag, kwin

Tags: #kwin

Maniphest Tasks: T11098

Differential Revision: https://phabricator.kde.org/D18128
2019-07-06 16:00:32 +02:00
Vlad Zagorodniy 3608fb52dd Pedantic whitespace additions 2019-07-03 19:56:36 +03:00
Vlad Zagorodniy 01ff92d16c Add more details about default implementation of isInternal() 2019-07-03 19:44:37 +03:00
Vlad Zagorodniy 81cdfd2ebf Keep internal clients in the unmanaged layer
Summary:
All internal clients live in the x stacking order, but when such a
client is closed, it will be moved to the normal stacking order.

Given that internal clients don't specify the desired layer, they will
be moved to the normal layer, which is not really what we want because
it means that the task switcher window will be placed below docks.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D21116
2019-05-17 11:45:19 +03:00
David Strobach 1d4a9d24f8 Expose AbstractClient::setMaximize to scripting
Summary: Fixes BUG: 403071

Reviewers: graesslin, davidedmundson

Reviewed By: graesslin, davidedmundson

Subscribers: davidedmundson, zzag, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20044
2019-03-26 09:38:21 +01: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
Marco Martin 6bc2ddd56a virtualkeyboard: resize the focused window to make room for the keyboard
Summary:
alternative approach: try to resize the winidow to make room for the keyboard.
the new input wayland protocol doesn't have anymore the overlap rectangle (and it would not be going to work with qwidget apps anyways)

in the future will probably be needed anextension to the input protocol v3 which partially gets back this, tough window resizing is needed regardless

what's missing: the resize should be "temporary" and the window should be restored to its previous geometry when the keyboard closes

Test Plan: tested with test QML code

Reviewers: #plasma, #kwin, bshah, graesslin, romangg, davidedmundson

Reviewed By: #plasma, #kwin, romangg, davidedmundson

Subscribers: nicolasfella, mart, kwin, davidedmundson, graesslin

Tags: #kwin

Maniphest Tasks: T9815

Differential Revision: https://phabricator.kde.org/D18818
2019-03-20 11:05:06 +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
David Edmundson e0071910f2 Fix DesktopGrid drag on X11
Summary:
EffectsAPI explicitly says:
"On X11, the window will end up on the last window in the list" and
DesktopGrid reliaed on that.

Using the last makes sense as it means the
enterDesktop method will work for both.

Somehow in the refactors AbstractClient ended up doing the opposite.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18339
2019-01-17 23:43:11 +00:00
Yuri Chornoivan d08950feea Fix minor Doxygen issues 2019-01-13 09:22:11 +02:00
Yuri Chornoivan d17a3ff88f Fix minor Doxygen issues 2019-01-12 12:31:32 +02:00
Martin Flöser 2799f69533 Move groupTransient and group from Client to AbstractClient as virtual
Summary:
The default implementations just return false/nullptr. The advantage of
having this in AbstractClient is that we can reduce the needed casts
from AbstractClient to Client in core as can be seen in this change.

There are more cases which can be improved thanks to this refactoring
which will follow in dedicated commits.

Test Plan: ctest passes

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17890
2019-01-12 07:35:18 +01:00
Yuri Chornoivan 9dbb74afb7 Fix minor Doxygen issues 2019-01-11 15:36:22 +02:00
Vlad Zagorodniy a0fe38c9b3 [wayland] Send only clients that were on the removed desktop to a new desktop
Summary:
Currently, if a virtual desktop was removed, then we'll try to send all
clients to the last virtual desktop even though most of those clients
weren't present on the removed virtual desktop.

Test Plan: Manually.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17576
2018-12-14 14:22:30 +02:00
David Edmundson f521d4bbe1 [wayland] add enter/leave virtual desktop API
Summary:
As setDesktop was changed to "move" this left unSetDesktop non-symetric.

This replaces it with explicit API to enter/leave.

This also moves new API to the new object based API rather than still
using ints.

Where numbers are used it has been tidied up so that desktop IDs are
uint, which should be used when we have a list of desktops.
int is used only when we have either a desktop ID or NET::OnAllDesktops
(-1)

Effects API cleared up to use this and use a set of x11 IDs, which
avoids any potential complications of handling add and removes any
ambiguity with what happens if you leave all desktops and such.

Test Plan:
testVirtualDesktops passes (with pending kwayland patch)
Moving a window in the desktop grid on X11 behaves
Moving a window in the desktop grid on wayland behaves

Reviewers: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16704
2018-11-14 11:08:46 +00:00
David Edmundson 2fb2fb9a44 [wayland] add explict AbstractClient::setDesktops(QList)
Summary:
Currently setDesktop and unsetDesktop were out of sync, with the latter
missing several important signals and updating of transients.

By using a a shared implementation we avoid that, it also allows for an
atomic move of a window between desktops.

setDesktop is changed back to be a moval of desktop as it currently
broke several unit tests as well as changing the behaviour of the move
to desktop shortcut on wayland.

Test Plan:
testBindings now passes
Moved windows with the context menu on X11

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16703
2018-11-13 16:07:40 +00:00
David Edmundson 62d334eb61 [wayland] Move AbstractClient::desktops from QList to QVector
Summary:
Doesn't have any meaningful impact. It's the same performance when T is a pointer,
but it'll bring it consistent with VirtualDesktopManager::desktops

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16736
2018-11-07 16:22:59 +00:00
David Edmundson 7e8facc3fd [wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)

Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)

Test Plan: used a bit a plasma session together with D12820, D13748 and D13746

Reviewers: #plasma, #kwin, graesslin, davidedmundson

Reviewed By: #plasma, #kwin, davidedmundson

Subscribers: hein, zzag, davidedmundson, kwin

Tags: #kwin

Maniphest Tasks: T4457

Differential Revision: https://phabricator.kde.org/D13887
2018-11-01 16:35:29 +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 2d3431aede Expose AbstractClient's colorScheme as a property
Summary:
This exposes colorScheme as a property which is then usable by kwin
scripts.
Wanted by T9769.

Test Plan:
Michail to test in a script.

Reviewers: #kwin, zzag, graesslin

Reviewed By: #kwin, zzag, graesslin

Subscribers: mvourlakos, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15913
2018-10-08 09:35:56 +01:00
David Edmundson 29a49f8656 [wayland] Use pending maximize mode in decoration updates
Summary:
The change to make maximize mode asynchronous featured the comment

>Things are a bit complex with borders. Technically we
>shouldn't update them till we get a response, but we also need to have
>the correct geometry of the full size window in our request. For now
>they behave as before, updating when we request the change.

We call setNoBorder when we request the geometry but decoratedClient
also checks the maximise mode, in order to follow the scheme above we
need this to operate on the requested state not current state.

X is unaffected.

This fixes the borders being restored correct after maximize/restore.

Test Plan:
Chose a theme with visible borders
Maximised a window and back
They restored

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15991
2018-10-07 17:52:34 +01:00
David Edmundson 5b4eb80c8f Set specific edge cursor shape when resizing
Summary:
Instead of seeing the cursor <--> on the left edge you now see an icon
that looks like |<-  .

This brings kwin decorations in line with GTK CSD icons.

In theory this is also useful to tell which window will resize in the
case of side-by-side windows (regardless of whether borders are on or
not). In practice with the adwaita icon theme I tested with it's not
very intuitive to realise which is which till you learn the icon.

Change is more involved than it should be as Qt::CursorShape doesn't
have these entries, and I don't want to shadow that enum internally or
have
to change kwin effect code.

Specifics depend on cursor icon theme if they are not present it will
fallback to the <--> icon. (Breeze does not have them currently)

Test Plan:
Resized some windows (on X and on Wayland)
Correct icon appeared on Adwaita
Existing icon appeared on Breeze

Reviewers: #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13396
2018-06-11 10:05:07 +01:00
Scott Harvey 393af855c4 Revert "Revert "Add "SkipSwitcher" to API""
This reverts commit 5ef119044d.
2018-05-23 23:33:39 -05:00
Martin Flöser 46d8b87646 Move TabGroup functionality from Client to AbstractClient
Only setClientShown remains in Client. This might need a dedicated
implementation for ShellClient.
2018-05-20 19:50:35 +02:00
Martin Flöser 7defd93047 Port TabGroup from Client to AbstractClient
First step towards a return of window tabbing.
2018-05-20 19:50:29 +02:00
Luca Beltrame 5ef119044d
Revert "Add "SkipSwitcher" to API"
This reverts commit 8a2a00a4ca.

It was likely wrongly pushed before the KWayland changes, so it won't
compile.

Feel free to reinstate it once the dependent changes (KWayland) are in.

CCMAIL: bundito@gmail.com
CCMAIL: kwin@kde.org
2018-04-28 09:26:51 +02:00
Scott Harvey 8a2a00a4ca Add "SkipSwitcher" to API
Summary:
Adding "SkipSwitcher" to the API, following discussion in
BUG 375921

Depends on / related to D11925 and D11924

Reviewers: hein, #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: davidedmundson, #plasma, ngraham, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D11926
2018-04-27 09:43:13 -05:00
Martin Flöser d61eaa2d66 Add a new desktopfile name rule
Summary:
This allows to override the desktop file name.

CCBUG: 351055

Test Plan: Created a window rule for telegram-desktop to fix the icon

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D11266
2018-03-18 09:15:15 +01:00
Martin Flöser b7ad4bcf88 Keep fullscreen windows in active layer based on transients not the group
Summary:
So far a not-active fullscreen X11 window was kept in the active layer if
the newly activated window is in the same group (that is same client
leader). For example a fullscreen X11 kwrite window is in the active layer
if another kwrite window is active. The two kwrite windows obviously
don't have anything to do with each other, but are in the same group.

This creates problems as it's not possible to raise other windows above
the active not-fullscreen kwrite window. E.g. the panel is stacked below.

The idea behind the check makes sense: if a fullscreen window opens
another window (e.g. a configuration dialog) it should not be put back
to normal layer. Thus the check is adjusted whether the new active
window is a transient to the fullscreen window. Thus the intention is
still the same, but does not cause the problems.

As the code now does not need to differentiate between X11 and Wayland
windows (group only on X11) the Client specific implementation is
removed and the method unvirtual'ed.

BUG: 388310
FIXED-IN: 5.12.0

Test Plan: Test passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9699
2018-01-10 17:44:00 +01:00
Martin Flöser f0f4e494fe Merge branch 'Plasma/5.11' 2017-11-16 20:34:52 +01:00
Martin Flöser 1ae7990a95 Allow a cross-process check for same applications
Summary:
Commit 5d9027b110 introduced a regression in TabBox by using the generic
framework inside KWin to test for same application. What I did not
consider was that the code in TabBox was "broken by design". It didn't
use the generic check as that is too strict and considers windows from
different processes as not belonging to the same application. But this
is not wanted in the case of TabBox.

On the other hand the change itself is an improvement to also support
Wayland in a better way and not have special handling situations. Thus
just reverting would not help.

Instead this change addresses the problem by extending the internal API
and to allow more adjustements. So far there was already an
"active_hack" boolean flag. This is extended to proper flags with an
additional flag to allow cross application checks.

The checks in Client which would filter out different applications check
for this flag and are skipped if set. In addition ShellClient also adds
support for this flag and compares for the desktop file name.

Thus we get in TabBox the same behavior as before with the advantage of
having a better shared code base working on both X11 and Wayland.

BUG: 386043
FIXED-IN: 5.11.4

Test Plan:
Started two kwrite processes on X11, clicked new in one of them,
used Alt+` and verified that there are three windows shown.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8661
2017-11-16 20:33:54 +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 9a965405e3 Support updating deco for changes of borderless maximize windows config
Summary: So far only updated the Clients, now also ShellClient.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8095
2017-11-14 17:51:54 +01:00
Martin Flöser afe0a5c041 Fix placement of KSplash
Summary:
In a bug report there was a reference that on multi-screen KSplash is
not placed correctly. I investigated and noticed that it is an OSD which
sets an own position. In KWin the events were processed correctly but
the position was off.

The problem is that KWin has code to correct the position of an OSD when
it's size changes. This happens also on first damage and then the window
gets incorrectly placed when the position is set. So honor that the
position is set.

Test Plan: Restarted the session, ksplash positioned correctly now.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8268
2017-10-15 16:41:31 +02:00
Martin Flöser 0372fdaf92 Move WindowRules from Client to AbstractClient
Summary:
So far window rule specific functionality was only implemented in Client
and in ShellClient there was only a dummy implementation. This change
moves the client_rules member variable from Client to AbstractClient.
Areas which would not compile anymore are adjusted.

This is a first step to get window rule support for Wayland windows.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8090
2017-10-07 07:42:41 +02:00
Martin Flöser f0652970f4 Drop boolean parameter from AbstractClient::caption
Summary:
With the latest refactoring AbstractClient::captionNormal is the same as
AbstractClient::caption(false) used to be. As there were only two usages
of the false parameter, let's remove this boolean trap and use proper
API calls.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7427
2017-09-01 17:03:50 +02:00
Martin Flöser a7b29e09ce Make AbstractClient::caption no longer a virtual method
Summary:
The implementation can now be shared, it doesn't differ anymore between
X11 (Client) and Wayland (ShellClient). So instead of code duplication a
shared implementation in AbstractClient.

Test Plan: X11 and ShellClient tests still pass

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7426
2017-09-01 17:03:06 +02:00
Martin Flöser 6685288d48 Add <number> to Wayland captions if the caption is the same
Summary:
Bringing another caption feature from X11 to Wayland. If we have
multiple windows with the same caption, starting from the second window
a suffix <number> is added.

E.g. if we have three windows with caption "foo", the naming is:
 * foo
 * foo <2>
 * foo <3>

The change tries to use as much shared code between the X11 and Wayland
implementation. Unfortunately it's not possible to share completely as
the X11 implementation does X11 specific things like editing the visible
name.

By sharing the code the numbering also works cross windowing system.
That is if a window is called "foo" on X11, a new window on Wayland with
caption "foo" will get adjusted to "foo <2>" and vice versa.

The change also eliminates a duplicated signal for captionChanged in
ShellClient (found by test case).

By using the shared implementation on X11 side a bug gets fixed which
got introduced with the support of "unresponsive", this is no longer
considered and the numbering still works even if there is a window which
is unresponsive.

Test Plan: New test case and manual testing

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7425
2017-09-01 17:02:36 +02:00
Martin Flöser bbca8c6677 Implement the shortcut caption suffix for Wayland windows
Summary:
The generation of the shortcut caption part is moved from Client to
AbstractClient. The ShellClient also has a captionSuffix and implements
the full part in caption.

Overall this needs more refactoring to support more sharing between the
two implementations. But one step at a time.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7093
2017-08-12 11:31:33 +02:00
Martin Flöser afd52c188a Drop the stripped parameter from AbstractClient::caption
Summary:
The parameter is not used anywhere in KWin. Only the default value was
used. So let's drop this.

Test Plan: Compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7059
2017-08-02 17:09:49 +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 c29d6093ba Implement support for window shortcuts for Wayland windows
Summary:
Moves most of the implementation from Client to AbstractClient, so that
it can be used for both Client and ShellClient. Only the X11 specific
code is kept in Client.

Not yet implemented is updating the window caption.

Unfortunately the testing of this feature showed that setting a window
shortcut is not working on Wayland at all (the Qt widget doesn't properly
catch the shortcut). So this feature is currently only of erm theoretical
use.

Test Plan: Added new test case. No testing in real world as explained.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6818
2017-07-25 07:12:42 +02:00
Kai Uwe Broulik 1eb950a985 Desaturate non-responsive windows
When an application is not responding, its window is desaturated to communicate this.
Also "(Not Responding)" is added to the title bar.

Differential Revision: https://phabricator.kde.org/D5245
2017-04-05 11:16:23 +02:00
Kai Uwe Broulik 93938d60b8 Restore global menu support
This brings back global menu support in KWin.
The DBusMenu infrastructure is different that we just read the DBus service name and
menu object path from the windows rather than passing around window IDs on DBus which
won't work on Wayland.

Differential Revision: https://phabricator.kde.org/D3089
2017-01-11 10:21:03 +01:00
Martin Gräßlin 6bee7f4aac KillWindow support for Wayland windows
Summary:
AbstractClient gains a new pure virtual killWindow method and this gets
implemented in ShellClient.

ShellClient performs the killing by sending a term signal to the
process. This can only work if the client connected through the socket
and didn't get a socketpair fd passed. In that case the pid is KWin's
and KWin doesn't want to terminate. Thus this is special handled to
destroy the connection instead.

In case terminating the process has no effect, the connection gets
destroyed after five seconds.

The KillWindow is adjusted to operate on AbstractClient instead of
Client.

This implements T4463.

Test Plan: Killed windows and auto test

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3370
2016-11-17 14:06:42 +01:00
Martin Gräßlin b7bd5f9a09 Add support for desktopFileName provided by NETWinInfo
Summary:
KWindowSystem provides a KDE specific property for the desktop file
name. This allows KWin to take the icon from the desktop file. The
advantage from the desktop file is that KWin normally gets higher
resolution icons than provided through the xproperty based icons used
previously. If the desktop file does not provide an icon name, KWin
falls back to the previous implementation.

As on Wayland the icon is taken from the desktop file name already the
code for X11 and Wayland is merged in AbstractClient. Also to the
PlasmaWindowInterface the appId is taken from the new desktop file
instead of the resourceName. Due to that for Xwayland windows where KWin
knows the desktop file name it can be passed to PlasmaWindowInterface.
This allows e.g. the task manager to better map the windows to
applications and provide better icons. Also it means that icons do not
need to be passed as bitmap data to the clients.

Test Plan:
Verified that icon is taking from desktop file if provided and
from X property if not provided and that Wayland windows still have icon.

Reviewers: #kwin, #plasma_on_wayland, hein

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3177
2016-10-31 13:19:46 +01:00
Martin Gräßlin 03d706150a Support docks which take input
Summary:
On X11 one needs to force activate a panel to pass it focus. This change
implements something similar for Wayland but a little bit more stateful
by using a request on the PlasmaShellSurface. If set KWin will activate
the panel.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3037
2016-10-18 08:18:46 +02:00
Martin Gräßlin dd3c6d6cc2 Implement show on screen edge for Wayland
Summary:
This change ports ScreenEdges to operate on AbstractClient instead of
Client. For this AbstractClient gained a new pure virtual method
showOnScreenEdge which is also implemented in ShellClient.

In ShellClient the functionality is bound for the case windows can
cover a panel. If triggered the panel gets raised again.

The auto hiding panel, though, is not yet implemented. For that the
protocol needs to be adjusted to give a hint to the compositor when to
hide and hint back to the panel when it was shown. This needs a change
in KWayland and thus is not 5.8 material.

Test Plan: See added test case

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2793
2016-10-05 07:51:47 +02:00
Martin Gräßlin fb59b05488 Add support for resize only borders on Wayland
Summary:
This change adds support for resizing outside the window decoration
(e.g. setting borders to NoSide or None).

To support this a new Toplevel::inputGeometry() -> QRect method is
added which exposes the geometry adjusted by the margins provided by
the decoration. This is checked in InputRedirection when finding a
Toplevel at a given position. The logic for figuring out whether the
event should go to the decoration or the window already handled the
situation correctly, so no further changes are needed.

BUG: 364607
FIXED-IN: 5.8.1

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2787
2016-10-05 07:49:23 +02:00
Martin Gräßlin 42e82f09be Move Q_PROPERTY definitions from Client to AbstractClient
The properties:
 * maximizable
 * moveable
 * moveableAcrossScreens
 * resizeable

Were only defined on Client instead of AbstractClient. This resulted
in the EffectWindow having those properties evaluate always to false
for a ShellClient and breaking some effects.

BUG: 355947
2016-08-29 07:53:26 +02:00
Martin Gräßlin 455c5c07a0 Move implementation of iconGeometry from ShellClient to AbstractClient
Summary:
This allows Client to use the Wayland-specific implementation if there
is no icon geometry set through the X11 way. That way Xwayland windows
have an icon geometry even if Plasma is using Wayland and setting the
icon geometry in the Wayland way. Which is expected as Plasma is
ignorant about the windowing system a PlasmaWindow uses.

In order to move the code from ShellClient to AbstractClient
WaylandServer gained a new findAbstractClient(Surface*) method which
is just like findClient(Surface*) with the difference that it returns
an AbstractClient instead of a ShellClient*.

Test Plan:
minimized/unminimized an X client on Wayland, verified
animation is correct (though broken in general for minimize)

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2530
2016-08-24 13:11:32 +02:00
Martin Gräßlin a35ffa93d7 Use hiddenInternal() for a ShellClient which got unmapped
Summary:
So far when a ShellClient got unmapped ready_for_painting was set to
false. That is the ShellClient was treated in the same way as a not
yet shown window. It was completely excluded from painting, a close
animation impossible.

This change makes use of the functionality available in
Client::hiddenInternal(). The window is considered as hidden, thus
still excluded from e.g. getting input events, but could be rendered
any time as we still have a previous window pixmap (if referenced).
This allows to have it considered in the rendering pass, but effects
still cannot make use of it as that state is not yet exposed to the
effects.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2083
2016-07-13 10:45:10 +02:00
Martin Gräßlin 14d12c0585 Do not limit mouse actions to titleBarArea but allow on complete titleBarPosition
Summary:
Mouse actions like wheel and double click were restricted to the titleBar
area. This made the top most pixel non-interactive as it's not part of the
titleBarArea.

This change makes the complete titlebarPosition interactive. That is it
includes for a "normal" (top) setup also the TopLeft/Top/Right section.
Thus the top most pixel can be double clicked, mouse wheeled, etc.

For the Wayland case the test case is adjusted.

BUG: 362860
FIXED-IN: 5.7.0

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1596
2016-05-12 16:58:15 +02:00
Martin Gräßlin 0b9e6a4aa2 Fix start move through drag distance on window decoration
We need to call handleMoveResize on the mouse move with button down.

Auto tests adjusted to include all possible directions.
2016-03-11 12:48:01 +01:00
Martin Gräßlin c6e6d9a872 Move leaveNotify event handling to AbstractClient
Only most basic to cancel auto raise and delayed focus.
2016-02-18 13:00:50 +01:00
Martin Gräßlin 8ee550292f Move enterNotify handling to AbstractClient
General handling for mouse driven focus and auto raise should and can
be shared between Client and ShellClient. Thus the code is moved to
AbstractClient and invoked from Client::enterNotifyEvent.
2016-02-18 11:30:52 +01:00
Martin Gräßlin 4e32dcfbfe Cleanup includes of input.(h|cpp) a little bit 2016-02-15 13:51:36 +01:00
Thomas Lübking ed1d32288b move doubleclick logic into press event
alignes w/ systemwide behavior and allows elegant fix of
BUG: 357450
FIXED-IN: 5.6
REVIEW: 126631
2016-01-18 22:34:37 +01:00
Martin Gräßlin 5e96f65224 Add window decoration to ShellClient
If a ShellClient supports the ServerSideDecoration interface we can
create a server decoration for it. For that updateDecoration is added
as a pure virtual method in AbstractClient and a more-or-less code copy
from Client is added to ShellClient.

Geometry handling is adjusted to consider the window decoration offsets.
2015-12-18 16:41:49 +01:00
Martin Gräßlin 3de3a959c6 Move implementation of clientPos() to AbstractClient
The Client's variant works for both Client and ShellClient.
2015-12-18 16:41:49 +01:00
Martin Gräßlin 5f90fa5cfd Introduce pure virtual, protectd AbstractClient::acceptsFocus -> bool
Replacement for calls to info->input() which is only valid for the Client
sub class, but not for ShellClient.

In ShellClient the implementation is swapped with wantsInput() and
wantsInput() has a new implementation which properly delegates to rules()
just like Client does.
2015-12-18 16:41:49 +01:00
Martin Gräßlin 9ae2b505fa Group decoration related variables in a struct in AbstractClient 2015-12-18 16:41:49 +01:00
Martin Gräßlin 4873b2933f Move decoratedClient from Client to AbstractClient 2015-12-18 16:41:49 +01:00
Martin Gräßlin ce84ae4b65 Move some decoration related signals from Client to AbstractClient 2015-12-18 16:41:49 +01:00
Martin Gräßlin ae28c2499d Add virtual AbstractClient::showContextHelp and ::providesContextHelp
Required in the context of decorations. Default implementation does
nothing respectively returns false.
2015-12-18 16:41:49 +01:00
Martin Gräßlin 5de55b61e7 Move processDecorationButton(Press|Release) to AbstractClient
This also requires to move m_decorationDoubleClickTimer and reworking
a bit how the x11 events are passed to processDecorationButtonPress.
2015-12-18 16:41:49 +01:00
Martin Gräßlin 38d3346faa Mode dontMoveResize from Client to AbstractClient 2015-12-18 16:41:49 +01:00
Martin Gräßlin a15ccc2215 Move processDecorationMove from Client to AbstractClient 2015-12-18 16:41:49 +01:00
Martin Gräßlin 4d61835988 Move implementation of mousePosition to AbstractClient
Also method does not need to be virtual any more.
2015-12-18 16:41:49 +01:00
Martin Gräßlin ad6ead1928 Move property noBorder from Client to AbstractClient 2015-12-18 16:41:49 +01:00
Martin Gräßlin 5d36bab6b2 Move implementation for borderFoo() to AbstractClient
Also makes the methods no longer virtual, can just be provided in
AbstractClient.
2015-12-18 16:41:49 +01:00
Martin Gräßlin c1053ce1a5 Add a base implementation for layoutDecorationRects to AbstractClient 2015-12-18 16:41:49 +01:00
Martin Gräßlin 1659c0b641 Move triggerDecorationRepaint from Client to AbstractClient 2015-12-18 16:41:49 +01:00
Martin Gräßlin 0a82746f91 Move decorationHasAlpha from Client to AbstractClient 2015-12-18 16:41:49 +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
Marco Martin 1f9fa64a49 preliminar support for task geometries in wayland
make the minimize effect work by reading taskGeometry
from plasmawindowmanagement and returning as iconGeometry()
there is one task geometry per panel window, iconGeometry()
will return the geometry associated to the nearest panel
from the window

REVIEW:125873
2015-11-05 11:36:40 +01:00
Martin Gräßlin a23a9d38f9 Make it possible to end move/resize through mouse button release
Properly handle the mouse press/release events in InputRedirection
while we move windows. If it's the last mouse release event we end
the move resize of the window. For that we reuse the code written
in Client.
2015-10-28 10:43:49 +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 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 5d2251875f Move keyPressEvent(uint) to AbstractClient
The variant with additional timestamp is still in Client.
2015-10-26 09:21:36 +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 dcff41ab40 Move checkQuickTilingMaximizationZones to AbstractClient
Implementation is moved to abstract_client.cpp as so far events.cpp
does not have any code from AbstractClient.

This includes moving the electricMaximizingDelay from Client to
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 43e4071975 Provide positionGeometryTip() as virtual method in AbstractClient
The implementation of positionGeometryTip is X specific, we need to
figure out whether that one makes sense for Wayland. Given that, let's
have it virtual to ease the transition of code which calls it.
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 88e097ec16 Move signals clientFooUserMovedResized to AbstractClient
This also changes the argument to carry the sending AbstractClient
instead of 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 c9dbd94812 Move properties move and resize from Client to AbstractClient
Includes the public methods isMove() and isResize() and the signal
moveResizedChanged().
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