diff --git a/0001-analyze-set-text-on-side-with-most-space.patch b/0001-analyze-set-text-on-side-with-most-space.patch new file mode 100644 index 00000000..6268160c --- /dev/null +++ b/0001-analyze-set-text-on-side-with-most-space.patch @@ -0,0 +1,90 @@ +From 95168f7d55181475946ad93db30255c4d709df03 Mon Sep 17 00:00:00 2001 +From: Thomas Hindoe Paaboel Andersen +Date: Fri, 01 Nov 2013 21:57:47 +0000 +Subject: analyze: plot: place the text on the side with most space + +Set the width of the svg to always fit the longest string +while taking its starting position into consideration. + +Place the text on the right while the starting point is +in the first half of the screen. After that we put it on +the left to save the svg from being wider that it has to. +--- +diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c +index 6bfe13d..8730723 100644 +--- a/src/analyze/systemd-analyze.c ++++ b/src/analyze/systemd-analyze.c +@@ -509,7 +509,7 @@ static int analyze_plot(sd_bus *bus) { + m++; + + for (u = times; u < times + n; u++) { +- double len; ++ double text_start, text_width; + + if (u->ixt < boot->userspace_time || + u->ixt > boot->finish_time) { +@@ -517,10 +517,14 @@ static int analyze_plot(sd_bus *bus) { + u->name = NULL; + continue; + } +- len = ((boot->firmware_time + u->ixt) * SCALE_X) +- + (10.0 * strlen(u->name)); +- if (len > width) +- width = len; ++ ++ /* If the text cannot fit on the left side then ++ * increase the svg width so it fits on the right. ++ * TODO: calculate the text width more accurately */ ++ text_width = 8.0 * strlen(u->name); ++ text_start = (boot->firmware_time + u->ixt) * SCALE_X; ++ if (text_width > text_start && text_width + text_start > width) ++ width = text_width + text_start; + + if (u->iet > u->ixt && u->iet <= boot->finish_time + && u->aet == 0 && u->axt == 0) +@@ -608,7 +612,7 @@ static int analyze_plot(sd_bus *bus) { + svg_bar("active", boot->userspace_time, boot->finish_time, y); + svg_bar("generators", boot->generators_start_time, boot->generators_finish_time, y); + svg_bar("unitsload", boot->unitsload_start_time, boot->unitsload_finish_time, y); +- svg_text("left", boot->userspace_time, y, "systemd"); ++ svg_text(true, boot->userspace_time, y, "systemd"); + y++; + + for (u = times; u < times + n; u++) { +@@ -622,7 +626,8 @@ static int analyze_plot(sd_bus *bus) { + svg_bar("active", u->aet, u->axt, y); + svg_bar("deactivating", u->axt, u->iet, y); + +- b = u->ixt * SCALE_X > width * 2 / 3; ++ /* place the text on the left if we have passed the half of the svg width */ ++ b = u->ixt * SCALE_X < width / 2; + if (u->time) + svg_text(b, u->ixt, y, "%s (%s)", + u->name, format_timespan(ts, sizeof(ts), u->time, USEC_PER_MSEC)); +@@ -634,19 +639,19 @@ static int analyze_plot(sd_bus *bus) { + /* Legend */ + y++; + svg_bar("activating", 0, 300000, y); +- svg_text("right", 400000, y, "Activating"); ++ svg_text(true, 400000, y, "Activating"); + y++; + svg_bar("active", 0, 300000, y); +- svg_text("right", 400000, y, "Active"); ++ svg_text(true, 400000, y, "Active"); + y++; + svg_bar("deactivating", 0, 300000, y); +- svg_text("right", 400000, y, "Deactivating"); ++ svg_text(true, 400000, y, "Deactivating"); + y++; + svg_bar("generators", 0, 300000, y); +- svg_text("right", 400000, y, "Generators"); ++ svg_text(true, 400000, y, "Generators"); + y++; + svg_bar("unitsload", 0, 300000, y); +- svg_text("right", 400000, y, "Loading unit files"); ++ svg_text(true, 400000, y, "Loading unit files"); + y++; + + svg("\n\n"); +-- +cgit v0.9.0.2-2-gbebe diff --git a/systemd.changes b/systemd.changes index cce0aeb4..78f1b0e4 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Nov 4 15:23:02 UTC 2013 - werner@suse.de + +- Add upstream patch + 0001-analyze-set-text-on-side-with-most-space.patch + to place the text on the side with most space + ------------------------------------------------------------------- Fri Oct 25 12:12:48 UTC 2013 - werner@suse.de diff --git a/systemd.spec b/systemd.spec index 4231ba9f..c0335c01 100644 --- a/systemd.spec +++ b/systemd.spec @@ -236,6 +236,8 @@ Patch77: 0001-shared-util-Fix-glob_extend-argument.patch Patch78: 0001-Fix-bad-assert-in-show_pid_array.patch # PATCH-FIX-UPSTREAM 0001-analyze-set-white-background.patch werner@suse.com -- Make background of systemd-analyze SVG white Patch79: 0001-analyze-set-white-background.patch +# PATCH-FIX-UPSTREAM 0001-analyze-set-text-on-side-with-most-space.patch werner@suse.com -- Place the text on the side with most space +Patch80: 0001-analyze-set-text-on-side-with-most-space.patch # udev patches # PATCH-FIX-OPENSUSE 1001-re-enable-by_path-links-for-ata-devices.patch @@ -515,6 +517,7 @@ cp %{SOURCE7} m4/ %patch77 -p1 %patch78 -p1 %patch79 -p1 +%patch80 -p1 # udev patches %patch1001 -p1