Commit Graph

1051 Commits (cd293220bb9b2f794dae39b415613b2cb97ea896)

Author SHA1 Message Date
Martin Gräßlin 6eb104b32a Introduce an OperationMode enum
This enum describes how KWin is operating with the available windowing
systems. By default KWin is using the OperationModeX11, but if the
Wayland backend gets started KWin is using the OperationModeWaylandAndX11

This will be extended in future when XWayland and Wayland only become
viable options.
2014-01-09 15:16:33 +01:00
Martin Gräßlin 0c559c163d New QPainter based compositor called SceneQPainter
This compositor uses only the QPainter API to perform rendering. The
window's X Pixmap is mapped to a QImage using XShm. As rendering backend
a QImage is used.

The new compositing type "QPainterCompositing" is introduced. Effects
need to be adjusted to explicitly check the compositing type and no
longer assume the compositing type is XRender if it's not OpenGL.

This compositor can be selected with using "Q" as the value for
KWIN_COMPOSE env variable or setting the config value to "QPainter".
The GUI is not yet adjusted to select this compositor.

The QPainter scene provides currently the following features:
* 2D transformations (translation and scalation)
* opacity modifications
* rendering of decorations (new PaintRedirector sub class)
* rendering of shadows
* rendering of effect frames
* rendering to a Wayland surface

The following features are currently not provided:
* saturation changes
* brightness changes
* 3D transformations
* rendering to X Overlay window
* offscreen rendering (e.g. needed for screen shot effect)
* custom rendering in the effects to the current back buffer
2014-01-09 13:29:40 +01:00
Martin Gräßlin 0f09f00210 WaylandBackend becomes a KWin Singleton
The backend gets created by Workspace, but only if the environment
variable WAYLAND_DISPLAY is set.

Because of that the egl wayland backend does no longer create the
backend, but uses the already created one.
2014-01-08 09:22:40 +01:00
Martin Gräßlin 08a09d27f8 [kwin] Remove the KActionCollection for the client keys
Not needed as we can also find the action as a child of Workspace.
2013-12-10 10:15:23 +01:00
Martin Gräßlin a6f32bf3e8 [kwin] Do not use a KActionCollection for Workspace's global shortcut actions
The ActionCollection was only used for two features:
* setting the object name
* finding the action for retrieving it's shortcut

This can also be achieved by just setting the object name and searching
for the children of the Workspace singleton.
2013-12-10 10:01:13 +01:00
Martin Gräßlin 81a7a528bb [kwin] Block global shortcuts without KGlobalSettings
DBus call directly to kglobalacceld and don't wait for a signal to
come back.
2013-12-06 10:28:42 +01:00
Martin Gräßlin 9f6f0dd688 [kwin] Drop reaction on SETTINGS_SHORTCUTS changed
This looks mostly like dead code. The change got only emitted by the
KCMKeyboard on save. In ancient times this seems to have caused to
re-read the global shortcuts. Code got commented out during KDE4 times
and after several code refactors all that was left of it was discarding
the user actions menu.
2013-12-06 10:20:10 +01:00
Martin Gräßlin 09958a6b1c [kwin] Connect to refreshFonts from KDEPlatformTheme
Replaces one usage of KGlobalsettings. It might be a good idea to
move the connect into libkdecoration or into the options as it looks
like there is no need to reconfigure everything just because the fonts
changed.
2013-12-06 10:00:44 +01:00
Martin Gräßlin f7ff03f30b [kwin] Remove usage of KDE_VERSION_STRING
Replaced by KWIN_VERSION_STRING where useful. Support information
no longer contains the SC version number. We have to see whether
there will be a useful framework based platform information.
2013-12-05 17:20:14 +01:00
Martin Gräßlin e1b5716228 [kwin] Adjust to API-changes in NETRootInfo 2013-11-18 13:58:35 +01:00
Martin Gräßlin d6a69aea4f [kwin] NETRootInfo::setDesktopGeometry doesn't expect a desktop argument any more 2013-11-18 13:57:06 +01: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 d29b9bf03a Introduce a compositingChanged signal in KDecorationOptions
Connected from a signal in DecorationPlugins in KWin core replacing
the previous reset method.
2013-09-12 09:27:38 +02:00
Martin Gräßlin e923426930 Add a recreateDecorations signal to KDecorationFactory
A factory is supposed to emit this signal whenever the decorations
need to be recrated. The DecorationPlugins inside KWin Core connect
to the signal and recreate the decorations.

This signal is supposed to replace the reset method which encoded
this information in the return value and which is already ignored.
2013-09-12 09:27:38 +02:00
Martin Gräßlin e2583e679f No longer pass changed mask from KWin core to the decorations
The changed mask is going to be replaced by more specific signals so
we don't need to calculate the change mask in KWin core anymore.

We still need to call reset in the decoration plugin to check whether
a new decoration library needs to be loaded.
2013-09-12 09:27:38 +02:00
Martin Gräßlin 1121b2abb0 Port setting kwin_running atom to XCB 2013-09-10 15:30:11 +02:00
Martin Gräßlin 592ea89b01 Port all remaining XDeleteProperty calls to XCB 2013-09-10 15:30:10 +02:00
Martin Gräßlin 1398f9ed04 Remove left-over from disable global shortcuts removal
There used to be an own action collection in KDE 3 times for the
block global shortcuts shortcut. But the code ws disabled and by
that I didn't see it during removing the global shortcuts blocking.
And it explains why the global shortcut blocking didn't work.
2013-09-09 09:53:39 +02:00
Martin Gräßlin 8a78e71c97 Drop KWin::Extensions from kwinglobals
Replaced by KWin::Xcb::Extensions. This removes the remaining
Xlib extension dependencies form kwineffects.
2013-09-05 09:14:09 +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
Martin Gräßlin 57905c0cc2 And we got rid of KDebug
Usages of kBacktrace got dropped.
2013-09-02 13:14:39 +02:00
Martin Gräßlin 0dd7adf5f5 Port KWin::Application to QApplication and QCommandLineParser
Done in one step as it requires changes which are better suited with a
QApplication.

To not need to parte the QCommandLineParser around the needed arguments
are added to the KWin::Application through setters and the crash count
is available through a static getter/setter pair.
2013-08-28 14:13:39 +02:00
Martin Gräßlin 8621b4e46d Use qApp instead of kapp in KWin
Preparation step for porting away from KApplication. Disables a little
bit more session management code (as it's broken anyway).
2013-08-28 14:13:39 +02:00
Thomas Lübking e4d386b76e print active screen strategy, blocking for retrace
REVIEW: 112162
2013-08-25 17:05:37 +02:00
Martin Gräßlin d973194c36 Use an XCB replacement for XSelectInput
Wrapped in xcbutils.

In addition the check whether another WM is running in main.cpp is
improved by doing a checked request and directly checking for the
error. If there is an error, KWin puts out an error message and
quits.
2013-08-19 10:52:22 +02:00
Thomas Lübking a3357695a7 make stacking_order exclusive during shutdown
Client::releaseClient() deletes all Client objects
referenced by stacking_order, thus those pointers
dangle and everything trying to touch it died an ugly death.

REVIEW: 112020
BUG: 323383
2013-08-13 21:39:17 +02:00
Martin Gräßlin e72c52d075 Move first updateXTime() in Workspace ctor to init
It's needed for Client initialization and that early the integration
with Qt is not yet working correctly (dropping to endless loop).
2013-08-13 10:16:12 +02:00
Martin Gräßlin 9291b18cee Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/effects.cpp
	kwin/effects/logout/logout.cpp
	kwin/effects/presentwindows/main.qml
	kwin/effects/presentwindows/presentwindows.cpp
	kwin/effects/presentwindows/presentwindows.h
	kwin/effects/zoom/zoom_config.cpp
	kwin/libkwineffects/kwinglutils_funcs.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/nvidiahack.cpp
	kwin/xcbutils.h
	plasma/desktop/containments/desktop/plasma-containment-desktop.desktop
	plasma/generic/wallpapers/image/image.cpp
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-08-07 10:10:06 +02:00
Martin Gräßlin 3d414b908a Remove kapplication.h include from sm.h
Not needed in sm.h and pollutes the includes of most header files.
2013-08-06 11:20:28 +02:00
Martin Gräßlin 46f57221e4 Mouse motion event compression
Using a QTimer to move the resize/move related code to the end of the
event queue. In case there is another motion event in the queue it will
cancel the timer.
2013-08-06 11:20:27 +02:00
Martin Gräßlin 330d40f425 Fix no cast to/from ASCII intrduced issues
* "" needs to be wrapped in QStringLiteral
* QString::fromUtf8 needed for const char* and QByteArray
* QByteArray::constData() needed to get to the const char*
2013-07-24 09:58:33 +02:00
Martin Gräßlin 2f9ff5591c Drop support for native graphics system
Qt 5 only supports raster which means our pixmaps are always non native,
so we don't need the Extension information any more and can drop all
special code handling for mapping a native QPixmap to an X11 pixmap.
2013-07-24 09:46:54 +02:00
Thomas Lübking 89a1027ac8 fix secondary test for hiding utility windows
broke with 2ae475ce
CCBUG: 320921
REVIEW: 111302
2013-07-01 21:19:52 +02:00
Thomas Lübking 3f69a5d09b move Screens::create post global config reading
It calls KConfigGroup what is not thread safe and
collides with threaded config reading.

BUG: 321164
FIXED-IN: 4.11
REVIEW: 111082
2013-06-26 12:42:09 +02:00
Thomas Lübking fab8aa9a12 update composite blocking from deleted, not client
fixing bug by deferring the deletion and removal of the
deleted to the next event cycle had the side effect that
this now happens in the event cycle of the compositor
restart, which was deferred to avoid precisely that...

so the test is now moved to the removal of the deleted
which got an additional flag wasClient to avoid calling
this action for each and every tooltip (and might be usable
elsewise)

BUG: 321537
FIXED-IN: 4.11
REVIEW: 111204
2013-06-26 12:42:09 +02:00
Martin Gräßlin 17e38f3357 Remove "Block global shortcuts" global shortcut
This shortcut did not make any sense to me, because you could block the
global shortcuts for KWin, but not re-enable them again. So once blocked,
it was blocked for ever till kwin --replace &.

This is in opposite to the commit message which introduced it
(see BUG 108961).

REVIEW: 110364
2013-05-28 08:02:12 +02:00
Martin Gräßlin 2be7da70e0 Adding support information for Decorations
Unfortunately only information available through the factory can be read.
As Factory is not a QObject we cannot use the Q_SLOT trick to get further
information dynamically from the loaded decoration plugin.

REVIEW: 110665
2013-05-28 07:37:42 +02:00
Martin Gräßlin 1446fd6a38 Fix printing of GLSL version in supportInformation
If GLSL was supported, but not limited the information did not get added
to the output.
2013-05-22 09:18:05 +02:00
Martin Gräßlin d305185247 Remove Workspace pointer from Toplevel
Instead have a simple workspace() method returning the pointer.
2013-05-13 08:28:16 +02:00
Martin Gräßlin 0811d17329 Encapsulate colormap related functionality in own class
Split out the default and installed colormap from Workspace and put them
into an own class Colormaps.

The method updateColormaps is replaced by a slot update in Colormaps and
activeClientChanged signal is connected to this slot.

At the same time the colormap related code is straight forward ported to
xcb.

REVIEW: 110248
2013-05-02 13:47:02 +02:00
Martin Gräßlin b6681ddc3a Turn RootInfo into a KWIN_SINGLETON
It's not a typical singleton as the ctor is not taking a Workspace* and
needs addtional data to be passed to NETRootInfo.

All the initialization code is moved to RootInfo::create() and the tear-
down code is moved to RootInfo::destroyed(). This includes the support
window which used to be a member of Workspace. It's only needed by
RootInfo, so there is no need to have the ownership inside Workspace.

Instead of using a QWidget we just create a normal window through xcb.
It gets destroyed again in the tear-down code after the RootInfo got
destroyed.

REVIEW: 110238
2013-05-01 19:14:38 +02:00
Martin Gräßlin 2320b71cb7 Port Workspace's null focus window to xcb
Adding wrappers to Xcb::Window for setInputFocus.

REVIEW: 110246
2013-05-01 19:10:06 +02:00
Martin Gräßlin 23b395059f s/Time/xcb_timestamp_t/g in workspace.h
REVIEW: 110249
2013-05-01 19:08:00 +02:00
Martin Gräßlin 28d7b3c563 s/Window/xcb_window_t/g in workspace.h 2013-05-01 19:07:56 +02:00
Martin Gräßlin db18c08dd0 Move RootInfo and WinInfo into an own header and impl file
Main motivation for this change is that it's unhandy to have the class
definition in workspace.h and client.h while the implementation is in
events.cpp although nothing in events.cpp uses it directly.

By getting it out of workspace.h we get the header a little bit smaller
which should improve compile time given that it's included almost
everywhere.

In events.cpp the enum usage is changed to NETWinInfo as that's the class
where they are defined.

RootInfo does no longer hold a workspace pointer. Where it's needed it
uses the singleton accessor of Workspace.

REVIEW: 110199
2013-04-30 08:06:12 +02:00
Martin Gräßlin 65ec86113a Split out Rules related code from Workspace into class RuleBook
Workspace is hardly interacting with Rules and all the Rules related code
is already in rules.cpp. This highly qualifies to move all the code out
of Workspace and improve the names.

REVIEW: 110207
2013-04-30 07:52:08 +02:00
Martin Gräßlin 89c2fd5598 Remove YesIKnowWhatImDoing from internal API
No need to have Allowed everywhere.

REVIEW: 110197
2013-04-26 12:29:42 +02:00
Martin Gräßlin 929ba0d9c8 Re-order includes in workspace.cpp
* own > kwin > KDE > Qt
* camel case for KDE includes
* alphabetic order in the various groups
2013-04-26 08:49:51 +02:00
Martin Gräßlin 8a2357d89e Remove unused includes from workspace.cpp 2013-04-26 08:48:36 +02:00
Martin Gräßlin cd025c7526 Make Outline a KWIN_SINGLETON
Given that Outline is now a QObject hold by Workspace, but not used in
Workspace, it can also be a KWIN_SINGLETON.

REVIEW: 110146
2013-04-25 09:04:02 +02:00
Martin Gräßlin 1a3bc3f60c Split Outline in a composited and non-composited part
The non-composited part handles the showWithX case with the four small
windows. The composited part shows a translucent QWidget with the
FrameSvg as done by the selection effect frame.

Outline connects to the Compositor toggled signal to switch the mode if
compositing gets suspended/resumed. This works fine also in the case that
the switch happens while the outline is shown. To support this Outline
is now a QObject and created with Workspace as a parent.

Given that the Outline handles both cases by itself, the outline effect
is no longer needed and is dropped together with all the hooks into the
effect system.
2013-04-25 09:04:02 +02:00
Martin Gräßlin 6d0d9cfe43 Remove KWin::Notifications
Overall all notifications except compositing suspended by DBus were
configured by default to not have any action. This means all the time we
emit a notification we keep DBus and KDED busy for nothing.

All the cases when a notification is triggered ire also exported to
KWin scripting, so if one really needs to handle something in case a
window is moved, it could be done through a KWin script with much more
context about the event.

REVIEW: 110113
BUG: 258097
FIXED-IN: 4.11
2013-04-23 16:23:55 +02:00
Martin Gräßlin c9bfecc12b Remove dialog close notification 2013-04-23 16:21:29 +02:00
Martin Gräßlin 5d303e0fee Remove delete window notification 2013-04-23 16:21:29 +02:00
Martin Gräßlin edb074cbc2 Split out screen handling from Workspace into own class Screens
Following the approaches of other split out functionality Screens is a
singleton class created by Workspace.

The class takes over the responsibility for:
* screenChanged signal delayed by timer
* number of screens
* geometry of given screen
* active screen
* config option for active screen follows mouse

The class contains a small abstraction layer and has a concrete subclass
wrapping around QDesktopWidget, but the idea is to go more low level and
interact with XRandR directly to get more detailed information.

All over KWin the usage from QDesktopWidget is ported over to the new
Screens class.

REVIEW: 109839
2013-04-15 10:25:10 +02:00
Martin Gräßlin 27627bdccb Move killWindowId(Window) from Workspace to KillWindow
Only used from KillWindow and does not operate on private data of
Workspace.

At the same time port to XCB.

REVIEW: 109911
2013-04-15 10:09:04 +02:00
Martin Gräßlin a27bbb9698 Forward declare KillWindow in workspace.h 2013-04-15 10:08:51 +02:00
Martin Gräßlin a442bd6416 DecorationPlugin becomes a QObject
This allows to move the slot to reset the decoration when compositing
got toggled from Workspace to DecorationPlugin and the custom cleanup
is no longer needed.

REVIEW: 109909
2013-04-15 10:04:09 +02:00
Martin Gräßlin 15546e11c2 Rename DecorationPlugin::noDecoration property to disabled 2013-04-15 09:59:09 +02:00
Martin Gräßlin 265b5523e2 Move decoration related methods from Workspace to DecorationPlugin
They were all just delegating to the DecorationPlugin.
2013-04-15 09:59:09 +02:00
Martin Gräßlin 724bfd4548 Make DeocrationPlugin a KWin singleton
Like so many other classes there is exactly one instance hold by
Workspace.
2013-04-15 09:59:09 +02:00
Martin Gräßlin 32be37bce3 Rename PluginMgr to DecorationPlugin
It's about the decorations not just *the* plugin.
2013-04-15 09:59:09 +02:00
Martin Gräßlin 0fb27fd12e Defines to create the boilerplate code for KWin's singleton classes
The define KWIN_SINGLETON adds to a class definition:

public:
    static Foo *create(QObject *parent = 0);
    static Foo *self() { return s_self; }
protected:
    explicit Foo(QObject *parent = 0);
private:
    static Foo *s_self;

There is an additional define KWIN_SINGLETON_VARIABLE to set a different
name than s_self.

The define KWIN_SINGLETON_FACTORY can be used to generate the create
method. It expands to:

Foo *Foo::s_self = 0;
Foo *Foo::create(QObject *parent)
{
    Q_ASSERT(!s_self);
    s_self = new Foo(parent);
    return s_self;
}

In addition there are defines to again set a different variable name and
to create an object of another inheriting class.

All the classes currently using this pattern are adjusted to use these
new defines. In a few places the name was adjusted. E.g. in Compositor
the factory method was called createCompositor instead of create.

REVIEW: 109865
2013-04-15 09:57:25 +02:00
Martin Gräßlin d503d9ffb6 Turn TabBox into a proper singleton
There is only one instance hold by Workspace which means it should follow
the common approach with ::self and ::create.

The hasTabBox is completely removed as it's rather useless and the same
as the ifdef around the usages any way.

REVIEW: 109851
2013-04-11 14:18:30 +02:00
Martin Gräßlin 6f113d84d3 Turn Scripting into a proper singleton
There is only one instance hold by Workspace which means it should follow
the common approach with ::self and ::create.

REVIEW: 109850
2013-04-11 14:01:39 +02:00
Martin Gräßlin da85b5fdc7 Split out Activities related code from Workspace
All activities related code moves into new singleton class Activities.
This class gets only included into the build if the build option is
enabled which means there are less ifdefs all over the code and it also
handles better the moc doesn't like ifdef case.

The class holds the list of open and all activites, the current and the
previous activity and the KActivities::Controller. It also emits the
signals for any activities related changes.

Workspace still contains some activities related code. That is the
adjustment on change of current activity. Nevertheless the code looks
much cleaner now and does not contain the confusing naming conflict with
takeActivity() which existed before.

In all the places where Activities got used the code got adjusted and
quite often the ifdef got added with a fallback for the disabled case.
2013-04-11 13:01:36 +02:00
Martin Gräßlin 15aa42c565 Remove doNotManage hack for Java Applets
The hack used to be used to hide windows before they get embedded into
another window. This has been wrong on multiple levels:
1. it does not belong into a window manager - the window should take care
   of this by itself
2. Window title is not a proper way to identify windows
3. Using D-Bus to inform an X11 window manager about windows which should
   not get managed is rather strange
4. The hack only works with KWin, but not with any other X Window Manager
5. Windows identified with this hack still appear in Alt+Tab, that is
   they are managed after all. Only a flicker is suppressed
6. Such windows are shown in the taskbar which nicely illustrates how
   wrong a D-Bus call to the window manager is

That the hack has been introduced for Java Applets in KHTML also shows
that this is wrong. Why does Gecko and WebKit not need such a hack? Why
is KHTML tied so closely to X11 and KWin? Having a hack for a technology
which is obsoleted (Java Applets) and shouldn't be used due to security
issues is another reason to no longer support this hack. This usage has
been removed from KHTML as of 67939b1 of kdelibs git repo.

REVIEW: 109450
2013-03-22 09:54:45 +01:00
Martin Gräßlin 7e3809a3ca Split out Application Menu related code into own class
Following the approach to move out of Workspace what doesn't belong into
Workspace Appmenu support goes into an own class.

This also has the advantage of better compilation with Qt 5 as moc seems
to dislike ifdefs in the slot definitions.

REVIEW: 109497
2013-03-21 09:34:56 +01:00
Thomas Lübking 476ca65295 Depend fs layer upon active state, not stackorder
according to NETWM spec implementation notes suggests
"focused windows having state _NET_WM_STATE_FULLSCREEN" to be on the highest layer.
We'll also take the screen into account
The user set stacking (being raised) is not considered by the spec note
This behavior is also suggested by an old comment in activation.cpp, void Workspace::setActiveClient()

BUG: 296076
CCBUG: 224600
REVIEW: 109572
FIXED-IN: 4.11
2013-03-20 22:23:43 +01:00
Martin Gräßlin e9eb48c735 Use own screen number instead of asking QX11Info
Wouldn't compile with Qt 5 as there the method is missing and the ctor
is private.

REVIEW: 109338
2013-03-08 09:26:27 +01:00
Martin Gräßlin 6424a44632 Add some missing includes with Qt5/KF5 2013-03-07 13:59:16 +01:00
Martin Gräßlin 544b772e42 Use non obsoleted ctor for KXMessages 2013-03-07 13:59:16 +01:00
Martin Gräßlin 60c42b7a34 s/KLocale/KLocalizedString/g
Many headers included KLocale to use i18n and co. But those methods are
defined in KLocalizedString and not in KLocale.

With KF5 klocale.h does no longer include KLocalizedString causing lots
of compile errors.
2013-03-07 13:59:15 +01:00
Martin Gräßlin 32b6ef42b9 Strip module path from all Qt #include <>
Done with:
fixqt4headers.pl --strip-modules

REVIEW: 109176
2013-03-06 10:26:56 +01:00
Martin Gräßlin b99e1c0a6b Reduce usage of QCursor::pos() and ::setPos()
Where possible it is changed to Cursor::pos(), where we cannot use the
Cursor class (e.g. Aurorae) we can at least try to limit the usage to
prevent roundtrips to the X server.

REVIEW: 109178
2013-02-27 11:46:30 +01:00
Martin Gräßlin f12cf0efba Replacement class for QCursor
With Qt5 QCursor does no longer provide ::handle() which was used to
set a cursor on a native XWindow for which we do not have a QWidget.

Also KWin has had for quite some time an optimized version to get the
cursor position without doing XQueryPointer each time ::pos() is called.

These two features are merged into a new class Cursor providing more or
less the same API as QCursor.

In addition the new class provides a facility to perform mouse polling
replacing the implementations in Compositor and ScreenEdges.

For more information about the new class see the documentation for the
new class in cursor.h.
2013-02-25 13:35:14 +01:00
Martin Gräßlin 4a0a4bc27e Split out handling of focus chain into an own class
The new class FocusChain manages two different kind of focus chains.
First of all there is a most recently used focus chain which is primarily
used for TabBox.

Then there is one focus chain per virtual desktop. These chains are used
to determine which Client needs to be activated when e.g. switching to a
virtual desktop.

The individual chains are implemented as a simple QList of Client* with
the most recently used Client as the last element. That way one can see
it as a LIFO like structure.

The desktop focus chains are internally represented as a hash with the id
of the virtual desktop as the key and a list as described as the value.

FocusChain is a singleton which provides some methods to manipulate the
chains and to get a specific Client for a task (e.g. TabBox).

While splitting out the code some unused code inside TabBox got removed
as well as some activities related code (windows cannot be moved while
switching activities).

REVIEW: 107494
2013-02-21 09:57:46 +01:00
Thomas Lübking 48128f268c improve multihead situation
prevents the focus being passed to the other head
manages OpenGLIsUnsafe setting per head

CCBUG: 256242
BUG: 282677
REVIEW: 107853
FIXED-IN: 4.11
2013-02-18 21:55:13 +01:00
Martin Gräßlin 90eb2dbf05 Screen Edges may belong to fullscreen windows
Corners are still ours (it's a valid use case to still be able to switch
window through e.g. Present Windows even when running a fullscreen app).

How is it done? An Edge can be blocked and does no longer trigger if it
is blocked. For WindowBasedEdges the edge windows get unmapped in the
blocking case and mapped again when the blocking condition is no longer
valid.

The blocking is so far connected to:
* changes of active window
* changes of fullscreen windows

Whenever one of the events occurs it is checked whether there is:
1. an active client
2. it is fullscreen
3. on the same screen as the edge

If this is the case the edge will be blocked, otherwise unblocked.

BUG: 271607
FIXED-IN: 4.11
2013-02-07 09:48:09 +01:00
Martin Gräßlin a8539ff54e Turn ScreenEdges into a Singleton
In fact it already used to be a Singleton as there is just one object
hold by the Singleton Workspace. So let's make it a proper Singleton
following our kind of standard approach of having a ::create factory
method called from Workspace ctor and a ::self to get to the singleton
instance.
2013-02-07 09:46:52 +01:00
Martin Gräßlin d9aedf620b Rewrite of KWin's Screen Edge Handling
This rewrite is mostly motivated by the need to handle multi screen
setups correctly. That is have edges per screen and not for the combined
geometry. Also porting from XLib to XCB has been a motivation for the
rewrite.

The design of the new ScreenEdge handling is described in the
documentation of ScreenEdges in screenedge.h.

In addition the following changes have been performed:
* move configuration from Options to ScreenEdge
* add screen edge information to Workspace::supportInformation (obviously
  replaces what had been read from Options)
* have Workspace hold a pointer to ScreenEdges instead of an object
* forward declaration of ScreenEdges in workspaces.h, this explains the
  seemingly unrelated changes of just another include in some files

BUG: 290887
FIXED-IN: 4.11
2013-02-07 09:46:52 +01:00
Martin Gräßlin 6c213d4392 Make use of new Xcb Wrapper classes
Use WindowAttributes and WindowGeometry everywhere where the xcb commands
had already been used.

Introduces another wrapper for overlay window and a subclass for query
tree which also wrapps the children command.
2013-01-25 08:51:38 +01:00
Martin Gräßlin b967527db3 Use XCB to resolve the X11 Extensions
The extension handling is removed from kwinglobals and moved into the
xcbutils in KWin core in namespace KWin::Xcb. The motivation for this
change is that the Extensions are only used in KWin core and are marked
as internal. So there is no need to have them in the library.

What remains in Extensions are the non-native pixmaps. This will be
removed once we are on Qt 5 as QPixmap can no longer reference an XPixmap.

The remaining code in kwinglobals also still initialize the XLib versions
of extensions emitting events. It seems like there are no XEvents emitted
if not done so even if the extension is correctly initialized with xcb.
This needs to be removed once the event handling is ported over to xcb.

REVIEW: 107832
2013-01-22 07:50:03 +01:00
Martin Gräßlin 5f4935fc66 Merge branch 'KDE/4.10'
Conflicts:
	kwin/workspace.cpp
2013-01-14 15:43:01 +01:00
Martin Gräßlin a1c76f4df2 Gather support information about screens
Adds a section about screens to supportInformation containing:
* whether multi-head is used
* in case of multi-head the screen number
* the number of screens
* geometry per screen

That should hopefully end the two often asked questions about the user's
screen setup, especially if they say they use multi-head.

REVIEW: 108363
2013-01-14 15:39:05 +01:00
Martin Gräßlin 47da2464f3 Merge branch 'KDE/4.10' 2013-01-11 08:52:42 +01:00
Martin Gräßlin 5ccd4f2db8 Adding version information to supportInformation
* KWin version as defined by KDE4WORKSPACE_VERSION
* KDE SC version (compile)
* KDE SC version (runtime)
* Qt version (runtime)

REVIEW: 108320
2013-01-11 08:49:25 +01:00
Martin Gräßlin 3ee9869ba0 Move ScreenEdge configuration from Workspace to ScreenEdge
Main motivation for this change except the fact that it doesn't belong
into Workspace is that the screen edges got updated from within setting
the desktop layout which got removed with the introduction of the
VirtualDesktopManager.

The ScreenEdge now keeps some state to be able to correctly unreserve the
electric borders when changes in the configuration are performed. There
is still room for improvement as there are still some deep function calls
from within reconfiguring in Workspace.

REVIEW: 107493
2013-01-07 09:47:59 +01:00
Martin Gräßlin 1d959dea64 Move Desktop Chain management from Workspace into own class
Most recently used virtual desktop chain is only used in the context of
TabBox and therefore moved into this namespace. KWin uses one desktop
chain for each activity. This is mapped by having multiple DesktopChains.
In addition there is a DesktopChainManager which contains all those
chains which are identified by a QString.

The manager gets connected to the signals emitted by VirtualDesktopManager
for changes in virtual desktops and to signals related to Activities
emitted by Workspace. This means the manager is rather generic as it does
not depend on any other components.
2013-01-07 09:47:51 +01:00
Martin Gräßlin 334b4bf622 Move handling of Virtual Desktops into a VirtualDesktopManager
The ownership for virtual desktops is moved from Workspace into a new
VirtualDesktopManager. The manager is responsible for providing the count
of virtual desktops and keeping track of the currently used virtual
desktop.

All methods related to moving between desktops are also moved from
Workspace to the new manager, though all methods related to Clients on
Virtual Desktops remain in Workspace for the time being. This is to have
the new manager as independent from KWin core as possible.

An rather important change for the handling of virtual desktops is that
the count and the id of a desktop is now an unsinged integer instead of
an integer. The reason for that is that we cannot have a negative count
of desktops as well as it is not possible to be on a desktop with a
negative identifier.

In that regard it is important to remember that a Client can be on a
desktop with a negative identifier. The special value for a Client being
on all desktops is handled by using -1 as a desktop. For the time being
this is not adjusted but instead of comparing the virtual desktop ids one
should prefer to use the convenient methods like isOnDesktop and
isOnAllDesktops. This would allow in future to internally change the
representation for on all desktops.
2013-01-07 09:47:51 +01:00
Thomas Lübking 62c62e4336 skip reset states if client untabbed for release
BUG: 310142
FIXED-IN: 4.10
REVIEW: 108003
2013-01-02 19:04:52 +01:00
Thomas Lübking 1727ab1211 skip reset states if client untabbed for release
BUG: 299333
FIXED-IN: 4.10
REVIEW: 108003
2013-01-02 18:24:42 +01:00
Martin Gräßlin 67174bbf69 Remove outdated and not very useful comment sections
If a section of comments consists of a list of links and all are broken
it's a sign that nobody has used these comments for a long time...

REVIEW: 107933
2012-12-30 09:52:42 +01:00
Martin Gräßlin 41f6a2c7d2 Remove Placement* member variable from Workspace
Not needed anymore given that Placement became a singleton.

REVIEW: 107416
2012-12-20 07:19:53 +01:00
Martin Gräßlin 607e175b4b Make Placement a Singleton
No real change as there has only been one Placement instance inside
Workspace anyway.
2012-12-20 07:19:53 +01:00
Martin Gräßlin aac42d04db Remove unused variables transSlider and transButton
Whatever those have been...
2012-11-21 14:29:42 +01:00
Cedric Bellegarde 53ae2b91e2 GUI: Kwin appmenu support:
- Add support for application menu button in Kwin
- Add kded appmenu configuration in kcm_style
2012-11-09 13:44:50 +01:00
Fredrik Höglund c679ec6508 kwin: Port most of Workspace::init() to xcb 2012-11-07 22:13:13 +01:00
Thomas Lübking 4a94561f68 preconnect client and compositor
the manage code will emit the composite blocking check trigger

REVIEW: 106894
2012-10-25 19:06:57 +02:00
Martin Gräßlin 388edab9e5 Add support for OpenGL in VirtualBox
OpenGL is properly working if there is a direct rendering context.
If LIBGL_ALWAYS_INDIRECT is set VirtualBox falls back to Mesa's software
rasterizer. So in order to get OpenGL the driver is now whitelisted in
the opengltest.

GLPlatform is extended to recognize the VirtualBox driver and has new
methods to report whether it is a virtual machine and VirtualBox. The
detection is rather limited as we don't get access to the underlying
hardware, so we do not know whether the features are really supported.
We need to trust the driver here in announcing the right extensions.

The driver does not provide glxQueryDrawable although it is part of
GLX 1.3. A hack is added in the glxbackend to set the function pointer to
NULL. This can unfortunately not be done in glxResolveFunctions() as
QueryDrawable seems not to be provided by an extension (at least not
listed in the OpenGL registry) and getProcAddress resolves a function but
it only prints an OpenGL Warning to stderr.

As a note: the driver reports that it is using XSHM for
GLX_EXT_texture_from_pixmap.

REVIEW: 106821
2012-10-25 11:27:28 +02:00