From e9cfd1892d813d7e8115c045ca0cd1f10d7beb33 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 12 Sep 2017 16:25:47 -0400 Subject: [PATCH] prototyped drawing a cursor --- edit.ml | 9 ++++++--- lib/x11.ml | 14 ++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/edit.ml b/edit.ml index 203c280..6b19d41 100644 --- a/edit.ml +++ b/edit.ml @@ -1,6 +1,7 @@ open X11 -let font = font_load "Times New Roman:size=12" +(*let font = font_load "Times New Roman:pixelsize=14"*) +let font = font_load "Liberation Mono:pixelsize=14" let onfocus focused = print_endline "onfocus" @@ -16,8 +17,10 @@ let onmousemove mods x y = let onupdate width height = Printf.printf "onupdate: %d %d\n" width height; - draw_rect { x = 0; y = 0; w = width; h = height; c = Cfg.Color.palette.(0) }; - draw_string font Cfg.Color.palette.(5) "FooBarBaz" (0,0); + draw_rect { x = 2; y = 2; w = width; h = height; c = Cfg.Color.palette.(0) }; + draw_string font Cfg.Color.palette.(5) "FooBarBaz\tYay\r\n" (2,2); + draw_string font Cfg.Color.palette.(5) "FooBarBaz\tYay\r\n" (2,2+font.height); + draw_rect { x = 2; y = 2; w = 1; h = font.height; c = Cfg.Color.palette.(3) }; flip () let onshutdown () = diff --git a/lib/x11.ml b/lib/x11.ml index 6b43603..ebbabe2 100644 --- a/lib/x11.ml +++ b/lib/x11.ml @@ -34,14 +34,12 @@ type xcfgvar = | String of string | NotSet -type font = - | NoFont - | Font of { - font: xfont; - patt: xfontpatt; - height: int; - next: font; - } +type font = { + font: xfont; + patt: xfontpatt; + height: int; + next: font; +} type glyph = { font: xfont; -- 2.52.0