Commit Graph

133 Commits (b002b279032145a6d4e3b93c30ea5b16d20a4973)

Author SHA1 Message Date
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
Eike Hein 262fb00b51 Set pid on the PlasmaWindow based on the client connection.
Summary: Depends on D5747.

Test Plan:

Reviewers: #plasma,sebas,graesslin

Subscribers: plasma-devel
2017-05-08 19:25:54 +09: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
Marco Martin 948ff63d65 when the padding aroun the window changes, update
Summary:
update m_visibleRectBeforeGeometryUpdate when the padding
change signal gets emitted: aurorae updates its shadow
and postentially shadow size asynchronously after repainting.
that would make the first addRepaintDuringGeometryUpdates
when the winow is moved *for the first time* have a wrong
m_visibleRectBeforeGeometryUpdate that doesn't take into
account the shadow, leaving some leftover shadow on screen

BUG:377670

Test Plan:
shadow leftover not reproducible anymore with maui's kwinrc
replaces D4989
tested both on master and together D4990, which should go in as well

Reviewers: #plasma, davidedmundson, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5078
2017-03-17 17:47:24 +01: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 bba18a1ba8 Fix the osd re-placement on X11
Summary:
6383f83047 introduced a regression hitting
an assert on X11 when an osd window is added.

This change tries to address this by adding a GeometryUpdateBlocker
around the change. The hit assertion is:

    pendingGeometryUpdate() == PendingGeometryNone ||
    areGeometryUpdatesBlocked()

By using a GeometryUpdateBlocker the second condition becomes true
and we no longer hit the condition.

BUG: 374038

Test Plan:
Manual tested both on X11 and Wayland, Wayland autotest
still passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3808
2016-12-27 17:36:32 +01:00
Martin Gräßlin 6383f83047 Place OSD windows again on size changes
Summary:
The position of an OSD is based on the size of the window. If the
size of the OSD changed, it would not be positioned correctly any more.

With this change the OSD window gets placed again if the size changes.
Thus it's also placed correctly even if the window changed it's size.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3720
2016-12-21 19:24:57 +01:00
Martin Gräßlin 2619ddf02e Merge branch 'Plasma/5.8' 2016-11-18 16:08:29 +01:00
Martin Gräßlin 16c7650d76 Fix AbstractClient::sizeForClientSize
Summary:
The method is supposed to return the AbstractClient's size for a given
client size. That is the size including the window decoration.

The default implementation returned the passed in client size without
adjusting for the decoration. This resulted in ShellClient getting a
wrong size especially when AbstractClient::adjustedClientSize (which
calls sizeForClientSize) was called.

The result of the incorrect size was for example a shrinking of the
window when starting to resize a window.

BUG: 370345
FIXED-IN: 5.8.4

Reviewers: #kwin, #plasma_on_wayland, broulik, subdiff

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3414
2016-11-18 12:36:08 +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 05d21b6b25 Use new PlasmaWindowInterface::setIcon
Summary: This allows to pass also Xwayland icons to the task manager.

Reviewers: #kwin, #plasma_on_wayland, hein

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3050
2016-10-17 09:01:09 +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 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 8445008e85 Expose window geometry to PlasmaWindow
Summary: Needed for e.g. the pager.

Test Plan: Test case for PlasmaWindow verifies the geometry

Reviewers: #kwin, #plasma_on_wayland, hein

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2200
2016-07-20 13:49:10 +02:00
Martin Gräßlin 89b28c32da Correct datatype to qint64 for value returned from QElapsedTimer::elapsed
Was incorrectly passed to a quint64.
2016-06-29 10:52:43 +02:00
Martin Gräßlin aa215e12cc Expose the transientFor relationship to PlasmaWindowInterface
Test Plan: Compiles

Reviewers: #kwin, #plasma_on_wayland, hein

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1780
2016-06-29 09:19:15 +02:00
Martin Gräßlin d7f3ed5513 Destroy decoration when DecorationBridge is destroyed
When KWin goes down the DecorationBridge might be destroyed before the
last AbstractClient is destroyed. Thus we should destroy the Decoration
when the DecorationBridge gets destroyed.
2016-05-23 10:01:31 +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 0be773262e Unmap PlasmaWindowInterface instead of deleting directly
Summary:
The window will be cleaned up automatically once all bound resources
are destroyed. A manual delete though might cause protocol errors on
client side as the unmap and resource destroy happen together and we
are in a race condition.

To ensure that we don't leak the interface is set as the parent, so
on tear-down remaining resources will be destroyed eventually, even
if it triggers a protocol error on the client.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1595
2016-05-12 11:10:10 +02:00
Eike Hein f2e4e11929 Hook up virtual_desktop_changeable state.
Summary: Depends on D1448.

Reviewers: graesslin

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1449
2016-04-20 01:35:54 +09:00
Eike Hein 7804a352a8 Hook up movable and resizable states.
Summary:
Sets movable and resizable states on the Wayland window.

kwin doesn't have state change signals for this, so it's a one-time thing.

Depends on D1432.

Reviewers: graesslin

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1434
2016-04-19 21:08:53 +09:00
Eike Hein 6b869f1355 Switch to naming suggested by native speakers. 2016-04-19 18:57:19 +09:00
Eike Hein ef6a2cfa64 Expose client shade state to kwayland's interface.
Summary:
Makes use of new API in kwayland to expose shade state.

Depends on D1417.

Reviewers: graesslin

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1418
2016-04-19 18:57:19 +09: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 f0ec89f38b Merge Options::MouseLower for Client and AbstractClient
The implementation in Client::performMouseCommand can now also be
used directly in AbstractClient.
2016-02-18 10:30:58 +01:00
Martin Gräßlin 093e56ff05 Move decoration double click logic to button press
Complements ed1d32288b for Wayland.
2016-02-17 14:41:26 +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 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 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