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
=== modified file 'include/core/atoms.h'
--- include/core/atoms.h 2009-02-26 06:04:15 +0000
+++ include/core/atoms.h 2012-01-19 17:54:25 +0000
@@ -81,6 +81,7 @@
81 extern Atom winStateBelow;81 extern Atom winStateBelow;
82 extern Atom winStateDemandsAttention;82 extern Atom winStateDemandsAttention;
83 extern Atom winStateDisplayModal;83 extern Atom winStateDisplayModal;
84 extern Atom winStateFocused;
8485
85 extern Atom winActionMove;86 extern Atom winActionMove;
86 extern Atom winActionResize;87 extern Atom winActionResize;
8788
=== modified file 'include/core/window.h'
--- include/core/window.h 2011-09-19 12:54:22 +0000
+++ include/core/window.h 2012-01-19 17:54:25 +0000
@@ -93,6 +93,7 @@
93#define CompWindowStateBelowMask (1 << 10)93#define CompWindowStateBelowMask (1 << 10)
94#define CompWindowStateDemandsAttentionMask (1 << 11)94#define CompWindowStateDemandsAttentionMask (1 << 11)
95#define CompWindowStateDisplayModalMask (1 << 12)95#define CompWindowStateDisplayModalMask (1 << 12)
96#define CompWindowStateFocusedMask (1 << 13)
9697
97#define MAXIMIZE_STATE (CompWindowStateMaximizedHorzMask | \98#define MAXIMIZE_STATE (CompWindowStateMaximizedHorzMask | \
98 CompWindowStateMaximizedVertMask)99 CompWindowStateMaximizedVertMask)
@@ -256,6 +257,8 @@
256 virtual bool alpha ();257 virtual bool alpha ();
257 virtual bool isFocussable ();258 virtual bool isFocussable ();
258 virtual bool managed ();259 virtual bool managed ();
260
261 virtual bool focused ();
259};262};
260263
261/**264/**
@@ -263,7 +266,7 @@
263 * window state, geometry, etc. between Compiz and the X server.266 * window state, geometry, etc. between Compiz and the X server.
264 */267 */
265class CompWindow :268class CompWindow :
266 public WrapableHandler<WindowInterface, 19>,269 public WrapableHandler<WindowInterface, 20>,
267 public PluginClassStorage270 public PluginClassStorage
268{271{
269 public:272 public:
@@ -553,6 +556,8 @@
553 WRAPABLE_HND (17, WindowInterface, bool, isFocussable);556 WRAPABLE_HND (17, WindowInterface, bool, isFocussable);
554 WRAPABLE_HND (18, WindowInterface, bool, managed);557 WRAPABLE_HND (18, WindowInterface, bool, managed);
555558
559 WRAPABLE_HND (19, WindowInterface, bool, focused);
560
556 friend class PrivateWindow;561 friend class PrivateWindow;
557 friend class CompScreen;562 friend class CompScreen;
558 friend class PrivateScreen;563 friend class PrivateScreen;
559564
=== modified file 'src/atoms.cpp'
--- src/atoms.cpp 2009-02-26 06:04:15 +0000
+++ src/atoms.cpp 2012-01-19 17:54:25 +0000
@@ -78,6 +78,7 @@
78 Atom winStateBelow;78 Atom winStateBelow;
79 Atom winStateDemandsAttention;79 Atom winStateDemandsAttention;
80 Atom winStateDisplayModal;80 Atom winStateDisplayModal;
81 Atom winStateFocused;
8182
82 Atom winActionMove;83 Atom winActionMove;
83 Atom winActionResize;84 Atom winActionResize;
@@ -228,6 +229,8 @@
228 XInternAtom (dpy, "_NET_WM_STATE_DEMANDS_ATTENTION", 0);229 XInternAtom (dpy, "_NET_WM_STATE_DEMANDS_ATTENTION", 0);
229 winStateDisplayModal =230 winStateDisplayModal =
230 XInternAtom (dpy, "_NET_WM_STATE_DISPLAY_MODAL", 0);231 XInternAtom (dpy, "_NET_WM_STATE_DISPLAY_MODAL", 0);
232 winStateFocused =
233 XInternAtom (dpy, "_NET_WM_STATE_FOCUSED", 0);
231234
232 winActionMove = XInternAtom (dpy, "_NET_WM_ACTION_MOVE", 0);235 winActionMove = XInternAtom (dpy, "_NET_WM_ACTION_MOVE", 0);
233 winActionResize =236 winActionResize =
234237
=== modified file 'src/event.cpp'
--- src/event.cpp 2012-01-19 06:08:11 +0000
+++ src/event.cpp 2012-01-19 17:54:25 +0000
@@ -1906,9 +1906,18 @@
1906 }1906 }
1907 }1907 }
19081908
1909 active->changeState (active->focused () ?
1910 active->state () | CompWindowStateFocusedMask :
1911 active->state () & ~CompWindowStateFocusedMask);
1912
1909 active->priv->updatePassiveButtonGrabs ();1913 active->priv->updatePassiveButtonGrabs ();
1910 }1914 }
19111915
1916 if (w->focused ())
1917 state |= w->state () | CompWindowStateFocusedMask;
1918 else
1919 state &= w->state () & ~CompWindowStateFocusedMask;
1920
1912 w->priv->updatePassiveButtonGrabs ();1921 w->priv->updatePassiveButtonGrabs ();
19131922
1914 priv->addToCurrentActiveWindowHistory (w->id ());1923 priv->addToCurrentActiveWindowHistory (w->id ());
19151924
=== modified file 'src/screen.cpp'
--- src/screen.cpp 2012-01-19 06:08:11 +0000
+++ src/screen.cpp 2012-01-19 17:54:25 +0000
@@ -1328,6 +1328,8 @@
1328 data[i++] = Atoms::winStateDemandsAttention;1328 data[i++] = Atoms::winStateDemandsAttention;
1329 if (state & CompWindowStateDisplayModalMask)1329 if (state & CompWindowStateDisplayModalMask)
1330 data[i++] = Atoms::winStateDisplayModal;1330 data[i++] = Atoms::winStateDisplayModal;
1331 if (state & CompWindowStateFocusedMask)
1332 data[i++] = Atoms::winStateFocused;
13311333
1332 XChangeProperty (priv->dpy, id, Atoms::winState,1334 XChangeProperty (priv->dpy, id, Atoms::winState,
1333 XA_ATOM, 32, PropModeReplace,1335 XA_ATOM, 32, PropModeReplace,
@@ -2198,6 +2200,7 @@
2198 atoms.push_back (Atoms::winStateAbove);2200 atoms.push_back (Atoms::winStateAbove);
2199 atoms.push_back (Atoms::winStateBelow);2201 atoms.push_back (Atoms::winStateBelow);
2200 atoms.push_back (Atoms::winStateDemandsAttention);2202 atoms.push_back (Atoms::winStateDemandsAttention);
2203 atoms.push_back (Atoms::winStateFocused);
22012204
2202 atoms.push_back (Atoms::winOpacity);2205 atoms.push_back (Atoms::winOpacity);
2203 atoms.push_back (Atoms::winBrightness);2206 atoms.push_back (Atoms::winBrightness);
22042207
=== modified file 'src/window.cpp'
--- src/window.cpp 2012-01-19 06:08:11 +0000
+++ src/window.cpp 2012-01-19 17:54:25 +0000
@@ -5699,6 +5699,10 @@
5699WindowInterface::managed ()5699WindowInterface::managed ()
5700 WRAPABLE_DEF (managed);5700 WRAPABLE_DEF (managed);
57015701
5702bool
5703WindowInterface::focused ()
5704 WRAPABLE_DEF (focused);
5705
5702Window5706Window
5703CompWindow::id ()5707CompWindow::id ()
5704{5708{
@@ -6056,6 +6060,13 @@
6056}6060}
60576061
6058bool6062bool
6063CompWindow::focused ()
6064{
6065 WRAPABLE_HND_FUNCTN_RETURN (bool, focused);
6066 return screen->activeWindow () == id ();
6067}
6068
6069bool
6059CompWindow::grabbed ()6070CompWindow::grabbed ()
6060{6071{
6061 return priv->grabbed;6072 return priv->grabbed;

Subscribers

People subscribed via source and target branches