- root_selection <- root_selection';
- match root_selection' with
- None -> ()
- | Some e -> self#select e
- end
-;;
+ root_selected <- elem;
+ begin
+ match elem with
+ None -> ()
+ | Some e -> self#select e
+ end ;
+ self#thaw
+
+ initializer
+ ignore
+ (self#connect#select_begin
+ (fun _ state ->
+ if not (List.mem `CONTROL (Gdk.Convert.modifier state)) then
+ self#remove_selections)) ;
+
+ ignore
+ (self#connect#select_over
+ (fun _ state ->
+ Printf.printf "stable selections: %d\n" (List.length selected) ;
+ Printf.printf "select_over with state: " ;
+ let c =
+ function
+ `SHIFT -> "shift "
+ | `LOCK -> "lock "
+ | `CONTROL -> "control "
+ | `MOD1 -> "mod1 "
+ | _ -> ""
+ in
+ List.iter (fun x -> print_string (c x)) (Gdk.Convert.modifier state) ;
+ print_char '\n' ;
+ flush stdout)) ;
+
+ ignore
+ (self#connect#select_end
+ (fun _ state ->
+ Printf.printf "select_end\n" ; flush stdout ;
+ if not (List.mem `CONTROL (Gdk.Convert.modifier state)) then
+ self#remove_selections ;
+ match root_selected with
+ None -> ()
+ | Some e -> self#set_selection None ; self#add_selection e)) ;
+
+ ignore
+ (self#connect#click
+ (fun _ _ -> self#remove_selections))
+ end
+ ;;