wmgeneral: Merge 2003-10-10 version from wmmon and wmtime.
Note that this was a fork of the earlier 1998-05-02 version and didn't contain the later changes. Therefore we merge the best of both versions. wmtime had some additional unnecessary dummy variables, so we use the wmmon version.
This commit is contained in:
parent
a680f87666
commit
6dc4716c29
|
@ -12,6 +12,8 @@
|
|||
---
|
||||
CHANGES:
|
||||
---
|
||||
10/10/2003 (Simon Law, sfllaw@debian.org)
|
||||
* changed the parse_rcfile function to use getline instead of fgets.
|
||||
14/09/1998 (Dave Clark, clarkd@skyia.com)
|
||||
* Updated createXBMfromXPM routine
|
||||
* Now supports >256 colors
|
||||
|
@ -134,7 +136,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|
|||
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||
|
||||
char *p;
|
||||
char temp[128];
|
||||
char *line = NULL;
|
||||
size_t line_size = 0;
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
|
@ -142,10 +145,10 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
|||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
while (fgets(temp, 128, fp)) {
|
||||
while (getline(&line, &line_size, fp) >= 0) {
|
||||
key = 0;
|
||||
while (key >= 0 && keys[key].label) {
|
||||
if ((p = strstr(temp, keys[key].label))) {
|
||||
if ((p = strstr(line, keys[key].label))) {
|
||||
p += strlen(keys[key].label);
|
||||
p += strspn(p, tokens);
|
||||
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||
|
@ -383,14 +386,10 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
int i, wx, wy;
|
||||
|
||||
for (i=1; argv[i]; i++) {
|
||||
if (!strcmp(argv[i], "-display")) {
|
||||
display_name = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-geometry")) {
|
||||
geometry = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-display"))
|
||||
display_name = argv[++i];
|
||||
else if (!strcmp(argv[i], "-geometry"))
|
||||
geometry = argv[++i];
|
||||
}
|
||||
|
||||
if (!(display = XOpenDisplay(display_name))) {
|
||||
|
@ -416,6 +415,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
|
||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||
if (geometry)
|
||||
XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
|
||||
(unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height);
|
||||
|
||||
mysizehints.width = 64;
|
||||
mysizehints.height = 64;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
---
|
||||
CHANGES:
|
||||
---
|
||||
10/10/2003 (Simon Law, sfllaw@debian.org)
|
||||
* changed the parse_rcfile function to use getline instead of fgets.
|
||||
14/09/1998 (Dave Clark, clarkd@skyia.com)
|
||||
* Updated createXBMfromXPM routine
|
||||
* Now supports >256 colors
|
||||
|
@ -134,7 +136,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|
|||
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||
|
||||
char *p;
|
||||
char temp[128];
|
||||
char *line = NULL;
|
||||
size_t line_size = 0;
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
|
@ -142,10 +145,10 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
|||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
while (fgets(temp, 128, fp)) {
|
||||
while (getline(&line, &line_size, fp) >= 0) {
|
||||
key = 0;
|
||||
while (key >= 0 && keys[key].label) {
|
||||
if ((p = strstr(temp, keys[key].label))) {
|
||||
if ((p = strstr(line, keys[key].label))) {
|
||||
p += strlen(keys[key].label);
|
||||
p += strspn(p, tokens);
|
||||
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||
|
@ -383,14 +386,10 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
int i, wx, wy;
|
||||
|
||||
for (i=1; argv[i]; i++) {
|
||||
if (!strcmp(argv[i], "-display")) {
|
||||
display_name = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-geometry")) {
|
||||
geometry = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-display"))
|
||||
display_name = argv[++i];
|
||||
else if (!strcmp(argv[i], "-geometry"))
|
||||
geometry = argv[++i];
|
||||
}
|
||||
|
||||
if (!(display = XOpenDisplay(display_name))) {
|
||||
|
@ -416,6 +415,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
|
||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||
if (geometry)
|
||||
XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
|
||||
(unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height);
|
||||
|
||||
mysizehints.width = 64;
|
||||
mysizehints.height = 64;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
---
|
||||
CHANGES:
|
||||
---
|
||||
10/10/2003 (Simon Law, sfllaw@debian.org)
|
||||
* changed the parse_rcfile function to use getline instead of fgets.
|
||||
14/09/1998 (Dave Clark, clarkd@skyia.com)
|
||||
* Updated createXBMfromXPM routine
|
||||
* Now supports >256 colors
|
||||
|
@ -134,7 +136,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|
|||
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||
|
||||
char *p;
|
||||
char temp[128];
|
||||
char *line = NULL;
|
||||
size_t line_size = 0;
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
|
@ -142,10 +145,10 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
|||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
while (fgets(temp, 128, fp)) {
|
||||
while (getline(&line, &line_size, fp) >= 0) {
|
||||
key = 0;
|
||||
while (key >= 0 && keys[key].label) {
|
||||
if ((p = strstr(temp, keys[key].label))) {
|
||||
if ((p = strstr(line, keys[key].label))) {
|
||||
p += strlen(keys[key].label);
|
||||
p += strspn(p, tokens);
|
||||
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||
|
@ -383,14 +386,10 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
int i, wx, wy;
|
||||
|
||||
for (i=1; argv[i]; i++) {
|
||||
if (!strcmp(argv[i], "-display")) {
|
||||
display_name = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-geometry")) {
|
||||
geometry = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-display"))
|
||||
display_name = argv[++i];
|
||||
else if (!strcmp(argv[i], "-geometry"))
|
||||
geometry = argv[++i];
|
||||
}
|
||||
|
||||
if (!(display = XOpenDisplay(display_name))) {
|
||||
|
@ -416,6 +415,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
|
||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||
if (geometry)
|
||||
XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
|
||||
(unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height);
|
||||
|
||||
mysizehints.width = 64;
|
||||
mysizehints.height = 64;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
---
|
||||
CHANGES:
|
||||
---
|
||||
10/10/2003 (Simon Law, sfllaw@debian.org)
|
||||
* changed the parse_rcfile function to use getline instead of fgets.
|
||||
14/09/1998 (Dave Clark, clarkd@skyia.com)
|
||||
* Updated createXBMfromXPM routine
|
||||
* Now supports >256 colors
|
||||
|
@ -134,7 +136,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|
|||
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||
|
||||
char *p;
|
||||
char temp[128];
|
||||
char *line = NULL;
|
||||
size_t line_size = 0;
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
|
@ -142,10 +145,10 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
|||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
while (fgets(temp, 128, fp)) {
|
||||
while (getline(&line, &line_size, fp) >= 0) {
|
||||
key = 0;
|
||||
while (key >= 0 && keys[key].label) {
|
||||
if ((p = strstr(temp, keys[key].label))) {
|
||||
if ((p = strstr(line, keys[key].label))) {
|
||||
p += strlen(keys[key].label);
|
||||
p += strspn(p, tokens);
|
||||
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||
|
@ -383,14 +386,10 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
int i, wx, wy;
|
||||
|
||||
for (i=1; argv[i]; i++) {
|
||||
if (!strcmp(argv[i], "-display")) {
|
||||
display_name = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-geometry")) {
|
||||
geometry = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-display"))
|
||||
display_name = argv[++i];
|
||||
else if (!strcmp(argv[i], "-geometry"))
|
||||
geometry = argv[++i];
|
||||
}
|
||||
|
||||
if (!(display = XOpenDisplay(display_name))) {
|
||||
|
@ -416,6 +415,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
|
||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||
if (geometry)
|
||||
XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
|
||||
(unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height);
|
||||
|
||||
mysizehints.width = 64;
|
||||
mysizehints.height = 64;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
---
|
||||
CHANGES:
|
||||
---
|
||||
10/10/2003 (Simon Law, sfllaw@debian.org)
|
||||
* changed the parse_rcfile function to use getline instead of fgets.
|
||||
14/09/1998 (Dave Clark, clarkd@skyia.com)
|
||||
* Updated createXBMfromXPM routine
|
||||
* Now supports >256 colors
|
||||
|
@ -134,7 +136,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|
|||
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||
|
||||
char *p;
|
||||
char temp[128];
|
||||
char *line = NULL;
|
||||
size_t line_size = 0;
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
|
@ -142,10 +145,10 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
|||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
while (fgets(temp, 128, fp)) {
|
||||
while (getline(&line, &line_size, fp) >= 0) {
|
||||
key = 0;
|
||||
while (key >= 0 && keys[key].label) {
|
||||
if ((p = strstr(temp, keys[key].label))) {
|
||||
if ((p = strstr(line, keys[key].label))) {
|
||||
p += strlen(keys[key].label);
|
||||
p += strspn(p, tokens);
|
||||
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||
|
@ -383,14 +386,10 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
int i, wx, wy;
|
||||
|
||||
for (i=1; argv[i]; i++) {
|
||||
if (!strcmp(argv[i], "-display")) {
|
||||
display_name = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-geometry")) {
|
||||
geometry = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-display"))
|
||||
display_name = argv[++i];
|
||||
else if (!strcmp(argv[i], "-geometry"))
|
||||
geometry = argv[++i];
|
||||
}
|
||||
|
||||
if (!(display = XOpenDisplay(display_name))) {
|
||||
|
@ -416,6 +415,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
|
||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||
if (geometry)
|
||||
XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
|
||||
(unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height);
|
||||
|
||||
mysizehints.width = 64;
|
||||
mysizehints.height = 64;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
---
|
||||
CHANGES:
|
||||
---
|
||||
10/10/2003 (Simon Law, sfllaw@debian.org)
|
||||
* changed the parse_rcfile function to use getline instead of fgets.
|
||||
14/09/1998 (Dave Clark, clarkd@skyia.com)
|
||||
* Updated createXBMfromXPM routine
|
||||
* Now supports >256 colors
|
||||
|
@ -134,7 +136,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|
|||
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||
|
||||
char *p;
|
||||
char temp[128];
|
||||
char *line = NULL;
|
||||
size_t line_size = 0;
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
|
@ -142,10 +145,10 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
|||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
while (fgets(temp, 128, fp)) {
|
||||
while (getline(&line, &line_size, fp) >= 0) {
|
||||
key = 0;
|
||||
while (key >= 0 && keys[key].label) {
|
||||
if ((p = strstr(temp, keys[key].label))) {
|
||||
if ((p = strstr(line, keys[key].label))) {
|
||||
p += strlen(keys[key].label);
|
||||
p += strspn(p, tokens);
|
||||
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||
|
@ -383,14 +386,10 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
int i, wx, wy;
|
||||
|
||||
for (i=1; argv[i]; i++) {
|
||||
if (!strcmp(argv[i], "-display")) {
|
||||
display_name = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-geometry")) {
|
||||
geometry = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-display"))
|
||||
display_name = argv[++i];
|
||||
else if (!strcmp(argv[i], "-geometry"))
|
||||
geometry = argv[++i];
|
||||
}
|
||||
|
||||
if (!(display = XOpenDisplay(display_name))) {
|
||||
|
@ -416,6 +415,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
|
||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||
if (geometry)
|
||||
XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
|
||||
(unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height);
|
||||
|
||||
mysizehints.width = 64;
|
||||
mysizehints.height = 64;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
---
|
||||
CHANGES:
|
||||
---
|
||||
10/10/2003 (Simon Law, sfllaw@debian.org)
|
||||
* changed the parse_rcfile function to use getline instead of fgets.
|
||||
14/09/1998 (Dave Clark, clarkd@skyia.com)
|
||||
* Updated createXBMfromXPM routine
|
||||
* Now supports >256 colors
|
||||
|
@ -134,7 +136,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|
|||
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||
|
||||
char *p;
|
||||
char temp[128];
|
||||
char *line = NULL;
|
||||
size_t line_size = 0;
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
|
@ -142,10 +145,10 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
|||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
while (fgets(temp, 128, fp)) {
|
||||
while (getline(&line, &line_size, fp) >= 0) {
|
||||
key = 0;
|
||||
while (key >= 0 && keys[key].label) {
|
||||
if ((p = strstr(temp, keys[key].label))) {
|
||||
if ((p = strstr(line, keys[key].label))) {
|
||||
p += strlen(keys[key].label);
|
||||
p += strspn(p, tokens);
|
||||
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||
|
@ -383,14 +386,10 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
int i, wx, wy;
|
||||
|
||||
for (i=1; argv[i]; i++) {
|
||||
if (!strcmp(argv[i], "-display")) {
|
||||
display_name = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-geometry")) {
|
||||
geometry = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-display"))
|
||||
display_name = argv[++i];
|
||||
else if (!strcmp(argv[i], "-geometry"))
|
||||
geometry = argv[++i];
|
||||
}
|
||||
|
||||
if (!(display = XOpenDisplay(display_name))) {
|
||||
|
@ -416,6 +415,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
|
||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||
if (geometry)
|
||||
XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
|
||||
(unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height);
|
||||
|
||||
mysizehints.width = 64;
|
||||
mysizehints.height = 64;
|
||||
|
|
|
@ -14,8 +14,25 @@
|
|||
---
|
||||
10/10/2003 (Simon Law, sfllaw@debian.org)
|
||||
* changed the parse_rcfile function to use getline instead of fgets.
|
||||
14/09/1998 (Dave Clark, clarkd@skyia.com)
|
||||
* Updated createXBMfromXPM routine
|
||||
* Now supports >256 colors
|
||||
11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||
* Removed a bug from parse_rcfile. You could
|
||||
not use "start" in a command if a label was
|
||||
also start.
|
||||
* Changed the needed geometry string.
|
||||
We don't use window size, and don't support
|
||||
negative positions.
|
||||
03/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||
* Added parse_rcfile2
|
||||
02/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||
* Added -geometry support (untested)
|
||||
28/08/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||
* Added createXBMfromXPM routine
|
||||
* Saves a lot of work with changing xpm's.
|
||||
02/05/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||
* changed the read_rc_file to parse_rcfile, as suggester by Marcelo E. Magallon
|
||||
* changed the read_rc_file to parse_rcfile, as suggested by Marcelo E. Magallon
|
||||
* debugged the parse_rc file.
|
||||
30/04/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||
* Ripped similar code from all the wm* programs,
|
||||
|
@ -23,7 +40,6 @@
|
|||
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -66,7 +82,6 @@ typedef struct {
|
|||
int right;
|
||||
} MOUSE_REGION;
|
||||
|
||||
#define MAX_MOUSE_REGION (8)
|
||||
MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
|
||||
|
||||
/***********************/
|
||||
|
@ -80,17 +95,53 @@ void AddMouseRegion(int, int, int, int, int);
|
|||
int CheckMouseRegion(int, int);
|
||||
|
||||
/*******************************************************************************\
|
||||
|* read_rc_file *|
|
||||
|* parse_rcfile *|
|
||||
\*******************************************************************************/
|
||||
|
||||
void parse_rcfile(const char *filename, rckeys *keys) {
|
||||
|
||||
char *p,*q;
|
||||
char temp[128];
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
while (fgets(temp, 128, fp)) {
|
||||
key = 0;
|
||||
q = strdup(temp);
|
||||
q = strtok(q, tokens);
|
||||
while (key >= 0 && keys[key].label) {
|
||||
if ((!strcmp(q, keys[key].label))) {
|
||||
p = strstr(temp, keys[key].label);
|
||||
p += strlen(keys[key].label);
|
||||
p += strspn(p, tokens);
|
||||
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||
free(*keys[key].var);
|
||||
*keys[key].var = strdup(p);
|
||||
key = -1;
|
||||
} else key++;
|
||||
}
|
||||
free(q);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************\
|
||||
|* parse_rcfile2 *|
|
||||
\*******************************************************************************/
|
||||
|
||||
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||
|
||||
char *p;
|
||||
char *line = NULL;
|
||||
size_t line_size = 0;
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
char *family = NULL;
|
||||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
|
@ -109,6 +160,7 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|
|||
}
|
||||
fclose(fp);
|
||||
}
|
||||
free(family);
|
||||
}
|
||||
|
||||
|
||||
|
@ -236,6 +288,54 @@ int CheckMouseRegion(int x, int y) {
|
|||
return (i-1);
|
||||
}
|
||||
|
||||
/*******************************************************************************\
|
||||
|* createXBMfromXPM *|
|
||||
\*******************************************************************************/
|
||||
void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
|
||||
|
||||
int i,j,k;
|
||||
int width, height, numcol, depth;
|
||||
int zero=0;
|
||||
unsigned char bwrite;
|
||||
int bcount;
|
||||
int curpixel;
|
||||
|
||||
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
|
||||
|
||||
|
||||
for (k=0; k!=depth; k++)
|
||||
{
|
||||
zero <<=8;
|
||||
zero |= xpm[1][k];
|
||||
}
|
||||
|
||||
for (i=numcol+1; i < numcol+sy+1; i++) {
|
||||
bcount = 0;
|
||||
bwrite = 0;
|
||||
for (j=0; j<sx*depth; j+=depth) {
|
||||
bwrite >>= 1;
|
||||
|
||||
curpixel=0;
|
||||
for (k=0; k!=depth; k++)
|
||||
{
|
||||
curpixel <<=8;
|
||||
curpixel |= xpm[i][j+k];
|
||||
}
|
||||
|
||||
if ( curpixel != zero ) {
|
||||
bwrite += 128;
|
||||
}
|
||||
bcount++;
|
||||
if (bcount == 8) {
|
||||
*xbm = bwrite;
|
||||
xbm++;
|
||||
bcount = 0;
|
||||
bwrite = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************\
|
||||
|* copyXPMArea *|
|
||||
\*******************************************************************************/
|
||||
|
@ -274,16 +374,16 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
unsigned int borderwidth = 1;
|
||||
XClassHint classHint;
|
||||
char *display_name = NULL;
|
||||
char *geometry = NULL;
|
||||
char *wname = argv[0];
|
||||
XTextProperty name;
|
||||
|
||||
XGCValues gcv;
|
||||
unsigned long gcm;
|
||||
|
||||
char *geometry = NULL;
|
||||
|
||||
int dummy=0;
|
||||
int i;
|
||||
int i, wx, wy;
|
||||
|
||||
for (i=1; argv[i]; i++) {
|
||||
if (!strcmp(argv[i], "-display"))
|
||||
|
@ -314,8 +414,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
fore_pix = GetColor("black");
|
||||
|
||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y,
|
||||
&mysizehints.width, &mysizehints.height, &dummy);
|
||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||
if (geometry)
|
||||
XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
|
||||
(unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height);
|
||||
|
@ -374,7 +473,11 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
XSetCommand(display, win, argv, argc);
|
||||
XMapWindow(display, win);
|
||||
|
||||
if (geometry) {
|
||||
if (sscanf(geometry, "+%d+%d", &wx, &wy) != 2) {
|
||||
fprintf(stderr, "Bad geometry string.\n");
|
||||
exit(1);
|
||||
}
|
||||
XMoveWindow(display, win, wx, wy);
|
||||
}
|
||||
}
|
||||
|
||||
/* vim: sw=4 ts=4 columns=82
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/* Defines */
|
||||
/***********/
|
||||
|
||||
#define MAX_MOUSE_REGION (8)
|
||||
#define MAX_MOUSE_REGION (16)
|
||||
|
||||
/************/
|
||||
/* Typedefs */
|
||||
|
@ -18,6 +18,14 @@ struct _rckeys {
|
|||
char **var;
|
||||
};
|
||||
|
||||
typedef struct _rckeys2 rckeys2;
|
||||
|
||||
struct _rckeys2 {
|
||||
const char *family;
|
||||
const char *label;
|
||||
char **var;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
Pixmap pixmap;
|
||||
Pixmap mask;
|
||||
|
@ -41,6 +49,7 @@ void openXwindow(int argc, char *argv[], char **, char *, int, int);
|
|||
void RedrawWindow(void);
|
||||
void RedrawWindowXY(int x, int y);
|
||||
|
||||
void createXBMfromXPM(char *, char **, int, int);
|
||||
void copyXPMArea(int, int, int, int, int, int);
|
||||
void copyXBMArea(int, int, int, int, int, int);
|
||||
void setMaskXY(int, int);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
---
|
||||
CHANGES:
|
||||
---
|
||||
10/10/2003 (Simon Law, sfllaw@debian.org)
|
||||
* changed the parse_rcfile function to use getline instead of fgets.
|
||||
14/09/1998 (Dave Clark, clarkd@skyia.com)
|
||||
* Updated createXBMfromXPM routine
|
||||
* Now supports >256 colors
|
||||
|
@ -134,7 +136,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|
|||
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||
|
||||
char *p;
|
||||
char temp[128];
|
||||
char *line = NULL;
|
||||
size_t line_size = 0;
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
|
@ -142,10 +145,10 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
|||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
while (fgets(temp, 128, fp)) {
|
||||
while (getline(&line, &line_size, fp) >= 0) {
|
||||
key = 0;
|
||||
while (key >= 0 && keys[key].label) {
|
||||
if ((p = strstr(temp, keys[key].label))) {
|
||||
if ((p = strstr(line, keys[key].label))) {
|
||||
p += strlen(keys[key].label);
|
||||
p += strspn(p, tokens);
|
||||
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||
|
@ -383,14 +386,10 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
int i, wx, wy;
|
||||
|
||||
for (i=1; argv[i]; i++) {
|
||||
if (!strcmp(argv[i], "-display")) {
|
||||
display_name = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-geometry")) {
|
||||
geometry = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-display"))
|
||||
display_name = argv[++i];
|
||||
else if (!strcmp(argv[i], "-geometry"))
|
||||
geometry = argv[++i];
|
||||
}
|
||||
|
||||
if (!(display = XOpenDisplay(display_name))) {
|
||||
|
@ -416,6 +415,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
|
||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||
if (geometry)
|
||||
XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
|
||||
(unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height);
|
||||
|
||||
mysizehints.width = 64;
|
||||
mysizehints.height = 64;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
---
|
||||
CHANGES:
|
||||
---
|
||||
10/10/2003 (Simon Law, sfllaw@debian.org)
|
||||
* changed the parse_rcfile function to use getline instead of fgets.
|
||||
14/09/1998 (Dave Clark, clarkd@skyia.com)
|
||||
* Updated createXBMfromXPM routine
|
||||
* Now supports >256 colors
|
||||
|
@ -134,7 +136,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|
|||
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||
|
||||
char *p;
|
||||
char temp[128];
|
||||
char *line = NULL;
|
||||
size_t line_size = 0;
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
|
@ -142,10 +145,10 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
|||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
while (fgets(temp, 128, fp)) {
|
||||
while (getline(&line, &line_size, fp) >= 0) {
|
||||
key = 0;
|
||||
while (key >= 0 && keys[key].label) {
|
||||
if ((p = strstr(temp, keys[key].label))) {
|
||||
if ((p = strstr(line, keys[key].label))) {
|
||||
p += strlen(keys[key].label);
|
||||
p += strspn(p, tokens);
|
||||
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||
|
@ -383,14 +386,10 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
int i, wx, wy;
|
||||
|
||||
for (i=1; argv[i]; i++) {
|
||||
if (!strcmp(argv[i], "-display")) {
|
||||
display_name = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-geometry")) {
|
||||
geometry = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-display"))
|
||||
display_name = argv[++i];
|
||||
else if (!strcmp(argv[i], "-geometry"))
|
||||
geometry = argv[++i];
|
||||
}
|
||||
|
||||
if (!(display = XOpenDisplay(display_name))) {
|
||||
|
@ -416,6 +415,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
|
||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||
if (geometry)
|
||||
XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
|
||||
(unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height);
|
||||
|
||||
mysizehints.width = 64;
|
||||
mysizehints.height = 64;
|
||||
|
|
|
@ -14,8 +14,25 @@
|
|||
---
|
||||
10/10/2003 (Simon Law, sfllaw@debian.org)
|
||||
* changed the parse_rcfile function to use getline instead of fgets.
|
||||
14/09/1998 (Dave Clark, clarkd@skyia.com)
|
||||
* Updated createXBMfromXPM routine
|
||||
* Now supports >256 colors
|
||||
11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||
* Removed a bug from parse_rcfile. You could
|
||||
not use "start" in a command if a label was
|
||||
also start.
|
||||
* Changed the needed geometry string.
|
||||
We don't use window size, and don't support
|
||||
negative positions.
|
||||
03/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||
* Added parse_rcfile2
|
||||
02/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||
* Added -geometry support (untested)
|
||||
28/08/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||
* Added createXBMfromXPM routine
|
||||
* Saves a lot of work with changing xpm's.
|
||||
02/05/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||
* changed the read_rc_file to parse_rcfile, as suggester by Marcelo E. Magallon
|
||||
* changed the read_rc_file to parse_rcfile, as suggested by Marcelo E. Magallon
|
||||
* debugged the parse_rc file.
|
||||
30/04/1998 (Martijn Pieterse, pieterse@xs4all.nl)
|
||||
* Ripped similar code from all the wm* programs,
|
||||
|
@ -23,7 +40,6 @@
|
|||
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -46,11 +62,6 @@ int screen;
|
|||
int x_fd;
|
||||
int d_depth;
|
||||
XSizeHints mysizehints;
|
||||
/* Deal with strange X11 function prototyping...
|
||||
* If I don't do this, I will get warnings about the sign
|
||||
* of the width/height variables - which are thrown away anyway. */
|
||||
int dummy_int_width, dummy_int_height;
|
||||
unsigned int uint_width, uint_height;
|
||||
XWMHints mywmhints;
|
||||
Pixel back_pix, fore_pix;
|
||||
char *Geometry = "";
|
||||
|
@ -71,7 +82,6 @@ typedef struct {
|
|||
int right;
|
||||
} MOUSE_REGION;
|
||||
|
||||
#define MAX_MOUSE_REGION (8)
|
||||
MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
|
||||
|
||||
/***********************/
|
||||
|
@ -85,17 +95,53 @@ void AddMouseRegion(int, int, int, int, int);
|
|||
int CheckMouseRegion(int, int);
|
||||
|
||||
/*******************************************************************************\
|
||||
|* read_rc_file *|
|
||||
|* parse_rcfile *|
|
||||
\*******************************************************************************/
|
||||
|
||||
void parse_rcfile(const char *filename, rckeys *keys) {
|
||||
|
||||
char *p,*q;
|
||||
char temp[128];
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
while (fgets(temp, 128, fp)) {
|
||||
key = 0;
|
||||
q = strdup(temp);
|
||||
q = strtok(q, tokens);
|
||||
while (key >= 0 && keys[key].label) {
|
||||
if ((!strcmp(q, keys[key].label))) {
|
||||
p = strstr(temp, keys[key].label);
|
||||
p += strlen(keys[key].label);
|
||||
p += strspn(p, tokens);
|
||||
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||
free(*keys[key].var);
|
||||
*keys[key].var = strdup(p);
|
||||
key = -1;
|
||||
} else key++;
|
||||
}
|
||||
free(q);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************\
|
||||
|* parse_rcfile2 *|
|
||||
\*******************************************************************************/
|
||||
|
||||
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||
|
||||
char *p;
|
||||
char *line = NULL;
|
||||
size_t line_size = 0;
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
char *family = NULL;
|
||||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
|
@ -114,6 +160,7 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|
|||
}
|
||||
fclose(fp);
|
||||
}
|
||||
free(family);
|
||||
}
|
||||
|
||||
|
||||
|
@ -241,6 +288,54 @@ int CheckMouseRegion(int x, int y) {
|
|||
return (i-1);
|
||||
}
|
||||
|
||||
/*******************************************************************************\
|
||||
|* createXBMfromXPM *|
|
||||
\*******************************************************************************/
|
||||
void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
|
||||
|
||||
int i,j,k;
|
||||
int width, height, numcol, depth;
|
||||
int zero=0;
|
||||
unsigned char bwrite;
|
||||
int bcount;
|
||||
int curpixel;
|
||||
|
||||
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
|
||||
|
||||
|
||||
for (k=0; k!=depth; k++)
|
||||
{
|
||||
zero <<=8;
|
||||
zero |= xpm[1][k];
|
||||
}
|
||||
|
||||
for (i=numcol+1; i < numcol+sy+1; i++) {
|
||||
bcount = 0;
|
||||
bwrite = 0;
|
||||
for (j=0; j<sx*depth; j+=depth) {
|
||||
bwrite >>= 1;
|
||||
|
||||
curpixel=0;
|
||||
for (k=0; k!=depth; k++)
|
||||
{
|
||||
curpixel <<=8;
|
||||
curpixel |= xpm[i][j+k];
|
||||
}
|
||||
|
||||
if ( curpixel != zero ) {
|
||||
bwrite += 128;
|
||||
}
|
||||
bcount++;
|
||||
if (bcount == 8) {
|
||||
*xbm = bwrite;
|
||||
xbm++;
|
||||
bcount = 0;
|
||||
bwrite = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************\
|
||||
|* copyXPMArea *|
|
||||
\*******************************************************************************/
|
||||
|
@ -279,16 +374,16 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
unsigned int borderwidth = 1;
|
||||
XClassHint classHint;
|
||||
char *display_name = NULL;
|
||||
char *geometry = NULL;
|
||||
char *wname = argv[0];
|
||||
XTextProperty name;
|
||||
|
||||
XGCValues gcv;
|
||||
unsigned long gcm;
|
||||
|
||||
char *geometry = NULL;
|
||||
|
||||
int dummy=0;
|
||||
int i;
|
||||
int i, wx, wy;
|
||||
|
||||
for (i=1; argv[i]; i++) {
|
||||
if (!strcmp(argv[i], "-display"))
|
||||
|
@ -319,21 +414,19 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
fore_pix = GetColor("black");
|
||||
|
||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y,
|
||||
&dummy_int_width, &dummy_int_height, &dummy);
|
||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||
if (geometry)
|
||||
XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
|
||||
&uint_width, &uint_height);
|
||||
(unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height);
|
||||
|
||||
/* Override width/height anyway */
|
||||
uint_width = 64;
|
||||
uint_height = 64;
|
||||
mysizehints.width = 64;
|
||||
mysizehints.height = 64;
|
||||
|
||||
win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
|
||||
uint_width, uint_height, borderwidth, fore_pix, back_pix);
|
||||
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
|
||||
|
||||
iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
|
||||
uint_width, uint_height, borderwidth, fore_pix, back_pix);
|
||||
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
|
||||
|
||||
/* Activate hints */
|
||||
XSetWMNormalHints(display, win, &mysizehints);
|
||||
|
@ -380,7 +473,11 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
XSetCommand(display, win, argv, argc);
|
||||
XMapWindow(display, win);
|
||||
|
||||
if (geometry) {
|
||||
if (sscanf(geometry, "+%d+%d", &wx, &wy) != 2) {
|
||||
fprintf(stderr, "Bad geometry string.\n");
|
||||
exit(1);
|
||||
}
|
||||
XMoveWindow(display, win, wx, wy);
|
||||
}
|
||||
}
|
||||
|
||||
/* vim: ts=4 columns=82
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/* Defines */
|
||||
/***********/
|
||||
|
||||
#define MAX_MOUSE_REGION (8)
|
||||
#define MAX_MOUSE_REGION (16)
|
||||
|
||||
/************/
|
||||
/* Typedefs */
|
||||
|
@ -18,6 +18,14 @@ struct _rckeys {
|
|||
char **var;
|
||||
};
|
||||
|
||||
typedef struct _rckeys2 rckeys2;
|
||||
|
||||
struct _rckeys2 {
|
||||
const char *family;
|
||||
const char *label;
|
||||
char **var;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
Pixmap pixmap;
|
||||
Pixmap mask;
|
||||
|
@ -41,6 +49,7 @@ void openXwindow(int argc, char *argv[], char **, char *, int, int);
|
|||
void RedrawWindow(void);
|
||||
void RedrawWindowXY(int x, int y);
|
||||
|
||||
void createXBMfromXPM(char *, char **, int, int);
|
||||
void copyXPMArea(int, int, int, int, int, int);
|
||||
void copyXBMArea(int, int, int, int, int, int);
|
||||
void setMaskXY(int, int);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
---
|
||||
CHANGES:
|
||||
---
|
||||
10/10/2003 (Simon Law, sfllaw@debian.org)
|
||||
* changed the parse_rcfile function to use getline instead of fgets.
|
||||
14/09/1998 (Dave Clark, clarkd@skyia.com)
|
||||
* Updated createXBMfromXPM routine
|
||||
* Now supports >256 colors
|
||||
|
@ -134,7 +136,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|
|||
void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
||||
|
||||
char *p;
|
||||
char temp[128];
|
||||
char *line = NULL;
|
||||
size_t line_size = 0;
|
||||
char *tokens = " :\t\n";
|
||||
FILE *fp;
|
||||
int i,key;
|
||||
|
@ -142,10 +145,10 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
|
|||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
while (fgets(temp, 128, fp)) {
|
||||
while (getline(&line, &line_size, fp) >= 0) {
|
||||
key = 0;
|
||||
while (key >= 0 && keys[key].label) {
|
||||
if ((p = strstr(temp, keys[key].label))) {
|
||||
if ((p = strstr(line, keys[key].label))) {
|
||||
p += strlen(keys[key].label);
|
||||
p += strspn(p, tokens);
|
||||
if ((i = strcspn(p, "#\n"))) p[i] = 0;
|
||||
|
@ -383,14 +386,10 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
int i, wx, wy;
|
||||
|
||||
for (i=1; argv[i]; i++) {
|
||||
if (!strcmp(argv[i], "-display")) {
|
||||
display_name = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-geometry")) {
|
||||
geometry = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
if (!strcmp(argv[i], "-display"))
|
||||
display_name = argv[++i];
|
||||
else if (!strcmp(argv[i], "-geometry"))
|
||||
geometry = argv[++i];
|
||||
}
|
||||
|
||||
if (!(display = XOpenDisplay(display_name))) {
|
||||
|
@ -416,6 +415,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
|
|||
|
||||
XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
|
||||
&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
|
||||
if (geometry)
|
||||
XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
|
||||
(unsigned int *) &mysizehints.width, (unsigned int *) &mysizehints.height);
|
||||
|
||||
mysizehints.width = 64;
|
||||
mysizehints.height = 64;
|
||||
|
|
Loading…
Reference in a new issue