Commit graph

282 commits

Author SHA1 Message Date
Martin Gräßlin
f39c3c8cbb Emit signal from Application once Workspace is created
Allows interesting parties to delay initialization till Workspace is
ready.
2015-03-17 10:20:19 +01:00
Martin Gräßlin
0f945f53fe Move creation of InputRedirection, Cursor and Screens out of Workspace
Do not depend on Workspace and do not depend on X11 thus can be started
earlier allowing to get more things started prior to depending on
Workspace.
2015-03-17 10:20:19 +01:00
Martin Gräßlin
7369a2c3a5 [kwin_wayland] Support using platform wayland for the QPA
This reorders the startup sequence quite a bit:
1. Create QAbstractEventDispatcher and install it on QCoreApplication
2. Create Application
3. Start Xwayland, use thread to get when its ready
4. Create xcb connection
5. perform startup

For using the wayland QPA it needs a patch in QtWayland which will be
part of Qt 5.4.2, otherwise it blocks.
2015-03-17 10:20:19 +01:00
Martin Gräßlin
65007cd104 [xwayland] Add a dedicated --xwayland option to kwin_wayland
The --xwayland option starts a rootles Xwayland server. If a
rootless Xwayland server is used OperationModeXwayland is used
which is introduced with this change as well.
2015-03-17 10:03:05 +01:00
Martin Gräßlin
0d51952d78 Provide x11Connection as a property on the KWin::Application
KWin::connection() uses the property to resolve the value instead of
using QX11Info. In practice this doesn't change anything at the moment,
but allows kwin_wayland to provide an xcb connection without depending
on QX11Info.

As we cannot make xcb_connection_t* available as a metatype, the
property's type is set to void*.
2015-03-17 09:44:53 +01:00
Martin Gräßlin
fe9873e4b1 Provide x11RootWindow as a property on the KWin::Application
KWin::rootWindow() uses the property to resolve the value instead of
using QX11Info. In practice this doesn't change anything at the moment,
but allows kwin_wayland to provide a root window without depending on
QX11Info.
2015-03-17 09:44:53 +01:00
Martin Gräßlin
b56ed80de1 Workaround broken CI system
It doesn't know XCB_GE_GENERIC.
2015-02-25 11:10:31 +01:00
Martin Gräßlin
d95ab94f0a Migrate away from QX11Info::appTime
The porting to Qt5 broke the timestamp handling in many areas. A deeper
look into Qt's xcb plugin shows that the appTime handling is not
sufficient for KWin's need. E.g. the time is only updated in response to
a property notify event if it's for a Qt created window, which is hardly
ever the case in KWin. Another example is that key press/release events
never updated the appTime.

As the functionality in Qt is rather trivial we can do the timestamp
handling ourselves. We filter all events anyway and it is slightly faster
as we don't have to go through the QPA interface any more.

REVIEW: 122636
2015-02-23 11:02:59 +01:00
Martin Gräßlin
8cb78b7df6 Use KWIN_DBUS_SERVICE_SUFFIX for multi-head service name wrangling
Adjust the KWIN_DBUS_SERVICE_SUFFIX env variable in a multi-head
scenario instead of adjusting the "org.kde.kwin" DBus service which
we actually don't use in 5.x any more.

REVIEW: 122217
2015-01-27 07:25:52 +01:00
Lasse Liehu
4963bf3d44 Fix QTranslator installation for Qt translations
The translator instance was uninstalled right away after installation
because it was destroyed when returning from the function.

REVIEW: 121977
2015-01-12 21:10:38 +02:00
Martin Gräßlin
b6bb4e2548 Register metatype Options::WindowOperation
Fixes all actions not working from user actions menu.
2014-12-08 10:08:49 +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
15a1a5b70f Add command line option to enable libinput support
kwin_wayland gains a new command line option to enable libinput support.
This is needed as logind blanks the VT when the session controller
releases the control. So a nested compositor can seriously affect the
primary session. Thus it needs a dedicated command line switch to
enable it.

By default libinput support is disabled for kwin_x11 and can be enabled
for kwin_wayland in case KWin is compiled with libinput support.
2014-10-20 14:51:24 +02:00
Martin Gräßlin
f9a7b94ee7 Create dedicated kwin_x11 and kwin_wayland binaries
All of kwin except the main function goes into a new (private) library
called kwin. Two new kdeinit_executables are created:
* kwin_x11
* kwin_wayland

Both only use a dedicated main_x11.cpp and main_wayland.cpp with the
main function and a KWin::Application subclass and linking the new
kwin library.

The main idea behind this is to be able to perform more sane sanity
checks. E.g. on Wayland we don't need to first test whether we can
create an X11 connection. Instead we should abort if we cannot connect
to the Wayland display. Also the multi-head checks are not needed on
Wayland, etc. etc. As most of that code is in the main function to
simplify it's better to split.

This will also make it easier to diverge more easily in future. The
Wayland variant can introduce more suited command line arguments for
example. This already started by having the --replace option only
available in X11 variant. The Wayland backend is still a window manager,
but doesn't claim the manager selection.
2014-08-18 08:50:44 +02:00
Martin Gräßlin
6e195331f6 Revert "set QSG_RENDER_LOOP as basic if not explicitly set"
This reverts commit c09d63d192.

The test results we got indicate that on NVIDIA the problems with the
threaded rendering loop do not exist and at the same time the rendering
result improves a lot. As Qt still disables the threaded rendering loop
for the problematic drivers, it's better to not force the basic rendering
loop.
2014-06-30 14:21:40 +02:00
Hrvoje Senjan
52653aaede Rename KWin binary to kwin_x11
This servers two purposes.
1. it makes KWin/5 co-installable with KWin/4 as now binary and
   all libraries etc. are renamed or installed to a different
   location.
2. In future we need a dedicated X11 and Wayland main function
   anyway. Thus it makes most sense to rename to kwin_x11 directly
   instead of first renaming to kwin5. The reason why we need to
   have dedicated main functions is that kwin needs to check early
   whether X11 is working or Wayland is working. Right now the first
   thing kwin does is trying to connect to the XServer. This happens
   before the QApplication is constructed and before command line
   args are processed. On Wayland we won't want to test whether we
   can connect to the XServer. As it's too early to check whether we
   are starting kwin for X11 or Wayland the most convenient way is to
   have dedicated binaries - thus a rename is needed. Just renaming
   kwin for wayland is also not a good idea as in future the "main"
   kwin will be for wayland not for X11. Another case for the dedicated
   binaries is the Application class, which right now first tries to
   claim the X11 Window Manager Selection. Again on Wayland even with
   XWayland we won't need that. KWin will be the window manager for
   XWayland if KWin is the Wayland compositor. There is no need to even
   try to support anything else. Most likely it will even be KWin to
   start the XWayland server, so we can be sure that there is no other
   WM running and thus no need to claim the selection and abort if it
   fails.

REVIEW: 118266
2014-06-16 15:34:34 +02:00
Martin Gräßlin
d8dd369f9e Load Qt's translations 2014-06-04 15:59:53 +02:00
Martin Gräßlin
14c5637d68 Add KAboutData's command line arguments to the QCommandLineParser
This adds back --author and --license.
2014-05-27 09:34:14 +02:00
Martin Gräßlin
7fe2b08bf9 Call KAboutData::setApplicationData
That way we don't have to specifiy name et all multiple times.
2014-05-27 09:33:34 +02:00
Andreas Hartmetz
9c73055a10 Adapt to changes in KAboutData. 2014-05-14 05:04:40 +02:00
Marco Martin
c09d63d192 set QSG_RENDER_LOOP as basic if not explicitly set 2014-05-07 15:43:01 +02:00
Martin Gräßlin
88d55997f7 Port away from DefaultScreen(display())
The screen number is provided through QX11Info.
2014-05-05 08:09:09 +02:00
Martin Gräßlin
e80094694e Adjust kwin and killer to new ki18n
Setting the ApplicationDomain to kwin, both use the kwin catalog.

The left-over code for catalogs is removed. Note for adjustments:
* scripting doesn't provide an own catalog
* scripts are extracted but there are no scripts with i18n
2014-05-05 08:03:54 +02:00
Martin Gräßlin
ee20101142 Fix deprecated warnings for KAboutData
Ctor with catalog name got deprecated, use ctor without it.
2014-04-28 17:11:20 +02:00
Àlex Fiestas
0e9f6888e0 Stop suspending startup from KWin
This commit basically makes KWin stop using suspend-resumeStartup
methods from KSMServer. The idea is to launch things on parallel and
this is doing exactly the contrary.

Reviewed-by: Martin Gräßlin <mgraesslin@kde.org>
2014-03-24 16:01:48 +01:00
Martin Gräßlin
704e42163d [kwin] Add missing includes
Were missing if built stand-alone.
2014-03-18 14:37:01 +01:00
Martin Gräßlin
cb262a2bbb [kwin] Add used features from config-workspace.h to config-kwin.h
Adds HAVE_UNISTD_H and HAVE_MALLOC_H to config-kwin.h and gets used
in main.cpp. With that KWin does no longer need config-workspace.h.
2014-03-18 09:30:40 +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
72882f6aba [kwin] Add sanity checks for the QPA plugin
KWin requires the xcb plugin otherwise KWin crashes when the first
xcb/xlib code is called. First KWin tries to set the QT_QPA_PLATFORM
to "xcb", but that doesn't protect against the command line switch.

Thus KWin also verifies that after constructing the QGuiApplication
the platform name is set to xcb, if not it exits gracefully with a
useful error message instead a crash.

To make that work the KWinSelectionOwner has to be changed to a
pointer and be delayed constructed, otherwise the crash already happens
in the KSelectionOwner.

Furthermore a small sanity check on the plugin is performed by checking
whether KWin can get the XDisplay from the QPA. If not it means that the
QPA plugin was compiled with -no-xcb-xlib which KWin doesn't support, it
still uses XLib at various places. If KWin doesn't get the Display, it
exits gracefully with a clear error message.

CCBUG: 331880
REVIEW: 116669
2014-03-10 08:41:53 +01:00
Martin Gräßlin
a8d8d6461c [kwin] Fix operation mode on X11
Picked Wayland by default instead of X11 causing KWin to abort
startup if there is no Wayland backend.

Important lesson: test your changes also on X11 and not just on
Wayland!
2014-01-09 17:39:47 +01:00
Martin Gräßlin
b65d54f4d2 Enforce compositing if required
In the Wayland world we need to have a compositor. This means we have to
enforce that the compositor is running. If the setup fails we have to
quit, because it doesn't make any sense any more to be running.

A new method requiresCompositing() is added to the Application. If it
returns true the useCompositing option will always return true and the
unredirect fullscreen option will always return false. That way
compositing is enforced at startup and cannot end by unredirecting.

In addition this method is checked if actions are performed which would
suspend compositing. E.g. the shortcut to toggle compositing. Restarting
the compositor is still possible in order to change the selected
compositing backend without a restart. But if it fails KWin will quit.
2014-01-09 15:16:42 +01:00
Martin Gräßlin
1be3a7a9f0 Introduce a method shouldUseWaylandForCompositing() in KWin::Application
Returns true if the OperationMode requires KWin to composite to a
Wayland surface. This replaces the checks for the WaylandBackend or env
variable used so far in the construction of the Scene.
2014-01-09 15:16:42 +01:00
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
e92d02ab61 [kwin] Remove include of kdemacros.h from kwinglobals
Instead we generate an export header for kdeinit_kwin and use it
to declare the KWIN_EXPORT. With this change our libs don't include
any KDE4Support headers any more. One step closer to no KDE4Support.
2013-12-06 08:37:16 +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
Jacob Logan
ac72e9fb73 Changed debug statements in kwin/effects from qDebug() to qCDebug(KWINEFFECTS)
A new .cpp file is added containing the declaration of the logging
category and compiled into the effects lib.

REVIEW: 114194
2013-11-29 08:47:56 +01:00
Eric Newberry
02a42b355b Converted Aurorae to categorized logging. 2013-11-25 15:37:33 +01:00
Martin Gräßlin
85e3a00f27 [kwin] Fix crash checking in startup
Need to do it before we start to claim the manager selection.
2013-11-13 10:23:45 +01:00
Martin Gräßlin
324aae916a [kwin] Drop testapp for detecting whether direct rendering works on glx
The main purpose of the opengl testapp was to set the environment
variable LIBGL_ALWAYS_INDIRECT if direct rendering is not supported
before glx gets initialized.

With Qt5 we may no longer set this environment variable. QtQuick
requires direct rendering. On IvyBridge QtQuick is crashing if the
variable is set. Thus we are no longer allowed to set it and thus the
complete test becomes pointless.

The test app basically whitelisted most drivers anyway, the only
drivers which were problematic are the proprietary Catalyst drivers.
It that's still a problem we can also disable OpenGL compositing on
those drivers through the recommendation in the GLPlatform.

This also means that the KWIN_DIRECT_GL variable is no longer useful.
2013-11-05 14:48:40 +01:00
Martin Klapetek
2dc5aebcc2 Inform KSplash via DBus about kwin startup
KSplash for PW2 will use DBus for setting stages instead of xatoms, this
ports kwin to send a DBus message to KSplash.

REVIEW: 113524
2013-11-04 11:17:24 +01:00
Martin Gräßlin
a360d0b96e [kwin] Call QQuickWindow::setDefaultAlphaBuffer before creating first window
We want to have the QQuickWindows using translucency.
2013-10-25 13:00:50 +02:00
Martin Gräßlin
e448a4bfc1 Merge branch 'KDE/4.11'
Conflicts:
	kwin/main.cpp
2013-09-26 07:54:51 +02:00
Thomas Lübking
61f1bcc991 Revert "Add ability to disable multihead support"
The variable is set not from config nor anywhere else when kwin is
started through ksmserver by startkde.

In addition the KGlobal implementation is twisted compared to the kcminit
config behavior (the config value defaults to true, not false - ie. if the
variable isn't set (by kcm init) it's reasonable to assume true either.

Therefore and in alignment with PW/2, the environment is read directly and
on absence resolved to "true".

To control the behavior, please export KDE_MULTIHEAD=true/false before starting KWin
(eg. in /usr/bin/startkde)

This reverts commit ab6d5c048a25bcb2f5bdb822ba3eda64019c61bc.

REVIEW: 112579
CCBUG: 256242
2013-09-26 07:52:47 +02:00
Martin Gräßlin
108252194a Use Xcb::Atom in KWin::Atoms to resolve all atoms
During startup we only create the request, the reply will be fetched
once the atom is needed.

To make proper use of this async behavior the creation of Atoms is
moved directly to the claim of the manager selection, so they can be
fetched while we wait for the previous manager selection to give up
on it.
2013-09-10 15:30:11 +02:00
Martin Gräßlin
64dde54f35 Perform crash count checking before we claimed the manager selection
The crash count checking does not depend on whether or not we will
be able to claim the window manager selection. As claiming the selection
can take up to one second we should try to get as many checks which do
not depend on it out.
2013-09-10 15:30:11 +02:00
Martin Gräßlin
5d6c52e26c Drop initing variable from kwin/main.cpp
It's nowhere read, just set once to true and once to false and by
that rather useless.
2013-09-10 15:30:11 +02:00
Martin Gräßlin
26c0e36400 Do not build KWin::SessionManager for the time being
KSessionManager is deprecated and there is no replacement yet. So
let's get rid of the warnings for now. Needs to be re-added once
there is a working QSessionManager again.
2013-09-09 06:03:35 +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
c1d0a32b64 Drop close on exit hack in kwin/main
See http://lists.kde.org/?l=kwin&m=137777699329758&w=2
2013-08-30 07:48:17 +02:00