Commit Graph

264 Commits (48fcaa565633176824fa836f49f7969f35a1397e)

Author SHA1 Message Date
Martin Gräßlin cef84cd8a5 Use NETWinInfo::opaqueRegion
REVIEW: 122199
2015-01-26 11:47:40 +01:00
Martin Gräßlin 7e4307b263 Use new KWindowSystem::icon overload taking a NETWinInfo*
Removes roundtrips to the X-server when reading the icons.

Requires kwindowsystem.git as of 6f941a5 (version 5.7).

CCBUG: 329979
2015-01-21 10:19:35 +01:00
Martin Gräßlin 14659a9907 Split Client::checkActivities into two parts
REVIEW: 122087
CCBUG: 329979
2015-01-21 09:25:18 +01:00
Martin Gräßlin 5abccbec7d Split Client::readTransient into two parts 2015-01-21 09:25:15 +01:00
Martin Gräßlin 584bdbce71 Split Client::updateFirstInTabBox into two parts 2015-01-21 09:25:15 +01:00
Martin Gräßlin 327dd406e6 Split Client::updateColorScheme into two parts 2015-01-21 09:25:15 +01:00
Martin Gräßlin a55c7ba0d5 Split Client::updateShowOnScreenEdge into two parts 2015-01-21 09:25:15 +01:00
Martin Gräßlin 24688f8dae Split Client::detectGtkFrameExtents into two parts 2015-01-21 09:25:14 +01:00
Martin Gräßlin 770c723c61 Split Toplevel::getSkipCloseAnimation into two parts 2015-01-21 09:25:14 +01:00
Martin Gräßlin b27d3d20e7 Split Toplevel::getWmClientLeader in two parts
First part (fetch) just creates the Xcb::Property while the
second part (read) reads the property. This allows to better
schedule the commands in Client::manage to reduce the number of
roundtrips. This reduces the time spent for fetching the client
leader property by about half a millisecond on my system.
2015-01-21 09:25:14 +01:00
Martin Gräßlin f643b71902 Use NET::WM2InitialMappingState instead of XWMHints
One roundtrip to X Server during Client::manage removed.

REVIEW: 122068
2015-01-15 13:22:02 +01:00
Martin Gräßlin 3d9a035312 Move MaximizeMode from KDecorationDefines to utils.h
Unfortunately it cannot be a enum defined in Client as client.h
depends on rules.h and with it in Client rules.h would depend on
client.h.
2014-12-02 13:49:08 +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 0f7a990316 Use Protocol support in NETWinInfo instead of fetching them ourselves
Client does no longer need to track the protocols as this is also
provided by NETWinInfo as of version 5.3.

REVIEW: 120255
2014-11-24 10:37:18 +01:00
Martin Gräßlin e32da9d9e0 Merge branch 'master' into kdecorations2
Conflicts:
	CMakeLists.txt
	paintredirector.cpp
	scene_opengl.h
	scene_qpainter.h
	scene_xrender.h
2014-10-20 16:04:52 +02:00
Martin Gräßlin 9fae34f86f Remove Client::getWMHints in favor of functionality in NETWinInfo
We are only using the UrgencyHint, InputHint and GroupLeader from
WMHints. Those are provided by NETWinInfo, so we can use the
functionality provided by NETWinInfo instead of calling XGetWMHints.

REVIEW: 120162
2014-09-15 16:29:47 +02:00
Martin Gräßlin 0030eb7f84 Initial import of support for new KDecoration2 based decorations
NOTE: this is not working completely yet, lots of code is still ifdefed
other parts are still broken.

The main difference for the new decoration API is that it is neither
QWidget nor QWindow based. It's just a QObject which processes input
events and has a paint method to render the decoration. This means all
the workarounds for the QWidget interception are removed. Also the paint
redirector is removed. Instead each compositor has now its own renderer
which can be optimized for the specific case. E.g. the OpenGL compositor
renders to a scratch image which gets copied into the combined texture,
the XRender compositor copies into the XPixmaps.

Input events are also changed. The events are composed into QMouseEvents
and passed through the decoration, which might accept them. If they are
not accpted we assume that it's a press on the decoration area allowing
us to resize/move the window. Input events are not completely working
yet, e.g. wheel events are not yet processed and double click on deco
is not yet working.

Overall KDecoration2 is way more stateful and KWin core needs more
adjustments for it. E.g. borders are allowed to be disabled at any time.
2014-07-25 14:02:26 +02:00
Thomas Lübking 75a298a4fb allow FS mapping of geometry restricted windows
and copy isSpecialWindow() check as rulebook input
to setFullscreen()

Client::isFullScreenable() checks:
* fullscreen rule
* fullscreen_hack (-> for normal windows)
* geometry restrictions
* special window

Client::manage() for fullscreeining checks:
* fullscreen rule (with correct "initial" parameter)
* fullscreen_hack

-> this breaks the fullscreen rule for geometry restricted windows
and causes inconsistent behavior between client requests at runtime
(which do not test ::isFullScreenable()) and on mapping.

Otoh, the specialWindow() protection should apply generally - those
kind of windows should not be fullscreened since the user can not
exit this state via kwin for them - and there's hardly a good reason
for them to be fullscreen, esp. not to enter that state at runtime

REVIEW: 118442
CCBUG: 335617

Cherry-picked from kde-workspace
43229afee9fac4303e3d280ea63f96f034b3ffb5
2014-07-10 13:36:50 +02:00
Martin Gräßlin f0e1e3187e Add a script to enforce window decorations for GTK windows
This is going to be a controversal change. It enforces KWin decorations
on all client side decorated windows from GTK+. Unfortunately we are
caught between a rock and a hard place. Keeping the status quo means
having broken windows and a more or less broken window manager due to
GTK+ including the shadow in the windows. This is no solution.
Enforcing server side decorations visually breaks the windows. This is
also no solution. So why do it?

It's our task to provide the best possible user experience and KWin is
a window manager which has always done great efforts to fix misbehaving
windows. One can think of the focus stealing prevention, the window rules
and lately the scripts. The best possible window management experience is
our aim. This means we cannot leave the users with the broken windows
from GTK.

The issues we noticed were reported to GTK+ about 2 months ago and we are
working on improving the situation. Unfortunately several issues are not
yet addressed and others will only be addressed in the next GTK+ release.
We are working on improving the NETWM spec (see [1]) to ensure that the
client side decorated windows are not in a broken state. This means the
enforcment is a temporary solution and will be re-evaluated with the next
GTK release. I would prefer to not have to do such a change, if some of
the bugs were fixed or GTK+ would not use client-side-decos on wms not
yet supporting those all of this would be a no issue.

For a complete list of the problems caused by GTK's decos see bug [2] and
the linked bug reports from there.

The change is done in a least inversive way in KWin. We just check for
the property _GTK_FRAME_EXTENTS and create a Q_PROPERTY in Client for it.
If we add support for the frame extents in future we would also need
this. So it's not a change just for enforcing the decoration.

The actual enforcing is done through a KWin script so users can still
disable it.

REVIEW: 119062

[1] https://mail.gnome.org/archives/wm-spec-list/2014-June/msg00002.html
[2] https://bugzilla.gnome.org/show_bug.cgi?id=729721
2014-07-03 16:03:22 +02:00
Thomas Lübking d6ea601005 keep oversized windows in fullscreen area
huge windows are not contrained to their initial screen
(the user might want to move them to the other instead),
but we must not let them drop out of the fullscreen area
either

CCBUG: 335043

Forward port of d7c2434a9e144dd2e7f1519d78b333e7d4d3bfc7 from kde-workspace
2014-06-04 16:30:29 +02:00
Martin Gräßlin 8543033d59 Reparent decoration window by using a QWindow wrapper for the frame
Qt doesn't like that we reparent the decoration using low level xcb
calls. So let's use a QWindow wrapper for the frame and let Qt do
the reparenting itself.

BUG: 334768
REVIEW: 118159
2014-06-03 09:22:18 +02:00
Martin Gräßlin 75f80e88ed Port Client::manage away from XGetWindowAttributes
Replaced by Xcb::WindowAttributes and Xcb::WindowGeometry. Also arguments
of Client::embedClient are adjusted to take the required values directly.
2014-05-05 08:09:10 +02:00
Martin Gräßlin b039a07f4d Toplevel::vis becomes Toplevel::m_visual and is xcb_visualid_t
Only usage of the ::vis was the visualid, so have this as the member
instead of the XVisual*.
2014-05-05 08:09:10 +02:00
Martin Gräßlin fd0fd82ad6 Use NETWM to get updates on blocking compositing
Adds NET::WM2BlockCompositing to the Client's properties which allows to
read the state from the NETWinInfo object and get updates without having
to resolve the atom ourselve.

REVIEW: 117561
2014-04-14 15:34:39 +02:00
Martin Gräßlin c63e3533f4 Get Toplevel::resourceName() and ::resourceClass() from NETWinInfo
It's provided by the NETWinInfo, no need to keep an own implementation.
To keep compatibility with existing KWin code using the window class or
resource it's always converted to lower.

In addition a notify signal Toplevel::windowClassChanged is added and
emitted from the event handler whenever the WM2WindowClass property is
set.

REVIEW: 117496
2014-04-14 08:46:38 +02:00
Martin Gräßlin f1f6d6eea8 Get windowRole from NETWinInfo instead doing it ourself
NETWinInfo provides windowRole if NET::WM2WindowRole is added to the
properties2. Thus KWin doesn't need to monitor and fetch itself, but
can just wrap the data provided by NETWinInfo.

In addition a signal is added to Toplevel whenever the window role
changes.

REVIEW: 117470
2014-04-10 15:57:00 +02: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 2675b5d4e7 Merge branch 'KDE/4.11'
Conflicts:
	CMakeLists.txt
	kcontrol/screensaver/screensaver.desktop
	kdm/kfrontend/themes/elarun/KdmGreeterTheme.desktop
	khotkeys/kcm_hotkeys/kcm_hotkeys.cpp
	kinfocenter/main.cpp
	kscreensaver/kblank_screensaver/blankscrn.cpp
	kscreensaver/krandom_screensaver/random.cpp
	kstyles/oxygen/config/main.cpp
	kstyles/oxygen/demo/main.cpp
	ksysguard/gui/ksysguard.cpp
	kwin/clients/oxygen/demo/main.cpp
	kwin/kcmkwin/kwincompositing/kwincompositing.desktop
	kwin/tabbox/qml/clients/text/metadata.desktop
	kwin/tabbox/qml/clients/window_strip/metadata.desktop
	libs/plasmagenericshell/widgetsexplorer/package/metadata.desktop
	plasma/desktop/applets/pager/package/metadata.desktop
	plasma/desktop/shell/activitymanager/package/metadata.desktop
	plasma/desktop/shell/data/layouts/org.kde.plasma-desktop.defaultPanel/contents/layout.js
	plasma/desktop/shell/desktopcorona.cpp
	plasma/desktop/shell/main.cpp
	plasma/desktop/toolboxes/plasma-toolbox-desktoptoolbox.desktop
	plasma/desktop/toolboxes/plasma-toolbox-paneltoolbox.desktop
	plasma/generic/applets/batterymonitor/contents/ui/batterymonitor.qml
	plasma/generic/applets/systemtray/protocols/fdo/fdographicswidget.cpp
	plasma/generic/applets/systemtray/protocols/fdo/fdographicswidget.h
	plasma/generic/applets/systemtray/protocols/fdo/x11embeddelegate.cpp
	plasma/generic/runners/nepomuksearch/plasma-runner-nepomuksearch.desktop
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
	plasma/netbook/shell/nettoolbox/plasma-toolbox-nettoolbox.desktop
	statusnotifierwatcher/statusnotifierwatcher.cpp
	systemsettings/app/main.cpp
2014-03-10 21:21:16 +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
Thomas Lübking a0a976885c ensure to show clients that need sessionInteract
transients of minimized windows are not shown, thus missed
the sessionSavin branch
since window input is also largely blocked (eg. taskbar!)
they cannot easily be unshown (including their transients)
and thus block logout forever

REVIEW: 115955
2014-02-24 20:12:08 +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 ffaa9d336e Merge branch 'KDE/4.11'
Conflicts:
	kcontrol/workspaceoptions/workspaceoptions.desktop
	kwin/sm.cpp
2014-01-29 20:28:27 +01:00
Thomas Lübking 6bd74cebf3 no autogrouping if deco doesn't support it
BUG: 328272
FIXED-IN: 4.11.6
REVIEW: 115308
2014-01-29 19:58:32 +01:00
Martin Gräßlin 882d55f1b5 Allow windows to specify that they should not get animated on window close
By setting the X property _KDE_NET_WM_SKIP_CLOSE_ANIMATION to 1 a window
can request to be excluded from any close animation. This property is
read in Toplevel, so that it is available to both Client and Unmanaged.

If the window has this property set the Scene suppresses the paintWindow
loop of the Deleted. Thus no effect needs to be adjusted. But an effect
using drawWindow directly would still be able to render the Deleted as
there is no suppression.

Furthermore the property is passed to the EffectWindow so that an
Effect can make use of this functionality and not start the animation
in the first place.

REVIEW: 115288
CCBUG: 279615

Backported from 9497b4ddb681ac50dbe9c015e05a3f12fd496da8
2014-01-28 09:01:55 +01:00
Martin Gräßlin 2fbc8414a7 Allow windows to specify that they should not get animated on window close
By setting the X property _KDE_NET_WM_SKIP_CLOSE_ANIMATION to 1 a window
can request to be excluded from any close animation. This property is
read in Toplevel, so that it is available to both Client and Unmanaged.

If the window has this property set the Scene suppresses the paintWindow
loop of the Deleted. Thus no effect needs to be adjusted. But an effect
using drawWindow directly would still be able to render the Deleted as
there is no suppression.

Furthermore the property is passed to the EffectWindow so that an
Effect can make use of this functionality and not start the animation
in the first place.

REVIEW: 115288
2014-01-28 07:43:35 +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
Thomas Lübking feafbca941 Merge branch 'KDE/4.11' 2013-09-24 21:33:46 +02:00
Thomas Lübking 51c3c6cc42 no VD change for activation & unreasonable policy
F(S)UM mean "the focus is where the mouse is"
the mouse is not on the other virtual desktop
(and it was even granted regardless of the actual geometry/position)

The "unreasonable" focus policies expose an issue about
the present linked handling of "allow activation" and
"allow raising" (see https://git.reviewboard.kde.org/r/110919/ )

Activation would match "extreme" (if the window maps on the same
virtual desktop, half a mile away from the mouse, it won't
receive the focus) but not regarding raising (which is actually
an issue entirely different from FSP)

REVIEW: 112585
CCBUG: 80897
2013-09-24 21:23:36 +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
Martin Gräßlin 3ee886be2d Add setBorderWidth() method to Xcb::Window
Performs the configure window call.
2013-09-10 15:30:10 +02:00
Martin Gräßlin 48f32b3bca Use Xcb::Window::selectInput where useful
Replacing to direct xcb commands with our wrapper.
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 4215599e97 And add a lower() method to Xcb::Window
Just like ::raise().
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 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
Martin Gräßlin 139201a2e2 KGlobal::config() -> KSharedConfig::openConfig()
KWin Core says good bye to KGlobal. We will not miss the threading
issues.
2013-09-04 16:11:40 +02:00
Thomas Lübking 7d6d80351c align zero corner placement to client, not deco
BUG: 318107
FIXED-IN: 4.11.1
REVIEW: 112102
2013-08-27 07:53:02 +02:00
Martin Gräßlin e21225fa47 Use XCB Shape instead of XLib Shape in KWin core 2013-08-20 09:48:14 +02:00