File: 273866.patch

package info (click to toggle)
osdclock 0.5-11
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 80 kB
  • ctags: 18
  • sloc: ansic: 120; makefile: 82
file content (92 lines) | stat: -rw-r--r-- 2,468 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--- osdclock-0.5/osd_clock.c	2004-09-29 20:39:15.000000000 +0200
+++ osdclock-0.5-modif/osd_clock.c	2004-09-29 20:47:29.000000000 +0200
@@ -64,13 +64,15 @@
 
   char *font = osd_default_font;
   char *color = "red";
+  char *align = "left";
   int delay = 3; 
   int offset = 0;
   int shadow = 2;
   int interval = 1;
   int perhour = 0; // feature off by default
+  int wait = 0;
   
-  while ((c = getopt_long(argc ,argv,"f:c:d:F:i:H:s:o:tbh",
+  while ((c = getopt_long(argc ,argv,"f:c:d:F:i:H:s:o:w:tbhr",
 			  long_options, NULL)) != -1)
   {
     switch(c)
@@ -87,6 +89,9 @@
       case 'd':
 	delay = atoi(optarg);
 	break;
+      case 'w':
+	wait = atoi(optarg);
+	break;
       case 'i':
 	interval = atoi(optarg);
        break;
@@ -105,17 +110,22 @@
       case 'b':
 	pos = XOSD_bottom;
 	break;
+      case 'r':
+	align = "right";
+	break;
       case 'h':
 	printf("USAGE: %s [-flag args]\n"
 		"\t-f\tfully qualified font.  default: %s\n"
 		"\t-c\tcolor.  default: red\n"
 		"\t-s\tdrop shadow offset.  default: 2\n"
-		"\t-t\tlocate clock at top left (default: bottom left)\n"
-		"\t-b\tlocate clock at bottom left (default)\n"
+		"\t-t\tlocate clock at top of screen (default: bottom)\n"
+		"\t-b\tlocate clock at bottom of screen(default)\n"
+		"\t-r\tlocate clock at right side (default: left)\n"
 		"\t-o\toffset value to raise or lower around panels.  def: 0\n"
 		"\t-F\tSpecify time/date format (in strftime(3) style)\n"
 		"\t-d\tDelay (time the clock stays on screen when it's updated)\n"
 	        "\t\tin seconds\n"
+		"\t-w\tSeconds to wait before first display (default: 0)\n"
 		"\t-i\tInterval (time between updates) in seconds\n"
 	        "\t-H\tInteger (displayed this many times each hour)\n"
 		"\t-h\tthis help message\n",
@@ -124,6 +134,8 @@
 	break;
     }
   }
+ 
+  sleep(wait);
   
   osd = xosd_init (font, color, delay, pos, offset, shadow, 2);
   if (!osd)
@@ -132,6 +144,11 @@
     return EXIT_FAILURE;
   }
 
+  if(align == "right")
+  {
+    xosd_set_align(osd, XOSD_right);
+  }
+  
   /* If no format is specified, we revert to ctime-ish display */ 
   if(!format) format = "%a %b %e %H:%M:%S %G";
 
@@ -143,6 +160,7 @@
     strftime(output, 255, format, localtime(&curr_time));
 
     xosd_display (osd, 1, XOSD_string, output);
+
     if (perhour)
     {
       int secs = secondspast();
@@ -154,7 +172,7 @@
     sleep(interval);
   }
 
-  xosd_uninit (osd);
+  xosd_destroy (osd);
   
   return EXIT_SUCCESS;
 }