1 # Make asusosd's screen position configurable patch
2 # by Mika Hynnä <igheax@gmail.com>
3 --- asusosd_image.c.orig 2008-03-26 19:55:55.000000000 +0200
4 +++ asusosd_image.c 2008-03-26 21:30:07.000000000 +0200
6 static int xwindow_create(void);
7 static int ximage_create(void);
8 static int ximage_display(void);
9 +static void read_pos_from_config(char config[], int *x, int *y);
10 void destroy_osd(void);
11 //static void destroy_image(void);
12 static int x_msb(unsigned long u32val);
14 attr.border_pixel = 0;
15 x = 2;//(XDefaultScreenOfDisplay(display)->width - image_width)/2;
16 y = 2;//(XDefaultScreenOfDisplay(display)->height - image_height)/2;
18 + read_pos_from_config("/etc/acpi/eee.conf", &x, &y);
20 window = XCreateWindow(display, root, x, y, image_width, image_height, 0,
21 depth, InputOutput, visual, attrmask, &attr);
28 +static void read_pos_from_config(char config[], int *x, int *y)
33 + configfile = fopen(config, "r");
34 + if (configfile != NULL)
36 + while(fgets(line, 80, configfile) != NULL)
40 + //try to ignore comments
42 + else if (strstr(line, "ASUSOSD_XPOS=center") != NULL)
44 + *x = (XDefaultScreenOfDisplay(display)->width - image_width)/2;
46 + else if (strstr(line, "ASUSOSD_XPOS=") != NULL)
48 + sscanf(line,"ASUSOSD_XPOS=%i" , x);
50 + else if (strstr(line, "ASUSOSD_YPOS=center") != NULL)
52 + *y = (XDefaultScreenOfDisplay(display)->height - image_height)/2;
54 + else if (strstr(line, "ASUSOSD_YPOS=") != NULL)
56 + sscanf(line,"ASUSOSD_YPOS=%i" , y);
62 + printf("Unable to open configuration file '%s': defaulting.", config);