Nux

Merge lp:~3v1n0/nux/xinputwindow-wm-pid into lp:nux

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: 801
Merged at revision: 797
Proposed branch: lp:~3v1n0/nux/xinputwindow-wm-pid
Merge into: lp:nux
Prerequisite: lp:~3v1n0/nux/xinputwindow-cache-atoms
Diff against target: 46 lines (+16/-0)
1 file modified
NuxGraphics/XInputWindow.cpp (+16/-0)
To merge this branch: bzr merge lp:~3v1n0/nux/xinputwindow-wm-pid
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Andrea Azzarone (community) Approve
Review via email: mp+169853@code.launchpad.net

Commit message

XInputWindow: define _NET_WM_PID and WM_CLIENT_MACHINE for nux windows

This makes them to be matched properly

Description of the change

Register the process pid that launched every nux input window, in this way BAMF can handle the unity windows as windows of the same application (that won't be shown anyway), instead of creating a new application for each window.
This reduces the usage of some resources both in bamf and in unity (that now will create only one hidden ApplicationLauncherIcon, instead of 5, in case of single monitor).

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

+ hostname[sizeof(hostname)-1] = '\0';

gethostname returns a null-terminated string. Do you really need that?

review: Needs Information
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

> + hostname[sizeof(hostname)-1] = '\0';
>
> gethostname returns a null-terminated string. Do you really need that?

Probably no, but just to be safer...

Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NuxGraphics/XInputWindow.cpp'
2--- NuxGraphics/XInputWindow.cpp 2013-06-17 16:57:39 +0000
3+++ NuxGraphics/XInputWindow.cpp 2013-06-17 16:57:39 +0000
4@@ -33,6 +33,8 @@
5 Atom WM_WINDOW_TYPE = 0;
6 Atom WM_WINDOW_TYPE_DOCK = 0;
7 Atom WM_STATE = 0;
8+ Atom WM_PID;
9+ Atom WM_CLIENT_MACHINE;
10 Atom WM_TAKE_FOCUS = 0;
11 Atom WM_STRUT_PARTIAL = 0;
12 Atom X_DND_AWARE = 0;
13@@ -51,6 +53,8 @@
14 WM_WINDOW_TYPE = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
15 WM_WINDOW_TYPE_DOCK = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
16 WM_STATE = XInternAtom(dpy, "_NET_WM_STATE", False);
17+ WM_PID = XInternAtom(dpy, "_NET_WM_PID", False);
18+ WM_CLIENT_MACHINE = XInternAtom(dpy, "WM_CLIENT_MACHINE", False);
19 WM_TAKE_FOCUS = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
20 X_DND_AWARE = XInternAtom(dpy, "XdndAware", False);
21
22@@ -71,6 +75,7 @@
23 , mapped_(false)
24 {
25 XSetWindowAttributes attrib;
26+ char hostname[256];
27
28 attrib.override_redirect = override_redirect;
29 attrib.event_mask = KeyPressMask |
30@@ -101,6 +106,17 @@
31 XChangeProperty(display_, window_, atom::WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace,
32 (unsigned char *) &atom::WM_WINDOW_TYPE_DOCK, 1);
33
34+ if (gethostname(hostname, sizeof(hostname)) > -1)
35+ {
36+ hostname[sizeof(hostname)-1] = '\0';
37+ XChangeProperty(display_, window_, atom::WM_CLIENT_MACHINE, XA_STRING, 8,
38+ PropModeReplace, (unsigned char *) hostname, strlen(hostname));
39+
40+ pid_t pid = getpid();
41+ XChangeProperty(display_, window_, atom::WM_PID, XA_CARDINAL, 32,
42+ PropModeReplace, (unsigned char *) &pid, 1);
43+ }
44+
45 XStoreName(display_, window_, title);
46 EnsureInputs();
47

Subscribers

People subscribed via source and target branches