static void onmousebtn(int btn, bool pressed, int x, int y);
static void onwheelup(WinRegion id, bool pressed, size_t row, size_t col);
static void onwheeldn(WinRegion id, bool pressed, size_t row, size_t col);
-static void oncommand(char* cmd);
static void draw_glyphs(size_t x, size_t y, UGlyph* glyphs, size_t rlen, size_t ncols);
static WinRegion getregion(size_t x, size_t y);
int ncached;
};
-static bool Running = true;
static struct {
Window root;
Display* display;
static KeyBinding* Keys = NULL;
static void (*InputFunc)(Rune);
-void x11_deinit(void) {
- Running = false;
-}
-
void x11_init(XConfig* cfg) {
signal(SIGPIPE, SIG_IGN); // Ignore the SIGPIPE signal
setlocale(LC_CTYPE, "");
view_scroll(win_view(id), +ScrollBy);
}
-static void oncommand(char* cmd) {
- size_t line = strtoul(cmd, NULL, 0);
- if (line) {
- View* view = win_view(EDIT);
- win_setregion(EDIT);
- view_setln(view, line);
- view_eol(view, false);
- view_selctx(view);
- }
-}
-
static void draw_glyphs(size_t x, size_t y, UGlyph* glyphs, size_t rlen, size_t ncols) {
XGlyphSpec specs[rlen];
size_t i = 0;
static uint64_t before = 0;
uint64_t now = getmillis();
if (!win_buf(EDIT)->modified || (now-before) <= (uint64_t)ClickTime) {
- #ifndef TEST
- x11_deinit();
- #else
exit(0);
- #endif
} else {
ondiagmsg("File is modified. Repeat action twice quickly to quit.");
}