1
0
mirror of https://github.com/gryf/wmdocklib.git synced 2025-12-19 04:20:17 +01:00

Removed trailing whitespace from c module.

This commit is contained in:
2022-04-11 18:14:38 +02:00
parent 21c9d0afeb
commit ba08fc6ec2

View File

@@ -63,7 +63,7 @@ Pixmap pixmask;
Atom deleteAtom; /* Added 2003-06-24 for graceful shutdown. */ Atom deleteAtom; /* Added 2003-06-24 for graceful shutdown. */
/*****************************************************************************/ /*****************************************************************************/
/* The Python stuff */ /* The Python stuff */
/*****************************************************************************/ /*****************************************************************************/
static char **pixmap; /* Global pixmap, we only support one of these */ static char **pixmap; /* Global pixmap, we only support one of these */
static char *maskBits; /* Global maskbits, also only 1 supported */ static char *maskBits; /* Global maskbits, also only 1 supported */
@@ -204,27 +204,27 @@ pywmgeneral_checkForEvents(PyObject *self, PyObject *args) {
RedrawWindow(); RedrawWindow();
break; break;
case EnterNotify: case EnterNotify:
case LeaveNotify: case LeaveNotify:
/* needed by KeyPress/release, otherwise events go to parent. */ /* needed by KeyPress/release, otherwise events go to parent. */
XSetInputFocus(display, PointerRoot, RevertToParent, CurrentTime); XSetInputFocus(display, PointerRoot, RevertToParent, CurrentTime);
break; break;
case KeyPress: case KeyPress:
count = XLookupString((XKeyEvent*)&event, buffer, bufsize, &keysym, &dummy); count = XLookupString((XKeyEvent*)&event, buffer, bufsize, &keysym, &dummy);
buffer[count] = '\0'; buffer[count] = '\0';
return Py_BuildValue("{s:s,s:i,s:i,s:s}", return Py_BuildValue("{s:s,s:i,s:i,s:s}",
"type", "keypress", "type", "keypress",
"state", event.xkey.state, "state", event.xkey.state,
"keycode", event.xkey.keycode, "keycode", event.xkey.keycode,
"button", buffer); "button", buffer);
case ButtonPress: case ButtonPress:
case ButtonRelease: case ButtonRelease:
return Py_BuildValue("{s:s,s:i,s:i,s:i}", return Py_BuildValue("{s:s,s:i,s:i,s:i}",
"type", event.type==ButtonPress?"buttonpress":"buttonrelease", "type", event.type==ButtonPress?"buttonpress":"buttonrelease",
"button", event.xbutton.button, "button", event.xbutton.button,
"x", event.xbutton.x, "y", event.xbutton.y); "x", event.xbutton.x, "y", event.xbutton.y);
case ClientMessage: case ClientMessage:
@@ -289,7 +289,7 @@ Drawable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
self->width = 0; self->width = 0;
self->height = 0; self->height = 0;
} }
return (PyObject *)self; return (PyObject *)self;
} }
@@ -298,7 +298,7 @@ Drawable_init(drawable_DrawableObject *self, PyObject *args, PyObject *kwds)
{ {
unsigned int w, h; unsigned int w, h;
if (! PyArg_ParseTuple(args, "ii", &w, &h)) if (! PyArg_ParseTuple(args, "ii", &w, &h))
return -1; return -1;
if (!wmgen.attributes.depth) { if (!wmgen.attributes.depth) {
PyErr_SetString(PyExc_RuntimeError, "X client must be initialized first."); PyErr_SetString(PyExc_RuntimeError, "X client must be initialized first.");
return -1; return -1;
@@ -309,7 +309,7 @@ Drawable_init(drawable_DrawableObject *self, PyObject *args, PyObject *kwds)
self->has_drawable = 1; self->has_drawable = 1;
self->width = w; self->width = w;
self->height = h; self->height = h;
self->drawable = XCreatePixmap(display, wmgen.pixmap, self->drawable = XCreatePixmap(display, wmgen.pixmap,
w, h, wmgen.attributes.depth); w, h, wmgen.attributes.depth);
return 0; return 0;
@@ -327,7 +327,7 @@ Drawable_xCopyAreaToWindow(drawable_DrawableObject *self, PyObject *args, PyObje
{ {
unsigned int src_x, src_y, width, height, dst_x, dst_y; unsigned int src_x, src_y, width, height, dst_x, dst_y;
if (! PyArg_ParseTuple(args, "iiiiii", &src_x, &src_y, &width, &height, &dst_x, &dst_y)) if (! PyArg_ParseTuple(args, "iiiiii", &src_x, &src_y, &width, &height, &dst_x, &dst_y))
return NULL; return NULL;
XCopyArea(display, self->drawable, wmgen.pixmap, NormalGC, XCopyArea(display, self->drawable, wmgen.pixmap, NormalGC,
src_x, src_y, width, height, dst_x, dst_y); src_x, src_y, width, height, dst_x, dst_y);
@@ -339,7 +339,7 @@ Drawable_xCopyAreaToWindow(drawable_DrawableObject *self, PyObject *args, PyObje
static PyObject * static PyObject *
Drawable_xClear(drawable_DrawableObject *self, PyObject *args, PyObject *kwds) Drawable_xClear(drawable_DrawableObject *self, PyObject *args, PyObject *kwds)
{ {
XFillRectangle(display, self->drawable, NormalGC, XFillRectangle(display, self->drawable, NormalGC,
0, 0, self->width, self->height); 0, 0, self->width, self->height);
Py_INCREF(Py_None); Py_INCREF(Py_None);
@@ -351,7 +351,7 @@ Drawable_xCopyAreaFromWindow(drawable_DrawableObject *self, PyObject *args, PyOb
{ {
unsigned int src_x, src_y, width, height, dst_x, dst_y; unsigned int src_x, src_y, width, height, dst_x, dst_y;
if (! PyArg_ParseTuple(args, "iiiiii", &src_x, &src_y, &width, &height, &dst_x, &dst_y)) if (! PyArg_ParseTuple(args, "iiiiii", &src_x, &src_y, &width, &height, &dst_x, &dst_y))
return NULL; return NULL;
XCopyArea(display, wmgen.pixmap, self->drawable, NormalGC, XCopyArea(display, wmgen.pixmap, self->drawable, NormalGC,
src_x, src_y, width, height, dst_x, dst_y); src_x, src_y, width, height, dst_x, dst_y);
@@ -468,7 +468,7 @@ static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap), err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap),
&(wmgen->mask), &(wmgen->attributes)); &(wmgen->mask), &(wmgen->attributes));
if (err != XpmSuccess) { if (err != XpmSuccess) {
fprintf(stderr, "Not enough free colorcells. %d\n", err); fprintf(stderr, "Not enough free colorcells. %d\n", err);
exit(1); exit(1);
@@ -515,9 +515,9 @@ static int flush_expose(Window w) {
\*******************************************************************************/ \*******************************************************************************/
void RedrawWindow(void) { void RedrawWindow(void) {
flush_expose(iconwin); flush_expose(iconwin);
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0); 0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
flush_expose(win); flush_expose(win);
XCopyArea(display, wmgen.pixmap, win, NormalGC, XCopyArea(display, wmgen.pixmap, win, NormalGC,
@@ -529,9 +529,9 @@ void RedrawWindow(void) {
\*******************************************************************************/ \*******************************************************************************/
void RedrawWindowXY(int x, int y) { void RedrawWindowXY(int x, int y) {
flush_expose(iconwin); flush_expose(iconwin);
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0); x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
flush_expose(win); flush_expose(win);
XCopyArea(display, wmgen.pixmap, win, NormalGC, XCopyArea(display, wmgen.pixmap, win, NormalGC,
@@ -587,7 +587,7 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
unsigned char bwrite; unsigned char bwrite;
int bcount; int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@@ -596,7 +596,7 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
zero <<=8; zero <<=8;
zero |= xpm[1][k]; zero |= xpm[1][k];
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
@@ -609,7 +609,7 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
curpixel <<=8; curpixel <<=8;
curpixel |= xpm[i][j+k]; curpixel |= xpm[i][j+k];
} }
if ( curpixel != zero ) { if ( curpixel != zero ) {
bwrite += 128; bwrite += 128;
} }
@@ -690,7 +690,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
} }
if (!(display = XOpenDisplay(display_name))) { if (!(display = XOpenDisplay(display_name))) {
fprintf(stderr, "%s: can't open display %s\n", fprintf(stderr, "%s: can't open display %s\n",
wname, XDisplayName(display_name)); wname, XDisplayName(display_name));
exit(1); exit(1);
} }
@@ -715,13 +715,13 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
mysizehints.width = 64; mysizehints.width = 64;
mysizehints.height = 64; mysizehints.height = 64;
win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y, win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, mysizehints.width, mysizehints.height, borderwidth,
fore_pix, back_pix); fore_pix, back_pix);
iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y, iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, mysizehints.width, mysizehints.height, borderwidth,
fore_pix, back_pix); fore_pix, back_pix);
@@ -737,8 +737,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
XSetClassHint(display, win, &classHint); XSetClassHint(display, win, &classHint);
XSelectInput(display, win, XSelectInput(display, win,
ExposureMask | ExposureMask |
ButtonPressMask | ButtonPressMask |
ButtonReleaseMask | /* added ButtonReleaseMask *charkins*/ ButtonReleaseMask | /* added ButtonReleaseMask *charkins*/
KeyPressMask | /* Try this to get keyboard working */ KeyPressMask | /* Try this to get keyboard working */
PointerMotionMask | PointerMotionMask |
@@ -746,9 +746,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
LeaveWindowMask | LeaveWindowMask |
StructureNotifyMask | StructureNotifyMask |
EnterWindowMask ); EnterWindowMask );
XSelectInput(display, iconwin, XSelectInput(display, iconwin,
ExposureMask | ExposureMask |
ButtonPressMask | ButtonPressMask |
ButtonReleaseMask | /* added ButtonReleaseMask *charkins*/ ButtonReleaseMask | /* added ButtonReleaseMask *charkins*/
KeyPressMask | /* Try this to get keyboard working */ KeyPressMask | /* Try this to get keyboard working */
PointerMotionMask | PointerMotionMask |
@@ -756,8 +756,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
LeaveWindowMask | LeaveWindowMask |
StructureNotifyMask | StructureNotifyMask |
EnterWindowMask ); EnterWindowMask );
//ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask | //ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask |
//ExposureMask | //ExposureMask |
//FocusChangeMask | EnterWindowMask | //FocusChangeMask | EnterWindowMask |
//PointerMotionMask | StructureNotifyMask); //PointerMotionMask | StructureNotifyMask);
@@ -769,7 +769,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
XSetWMName(display, win, &name); XSetWMName(display, win, &name);
/* Create GC for drawing */ /* Create GC for drawing */
gcm = GCForeground | GCBackground | GCGraphicsExposures; gcm = GCForeground | GCBackground | GCGraphicsExposures;
gcv.foreground = fore_pix; gcv.foreground = fore_pix;
gcv.background = back_pix; gcv.background = back_pix;
@@ -821,11 +821,11 @@ static struct PyModuleDef pywmgeneral = {
PyMODINIT_FUNC PyMODINIT_FUNC
PyInit_pywmgeneral(void) { PyInit_pywmgeneral(void) {
PyObject* m; PyObject* m;
drawable_DrawableType.tp_new = PyType_GenericNew; drawable_DrawableType.tp_new = PyType_GenericNew;
if (PyType_Ready(&drawable_DrawableType) < 0) if (PyType_Ready(&drawable_DrawableType) < 0)
return NULL; return NULL;
m = PyModule_Create(&pywmgeneral); m = PyModule_Create(&pywmgeneral);
if (m == NULL) if (m == NULL)