Commit graph

454 commits

Author SHA1 Message Date
Martin Gräßlin
71c996fe33 Select also raw button press/release in XInput2 based polling
Summary:
The mouse polling is also used to detect mouse button press/release
events. This is used e.g. by the MouseClickEffect. The XInput2 filter
only selected for Raw Motion events which means mouse button events
are missed in case it's not combined with a motion.

This change makes the input filter also select for raw button press
and release events. To support this the X11EventFilter needed to
be adjusted to support multiple generic event types to filter for.

BUG: 366612
FIXED-IN: 5.7.4

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2406
2016-08-15 16:06:30 +02:00
Martin Gräßlin
96ce7bd2ad Properly call Toplevel::setSurface for wl_surface_id X11 client message event
Summary:
For an X11 window through Xwayland KWin gets a client message with the
Surface id. KWin has two code paths for handling that:
* Wayland Surface is created after the X11 event
* Wayland Surface is created before the X11 event

In the first code path in WaylandServer KWin called Toplevel::setSurface,
the other code path just updated the m_surface without calling into
setSurface. This means the connects for the Surface were not set up,
resulting in the worst case in accessing deleted memory after the Surface
was destroyed.

This change now ensures that setSurface is called from both code paths.
That should fix the potential crash and could also be a fix to the
problem that sometimes X windows seem to not be damaged correctly.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1820
2016-06-14 07:41:20 +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
e2e6d8b08b Warp the cursor pos to the specificed global position in a NET::Move request
Summary:
The cursor position is the reference KWin uses while moving a window.
If we don't warp the cursor position the window "jumps" to the cursor
position on first movement.

For requests triggered by the client (e.g. widget style) this does not
matter as the cursor is at the correct position. But for tools such as
task bars we should ensure the cursor is at the right pos.

Reviewers: #plasma, hein

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1421
2016-04-18 07:50:06 +02: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
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
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
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
Thomas Lübking
37a64dcf5f catch lost FOCUS_POINTER_ROOT FOCUS_IN events
it seems we can "loose" focus reversions when the closing client hold a grab
(eg. the screenlocker or some games) thus we catch the typical pattern
(though we don't want the focus on the root anyway)

BUG: 348935
FIXED-IN: 5.5
REVIEW: 126033
2015-11-17 21:29:45 +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
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
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
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
84c7575cbf Move (inverted)MoveOffset to AbstractClient 2015-10-26 09:21:36 +01:00
Martin Gräßlin
3514b4d691 Track whehter moveResize is unrestricted in 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
Thomas Lübking
801e60b290 force grab on useractions menu
Workaround, this *seems* a Qt problem.
The grab fails while the button is down - Qt then also seems
to release the keyboard.

Not sending it to the deco didn't help either - nevertheless it seems
(from the Qt code) as if the button is currently grabbed
(the code is a dumb forward to xcb_grab_pointer)

As a workaround, the patch simply ensures a grab on releasing a button when
the popup is visible.

BUG: 351112
FIXED-IN: 5.5
2015-10-16 15:45:55 +02:00
Martin Gräßlin
9b8836b455 Move (set)electricBorderMode() from Client to AbstractClient
While it was public in Client, it was not used anywhere outside of
Client, because of that it's only protected in AbstractClient.
2015-10-12 09:56:54 +02:00
Thomas Lübking
af4809134c fix up delayed quick tiling
a) if the move is left after the delay is triggered
   but before the timer hit, do not cause a stale QT
   indication
b) only delay QT if there's actually another screen
   on the other side

BUG: 352744
REVIEW: 125250
2015-09-25 14:37:02 +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
Thomas Lübking
cc6886d7dd fetch motif hints when get them for managed client
notably *after* storing the old values.
Otherwise the old value is polluted because of
m_hints being nullptr, thus a default value is
returned (instead of the actual old value)

BUG: 347818
FIXED-IN: 5.4.2
REVIEW: 125007
2015-09-14 21:01:22 +02:00
Martin Gräßlin
f6f555d688 Merge branch 'Plasma/5.4' 2015-09-08 08:42:07 +02:00
Martin Gräßlin
0b95561193 Fake a leave event for the decoration when client is left
We need to send a fake HoverMove event on minimized to remove all
hovered states of the decoration.

At the same time we need to ensure that no further hover events are
sent to a minimized client.

BUG: 351984
FIXED-IN: 5.4.1
REVIEW: 124997
2015-09-07 15:27:06 +02:00
Martin Gräßlin
3139dcd3b9 Drop cmakedefine HAVE_WAYLAND
Now a required build dependency.
2015-08-12 11:39:20 +02:00
Martin Gräßlin
c3b7ed907b Move logic to handle mouse buttons on windows to AbstractClient
Part of the logic is split out in a generic way so that the code
can be shared with activating of Wayland clients.
2015-07-09 16:34:19 +02:00
Martin Gräßlin
72635101f0 [wayland] Improve creation of KWayland::Server::PlasmaWindowInterface
The creation of PlasmaWindowInterface is moved from WaylandServer into
AbstractClient. This allows the sub classes to better control when to
create/destroy the Client.

For creation it's bound to becoming visible - that is Windows which are
only created but never shown are not announced at all.

For Client it's destroyed with the normal tear-down of a Client, for
ShellClient it's destroyed on unmapped (which also means a new one
will be created again in case of another mapping of the surface).

As a side effect, this works around the problem that ShellClients do not
yet get destroyed for QtWayland's menus (needs further investigation).
2015-07-09 09:10:33 +02:00
Martin Gräßlin
4ca3734d12 [wayland] Support move/resize mode in pointer move handling 2015-06-06 17:43:12 +02:00
Martin Gräßlin
eac99d5df6 Clenup: Drop QPoint argument from Client::mousePosition
Unused variable is unused.
2015-06-04 19:26:35 +02:00
Martin Gräßlin
1fcd1120d9 Move auto-raise handling to AbstractClient
Adds QTimer to AbstractClient and introduces new protected method to
start the timer.
2015-05-08 12:43:46 +02:00
Martin Gräßlin
94ce47ef7b Workspace::mostRecentlyActivatedClient returns an AbstractClient
Implementation temporarily moved to cpp. Needs to be moved back once
should_get_focus and active_client are AbstractClient.
2015-05-08 12:43:46 +02:00
Martin Gräßlin
4b41c33268 Workspace::movingClient changed to AbstractClient
In events.cpp it's casted to Client as it's X11 specific.
In InputRedirections it's kind of broken, but window movement is
anyway broken.
2015-05-08 12:43:45 +02:00
Martin Gräßlin
bb404f7d67 [wayland] Fix checking id to Surface in xwayland client message
We need to also pass the client to the verification.
2015-04-02 09:49:39 +02:00
Martin Gräßlin
07c972b6d4 [wayland] Add a SurfaceInterface to Toplevel
Adds the SurfaceInterface identified by the surface id we get from
Xwayland. This allows in an easier way to map a Toplevel to a
Wayland surface and will also be useful for Wayland clients.
2015-03-17 10:08:27 +01:00
Martin Gräßlin
e7019d9545 [xwayland] Add support for WL_SURFACE_ID
When XWayland associates a Wayland surface with an X window it
sends a WL_SURFACE_ID client message to the window manager.

KWin listens for this client message in Toplevel and provides it
as a member in Toplevel.

This requires KWin to actually start a Wayland server (and XWayland)
to make proper use of the information.
2015-03-17 10:03:04 +01:00
Martin Gräßlin
dfa89cc050 Port reading Motif hints to XCB
A wrapper class for MotifHints is added to xcbutils. This class manages
the information about the read Motif hints, so that Client doesn't need
to have a copy of the read states.

The class is designed in a way that during Client::manage we get rid of
another roundtrip.

REVIEW: 122378
2015-02-06 13:43:57 +01:00
Thomas Lübking
93fb58aa88 Merge branch 'Plasma/5.2' 2015-02-06 00:29:55 +01:00
Thomas Lübking
ff700a8db5 fix e3768b4355
accidentally picked the patch from the wrong branch
just about comments
2015-02-06 00:27:31 +01:00
Martin Gräßlin
cef84cd8a5 Use NETWinInfo::opaqueRegion
REVIEW: 122199
2015-01-26 11:47:40 +01:00
Thomas Lübking
f3a1d1bd3d updateXTime for kde_net_wm_user_creation_time
explicitly

CCBUG: 340994
CCBUG: 337798
2015-01-08 00:06:35 +01:00
Hugo Pereira Da Costa
02d0a5bb7d Also send a QHoverEvent to the decoration when MotionNotify event occurs in input window, in order to get the right cursor shape and resize mode from extended borders
REVIEW: 121556
2015-01-03 18:02:08 +01:00
Daniel Pastushchak
0d997b1093 Introduce categorized logging for kwin core
Done by Daniel Pastushchak for KDE during GCI-2014.
2014-12-05 14:27:15 +01:00
Martin Gräßlin
4c9744fe8e Drop dependency on kdecoration.h 2014-12-02 13:50:26 +01:00
Martin Gräßlin
c2e53b9a2f Merge branch 'kdecorations2'
Conflicts:
	effects.cpp
	paintredirector.cpp
2014-12-02 08:38:10 +01:00
Martin Gräßlin
d1bf38e92c [kdecoration2] Detect double clicks on the decoration title bar
No longer handled by the Decoration.
2014-11-28 14:50:21 +01:00
Martin Gräßlin
0efa9d9c73 [kdecoration2] Decoration does not provide titleBarWheelEvent any more
Instead KWin needs to determine by itself whether it should act on the
wheel event. The Decoration will set it to accepted if it handled it.
2014-11-28 14:08:13 +01:00
Thomas Lübking
b26ef9302a don't restore unrestorable window sizes on Q'unmax
BUG: 340600
REVIEW: 121022
2014-11-27 20:01:10 +01:00
Martin Gräßlin
b7a8bb4f52 Drop build option KWIN_BUILD_SCREENEDGES
The build option got introduced for Plasma Active back in a time
when we did not properly aim for convergence. In a Plasma 5 world
we want to have only one shell and one window manager which adjust
itself. This means we don't want a differently compiled kwin for
plasma active, but the same one. Thus the build option doesn't
make much sense any more. A KWin for touch interface needs to support
screenedges for the case that mouse is plugged in.

CCBUG: 340960
REVIEW: 121200
2014-11-24 10:48:49 +01:00