commit 6e995c6f6fec9a78b75e608d73d4d34b3cf05d0b
parent 1f784f62d7af526604865c450d34e5733734cb80
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;