Merge lp:~smspillaz/compiz-core/compiz-core.fix_904806v2 into lp:compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 2918
Merged at revision: 2919
Proposed branch: lp:~smspillaz/compiz-core/compiz-core.fix_904806v2
Merge into: lp:compiz-core/0.9.5
Diff against target: 144 lines (+33/-1)
6 files modified
include/core/atoms.h (+1/-0)
include/core/window.h (+6/-1)
src/atoms.cpp (+3/-0)
src/event.cpp (+9/-0)
src/screen.cpp (+3/-0)
src/window.cpp (+11/-0)
To merge this branch: bzr merge lp:~smspillaz/compiz-core/compiz-core.fix_904806v2
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Review via email: mp+89305@code.launchpad.net

Description of the change

      Support _NET_WM_STATE_FOCUSED (LP #904806)

      +_NET_WM_STATE_FOCUSED indicates whether the window's decorations are drawn in an
      +active state. Clients MUST regard it as a read-only hint. It cannot be set at
      +map time or changed via a _NET_WM_STATE client message. The window given by
      +_NET_ACTIVE_WINDOW will usually have this hint, but at times other windows may
      +as well, if they have a strong association with the active window and will be
      +considered as a unit with it by the user. Clients that modify the appearance of
      +internal elements when a toplevel has keyboard focus SHOULD check for the
      +availability of this state in _NET_SUPPORTED and, if it is available,
      +use it in preference to tracking focus via FocusIn events. By doing so they will
      +match the window decorations and accurately reflect the intentions of the Window
      +Manager.

      [1] http://cgit.freedesktop.org/xdg/xdg-specs/commit/?id=e34d84a17341bb82af38fb84c6c070bb58b6d5b5

XWMQA Test: lp:~smspillaz/+junk/net-wm-state-focused-test

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

OK AFAICS

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/core/atoms.h'
2--- include/core/atoms.h 2009-02-26 06:04:15 +0000
3+++ include/core/atoms.h 2012-01-19 17:54:25 +0000
4@@ -81,6 +81,7 @@
5 extern Atom winStateBelow;
6 extern Atom winStateDemandsAttention;
7 extern Atom winStateDisplayModal;
8+ extern Atom winStateFocused;
9
10 extern Atom winActionMove;
11 extern Atom winActionResize;
12
13=== modified file 'include/core/window.h'
14--- include/core/window.h 2011-09-19 12:54:22 +0000
15+++ include/core/window.h 2012-01-19 17:54:25 +0000
16@@ -93,6 +93,7 @@
17 #define CompWindowStateBelowMask (1 << 10)
18 #define CompWindowStateDemandsAttentionMask (1 << 11)
19 #define CompWindowStateDisplayModalMask (1 << 12)
20+#define CompWindowStateFocusedMask (1 << 13)
21
22 #define MAXIMIZE_STATE (CompWindowStateMaximizedHorzMask | \
23 CompWindowStateMaximizedVertMask)
24@@ -256,6 +257,8 @@
25 virtual bool alpha ();
26 virtual bool isFocussable ();
27 virtual bool managed ();
28+
29+ virtual bool focused ();
30 };
31
32 /**
33@@ -263,7 +266,7 @@
34 * window state, geometry, etc. between Compiz and the X server.
35 */
36 class CompWindow :
37- public WrapableHandler<WindowInterface, 19>,
38+ public WrapableHandler<WindowInterface, 20>,
39 public PluginClassStorage
40 {
41 public:
42@@ -553,6 +556,8 @@
43 WRAPABLE_HND (17, WindowInterface, bool, isFocussable);
44 WRAPABLE_HND (18, WindowInterface, bool, managed);
45
46+ WRAPABLE_HND (19, WindowInterface, bool, focused);
47+
48 friend class PrivateWindow;
49 friend class CompScreen;
50 friend class PrivateScreen;
51
52=== modified file 'src/atoms.cpp'
53--- src/atoms.cpp 2009-02-26 06:04:15 +0000
54+++ src/atoms.cpp 2012-01-19 17:54:25 +0000
55@@ -78,6 +78,7 @@
56 Atom winStateBelow;
57 Atom winStateDemandsAttention;
58 Atom winStateDisplayModal;
59+ Atom winStateFocused;
60
61 Atom winActionMove;
62 Atom winActionResize;
63@@ -228,6 +229,8 @@
64 XInternAtom (dpy, "_NET_WM_STATE_DEMANDS_ATTENTION", 0);
65 winStateDisplayModal =
66 XInternAtom (dpy, "_NET_WM_STATE_DISPLAY_MODAL", 0);
67+ winStateFocused =
68+ XInternAtom (dpy, "_NET_WM_STATE_FOCUSED", 0);
69
70 winActionMove = XInternAtom (dpy, "_NET_WM_ACTION_MOVE", 0);
71 winActionResize =
72
73=== modified file 'src/event.cpp'
74--- src/event.cpp 2012-01-19 06:08:11 +0000
75+++ src/event.cpp 2012-01-19 17:54:25 +0000
76@@ -1906,9 +1906,18 @@
77 }
78 }
79
80+ active->changeState (active->focused () ?
81+ active->state () | CompWindowStateFocusedMask :
82+ active->state () & ~CompWindowStateFocusedMask);
83+
84 active->priv->updatePassiveButtonGrabs ();
85 }
86
87+ if (w->focused ())
88+ state |= w->state () | CompWindowStateFocusedMask;
89+ else
90+ state &= w->state () & ~CompWindowStateFocusedMask;
91+
92 w->priv->updatePassiveButtonGrabs ();
93
94 priv->addToCurrentActiveWindowHistory (w->id ());
95
96=== modified file 'src/screen.cpp'
97--- src/screen.cpp 2012-01-19 06:08:11 +0000
98+++ src/screen.cpp 2012-01-19 17:54:25 +0000
99@@ -1328,6 +1328,8 @@
100 data[i++] = Atoms::winStateDemandsAttention;
101 if (state & CompWindowStateDisplayModalMask)
102 data[i++] = Atoms::winStateDisplayModal;
103+ if (state & CompWindowStateFocusedMask)
104+ data[i++] = Atoms::winStateFocused;
105
106 XChangeProperty (priv->dpy, id, Atoms::winState,
107 XA_ATOM, 32, PropModeReplace,
108@@ -2198,6 +2200,7 @@
109 atoms.push_back (Atoms::winStateAbove);
110 atoms.push_back (Atoms::winStateBelow);
111 atoms.push_back (Atoms::winStateDemandsAttention);
112+ atoms.push_back (Atoms::winStateFocused);
113
114 atoms.push_back (Atoms::winOpacity);
115 atoms.push_back (Atoms::winBrightness);
116
117=== modified file 'src/window.cpp'
118--- src/window.cpp 2012-01-19 06:08:11 +0000
119+++ src/window.cpp 2012-01-19 17:54:25 +0000
120@@ -5699,6 +5699,10 @@
121 WindowInterface::managed ()
122 WRAPABLE_DEF (managed);
123
124+bool
125+WindowInterface::focused ()
126+ WRAPABLE_DEF (focused);
127+
128 Window
129 CompWindow::id ()
130 {
131@@ -6056,6 +6060,13 @@
132 }
133
134 bool
135+CompWindow::focused ()
136+{
137+ WRAPABLE_HND_FUNCTN_RETURN (bool, focused);
138+ return screen->activeWindow () == id ();
139+}
140+
141+bool
142 CompWindow::grabbed ()
143 {
144 return priv->grabbed;

Subscribers

People subscribed via source and target branches