nandi/cosmicnimpublic Fork 0
v0.1.1
Commits
Clone
git clone https://git.rickub.com/nandi/cosmicnim.git
git clone ssh://git@rickub.com/nandi/cosmicnim.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

cosmic_ffi.h · 25 lines · 716 BC Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* C ABI over libcosmic. See src/lib.rs for the contract. */
#ifndef COSMIC_FFI_H
#define COSMIC_FFI_H

#include <stddef.h>
#include <stdint.h>

/* Fills `out` (a buffer of `out_len` bytes) with the NUL-terminated text to
   display after button `button_id` was pressed. 0 = left, 1 = right. */
typedef void (*cosmic_on_press)(void *ctx, int32_t button_id, char *out,
                                size_t out_len);

typedef struct {
  const char *title;
  const char *initial_text;
  const char *left_label;
  const char *right_label;
  cosmic_on_press on_press;
  void *ctx;
} CosmicConfig;

/* Opens the window and blocks until it closes. 0 on success. */
int32_t cosmic_run(const CosmicConfig *config);

#endif