Commit Graph

1050 Commits (93938d60b84df81733da7b3f697332fc76fe085b)

Author SHA1 Message Date
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 d9612b327c Merge branch 'Plasma/5.8' 2016-11-07 11:41:30 +01:00
Martin Gräßlin 2a15592571 Simplify the window title passed in from the window system
Summary:
So far KWin used the window title provided from the window directly
without any sanitizing. This could result in broken window decorations
if the title included line breaks. Those were passed to the decoration
and depending on the way how the decoration renders the title, it could
result in visual breakage.

Having line breaks in a window title doesn't make sense. Given that KWin
now simplifies the title when copying it to it's own structure. This
also ensures that the title passed to e.g. task manager does not have
any line breaks on Wayland.

BUG: 323798
FIXED-IN: 5.8.4

Test Plan: Opened the web page in a nested KWin, properly rendered now.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3215
2016-11-07 11:26:48 +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 2e3c6c92e9 Trigger resize of input window when deco size changes
Summary:
Client::updateInputWindow operates with the decoration size. The method
gets called from various points when changing the window geometry. If at
that moment the decoration has not updated yet, the borders might be at
a wrong position.

This behavior could be triggered when a window requested to change the
state to maximized. During maximization the decoration still had the
wrong size when updateInputWindow was called, thus an interactive area
inside the window was created.

To circumvent this problem updateInputWindow is now also called whenever
the window decoration changes.

As a note: that a maximized window has resize only borders is wrong. Kwin
should be protected against that.

BUG: 371284
FIXED-IN: 5.8.3

Test Plan: Checked xwininfo for the deco extends window

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3151
2016-10-28 16:06:25 +02:00
Martin Gräßlin 853020336f Introduce a config option whether applications are allowed to block compositing
Summary:
From feedback we got it seems that not all users agree to games and
other applications blocking compositing. Some users prefer to have
compositing always on even if this gives a small performance penelity.

This change introduces a dedicated config option to specify whether games
are allowed to block compositing. By default this option is enabled.

The setting can be overwritten with a window specific rule. So usecases
like all windows except this very specific one are supported.

In the user interface the config option is shown where previously the
unredirect fullscreen option was shown.

Test Plan:
Run a game which should block compositing, verified it blocks.
Changed the setting, run the game again, verified it doesn't block. And
once more for with allowing to block.

Reviewers: #kwin, #plasma_on_wayland, #vdg

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2584
2016-09-13 15:47:05 +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
David Edmundson 0dd927c4a4 Validate activities in setOnActivities
Summary:
This fixes a bug I had where Session Management restored a window on an
activity that didn't exist that, meaning I was unable to access it.

setOnActivity() already has this check

BUG: 362620

Test Plan:
Using my broken session, restored and got my ghost process back
on all activities

Added a window to activity 2, checked it came back there and
only there.

Reviewers: #plasma, graesslin

Subscribers: ivan, luebking, graesslin, kwin

Tags: #kwin

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

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

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

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

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

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

Reviewers: #kwin, #plasma, #vdg

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2180
2016-08-04 14:48:35 +02:00
Martin Gräßlin a1afeded6a Emit windowShown and windowHidden from Client::internalKeep and ::internalHide
Summary:
With this change auto-hiding panels are animated again by SlidingPopups
effect.

Test Plan: Test case adjusted, and tested in VM

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2157

BUG: 354407
FIXED-IN: 5.8.0
2016-07-14 11:11:49 +02:00
Martin Gräßlin 67f7e8da34 Drop static previous_client from Client::takeFocus
Only set but never read. The debug code for verifying was commented
out as it would no longer compile. Let's just get rid of it completely.
2016-06-29 10:55:20 +02:00
Martin Gräßlin ea4de85553 Destroy static Client helper window before application goes down
Summary:
Client uses a static Xcb::Window helper. This so far didn't get
explicitly destroyed, so the application finalize cleaned it up.
To destroy the window the xcb_connection_t* is used which the
QGuiApplication already destroyed.

This change ensures that the window gets destroyed before the xcb
connection gets destroyed.

In addition an assert is added to KWin::connection() to ensure that
we still have the QGuiApplication::instance() when it's invoked.
This way we'll notice if we have more cases where we call into xcb
after the application went down.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1573
2016-05-17 14:17:07 +02:00
Martin Gräßlin 34951b3bee Fix repaints area on Wayland damage
The damage event of the Surface does not consider the offset through
the server side decoration. Due to that we need to have a different
repaint and damage area. As Toplevel::addDamage(QRegion) is only used
in the Wayland case the repaint adjustment is removed from the generic
implementation and moved into the specific implementations. While it
wouldn't hurt to have the repaint adjustment in Toplevel, it would
trigger a repaint of an unchanged area.

For Client I'm not sure whether it's correct without considering the
clientPos. My testing shows it's working, but that might also just be
do to Xwayland using OpenGL buffers. Needs further testing.
2016-03-04 16:33:09 +01:00
Kevin Funk 8ea4f4dae7 Port to CMake AUTOMOC
Summary: Run convert-to-cmake-automoc.pl over all .cpp files

Differential Revision: https://phabricator.kde.org/D882
2016-02-01 21:05:36 +01:00
Thomas Lübking 1c344c16d9 emit shadeChanged before calculating unshaded size
Otherwise the old (shaded) border sizes will be invoked, causing
a shrinkage of the window

BUG: 357669
FIXED-IN: 5.6
REVIEW: 126671
2016-01-18 22:50:13 +01:00
Thomas Lübking e73e331f35 use XCB_CURRENT_TIME for NET::TakeFocusProtocol
The only clients that really seem to rely on it are
Java and they're apparently "broken", resp. extremely
picky on the tiemstamp and probably happily refuse focus
if it's *not* equal to the current server time (ie. anything else
happens at this moment) and overmore feel oblieged to act as WM
by juggling around VDs at all.

BUG: 347153
FIXED-IN: 5.6
REVIEW: 126753
2016-01-15 22:00:10 +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 4873b2933f Move decoratedClient from Client to AbstractClient 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 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 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
Nick Shaforostoff 3a8d7d866a optimize string operations
-use qstringliteral only when necessary (i.e. not in concat or comparison)
-use qbytearray instead of qstring when dealing with latin1 input and output (glplatform)
-use qstringref to extract numbers from strings (glplatform)
-define qt_use_qstringbuilder to optimize all string concatenations
-anidata: use ctor init lists, add windowType member initialization

REVIEW: 125933
2015-11-05 14:14:06 +00:00
Thomas Lübking b2755bcaa7 re-evaluate rules on title change
If a rule minus the title match matches,
the captionChanged signal is bound to re-evaluate
the rules for that client, ie. the tracking overhead
only exists for those clients where title matching
is relevant and costs rematching all rules when such
client changes its title (yes, the partial matching
rules could be stored for faster re-check, but that
would make the patch bigger and is probably not worth
it; just some string comparisms)

additional tracking of wm_class or wm_role
(what is iirc a netwm violation anyway) would require
to monitor the resp. property for changes (not done atm.)

BUG: 220227
FIXED-IN: 5.5
REVIEW: 125427
2015-10-29 23:36:10 +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 5d4cd0b26c Move geometry related connects from Client to AbstractClient 2015-10-26 10:14:54 +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 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 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 8a3be2bacd Move the Position mode from Client to AbstractClient 2015-10-26 09:21:36 +01:00
Martin Gräßlin b5e8e3511e Track whether Client is in moveResizeMode in AbstractClient
Variable moveResizeMode replaced by protected methods isMoveResize()
and setMoveResize().
2015-10-26 09:21:36 +01:00
Martin Gräßlin c578720615 Add virtual AbstractClient::updateTabGroupStates(TabGroup::States)
Method added so that we can call into TabGroup::updateStates from code
in AbstractClient. Default implementation does nothing, implementation
in Client performs the actuall call.

As a first case added to Client::move in order to be able to move the
implementation to AbstractClient.
2015-10-15 15:29:09 +02:00
Martin Gräßlin 9f91431e8c Move quick tiling from Client to AbstractClient
In order to make it possible to quick tile also ShellClients.
2015-10-14 08:36:29 +02:00
Martin Gräßlin 9ef42ae3c7 Move blocking geometry updates functionality to AbstractClient 2015-10-14 08:36:29 +02:00
David Edmundson 04ab8554aa Add hint similar to autohide to raise/lower a window
Add action type to screen edge show to allow raise/lower as well as
autohide

Add an action type to screen edge show to allow raise/lower as well as
autohide. This uses the same atom, using a mask to separate type and
location.

The logic for handling geometry changes is moved from the screenedge to
the client so that we can handle both types without screenedge needing
to know what the raise is for.

REVIEW: 124272
2015-10-12 10:37:16 +01:00
Martin Gräßlin 53b87dbbd9 Move (is|set)ElectricBorderMaximizing from Client to AbstractClient 2015-10-12 10:26:00 +02:00
Martin Gräßlin d25c465211 Move layer functionality to AbstractClient
Merges together the code from ShellClient and Client and removes the
starting differences. Long term it's better to have only one
implementation to prevent diversions in the implementation.

As it doesn't match exactly protected virtual methods are called
which allow more specific implementations for a certain aspect of the
layer resolving.
2015-09-17 11:06:59 +02:00
Martin Gräßlin b199356774 Move functionality from Client::doSetDesktop to AbstractClient::setDesktop
Functionality related to transient handling can now be provided by
AbstractClient.
2015-09-16 13:54:47 +02:00
Martin Gräßlin 2da04aa26b Use auto where we call ensureStackingOrder(client->transients())
Preparation step for switching transients from Client to AbstractClient.
2015-09-16 13:54:47 +02:00
Martin Gräßlin 305699be8e Move modal from Client to AbstractClient 2015-09-16 13:54:47 +02:00
Martin Gräßlin 1d242d9daf Move mainClients() and allMainClients from Client to AbstractClient
AbstractClient::mainClients is virtual and overriden in Client,
allMainClients has only a common implementation in AbstractClient.

In activation.cpp we still need one case where a temporary ClientList
needs to be constructed. Once transients are fully migrated that should
be removable again.
2015-09-16 13:54:47 +02:00
Martin Gräßlin c4c3dfc73f Move transientFor from Client to AbstractClient
Right now this caused a few dynamic_casts. On the other hand existing
dynamic_casts from AbstractClient to Client can be removed again.
2015-09-16 13:52:25 +02:00
Thomas Lübking 1ab663436d Merge branch 'Plasma/5.4' 2015-09-14 21:02:41 +02:00
Thomas Lübking 3a1f11d213 delay QuickTiling indication on inner screenborder
The user might just want to move the window from
one screen to another, no point in wasting time to
show the indicator

BUG: 352050
REVIEW: 125024
FIXED-IN: 5.5
2015-09-14 21:02:02 +02:00