From: malc Date: Tue, 12 Feb 2013 07:46:36 +0000 (+0400) Subject: Add activatewin remote command X-Git-Tag: v14~34 X-Git-Url: https://repo.or.cz/w/llpp.git/commitdiff_plain/8969183e166f05644860aff497a4e8b1b59e7c09 Add activatewin remote command --- diff --git a/main.ml b/main.ml index cd8c03f..8a52974 100644 --- a/main.ml +++ b/main.ml @@ -7011,7 +7011,8 @@ let ract cmds = G.postRedisplay "rect"; ) ) - | "quit" :: [] -> raise Quit + | "activatewin" :: [] -> Wsi.activatewin () + | "quit" :: [] -> raise Quit | _ -> adderrfmt "remote command" "error processing remote command: %S\n" cmds; diff --git a/wsi.ml b/wsi.ml index 0972321..65bb3ff 100644 --- a/wsi.ml +++ b/wsi.ml @@ -59,6 +59,7 @@ type state = ; mutable idbase : int ; mutable fullscreen : (int -> unit) ; mutable setwmname : (string -> unit) + ; mutable actwin : (unit -> unit) ; mutable stringatom : int ; mutable t : t ; mutable sock : Unix.file_descr @@ -89,6 +90,7 @@ let state = ; idbase = -1 ; fullscreen = (fun _ -> ()) ; setwmname = (fun _ -> ()) + ; actwin = (fun _ -> ()) ; sock = Unix.stdin ; t = onot ; x = -1 @@ -591,6 +593,10 @@ let reshape w h = else state.fullscreen state.idbase ;; +let activatewin () = + state.actwin (); +;; + let syncsendwithrep sock secstowait s f = let completed = ref false in sendwithrep sock s (fun resp -> f resp; completed := true); @@ -751,6 +757,24 @@ let setup sock screennum w h = ) ); + state.actwin <- (fun () -> + let s = "\000uuu" in + let s = configurewindowreq state.idbase 0x40 s in + sendstr s state.sock; + let s = mapreq state.idbase in + sendstr s state.sock; + ); + + sendintern sock "_NET_ACTIVE_WINDOW" true (fun resp -> + let atom = r32 resp 8 in + state.actwin <- (fun () -> + let data = String.make 20 '\000' in + let cm = clientmessage 32 0 wid atom data in + let s = sendeventreq 0 root 0x180000 cm in + sendstr s state.sock; + ); + ); + syncsendintern sock 2.0 "WM_CLASS" false (fun resp -> let atom = r32 resp 8 in let llpp = "llpp\000llpp\000" in diff --git a/wsi.mli b/wsi.mli index de6454e..9d31e50 100644 --- a/wsi.mli +++ b/wsi.mli @@ -26,6 +26,7 @@ val readresp : Unix.file_descr -> unit;; val init : t -> int -> int -> bool -> Unix.file_descr * int * int;; val fullscreen : unit -> unit;; val reshape : int -> int -> unit;; +val activatewin : unit -> unit;; val withalt : int -> bool;; val withctrl : int -> bool;; val withshift : int -> bool;;