Commit graph

168 commits

Author SHA1 Message Date
Vlad Zahorodnii
62a7db7028 Use nullptr everywhere
Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.

This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson, romangg

Reviewed By: #kwin, davidedmundson, romangg

Subscribers: romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23618
2019-09-19 17:48:21 +03:00
Vlad Zahorodnii
bccbb8f3a5 Pass area by const reference to placeFoo methods 2019-09-16 16:26:58 +03:00
Vlad Zahorodnii
726e6c1567 Don't initialize QFlags<T> with 0 value
Summary:
clang-tidy has a check that converts all usages of null pointer literals
to nullptr keyword. However, there's a small issue related to QFlags<T>.

Apparently, QFlags<T> has a constructor that takes a pointer and if you
pass 0 to it, clang-tidy will replace 0 with nullptr, e.g.

    NET::States(0) -> NET::States(nullptr)

Even though passing nullptr is totally correct, it looks very weird.

Test Plan: Complies.

Reviewers: #kwin, gladhorn

Reviewed By: #kwin, gladhorn

Subscribers: gladhorn, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23948
2019-09-15 00:17:53 +03:00
Frederik Gladhorn
b64e67ce7c Remove disabled TabGroup feature
Summary:
This has been commented out since 2014, I doubt it will come back.
This is a big amount of code, maintenance will be easier without it.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: romangg, graesslin, kwin

Tags: #kwin, #documentation

Differential Revision: https://phabricator.kde.org/D23069
2019-09-14 10:58:48 +02:00
Vlad Zagorodniy
7a3722b4f5 Switch to Q_ASSERT
Summary:
Switch to Q_ASSERT in order to make code a bit more consistent. We have
places where both assert and Q_ASSERT are used next to each other. Also,
distributions like Ubuntu don't strip away assert(), let's hope that
things are a bit different with Q_ASSERT.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: romangg, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23605
2019-08-31 20:07:05 +03:00
Vlad Zagorodniy
744e2be3f6 refactor: Minimize use of geom in Toplevel subclasses
Summary:
This change makes easier to refactor geometry handling in the future.
The main motivation for avoiding using geom directly is to make code
more readable and ensure that the geometry is updated only through
designated methods, e.g. setGeometry, plainResize, etc.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23072
2019-08-10 20:01:16 +03:00
Vlad Zagorodniy
28a4337ad5 Don't use deprecated toAscii() method
Summary:
QChar::toAscii() and QString::toAscii() are deprecated in favor of
QChar::toLatin1() and QString::toLatin1() respectively.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22374
2019-07-10 22:50:00 +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
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
Kai Uwe Broulik
df85907de3 Support CriticalNotification type and place it in a CriticalNotificationLayer
Differential Revision: https://phabricator.kde.org/D20629
2019-05-02 10:29:38 +02: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
Vlad Zagorodniy
8010e076ee Revert "Move keep-above clients to the Normal layer when showing desktop"
This reverts commit 1e2a0028c3.

Unfortunately, we can't move clients from the above layer to the normal
layer because some of those clients have to be visible when showing
desktop, one such client for example is krunner.

CCBUG: 406101
2019-04-16 11:10:20 +03:00
Vlad Zagorodniy
1e2a0028c3 Move keep-above clients to the Normal layer when showing desktop
Summary:
Implementation of the Show Desktop feature moves desktop windows to
the Above layer, but it doesn't take into account existing clients
that belong to the Above layer. If there are any, we have to move
them to a layer below (e.g. normal), otherwise those clients will be
visible when showing the desktop.

BUG: 406101

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20153
2019-04-02 23:44:20 +03:00
Marco Martin
d2820bf05e Don't try to resize desktop or fullscreen windows
Summary: those windows should always take all the space no matter what

Test Plan: text areas on desktop or fullscreen windows don't cause resizes anymore

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19922
2019-03-20 17:47:08 +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
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
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
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
Vlad Zagorodniy
7e73ad230a Merge branch 'Plasma/5.14' 2018-11-13 10:28:56 +02:00
Vlad Zagorodniy
406b70b04e [wayland] Don't crash when resizing windows
Summary:
If you resize a decorated client by using the resize user action(press
Alt + F3 > More Actions > Resize), then KWin will crash because it gets
stuck in an infinite loop (AbstractClient::performMoveResize <->
ShellClient::setGeometry).

Here's how KWin gets stuck in that loop:
* when you finish resizing the client, AbstractClient::keyPressEvent
  will call AbstractClient::finishMoveResize;
* the first thing that finishMoveResize does is block geometry updates,
  then it does some clean up (e.g. reset the value of isMoveResize(), etc),
  updates the geometry of the client and when it's done, it will emit
  clientFinishUserMoveResized signal;
* when PointerInputRedirection notices that signal, it will call
  processDecorationMove on the client, which in its turn will indirectly
  call AbstractClient::startMoveResize;
* when it's time to go back to AbstractClient::keyPressEvent, geometry
  updates are unblocked and if there are any pending geometry updates,
  then ShellClient::setGeometry will be called;
* ShellClient::setGeometry will eventually call ShellClient::doSetGeometry;
* ShellClient::doSetGeometry will call AbstractClient::performMoveResize
  because AbstractClient::processDecorationMove indirectly called
  AbstractClient::startMoveResize;
* AbstractClient::performMoveResize calls ShellClient::setGeometry;
* (at this point, KWin got stuck in the infinite loop)

This change swaps setMoveResizePointerButtonDown and finishMoveResize,
so processDecorationMove won't indirectly call startMoveResize.

BUG: 397577
FIXED-IN: 5.14.4

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16846
2018-11-13 10:28:16 +02: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
85ef2831db Do not call into NETWinInfo in AbstractClient::setSkipPager
Summary:
There's a call to a virtual doSetSkipPager for performing this call and
Client implements it with the code which now is removed.

This fixes a crash when using setSkipPager for a Wayland window.

Test Plan:
Crash which happens with a new test case (see dependent phab
request) is fixed.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9865
2018-01-14 11:19:19 +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
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
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
a6d0bc276d Merge branch 'Plasma/5.10' 2017-06-26 22:11:46 +02:00
Martin Flöser
152be60cc0 Fix double click on window deco if tripple clicked
Patch by Thomas Lübking which got lost in bugs.kde.org.

BUG: 361241
FIXED-IN: 5.10.3
2017-06-22 07:07:06 +02:00
Eike Hein
e7e79124aa Set pid on the ClientConnection backing the PlasmaWindow surface.
Summary: Depends on D5747.

Reviewers: #plasma, sebas, graesslin

Reviewed By: #plasma, graesslin

Subscribers: kwin, plasma-devel, #kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5756
2017-06-12 01:09:22 +02:00
Eike Hein
6607bd72f2 Use resourceClass as fallback for XWayland clients instead of resourceName.
Summary:
resourceClass is the more useful half of WM_CLASS. It's what modern X
clients are supposed to set to a .desktop file name, which is closer to
the semantics of appId than resourceName.

Reviewers: #plasma, graesslin

Subscribers: kwin, plasma-devel, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5815
2017-05-12 02:18:44 +09:00
Martin Flöser
a2d19c6b9d Revert "Set pid on the PlasmaWindow based on the client connection."
This reverts commit 262fb00b51.

CCMAIL: hein@kde.org
2017-05-08 16:46:16 +02:00