-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplay.ml
More file actions
26 lines (22 loc) · 815 Bytes
/
Copy pathdisplay.ml
File metadata and controls
26 lines (22 loc) · 815 Bytes
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
open Glut
let panel_height = 20
let inited = ref false
let system_with_out str =
let o = BatUnix.open_process_in ~autoclose:true ~cleanup:true str in
BatString.strip (BatIO.read_all o)
let screen_width, screen_height =
let w,h =
BatString.split
(system_with_out "xrandr \\
| sed -n 's/^.*current \\([^ ]\\+\\) x \\([^ ]\\+\\), .*$/\\1 \\2/p'") " "
in
(* Printf.printf "'%s' '%s'" w h; *)
(* flush stdout; *)
int_of_string w, int_of_string h - panel_height
let display_size () =
if not !inited then
(ignore( Glut.glutInit Sys.argv );
Glut.glutInitDisplayMode [Glut.GLUT_RGBA; Glut.GLUT_DEPTH; Glut.GLUT_DOUBLE];
ignore (Glut.glutCreateWindow ~title:"OpenGL Demo");
inited := true);
glutGet GLUT_WINDOW_WIDTH, glutGet GLUT_WINDOW_HEIGHT