Merge lp:~smspillaz/compiz-core/compiz-core.core_923087 into lp:compiz-core

Proposed by Sam Spilsbury
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3005
Merged at revision: 3008
Proposed branch: lp:~smspillaz/compiz-core/compiz-core.core_923087
Merge into: lp:compiz-core
Diff against target: 62 lines (+25/-8)
2 files modified
include/core/window.h (+8/-0)
src/screen.cpp (+17/-8)
To merge this branch: bzr merge lp:~smspillaz/compiz-core/compiz-core.core_923087
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Alan Griffiths Approve
Review via email: mp+93347@code.launchpad.net

Description of the change

Refactors out fillStateData since it was being duplicated in a plugin that was causing bug 932087

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

This seems overcomplicated:

62 + boost::scoped_array <Atom> data (new Atom[32]);

over

62 + Atom data[32];

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Agreed. scoped_array makes no sense for such a small array. You'd literally be adding hundreds if not thousands of bytes of template code for something that doesn't need it.

If a fixed size array works, then it should be used over a template.

3005. By Sam Spilsbury

Use a regular ptr

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Looks good. No obvious regressions either.

I do still wonder if core needs to contain multiple different namespaces though.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/core/window.h'
2--- include/core/window.h 2012-01-31 14:52:20 +0000
3+++ include/core/window.h 2012-02-16 10:16:31 +0000
4@@ -204,6 +204,14 @@
5 */
6 typedef compiz::window::extents::Extents CompWindowExtents;
7
8+namespace compiz
9+{
10+ namespace window
11+ {
12+ unsigned int fillStateData (unsigned int state, Atom *data);
13+ }
14+}
15+
16 /**
17 * Specifies the area of the screen taken up by strut windows
18 */
19
20=== modified file 'src/screen.cpp'
21--- src/screen.cpp 2012-02-16 01:11:23 +0000
22+++ src/screen.cpp 2012-02-16 10:16:31 +0000
23@@ -1411,10 +1411,9 @@
24 return state;
25 }
26
27-void
28-PrivateScreen::setWindowState (unsigned int state, Window id)
29+unsigned int
30+compiz::window::fillStateData (unsigned int state, Atom *data)
31 {
32- Atom data[32];
33 int i = 0;
34
35 if (state & CompWindowStateModalMask)
36@@ -1444,11 +1443,21 @@
37 if (state & CompWindowStateDisplayModalMask)
38 data[i++] = Atoms::winStateDisplayModal;
39 if (state & CompWindowStateFocusedMask)
40- data[i++] = Atoms::winStateFocused;
41-
42- XChangeProperty (dpy, id, Atoms::winState,
43- XA_ATOM, 32, PropModeReplace,
44- (unsigned char *) data, i);
45+ data[i++] = Atoms::winStateFocused;
46+
47+ return i;
48+}
49+
50+void
51+PrivateScreen::setWindowState (unsigned int state, Window id)
52+{
53+ int i = 0;
54+ Atom data[32];
55+
56+ if ((i = compiz::window::fillStateData (state, data)))
57+ XChangeProperty (dpy, id, Atoms::winState,
58+ XA_ATOM, 32, PropModeReplace,
59+ (unsigned char *) data, i);
60 }
61
62 unsigned int

Subscribers

People subscribed via source and target branches