Commit Graph

899 Commits (c5def47bf576d5f08e3173b7f41f5f5deebff8d5)

Author SHA1 Message Date
Martin Gräßlin 6baf794f88 InputRedirection for keyboard events
Major new functionality is xkbcommon support. InputRedirection holds an
instance to a small wrapper class which has the xkb context, keymap and
state. The keymap is initialied from the file descriptor we get from the
Wayland backend.

InputRedirection uses this to translate the keycodes into keysymbols and
to QString and to track the modifiers as provided by the
Qt::KeybordModifiers flags.

This provides us enough information for internal usage (e.g. pass through
effects if they have "grabbed" the keyboard).

If KWin doesn't filter out the key events, it passes them on to the
currently active Client respectively an unmanaged on top of the stack.
This needs still some improvement (not each unmanaged should get the
event). The Client/Unmnaged still uses xtest extension to send the key
events to the window. So keylogging is still possible.
2014-03-18 09:00:50 +01:00
Martin Gräßlin 7d48b92e2b Redirect pointer events to the Toplevel
InputRedirection keeps track of the Toplevel which is currently the one
which should get pointer events. This is determined by checking whether
there is an Unmanaged or a Client at the pointer position. At the moment
this is still slightly incorrect, e.g. pointer grabs are ignored,
unmanaged are not checked whether they are output only and input shapes
are not yet tracked.

The pointer events are delivered to the Toplevel as:
* enter
* leave
* move
* button press
* axis event

Nevertheless move events are still generated in InputRedirection through
xcb test for simplicity. They are still send to the root window, so all
windows get mouse move.

Button press and axis are generated only in the implementations of the
event handlers and delivered directly to the window, so other windows
won't see it.
2014-03-18 09:00:50 +01:00
Aleix Pol c72e519d9c Remove KDE/ prefix in include directories
It's unneeded and deprecated since KF5.
2014-03-17 16:24:10 +01:00
Martin Gräßlin b0c0e81661 Adjust kde-workspace to changes in NETWMClient
ctor changed to take NET::Properties and NET::Properties2.
2014-03-17 08:13:14 +01:00
Martin Gräßlin aee20b4a5a Hide the OnAllDesktops button if there is only one virtual desktop
In KCommonDecoration the OnAllDesktops button gets hidden or shown
depending on the number of desktops. For that KDecoration is extended
by a new property which delegates to the bridge to return whether
onAllDesktops is available. In KWin Core this is implemented using
the number of desktops.

FEATURE: 321611
FIXED-IN: 5.0.0
REVIEW: 116076
2014-03-05 13:02:32 +01:00
Martin Gräßlin 4dff7888e3 [kwin] Drop build option to build without scripting
Scripting has proved it's point of being useful so it's time to turn it
into a mandatory part of KWin.

Also I start to use features provided by Scripting in more and more
parts of KWin core (e.g. sharing QQmlEngine) which makes it in the
long to complicated to have a build option and ifdefs for it.

REVIEW: 116587
2014-03-04 08:19:55 +01:00
Martin Gräßlin ed4a0d0319 Screenedge show support for Clients
This provides a new protocol intended to be used by auto-hiding panels
to make use of the centralized screen edges. To use it a Client can
set an X11 property of type _KDE_NET_WM_SCREEN_EDGE_SHOW to KWin.
As value it takes:
* 0: top edge
* 1: right edge
* 2: bottom edge
* 3: left edge

KWin will hide the Client (hide because unmap or minimize would break
it) and create an Edge. If that Edge gets triggered the Client is shown
again and the property gets deleted. If the Client doesn't border the
specified screen edge the Client gets shown immediately so that we
never end in a situation that we cannot unhide the auto-hidden panel
again. The exact process is described in the documentation of
ScreenEdges. The Client can request to be shown again by deleting the
property.

If KWin gets restarted the state is read from the property and it is
tried to create the edge as described.

As this is a KWin specific extension we need to discuss what it means
for Clients using this feature with other WMs: it does nothing. As
the Client gets hidden by KWin and not by the Client, it just doesn't
get hidden if the WM doesn't provide the feature. In case of an
auto-hiding panel this seems like a good solution given that we don't
want to hide it if we cannot unhide it. Of course there's the option
for the Client to provide that feature itself and if that's wanted we
would need to announce the feature in the _NET_SUPPORTED atom. At the
moment that doesn't sound like being needed as Plasma doesn't want to
provide an own implementation.

The implementation comes with a small test application showing how
the feature is intended to be used.

REVIEW: 115910
2014-02-26 12:54:00 +01:00
Martin Klapetek 70fd9d6b58 [kwin] Client of type NET::Notification should have no borders
Reviewed-by: Martin Gräßlin
2014-02-12 10:53:33 +01:00
Martin Gräßlin fdee4ea8c8 Adjust kde-workspace to introduction of flags in NET classes 2014-02-05 17:40:19 +01:00
Thomas Lübking 66375ad741 Merge branch 'KDE/4.11'
Conflicts:
	kwin/effects/mouseclick/mouseclick.cpp
	plasma/generic/scriptengines/python/plasma-scriptengine-dataengine-python.desktop
	plasma/generic/scriptengines/python/plasma-scriptengine-runner-python.desktop
	plasma/generic/scriptengines/ruby/plasma-scriptengine-ruby-applet.desktop
	plasma/generic/scriptengines/ruby/plasma-scriptengine-ruby-dataengine.desktop
2014-01-30 20:55:35 +01:00
Thomas Lübking 62b277ad9f depend noborder on motif_noborder after reshape
app_noborder shall be the determined noborder (shape, type)
but relevant noborder shall be determined by rules and respect the
motif hint

BUG: 330573
FIXED-IN: 4.11.6
REVIEW: 115402
2014-01-30 20:25:09 +01:00
Thomas Lübking 4bb88df714 Merge branch 'KDE/4.11' 2014-01-14 22:51:24 +01:00
Thomas Lübking c378bf4f7c emit desktopPresenceChanged from Client:setDesktop
and forward it to scripted effects

CCBUG: 326903
REVIEW: 114080
2014-01-14 22:23:49 +01:00
Martin Gräßlin 2372e02752 [kwin] Use a QIcon in Client for the icons instead of Pixmaps
Client used to have dedicated methods for different icon sizes instead
of combining all pixmaps into one QIcon. This resulted in various parts
of KWin having different access to the icons:
* effects only got one pixmap of size 32x32
* decorations only got the 16x16 and 32x32 pixmaps combined into a QIcon
* tabbox could request all icon sizes, but only as pixmap

Now all sizes are available in one QIcon allowing to easily access the
best fitting icon in a given UI.
2013-12-06 14:41:23 +01:00
Martin Gräßlin 7aeec8ef89 [kwin] Drop dead code
kwin_get_menu_pix_hack was no longer used anywhere.
2013-12-06 11:21:07 +01:00
Martin Gräßlin 49cf996aa7 [kwin] Window specific rule for decoration color scheme
Adds a new force rule to specify the color scheme to use on the window
decoration. The scheme is stored by the name of the .colors file name.
So for Oxygen.colors the value is Oxygen.

When loaded the scheme is located and the full path to the colors file
is used. This is because the X property also uses the full path.
2013-11-25 09:44:23 +01:00
Martin Gräßlin 302271ce97 [kwin] Client supports an X property for color scheme
The X property _KDE_NET_WM_COLOR_SCHEME can be set on a window and
specifies the absolute path to a .color file describing the color
scheme of the managed client.

The Client reads this property and creates a QPalette from it. If
the property is not set or the value is incorrect, the Client uses
KWin's default palette.

The idea behind this property is to allow an application with a
custom color scheme to tell KWin which color scheme the window
decoration should use. So that the window looks as a solid pattern
again.
2013-11-25 09:41:24 +01:00
Martin Gräßlin ba66fd9ef6 [kwin] NETWinInfo2 becomes NETWinInfo
And takes a xcb_connection_t instead of Display. Also our own class
is adjusted to no longer need the connection being passed in.
2013-11-18 13:56:28 +01:00
Martin Gräßlin 2c9e21a983 [kwin] Use XCB Atom enum definition instead of XLib's one 2013-11-18 13:48:31 +01:00
Martin Gräßlin 695697ebbd [decorations] Allow Client to use QWindow based decorations
Shared implementation using the delegating methods in KDecoration
which uses either QWindow or QWidget where possible.
2013-11-14 09:41:51 +01:00
Martin Gräßlin 8ecb69cd8c [decorations] Add a KDecoration::window() returning the QWindow
KWin core can access the QWindow of the decoration instead of the
QWidget. This is a preparation step to allow QWidget based window
decorations without any QWidgets at all.

KWin core makes already use of this new accessor to get the window Id
which is also on QWidgets provided through the QWindow.
2013-11-14 09:41:50 +01:00
Martin Gräßlin 1deea69170 [paintredirector] Pass KDecoration to PaintRedirector
Gives us more power in the future.
2013-11-14 09:41:50 +01:00
Martin Gräßlin c32ec9b32b [kwin] Work around broken xcb_sync_create_alarm
The xcb sync protocol is incorrectly defined (see [1]) which results in
xcb_sync_create_alarm not creating a valid alarm. To work around this
issue we only create the alarm without setting the int64 values. For
those we use the XLib XSyncChangeAlarm call after we verified that the
alarm got created. This unfortunately reintroduces linking against
libxext. But at least resizing works again.

[1] http://lists.freedesktop.org/archives/xcb/2013-June/008375.html
2013-11-11 11:36:26 +01:00
Bhushan Shah 935851a2b5 kDebug -> qDebug in kwin 2013-11-01 17:00:41 +05:30
Thomas Lübking 3594550b14 Merge branch 'KDE/4.11'
Conflicts:
	kwin/eglonxbackend.cpp
	kwin/glxbackend.cpp
2013-09-25 23:21:36 +02:00
Thomas Lübking 06b482f725 pack to client, not deco
this makes packing following the snapping behavior

REVIEW: 112807
2013-09-25 23:09:08 +02:00
Martin Gräßlin 969e6b85e7 Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/client.cpp
	kwin/effects/highlightwindow/highlightwindow.cpp
	kwin/libkwineffects/kwingltexture.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/scene_opengl.cpp
	kwin/workspace.cpp
	plasma/desktop/applets/kickoff/CMakeLists.txt
	plasma/desktop/applets/taskmanager/package/contents/code/tools.js
	plasma/desktop/applets/taskmanager/package/contents/ui/Task.qml
	plasma/desktop/applets/taskmanager/package/contents/ui/main.qml
	plasma/desktop/applets/taskmanager/package/metadata.desktop
	plasma/desktop/applets/taskmanager/plugin/textlabel.h
	plasma/desktop/applets/tasks/CMakeLists.txt
	plasma/desktop/applets/tasks/package/metadata.desktop
	plasma/desktop/applets/tasks/tasks.cpp
	plasma/desktop/toolboxes/plasma-toolbox-desktoptoolbox.desktop
	plasma/generic/applets/activitybar/activitybar.cpp
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-09-24 11:28:38 +02:00
Thomas Lübking 66ffd9f0f6 input window: ensure input shaping is supported
BUG: 320459
FIXED-IN: 4.11.2
REVIEW: 112623
2013-09-24 00:50:54 +02:00
Martin Gräßlin e553d2869d Move the decoration window back to the padding position after each resize
Behavior seems to have changed in Qt 5. Without doing the move the deco
has a wrong position and all mouse interaction is broken after the first
resize.

And with this change Oxygen windeco in compositing is fully functional!
2013-09-13 13:56:09 +02:00
Martin Gräßlin 7aadeaa310 Add maximized property and changed signal to KDecoration
Replaces the pure virtual method which the Decoration had to
implement. Instead the Decoration can now connect to the signal.

For KCommonDecoration there is no change at all except that the
invoked method is turned into a slot.

The property is of type bool and maps to isMaximized and not to
maximizeMode.
2013-09-12 09:27:39 +02:00
Martin Gräßlin 22e4476777 Add icon property and changed signal to KDecoration
Replaces the pure virtual method which the Decoration had to
implement. Instead the Decoration can now connect to the signal.

For KCommonDecoration there is no change at all except that the
invoked method is turned into a slot.
2013-09-12 09:27:39 +02:00
Martin Gräßlin 63bb36e2ad Add shade property and changed signal to KDecoration
Replaces the pure virtual method which the Decoration had to
implement. Instead the Decoration can now connect to the signal.

For KCommonDecoration there is no change at all except that the
invoked method is turned into a slot.
2013-09-12 09:27:39 +02:00
Martin Gräßlin fd64a29f72 Add desktop property and changed signal to KDecoration
Replaces the pure virtual method which the Decoration had to
implement. Instead the Decoration can now connect to the signal.

For KCommonDecoration there is no change at all except that the
invoked method is turned into a slot.

Also isOnAllDesktop property is added using the same changed
signal as desktop property.
2013-09-12 09:27:39 +02:00
Martin Gräßlin 29bce13e9f Add caption property and changed signal to KDecoration
Replaces the pure virtual method which the Decoration had to
implement. Instead the Decoration can now connect to the signal.

For KCommonDecoration there is no change at all except that the
invoked method is turned into a slot
2013-09-12 09:27:39 +02:00
Martin Gräßlin e1c4512ccc Add active property and changed signal to KDecoration
Replaces the pure virtual method which the Decoration had to
implement. Instead the Decoration can now connect to the signal.

For KCommonDecoration there is no change at all except that the
invoked method is turned into a slot.
2013-09-12 09:27:39 +02:00
Martin Gräßlin d10a31750e Drop reset method from K(Common)Decoration
For the only remaining update flag a dedicated signal is added to
KDecoration.
2013-09-12 09:27:38 +02:00
Martin Gräßlin a90072d753 Merge KDecorationUnstable into KDecoration
Also KCommonDecorationUnstable is merged into KCommonDecoration.
2013-09-12 09:27:38 +02:00
Martin Gräßlin 75fe5f6965 Port Client::firstInTabBox to XCB
That code needs testing with Plasma Active.
2013-09-11 08:39:17 +02:00
Martin Gräßlin e687c91402 Add a changeProperty method to Xcb::Window
Used from Client to directly change properties on its client.
2013-09-10 15:30:11 +02:00
Martin Gräßlin 4173de1164 Port remaining set input focus to XCB 2013-09-10 15:30:11 +02:00
Martin Gräßlin e3a1cc0b5d Add deleteProperty() method to Xcb::Window
Calls xcb_delete_property on the managed window with the passed in
xcb_atom_t.
2013-09-10 15:30:10 +02:00
Martin Gräßlin 49da9a8fdb Add a reparent() method to Xcb::Window
Reparents the managed window to the passed in parent window.
2013-09-10 15:30:10 +02:00
Martin Gräßlin 070921f114 Add a kill() method to Xcb::Window 2013-09-10 15:30:10 +02:00
Martin Gräßlin 484c61a81e Use Window wrapper methods for manipulating the frame
And by that it's also mostly ported to XCB.
2013-09-10 15:30:10 +02:00
Martin Gräßlin cfd93246b3 Toplevel::frameId() becomes virtual
The frameId only makes sense for a Client, in case of Unmanaged the
same window id is used as for the window() handle. Client creates the
frame and destroys it.

Given that it makes sense to let Client manage the frame properly.
The ::frameId() is therefore virtual and as base implementation it
returns the client id. Client reimplements it and returns the proper
frame id.

Method is also implemented in Deleted as it used to be passed to
deleted.
2013-09-10 15:30:10 +02:00
Martin Gräßlin 4e5a44e23c XMapWindow(wrapperId()) -> m_wrapper.map() 2013-09-10 15:30:10 +02:00
Martin Gräßlin ba7c5936fe Use Client::m_client instead of Toplevel::window() where useful
Allows to use .setGeometry() instead of XMoveResizeWindow.
2013-09-10 15:30:10 +02:00
Martin Gräßlin 0d9ab27798 Use the wrapper methods for Client::m_client instead of xcb_foo 2013-09-10 15:30:10 +02:00
Martin Gräßlin c1483f41d4 Use Xcb::Window wrapper class for Client::m_client
Now we can use the wrapper for the client which we manage.
2013-09-10 15:30:10 +02:00
Thomas Lübking f1346494f6 connect iconChanged to decoration
broke with 9eaee286c55717d26535d3dc9e543c0285740d9a

BUG: 324355
FIXED-IN: 4.11.2
REVIEW: 112435
2013-09-08 23:43:19 +02:00