Skip to content

Commit

Permalink
Check if 'zone' is non-null before using it
Browse files Browse the repository at this point in the history
This seems to fix the following X11 error

Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  129 (SHAPE)
  Minor opcode of failed request:  1 (X_ShapeRectangles)
  Resource id in failed request:  0x0
  • Loading branch information
mgsloan committed Jun 14, 2018
1 parent a5785ba commit 982994f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions keynav.c
Original file line number Diff line number Diff line change
Expand Up @@ -2097,12 +2097,14 @@ int main(int argc, char **argv) {
break;

case MotionNotify:
if (zone) {
if (mouseinfo.x != -1 && mouseinfo.y != -1) {
closepixel(dpy, zone, &mouseinfo);
}
mouseinfo.x = e.xmotion.x;
mouseinfo.y = e.xmotion.y;
openpixel(dpy, zone, &mouseinfo);
}
break;

// Ignorable events.
Expand Down

0 comments on commit 982994f

Please sign in to comment.