diff options
Diffstat (limited to 'slock/slock.c')
| -rw-r--r-- | slock/slock.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/slock/slock.c b/slock/slock.c index 86be711..f7af3c8 100644 --- a/slock/slock.c +++ b/slock/slock.c @@ -349,8 +349,9 @@ refresh(Display *dpy, Window win , int screen, struct tm time, cairo_t* cr, cair text_width = extents.width; text_height = extents.height; - xpos = DisplayWidth(dpy, screen) / 4 - text_width / 2; - ypos = (DisplayHeight(dpy, screen) + 12 * text_height) / 2; + /* Center text horizontally and vertically based on text center point */ + xpos = (DisplayWidth(dpy, screen) / 2) - (text_width / 2) - extents.x_bearing; + ypos = (DisplayHeight(dpy, screen) / 2) - (text_height / 2) - extents.y_bearing; cairo_move_to(cr, xpos, ypos); cairo_show_text(cr, tm); cairo_surface_flush(sfc); |
