~ubuntu-branches/ubuntu/trusty/docker/trusty-proposed

« back to all changes in this revision

Viewing changes to debian/patches/01_color.patch

  • Committer: Bazaar Package Importer
  • Author(s): Ari Pollak
  • Date: 2008-10-25 15:35:44 UTC
  • Revision ID: james.westby@ubuntu.com-20081025153544-p9d0wcyqcrzf69nx
Tags: 1.4-5
* Convert patches to quilt
* 02_no-poll.patch:
  - Apply patch from Leandro Lucarella to stop polling every 1/2 second
    (Closes: #501094)
* Move menu entry to Applications/Viewers (Closes: #482928)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Index: docker-1.4/docker.c
 
2
===================================================================
 
3
--- docker-1.4.orig/docker.c
 
4
+++ docker-1.4/docker.c
 
5
@@ -24,6 +24,7 @@ int width = 0, height = 0;
 
6
 int border = 1; /* blank area around icons. must be > 0 */
 
7
 gboolean horizontal = TRUE; /* layout direction */
 
8
 int icon_size = 24; /* width and height of systray icons */
 
9
+static const char *colortext = NULL;
 
10
 
 
11
 static char *display_string = NULL;
 
12
 /* excluding the border. sum of all child apps */
 
13
@@ -95,6 +96,15 @@ void parse_cmd_line()
 
14
         g_printerr("-iconsize requires a parameter\n");
 
15
         help = TRUE;
 
16
       }
 
17
+    } else if (0 == strcasecmp(argv[i], "-color")) {
 
18
+      ++i;
 
19
+
 
20
+      if (i < argc) {
 
21
+        colortext = argv[i];
 
22
+      } else { /* argument doesn't exist */
 
23
+        g_printerr("-color requires a parameter\n");
 
24
+        help = TRUE;
 
25
+      }
 
26
     } else {
 
27
       if (argv[i][0] == '-')
 
28
         help = TRUE;
 
29
@@ -121,6 +131,9 @@ void parse_cmd_line()
 
30
       g_print("  -iconsize SIZE    The size (width and height) to display\n"
 
31
               "                    icons as in the system tray. Defaults to\n"
 
32
               "                    24.\n");
 
33
+      g_print("  -color COLOR      The background color to use for the tray.\n"
 
34
+              "                    Defaults to whatever color the window\n"
 
35
+              "                    manager specifies.\n");
 
36
       exit(1);
 
37
     }
 
38
   }
 
39
@@ -154,6 +167,9 @@ void create_main_window()
 
40
 {
 
41
   XWMHints hints;
 
42
   XTextProperty text;
 
43
+  Colormap colormap;
 
44
+  XColor xcolor;
 
45
+  char *name = "Docker";
 
46
 
 
47
   /* the border must be > 0 if not in wmaker mode */
 
48
   assert(wmaker || border > 0);
 
49
@@ -167,7 +183,6 @@ void create_main_window()
 
50
     
 
51
   assert(win);
 
52
 
 
53
-  char *name = "Docker";
 
54
   XStringListToTextProperty(&name, 1, &text);
 
55
   XSetWMName(display, win, &text);
 
56
 
 
57
@@ -178,7 +193,19 @@ void create_main_window()
 
58
   create_hint_win();
 
59
   
 
60
   XSync(display, False);
 
61
-  XSetWindowBackgroundPixmap(display, win, ParentRelative);
 
62
+
 
63
+  if (colortext) {
 
64
+    colormap = DefaultColormap(display, DefaultScreen(display));
 
65
+    if (!XParseColor(display, colormap, colortext, &xcolor)) {
 
66
+      g_printerr("Couldn't find color in database: %s\n", colortext);
 
67
+      exit(1);
 
68
+    }
 
69
+    assert(XAllocColor(display, colormap, &xcolor));
 
70
+    XSetWindowBackground(display, win, xcolor.pixel);
 
71
+  } else {
 
72
+    XSetWindowBackgroundPixmap(display, win, ParentRelative);
 
73
+  }
 
74
+
 
75
   XClearWindow(display, win);
 
76
 }
 
77