let handle_window (win : GWindow.window) name =
  win#show ();
  let (x,y) = Gdk.Window.get_position win#misc#window in
  let (w,h) = Gdk.Drawable.get_size win#misc#window in

  ignore (win#event#connect#configure
            (fun _ ->
              let (x,y) = Gdk.Window.get_position win#misc#window in
              let (w,h) = Gdk.Drawable.get_size win#misc#window in
              set_window_info name (w,h,x,y);
              save_gui ();
              false
            )
         );
  let (width,height,x,y) =
    try get_window_info name
    with Not_found -> (w,h,x,y)
  in
  let (offset_x, offset_y) =
    match !move_offset with
      None ->
        let (x,y) = Cam_misc.get_wm_window_position_offset () in
        move_offset := Some (x,y);
        (x,y)
    | Some (x,y) -> (x,y)
  in
  win#move ~x: (x-offset_x) ~y: (y-offset_y);
  win#resize ~width ~height