Merge lp:~alan-griffiths/compiz-core/more-PrivateScreen-tidy-up into lp:compiz-core/0.9.8
- more-PrivateScreen-tidy-up
- Merge into 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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sam Spilsbury | Approve | ||
Review via email: mp+104938@code.launchpad.net |
Commit message
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 | 75 | 75 | ||
6 | 76 | int outputDeviceForGeometry(const CompWindow::Geometry& gm, int strategy, | 76 | int outputDeviceForGeometry(const CompWindow::Geometry& gm, int strategy, |
7 | 77 | CompScreen* screen) const; | 77 | CompScreen* screen) const; |
8 | 78 | void updateOutputDevices(CoreOptions& coreOptions, CompScreen* screen); | ||
9 | 79 | |||
10 | 80 | private: | ||
11 | 78 | void setGeometryOnDevice(unsigned int nOutput, int x, int y, | 81 | void setGeometryOnDevice(unsigned int nOutput, int x, int y, |
12 | 79 | const int width, const int height); | 82 | const int width, const int height); |
13 | 80 | void adoptDevices(unsigned int nOutput); | 83 | void adoptDevices(unsigned int nOutput); |
14 | 81 | 84 | ||
15 | 82 | private: | ||
16 | 83 | static CompRect computeWorkareaForBox(const CompRect& box, | 85 | static CompRect computeWorkareaForBox(const CompRect& box, |
17 | 84 | const CompWindowList& windows); | 86 | const CompWindowList& windows); |
18 | 85 | 87 | ||
19 | @@ -712,105 +714,101 @@ | |||
20 | 712 | int getXkbEvent() const { return xkbEvent.get(); } | 714 | int getXkbEvent() const { return xkbEvent.get(); } |
21 | 713 | std::vector<XineramaScreenInfo>& getScreenInfo () { return screenInfo; } | 715 | std::vector<XineramaScreenInfo>& getScreenInfo () { return screenInfo; } |
22 | 714 | SnDisplay* getSnDisplay () const { return snDisplay; } | 716 | SnDisplay* getSnDisplay () const { return snDisplay; } |
122 | 715 | char const* displayString () const { return displayString_; } | 717 | const char* displayString() const |
123 | 716 | CompRegion const& getRegion () const { return region; } | 718 | { |
124 | 717 | XWindowAttributes const& getAttrib () const { return attrib; } | 719 | return displayString_; |
125 | 718 | Window rootWindow() const { return root; } | 720 | } |
126 | 719 | void identifyEdgeWindow(Window id); | 721 | |
127 | 720 | 722 | const CompRegion& getRegion() const | |
128 | 721 | void setPlugins(CompOption::Value::Vector const& vList); | 723 | { |
129 | 722 | void initPlugins(); | 724 | return region; |
130 | 723 | 725 | } | |
131 | 724 | void updateClientList () { windowManager.updateClientList (*this); } | 726 | |
132 | 725 | 727 | const XWindowAttributes& getAttrib() const | |
133 | 726 | void detectOutputDevices (CoreOptions& coreOptions); | 728 | { |
134 | 727 | void updateOutputDevices (CoreOptions& coreOptions); | 729 | return attrib; |
135 | 728 | 730 | } | |
136 | 729 | public: | 731 | |
137 | 730 | Display *dpy; | 732 | Window rootWindow() const |
138 | 731 | ::compiz::private_screen::Extension xSync; | 733 | { |
139 | 732 | ::compiz::private_screen::Extension xRandr; | 734 | return root; |
140 | 733 | ::compiz::private_screen::Extension xShape; | 735 | } |
141 | 734 | ::compiz::private_screen::History history; | 736 | |
142 | 735 | 737 | void identifyEdgeWindow(Window id); | |
143 | 736 | ::compiz::private_screen::ViewPort viewPort; | 738 | void setPlugins(const CompOption::Value::Vector& vList); |
144 | 737 | ::compiz::private_screen::StartupSequenceImpl startupSequence; | 739 | void initPlugins(); |
145 | 738 | ::compiz::private_screen::GrabManager grabManager; | 740 | |
146 | 739 | ::compiz::private_screen::EventManager eventManager; | 741 | void updateClientList() |
147 | 740 | ::compiz::private_screen::Ping ping; | 742 | { |
148 | 741 | ::compiz::private_screen::OrphanData orphanData; | 743 | windowManager.updateClientList(*this); |
149 | 742 | ::compiz::private_screen::OutputDevices outputDevices; | 744 | } |
150 | 743 | ::compiz::private_screen::WindowManager windowManager; | 745 | |
151 | 744 | 746 | void detectOutputDevices(CoreOptions& coreOptions); | |
152 | 745 | private: | 747 | void updateOutputDevices(CoreOptions& coreOptions); |
153 | 746 | CompScreen* screen; | 748 | |
154 | 747 | ::compiz::private_screen::Extension xkbEvent; | 749 | public: |
155 | 748 | 750 | Display* dpy; | |
156 | 749 | //TODO? Pull these two out as a class? | 751 | compiz::private_screen::Extension xSync; |
157 | 750 | bool xineramaExtension; | 752 | compiz::private_screen::Extension xRandr; |
158 | 751 | std::vector<XineramaScreenInfo> screenInfo; | 753 | compiz::private_screen::Extension xShape; |
159 | 752 | 754 | compiz::private_screen::History history; | |
160 | 753 | SnDisplay *snDisplay; | 755 | compiz::private_screen::ViewPort viewPort; |
161 | 754 | 756 | compiz::private_screen::StartupSequenceImpl startupSequence; | |
162 | 755 | char displayString_[256]; | 757 | compiz::private_screen::GrabManager grabManager; |
163 | 756 | 758 | compiz::private_screen::EventManager eventManager; | |
164 | 757 | KeyCode escapeKeyCode; | 759 | compiz::private_screen::Ping ping; |
165 | 758 | KeyCode returnKeyCode; | 760 | compiz::private_screen::OrphanData orphanData; |
166 | 759 | 761 | compiz::private_screen::OutputDevices outputDevices; | |
167 | 760 | public: | 762 | compiz::private_screen::WindowManager windowManager; |
168 | 761 | Colormap colormap; | 763 | |
169 | 762 | int screenNum; | 764 | Colormap colormap; |
170 | 763 | 765 | int screenNum; | |
171 | 764 | unsigned int nDesktop; | 766 | unsigned int nDesktop; |
172 | 765 | unsigned int currentDesktop; | 767 | unsigned int currentDesktop; |
173 | 766 | 768 | ||
174 | 767 | private: | 769 | CompOutput fullscreenOutput; |
175 | 768 | CompRegion region; | 770 | CompScreenEdge screenEdge[SCREEN_EDGE_NUM]; |
176 | 769 | 771 | ||
177 | 770 | Window root; | 772 | Window wmSnSelectionWindow; |
178 | 771 | 773 | ||
179 | 772 | XWindowAttributes attrib; | 774 | Cursor normalCursor; |
180 | 773 | public: | 775 | Cursor busyCursor; |
181 | 774 | 776 | Cursor invisibleCursor; | |
182 | 775 | CompOutput fullscreenOutput; | 777 | CompRect workArea; |
183 | 776 | 778 | unsigned int showingDesktopMask; | |
184 | 777 | CompScreenEdge screenEdge[SCREEN_EDGE_NUM]; | 779 | |
185 | 778 | 780 | bool initialized; | |
186 | 779 | private: | 781 | |
187 | 780 | SnMonitorContext *snContext; | 782 | private: |
188 | 781 | 783 | bool handlePingTimeout(); | |
189 | 782 | public: | 784 | |
190 | 783 | Window wmSnSelectionWindow; | 785 | CompScreen* screen; |
191 | 784 | private: | 786 | compiz::private_screen::Extension xkbEvent; |
192 | 785 | Atom wmSnAtom; | 787 | //TODO? Pull these two out as a class? |
193 | 786 | Time wmSnTimestamp; | 788 | bool xineramaExtension; |
194 | 787 | 789 | std::vector<XineramaScreenInfo> screenInfo; | |
195 | 788 | public: | 790 | SnDisplay* snDisplay; |
196 | 789 | Cursor normalCursor; | 791 | char displayString_[256]; |
197 | 790 | Cursor busyCursor; | 792 | KeyCode escapeKeyCode; |
198 | 791 | Cursor invisibleCursor; | 793 | KeyCode returnKeyCode; |
199 | 792 | 794 | ||
200 | 793 | CompRect workArea; | 795 | CompRegion region; |
201 | 794 | 796 | Window root; | |
202 | 795 | unsigned int showingDesktopMask; | 797 | XWindowAttributes attrib; |
203 | 796 | 798 | ||
204 | 797 | private: | 799 | SnMonitorContext* snContext; |
205 | 798 | unsigned long *desktopHintData; | 800 | |
206 | 799 | int desktopHintSize; | 801 | Atom wmSnAtom; |
207 | 800 | 802 | Time wmSnTimestamp; | |
208 | 801 | public: | 803 | |
209 | 802 | bool initialized; | 804 | unsigned long *desktopHintData; |
210 | 803 | 805 | int desktopHintSize; | |
211 | 804 | private: | 806 | |
212 | 805 | bool handlePingTimeout (); | 807 | Window edgeWindow; |
213 | 806 | 808 | CompTimer pingTimer; | |
214 | 807 | Window edgeWindow; | 809 | CompTimer edgeDelayTimer; |
215 | 808 | 810 | CompDelayedEdgeSettings edgeDelaySettings; | |
216 | 809 | CompTimer pingTimer; | 811 | Window xdndWindow;compiz::private_screen::PluginManager pluginManager; |
118 | 810 | CompTimer edgeDelayTimer; | ||
119 | 811 | CompDelayedEdgeSettings edgeDelaySettings; | ||
120 | 812 | Window xdndWindow; | ||
121 | 813 | ::compiz::private_screen::PluginManager pluginManager; | ||
217 | 814 | }; | 812 | }; |
218 | 815 | 813 | ||
219 | 816 | class CompManager | 814 | class CompManager |
220 | 817 | 815 | ||
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 | 1988 | if (outputDevs[i].intersects(outputDevs[j])) | 1988 | if (outputDevs[i].intersects(outputDevs[j])) |
226 | 1989 | overlappingOutputs = true; | 1989 | overlappingOutputs = true; |
227 | 1990 | } | 1990 | } |
228 | 1991 | |||
229 | 1991 | void | 1992 | void |
231 | 1992 | PrivateScreen::updateOutputDevices (CoreOptions& coreOptions) | 1993 | cps::OutputDevices::updateOutputDevices(CoreOptions& coreOptions, CompScreen* screen) |
232 | 1993 | { | 1994 | { |
241 | 1994 | CompOption::Value::Vector &list = coreOptions.optionGetOutputs (); | 1995 | CompOption::Value::Vector& list = coreOptions.optionGetOutputs(); |
242 | 1995 | unsigned int nOutput = 0; | 1996 | unsigned int nOutput = 0; |
243 | 1996 | int x, y, bits; | 1997 | int x, y, bits; |
244 | 1997 | unsigned int uWidth, uHeight; | 1998 | unsigned int uWidth, uHeight; |
245 | 1998 | int width, height; | 1999 | int width, height; |
246 | 1999 | int x1, y1, x2, y2; | 2000 | int x1, y1, x2, y2; |
247 | 2000 | 2001 | foreach(CompOption::Value & value, list) | |
240 | 2001 | foreach (CompOption::Value &value, list) | ||
248 | 2002 | { | 2002 | { |
253 | 2003 | x = 0; | 2003 | x = 0; |
254 | 2004 | y = 0; | 2004 | y = 0; |
255 | 2005 | uWidth = (unsigned) screen->width (); | 2005 | uWidth = (unsigned) screen->width(); |
256 | 2006 | uHeight = (unsigned) screen->height (); | 2006 | uHeight = (unsigned) screen->height(); |
257 | 2007 | 2007 | ||
260 | 2008 | bits = XParseGeometry (value.s ().c_str (), &x, &y, &uWidth, &uHeight); | 2008 | bits = XParseGeometry(value.s().c_str(), &x, &y, &uWidth, &uHeight); |
261 | 2009 | width = (int) uWidth; | 2009 | width = (int) uWidth; |
262 | 2010 | height = (int) uHeight; | 2010 | height = (int) uHeight; |
263 | 2011 | 2011 | ||
264 | 2012 | if (bits & XNegative) | 2012 | if (bits & XNegative) |
266 | 2013 | x = screen->width () + x - width; | 2013 | x = screen->width() + x - width; |
267 | 2014 | 2014 | ||
268 | 2015 | if (bits & YNegative) | 2015 | if (bits & YNegative) |
270 | 2016 | y = screen->height () + y - height; | 2016 | y = screen->height() + y - height; |
271 | 2017 | 2017 | ||
272 | 2018 | x1 = x; | 2018 | x1 = x; |
273 | 2019 | y1 = y; | 2019 | y1 = y; |
274 | @@ -2024,19 +2024,24 @@ | |||
275 | 2024 | x1 = 0; | 2024 | x1 = 0; |
276 | 2025 | if (y1 < 0) | 2025 | if (y1 < 0) |
277 | 2026 | y1 = 0; | 2026 | y1 = 0; |
282 | 2027 | if (x2 > screen->width ()) | 2027 | if (x2 > screen->width()) |
283 | 2028 | x2 = screen->width (); | 2028 | x2 = screen->width(); |
284 | 2029 | if (y2 > screen->height ()) | 2029 | if (y2 > screen->height()) |
285 | 2030 | y2 = screen->height (); | 2030 | y2 = screen->height(); |
286 | 2031 | 2031 | ||
287 | 2032 | if (x1 < x2 && y1 < y2) | 2032 | if (x1 < x2 && y1 < y2) |
288 | 2033 | { | 2033 | { |
290 | 2034 | outputDevices.setGeometryOnDevice(nOutput, x1, y1, x2 - x1, y2 - y1); | 2034 | setGeometryOnDevice(nOutput, x1, y1, x2 - x1, y2 - y1); |
291 | 2035 | nOutput++; | 2035 | nOutput++; |
292 | 2036 | } | 2036 | } |
293 | 2037 | } | 2037 | } |
294 | 2038 | adoptDevices(nOutput); | ||
295 | 2039 | } | ||
296 | 2038 | 2040 | ||
298 | 2039 | outputDevices.adoptDevices(nOutput); | 2041 | void |
299 | 2042 | PrivateScreen::updateOutputDevices (CoreOptions& coreOptions) | ||
300 | 2043 | { | ||
301 | 2044 | outputDevices.updateOutputDevices(coreOptions, screen); | ||
302 | 2040 | 2045 | ||
303 | 2041 | /* clear out fullscreen monitor hints of all windows as | 2046 | /* clear out fullscreen monitor hints of all windows as |
304 | 2042 | suggested on monitor layout changes in EWMH */ | 2047 | suggested on monitor layout changes in EWMH */ |
305 | @@ -5224,22 +5229,22 @@ | |||
306 | 5224 | startupSequence(this), | 5229 | startupSequence(this), |
307 | 5225 | grabManager (screen), | 5230 | grabManager (screen), |
308 | 5226 | eventManager (), | 5231 | eventManager (), |
309 | 5227 | screen(screen), | ||
310 | 5228 | screenInfo (), | ||
311 | 5229 | snDisplay(0), | ||
312 | 5230 | nDesktop (1), | 5232 | nDesktop (1), |
313 | 5231 | currentDesktop (0), | 5233 | currentDesktop (0), |
314 | 5232 | root(None), | ||
315 | 5233 | snContext (0), | ||
316 | 5234 | wmSnSelectionWindow (None), | 5234 | wmSnSelectionWindow (None), |
317 | 5235 | wmSnAtom (None), | ||
318 | 5236 | normalCursor (None), | 5235 | normalCursor (None), |
319 | 5237 | busyCursor (None), | 5236 | busyCursor (None), |
320 | 5238 | invisibleCursor (None), | 5237 | invisibleCursor (None), |
321 | 5239 | showingDesktopMask (0), | 5238 | showingDesktopMask (0), |
322 | 5239 | initialized (false), | ||
323 | 5240 | screen(screen), | ||
324 | 5241 | screenInfo (), | ||
325 | 5242 | snDisplay(0), | ||
326 | 5243 | root(None), | ||
327 | 5244 | snContext (0), | ||
328 | 5245 | wmSnAtom (None), | ||
329 | 5240 | desktopHintData (0), | 5246 | desktopHintData (0), |
330 | 5241 | desktopHintSize (0), | 5247 | desktopHintSize (0), |
331 | 5242 | initialized (false), | ||
332 | 5243 | edgeWindow (None), | 5248 | edgeWindow (None), |
333 | 5244 | edgeDelayTimer (), | 5249 | edgeDelayTimer (), |
334 | 5245 | xdndWindow (None) | 5250 | xdndWindow (None) |