File: xrootbg.c

package info (click to toggle)
libsx 2.05-6
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,480 kB
  • ctags: 1,576
  • sloc: ansic: 8,525; makefile: 267
file content (45 lines) | stat: -rw-r--r-- 916 bytes parent folder | download | duplicates (4)
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
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "libsx.h"

static void color_exec(Widget w, CSelData *cdata)
{
char cmd[256];
  sprintf(cmd, "xsetroot -solid \\#%02X%02X%02X ", 
          (int)(cdata->r+0.5), (int)(cdata->g+0.5), (int)(cdata->b+0.5));
  system(cmd);
}

int main(int argc, char **argv)
{
  char *args[] = { "-bg" , "gray76", NULL };
  char label[80];
  char *ptr;

  PredefArgs = args;
  argc = OpenDisplay(argc, argv);
  if (argc == FALSE)
    return argc;

  GetStandardColors();
  INPUTBG = WHITE;
  BUTTONBG = GetNamedColor("Gray84");

#ifndef Xaw
  SetScrollbarDirection(-1);
#endif

  ptr = getenv("LANG");
  if (!strncmp(ptr, "de", 2)) 
     strcpy(label, "Grund Farbe");
  else
  if (!strncmp(ptr, "fr", 2)) 
     strcpy(label, "Couleur fond d'cran");
  else
     strcpy(label, "Background color");
  SelectColor("40,80,120", 0, label, color_exec, NULL);

 
  return(0);
}