Merge lp:~alan-griffiths/compiz-core/more-PrivateScreen-tidy-up into lp:compiz-core/0.9.8

Proposed by Alan Griffiths
Status: Merged
Merged at revision: 3129
Proposed branch: lp:~alan-griffiths/compiz-core/more-PrivateScreen-tidy-up
Merge into: lp:compiz-core/0.9.8
Diff against target: 334 lines (+133/-130)
2 files modified
src/privatescreen.h (+98/-100)
src/screen.cpp (+35/-30)
To merge this branch: bzr merge lp:~alan-griffiths/compiz-core/more-PrivateScreen-tidy-up
Reviewer Review Type Date Requested Status
Sam Spilsbury Approve
Review via email: mp+104938@code.launchpad.net

Description of the change

More tidy-up of PrivateScreen code

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/privatescreen.h'
2--- src/privatescreen.h 2012-05-04 11:55:34 +0000
3+++ src/privatescreen.h 2012-05-07 16:39:19 +0000
4@@ -75,11 +75,13 @@
5
6 int outputDeviceForGeometry(const CompWindow::Geometry& gm, int strategy,
7 CompScreen* screen) const;
8+ void updateOutputDevices(CoreOptions& coreOptions, CompScreen* screen);
9+
10+private:
11 void setGeometryOnDevice(unsigned int nOutput, int x, int y,
12 const int width, const int height);
13 void adoptDevices(unsigned int nOutput);
14
15-private:
16 static CompRect computeWorkareaForBox(const CompRect& box,
17 const CompWindowList& windows);
18
19@@ -712,105 +714,101 @@
20 int getXkbEvent() const { return xkbEvent.get(); }
21 std::vector<XineramaScreenInfo>& getScreenInfo () { return screenInfo; }
22 SnDisplay* getSnDisplay () const { return snDisplay; }
23- char const* displayString () const { return displayString_; }
24- CompRegion const& getRegion () const { return region; }
25- XWindowAttributes const& getAttrib () const { return attrib; }
26- Window rootWindow() const { return root; }
27- void identifyEdgeWindow(Window id);
28-
29- void setPlugins(CompOption::Value::Vector const& vList);
30- void initPlugins();
31-
32- void updateClientList () { windowManager.updateClientList (*this); }
33-
34- void detectOutputDevices (CoreOptions& coreOptions);
35- void updateOutputDevices (CoreOptions& coreOptions);
36-
37- public:
38- Display *dpy;
39- ::compiz::private_screen::Extension xSync;
40- ::compiz::private_screen::Extension xRandr;
41- ::compiz::private_screen::Extension xShape;
42- ::compiz::private_screen::History history;
43-
44- ::compiz::private_screen::ViewPort viewPort;
45- ::compiz::private_screen::StartupSequenceImpl startupSequence;
46- ::compiz::private_screen::GrabManager grabManager;
47- ::compiz::private_screen::EventManager eventManager;
48- ::compiz::private_screen::Ping ping;
49- ::compiz::private_screen::OrphanData orphanData;
50- ::compiz::private_screen::OutputDevices outputDevices;
51- ::compiz::private_screen::WindowManager windowManager;
52-
53- private:
54- CompScreen* screen;
55- ::compiz::private_screen::Extension xkbEvent;
56-
57- //TODO? Pull these two out as a class?
58- bool xineramaExtension;
59- std::vector<XineramaScreenInfo> screenInfo;
60-
61- SnDisplay *snDisplay;
62-
63- char displayString_[256];
64-
65- KeyCode escapeKeyCode;
66- KeyCode returnKeyCode;
67-
68- public:
69- Colormap colormap;
70- int screenNum;
71-
72- unsigned int nDesktop;
73- unsigned int currentDesktop;
74-
75- private:
76- CompRegion region;
77-
78- Window root;
79-
80- XWindowAttributes attrib;
81- public:
82-
83- CompOutput fullscreenOutput;
84-
85- CompScreenEdge screenEdge[SCREEN_EDGE_NUM];
86-
87- private:
88- SnMonitorContext *snContext;
89-
90- public:
91- Window wmSnSelectionWindow;
92- private:
93- Atom wmSnAtom;
94- Time wmSnTimestamp;
95-
96- public:
97- Cursor normalCursor;
98- Cursor busyCursor;
99- Cursor invisibleCursor;
100-
101- CompRect workArea;
102-
103- unsigned int showingDesktopMask;
104-
105- private:
106- unsigned long *desktopHintData;
107- int desktopHintSize;
108-
109- public:
110- bool initialized;
111-
112- private:
113- bool handlePingTimeout ();
114-
115- Window edgeWindow;
116-
117- CompTimer pingTimer;
118- CompTimer edgeDelayTimer;
119- CompDelayedEdgeSettings edgeDelaySettings;
120- Window xdndWindow;
121- ::compiz::private_screen::PluginManager pluginManager;
122+ const char* displayString() const
123+ {
124+ return displayString_;
125+ }
126+
127+ const CompRegion& getRegion() const
128+ {
129+ return region;
130+ }
131+
132+ const XWindowAttributes& getAttrib() const
133+ {
134+ return attrib;
135+ }
136+
137+ Window rootWindow() const
138+ {
139+ return root;
140+ }
141+
142+ void identifyEdgeWindow(Window id);
143+ void setPlugins(const CompOption::Value::Vector& vList);
144+ void initPlugins();
145+
146+ void updateClientList()
147+ {
148+ windowManager.updateClientList(*this);
149+ }
150+
151+ void detectOutputDevices(CoreOptions& coreOptions);
152+ void updateOutputDevices(CoreOptions& coreOptions);
153+
154+public:
155+ Display* dpy;
156+ compiz::private_screen::Extension xSync;
157+ compiz::private_screen::Extension xRandr;
158+ compiz::private_screen::Extension xShape;
159+ compiz::private_screen::History history;
160+ compiz::private_screen::ViewPort viewPort;
161+ compiz::private_screen::StartupSequenceImpl startupSequence;
162+ compiz::private_screen::GrabManager grabManager;
163+ compiz::private_screen::EventManager eventManager;
164+ compiz::private_screen::Ping ping;
165+ compiz::private_screen::OrphanData orphanData;
166+ compiz::private_screen::OutputDevices outputDevices;
167+ compiz::private_screen::WindowManager windowManager;
168+
169+ Colormap colormap;
170+ int screenNum;
171+ unsigned int nDesktop;
172+ unsigned int currentDesktop;
173+
174+ CompOutput fullscreenOutput;
175+ CompScreenEdge screenEdge[SCREEN_EDGE_NUM];
176+
177+ Window wmSnSelectionWindow;
178+
179+ Cursor normalCursor;
180+ Cursor busyCursor;
181+ Cursor invisibleCursor;
182+ CompRect workArea;
183+ unsigned int showingDesktopMask;
184+
185+ bool initialized;
186+
187+private:
188+ bool handlePingTimeout();
189+
190+ CompScreen* screen;
191+ compiz::private_screen::Extension xkbEvent;
192+ //TODO? Pull these two out as a class?
193+ bool xineramaExtension;
194+ std::vector<XineramaScreenInfo> screenInfo;
195+ SnDisplay* snDisplay;
196+ char displayString_[256];
197+ KeyCode escapeKeyCode;
198+ KeyCode returnKeyCode;
199+
200+ CompRegion region;
201+ Window root;
202+ XWindowAttributes attrib;
203+
204+ SnMonitorContext* snContext;
205+
206+ Atom wmSnAtom;
207+ Time wmSnTimestamp;
208+
209+ unsigned long *desktopHintData;
210+ int desktopHintSize;
211+
212+ Window edgeWindow;
213+ CompTimer pingTimer;
214+ CompTimer edgeDelayTimer;
215+ CompDelayedEdgeSettings edgeDelaySettings;
216+ Window xdndWindow;compiz::private_screen::PluginManager pluginManager;
217 };
218
219 class CompManager
220
221=== modified file 'src/screen.cpp'
222--- src/screen.cpp 2012-05-04 11:55:34 +0000
223+++ src/screen.cpp 2012-05-07 16:39:19 +0000
224@@ -1988,32 +1988,32 @@
225 if (outputDevs[i].intersects(outputDevs[j]))
226 overlappingOutputs = true;
227 }
228+
229 void
230-PrivateScreen::updateOutputDevices (CoreOptions& coreOptions)
231+cps::OutputDevices::updateOutputDevices(CoreOptions& coreOptions, CompScreen* screen)
232 {
233- CompOption::Value::Vector &list = coreOptions.optionGetOutputs ();
234- unsigned int nOutput = 0;
235- int x, y, bits;
236- unsigned int uWidth, uHeight;
237- int width, height;
238- int x1, y1, x2, y2;
239-
240- foreach (CompOption::Value &value, list)
241+ CompOption::Value::Vector& list = coreOptions.optionGetOutputs();
242+ unsigned int nOutput = 0;
243+ int x, y, bits;
244+ unsigned int uWidth, uHeight;
245+ int width, height;
246+ int x1, y1, x2, y2;
247+ foreach(CompOption::Value & value, list)
248 {
249- x = 0;
250- y = 0;
251- uWidth = (unsigned) screen->width ();
252- uHeight = (unsigned) screen->height ();
253+ x = 0;
254+ y = 0;
255+ uWidth = (unsigned) screen->width();
256+ uHeight = (unsigned) screen->height();
257
258- bits = XParseGeometry (value.s ().c_str (), &x, &y, &uWidth, &uHeight);
259- width = (int) uWidth;
260+ bits = XParseGeometry(value.s().c_str(), &x, &y, &uWidth, &uHeight);
261+ width = (int) uWidth;
262 height = (int) uHeight;
263
264 if (bits & XNegative)
265- x = screen->width () + x - width;
266+ x = screen->width() + x - width;
267
268 if (bits & YNegative)
269- y = screen->height () + y - height;
270+ y = screen->height() + y - height;
271
272 x1 = x;
273 y1 = y;
274@@ -2024,19 +2024,24 @@
275 x1 = 0;
276 if (y1 < 0)
277 y1 = 0;
278- if (x2 > screen->width ())
279- x2 = screen->width ();
280- if (y2 > screen->height ())
281- y2 = screen->height ();
282+ if (x2 > screen->width())
283+ x2 = screen->width();
284+ if (y2 > screen->height())
285+ y2 = screen->height();
286
287 if (x1 < x2 && y1 < y2)
288 {
289- outputDevices.setGeometryOnDevice(nOutput, x1, y1, x2 - x1, y2 - y1);
290+ setGeometryOnDevice(nOutput, x1, y1, x2 - x1, y2 - y1);
291 nOutput++;
292 }
293 }
294+ adoptDevices(nOutput);
295+}
296
297- outputDevices.adoptDevices(nOutput);
298+void
299+PrivateScreen::updateOutputDevices (CoreOptions& coreOptions)
300+{
301+ outputDevices.updateOutputDevices(coreOptions, screen);
302
303 /* clear out fullscreen monitor hints of all windows as
304 suggested on monitor layout changes in EWMH */
305@@ -5224,22 +5229,22 @@
306 startupSequence(this),
307 grabManager (screen),
308 eventManager (),
309- screen(screen),
310- screenInfo (),
311- snDisplay(0),
312 nDesktop (1),
313 currentDesktop (0),
314- root(None),
315- snContext (0),
316 wmSnSelectionWindow (None),
317- wmSnAtom (None),
318 normalCursor (None),
319 busyCursor (None),
320 invisibleCursor (None),
321 showingDesktopMask (0),
322+ initialized (false),
323+ screen(screen),
324+ screenInfo (),
325+ snDisplay(0),
326+ root(None),
327+ snContext (0),
328+ wmSnAtom (None),
329 desktopHintData (0),
330 desktopHintSize (0),
331- initialized (false),
332 edgeWindow (None),
333 edgeDelayTimer (),
334 xdndWindow (None)

Subscribers

People subscribed via source and target branches