Merge lp:~aurelien-riv/livewallpaper/openmp into lp:livewallpaper

Proposed by Aurélien RIVIERE on 2016-11-24
Status: Needs review
Proposed branch: lp:~aurelien-riv/livewallpaper/openmp
Merge into: lp:livewallpaper
Diff against target: 668 lines (+229/-182) (has conflicts)
11 files modified
CMakeLists.txt (+1/-1)
data/livewallpaper.xml (+114/-114)
plugins/galaxy/CMakeLists.txt (+10/-4)
plugins/galaxy/galaxy.xml (+9/-0)
plugins/galaxy/src/galaxy.c (+1/-0)
plugins/galaxy/src/particle.c (+70/-47)
ui/config/CMakeLists.txt (+1/-1)
ui/config/key.vala (+1/-2)
ui/config/keyfactory.vala (+11/-2)
ui/config/plugin-parser.vala (+6/-0)
ui/config/search.vala (+5/-11)
Contents conflict in ui/config/search-workaround.c
To merge this branch: bzr merge lp:~aurelien-riv/livewallpaper/openmp
Reviewer Review Type Date Requested Status
Maximilian Schnarr 2016-11-24 Pending
Review via email: mp+311702@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

326. By Aurélien RIVIERE on 2016-11-24

remove dead code
limit lw:range with string conditions in addition to double, num_processors is the only possible value for now

325. By Aurélien RIVIERE on 2016-10-06

Option to limit the number of threads used to update the stars

324. By Aurélien RIVIERE on 2016-10-06

Use OpenMP to parallelize the stars' position faster

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-01-21 12:32:29 +0000
3+++ CMakeLists.txt 2016-11-24 09:49:00 +0000
4@@ -11,7 +11,7 @@
5 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
6 include(LiveWallpaperCommon)
7
8-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -pedantic -W -Wall -Wextra -Wno-missing-field-initializers")
9+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -pedantic -W -Wall -Wextra -Wno-missing-field-initializers -Wno-variadic-macros")
10
11 # enable debugging
12 option(ENABLE_DEBUG "Enable debugging" OFF)
13
14=== modified file 'data/livewallpaper.xml'
15--- data/livewallpaper.xml 2014-06-13 09:40:37 +0000
16+++ data/livewallpaper.xml 2016-11-24 09:49:00 +0000
17@@ -1,60 +1,60 @@
18 <?xml version="1.0" encoding="UTF-8"?>
19 <schemalist>
20- <enum id="net.launchpad.livewallpaper.multioutput-mode">
21- <value nick="One big wallpaper" value="0" />
22- <value nick="Multiple wallpapers" value="1" />
23- </enum>
24-
25- <enum id="net.launchpad.livewallpaper.bg-mode">
26- <value nick="Default background" value="0" />
27- <value nick="Custom image" value="1" />
28- <value nick="Single color" value="2" />
29- <value nick="Horizontal color gradient" value="3" />
30- <value nick="Vertical color gradient" value="4" />
31- </enum>
32-
33- <enum id="net.launchpad.livewallpaper.bg-render-type">
34- <value nick="Zoom" value="0" />
35- <value nick="Center" value="1" />
36- <value nick="Scale" value="2" />
37- <value nick="Fill" value="3" />
38- <value nick="Tile" value="4" />
39- </enum>
40-
41- <enum id="net.launchpad.livewallpaper.pm-mode">
42- <value nick="Never" value="0" />
43- <value nick="On low battery" value="1" />
44- <value nick="On battery" value="2" />
45- </enum>
46-
47- <schema id="net.launchpad.livewallpaper" path="/net/launchpad/livewallpaper/">
48- <key type="b" name="active">
49- <default>true</default>
50- <summary>Show or hide the live wallpaper</summary>
51- <description>Set whether the live wallpaper is visible or not</description>
52- </key>
53- <key type="s" name="active-plugin">
54- <default>"galaxy"</default>
55- <summary>Active plugin</summary>
56- <description>The name of the active wallpaper plugin</description>
57- </key>
58-
59- <lw:tab name="General">
60- <key type="b" name="autostart">
61- <default>true</default>
62- <summary>Autostart</summary>
63- <description>Define whether LiveWallpaper should autostart at startup</description>
64- </key>
65- <key type="b" name="desktop-icons">
66- <default>false</default>
67- <summary>Show desktop icons (Nautilus only)</summary>
68- <description>Set this to true, if you want to see the desktop icons with Nautilus when a live wallpaper is running.</description>
69- </key>
70- <key name="multioutput-mode" enum="net.launchpad.livewallpaper.multioutput-mode">
71- <default>"One big wallpaper"</default>
72- <summary>Multioutput Mode</summary>
73- <description>Selects how the live wallpaper is displayed if multiple output devices are used</description>
74- </key>
75+ <enum id="net.launchpad.livewallpaper.multioutput-mode">
76+ <value nick="One big wallpaper" value="0" />
77+ <value nick="Multiple wallpapers" value="1" />
78+ </enum>
79+
80+ <enum id="net.launchpad.livewallpaper.bg-mode">
81+ <value nick="Default background" value="0" />
82+ <value nick="Custom image" value="1" />
83+ <value nick="Single color" value="2" />
84+ <value nick="Horizontal color gradient" value="3" />
85+ <value nick="Vertical color gradient" value="4" />
86+ </enum>
87+
88+ <enum id="net.launchpad.livewallpaper.bg-render-type">
89+ <value nick="Zoom" value="0" />
90+ <value nick="Center" value="1" />
91+ <value nick="Scale" value="2" />
92+ <value nick="Fill" value="3" />
93+ <value nick="Tile" value="4" />
94+ </enum>
95+
96+ <enum id="net.launchpad.livewallpaper.pm-mode">
97+ <value nick="Never" value="0" />
98+ <value nick="On low battery" value="1" />
99+ <value nick="On battery" value="2" />
100+ </enum>
101+
102+ <schema id="net.launchpad.livewallpaper" path="/net/launchpad/livewallpaper/">
103+ <key type="b" name="active">
104+ <default>true</default>
105+ <summary>Show or hide the live wallpaper</summary>
106+ <description>Set whether the live wallpaper is visible or not</description>
107+ </key>
108+ <key type="s" name="active-plugin">
109+ <default>"galaxy"</default>
110+ <summary>Active plugin</summary>
111+ <description>The name of the active wallpaper plugin</description>
112+ </key>
113+
114+ <lw:tab name="General">
115+ <key type="b" name="autostart">
116+ <default>true</default>
117+ <summary>Autostart</summary>
118+ <description>Define whether LiveWallpaper should autostart at startup</description>
119+ </key>
120+ <key type="b" name="desktop-icons">
121+ <default>false</default>
122+ <summary>Show desktop icons (Nautilus only)</summary>
123+ <description>Set this to true, if you want to see the desktop icons with Nautilus when a live wallpaper is running.</description>
124+ </key>
125+ <key name="multioutput-mode" enum="net.launchpad.livewallpaper.multioutput-mode">
126+ <default>"One big wallpaper"</default>
127+ <summary>Multioutput Mode</summary>
128+ <description>Selects how the live wallpaper is displayed if multiple output devices are used</description>
129+ </key>
130 <lw:frame name="Power Management">
131 <lw:DisplayIf computer="Laptop" />
132 <key name="pm-mode" enum="net.launchpad.livewallpaper.pm-mode">
133@@ -68,73 +68,73 @@
134 <description>Restart the live wallpaper if the laptop is not on battery anymore. This only works, if LiveWallpaper stopped automatically because it is on (low) battery.</description>
135 </key>
136 </lw:frame>
137- </lw:tab>
138- <lw:tab name="Background">
139- <key name="bg-mode" enum="net.launchpad.livewallpaper.bg-mode">
140- <default>"Default background"</default>
141- <summary>Background</summary>
142- <description>Choose the plugin's background image</description>
143- </key>
144+ </lw:tab>
145+ <lw:tab name="Background">
146+ <key name="bg-mode" enum="net.launchpad.livewallpaper.bg-mode">
147+ <default>"Default background"</default>
148+ <summary>Background</summary>
149+ <description>Choose the plugin's background image</description>
150+ </key>
151
152- <lw:separator/>
153- <key type="s" name="bg-image">
154- <lw:type>file</lw:type>
155+ <lw:separator/>
156+ <key type="s" name="bg-image">
157+ <lw:type>file</lw:type>
158 <lw:filefilter name="Image" pixbuf="true"></lw:filefilter>
159- <default>""</default>
160- <summary>Background Image</summary>
161- <description>Path to use for the background image</description>
162- </key>
163- <key name="bg-render-type" enum="net.launchpad.livewallpaper.bg-render-type">
164- <default>"Zoom"</default>
165- <summary>Render Type</summary>
166- <description>Determines how the background image is rendered</description>
167- </key>
168+ <default>""</default>
169+ <summary>Background Image</summary>
170+ <description>Path to use for the background image</description>
171+ </key>
172+ <key name="bg-render-type" enum="net.launchpad.livewallpaper.bg-render-type">
173+ <default>"Zoom"</default>
174+ <summary>Render Type</summary>
175+ <description>Determines how the background image is rendered</description>
176+ </key>
177
178- <lw:separator/>
179- <key type="s" name="bg-primary-color">
180- <lw:type>color</lw:type>
181- <default>"rgba (255, 255, 0, 255)"</default>
182- <summary>Primary Color</summary>
183- <description>Left or bottom color when drawing gradients, or the solid color</description>
184- </key>
185- <key type="s" name="bg-secondary-color">
186- <lw:type>color</lw:type>
187- <default>"rgba (255, 0, 0, 255)"</default>
188- <summary>Secondary Color</summary>
189- <description>Right or top color when drawing gradients, not used for solid color</description>
190- </key>
191- </lw:tab>
192+ <lw:separator/>
193+ <key type="s" name="bg-primary-color">
194+ <lw:type>color</lw:type>
195+ <default>"rgba (255, 255, 0, 255)"</default>
196+ <summary>Primary Color</summary>
197+ <description>Left or bottom color when drawing gradients, or the solid color</description>
198+ </key>
199+ <key type="s" name="bg-secondary-color">
200+ <lw:type>color</lw:type>
201+ <default>"rgba (255, 0, 0, 255)"</default>
202+ <summary>Secondary Color</summary>
203+ <description>Right or top color when drawing gradients, not used for solid color</description>
204+ </key>
205+ </lw:tab>
206 <lw:tab name="FPS">
207 <key type="u" name="fps-limit">
208- <range min="0" max="120" />
209- <default>30</default>
210- <summary>FPS Limit</summary>
211- <description>Limit the frames per second to this value</description>
212- </key>
213+ <range min="0" max="120" />
214+ <default>30</default>
215+ <summary>FPS Limit</summary>
216+ <description>Limit the frames per second to this value</description>
217+ </key>
218 <lw:separator/>
219- <key type="b" name="show-fps">
220- <default>false</default>
221- <summary>Show FPS</summary>
222- <description>Show the current frames per second</description>
223- </key>
224+ <key type="b" name="show-fps">
225+ <default>false</default>
226+ <summary>Show FPS</summary>
227+ <description>Show the current frames per second</description>
228+ </key>
229 <key type="s" name="fps-font">
230- <lw:type>font</lw:type>
231- <default>"Sans 20"</default>
232- <summary>FPS visualizer's font</summary>
233- <description>The font used to display the current frames per second</description>
234- </key>
235+ <lw:type>font</lw:type>
236+ <default>"Sans 20"</default>
237+ <summary>FPS visualizer's font</summary>
238+ <description>The font used to display the current frames per second</description>
239+ </key>
240 <key type="s" name="fps-fg-color">
241- <lw:type>color</lw:type>
242- <default>"rgba (255, 255, 255, 255)"</default>
243- <summary>FPS visualizer's font color</summary>
244- <description>Color used to display the current frames per second</description>
245- </key>
246+ <lw:type>color</lw:type>
247+ <default>"rgba (255, 255, 255, 255)"</default>
248+ <summary>FPS visualizer's font color</summary>
249+ <description>Color used to display the current frames per second</description>
250+ </key>
251 <key type="s" name="fps-bg-color">
252- <lw:type>color</lw:type>
253- <default>"rgba (0, 0, 0, 255)"</default>
254- <summary>FPS visualizer's background color</summary>
255- <description>Color used as background for the area which shows the current frames per second</description>
256- </key>
257+ <lw:type>color</lw:type>
258+ <default>"rgba (0, 0, 0, 255)"</default>
259+ <summary>FPS visualizer's background color</summary>
260+ <description>Color used as background for the area which shows the current frames per second</description>
261+ </key>
262 </lw:tab>
263- </schema>
264+ </schema>
265 </schemalist>
266
267=== modified file 'plugins/galaxy/CMakeLists.txt'
268--- plugins/galaxy/CMakeLists.txt 2014-03-28 22:55:56 +0000
269+++ plugins/galaxy/CMakeLists.txt 2016-11-24 09:49:00 +0000
270@@ -1,12 +1,18 @@
271 file(GLOB GALAXY_XCF images/*.xcf)
272 file(GLOB GALAXY_SOURCES src/*)
273
274+find_package(OpenMP)
275+if (OPENMP_FOUND)
276+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
277+endif()
278+
279 livewallpaper_plugin_c(
280- galaxy
281- SOURCES ${GALAXY_SOURCES}
282- SETTINGS galaxy.xml
283+ galaxy
284+ SOURCES ${GALAXY_SOURCES}
285+ SETTINGS galaxy.xml
286 RESOURCE galaxy.gresource.xml
287- ICON galaxy.svg
288+ ICON galaxy.svg
289+ LIBRARIES -fopenmp
290 )
291
292 livewallpaper_plugin_build_xcf(galaxy FILES ${GALAXY_XCF})
293
294=== modified file 'plugins/galaxy/galaxy.xml'
295--- plugins/galaxy/galaxy.xml 2015-01-01 12:58:43 +0000
296+++ plugins/galaxy/galaxy.xml 2016-11-24 09:49:00 +0000
297@@ -29,6 +29,15 @@
298 <summary>Draw star streaks</summary>
299 <description>Draw a star with streaks</description>
300 </key>
301+ <lw:separator/>
302+ <key type="i" name="thread-count">
303+ <range min="1" max="16" />
304+ <lw:range max="num_processors"/>
305+ <lw:scale />
306+ <default>1</default>
307+ <summary>Number of threads</summary>
308+ <description>Number of threads to be used to update the position of the stars</description>
309+ </key>
310 </lw:tab>
311 <lw:tab name="Colors">
312 <key type="s" name="star-color">
313
314=== modified file 'plugins/galaxy/src/galaxy.c'
315--- plugins/galaxy/src/galaxy.c 2016-02-21 09:46:31 +0000
316+++ plugins/galaxy/src/galaxy.c 2016-11-24 09:49:00 +0000
317@@ -355,6 +355,7 @@
318 LW_BIND(self->priv->ps, "star-size");
319 LW_BIND(self->priv->ps, "speed-ratio");
320 LW_BIND(self->priv->ps, "draw-streaks");
321+ LW_BIND(self->priv->ps, "thread-count");
322 LW_BIND_COLOR(self->priv->ps, "star-color");
323
324 /* Light Program */
325
326=== modified file 'plugins/galaxy/src/particle.c'
327--- plugins/galaxy/src/particle.c 2016-02-21 09:46:31 +0000
328+++ plugins/galaxy/src/particle.c 2016-11-24 09:49:00 +0000
329@@ -21,7 +21,6 @@
330 */
331
332 #include <math.h>
333-#include <stdlib.h>
334 #include <glib-object.h>
335 #include <livewallpaper/core.h>
336 #include "particle.h"
337@@ -37,16 +36,22 @@
338 * ellipse. Phi is the angle between the x-axis and the major
339 * axis of the ellipse.
340 */
341- gfloat cos_phi, sin_phi;
342+ double sin_phi;
343+ /*
344+* Those values needed for the general parametic form of an
345+* ellipse. Phi is the angle between the x-axis and the major
346+* axis of the ellipse.
347+*/
348+ double cos_phi;
349
350- /* The current angle/position of this star. */
351+ /* The current angle/position of this star. */
352 gfloat angle;
353
354 /* The distance from the center of the galaxy to this star. */
355- gfloat distance;
356+ double distance;
357
358 /* the angular velocity of the star in 1/ms. */
359- gfloat speed;
360+ double speed;
361 };
362
363 /* 0 (line) -> 1.0f (circle) */
364@@ -54,14 +59,16 @@
365
366 struct _GalaxyParticleSystemPrivate
367 {
368- guint star_count;
369- guint star_size;
370- gfloat speed_ratio;
371+ guint star_count;
372+ guint star_size;
373+ gdouble speed_ratio;
374 gboolean draw_streaks;
375- GdkRGBA star_color;
376+ GdkRGBA star_color;
377+
378+ guint thread_count;
379
380 GArray *stars;
381- gfloat *vertices;
382+ double *vertices;
383
384 LwTexture *starTexture;
385 };
386@@ -76,6 +83,8 @@
387 PROP_DRAW_STREAKS,
388 PROP_STAR_COLOR,
389
390+ PROP_THREAD_COUNT,
391+
392 N_PROPERTIES
393 };
394
395@@ -128,6 +137,10 @@
396 self->priv->star_color = *((GdkRGBA*)g_value_get_boxed(value));
397 break;
398
399+ case PROP_THREAD_COUNT:
400+ self->priv->thread_count = g_value_get_uint(value);
401+ break;
402+
403 default:
404 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
405 break;
406@@ -164,6 +177,10 @@
407 g_value_set_boxed(value, &self->priv->star_color);
408 break;
409
410+ case PROP_THREAD_COUNT:
411+ g_value_set_uint(value, self->priv->thread_count);
412+ break;
413+
414 default:
415 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
416 break;
417@@ -174,17 +191,17 @@
418 * Gaussian random generator
419 * Using the polar form of the Box-Muller transformation
420 */
421-static gfloat
422+static double
423 randng(void)
424 {
425- static gfloat y;
426+ static double y;
427 static gboolean have_next = FALSE;
428
429 if (! have_next)
430 {
431- gfloat x1, x2, w;
432+ double w, x1, x2;
433
434- do
435+ do
436 {
437 x1 = 2.0 * randf() - 1.0;
438 x2 = 2.0 * randf() - 1.0;
439@@ -201,7 +218,7 @@
440 return y;
441 }
442
443-static inline gfloat
444+static inline double
445 galaxy_particle_system_init_star(Star *star)
446 {
447 star->angle = rand1f(-LW_2PI);
448@@ -228,7 +245,7 @@
449 {
450 guint i;
451 g_array_set_size(self->priv->stars, count);
452- self->priv->vertices = g_realloc(self->priv->vertices, 3 * count * sizeof(gfloat));
453+ self->priv->vertices = g_realloc(self->priv->vertices, 3 * count * sizeof(gdouble));
454
455 /* Append stars if necessary */
456 for(i = self->priv->star_count; i < count; i++)
457@@ -259,34 +276,38 @@
458 void
459 galaxy_particle_system_update(GalaxyParticleSystem *self, gint ms_since_last_paint)
460 {
461- const Star * const limit = &g_array_index (self->priv->stars, Star, self->priv->star_count);
462- Star * star = &g_array_index (self->priv->stars, Star, 0);
463- const gfloat k = ms_since_last_paint * self->priv->speed_ratio;
464- gfloat * v = self->priv->vertices;
465+ const int limit = self->priv->star_count;
466+ GArray *stars = self->priv->stars;
467+ const gdouble k = ms_since_last_paint * self->priv->speed_ratio;
468+ gdouble *v = self->priv->vertices;
469+ int i;
470
471- for(; star != limit; ++star, v+=3)
472+ #pragma omp parallel for num_threads(self->priv->thread_count) private(i)
473+ for(i=0; i < limit; ++i)
474 {
475- gfloat a_cos_angle, b_sin_angle;
476-
477- /* Make sure that angle is between -2PI and 0! */
478- star->angle += k * star->speed;
479- while(star->angle < -LW_2PI) star->angle += LW_2PI;
480- while(star->angle > 0) star->angle -= LW_2PI;
481-
482- /*
483- * a is the semi-major axis, here the distance and b is the
484- * semi-minor axis defined by the distance and the ellipse ratio.
485- */
486- a_cos_angle = star->distance * lw_cos(star->angle);
487- b_sin_angle = star->distance * lw_sin(star->angle) * ELLIPSE_RATIO;
488-
489- /*
490- * To calculate the current position we use the general
491- * parametic form of an ellipse.
492- * See http://en.wikipedia.org/wiki/Ellipse#General_parametric_form
493- */
494- v[0] = a_cos_angle * star->cos_phi - b_sin_angle * star->sin_phi;
495- v[1] = a_cos_angle * star->sin_phi + b_sin_angle * star->cos_phi;
496+ Star *star = &g_array_index(stars, Star, i);
497+
498+ double a_cos_angle, b_sin_angle;
499+
500+ /* Make sure that angle is between -2PI and 0! */
501+ star->angle += k * star->speed;
502+ while(star->angle < -LW_2PI) star->angle += LW_2PI;
503+ while(star->angle > 0) star->angle -= LW_2PI;
504+
505+ /*
506+ * a is the semi-major axis, here the distance and b is the
507+ * semi-minor axis defined by the distance and the ellipse ratio.
508+ */
509+ a_cos_angle = star->distance * lw_cos(star->angle);
510+ b_sin_angle = star->distance * lw_sin(star->angle) * ELLIPSE_RATIO;
511+
512+ /*
513+ * To calculate the current position we use the general
514+ * parametic form of an ellipse.
515+ * See http://en.wikipedia.org/wiki/Ellipse#General_parametric_form
516+ */
517+ v[i*3+0] = a_cos_angle * star->cos_phi - b_sin_angle * star->sin_phi;
518+ v[i*3+1] = a_cos_angle * star->sin_phi + b_sin_angle * star->cos_phi;
519 }
520 }
521
522@@ -316,10 +337,10 @@
523 /* Set star color */
524 {
525 GdkRGBA *c = &self->priv->star_color;
526- glColor4f(c->red, c->green, c->blue, c->alpha);
527+ glColor4d(c->red, c->green, c->blue, c->alpha);
528 }
529
530- glVertexPointer(3, GL_FLOAT, 3 * sizeof(gfloat), self->priv->vertices);
531+ glVertexPointer(3, GL_DOUBLE, 3 * sizeof(gdouble), self->priv->vertices);
532 glDrawArrays(GL_POINTS, 0, self->priv->star_count);
533
534 glDisable(GL_POINT_SPRITE);
535@@ -337,10 +358,11 @@
536 self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self, GALAXY_TYPE_PARTICLE_SYSTEM,
537 GalaxyParticleSystemPrivate);
538
539- self->priv->star_count = 0;
540- self->priv->star_size = 8;
541- self->priv->speed_ratio = 1;
542+ self->priv->star_count = 0;
543+ self->priv->star_size = 8;
544+ self->priv->speed_ratio = 1;
545 self->priv->draw_streaks = TRUE;
546+ self->priv->thread_count = 1;
547
548 self->priv->stars = g_array_new(FALSE, FALSE, sizeof(Star));
549 self->priv->vertices = NULL;
550@@ -386,6 +408,7 @@
551 obj_properties[PROP_SPEED_RATIO] = g_param_spec_double ("speed-ratio", "Speed ratio", "Speed ratio", -5, 5, 1, G_PARAM_READWRITE);
552 obj_properties[PROP_DRAW_STREAKS] = g_param_spec_boolean("draw-streaks", "Draw star streaks", "Draw a star with streaks", TRUE, G_PARAM_READWRITE);
553 obj_properties[PROP_STAR_COLOR] = g_param_spec_boxed ("star-color", "Star color", "Color of the stars", GDK_TYPE_RGBA, G_PARAM_READWRITE);
554+ obj_properties[PROP_THREAD_COUNT] = g_param_spec_uint ("thread-count", "Number of threads", "Number of threads", 1, 16, 1, G_PARAM_READWRITE);
555
556 g_object_class_install_properties(gobject_class, N_PROPERTIES, obj_properties);
557 }
558
559=== modified file 'ui/config/CMakeLists.txt'
560--- ui/config/CMakeLists.txt 2015-03-28 09:50:38 +0000
561+++ ui/config/CMakeLists.txt 2016-11-24 09:49:00 +0000
562@@ -22,7 +22,7 @@
563 )
564
565 # append additional c sources
566-list(APPEND LWC_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/resources.c" "${CMAKE_CURRENT_SOURCE_DIR}/search-workaround.c")
567+list(APPEND LWC_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/resources.c")
568
569 add_executable(livewallpaper-config ${LWC_SOURCES})
570 target_link_libraries(livewallpaper-config m)
571
572=== modified file 'ui/config/key.vala'
573--- ui/config/key.vala 2016-02-21 09:46:31 +0000
574+++ ui/config/key.vala 2016-11-24 09:49:00 +0000
575@@ -37,10 +37,9 @@
576 });
577 pack_end (ctl, false, false);
578
579-#if GTK_3_14_OR_HIGHER
580 if (responsive)
581 w.margin_start=100;
582-#endif
583+
584 pack_end (w, responsive, responsive, 3);
585 }
586 }
587
588=== modified file 'ui/config/keyfactory.vala'
589--- ui/config/keyfactory.vala 2016-02-21 09:46:31 +0000
590+++ ui/config/keyfactory.vala 2016-11-24 09:49:00 +0000
591@@ -176,10 +176,19 @@
592 }
593
594 private void prepare_numeric (bool floating, out double min, out double max, out int digits, out double inc) {
595- min = double.parse (prop["min"]);
596- max = double.parse (prop["max"]);
597+ parse_min_max_string(prop["min"], out min);
598+ parse_min_max_string(prop["max"], out max);
599 digits = int.parse (prop["lw:digits"] ?? (floating ? "6" : "0"));
600 inc = double.max (Math.pow (10.0, - (double)digits), double.parse (prop["lw:increment"] ?? (floating ? ".000001" : "1.0")));
601 }
602+
603+ private static void parse_min_max_string (string arg, out double ret) {
604+ if (! double.try_parse(arg, out ret)) {
605+ if (arg == "num_processors")
606+ ret = get_num_processors();
607+ else
608+ stderr.printf("Unrecognized query : %s\n", arg);
609+ }
610+ }
611 }
612 }
613
614=== modified file 'ui/config/plugin-parser.vala'
615--- ui/config/plugin-parser.vala 2016-02-21 09:46:31 +0000
616+++ ui/config/plugin-parser.vala 2016-11-24 09:49:00 +0000
617@@ -120,6 +120,12 @@
618 parent.no_show_all = true;
619 }
620 break;
621+ case "range":
622+ if ("min" in ht && (! ("lw:range" in key.prop) || ! ("min" in key.prop)))
623+ key.prop["min"] = ht["min"];
624+ if ("max" in ht && (! ("lw:range" in key.prop) || ! ("max" in key.prop)))
625+ key.prop["max"] = ht["max"];
626+ break;
627 default:
628 if (key != null) {
629 key.prop[tag] = "";
630
631=== renamed file 'ui/config/search-workaround.c' => 'ui/config/search-workaround.c.THIS'
632=== modified file 'ui/config/search.vala'
633--- ui/config/search.vala 2016-02-21 09:46:31 +0000
634+++ ui/config/search.vala 2016-11-24 09:49:00 +0000
635@@ -53,7 +53,7 @@
636 if (! visible) {
637 unowned string title;
638 w.child_get(item, "title", out title, null);
639- visible = needle in title.down ();
640+ visible = needle in title.down();
641 }
642 if (!dry_run)
643 item.visible = visible;
644@@ -64,21 +64,15 @@
645 ret = stack_visible;
646 }
647
648- private extern bool needle_in_ssk(string schema_id, string key, string needle);
649-
650 public virtual signal void lwckey (out bool ret, Key w) {
651 if (! (ret = needle in w.tooltip_text.down())) {
652 unowned string key = w.get_children().nth_data(2).get_data ("key");
653 ret = needle in key ||
654 needle in p.settings.get_value(key).print(false).down();
655- #if GTK_3_14_OR_HIGHER
656- var ssk = SettingsSchemaSource.get_default().lookup(p.schema_id, true).get_key (key);
657- ret |= needle in ssk.get_summary() ||
658- needle in ssk.get_description() ||
659- needle in ssk.get_range().print(false).down();
660- #else
661- ret |= needle_in_ssk(p.schema_id, key, needle);
662- #endif
663+ var ssk = SettingsSchemaSource.get_default().lookup(p.schema_id, true).get_key (key);
664+ ret |= needle in ssk.get_summary() ||
665+ needle in ssk.get_description() ||
666+ needle in ssk.get_range().print(false).down();
667 }
668 }
669

Subscribers

People subscribed via source and target branches