Merge lp:~samuel-thibault/compiz/guide-thick into lp:compiz/0.9.13

Proposed by Samuel thibault
Status: Needs review
Proposed branch: lp:~samuel-thibault/compiz/guide-thick
Merge into: lp:compiz/0.9.13
Diff against target: 87 lines (+14/-14)
3 files modified
plugins/showmouse/showmouse.xml.in (+2/-2)
plugins/showmouse/src/showmouse.cpp (+11/-11)
plugins/showmouse/src/showmouse.h (+1/-1)
To merge this branch: bzr merge lp:~samuel-thibault/compiz/guide-thick
Reviewer Review Type Date Requested Status
Compiz Maintainers Pending
Review via email: mp+345040@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

4144. By Samuel thibault

showmouse: increase maximum guides width

20 is not enough for some people with low vision, so this changeset increases it
to 100.

Some OpenGL hardware implementations do not support so large values, so this
changeset also replaces the use of GL_LINES by GL_QUADS, to simply drop the
hardware constraint.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/showmouse/showmouse.xml.in'
--- plugins/showmouse/showmouse.xml.in 2017-03-02 07:54:06 +0000
+++ plugins/showmouse/showmouse.xml.in 2018-05-03 15:12:11 +0000
@@ -44,7 +44,7 @@
44 <_long>How thick mouse guides should be, in pixels.</_long>44 <_long>How thick mouse guides should be, in pixels.</_long>
45 <default>0</default>45 <default>0</default>
46 <min>0</min>46 <min>0</min>
47 <max>20</max><!-- search for "XML" in showmouse.cpp -->47 <max>100</max><!-- search for "XML" in showmouse.cpp -->
48 <precision>1</precision>48 <precision>1</precision>
49 </option>49 </option>
50 <option name="guide_empty_radius" type="int">50 <option name="guide_empty_radius" type="int">
@@ -52,7 +52,7 @@
52 <_long>Radius of the disk around the cursor which doesn't contain guides.</_long>52 <_long>Radius of the disk around the cursor which doesn't contain guides.</_long>
53 <default>20</default>53 <default>20</default>
54 <min>0</min>54 <min>0</min>
55 <max>100</max>55 <max>200</max>
56 <precision>1</precision>56 <precision>1</precision>
57 </option>57 </option>
58 <option name="guide_color" type="color">58 <option name="guide_color" type="color">
5959
=== modified file 'plugins/showmouse/src/showmouse.cpp'
--- plugins/showmouse/src/showmouse.cpp 2017-04-20 13:04:22 +0000
+++ plugins/showmouse/src/showmouse.cpp 2018-05-03 15:12:11 +0000
@@ -579,17 +579,18 @@
579}579}
580580
581void581void
582ShowmouseScreen::drawLine (const GLMatrix &transform,582ShowmouseScreen::drawRect (const GLMatrix &transform,
583 double x1, double y1, double x2, double y2,583 double x1, double y1, double x2, double y2,
584 unsigned short *color)584 unsigned short *color)
585{585{
586 GLVertexBuffer *stream = GLVertexBuffer::streamingBuffer ();586 GLVertexBuffer *stream = GLVertexBuffer::streamingBuffer ();
587 GLfloat vertices[6] =587 GLfloat vertices[12] =
588 {GLfloat(x1), GLfloat(y1), GLfloat(0), GLfloat(x2), GLfloat(y2), GLfloat(0)};588 {GLfloat(x1), GLfloat(y1), GLfloat(0), GLfloat(x1), GLfloat(y2), GLfloat(0),
589 GLfloat(x2), GLfloat(y2), GLfloat(0), GLfloat(x2), GLfloat(y1), GLfloat(0)};
589590
590 stream->begin (GL_LINES);591 stream->begin (GL_QUADS);
591 stream->addColors (1, color);592 stream->addColors (1, color);
592 stream->addVertices (2, vertices);593 stream->addVertices (4, vertices);
593 if (stream->end ())594 if (stream->end ())
594 stream->render (transform);595 stream->render (transform);
595}596}
@@ -609,20 +610,19 @@
609610
610 if (thickness > 0)611 if (thickness > 0)
611 {612 {
612 glLineWidth (thickness);
613 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);613 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
614 glEnable (GL_BLEND);614 glEnable (GL_BLEND);
615 drawLine (transform, x, 0, x, y - r, color);615 drawRect (transform, x-thickness/2, 0, x+thickness/2, y - r, color);
616 drawLine (transform, x, y + r, x, screen->height (), color);616 drawRect (transform, x-thickness/2, y + r, x+thickness/2, screen->height (), color);
617 drawLine (transform, 0, y, x - r, y, color);617 drawRect (transform, 0, y-thickness/2, x - r, y+thickness/2, color);
618 drawLine (transform, x + r, y, screen->width (), y, color);618 drawRect (transform, x + r, y-thickness/2, screen->width (), y+thickness/2, color);
619 glDisable (GL_BLEND);619 glDisable (GL_BLEND);
620 }620 }
621621
622 // This has to be manually synchronized with the maximum value in622 // This has to be manually synchronized with the maximum value in
623 // showmouse.xml.in. The code generated from the XML file keeps623 // showmouse.xml.in. The code generated from the XML file keeps
624 // the value private.624 // the value private.
625 thickness = 20;625 thickness = 100;
626 cScreen->damageRegion (CompRegion(0, y - thickness / 2 - 1,626 cScreen->damageRegion (CompRegion(0, y - thickness / 2 - 1,
627 screen->width (), thickness + 1));627 screen->width (), thickness + 1));
628 cScreen->damageRegion (CompRegion(x - thickness / 2 - 1, 0,628 cScreen->damageRegion (CompRegion(x - thickness / 2 - 1, 0,
629629
=== modified file 'plugins/showmouse/src/showmouse.h'
--- plugins/showmouse/src/showmouse.h 2017-04-20 13:04:22 +0000
+++ plugins/showmouse/src/showmouse.h 2018-05-03 15:12:11 +0000
@@ -117,7 +117,7 @@
117 drawGuides (const GLMatrix &transform);117 drawGuides (const GLMatrix &transform);
118118
119 void119 void
120 drawLine (const GLMatrix &transform,120 drawRect (const GLMatrix &transform,
121 double x1, double y1, double x2, double y2,121 double x1, double y1, double x2, double y2,
122 unsigned short *color);122 unsigned short *color);
123123

Subscribers

People subscribed via source and target branches