commit 0f5317da84e4b76bac37baad53b9965f58746722
parent e290797c0b1a96ef833bbbfd728dd077183a3737
Author: Natasha Kerensikova <natacha@instinctive.eu>
Date: Fri, 19 May 2023 08:40:13 +0200
[nat] Shortcut to insert size-related debug text
Diffstat:
M | x.c | | | 18 | ++++++++++++++++++ |
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/x.c b/x.c
@@ -53,6 +53,7 @@ typedef struct {
/* function definitions used in config.h */
static void clipcopy(const Arg *);
static void clippaste(const Arg *);
+static void insert_debug(const Arg *);
static void numlock(const Arg *);
static void selpaste(const Arg *);
static void zoom(const Arg *);
@@ -290,6 +291,23 @@ selpaste(const Arg *dummy)
}
void
+insert_debug(const Arg *dummy)
+{
+ char buffer[160];
+ int n;
+
+ n = snprintf(buffer, sizeof buffer,
+ "Cell %dx%d from ascent %d, descent %d, height %d, width %d,"
+ " fontsize %lf, defaultfontsize %lf\n",
+ win.cw, win.ch,
+ dc.font.ascent, dc.font.descent, dc.font.match->height,
+ dc.font.width, usedfontsize, defaultfontsize);
+
+ if (n > 0)
+ ttywrite(buffer, n, 1);
+}
+
+void
numlock(const Arg *dummy)
{
win.mode ^= MODE_NUMLOCK;