From: Michael D. Lowis Date: Sun, 5 Apr 2020 18:57:39 +0000 (-0400) Subject: moved get_mouse to mouse.c X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=5edd852e772b2a7a34b4dd0cd022619079532625;p=proto%2Fanvil.git moved get_mouse to mouse.c --- diff --git a/anvil.h b/anvil.h index 4cf1199..c675f42 100644 --- a/anvil.h +++ b/anvil.h @@ -176,6 +176,7 @@ void mouse_up(XButtonEvent* ev, Location* loc); void mouse_drag(XMotionEvent* ev, Location* loc); void mouse_tocorner(Client* c); void mouse_totitle(Client* c); +void mouse_get(int* ptrx, int* ptry); /* tile.c */ void monocled_add(Monitor* mon, Column* col, Client* c); @@ -199,4 +200,3 @@ void* ecalloc(size_t n, size_t sz); void xfree(void* p); Atom atom(char* str); void sendmsg(Window win, Atom proto, Atom type); -void get_mouse(int* ptrx, int* ptry); diff --git a/mons.c b/mons.c index acb1132..05e8afc 100644 --- a/mons.c +++ b/mons.c @@ -206,7 +206,7 @@ void mons_towspace(Client* c, int wsid) Location loc = {0}; if (mons_find(c->win, &loc)) { - get_mouse(&PtrX, &PtrY); + mouse_get(&PtrX, &PtrY); Workspace* wspace = pickws(loc.monitor, wsid); if (wspace != loc.workspace) { @@ -369,7 +369,7 @@ void mons_activate(Window win) static Monitor* pickmon(void) { - get_mouse(&PtrX, &PtrY); + mouse_get(&PtrX, &PtrY); Monitor* mon; LIST_FOR_EACH_UNTIL(mon, Monitors, (mon->x <= PtrX && PtrX < mon->x+mon->w) && diff --git a/mouse.c b/mouse.c index e666709..1423b9c 100644 --- a/mouse.c +++ b/mouse.c @@ -180,4 +180,10 @@ void mouse_totitle(Client* c) XWarpPointer(X.disp, None, X.root, 0, 0, 0, 0, (c->x + c->w/2), c->y + (MIN_HEIGHT/2)); } +void mouse_get(int* ptrx, int* ptry) +{ + Window root = 0, child = 0; + int winx = 0, winy = 0, mask = 0; + XQueryPointer(X.disp, X.root, &root, &child, ptrx, ptry, &winx, &winy, (unsigned int*)&mask); +} diff --git a/util.c b/util.c index 8b0b77c..7bf4227 100644 --- a/util.c +++ b/util.c @@ -50,10 +50,3 @@ void sendmsg(Window win, Atom proto, Atom type) XSendEvent(X.disp, win, False, 0, &ev); XSync(X.disp, False); } - -void get_mouse(int* ptrx, int* ptry) -{ - Window root = 0, child = 0; - int winx = 0, winy = 0, mask = 0; - XQueryPointer(X.disp, X.root, &root, &child, ptrx, ptry, &winx, &winy, (unsigned int*)&mask); -}