[Pkg-wmaker-commits] [wmbiff] 40/77: run make indent; also tolerate standard geometry string (dumping the dimensions provided)
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:01:10 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to tag wmbiff_0_4_0
in repository wmbiff.
commit 04dabbf9ef203eb7ca3277ef2ca0de7de5352a2c
Author: bluehal <bluehal>
Date: Mon Apr 15 21:19:17 2002 +0000
run make indent; also tolerate standard geometry string (dumping the dimensions provided)
---
wmgeneral/Makefile.am | 8 ++
wmgeneral/list.c | 138 ++++++++++------------
wmgeneral/list.h | 20 ++--
wmgeneral/misc.c | 14 +--
wmgeneral/misc.h | 2 +-
wmgeneral/wmgeneral.c | 319 ++++++++++++++++++++++++++++----------------------
wmgeneral/wmgeneral.h | 21 ++--
7 files changed, 278 insertions(+), 244 deletions(-)
diff --git a/wmgeneral/Makefile.am b/wmgeneral/Makefile.am
index 78d10db..ba9f553 100644
--- a/wmgeneral/Makefile.am
+++ b/wmgeneral/Makefile.am
@@ -2,3 +2,11 @@ noinst_LIBRARIES = libwmgeneral.a
libwmgeneral_a_SOURCES = list.c list.h misc.c misc.h wmgeneral.c wmgeneral.h
MAINTAINERCLEANFILES = Makefile.in
+
+
+indent:
+ indent -npro -kr -i4 -ts4 $(libwmgeneral_a_SOURCES) || true
+
+dist-hook-local: indent
+
+
diff --git a/wmgeneral/list.c b/wmgeneral/list.c
index f804b2c..14f5ee8 100644
--- a/wmgeneral/list.c
+++ b/wmgeneral/list.c
@@ -38,64 +38,57 @@ Boston, MA 02111-1307, USA. */
/* Return a cons cell produced from (head . tail) */
-INLINE LinkedList*
-list_cons(void* head, LinkedList* tail)
+INLINE LinkedList *list_cons(void *head, LinkedList * tail)
{
- LinkedList* cell;
+ LinkedList *cell;
- cell = (LinkedList*)malloc(sizeof(LinkedList));
- cell->head = head;
- cell->tail = tail;
- return cell;
+ cell = (LinkedList *) malloc(sizeof(LinkedList));
+ cell->head = head;
+ cell->tail = tail;
+ return cell;
}
/* Return the length of a list, list_length(NULL) returns zero */
-INLINE int
-list_length(LinkedList* list)
+INLINE int list_length(LinkedList * list)
{
- int i = 0;
- while(list)
- {
- i += 1;
- list = list->tail;
- }
- return i;
+ int i = 0;
+ while (list) {
+ i += 1;
+ list = list->tail;
+ }
+ return i;
}
/* Return the Nth element of LIST, where N count from zero. If N
larger than the list length, NULL is returned */
-INLINE void*
-list_nth(int index, LinkedList* list)
+INLINE void *list_nth(int index, LinkedList * list)
{
- while(index-- != 0)
- {
- if(list->tail)
- list = list->tail;
- else
- return 0;
- }
- return list->head;
+ while (index-- != 0) {
+ if (list->tail)
+ list = list->tail;
+ else
+ return 0;
+ }
+ return list->head;
}
/* Remove the element at the head by replacing it by its successor */
-INLINE void
-list_remove_head(LinkedList** list)
+INLINE void list_remove_head(LinkedList ** list)
{
- if (!*list) return;
- if ((*list)->tail)
- {
- LinkedList* tail = (*list)->tail; /* fetch next */
- *(*list) = *tail; /* copy next to list head */
- free(tail); /* free next */
- }
- else /* only one element in list */
- {
- free(*list);
- (*list) = 0;
- }
+ if (!*list)
+ return;
+ if ((*list)->tail) {
+ LinkedList *tail = (*list)->tail; /* fetch next */
+ *(*list) = *tail; /* copy next to list head */
+ free(tail); /* free next */
+ } else { /* only one element in list */
+
+ free(*list);
+ (*list) = 0;
+ }
}
@@ -112,58 +105,51 @@ list_remove_elem(LinkedList** list, void* elem)
}
}*/
-INLINE LinkedList *
-list_remove_elem(LinkedList* list, void* elem)
+INLINE LinkedList *list_remove_elem(LinkedList * list, void *elem)
{
- LinkedList *tmp;
-
- if (list) {
- if (list->head == elem) {
- tmp = list->tail;
- free(list);
- return tmp;
+ LinkedList *tmp;
+
+ if (list) {
+ if (list->head == elem) {
+ tmp = list->tail;
+ free(list);
+ return tmp;
+ }
+ list->tail = list_remove_elem(list->tail, elem);
+ return list;
}
- list->tail = list_remove_elem(list->tail, elem);
- return list;
- }
- return NULL;
+ return NULL;
}
/* Return element that has ELEM as car */
-INLINE LinkedList*
-list_find(LinkedList* list, void* elem)
+INLINE LinkedList *list_find(LinkedList * list, void *elem)
{
- while(list)
- {
- if (list->head == elem)
- return list;
- list = list->tail;
- }
- return NULL;
+ while (list) {
+ if (list->head == elem)
+ return list;
+ list = list->tail;
+ }
+ return NULL;
}
/* Free list (backwards recursive) */
-INLINE void
-list_free(LinkedList* list)
+INLINE void list_free(LinkedList * list)
{
- if(list)
- {
- list_free(list->tail);
- free(list);
- }
+ if (list) {
+ list_free(list->tail);
+ free(list);
+ }
}
/* Map FUNCTION over all elements in LIST */
-INLINE void
-list_mapcar(LinkedList* list, void(*function)(void*))
+INLINE void list_mapcar(LinkedList * list, void (*function) (void *))
{
- while(list)
- {
- (*function)(list->head);
- list = list->tail;
- }
+ while (list) {
+ (*function) (list->head);
+ list = list->tail;
+ }
}
diff --git a/wmgeneral/list.h b/wmgeneral/list.h
index 5ea8ee2..b32e65d 100644
--- a/wmgeneral/list.h
+++ b/wmgeneral/list.h
@@ -36,24 +36,24 @@ Boston, MA 02111-1307, USA. */
#endif
typedef struct LinkedList {
- void *head;
- struct LinkedList *tail;
+ void *head;
+ struct LinkedList *tail;
} LinkedList;
-INLINE LinkedList* list_cons(void* head, LinkedList* tail);
+INLINE LinkedList *list_cons(void *head, LinkedList * tail);
-INLINE int list_length(LinkedList* list);
+INLINE int list_length(LinkedList * list);
-INLINE void* list_nth(int n, LinkedList* list);
+INLINE void *list_nth(int n, LinkedList * list);
-INLINE void list_remove_head(LinkedList** list);
+INLINE void list_remove_head(LinkedList ** list);
-INLINE LinkedList *list_remove_elem(LinkedList* list, void* elem);
+INLINE LinkedList *list_remove_elem(LinkedList * list, void *elem);
-INLINE void list_mapcar(LinkedList* list, void(*function)(void*));
+INLINE void list_mapcar(LinkedList * list, void (*function) (void *));
-INLINE LinkedList*list_find(LinkedList* list, void* elem);
+INLINE LinkedList *list_find(LinkedList * list, void *elem);
-INLINE void list_free(LinkedList* list);
+INLINE void list_free(LinkedList * list);
#endif
diff --git a/wmgeneral/misc.c b/wmgeneral/misc.c
index 489c350..40274a3 100644
--- a/wmgeneral/misc.c
+++ b/wmgeneral/misc.c
@@ -24,14 +24,12 @@
#include "list.h"
#include "misc.h"
-extern pid_t
-execCommand(char *command)
+extern pid_t execCommand(char *command)
{
- pid_t pid;
+ pid_t pid;
- if ((pid=fork())==0)
- {
- execl("/bin/sh", "sh", "-c", command, (char *)0);
- }
- return pid;
+ if ((pid = fork()) == 0) {
+ execl("/bin/sh", "sh", "-c", command, (char *) 0);
+ }
+ return pid;
}
diff --git a/wmgeneral/misc.h b/wmgeneral/misc.h
index 602e1b7..4c0027b 100644
--- a/wmgeneral/misc.h
+++ b/wmgeneral/misc.h
@@ -6,4 +6,4 @@
extern void parse_command(char *, char ***, int *);
extern pid_t execCommand(char *);
-#endif /* __MISC_H */
+#endif /* __MISC_H */
diff --git a/wmgeneral/wmgeneral.c b/wmgeneral/wmgeneral.c
index 6b2f893..f5a2e52 100644
--- a/wmgeneral/wmgeneral.c
+++ b/wmgeneral/wmgeneral.c
@@ -55,7 +55,7 @@
#ifdef HAVE_XPM_H
#include <xpm.h>
#endif
-#include <X11/Xutil.h> /* needed for Region on solaris? */
+#include <X11/Xutil.h> /* needed for Region on solaris? */
#include <X11/extensions/shape.h>
#include "wmgeneral.h"
@@ -64,32 +64,32 @@
/* X11 Variables */
/*****************/
-Window Root;
-int screen;
-int x_fd;
-int d_depth;
-XSizeHints mysizehints;
-XWMHints mywmhints;
-Pixel back_pix, fore_pix;
-const char *Geometry = "";
-Window iconwin, win;
-GC NormalGC;
-XpmIcon wmgen;
-Pixmap pixmask;
+Window Root;
+int screen;
+int x_fd;
+int d_depth;
+XSizeHints mysizehints;
+XWMHints mywmhints;
+Pixel back_pix, fore_pix;
+const char *Geometry = "";
+Window iconwin, win;
+GC NormalGC;
+XpmIcon wmgen;
+Pixmap pixmask;
/*****************/
/* Mouse Regions */
/*****************/
typedef struct {
- int enable;
- int top;
- int bottom;
- int left;
- int right;
+ int enable;
+ int top;
+ int bottom;
+ int left;
+ int right;
} MOUSE_REGION;
-MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
+MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
/***********************/
/* Function Prototypes */
@@ -105,13 +105,14 @@ int CheckMouseRegion(int, int);
|* parse_rcfile *|
\*******************************************************************************/
-void parse_rcfile(const char *filename, rckeys *keys) {
+void parse_rcfile(const char *filename, rckeys * keys)
+{
- char *p,*q;
- char temp[128];
- const char *tokens = " :\t\n";
- FILE *fp;
- int i,key;
+ char *p, *q;
+ char temp[128];
+ const char *tokens = " :\t\n";
+ FILE *fp;
+ int i, key;
fp = fopen(filename, "r");
if (fp) {
@@ -124,11 +125,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
p = strstr(temp, keys[key].label);
p += strlen(keys[key].label);
p += strspn(p, tokens);
- if ((i = strcspn(p, "#\n"))) p[i] = 0;
+ if ((i = strcspn(p, "#\n")))
+ p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p);
key = -1;
- } else key++;
+ } else
+ key++;
}
free(q);
}
@@ -140,14 +143,15 @@ void parse_rcfile(const char *filename, rckeys *keys) {
|* parse_rcfile2 *|
\*******************************************************************************/
-void parse_rcfile2(const char *filename, rckeys2 *keys) {
+void parse_rcfile2(const char *filename, rckeys2 * keys)
+{
- char *p;
- char temp[128];
- const char *tokens = " :\t\n";
- FILE *fp;
- int i,key;
- char *family = NULL;
+ char *p;
+ char temp[128];
+ const char *tokens = " :\t\n";
+ FILE *fp;
+ int i, key;
+ char *family = NULL;
fp = fopen(filename, "r");
if (fp) {
@@ -157,11 +161,13 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
if ((p = strstr(temp, keys[key].label))) {
p += strlen(keys[key].label);
p += strspn(p, tokens);
- if ((i = strcspn(p, "#\n"))) p[i] = 0;
+ if ((i = strcspn(p, "#\n")))
+ p[i] = 0;
free(*keys[key].var);
*keys[key].var = strdup(p);
key = -1;
- } else key++;
+ } else
+ key++;
}
}
fclose(fp);
@@ -174,21 +180,23 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
|* GetXPM *|
\*******************************************************************************/
-static void GetXPM(XpmIcon *wmgen_local, const char *pixmap_bytes[]) {
+static void GetXPM(XpmIcon * wmgen_local, const char *pixmap_bytes[])
+{
- XWindowAttributes attributes;
- int err;
+ XWindowAttributes attributes;
+ int err;
/* For the colormap */
XGetWindowAttributes(display, Root, &attributes);
- wmgen_local->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
+ wmgen_local->attributes.valuemask |=
+ (XpmReturnPixels | XpmReturnExtensions);
+
+ err = XpmCreatePixmapFromData(display, Root, (char **) pixmap_bytes,
+ &(wmgen_local->pixmap),
+ &(wmgen_local->mask),
+ &(wmgen_local->attributes));
- err = XpmCreatePixmapFromData(display, Root, (char **)pixmap_bytes,
- &(wmgen_local->pixmap),
- &(wmgen_local->mask),
- &(wmgen_local->attributes));
-
if (err != XpmSuccess) {
fprintf(stderr, "Not enough free colorcells.\n");
exit(1);
@@ -199,10 +207,11 @@ static void GetXPM(XpmIcon *wmgen_local, const char *pixmap_bytes[]) {
|* GetColor *|
\*******************************************************************************/
-static Pixel GetColor(const char *name) {
+static Pixel GetColor(const char *name)
+{
- XColor color;
- XWindowAttributes attributes;
+ XColor color;
+ XWindowAttributes attributes;
XGetWindowAttributes(display, Root, &attributes);
@@ -219,10 +228,11 @@ static Pixel GetColor(const char *name) {
|* flush_expose *|
\*******************************************************************************/
-static int flush_expose(Window w) {
+static int flush_expose(Window w)
+{
- XEvent dummy;
- int i=0;
+ XEvent dummy;
+ int i = 0;
while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
i++;
@@ -234,35 +244,39 @@ static int flush_expose(Window w) {
|* RedrawWindow *|
\*******************************************************************************/
-void RedrawWindow(void) {
-
+void RedrawWindow(void)
+{
+
flush_expose(iconwin);
- XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
- 0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+ XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
+ 0, 0, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
flush_expose(win);
XCopyArea(display, wmgen.pixmap, win, NormalGC,
- 0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+ 0, 0, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
}
/*******************************************************************************\
|* RedrawWindowXY *|
\*******************************************************************************/
-void RedrawWindowXY(int x, int y) {
-
+void RedrawWindowXY(int x, int y)
+{
+
flush_expose(iconwin);
- XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
- x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+ XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
+ x, y, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
flush_expose(win);
XCopyArea(display, wmgen.pixmap, win, NormalGC,
- x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+ x, y, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
}
/*******************************************************************************\
|* AddMouseRegion *|
\*******************************************************************************/
-void AddMouseRegion(int region_idx, int left, int top, int right, int bottom) {
+void AddMouseRegion(int region_idx, int left, int top, int right,
+ int bottom)
+{
if (region_idx < MAX_MOUSE_REGION) {
mouse_region[region_idx].enable = 1;
@@ -277,60 +291,60 @@ void AddMouseRegion(int region_idx, int left, int top, int right, int bottom) {
|* CheckMouseRegion *|
\*******************************************************************************/
-int CheckMouseRegion(int x, int y) {
+int CheckMouseRegion(int x, int y)
+{
- int i;
- int found;
+ int i;
+ int found;
found = 0;
- for (i=0; i<MAX_MOUSE_REGION && !found; i++) {
+ for (i = 0; i < MAX_MOUSE_REGION && !found; i++) {
if (mouse_region[i].enable &&
x <= mouse_region[i].right &&
x >= mouse_region[i].left &&
- y <= mouse_region[i].bottom &&
- y >= mouse_region[i].top)
+ y <= mouse_region[i].bottom && y >= mouse_region[i].top)
found = 1;
}
- if (!found) return -1;
- return (i-1);
+ if (!found)
+ return -1;
+ return (i - 1);
}
/*******************************************************************************\
|* createXBMfromXPM *|
\*******************************************************************************/
-void createXBMfromXPM(char *xbm, const 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;
-
+void createXBMfromXPM(char *xbm, const 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++) {
+ 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 ) {
+ 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++;
@@ -348,9 +362,11 @@ void createXBMfromXPM(char *xbm, const char **xpm, int sx, int sy) {
|* copyXPMArea *|
\*******************************************************************************/
-void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
+void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy)
+{
- XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
+ XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy,
+ dx, dy);
}
@@ -358,9 +374,11 @@ void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
|* copyXBMArea *|
\*******************************************************************************/
-void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
+void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy)
+{
- XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
+ XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy,
+ dx, dy);
}
@@ -368,51 +386,56 @@ void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
|* setMaskXY *|
\*******************************************************************************/
-void setMaskXY(int x, int y) {
+void setMaskXY(int x, int y)
+{
- XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
- XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
+ XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask,
+ ShapeSet);
+ XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask,
+ ShapeSet);
}
/*******************************************************************************\
|* openXwindow *|
\*******************************************************************************/
-void openXwindow(int argc, char *argv[], const char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) {
+void openXwindow(int argc, char *argv[], const char *pixmap_bytes[],
+ char *pixmask_bits, int pixmask_width, int pixmask_height)
+{
- unsigned int borderwidth = 1;
- XClassHint classHint;
- char *display_name = NULL;
- char *wname = argv[0];
- XTextProperty name;
+ unsigned int borderwidth = 1;
+ XClassHint classHint;
+ char *display_name = NULL;
+ char *wname = argv[0];
+ XTextProperty name;
- XGCValues gcv;
- unsigned long gcm;
+ XGCValues gcv;
+ unsigned long gcm;
- char *geometry = NULL;
+ char *geometry = NULL;
- int dummy=0;
- int i, wx, wy;
+ int dummy = 0;
+ int i;
- for (i=1; argv[i]; i++) {
+ for (i = 1; argv[i]; i++) {
if (!strcmp(argv[i], "-display")) {
- display_name = argv[i+1];
+ display_name = argv[i + 1];
i++;
}
if (!strcmp(argv[i], "-geometry")) {
- geometry = argv[i+1];
+ geometry = argv[i + 1];
i++;
}
}
if (!(display = XOpenDisplay(display_name))) {
- fprintf(stderr, "%s: can't open display %s\n",
- wname, XDisplayName(display_name));
+ fprintf(stderr, "%s: can't open display %s\n",
+ wname, XDisplayName(display_name));
exit(1);
}
- screen = DefaultScreen(display);
- Root = RootWindow(display, screen);
+ screen = DefaultScreen(display);
+ Root = RootWindow(display, screen);
d_depth = DefaultDepth(display, screen);
- x_fd = XConnectionNumber(display);
+ x_fd = XConnectionNumber(display);
/* Convert XPM to XImage */
GetXPM(&wmgen, pixmap_bytes);
@@ -426,16 +449,20 @@ void openXwindow(int argc, char *argv[], const char *pixmap_bytes[], char *pixma
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);
mysizehints.width = 64;
mysizehints.height = 64;
-
+
win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
- mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
-
- iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
- mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
+ mysizehints.width, mysizehints.height,
+ borderwidth, fore_pix, back_pix);
+
+ iconwin =
+ XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
+ mysizehints.width, mysizehints.height,
+ borderwidth, fore_pix, back_pix);
/* Activate hints */
XSetWMNormalHints(display, win, &mysizehints);
@@ -443,8 +470,12 @@ void openXwindow(int argc, char *argv[], const char *pixmap_bytes[], char *pixma
classHint.res_class = wname;
XSetClassHint(display, win, &classHint);
- XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
- XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
+ XSelectInput(display, win,
+ ButtonPressMask | ExposureMask | ButtonReleaseMask |
+ PointerMotionMask | StructureNotifyMask);
+ XSelectInput(display, iconwin,
+ ButtonPressMask | ExposureMask | ButtonReleaseMask |
+ PointerMotionMask | StructureNotifyMask);
if (XStringListToTextProperty(&wname, 1, &name) == 0) {
fprintf(stderr, "%s: can't allocate window name\n", wname);
@@ -454,7 +485,7 @@ void openXwindow(int argc, char *argv[], const char *pixmap_bytes[], char *pixma
XSetWMName(display, win, &name);
/* Create GC for drawing */
-
+
gcm = GCForeground | GCBackground | GCGraphicsExposures;
gcv.foreground = fore_pix;
gcv.background = back_pix;
@@ -463,10 +494,14 @@ void openXwindow(int argc, char *argv[], const char *pixmap_bytes[], char *pixma
/* ONLYSHAPE ON */
- pixmask = XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width, pixmask_height);
+ pixmask =
+ XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width,
+ pixmask_height);
- XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet);
- XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
+ XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask,
+ ShapeSet);
+ XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask,
+ ShapeSet);
/* ONLYSHAPE OFF */
@@ -475,7 +510,8 @@ void openXwindow(int argc, char *argv[], const char *pixmap_bytes[], char *pixma
mywmhints.icon_x = mysizehints.x;
mywmhints.icon_y = mysizehints.y;
mywmhints.window_group = win;
- mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
+ mywmhints.flags =
+ StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
XSetWMHints(display, win, &mywmhints);
@@ -483,10 +519,15 @@ void openXwindow(int argc, char *argv[], const char *pixmap_bytes[], char *pixma
XMapWindow(display, win);
if (geometry) {
- if (sscanf(geometry, "+%d+%d", &wx, &wy) != 2) {
- fprintf(stderr, "Bad geometry string.\n");
+ int wx, wy, x, y;
+ if (sscanf(geometry, "+%d+%d", &wx, &wy) == 2) {
+ XMoveWindow(display, win, wx, wy);
+ } else if (sscanf(geometry, "%dx%d+%d+%d", &x, &y, &wx, &wy) == 4) {
+ XMoveWindow(display, win, wx, wy);
+ } else {
+ fprintf(stderr, "Unsupported geometry string '%s'\n",
+ geometry);
exit(1);
}
- XMoveWindow(display, win, wx, wy);
}
}
diff --git a/wmgeneral/wmgeneral.h b/wmgeneral/wmgeneral.h
index a167774..568545c 100644
--- a/wmgeneral/wmgeneral.h
+++ b/wmgeneral/wmgeneral.h
@@ -14,35 +14,36 @@
typedef struct _rckeys rckeys;
struct _rckeys {
- const char *label;
- char **var;
+ const char *label;
+ char **var;
};
typedef struct _rckeys2 rckeys2;
struct _rckeys2 {
- const char *family;
- const char *label;
- char **var;
+ const char *family;
+ const char *label;
+ char **var;
};
typedef struct {
- Pixmap pixmap;
- Pixmap mask;
- XpmAttributes attributes;
+ Pixmap pixmap;
+ Pixmap mask;
+ XpmAttributes attributes;
} XpmIcon;
/*******************/
/* Global variable */
/*******************/
-Display *display;
+Display *display;
/***********************/
/* Function Prototypes */
/***********************/
-void AddMouseRegion(int rgn_index, int left, int top, int right, int bottom);
+void AddMouseRegion(int rgn_index, int left, int top, int right,
+ int bottom);
int CheckMouseRegion(int x, int y);
void openXwindow(int argc, char *argv[], const char **, char *, int, int);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git
More information about the Pkg-wmaker-commits
mailing list