@@ -114,8 +114,9 @@ static void hide_cursor() {
114114
115115static void show_highlight () {
116116 int x , y ;
117+ int total_radius = options .radius + options .outline ;
117118 get_pointer_position (& x , & y );
118- XMoveWindow (dpy , win , x - options . radius - 1 , y - options . radius - 1 );
119+ XMoveWindow (dpy , win , x - total_radius - 1 , y - total_radius - 1 );
119120 XMapWindow (dpy , win );
120121 redraw ();
121122 highlight_visible = 1 ;
@@ -153,17 +154,18 @@ static int get_pointer_position(int* x, int* y) {
153154
154155static void set_window_mask () {
155156 XGCValues gc_values ;
156- Pixmap mask = XCreatePixmap (dpy , win , 2 * options .radius + 2 , 2 * options .radius + 2 , 1 );
157+ int total_radius = options .radius + options .outline ;
158+ Pixmap mask = XCreatePixmap (dpy , win , 2 * total_radius + 2 , 2 * total_radius + 2 , 1 );
157159 GC mask_gc = XCreateGC (dpy , mask , 0 , & gc_values );
158160 XSetForeground (dpy , mask_gc , 0 );
159- XFillRectangle (dpy , mask , mask_gc , 0 , 0 , 2 * options . radius + 2 , 2 * options . radius + 2 );
161+ XFillRectangle (dpy , mask , mask_gc , options . outline , options . outline , 2 * total_radius + 2 , 2 * total_radius + 2 );
160162
161163 XSetForeground (dpy , mask_gc , 1 );
162164 if (options .outline ) {
163165 XSetLineAttributes (dpy , mask_gc , options .outline , LineSolid , CapButt , JoinBevel );
164- XDrawArc (dpy , mask , mask_gc , 0 , 0 , 2 * options .radius + 1 , 2 * options .radius + 1 , 0 , 360 * 64 );
166+ XDrawArc (dpy , mask , mask_gc , options . outline , options . outline , 2 * options .radius + 1 , 2 * options .radius + 1 , 0 , 360 * 64 );
165167 } else {
166- XFillArc (dpy , mask , mask_gc , 0 , 0 , 2 * options .radius + 1 , 2 * options .radius + 1 , 0 , 360 * 64 );
168+ XFillArc (dpy , mask , mask_gc , options . outline , options . outline , 2 * options .radius + 1 , 2 * options .radius + 1 , 0 , 360 * 64 );
167169 }
168170
169171 XShapeCombineMask (dpy , win , ShapeBounding , 0 , 0 , mask , ShapeSet );
@@ -173,11 +175,12 @@ static void set_window_mask() {
173175}
174176
175177static int init_window () {
178+ int total_radius = options .radius + options .outline ;
176179 XSetWindowAttributes win_attributes ;
177180 win_attributes .event_mask = ExposureMask | VisibilityChangeMask ;
178181 win_attributes .override_redirect = True ;
179182
180- win = XCreateWindow (dpy , root , 0 , 0 , 2 * options . radius + 2 , 2 * options . radius + 2 , 0 , DefaultDepth (dpy , screen ), InputOutput , DefaultVisual (dpy , screen ),
183+ win = XCreateWindow (dpy , root , options . outline , options . outline , 2 * total_radius + 2 , 2 * total_radius + 2 , 0 , DefaultDepth (dpy , screen ), InputOutput , DefaultVisual (dpy , screen ),
181184 CWEventMask | CWOverrideRedirect , & win_attributes );
182185 if (!win ) {
183186 fprintf (stderr , "Can't create highlight window\n" );
@@ -243,9 +246,9 @@ static void redraw() {
243246 XSetForeground (dpy , gc , button_pressed ? pressed_color .pixel : released_color .pixel );
244247 if (options .outline ) {
245248 XSetLineAttributes (dpy , gc , options .outline , LineSolid , CapButt , JoinBevel );
246- XDrawArc (dpy , win , gc , 0 , 0 , 2 * options .radius + 1 , 2 * options .radius + 1 , 0 , 360 * 64 );
249+ XDrawArc (dpy , win , gc , options . outline , options . outline , 2 * options .radius + 1 , 2 * options .radius + 1 , 0 , 360 * 64 );
247250 } else {
248- XFillArc (dpy , win , gc , 0 , 0 , 2 * options .radius + 1 , 2 * options .radius + 1 , 0 , 360 * 64 );
251+ XFillArc (dpy , win , gc , options . outline , options . outline , 2 * options .radius + 1 , 2 * options .radius + 1 , 0 , 360 * 64 );
249252 }
250253}
251254
@@ -298,6 +301,7 @@ static void main_loop() {
298301 int fd = ConnectionNumber (dpy );
299302 struct timeval timeout ;
300303 int x , y , n ;
304+ int total_radius = options .radius + options .outline ;
301305 XGenericEventCookie * cookie ;
302306#if TARGET_FPS > 0
303307 Time lasttime = 0 ;
@@ -348,7 +352,7 @@ static void main_loop() {
348352 show_highlight ();
349353 } else if (highlight_visible ) {
350354 get_pointer_position (& x , & y );
351- XMoveWindow (dpy , win , x - options . radius - 1 , y - options . radius - 1 );
355+ XMoveWindow (dpy , win , x - total_radius - 1 , y - total_radius - 1 );
352356 /* unfortunately, this causes increase of the X server's cpu usage */
353357 }
354358 continue ;
0 commit comments