[Xfce4-commits] <ristretto:master> Make the clock-size relative to the window-size
Stephan Arts
noreply at xfce.org
Thu Apr 19 20:42:01 CEST 2012
Updating branch refs/heads/master
to 841cf9380e9fbad66b4d3343d816000a5fc1690c (commit)
from 9687b2e9029bd32af8fa7887df3e3c3e12e2e0dd (commit)
commit 841cf9380e9fbad66b4d3343d816000a5fc1690c
Author: Stephan Arts <stephan at xfce.org>
Date: Thu Apr 19 20:39:57 2012 +0200
Make the clock-size relative to the window-size
src/image_viewer.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/image_viewer.c b/src/image_viewer.c
index f22d5ce..3e4a398 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -1030,15 +1030,27 @@ paint_clock (
cairo_t *ctx )
{
//RsttoImageViewer *viewer = RSTTO_IMAGE_VIEWER (widget);
- gdouble width = 60;
- gdouble height = 60;
- gdouble offset = height*0.15;
+ gdouble width;
+ gdouble height;
+ gdouble offset;
gint i = 0;
time_t t = time(NULL);
struct tm *lt = localtime(&t);
gdouble hour_angle = (gdouble)(M_PI*2)/12*((gdouble)(lt->tm_hour%12+6)+((M_PI*2)/720.0*(gdouble)lt->tm_min));
+ if (widget->allocation.width < widget->allocation.height)
+ {
+ width = widget->allocation.width * 0.1;
+ }
+ else
+ {
+ width = widget->allocation.height * 0.1;
+ }
+
+ height = width;
+ offset = height * 0.15;
+
cairo_save (ctx);
cairo_translate (
More information about the Xfce4-commits
mailing list