mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
util.h: new header file defining commonly used macros
This commit is contained in:
parent
fc2e385d87
commit
69c3e74498
14 changed files with 18 additions and 39 deletions
|
|
@ -6,9 +6,7 @@
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "grid.h"
|
#include "grid.h"
|
||||||
|
#include "util.h"
|
||||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cmd_scrollback_up(struct terminal *term, int rows)
|
cmd_scrollback_up(struct terminal *term, int rows)
|
||||||
|
|
|
||||||
4
config.c
4
config.c
|
|
@ -19,11 +19,9 @@
|
||||||
#define LOG_ENABLE_DBG 0
|
#define LOG_ENABLE_DBG 0
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "util.h"
|
||||||
#include "wayland.h"
|
#include "wayland.h"
|
||||||
|
|
||||||
#define ALEN(v) (sizeof(v) / sizeof(v[0]))
|
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
|
||||||
|
|
||||||
static const uint32_t default_foreground = 0xdcdccc;
|
static const uint32_t default_foreground = 0xdcdccc;
|
||||||
static const uint32_t default_background = 0x111111;
|
static const uint32_t default_background = 0x111111;
|
||||||
|
|
||||||
|
|
|
||||||
3
csi.c
3
csi.c
|
|
@ -16,8 +16,7 @@
|
||||||
#include "vt.h"
|
#include "vt.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "sixel.h"
|
#include "sixel.h"
|
||||||
|
#include "util.h"
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
|
||||||
|
|
||||||
#define UNHANDLED() LOG_DBG("unhandled: %s", csi_as_string(term, final, -1))
|
#define UNHANDLED() LOG_DBG("unhandled: %s", csi_as_string(term, final, -1))
|
||||||
#define UNHANDLED_SGR(idx) LOG_DBG("unhandled: %s", csi_as_string(term, 'm', idx))
|
#define UNHANDLED_SGR(idx) LOG_DBG("unhandled: %s", csi_as_string(term, 'm', idx))
|
||||||
|
|
|
||||||
3
grid.c
3
grid.c
|
|
@ -7,8 +7,7 @@
|
||||||
#define LOG_ENABLE_DBG 0
|
#define LOG_ENABLE_DBG 0
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "sixel.h"
|
#include "sixel.h"
|
||||||
|
#include "util.h"
|
||||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grid_swap_row(struct grid *grid, int row_a, int row_b, bool initialize)
|
grid_swap_row(struct grid *grid, int row_a, int row_b, bool initialize)
|
||||||
|
|
|
||||||
3
input.c
3
input.c
|
|
@ -29,10 +29,9 @@
|
||||||
#include "search.h"
|
#include "search.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
|
#include "util.h"
|
||||||
#include "vt.h"
|
#include "vt.h"
|
||||||
|
|
||||||
#define ALEN(v) (sizeof(v) / sizeof(v[0]))
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
execute_binding(struct terminal *term, enum bind_action_normal action,
|
execute_binding(struct terminal *term, enum bind_action_normal action,
|
||||||
uint32_t serial)
|
uint32_t serial)
|
||||||
|
|
|
||||||
3
quirks.c
3
quirks.c
|
|
@ -7,8 +7,7 @@
|
||||||
#define LOG_MODULE "quirks"
|
#define LOG_MODULE "quirks"
|
||||||
#define LOG_ENABLE_DBG 0
|
#define LOG_ENABLE_DBG 0
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "util.h"
|
||||||
#define ALEN(v) (sizeof(v) / sizeof(v[0]))
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
is_weston(void)
|
is_weston(void)
|
||||||
|
|
|
||||||
5
render.c
5
render.c
|
|
@ -21,14 +21,11 @@
|
||||||
#include "quirks.h"
|
#include "quirks.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "shm.h"
|
#include "shm.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#define TIME_FRAME_RENDERING 0
|
#define TIME_FRAME_RENDERING 0
|
||||||
#define TIME_SCROLL_DAMAGE 0
|
#define TIME_SCROLL_DAMAGE 0
|
||||||
|
|
||||||
#define ALEN(v) (sizeof(v) / sizeof((v)[0]))
|
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
|
||||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
|
||||||
|
|
||||||
struct renderer {
|
struct renderer {
|
||||||
struct fdm *fdm;
|
struct fdm *fdm;
|
||||||
struct wayland *wayl;
|
struct wayland *wayl;
|
||||||
|
|
|
||||||
3
search.c
3
search.c
|
|
@ -16,8 +16,7 @@
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "shm.h"
|
#include "shm.h"
|
||||||
|
#include "util.h"
|
||||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
search_ensure_size(struct terminal *term, size_t wanted_size)
|
search_ensure_size(struct terminal *term, size_t wanted_size)
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,9 @@
|
||||||
#include "grid.h"
|
#include "grid.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
#include "util.h"
|
||||||
#include "vt.h"
|
#include "vt.h"
|
||||||
|
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
|
||||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
selection_enabled(const struct terminal *term)
|
selection_enabled(const struct terminal *term)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
6
sixel.c
6
sixel.c
|
|
@ -7,11 +7,7 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "sixel-hls.h"
|
#include "sixel-hls.h"
|
||||||
|
#include "util.h"
|
||||||
#define ALEN(v) (sizeof(v) / sizeof(v[0]))
|
|
||||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
|
||||||
|
|
||||||
|
|
||||||
static size_t count;
|
static size_t count;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,9 @@
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "sixel.h"
|
#include "sixel.h"
|
||||||
#include "slave.h"
|
#include "slave.h"
|
||||||
|
#include "util.h"
|
||||||
#include "vt.h"
|
#include "vt.h"
|
||||||
|
|
||||||
#define ALEN(v) (sizeof(v) / sizeof(v[0]))
|
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
|
||||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
|
||||||
|
|
||||||
#define PTMX_TIMING 0
|
#define PTMX_TIMING 0
|
||||||
|
|
||||||
static const char *const XCURSOR_LEFT_PTR = "left_ptr";
|
static const char *const XCURSOR_LEFT_PTR = "left_ptr";
|
||||||
|
|
|
||||||
5
util.h
Normal file
5
util.h
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define ALEN(v) (sizeof(v) / sizeof((v)[0]))
|
||||||
|
#define min(x, y) ((x) < (y) ? (x) : (y))
|
||||||
|
#define max(x, y) ((x) > (y) ? (x) : (y))
|
||||||
4
vt.c
4
vt.c
|
|
@ -16,9 +16,7 @@
|
||||||
#include "dcs.h"
|
#include "dcs.h"
|
||||||
#include "grid.h"
|
#include "grid.h"
|
||||||
#include "osc.h"
|
#include "osc.h"
|
||||||
|
#include "util.h"
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
|
||||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
|
||||||
|
|
||||||
#define UNHANDLED() LOG_DBG("unhandled: %s", esc_as_string(term, final))
|
#define UNHANDLED() LOG_DBG("unhandled: %s", esc_as_string(term, final))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,7 @@
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
|
#include "util.h"
|
||||||
#define ALEN(v) (sizeof(v) / sizeof(v[0]))
|
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
|
||||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
|
||||||
|
|
||||||
static bool wayl_reload_cursor_theme(
|
static bool wayl_reload_cursor_theme(
|
||||||
struct wayland *wayl, struct terminal *term);
|
struct wayland *wayl, struct terminal *term);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue