Commit Graph

103 Commits (8c2b2faf9da1be1d66b806cf457b481fcc78edc8)

Author SHA1 Message Date
Martin Flöser 9ce651fc30 Drop unused functions from utils
Summary: Not used anywhere in KWin -> can go.

Test Plan: Still compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7956
2017-09-23 21:15:00 +02:00
Martin Flöser 1cc38c929a Move updateXTime into the X11 standalone platform
Summary:
KWin::updateXTime only delegates into the platform API where the method
is a no-op. The actual implementation is moved into the X11 standalone
platform as it uses QX11Info which is non functional except on the X11
standalone platform.

This change exposes a problem with timestamp handling: on Wayland the
X11 timestamp does not get updated at all, causing e.g. window sync not
work correctly (c.f. bug 374881). We cannot implement the updating in the
same way as QX11Info/Qt xcb platform does it as that would introduce a
blocking roundtrip to XWayland which is dangerous.

As a side-effect this change removes linking to Qt5::X11Extras in kwin
core as it's no longer needed.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7515
2017-08-24 20:49:49 +02:00
Martin Gräßlin cacfdf3676 Merge branch 'Plasma/5.8' into Plasma/5.9 2017-05-05 19:14:10 +02:00
Martin Gräßlin 0bec9ad733 Improve the x11 timestamp handling
Summary:
So far KWin only updated the x11 timestamp if the new timestamp is larger
than the existing one. While this is a useful thing it creates problems
when the 32 bit msec based time stamp wraps around which happens after
running an X server for 49 days. After the timestamp wrapped around KWin
would not update the timestamp any more and thus some calls might fail.
Most prominent victims are keyboard and pointer grab which fails as the
timestamp is either larger than the server timestamp or smaller than the
last grab timestamp.

Another problem related to timestamp handling is KWin getting broken by
wrong timestamps sent by applications. A prominent example is clusterssh
which used to send a timestamp as unix time which is larger than the
x timestamp and thus our timestamp gets too large.

This change addresses these problems by allowing to reset the timestamp.
This is only used from updateXTime (which is normally invoked before we
do things like grabKeyboard). Thus we make QX11Info::getTimestamp the
ultimate trusted source for timestamps.

BUG: 377901
BUG: 348569
FIXED-IN: 5.8.7

Test Plan: As I cannot wait 50 days: unit tests for the two conditions added.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5704
2017-05-03 21:36:34 +02:00
Martin Gräßlin 346619aa36 Remove KWin::display from kwinglobals
Summary:
And finally nothing inside libkwineffects, libkwinglutils,
libkwinxrenderutils and kwineffect and kwin core uses KWin::display.
We are finally XLib free!

This change drops KWin::display and removes the include to QX11Info from
kwinglobals.h. And the libraries no longer need to link X11Extras.  Due
to that removal a few seeming unrelated changes are required to add the
include where needed and linkage to X11Extras.

The biggest change is to x11 platform plugin which still needs the
display and caches it in the Platform and passes it to various places in
a way that the code doesn't need to be adjusted.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3337
2016-11-16 18:00:00 +01:00
Kevin Funk 8ea4f4dae7 Port to CMake AUTOMOC
Summary: Run convert-to-cmake-automoc.pl over all .cpp files

Differential Revision: https://phabricator.kde.org/D882
2016-02-01 21:05:36 +01:00
Martin Gräßlin 14b9046ad2 Unblock signals in child processes
We need to unblock the signals blocked with pthread_sigmask.
This caused kdeinit to block, because it relies on SIGUSR1.

BUG: 356580
FIXED-IN: 5.5.1
REVIEW: 126361
2015-12-15 13:03:30 +01:00
Martin Gräßlin 125cc5082f Change default logging category to QtCriticalMsg
Less noisy KWin by default.
2015-07-31 13:29:58 +02: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
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 b45eeae352 [Xcb::Wrapper] Introduce a Property and StringProperty Wrapper subclass
The Xcb::Property can wrap the xcb_get_property call and provides
convenient access methods to read the value of the reply with checks
applied. For this it provides a templated ::value method for reading a
single value or reading an array. There's also a ::toBool and
::toByteArray which performs the conversion directly with default values
for the type and format checks.

Xcb::TransientFor is changed to be derived from Property instead of
Wrapper directly, so that the reading of the property value can be
shared.

Xcb::StringProperty is a convenient wrapper derived from Property to
handle the reading of a string property providing a cast to QByteArray
operator. This replaces the ::getStringProperty from utils. Though the
separator functionality from ::getStringProperty is not provided as that
is only used in one function and handled there.

All the custom usages of xcb_get_property or getStringProperty are
replaced to use this new wrapper. That simplifies the code and ensures
that all properties are read in the same way.

REVIEW: 117574
2014-04-17 07:41:33 +02:00
Martin Gräßlin 9075b5e2d6 [kwin] Remove cursorPos() from utils.h
Only delegated to Cursor::pos() anyway, so let's just use that directly.
Fixes the annoyances of having to mock it in the unit tests which include
utils.cpp.

REVIEW: 116900
2014-03-25 15:25:40 +01:00
Martin Gräßlin 1bc624f9f7 [kwin] Move Client specific code from utils.h to client.(h|cpp)
* Motif to client.cpp
* ClientWinMask to client.cpp
* ForceGeometry_t to Client

REVIEW: 116901
2014-03-19 18:54:00 +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 5032520920 cut spurious \0 byte from string properties
added with 26c263cc1de9cf0af66c12d0d746cd8ae7b1744a

CCBUG: 326893
FIXED-IN: 4.11.6
REVIEW: 114963
2014-01-29 19:57:53 +01:00
Martin Gräßlin 3b07653613 Make more methods in kwin/utils.cpp available to the rules KCM
Needed as the kcm includes cursor.

Sorry Eike ;-)
2013-09-30 10:56:56 +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 57905c0cc2 And we got rid of KDebug
Usages of kBacktrace got dropped.
2013-09-02 13:14:39 +02:00
Martin Gräßlin 37334f400a Drop no longer needed XLib includes from KWin 2013-08-20 10:29:20 +02:00
Martin Gräßlin e21225fa47 Use XCB Shape instead of XLib Shape in KWin core 2013-08-20 09:48:14 +02:00
Martin Gräßlin 95f10a6c33 updateXTime uses QX11Info::getTimestamp
Requires 9c45260942c0ee32267e651d981bfa33a6acb64d from qtx11extras.

Note: this does not fully replace the functionality which we used to
have. The event queue is not yet searched for the first even with a
timestamp.
2013-08-13 10:07:13 +02:00
Martin Gräßlin 1b4b13c863 Fix includes in utils.cpp
We do not need kxerrorhandler anymore and QX11Info already included.
2013-07-24 09:58:43 +02:00
Martin Gräßlin 64e464afe5 Use xcb_window_t in Motif::readFlags
Actual method is not ported to XCB yet.

REVIEW: 110269
2013-05-13 09:33:29 +02:00
Martin Gräßlin dfec59c60e Port getStringProperty to XCB 2013-05-13 08:48:19 +02:00
Martin Gräßlin 20f9af1571 Port qt/x11 button and modifier mapping to XCB
enums are nicer than C defines
2013-05-13 08:48:19 +02:00
Martin Gräßlin a51ba112fd Port (un)grabXServer to xcb 2013-05-13 08:48:19 +02:00
Martin Gräßlin 7e9d7f3959 Port (un)grabXKeyboard to XCB 2013-05-13 08:48:19 +02:00
Martin Gräßlin 1276eb044f Move KWinSelectionOwner to main.(h|cpp)
KWinSelectionOwner is only used in KWin::Application which means that
utils is the wrong place for it.

REVIEW: 110245
2013-05-01 19:15:19 +02:00
Martin Gräßlin 4a28d000cf Move ShortcutDialog to useractions
It's only used from useractions.cpp which means that it's not the best
fit in utils. We can see the problems with it given that it was in an
ifdef and it included quite some headers into everything.

REVIEW: 110189
2013-04-26 08:53:13 +02:00
Martin Gräßlin 22ecba3b7d Cleanup of includes in utils.h
* removed unneeded includes
* reordered
* camel case

REVIEW: 110188
2013-04-26 08:50:24 +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 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 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 5cd223f051 Improved resolving whether a window is on local machine
Most windows use the hostname in WM_CLIENT_MACHINE, but there are windows
using the FQDN (for example libreoffice). So instead of "foo" it is
"foo.local.net" or similar. The logic so far has been unable to properly
determine whether windows with FQDN are on the local system.

In order to solve this problem the handling is split out into an own
class which stores the information of hostname and whether it is a local
machine. This is to not query multiple times. To determine whether the
Client is on the local system getaddrinfo is used for the own hostname
and the FQDN provided in WM_CLIENT_MACHINE. If one of the queried
names matches, we know that it is on the local machine. The old logic to
compare the hostname is still used and getaddrinfo is only a fallback in
case hostname does not match.

The problem with getaddrinfo is, that it accesses the network and by that
could block. To circumvent this problem the calls are moved into threads
by using QtConcurrent::run.

Obviously this brings disadvantages. When trying to resolve whether a
Client is on the local machine and a FQDN is used, the information is
initially wrong. The new ClientMachine class emits a signal when the
information that the system is local becomes available, but for some
things this is just too late:
* window rules are already gathered
* Session Management has already taken place

In both cases this is an acceptable loss. For window rules it just needs
a proper matching of the machine in case of localhost (remote hosts are
not affected). And the case of session management is very academic as it
is unlikely that a restoring session contains remote windows.

BUG: 308391
FIXED-IN: 4.11
REVIEW: 108235
2013-01-21 16:00:49 +01:00
Thomas Lübking ef71908c6a fix ShortcutDialog to allow clearing the shortcut
BUG: 234793
REVIEW: 104336
2012-03-18 22:23:27 +01:00
Montel Laurent 62c5a5e276 normalize signal/slots 2011-08-17 23:51:55 +02:00
Luboš Luňák 13e6ead66e do not show hostname in titlebar if it's FQDN of localhost 2011-03-04 16:22:23 +01:00
Martin Gräßlin 0a7e48f7aa KWin uses kdelibs coding style. 2011-01-31 20:07:03 +01:00
Thomas Lübking e8b01efe44 improve keyboard navigation of the window shortcut dialog, add a conflict warning
kkeysequencewidget only needs the pushbutton as focusproxy
BUG: 182873
BUG: 251297

svn path=/trunk/KDE/kdebase/workspace/; revision=1195365
2010-11-10 22:28:15 +00:00
Lucas Murray 743e058af5 Detect when _MOTIF_WM_HINTS gains or loses the no border hint.
Patch by Daniel Erat.
BUG: 201523

svn path=/trunk/KDE/kdebase/workspace/; revision=1030932
2009-10-03 14:32:24 +00:00
Michael Jansen c58d6e1038 Use CurrentTime instead of xTime() for XUngrabKeyboard
svn path=/trunk/KDE/kdebase/workspace/; revision=1002752
2009-07-26 21:50:35 +00:00
Lucas Murray ca901dae30 Improved window movement around struts. Windows can be moved anywhere
where the titlebar is still clickable even if it is outside the normal
work area. When struts are added or removed only move the windows that
cover the same area, leave all others untouched. If a strut is removed
on a xinerama screen that is not on the edge of the full desktop area
prevent the windows from being moved offscreen. Prevent struts/panels
from interfering with the movement of windows on other xinerama screens.
BUG: 74559
BUG: 90833
BUG: 160068

svn path=/trunk/KDE/kdebase/workspace/; revision=927466
2009-02-17 15:50:00 +00:00
Martin Gräßlin daa32a53fb Adding mouse wheel support to effects. First one to use is cube effect.
CCMAIL: marco.gulino@gmail.com

svn path=/trunk/KDE/kdebase/workspace/; revision=922031
2009-02-06 09:45:34 +00:00
Lucas Murray 6d41a1320e Moved all debug, warning and error messages into the KWin 1212 area.
Replaced deprecated kdDebug() with kDebug().
Removed empty debug messages.

svn path=/trunk/KDE/kdebase/workspace/; revision=885620
2008-11-17 15:04:52 +00:00
Michael Jansen dfc55420e7 - Only record single key global shortcuts
- print a debug message when ignoring the entered shortcuts because
  of conflicts.

svn path=/trunk/KDE/kdebase/workspace/; revision=882188
2008-11-10 00:03:17 +00:00
Michael Jansen d6df278f49 Use the new session shortcut feature for kwins "Window Shorcut" feature.
@Lubos: Please have a look at commit 863096 too. I accidently commited a
part of this part there. Please have a look at the todo "Add the window
title" and possibly implement it. That would look much nicer in the global
shortcuts kcm.

Btw. There are two shortcuts dialogs in kwin. I haven't change the other
one (kwinrules) because it look it works better with KKeySequenceWidget
doing the message box.

CCMAIL:l.lunak@kde.org

svn path=/trunk/KDE/kdebase/workspace/; revision=863292
2008-09-21 18:03:59 +00:00
Michael Jansen 105ad40c37 Unbork the dialog. It still crashes for me when setting a global shortcut that is
currently used. Will try to investigate.

CCMAIL: l.lunak@suse.cz

svn path=/trunk/KDE/kdebase/workspace/; revision=837779
2008-07-25 17:31:41 +00:00
Luboš Luňák 0af83a41ec Don't crash when XGrabKeyboard() fails for some reason.
svn path=/trunk/KDE/kdebase/workspace/; revision=798523
2008-04-18 14:04:11 +00:00
Luboš Luňák bb433ac40e No longer include config*.h files in installed headers.
Also slightly redo the #define's for effects, now it's:
- #ifdef KWIN_HAVE_COMPOSITING to check whether there's any compositing support at all
- #ifdef KWIN_HAVE_OPENGL_COMPOSITING to check for OpenGL-based compositing
- #ifdef KWIN_HAVE_XRENDER_COMPOSITING the same for XRender
CCMAIL: kwin@kde.org


svn path=/trunk/KDE/kdebase/workspace/; revision=749628
2007-12-17 14:14:53 +00:00
Luboš Luňák 01bf6cbb4c License cleanup - add headers where missing, be explicit about GPL
being v2+ (right now it says just GPL, which according to GPL itself
means any GPL). Decoration clients will come later.
CCMAIL: kwin@kde.org


svn path=/trunk/KDE/kdebase/workspace/; revision=742302
2007-11-27 19:40:25 +00:00