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
1=== modified file 'plugins/showmouse/showmouse.xml.in'
2--- plugins/showmouse/showmouse.xml.in 2017-03-02 07:54:06 +0000
3+++ plugins/showmouse/showmouse.xml.in 2018-05-03 15:12:11 +0000
4@@ -44,7 +44,7 @@
5 <_long>How thick mouse guides should be, in pixels.</_long>
6 <default>0</default>
7 <min>0</min>
8- <max>20</max><!-- search for "XML" in showmouse.cpp -->
9+ <max>100</max><!-- search for "XML" in showmouse.cpp -->
10 <precision>1</precision>
11 </option>
12 <option name="guide_empty_radius" type="int">
13@@ -52,7 +52,7 @@
14 <_long>Radius of the disk around the cursor which doesn't contain guides.</_long>
15 <default>20</default>
16 <min>0</min>
17- <max>100</max>
18+ <max>200</max>
19 <precision>1</precision>
20 </option>
21 <option name="guide_color" type="color">
22
23=== modified file 'plugins/showmouse/src/showmouse.cpp'
24--- plugins/showmouse/src/showmouse.cpp 2017-04-20 13:04:22 +0000
25+++ plugins/showmouse/src/showmouse.cpp 2018-05-03 15:12:11 +0000
26@@ -579,17 +579,18 @@
27 }
28
29 void
30-ShowmouseScreen::drawLine (const GLMatrix &transform,
31+ShowmouseScreen::drawRect (const GLMatrix &transform,
32 double x1, double y1, double x2, double y2,
33 unsigned short *color)
34 {
35 GLVertexBuffer *stream = GLVertexBuffer::streamingBuffer ();
36- GLfloat vertices[6] =
37- {GLfloat(x1), GLfloat(y1), GLfloat(0), GLfloat(x2), GLfloat(y2), GLfloat(0)};
38+ GLfloat vertices[12] =
39+ {GLfloat(x1), GLfloat(y1), GLfloat(0), GLfloat(x1), GLfloat(y2), GLfloat(0),
40+ GLfloat(x2), GLfloat(y2), GLfloat(0), GLfloat(x2), GLfloat(y1), GLfloat(0)};
41
42- stream->begin (GL_LINES);
43+ stream->begin (GL_QUADS);
44 stream->addColors (1, color);
45- stream->addVertices (2, vertices);
46+ stream->addVertices (4, vertices);
47 if (stream->end ())
48 stream->render (transform);
49 }
50@@ -609,20 +610,19 @@
51
52 if (thickness > 0)
53 {
54- glLineWidth (thickness);
55 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
56 glEnable (GL_BLEND);
57- drawLine (transform, x, 0, x, y - r, color);
58- drawLine (transform, x, y + r, x, screen->height (), color);
59- drawLine (transform, 0, y, x - r, y, color);
60- drawLine (transform, x + r, y, screen->width (), y, color);
61+ drawRect (transform, x-thickness/2, 0, x+thickness/2, y - r, color);
62+ drawRect (transform, x-thickness/2, y + r, x+thickness/2, screen->height (), color);
63+ drawRect (transform, 0, y-thickness/2, x - r, y+thickness/2, color);
64+ drawRect (transform, x + r, y-thickness/2, screen->width (), y+thickness/2, color);
65 glDisable (GL_BLEND);
66 }
67
68 // This has to be manually synchronized with the maximum value in
69 // showmouse.xml.in. The code generated from the XML file keeps
70 // the value private.
71- thickness = 20;
72+ thickness = 100;
73 cScreen->damageRegion (CompRegion(0, y - thickness / 2 - 1,
74 screen->width (), thickness + 1));
75 cScreen->damageRegion (CompRegion(x - thickness / 2 - 1, 0,
76
77=== modified file 'plugins/showmouse/src/showmouse.h'
78--- plugins/showmouse/src/showmouse.h 2017-04-20 13:04:22 +0000
79+++ plugins/showmouse/src/showmouse.h 2018-05-03 15:12:11 +0000
80@@ -117,7 +117,7 @@
81 drawGuides (const GLMatrix &transform);
82
83 void
84- drawLine (const GLMatrix &transform,
85+ drawRect (const GLMatrix &transform,
86 double x1, double y1, double x2, double y2,
87 unsigned short *color);
88

Subscribers

People subscribed via source and target branches