window#set_geometry_hints ~min_size:(80,80) (da :> GObj.widget);
+ (* Force a repaint of the drawing area. *)
+ let drawing_area_repaint () =
+ debug "drawing_area_repaint\n%!";
+ GtkBase.Widget.queue_draw da#as_widget
+ in
+
(* Pango contexts used to draw large and small text. *)
let pango_large_context = da#misc#create_pango_context in
pango_large_context#set_font_description (Pango.Font.from_string "Sans 12");
(* Update the window title. *)
window#set_title (pkgstr ^ " - " ^ base_title);
- (* Force a repaint of the drawing area. *)
- GtkBase.Widget.queue_draw da#as_widget;
+ drawing_area_repaint ()
)
in
let tooltips = ref None in
+ (* If we are moused-over a particular package, then this is != None. *)
+ let current = ref None in
+ let set_current new_current =
+ let old_current = !current in
+ current := new_current;
+ (* Because this structure contains loops, we can't use
+ * structural comparisons like: = <> compare.
+ *)
+ let do_repaint =
+ match old_current, new_current with
+ | None, Some _ -> true
+ | Some _, None -> true
+ | Some { pkg = { nevra = n1 } }, Some { pkg = { nevra = n2 } } ->
+ n1 <> n2
+ | _ -> false in
+ if do_repaint then drawing_area_repaint ()
+ in
+
(* To track tooltips, the 'repaint' function records the location of
* each box (ie. package) in the drawing area in this private data
* structure, and the 'motion' function looks them up in order to
(match get_locn x y with
| None ->
+ set_current None;
kill_tooltip ()
| Some (colour, pkg, total, increm) ->
+ (* Update 'current' which points to the currently moused package. *)
+ set_current (Some (StringMap.find pkg.nevra depsmap));
+
(* The only way to make the tooltip follow the mouse is to
* kill the whole tooltips object and recreate it each time ...
*)