Commit Graph

69 Commits (51888e8abdac9cff5744cd5e487ab73aa46a851c)

Author SHA1 Message Date
Martin Gräßlin f84b4758f2 Fix incorrect static_casts to Client
Replace by better dynamic_casts to AbstractClient.
2015-09-16 13:54:48 +02:00
Martin Gräßlin cd254c8f47 [wayland] Configure key repeat
We take the configuration from the kcminputrc config file, group
keyboard (see plasma-desktop.git/kcms/keyboard/kcmmisc.cpp)

The values are only used for libinput. For backends providing input
events we expect to get repeated key events anyway.
2015-09-15 10:29:06 +02:00
Martin Gräßlin 66ad99787c Add signal InputRedirection::keyStateChanged
Complements all other signals for internal usage that there is an
input event.

Needed by e.g. DPMS implementation to re-enable the outputs.
2015-09-10 14:31:46 +02:00
Martin Gräßlin 07414e88a5 Add support for modifier only shortcuts on Wayland
On popular demand!

This change tracks how modifiers are used and detects a modifier only
key press/release. That is:
* no other key is pressed when the modifier gets pressed
* no other key gets pressed before the modifier gets released

If such a press/release is detected, we call a configurable dbus call.
The possible shortcuts can be configured in kwinrc, group
"ModifierOnlyShortcuts". The following keys are supported:
* Shift
* Control
* Alt
* Meta

As value it takes a QStringList (comma seperated string) with
service,path,interface,method,additionalargs

E.g. to invoke Desktop Grid effect on Meta key:

[ModifierOnlyShortcuts]
Meta=org.kde.kglobalaccel,/component/kwin/,org.kde.kglobalaccel.Component,invokeShortcut,ShowDesktopGrid

I do not intend to add a config interface for it. Let's keep it a hidden
way.

REVIEW: 124954
2015-09-09 08:58:43 +02:00
Martin Gräßlin 296313b2fc Keep Qt::Popup windows as internal pointer window once they leave window
A click outside a popup should close the popup and not be passed to the
window at the pointer position. Thus we only update the internal pointer
window if the internal pointer window does not represent a visible
popup.
2015-08-25 14:33:50 +02:00
Martin Gräßlin afd76b80ee [wayland] Send QKeyEvent to internal windows
Allows to navigate in e.g. Useractions menu.
2015-08-25 14:33:50 +02:00
Martin Gräßlin 73b8b3ec7b Fix moving windows in InputRedirection
* Need to pass modifiers to Client::keyPressEvent
* Need to check whether move/resize ended before updating position,
  otherwise it keeps stuck in move/resize after ending
2015-08-21 10:49: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 da1e063a37 Drop cmakedefine HAVE_XKB
No longer needed, we always depend on xkbcommon now.
2015-08-12 11:39:19 +02:00
Martin Gräßlin e56520dc81 [wayland] Improve pointer movements at screen edges
So far if the new position fell outside of the screen, we ignored
the movement completely. This change only discards the event if both
x and y coordinates are outside the screen. If one component is still
on the screen it will be used. So a movement to top-left on left border
will result in a pointer movement towards top.
2015-07-20 12:35:46 +02:00
Martin Gräßlin 3beff66aca [wayland] Announce modifier changes to clients 2015-07-13 14:25:09 +02:00
Martin Gräßlin a687a58e82 [wayland] Perform mouse command on AbstractClients on touch down
If the touch window changes we simulate a left press and perform
the mouse command for a left button.

Note: this is not yet tested on real system.
2015-07-09 16:34:19 +02:00
Martin Gräßlin 0c0ad87caf [wayland] Activate AbstractClient from InputRedirection on mouse button press
This only handles button presses without modifiers so far.
2015-07-09 16:34:19 +02:00
Martin Gräßlin 810ed5d396 [wayland] Add support for FakeInput interface 2015-07-09 11:34:40 +02:00
Martin Gräßlin 3041a7c32d [wayland] Add a plugin for kglobalaccel
The KGlobalAccelD which gets created by KWin needs a plugin for the
platform specific parts. This change introduces such a plugin. It's
linked against kwin so that it can integrate with the core.

On enable the plugin registers itself in the InputRedirection and
GlobalShortcutsManager checks the plugin whether a shortcut got
triggered.

As the loading of the plugin must happen after InputRedirection is
fully created a dedicated init method is added to InputRedirection.

REVIEW: 124187
2015-07-02 13:42:29 +02:00
Martin Gräßlin 97588faea2 [wayland] Add support for input shape
Toplevel provides the input shape forwarded from SurfaceInterface. The
shape is evaluated in InputRedirection when finding the Toplevel at a
given position.
2015-06-18 23:19:13 +02:00
Martin Gräßlin 01ac0abfd7 [wayland] Change keyboard focus window when active window changes
We used to change it only on keypresses. This resulted in the strange
situation that e.g. the input method virtual keyboard doesn't show up
until one presses a real key, because e.g. maliit only activates the
keyboard if there is an active focus object in the Qt application.
2015-06-13 17:54:08 +02:00
Martin Gräßlin 7f0758b85f [wayland] Handle pointer events for internal windows
If there is a visible internal window it gets the pointer events.
The assumption is that the last created internal window is the top
most in stacking order.
2015-06-06 17:43:13 +02:00
Martin Gräßlin 7a64426085 Trigger updateMoveResize after keyboard move 2015-06-06 17:43:13 +02:00
Martin Gräßlin 06fc00b4a9 [wayland] Support pointer warping in the backends
The X11 backend can warp the pointer.
2015-06-06 17:43:13 +02:00
Martin Gräßlin 74c111ef88 [wayland] Add support for pointer warping in InputRedirectionCursor
With libinput we do can support warping pointers, let's do it.
2015-06-06 17:43:13 +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 545c8b190e Send HoverMove event to selected window decoration if buttons are pressed
Ensures that e.g. decoration buttons get the Leave events.
2015-06-06 17:43:12 +02:00
Martin Gräßlin 4a1288b0c9 [wayland] Update cursor image from current decoration 2015-06-06 17:43:12 +02:00
Martin Gräßlin 1edd689293 Handle interaction with window decoration directly in InputRedirection
So far input events were sent through Xwayland which is not needed as
we have all information available. Even more it had the pointer surface
on the wrong window when interacting with decorations as it was on the
window and not on the decoration.
2015-06-06 17:43:12 +02:00
Martin Gräßlin 8b3be23032 Don't update focused pointer window on pointer movement while button is pressed
If a button is pressed all mouse events should go to the current surface
regardless of whether the pointer is on top of it or not.
2015-06-06 17:43:12 +02:00
Martin Gräßlin 3b4c508ee3 [wayland] Pass xkb keymap to Wayland server
When creating a new xkb keymap we need to pass it to the Wayland server's
seat. As the Wayland protocol expects the keymap as a file descriptor, a
temporary file is created, mmapped and the keymap written into it. As
the Wayland protocol doesn't restrict how long the file descriptor needs
to be valid we keep any created temporary file around till the
InputRedirection gets destroyed.
2015-05-28 10:17:41 +02:00
Martin Gräßlin 0853445dce Don't pass pointer focus to a Toplevel which is not yet ready for painting 2015-05-18 15:30:10 +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 e8b14cd587 [input] Add safety checks before accessing Cursor of focused pointer
There might be no focused pointer and there might be no cursor.
2015-05-08 12:43:44 +02:00
Martin Gräßlin efa0500313 [libinput] Bind libinput support to VirtualTerminal
This change is motivated by the fact that we need to suspend libinput
before switching the virtual terminal. Also we don't want to take over
libinput if we do not have a VirtualTerminal created - in windowed mode
we don't want libinput to be started. So binding it to the backends which
create the VirtualTerminal makes sense.

The KWin::Application gains a new signal virtualTerminalCreated which is
emitted from VirtualTerminal once it's properly setup. This is used by
Input to create Libinput integration instead of binding it to logind.

Furthermore Libinput gets suspended when the VirtualTerminal reports that
it is no longer active. For re-activation we still just use logind's
session active property.
2015-04-24 12:03:19 +02:00
Martin Gräßlin 30dd2ce466 [input] Add support for VT switch shortcuts
If we have a VirtualTerminal and get a XKB_KEY_XF86Switch_VT_* keysym
we trigger a VT switch.
2015-04-01 11:05:45 +02:00
Martin Gräßlin 61579506e3 [input] Only update seat state if session is active
When our session gets inactive libinput loses all devices, thus our
Seat would not have neither keyboard, pointer nor touch. To not confuse
all connected clients we block updates while libinput is suspended. After
resume we check whether something actually changed and emit the
corresponding signals to ensure everything is up to date.
2015-04-01 11:05:45 +02:00
Martin Gräßlin 634fd68446 Ensure screens are created before fully setting up libinput
Parts rely on screens being available but input might be created
before screens are available. Thus connect to signal and delay.
2015-04-01 11:05:45 +02:00
Martin Gräßlin c23e106c8b [input] Include more safety checks
nullptr checks as input events might be processed prior to KWin having
been fully started.
2015-04-01 11:05:45 +02:00
Martin Gräßlin 7a96c3ee46 [input] Disconnect the logind connection once setupLibInput is called
Don't want it to be called again if we lose session control.
2015-04-01 11:05:45 +02:00
Martin Gräßlin 2a39e6290b [input] Try updating the modifiers after each key press
TODO: send new modifier information to wayland server.
2015-04-01 11:05:45 +02:00
Martin Gräßlin b824175e05 [input] Set a default xkb modifier map 2015-04-01 11:05:45 +02:00
Martin Gräßlin f7bed6a003 [libinput] Pass device capabilities to Wayland::Server::SeatInterface
We handle device added/remove to monitor whether we have keyboard,
pointer and touch devices and emit signals. Those are used to update
the SeatInferface from InputRedirection.
2015-03-26 16:19:26 +01:00
Martin Gräßlin 60783b8228 Touch support in libinput 2015-03-25 16:40:17 +01:00
Martin Gräßlin 36f987198d [wayland] Add support for processing touch events
InputRedirection gains basic support for processing touch events which
are delegated to KWayland::Server.

WaylandBackend accepts touch events from KWayland::Client and delegates
them to the InputRedirection.
2015-03-25 14:50:14 +01:00
Martin Gräßlin 405e366815 Add safety check to InputRedirection::findToplevel
InputRedirection might be invoked to process input events prior to
Workspace being started.
2015-03-20 14:43:47 +01:00
Martin Gräßlin 9a0fd94013 Introduce AbstractBackend as base class for Wayland and X11Windowed backend
The AbstractBackend registers itself in the WaylandServer allowing
external users to easily get to the backend and not needing to test
manually which backend is used.
2015-03-20 14:41:03 +01:00
Martin Gräßlin 6bf44b7db4 [wayland] Add an X11 output backend
This new backend allows to start a kwin_wayland server nested on an
X-Server by using a normal X11 window as output. This allows testing
kwin_wayland without needing to start another Wayland server first.

The behavior is triggered by using new command line arguments:
--windowed
--x11-display=<:0>

With optional --width and --height arguments.

In this mode the WaylandBackend is not created at all.

So far the backend is not fully integrated yet and only the QPainter
backend supports this mode.
2015-03-20 14:08:53 +01:00
Martin Gräßlin f600e2f6f4 [wayland] Properly handle Cursor set on focused PointerInterface
This replaces getting the Cursor through the X11CursorTracker which
is now completely dropped. The Cursor data is now passed through from
the Wayland server and forwared to the WaylandBackend.
2015-03-17 10:20:20 +01:00
Martin Gräßlin 7bb107ba6d [wayland] Pass keyboard key press/released events to SeatInterface
Improves handling by no longer sending events with xtest.
2015-03-17 10:20:19 +01:00
Martin Gräßlin c29f96665d [wayland] Pass pointer input events to SeatInterface
Pointer events are no longer sent through the methods on Toplevel,
but properly sent through the SeatInterface. This has the advantage
that SeatInterface properly tracks which is the focused pointer surface
and does not need to use the xtest extension.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 857219546f Update x11Time when a global shortcut is pressed
KGlobalAccel sets the timestamp as a property and we need to set our
x11Time to it otherwise following keyboard grabs might fail.

Requires 61e2a156678eef033b2629f7c72530dc78d7c3ac in kglobalaccel.
2015-02-25 08:15:53 +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