From 5f23076c05c58e790eaffa66ed6b676f5f736555 Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine Date: Tue, 5 Jun 2012 14:43:11 +0900 Subject: Rename dpy to disp in function parameter to avoid shadowing dpy global declaration. --- dsimple.c | 48 ++++++++++++++++++++++++------------------------ transSet.c | 12 ++++++------ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/dsimple.c b/dsimple.c index 63d641b..1bfbd11 100644 --- a/dsimple.c +++ b/dsimple.c @@ -157,19 +157,19 @@ Fatal_Error (const char *msg, ...) */ Window -Select_Window (Display *dpy) +Select_Window (Display *disp) { int status; Cursor cursor; XEvent event; - Window target_win = None, root = RootWindow (dpy, screen); + Window target_win = None, root = RootWindow (disp, screen); int buttons = 0; /* Make the target cursor */ - cursor = XCreateFontCursor (dpy, XC_crosshair); + cursor = XCreateFontCursor (disp, XC_crosshair); /* Grab the pointer using target cursor, letting it room all over */ - status = XGrabPointer (dpy, root, False, + status = XGrabPointer (disp, root, False, ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, root, cursor, CurrentTime); if (status != GrabSuccess) @@ -178,8 +178,8 @@ Select_Window (Display *dpy) /* Let the user select a window... */ while ((target_win == None) || (buttons != 0)) { /* allow one more event */ - XAllowEvents (dpy, SyncPointer, CurrentTime); - XWindowEvent (dpy, root, ButtonPressMask | ButtonReleaseMask, &event); + XAllowEvents (disp, SyncPointer, CurrentTime); + XWindowEvent (disp, root, ButtonPressMask | ButtonReleaseMask, &event); switch (event.type) { case ButtonPress: if (target_win == None) { @@ -196,7 +196,7 @@ Select_Window (Display *dpy) } } - XUngrabPointer (dpy, CurrentTime); /* Done with pointer */ + XUngrabPointer (disp, CurrentTime); /* Done with pointer */ return (target_win); } @@ -207,32 +207,32 @@ Select_Window (Display *dpy) */ Window -Get_Window_Under_Cursor (Display *dpy) +Get_Window_Under_Cursor (Display *disp) { int status; Cursor cursor; //XEvent event; - Window target_win = None, root = RootWindow (dpy, screen); + Window target_win = None, root = RootWindow (disp, screen); //int buttons = 0; Window tmp; int rx, ry, cx, cy; unsigned int mask; /* Make the target cursor */ - cursor = XCreateFontCursor (dpy, XC_crosshair); + cursor = XCreateFontCursor (disp, XC_crosshair); /* Grab the pointer using target cursor, letting it room all over */ - status = XGrabPointer (dpy, root, False, + status = XGrabPointer (disp, root, False, ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, root, cursor, CurrentTime); if (status != GrabSuccess) Fatal_Error ("Can't grab the mouse."); /* get the window under the cursor */ - XQueryPointer (dpy, root, &tmp, &target_win, &rx, &ry, + XQueryPointer (disp, root, &tmp, &target_win, &rx, &ry, &cx, &cy, &mask); - XUngrabPointer (dpy, CurrentTime); /* Done with pointer */ + XUngrabPointer (disp, CurrentTime); /* Done with pointer */ return (target_win); } @@ -245,7 +245,7 @@ Get_Window_Under_Cursor (Display *dpy) * are looked at. Normally, top should be the RootWindow. */ Window -Window_With_Name (Display *dpy, Window top, char *name) +Window_With_Name (Display *disp, Window top, char *name) { Window *children, dummy; unsigned int nchildren; @@ -253,14 +253,14 @@ Window_With_Name (Display *dpy, Window top, char *name) Window w = 0; char *window_name; - if (XFetchName (dpy, top, &window_name) && !strcmp (window_name, name)) + if (XFetchName (disp, top, &window_name) && !strcmp (window_name, name)) return (top); - if (!XQueryTree (dpy, top, &dummy, &dummy, &children, &nchildren)) + if (!XQueryTree (disp, top, &dummy, &dummy, &children, &nchildren)) return (0); for (i = 0; i < nchildren; i++) { - w = Window_With_Name (dpy, children[i], name); + w = Window_With_Name (disp, children[i], name); if (w) break; } @@ -277,7 +277,7 @@ Window_With_Name (Display *dpy, Window top, char *name) * Written by Daniel Forchheimer 2005 * */ static Window -Window_With_Name_Regex_Recurse (Display *dpy, Window top, +Window_With_Name_Regex_Recurse (Display *disp, Window top, regex_t *reg_name) { Window *children, dummy; @@ -286,15 +286,15 @@ Window_With_Name_Regex_Recurse (Display *dpy, Window top, Window w = 0; char *window_name; - if (XFetchName (dpy, top, &window_name) && + if (XFetchName (disp, top, &window_name) && !regexec (reg_name, window_name, 0, NULL, 0)) return (top); - if (!XQueryTree (dpy, top, &dummy, &dummy, &children, &nchildren)) + if (!XQueryTree (disp, top, &dummy, &dummy, &children, &nchildren)) return (0); for (i = 0; i < nchildren; i++) { - w = Window_With_Name_Regex_Recurse (dpy, children[i], reg_name); + w = Window_With_Name_Regex_Recurse (disp, children[i], reg_name); if (w) break; } @@ -305,7 +305,7 @@ Window_With_Name_Regex_Recurse (Display *dpy, Window top, /* prepare the reg-exp for use with above function */ Window -Window_With_Name_Regex (Display *dpy, Window top, char *name) +Window_With_Name_Regex (Display *disp, Window top, char *name) { int err_no = 0; regex_t *regexp_name; @@ -322,8 +322,8 @@ Window_With_Name_Regex (Display *dpy, Window top, char *name) regfree (regexp_name); exit (1); } - target_win = Window_With_Name_Regex_Recurse (dpy, - RootWindow (dpy, screen), + target_win = Window_With_Name_Regex_Recurse (disp, + RootWindow (disp, screen), regexp_name); regfree (regexp_name); diff --git a/transSet.c b/transSet.c index 6a99f8b..899c14a 100644 --- a/transSet.c +++ b/transSet.c @@ -84,13 +84,13 @@ Usage (void) /* returns the highest parent of child that is not the root-window */ static Window -Get_Top_Window (Display *dpy, Window child) { +Get_Top_Window (Display *disp, Window child) { Window parent; Window root; Window *child_list; unsigned int num_children; - if (!XQueryTree (dpy, child, &root, &parent, &child_list, + if (!XQueryTree (disp, child, &root, &parent, &child_list, &num_children)) Fatal_Error ("Can't query window tree."); @@ -100,7 +100,7 @@ Get_Top_Window (Display *dpy, Window child) { while (parent != root) { child = parent; - if (!XQueryTree (dpy, child, &root, &parent, &child_list, + if (!XQueryTree (disp, child, &root, &parent, &child_list, &num_children)) Fatal_Error ("Can't query window tree."); XFree ((void *) child_list); @@ -109,13 +109,13 @@ Get_Top_Window (Display *dpy, Window child) { } static Window -Get_Actual_Window (Display *dpy) +Get_Actual_Window (Display *disp) { int i; Window w; - XGetInputFocus (dpy, &w, &i); - return Get_Top_Window (dpy, w); + XGetInputFocus (disp, &w, &i); + return Get_Top_Window (disp, w); } typedef enum { -- cgit v1.2.3