Skip to content

Commit 88aba24

Browse files
committed
Remove {open,close}pixel(), var mouseinfo, type mouseinfo_t
Input shape is now set to 0x0, which takes care of the functionality that {open,close}pixel() previously provided. As such, completely remove {open,close}pixel() since they're no longer needed. In addition, remove the mouseinfo var and the mouseinfo_t type since those were used only by {open,close}pixel().
1 parent 024fc8f commit 88aba24

File tree

1 file changed

+1
-63
lines changed

1 file changed

+1
-63
lines changed

keynav.c

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@ typedef struct wininfo {
8080
int curviewport;
8181
} wininfo_t;
8282

83-
typedef struct mouseinfo {
84-
int x;
85-
int y;
86-
} mouseinfo_t;
87-
8883
typedef struct viewport {
8984
int x;
9085
int y;
@@ -96,7 +91,6 @@ typedef struct viewport {
9691
} viewport_t;
9792

9893
static wininfo_t wininfo;
99-
static mouseinfo_t mouseinfo;
10094
static viewport_t *viewports;
10195
static int nviewports = 0;
10296
static int xinerama = 0;
@@ -191,8 +185,6 @@ void sighup(int sig);
191185
void restart();
192186
void recordings_save(const char *filename);
193187
void parse_recordings(const char *filename);
194-
void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
195-
void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
196188

197189
typedef struct dispatch {
198190
char *command;
@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
11781170
x = wininfo.x + wininfo.w / 2;
11791171
y = wininfo.y + wininfo.h / 2;
11801172

1181-
if (mouseinfo.x != -1 && mouseinfo.y != -1) {
1182-
closepixel(dpy, zone, &mouseinfo);
1183-
}
1184-
1185-
/* Open pixels hould be relative to the window coordinates,
1186-
* not screen coordinates. */
1187-
mouseinfo.x = x - wininfo.x;
1188-
mouseinfo.y = y - wininfo.y;
1189-
openpixel(dpy, zone, &mouseinfo);
1190-
11911173
xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
1192-
xdo_wait_for_mouse_move_to(xdo, x, y);
1193-
1194-
/* TODO(sissel): do we need to open again? */
1195-
openpixel(dpy, zone, &mouseinfo);
11961174
}
11971175

11981176
void cmd_click(char *args) {
@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
19811959
fclose(fp);
19821960
}
19831961

1984-
void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
1985-
XRectangle rect;
1986-
if (mouseinfo->x == -1 && mouseinfo->y == -1) {
1987-
return;
1988-
}
1989-
1990-
rect.x = mouseinfo->x;
1991-
rect.y = mouseinfo->y;
1992-
rect.width = 1;
1993-
rect.height = 1;
1994-
1995-
XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
1996-
ShapeSubtract, 0);
1997-
} /* void openpixel */
1998-
1999-
void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
2000-
XRectangle rect;
2001-
if (mouseinfo->x == -1 && mouseinfo->y == -1) {
2002-
return;
2003-
}
2004-
2005-
rect.x = mouseinfo->x;
2006-
rect.y = mouseinfo->y;
2007-
rect.width = 1;
2008-
rect.height = 1;
2009-
2010-
XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
2011-
ShapeUnion, 0);
2012-
} /* void closepixel */
2013-
20141962
int main(int argc, char **argv) {
20151963
char *pcDisplay;
20161964
int ret;
@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
20992047
}
21002048
break;
21012049

2102-
case MotionNotify:
2103-
if (zone) {
2104-
if (mouseinfo.x != -1 && mouseinfo.y != -1) {
2105-
closepixel(dpy, zone, &mouseinfo);
2106-
}
2107-
mouseinfo.x = e.xmotion.x;
2108-
mouseinfo.y = e.xmotion.y;
2109-
openpixel(dpy, zone, &mouseinfo);
2110-
}
2111-
break;
2112-
21132050
// Ignorable events.
21142051
case GraphicsExpose:
21152052
case NoExpose:
@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
21182055
case DestroyNotify: // window was destroyed
21192056
case UnmapNotify: // window was unmapped (hidden)
21202057
case MappingNotify: // when keyboard mapping changes
2058+
case MotionNotify: // when mouse movement is detected
21212059
break;
21222060
default:
21232061
if (e.type == xrandr_event_base + RRScreenChangeNotify) {

0 commit comments

Comments
 (0)