Skip to content

Commit c57ec15

Browse files
committed
Fix re-showing when toggling "auto"
1 parent 5d2daa2 commit c57ec15

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

highlight-pointer.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ static int init_window() {
181181
win_attributes.event_mask = ExposureMask | VisibilityChangeMask;
182182
win_attributes.override_redirect = True;
183183

184-
win = XCreateWindow(dpy, root, options.outline, options.outline, 2 * total_radius + 2, 2 * total_radius + 2, 0, DefaultDepth(dpy, screen), InputOutput, DefaultVisual(dpy, screen),
185-
CWEventMask | CWOverrideRedirect, &win_attributes);
184+
win = XCreateWindow(dpy, root, options.outline, options.outline, 2 * total_radius + 2, 2 * total_radius + 2, 0, DefaultDepth(dpy, screen), InputOutput,
185+
DefaultVisual(dpy, screen), CWEventMask | CWOverrideRedirect, &win_attributes);
186186
if (!win) {
187187
fprintf(stderr, "Can't create highlight window\n");
188188
return 1;
@@ -292,10 +292,16 @@ static void handle_key(KeySym keysym, unsigned int modifiers) {
292292
break;
293293

294294
case KEY_TOGGLE_AUTOHIDE_CURSOR:
295+
if (options.auto_hide_cursor && !cursor_visible) {
296+
show_cursor();
297+
}
295298
options.auto_hide_cursor = 1 - options.auto_hide_cursor;
296299
break;
297300

298301
case KEY_TOGGLE_AUTOHIDE_HIGHLIGHT:
302+
if (options.auto_hide_highlight) {
303+
show_highlight();
304+
}
299305
options.auto_hide_highlight = 1 - options.auto_hide_highlight;
300306
break;
301307
}
@@ -631,7 +637,7 @@ static int xerror_handler(Display* dpy_p, XErrorEvent* err) {
631637
}
632638
char buf[1024];
633639
XGetErrorText(dpy_p, err->error_code, buf, 1024);
634-
fprintf(stderr, "X error: %s\n", buf);
640+
fprintf(stderr, "X error: %s (in %d-%d)\n", buf, err->request_code, err->minor_code);
635641
exit(1);
636642
}
637643

0 commit comments

Comments
 (0)