To: lablgtk at kaba.or.jp Subject: Event weirdness in canvas From: Michael Welsh Duggan Date: Fri, 16 May 2003 08:33:32 -0400 Message-ID: <87he7vhy03.fsf at cs.cmu.edu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Sender: Michael Welsh Duggan --=-=-= If you run the attached bit of lablgtk2 code, you get some really weird behavior in regards to events. As one moves their cursor into and out of the square, one gets perfectly normal enter and leave events.If one right-clicks in the square, they get an ordinary button-press 3 event. The weirdness begins when one left clicks in the square. When I do this, I get three events: leave, enter, and then a button-press 1 event. Does anyone know if this weirdness is part of the current libgnomecanvas (v2.2.0.2, from Debian Sid), or part of lablgtk2? --=-=-= Content-Disposition: attachment; filename=test.ml open GnoCanvas let ct = ref 0 let do_stuff window = let swindow = GBin.scrolled_window ~packing:window#add ()in let canvas = canvas ~aa:true ~packing:swindow#add () in let () = canvas#set_scroll_region ~x1:(-75.) ~y1:(-75.) ~x2:75. ~y2:75. in let grp = group canvas#root in let _ = rect ~x1:(-50.) ~y1:(-50.) ~x2:50. ~y2:50. ~fill_color:"red" grp in let tile_event = function `ENTER_NOTIFY _ -> let () = prerr_string "Enter " in let () = prerr_int !ct in let () = prerr_newline () in let () = ct := !ct + 1 in true | `LEAVE_NOTIFY _ -> let () = prerr_string "Leave " in let () = prerr_int !ct in let () = prerr_newline () in let () = ct := !ct + 1 in true | `BUTTON_PRESS b -> (match GdkEvent.Button.button b with 1 -> let () = prerr_string "B1 " in let () = prerr_int !ct in let () = prerr_newline () in let () = ct := !ct + 1 in true | 3 -> let () = prerr_string "B3 " in let () = prerr_int !ct in let () = prerr_newline () in let () = ct := !ct + 1 in true | _ -> false) | _ -> false in ignore (grp#connect#event tile_event) let main () = let window = GWindow.window ~width:300 ~height:300 () in let () = GtkBase.Widget.push_visual (Gdk.Rgb.get_visual ()) in let () = GtkBase.Widget.push_colormap (Gdk.Rgb.get_cmap ()) in let () = do_stuff window in let () = GtkBase.Widget.pop_visual () in let () = GtkBase.Widget.pop_colormap () in let _ = window#connect#destroy ~callback:GMain.Main.quit in let () = window#show () in GMain.Main.main () let _ = main () --=-=-= -- Michael Welsh Duggan (md5i@cs.cmu.edu) --=-=-=--