File: xrootbg.c

package info (click to toggle)
libsx 2.08-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,732 kB
  • sloc: ansic: 8,713; sh: 8,603; makefile: 63
file content (69 lines) | stat: -rw-r--r-- 1,672 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "libsx.h"
#include <X11/Xaw3dxft/Xaw3dXft.h>

Xaw3dXftData *xaw3dxft_data = NULL;
Xaw3dXftProc *xaw3dxft_proc = NULL;

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);
}

#define DEFAULT_BG "#dcdad5"


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

  XftInitFtLibrary();
  GET_XAW3DXFT_DATA(xaw3dxft_data);

  if (xaw3dxft_data) {
    xaw3dxft_data->encoding = -1;
    xaw3dxft_data->string_hilight = 0;
    xaw3dxft_data->string_use_pixmap = 0;
    xaw3dxft_data->no_hilit_reverse = 1;
    xaw3dxft_data->button_inverse = 0;
    xaw3dxft_data->button_dashed = 1;
    xaw3dxft_data->show_tips = 1;
    xaw3dxft_data->text_bg_hilight = 1;
    xaw3dxft_proc = xaw3dxft_data->proc;
    xaw3dxft_proc->set_default_fontname("Droid Sans Mono-12");
    xaw3dxft_proc->set_insensitive_twist("#a00000");
    xaw3dxft_proc->set_hilit_color("#332211");
  }
  
  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);
}