Merge lp:~mc-return/compiz/compiz.merge-fix1169353-screenshot-needs-color-options into lp:compiz/0.9.10

Proposed by MC Return
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 3662
Merged at revision: 3667
Proposed branch: lp:~mc-return/compiz/compiz.merge-fix1169353-screenshot-needs-color-options
Merge into: lp:compiz/0.9.10
Diff against target: 300 lines (+93/-43)
3 files modified
plugins/screenshot/screenshot.xml.in (+30/-5)
plugins/screenshot/src/screenshot.cpp (+62/-38)
plugins/screenshot/src/screenshot.h (+1/-0)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-fix1169353-screenshot-needs-color-options
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Sam Spilsbury Approve
MC Return Needs Resubmitting
Review via email: mp+159038@code.launchpad.net

Commit message

*Screenshot, xml:

Better plugin summary.
Added option to disable the drawing of the screenshot
selection indicator.
Added options to change color and opacity of the outline
and the inside of the rectangle indicator, default colors
have not been changed.
Other minor improvements.

*Screenshot, code:

Introduced the new variable bool selectionSizeChanged,
which is true if the size of the selection has changed.

We just want to draw the screenshot selection box, if
we are grabbed, the size has changed and the CCSM
option to draw it is enabled.
Do not render anything if indicator is disabled.

Indicator colors are now configurable.
Increased indicator box outline line width to 2.0.

Only damage the full screen once, if the grab gets
terminated, during grab just damage the region painted,
which is the screenshot selection box (LP: #1172234).

*SCreenshot, cleanup:

Minor cleanup in the rendering code.
Removed redundant #ifndef USE_GLES compiler option,
GLES can cope with enabling and disabling GL_BLEND.
Use prefix- instead of postfix increments.
Declaration and assignment of local variables in one line.
Reduced the scope of the variables x1, y1, x2 and y2.
Replaced magic number 65535.0f with const float MaxUShortFloat =
std::numeric_limits <unsigned short>::max ();.
Indentation fixes.
C++ style for comments, added comments.

(LP: #1169353, LP: #1172234)

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

Looks mostly good, just a few tips:

115 +#ifndef USE_GLES
116 + glEnable (GL_BLEND);
117 +#endif
147 -#ifndef USE_GLES
148 - glEnable (GL_BLEND);
149 -#endif

Its not necessary to move that as it only needs to be enabled when draw commands are sent to the GPU. So it can stay in the same place.

119 + float alpha = ((float) optionGetFillColorAlpha () / 65535.0f);

This can be replaced with

float alpha = optionGetFillColorAlpha () / static_cast <float> (std::numeric_limits <unsigned short>::max ());

Three things to note with that:
 1. In order to get floating point division, you only need to have the denominator be a float and not the numerator.
 2. std::numeric_limits <unsigned short::max () is the preferable way of saying 65536
 3. static_cast should be preferred over c-style casts (eg (Type));

also:

125 + colorData[3] = alpha * 65535.0f;
becomes

colorData[3] = alpha * std::numeric_limits <unsigned short>::max ();

Finally, there are a few formatting changes scattered around here (though not as much as before). Try to split those two up as much as possible, as the areas where formatting changes were made were not really related to what this change is doing. They're fine to keep though, as they're correct.

Revision history for this message
MC Return (mc-return) wrote :

> Looks mostly good, just a few tips:
>
> 115 +#ifndef USE_GLES
> 116 + glEnable (GL_BLEND);
> 117 +#endif
> 147 -#ifndef USE_GLES
> 148 - glEnable (GL_BLEND);
> 149 -#endif
>
> Its not necessary to move that as it only needs to be enabled when draw
> commands are sent to the GPU. So it can stay in the same place.
>

Question: Do we really need those #ifndefs ?
GLES should have no problem with glEnable (GL_BLEND); and glDisable (GL_BLEND);, no ?

> 119 + float alpha = ((float) optionGetFillColorAlpha () /
> 65535.0f);
>
> This can be replaced with
>
> float alpha = optionGetFillColorAlpha () / static_cast <float>
> (std::numeric_limits <unsigned short>::max ());
>
I removed the redundant (float) casts in r3659.

> Three things to note with that:
> 1. In order to get floating point division, you only need to have the
> denominator be a float and not the numerator.
> 2. std::numeric_limits <unsigned short::max () is the preferable way of
> saying 65536
> 3. static_cast should be preferred over c-style casts (eg (Type));
>

2. AFAIK an unsigned short can have a different size, depending on the
hardware.
I am not convinced this is the best way to say 65535...

Maybe we can find another way ? (see the Ezoom MP also)

>
> Finally, there are a few formatting changes scattered around here (though not
> as much as before). Try to split those two up as much as possible, as the
> areas where formatting changes were made were not really related to what this
> change is doing. They're fine to keep though, as they're correct.

Yeah, sorry about that (again) - but it will get better each time we touch a
specific file.
Once most stuff has been cleaned up, it won't get cleaned up again ;)

Revision history for this message
MC Return (mc-return) :
review: Needs Information
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

The ifndefs are not necessary for enabling the blend state. Its a side effect of when Travis had turned on blend full-time, but we decided to revert that change because while it was certainly convenient, it had some performance implications and there are also some situations where blending is not desired.

short unsigned int basically going to be 16 bits on every architecture we care about. If we start caring about really exotic hardware then maybe that will need to change, but I don't imagine its the case now.

65535 is a lot easier to typo if you have it everywhere.

Revision history for this message
MC Return (mc-return) wrote :

Grmpf, during testing I found out that damage handling is also broken, I filed bug #1172234 about it.
This should be pretty easy to fix, so I'll do it here...

I still have a minor blending problem to fix, if you have a tip how to fix the
the-screenshot-selection-overlay-is-visible-on-screenshots-if-fbos-are-enabled
please shout out loud in the meantime... ;)

review: Needs Information
Revision history for this message
MC Return (mc-return) wrote :

Okay, all fixed now, except the
the-screenshot-selection-overlay-is-visible-on-screenshots-if-fbos-are-enabled issue...

The rest works perfectly now - had to fix some additional issues, please see
http://bazaar.launchpad.net/~mc-return/compiz/compiz.merge-fix1169353-screenshot-needs-color-options/revision/3661
for details.

The preview was overdrawing all the time, if no cursor movement was done. <- Fixed now.
The whole screen was damaged, instead of just the selection rectangle. <- Fixed now as well.

review: Needs Resubmitting
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Wed, Apr 24, 2013 at 4:03 AM, MC Return <email address hidden> wrote:
> Review: Needs Information
>
> Grmpf, during testing I found out that damage handling is also broken, I filed bug #1172234 about it.
> This should be pretty easy to fix, so I'll do it here...
>
Please do it separately. If there are comments I have about the damage
handling fix they'll also hold up this merge request too.

> I still have a minor blending problem to fix, if you have a tip how to fix the
> the-screenshot-selection-overlay-is-visible-on-screenshots-if-fbos-are-enabled
> please shout out loud in the meantime... ;)

You need to set the read buffer to GL_BACK I think. I'm a bit hesitant
about giving that advice though until we have a proper abstraction
for tracking framebuffer attachment points inside of compiz - querying
OpenGL is sloowwwww.

> --
> https://code.launchpad.net/~mc-return/compiz/compiz.merge-fix1169353-screenshot-needs-color-options/+merge/159038
> Your team Compiz Maintainers is requested to review the proposed merge of lp:~mc-return/compiz/compiz.merge-fix1169353-screenshot-needs-color-options into lp:compiz.

--
Sam Spilsbury

Revision history for this message
MC Return (mc-return) wrote :

> Please do it separately. If there are comments I have about the damage
> handling fix they'll also hold up this merge request too.
>
It is all already done and all fixed, I will explain in detail what I changed
to fix the damage handling, it was just a minor issue:

267 -
268 - cScreen->damageScreen ();
269 }
270 +
271 + cScreen->damageScreen ();

It was damaging the whole screen during a size change instead of just damaging
the screen once the operation was finished (the mouse button is released).

The other thing I fixed in r3661 was a permanent redraw problem, because the
overlay got overdrawn when there was no movement. This is now fixed also.
This was the blending problem I discovered and have written about earlier here:

> > I still have a minor blending problem to fix,

This was fixed by introducing the new variable bool selectionSizeChanged,
which is true if the size of the selection has changed, please see r3661
for details on this:

http://bazaar.launchpad.net/~mc-return/compiz/compiz.merge-fix1169353-screenshot-needs-color-options/revision/3661

>
> You need to set the read buffer to GL_BACK I think. I'm a bit hesitant
> about giving that advice though until we have a proper abstraction
> for tracking framebuffer attachment points inside of compiz - querying
> OpenGL is sloowwwww.
>

I will do some more experiments and try to fix this last issue in another MP.
Thanks a lot for the tip. :)

Revision history for this message
MC Return (mc-return) :
review: Needs Resubmitting
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Hrm, I don't think the way you've fixed this is really correct:

void
ShotScreen::handleMotionEvent (int xRoot,
          int yRoot)
{
    /* update screenshot rectangle size */
    if (mGrabIndex &&
 (mX2 != xRoot || mY2 != yRoot))
    {
 /* the size has changed now */
 selectionSizeChanged = true;

 int x1 = MIN (mX1, mX2) - 1;
 int y1 = MIN (mY1, mY2) - 1;
 int x2 = MAX (mX1, mX2) + 1;
 int y2 = MAX (mY1, mY2) + 1;

 cScreen->damageRegion (CompRegion (x1, y1, x2 - x1, y2 - y1));

 mX2 = xRoot;
 mY2 = yRoot;

 x1 = MIN (mX1, mX2) - 1;
 y1 = MIN (mY1, mY2) - 1;
 x2 = MAX (mX1, mX2) + 1;
 y2 = MAX (mY1, mY2) + 1;

 cScreen->damageRegion (CompRegion (x1, y1, x2 - x1, y2 - y1));
    }

    cScreen->damageScreen ();
}

The whole idea of those two damageRegion () calls is to mark the *old* selection rectangle region as damaged and then mark the new selection region as damaged, so that the damage area covers the selection area.

This change does that *and* damages the whole screen every time there is a motion event, regardless of whether or not screenshot even has an active grab or the mouse cursor position actually changed.

If the damage code isn't working, then you should look into why the current region-based damage isn't working rather than damaging the whole screen every time there is a motion event.

review: Needs Fixing
Revision history for this message
MC Return (mc-return) wrote :

> Hrm, I don't think the way you've fixed this is really correct:
>

> The whole idea of those two damageRegion () calls is to mark the *old*
> selection rectangle region as damaged and then mark the new selection region
> as damaged, so that the damage area covers the selection area.
>
> This change does that *and* damages the whole screen every time there is a
> motion event, regardless of whether or not screenshot even has an active grab
> or the mouse cursor position actually changed.
>
> If the damage code isn't working, then you should look into why the current
> region-based damage isn't working rather than damaging the whole screen every
> time there is a motion event.

You are right -> the fix is not entirely correct. The cScreen->damageScreen ();
call should be removed completely as we do never need to damage more than the
actual selection...

I'll fix that immediately.

Revision history for this message
MC Return (mc-return) wrote :

And the whole damage handling could be improved here, but without
the cScreen->damageScreen (); call it is already acting much more
sane, but it has some room for optimization still (no need to damage
the region twice for example)...

3662. By MC Return

We really never need to damage more than the selected region, removed
call to cScreen->damageScreen (); completely

Revision history for this message
MC Return (mc-return) wrote :

I will create a short video showing how the damaging for screenshot and ezoom now work if you like ?

Show Repaint is *awesome* for debugging this stuff !!!

review: Needs Resubmitting
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Looks good as it is now.

Don't change the current damageRegion code as it stands, its actually correct in its current form. Where you have a rectangle that varies in size, you should always mark the old rectangle as damaged as well as the new one, because you need to redraw the area underneath where the old rectangle was. This handles the case where the overlay-rectangle is getting smaller.

review: Approve
Revision history for this message
MC Return (mc-return) wrote :

> Looks good as it is now.
>

+1

> Don't change the current damageRegion code as it stands, its actually correct
> in its current form. Where you have a rectangle that varies in size, you
> should always mark the old rectangle as damaged as well as the new one,
> because you need to redraw the area underneath where the old rectangle was.
> This handles the case where the overlay-rectangle is getting smaller.

Never stop learning ;)

Now lets move to the freaking final screenshot issue... :)

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/screenshot/screenshot.xml.in'
--- plugins/screenshot/screenshot.xml.in 2012-10-15 10:31:51 +0000
+++ plugins/screenshot/screenshot.xml.in 2013-04-24 15:45:35 +0000
@@ -2,7 +2,7 @@
2<compiz>2<compiz>
3 <plugin name="screenshot" useBcop="true">3 <plugin name="screenshot" useBcop="true">
4 <_short>Screenshot</_short>4 <_short>Screenshot</_short>
5 <_long>Screenshot plugin</_long>5 <_long>Easily capture parts of your screen and save them as .png image</_long>
6 <category>Extras</category>6 <category>Extras</category>
7 <deps>7 <deps>
8 <requirement>8 <requirement>
@@ -17,18 +17,43 @@
17 <options>17 <options>
18 <option name="initiate_button" type="button">18 <option name="initiate_button" type="button">
19 <_short>Initiate</_short>19 <_short>Initiate</_short>
20 <_long>Initiate rectangle screenshot</_long>20 <_long>Initiate the capture, release the button to take the shot.</_long>
21 <default>&lt;Super&gt;Button1</default>21 <default>&lt;Super&gt;Button1</default>
22 </option>22 </option>
23 <option name="draw_selection_indicator" type="bool">
24 <_short>Draw Screenshot Selection Indicator</_short>
25 <_long>Draw a rectangle outline indicating the screenshot selection.</_long>
26 <default>true</default>
27 </option>
28 <option name="selection_outline_color" type="color">
29 <_short>Selection Indicator Outline Color</_short>
30 <_long>Color and opacity of the screenshot selection rectangle outline.</_long>
31 <default>
32 <red>0x2fff</red>
33 <green>0x2fff</green>
34 <blue>0x4fff</blue>
35 <alpha>0x9f9f</alpha>
36 </default>
37 </option>
38 <option name="selection_fill_color" type="color">
39 <_short>Selection Indicator Fill Color</_short>
40 <_long>Fill color and opacity of the screenshot selection rectangle.</_long>
41 <default>
42 <red>0x2fff</red>
43 <green>0x2fff</green>
44 <blue>0x4fff</blue>
45 <alpha>0x4fff</alpha>
46 </default>
47 </option>
23 <option name="directory" type="string">48 <option name="directory" type="string">
24 <_short>Directory</_short>49 <_short>Save Directory</_short>
25 <_long>Put screenshot images in this directory. If empty, the desktop directory will be used.</_long>50 <_long>Save screenshot images in this directory. If empty, the desktop directory will be used.</_long>
26 <hints>directory;</hints>51 <hints>directory;</hints>
27 <default></default>52 <default></default>
28 </option>53 </option>
29 <option name="launch_app" type="string">54 <option name="launch_app" type="string">
30 <_short>Launch Application</_short>55 <_short>Launch Application</_short>
31 <_long>Automatically open screenshot in this application</_long>56 <_long>Automatically open the screenshot in this application.</_long>
32 <default></default>57 <default></default>
33 </option>58 </option>
34 </options>59 </options>
3560
=== modified file 'plugins/screenshot/src/screenshot.cpp'
--- plugins/screenshot/src/screenshot.cpp 2013-04-13 22:29:01 +0000
+++ plugins/screenshot/src/screenshot.cpp 2013-04-24 15:45:35 +0000
@@ -34,8 +34,6 @@
34 #define scandir(a,b,c,d) scandir((a), (b), (c), (int(*)(const void*,const void*))(d));34 #define scandir(a,b,c,d) scandir((a), (b), (c), (int(*)(const void*,const void*))(d));
35#endif35#endif
3636
37
38
39COMPIZ_PLUGIN_20090315 (screenshot, ShotPluginVTable)37COMPIZ_PLUGIN_20090315 (screenshot, ShotPluginVTable)
4038
41bool39bool
@@ -58,7 +56,7 @@
58 if (state & CompAction::StateInitButton)56 if (state & CompAction::StateInitButton)
59 action->setState (action->state () | CompAction::StateTermButton);57 action->setState (action->state () | CompAction::StateTermButton);
6058
61 /* start selection screenshot rectangle */59 /* Start selection screenshot rectangle */
6260
63 mX1 = mX2 = pointerX;61 mX1 = mX2 = pointerX;
64 mY1 = mY2 = pointerY;62 mY1 = mY2 = pointerY;
@@ -82,7 +80,7 @@
8280
83 if (mGrabIndex)81 if (mGrabIndex)
84 {82 {
85 // Enable screen capture83 /* Enable screen capture */
86 cScreen->paintSetEnabled (this, true);84 cScreen->paintSetEnabled (this, true);
87 ::screen->removeGrab (mGrabIndex, 0);85 ::screen->removeGrab (mGrabIndex, 0);
88 mGrabIndex = 0;86 mGrabIndex = 0;
@@ -121,9 +119,9 @@
121 int nDigits = 0;119 int nDigits = 0;
122120
123 for (; number > 0; number /= 10)121 for (; number > 0; number /= 10)
124 nDigits++;122 ++nDigits;
125123
126 // Make sure there are no trailing characters in the name124 /* Make sure there are no trailing characters in the name */
127 if ((int) strlen (d->d_name) == 14 + nDigits)125 if ((int) strlen (d->d_name) == 14 + nDigits)
128 return 1;126 return 1;
129 }127 }
@@ -154,15 +152,13 @@
154152
155 if (mGrab)153 if (mGrab)
156 {154 {
157 int x1, x2, y1, y2;
158
159 x1 = MIN (mX1, mX2);
160 y1 = MIN (mY1, mY2);
161 x2 = MAX (mX1, mX2);
162 y2 = MAX (mY1, mY2);
163
164 if (!mGrabIndex)155 if (!mGrabIndex)
165 {156 {
157 int x1 = MIN (mX1, mX2);
158 int y1 = MIN (mY1, mY2);
159 int x2 = MAX (mX1, mX2);
160 int y2 = MAX (mY1, mY2);
161
166 int w = x2 - x1;162 int w = x2 - x1;
167 int h = y2 - y1;163 int h = y2 - y1;
168164
@@ -176,6 +172,7 @@
176 dir = getXDGUserDir (XDGUserDirDesktop);172 dir = getXDGUserDir (XDGUserDirDesktop);
177173
178 buffer = (GLubyte *)malloc (sizeof (GLubyte) * w * h * 4);174 buffer = (GLubyte *)malloc (sizeof (GLubyte) * w * h * 4);
175
179 if (buffer)176 if (buffer)
180 {177 {
181 struct dirent **namelist;178 struct dirent **namelist;
@@ -196,7 +193,7 @@
196 "screenshot%d.png",193 "screenshot%d.png",
197 &number);194 &number);
198195
199 number++;196 ++number;
200197
201 if (n)198 if (n)
202 free (namelist);199 free (namelist);
@@ -238,18 +235,36 @@
238 GLMatrix transform (matrix);235 GLMatrix transform (matrix);
239 GLfloat vertexData[12];236 GLfloat vertexData[12];
240 GLushort colorData[4];237 GLushort colorData[4];
238 GLushort *color;
241239
242 bool status = gScreen->glPaintOutput (attrib, matrix, region, output, mask);240 bool status = gScreen->glPaintOutput (attrib, matrix, region, output, mask);
243241
244 if (status && mGrab)242 if (status && mGrab)
245 {243 {
246 int x1 = MIN (mX1, mX2);244 /* We just want to draw the screenshot selection box if
247 int y1 = MIN (mY1, mY2);245 * we are grabbed, the size has changed and the CCSM
248 int x2 = MAX (mX1, mX2);246 * option to draw it is enabled. */
249 int y2 = MAX (mY1, mY2);
250247
251 if (mGrabIndex)248 if (mGrabIndex &&
249 selectionSizeChanged &&
250 optionGetDrawSelectionIndicator ())
252 {251 {
252 int x1 = MIN (mX1, mX2);
253 int y1 = MIN (mY1, mY2);
254 int x2 = MAX (mX1, mX2);
255 int y2 = MAX (mY1, mY2);
256
257 const float MaxUShortFloat = std::numeric_limits <unsigned short>::max ();
258
259 /* draw filled rectangle */
260 float alpha = optionGetSelectionFillColorAlpha () / MaxUShortFloat;
261 color = optionGetSelectionFillColor ();
262
263 colorData[0] = alpha * color[0];
264 colorData[1] = alpha * color[1];
265 colorData[2] = alpha * color[2];
266 colorData[3] = alpha * MaxUShortFloat;
267
253 vertexData[0] = x1;268 vertexData[0] = x1;
254 vertexData[1] = y1;269 vertexData[1] = y1;
255 vertexData[2] = 0.0f;270 vertexData[2] = 0.0f;
@@ -263,12 +278,6 @@
263 vertexData[10] = y2;278 vertexData[10] = y2;
264 vertexData[11] = 0.0f;279 vertexData[11] = 0.0f;
265280
266 colorData[0] = 0x2fff;
267 colorData[1] = 0x2fff;
268 colorData[2] = 0x4fff;
269 colorData[3] = 0x4fff;
270
271
272 transform.translate (-0.5f, -0.5f, -DEFAULT_Z_CAMERA);281 transform.translate (-0.5f, -0.5f, -DEFAULT_Z_CAMERA);
273 transform.scale (1.0f / output->width (),282 transform.scale (1.0f / output->width (),
274 -1.0f / output->height (),283 -1.0f / output->height (),
@@ -277,9 +286,8 @@
277 -output->region ()->extents.y2,286 -output->region ()->extents.y2,
278 0.0f);287 0.0f);
279288
280#ifndef USE_GLES
281 glEnable (GL_BLEND);289 glEnable (GL_BLEND);
282#endif290
283 streamingBuffer->begin (GL_TRIANGLE_STRIP);291 streamingBuffer->begin (GL_TRIANGLE_STRIP);
284292
285 streamingBuffer->addColors (1, colorData);293 streamingBuffer->addColors (1, colorData);
@@ -288,22 +296,35 @@
288 streamingBuffer->end ();296 streamingBuffer->end ();
289 streamingBuffer->render (transform);297 streamingBuffer->render (transform);
290298
291 streamingBuffer->begin (GL_LINE_LOOP);299 /* draw outline */
300 alpha = optionGetSelectionOutlineColorAlpha () / MaxUShortFloat;
301 color = optionGetSelectionOutlineColor ();
302
303 colorData[0] = alpha * color[0];
304 colorData[1] = alpha * color[1];
305 colorData[2] = alpha * color[2];
306 colorData[3] = alpha * MaxUShortFloat;
292307
293 vertexData[6] = x2;308 vertexData[6] = x2;
294 vertexData[7] = y2;309 vertexData[7] = y2;
295 vertexData[9] = x2;310 vertexData[9] = x2;
296 vertexData[10] = y1;311 vertexData[10] = y1;
297 colorData [3] = 0x9fff;312
313 glLineWidth (2.0);
314
315 streamingBuffer->begin (GL_LINE_LOOP);
298316
299 streamingBuffer->addColors (1, colorData);317 streamingBuffer->addColors (1, colorData);
300 streamingBuffer->addVertices (4, vertexData);318 streamingBuffer->addVertices (4, vertexData);
301319
302 streamingBuffer->end ();320 streamingBuffer->end ();
303#ifndef USE_GLES321 streamingBuffer->render (transform);
322
304 glDisable (GL_BLEND);323 glDisable (GL_BLEND);
305#endif324
306 streamingBuffer->render (transform);325 /* we finished painting the selection box,
326 * reset selectionSizeChanged now */
327 selectionSizeChanged = false;
307 }328 }
308 }329 }
309330
@@ -315,8 +336,12 @@
315 int yRoot)336 int yRoot)
316{337{
317 /* update screenshot rectangle size */338 /* update screenshot rectangle size */
318 if (mGrabIndex)339 if (mGrabIndex &&
340 (mX2 != xRoot || mY2 != yRoot))
319 {341 {
342 /* the size has changed now */
343 selectionSizeChanged = true;
344
320 int x1 = MIN (mX1, mX2) - 1;345 int x1 = MIN (mX1, mX2) - 1;
321 int y1 = MIN (mY1, mY2) - 1;346 int y1 = MIN (mY1, mY2) - 1;
322 int x2 = MAX (mX1, mX2) + 1;347 int x2 = MAX (mX1, mX2) + 1;
@@ -333,8 +358,6 @@
333 y2 = MAX (mY1, mY2) + 1;358 y2 = MAX (mY1, mY2) + 1;
334359
335 cScreen->damageRegion (CompRegion (x1, y1, x2 - x1, y2 - y1));360 cScreen->damageRegion (CompRegion (x1, y1, x2 - x1, y2 - y1));
336
337 cScreen->damageScreen ();
338 }361 }
339}362}
340363
@@ -366,12 +389,13 @@
366 cScreen (CompositeScreen::get (screen)),389 cScreen (CompositeScreen::get (screen)),
367 gScreen (GLScreen::get (screen)),390 gScreen (GLScreen::get (screen)),
368 mGrabIndex (0),391 mGrabIndex (0),
369 mGrab (false)392 mGrab (false),
393 selectionSizeChanged (false)
370{394{
371 optionSetInitiateButtonInitiate (boost::bind (&ShotScreen::initiate, this,395 optionSetInitiateButtonInitiate (boost::bind (&ShotScreen::initiate, this,
372 _1, _2, _3));396 _1, _2, _3));
373 optionSetInitiateButtonTerminate (boost::bind (&ShotScreen::terminate, this,397 optionSetInitiateButtonTerminate (boost::bind (&ShotScreen::terminate, this,
374 _1, _2, _3));398 _1, _2, _3));
375399
376 ScreenInterface::setHandler (screen, false);400 ScreenInterface::setHandler (screen, false);
377 CompositeScreenInterface::setHandler (cScreen, false);401 CompositeScreenInterface::setHandler (cScreen, false);
378402
=== modified file 'plugins/screenshot/src/screenshot.h'
--- plugins/screenshot/src/screenshot.h 2013-04-13 22:29:01 +0000
+++ plugins/screenshot/src/screenshot.h 2013-04-24 15:45:35 +0000
@@ -66,6 +66,7 @@
6666
67 CompScreen::GrabHandle mGrabIndex;67 CompScreen::GrabHandle mGrabIndex;
68 bool mGrab;68 bool mGrab;
69 bool selectionSizeChanged;
6970
70 int mX1, mY1, mX2, mY2;71 int mX1, mY1, mX2, mY2;
71};72};

Subscribers

People subscribed via source and target branches

to all changes: