From b2db22fd2598fb64a89f4b2c6d30f0d5b442a86c Mon Sep 17 00:00:00 2001 From: Volker Krause
Date: Sun, 14 Sep 2014 16:48:38 +0200 Subject: [PATCH 01/13] Make constants const, saves a few symbols in the .data
Hello community, here is the log from the commit of package kwindowsystem for openSUSE:Factory checked in at 2014-10-01 11:22:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kwindowsystem (Old) and /work/SRC/openSUSE:Factory/.kwindowsystem.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "kwindowsystem" Changes: -------- --- /work/SRC/openSUSE:Factory/kwindowsystem/kwindowsystem.changes 2014-09-12 17:05:05.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kwindowsystem.new/kwindowsystem.changes 2014-10-01 11:22:19.000000000 +0200 @@ -1,0 +2,9 @@ +Wed Sep 24 19:25:07 UTC 2014 - hrvoje.senjan@gmail.com + +- Added patches needed for KWin's 5.1 release, all from upstream: + 0001-Make-constants-const-saves-a-few-symbols-in-the-.dat.patch, + 0002-Add-support-for-urgency-hint-in-NETWinInfo.patch, + 0003-Add-support-for-input-hint-in-NETWinInfo.patch and + 0007-Add-support-for-protocols-to-NETWinInfo.patch + +------------------------------------------------------------------- New: ---- 0001-Make-constants-const-saves-a-few-symbols-in-the-.dat.patch 0002-Add-support-for-urgency-hint-in-NETWinInfo.patch 0003-Add-support-for-input-hint-in-NETWinInfo.patch 0007-Add-support-for-protocols-to-NETWinInfo.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kwindowsystem.spec ++++++ --- /var/tmp/diff_new_pack.ZL1WnY/_old 2014-10-01 11:22:21.000000000 +0200 +++ /var/tmp/diff_new_pack.ZL1WnY/_new 2014-10-01 11:22:21.000000000 +0200 @@ -39,6 +39,14 @@ Url: http://www.kde.org Source: http://download.kde.org/stable/frameworks/%{version}/%{name}-%{version}.tar.xz Source1: baselibs.conf +# PATCH-FIX-UPSTREAM 0001-Make-constants-const-saves-a-few-symbols-in-the-.dat.patch +Patch0: 0001-Make-constants-const-saves-a-few-symbols-in-the-.dat.patch +# PATCH-FIX-UPSTREAM 0002-Add-support-for-urgency-hint-in-NETWinInfo.patch +Patch1: 0002-Add-support-for-urgency-hint-in-NETWinInfo.patch +# PATCH-FIX-UPSTREAM 0003-Add-support-for-input-hint-in-NETWinInfo.patch +Patch2: 0003-Add-support-for-input-hint-in-NETWinInfo.patch +# PATCH-FIX-UPSTREAM 0007-Add-support-for-protocols-to-NETWinInfo.patch +Patch3: 0007-Add-support-for-protocols-to-NETWinInfo.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -81,6 +89,10 @@ %lang_package -n %lname %prep %setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build %cmake_kf5 -d build -- -Dlconvert_executable=%{_kf5_libdir}/qt5/bin/lconvert ++++++ 0001-Make-constants-const-saves-a-few-symbols-in-the-.dat.patch ++++++ section. --- src/kwindoweffects_x11.cpp | 2 +- src/kwindowsystem_x11.cpp | 8 ++++---- src/netwm.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/kwindoweffects_x11.cpp b/src/kwindoweffects_x11.cpp index 66aaca3..661a0af 100644 --- a/src/kwindoweffects_x11.cpp +++ b/src/kwindoweffects_x11.cpp @@ -29,7 +29,7 @@ #include <QX11Info> #include <QMatrix4x4> -static const char *DASHBOARD_WIN_CLASS = "dashboard\0dashboard"; +static const char DASHBOARD_WIN_CLASS[] = "dashboard\0dashboard"; using namespace KWindowEffects; KWindowEffectsPrivateX11::KWindowEffectsPrivateX11() diff --git a/src/kwindowsystem_x11.cpp b/src/kwindowsystem_x11.cpp index 46fbc7d..db77003 100644 --- a/src/kwindowsystem_x11.cpp +++ b/src/kwindowsystem_x11.cpp @@ -50,7 +50,7 @@ static Atom net_wm_cm; static void create_atoms(Display *dpy = QX11Info::display()); -static NET::Properties windowsProperties = NET::ClientList | NET::ClientListStacking | +static const NET::Properties windowsProperties = NET::ClientList | NET::ClientListStacking | NET::Supported | NET::NumberOfDesktops | NET::DesktopGeometry | @@ -59,11 +59,11 @@ static NET::Properties windowsProperties = NET::ClientList | NET::ClientListStac NET::DesktopNames | NET::ActiveWindow | NET::WorkArea; -static NET::Properties2 windowsProperties2 = NET::WM2ShowingDesktop; +static const NET::Properties2 windowsProperties2 = NET::WM2ShowingDesktop; // ClientList and ClientListStacking is not per-window information, but a desktop information, // so track it even with only INFO_BASIC -static NET::Properties desktopProperties = NET::ClientList | NET::ClientListStacking | +static const NET::Properties desktopProperties = NET::ClientList | NET::ClientListStacking | NET::Supported | NET::NumberOfDesktops | NET::DesktopGeometry | @@ -72,7 +72,7 @@ static NET::Properties desktopProperties = NET::ClientList | NET::ClientListStac NET::DesktopNames | NET::ActiveWindow | NET::WorkArea; -static NET::Properties2 desktopProperties2 = NET::WM2ShowingDesktop; +static const NET::Properties2 desktopProperties2 = NET::WM2ShowingDesktop; MainThreadInstantiator::MainThreadInstantiator(KWindowSystemPrivateX11::FilterInfo _what) : QObject(), diff --git a/src/netwm.cpp b/src/netwm.cpp index a0a2fae..07e5254 100644 --- a/src/netwm.cpp +++ b/src/netwm.cpp @@ -4771,7 +4771,7 @@ void NETWinInfo::setActivities(const char *activities) if (activities == (char *) NULL || activities[0] == '\0') { // on all activities - static const char *nulluuid = KDE_ALL_ACTIVITIES_UUID; + static const char nulluuid[] = KDE_ALL_ACTIVITIES_UUID; p->activities = nstrdup(nulluuid); -- 2.1.0 ++++++ 0002-Add-support-for-urgency-hint-in-NETWinInfo.patch ++++++
From 512b7c17dd3d02d5c49b2b34cbb155f7ad754115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?=
Date: Fri, 12 Sep 2014 11:39:55 +0200 Subject: [PATCH 02/13] Add support for urgency hint in NETWinInfo
UrgencyHint is part of WM_HINTS property which is already processed
for WM2GroupLeader.
REVIEW: 120158
CHANGELOG: NETWinInfo provides convenient wrapper for urgency hint of WM_HINTS property.
---
autotests/netwininfotestclient.cpp | 42 ++++++++++++++++++++++++++++++++++++++
src/netwm.cpp | 13 ++++++++++--
src/netwm.h | 8 ++++++++
src/netwm_def.h | 2 ++
src/netwm_p.h | 1 +
5 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/autotests/netwininfotestclient.cpp b/autotests/netwininfotestclient.cpp
index 160f759..8a39ba5 100644
--- a/autotests/netwininfotestclient.cpp
+++ b/autotests/netwininfotestclient.cpp
@@ -78,6 +78,8 @@ private Q_SLOTS:
void testWindowClass();
void testClientMachine();
void testGroupLeader();
+ void testUrgency_data();
+ void testUrgency();
void testTransientFor();
private:
@@ -665,6 +667,46 @@ void NetWinInfoTestClient::testGroupLeader()
QCOMPARE(info.groupLeader(), m_rootWindow);
}
+void NetWinInfoTestClient::testUrgency_data()
+{
+ QTest::addColumn<quint32>("flags");
+ QTest::addColumn<bool>("expected");
+
+ QTest::newRow("urgency") << quint32(1 << 8) << true;
+ QTest::newRow("none") << quint32(0) << false;
+ QTest::newRow("group_urgency") << quint32((1 << 6) | (1 << 8)) << true;
+ QTest::newRow("input") << quint32(1) << false;
+}
+
+void NetWinInfoTestClient::testUrgency()
+{
+ QVERIFY(connection());
+ INFO
+
+ QVERIFY(!info.urgency());
+ QFETCH(quint32, flags);
+
+ // group leader needs to be changed through wm hints
+ uint32_t values[] = {
+ flags,
+ 1, /* Input */
+ 1, /* Normal State */
+ XCB_NONE, /* icon pixmap */
+ XCB_NONE, /* icon window */
+ XCB_NONE, /* icon x */
+ XCB_NONE, /* icon y */
+ XCB_NONE, /* icon mask */
+ XCB_NONE /* group leader */
+ };
+ xcb_change_property(connection(), XCB_PROP_MODE_REPLACE, m_testWindow,
+ XCB_ATOM_WM_HINTS, XCB_ATOM_WM_HINTS, 32, 9, values);
+ xcb_flush(connection());
+
+ // only updated after event
+ waitForPropertyChange(&info, XCB_ATOM_WM_HINTS, NET::Property(0), NET::WM2Urgency);
+ QTEST(info.urgency(), "expected");
+}
+
void NetWinInfoTestClient::testTransientFor()
{
QVERIFY(connection());
diff --git a/src/netwm.cpp b/src/netwm.cpp
index 07e5254..0e77a95 100644
--- a/src/netwm.cpp
+++ b/src/netwm.cpp
@@ -2763,6 +2763,7 @@ NETWinInfo::NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_wi
p->icon_sizes = NULL;
p->activities = (char *) 0;
p->blockCompositing = false;
+ p->urgency = false;
// p->strut.left = p->strut.right = p->strut.top = p->strut.bottom = 0;
// p->frame_strut.left = p->frame_strut.right = p->frame_strut.top =
@@ -2822,6 +2823,7 @@ NETWinInfo::NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_wi
p->icon_sizes = NULL;
p->activities = (char *) 0;
p->blockCompositing = false;
+ p->urgency = false;
// p->strut.left = p->strut.right = p->strut.top = p->strut.bottom = 0;
// p->frame_strut.left = p->frame_strut.right = p->frame_strut.top =
@@ -3917,6 +3919,7 @@ void NETWinInfo::event(xcb_generic_event_t *event, NET::Properties *properties,
dirty2 |= WM2UserTime;
} else if (pe->atom == XCB_ATOM_WM_HINTS) {
dirty2 |= WM2GroupLeader;
+ dirty2 |= WM2Urgency;
} else if (pe->atom == XCB_ATOM_WM_TRANSIENT_FOR) {
dirty2 |= WM2TransientFor;
} else if (pe->atom == XCB_ATOM_WM_CLASS) {
@@ -4093,7 +4096,7 @@ void NETWinInfo::update(NET::Properties dirtyProperties, NET::Properties2 dirtyP
cookies[c++] = xcb_get_property(p->conn, false, p->window, XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 0, 1);
}
- if (dirty2 & WM2GroupLeader) {
+ if (dirty2 & (WM2GroupLeader | WM2Urgency)) {
cookies[c++] = xcb_get_property(p->conn, false, p->window, XCB_ATOM_WM_HINTS, XCB_ATOM_WM_HINTS, 0, 9);
}
@@ -4547,7 +4550,7 @@ void NETWinInfo::update(NET::Properties dirtyProperties, NET::Properties2 dirtyP
p->transient_for = get_value_reply
From fc189fa9ccd34ca50ef7999139d55a393054c37a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?=
Date: Fri, 12 Sep 2014 13:24:29 +0200 Subject: [PATCH 03/13] Add support for input hint in NETWinInfo
The Input Hint is part of WM_HINTS property which is already processed
for WM2GroupLeader and WM2Urgency.
The default for input hint is true. ICCCM suggests to assume convenient
values for all fields of WM_HINTS property if a window is mapped wihtout
one. KWin sets this value to true, so the sane convenient value for the
input field seems to be true.
REVIEW: 120165
CHANGELOG: NETWinInfo provides convenient wrapper for input hint of WM_HINTS property.
---
autotests/netwininfotestclient.cpp | 46 ++++++++++++++++++++++++++++++++++++++
src/netwm.cpp | 15 +++++++++++--
src/netwm.h | 10 +++++++++
src/netwm_def.h | 2 ++
src/netwm_p.h | 1 +
5 files changed, 72 insertions(+), 2 deletions(-)
diff --git a/autotests/netwininfotestclient.cpp b/autotests/netwininfotestclient.cpp
index 8a39ba5..e35ab8d 100644
--- a/autotests/netwininfotestclient.cpp
+++ b/autotests/netwininfotestclient.cpp
@@ -80,6 +80,8 @@ private Q_SLOTS:
void testGroupLeader();
void testUrgency_data();
void testUrgency();
+ void testInput_data();
+ void testInput();
void testTransientFor();
private:
@@ -707,6 +709,50 @@ void NetWinInfoTestClient::testUrgency()
QTEST(info.urgency(), "expected");
}
+void NetWinInfoTestClient::testInput_data()
+{
+ QTest::addColumn<quint32>("flags");
+ QTest::addColumn<quint32>("input");
+ QTest::addColumn<bool>("expected");
+
+ QTest::newRow("flag_input") << quint32(1) << quint32(1) << true;
+ QTest::newRow("flag_noinput") << quint32(1) << quint32(0) << false;
+ QTest::newRow("noflag_input") << quint32(0) << quint32(1) << true;
+ QTest::newRow("noflag_noinput") << quint32(0) << quint32(0) << true;
+ QTest::newRow("flag_with_other_input") << quint32(1 | 1 << 8) << quint32(1) << true;
+ QTest::newRow("flag_with_other_noinput") << quint32(1 | 1 << 8) << quint32(0) << false;
+}
+
+void NetWinInfoTestClient::testInput()
+{
+ QVERIFY(connection());
+ INFO
+
+ QVERIFY(info.input());
+ QFETCH(quint32, flags);
+ QFETCH(quint32, input);
+
+ // group leader needs to be changed through wm hints
+ uint32_t values[] = {
+ flags,
+ input, /* Input */
+ 1, /* Normal State */
+ XCB_NONE, /* icon pixmap */
+ XCB_NONE, /* icon window */
+ XCB_NONE, /* icon x */
+ XCB_NONE, /* icon y */
+ XCB_NONE, /* icon mask */
+ XCB_NONE /* group leader */
+ };
+ xcb_change_property(connection(), XCB_PROP_MODE_REPLACE, m_testWindow,
+ XCB_ATOM_WM_HINTS, XCB_ATOM_WM_HINTS, 32, 9, values);
+ xcb_flush(connection());
+
+ // only updated after event
+ waitForPropertyChange(&info, XCB_ATOM_WM_HINTS, NET::Property(0), NET::WM2Urgency);
+ QTEST(info.input(), "expected");
+}
+
void NetWinInfoTestClient::testTransientFor()
{
QVERIFY(connection());
diff --git a/src/netwm.cpp b/src/netwm.cpp
index 0e77a95..1431cf6 100644
--- a/src/netwm.cpp
+++ b/src/netwm.cpp
@@ -2764,6 +2764,7 @@ NETWinInfo::NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_wi
p->activities = (char *) 0;
p->blockCompositing = false;
p->urgency = false;
+ p->input = true;
// p->strut.left = p->strut.right = p->strut.top = p->strut.bottom = 0;
// p->frame_strut.left = p->frame_strut.right = p->frame_strut.top =
@@ -2824,6 +2825,7 @@ NETWinInfo::NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_wi
p->activities = (char *) 0;
p->blockCompositing = false;
p->urgency = false;
+ p->input = true;
// p->strut.left = p->strut.right = p->strut.top = p->strut.bottom = 0;
// p->frame_strut.left = p->frame_strut.right = p->frame_strut.top =
@@ -3920,6 +3922,7 @@ void NETWinInfo::event(xcb_generic_event_t *event, NET::Properties *properties,
} else if (pe->atom == XCB_ATOM_WM_HINTS) {
dirty2 |= WM2GroupLeader;
dirty2 |= WM2Urgency;
+ dirty2 |= WM2Input;
} else if (pe->atom == XCB_ATOM_WM_TRANSIENT_FOR) {
dirty2 |= WM2TransientFor;
} else if (pe->atom == XCB_ATOM_WM_CLASS) {
@@ -4096,7 +4099,7 @@ void NETWinInfo::update(NET::Properties dirtyProperties, NET::Properties2 dirtyP
cookies[c++] = xcb_get_property(p->conn, false, p->window, XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 0, 1);
}
- if (dirty2 & (WM2GroupLeader | WM2Urgency)) {
+ if (dirty2 & (WM2GroupLeader | WM2Urgency | WM2Input)) {
cookies[c++] = xcb_get_property(p->conn, false, p->window, XCB_ATOM_WM_HINTS, XCB_ATOM_WM_HINTS, 0, 9);
}
@@ -4550,12 +4553,15 @@ void NETWinInfo::update(NET::Properties dirtyProperties, NET::Properties2 dirtyP
p->transient_for = get_value_reply
From 59cb063b99e6ec13c0bc3cf3fd95a01258184e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?=
Date: Fri, 12 Sep 2014 16:04:01 +0200 Subject: [PATCH 07/13] Add support for protocols to NETWinInfo
NETWinInfo is now able to read all known protocols set on WM_PROTOCOLS
property and provides the set protocols as flags.
So far the following protocols are supported:
* WM_TAKE_FOCUS (ICCCM 4.1.2.7)
* WM_DELETE_WINDOW (ICCCM 4.1.2.7)
* _NET_WM_SYNC_REQUEST (EWMH)
* _NET_WM_PING (EWMH)
* _NET_WM_CONTEXT_HELP (KDE specific extension to EWMH)
REVIEW: 120213
CHANGELOG: NETWinInfo provides convenient wrapper for WM_PROTOCOLS.
---
src/netwm.cpp | 46 +++++++++++++-
src/netwm.h | 13 ++++
src/netwm_def.h | 19 ++++++
src/netwm_p.h | 1 +
5 files changed, 201 insertions(+), 1 deletion(-)
diff --git a/src/netwm.cpp b/src/netwm.cpp
index 1431cf6..3107a23 100644
--- a/src/netwm.cpp
+++ b/src/netwm.cpp
@@ -118,7 +118,11 @@ static xcb_atom_t kde_net_wm_shadow = 0;
// application protocols
static xcb_atom_t wm_protocols = 0;
+static xcb_atom_t wm_take_focus = 0;
+static xcb_atom_t wm_delete_window = 0;
static xcb_atom_t net_wm_ping = 0;
+static xcb_atom_t net_wm_sync_request = 0;
+static xcb_atom_t net_wm_context_help = 0;
// application window types
static xcb_atom_t net_wm_window_type_normal = 0;
@@ -382,7 +386,7 @@ static QByteArray get_atom_name(xcb_connection_t *c, xcb_atom_t atom)
}
#endif
-static const int netAtomCount = 88;
+static const int netAtomCount = 91;
static void create_netwm_atoms(xcb_connection_t *c)
{
@@ -481,6 +485,10 @@ static void create_netwm_atoms(xcb_connection_t *c)
{ "WM_STATE", &xa_wm_state },
{ "WM_PROTOCOLS", &wm_protocols },
+ { "WM_TAKE_FOCUS", &wm_take_focus },
+ { "WM_DELETE_WINDOW", &wm_delete_window },
+ { "_NET_WM_SYNC_REQUEST", &net_wm_sync_request },
+ { "_NET_WM_CONTEXT_HELP", &net_wm_context_help },
{ "_NET_WM_FULL_PLACEMENT", &net_wm_full_placement },
{ "_KDE_NET_WM_ACTIVITIES", &kde_net_wm_activities },
@@ -2765,6 +2773,7 @@ NETWinInfo::NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_wi
p->blockCompositing = false;
p->urgency = false;
p->input = true;
+ p->protocols = NET::NoProtocol;
// p->strut.left = p->strut.right = p->strut.top = p->strut.bottom = 0;
// p->frame_strut.left = p->frame_strut.right = p->frame_strut.top =
@@ -2826,6 +2835,7 @@ NETWinInfo::NETWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_wi
p->blockCompositing = false;
p->urgency = false;
p->input = true;
+ p->protocols = NET::NoProtocol;
// p->strut.left = p->strut.right = p->strut.top = p->strut.bottom = 0;
// p->frame_strut.left = p->frame_strut.right = p->frame_strut.top =
@@ -3937,6 +3947,8 @@ void NETWinInfo::event(xcb_generic_event_t *event, NET::Properties *properties,
dirty2 |= WM2BlockCompositing;
} else if (pe->atom == kde_net_wm_shadow) {
dirty2 |= WM2KDEShadow;
+ } else if (pe->atom == wm_protocols) {
+ dirty2 |= WM2Protocols;
}
do_update = true;
@@ -4115,6 +4127,10 @@ void NETWinInfo::update(NET::Properties dirtyProperties, NET::Properties2 dirtyP
cookies[c++] = xcb_get_property(p->conn, false, p->window, XCB_ATOM_WM_CLIENT_MACHINE, XCB_ATOM_STRING, 0, MAX_PROP_SIZE);
}
+ if (dirty2 & WM2Protocols) {
+ cookies[c++] = xcb_get_property(p->conn, false, p->window, wm_protocols, XCB_ATOM_ATOM, 0, 2048);
+ }
+
c = 0;
if (dirty & XAWMState) {
@@ -4605,6 +4621,24 @@ void NETWinInfo::update(NET::Properties dirtyProperties, NET::Properties2 dirtyP
p->client_machine = nstrndup(value.constData(), value.length());
}
}
+
+ if (dirty2 & WM2Protocols) {
+ const QVector