Hi Cristofaro, Thanks for the patch, I'm impressed with you finding the reason of this bug, it does look a little hacky/weird problem, and it's nice that you fixed it. As reggaeman said, it's a WM issue which should be fixed by Beryl, but a workaround in amsn is a good thing for now. I just want to make sure that you'll notify the Beryl team of the bug once the source of the bug is confirmed. I'll wait for Phil to test your patch and see if it really fixes it, then I suppose Phil will probably commit it himself. I'm just wondering about something... Do you know (or did you understand, or does anybody else knows) why the bind on <Enter> does the bind on the <Leave> and why the bind on the <Leave> itself does a bind on the <Leave>.. couldn't it be directly a bind <Leave> "handleLeave" ? Also, it still is weird that the <Leave> is being done before the buttonPress because the buttonPress does the insert before doing the wm state withdrawn... And the code inserts directly the symbol, it doesn't need to check which button was clicked and what symbol it represented, so it doesn't need the window to be still there... Also, isn't there a %X or %Y option for the <Leave> event that you could pass to the function so you don't need to do the [winfo pointerX] ? but I think it's still ok to leave it as it is since you can directly check the coordinates relative to the window.. While looking at this small portion of code in the diff, I also noticed something else... we do a check for whether the smiley is equal to %, in which case we insert %% (because the 'bind' replaced %x with variable values), but did we think of a smiley not being "%" but being "%W" instead for example ? can you test something like that ? and if it doesn't work (you get the window path inserted instead of the "%W" smiley, then maybe it would be wise to remove the if {[string match] } and replace it directly with a bind "insert [string map { % %% } $symbol] ...
p.s.:Cristofaro will probably soon join the team, so we should show him how we work, like everyone of us got his little "introduction to how we do things", on how and when to use the ML, etc... who wants to do this ? and shouldn't we just set up a page explaining all that in the wiki ? would be easier as we don't always have the time... KaKaRoTo On Fri, Dec 15, 2006 at 02:03:48AM +0100, Cristofaro Del Prete wrote: > I've finally found the problem. Seems that, under Beryl, a ButtonPress > event triggers for some reason a Leave event, and then the menu is > withdrawn before it can catch the ButtonRelease event. > > This final patch implements a handleLeaveEvent procedure that checks if > the mouse pointer is outside the menu, and only in that case closes it. > > It's true that, like reggaemanus said, this is not a problem aMSN should > deal with, and that the fix it's a little too... harsh, howewer I hope > you will like the patch. > > Bye > Index: smileys.tcl > =================================================================== > --- smileys.tcl (revisione 7657) > +++ smileys.tcl (copia locale) > @@ -449,7 +449,7 @@ > if { [string match {(%)} $symbol] != 0 } { > bind $w.c.$temp <Button1-ButtonRelease> > "catch {$text insert insert \{(%%)\}; wm state $w withdrawn} res" > } else { > - bind $w.c.$temp <Button1-ButtonRelease> > "catch {[list $text insert insert $symbol]\; wm state $w withdrawn} res" > + bind $w.c.$temp <Button1-ButtonRelease> > "catch {[list $text insert insert $symbol]\; wm state $w withdrawn} res" > } > #Add binding for custom emoticons > if { [OnMac] } { > @@ -714,14 +714,38 @@ > label $w.c.custom_new -text "[trans custom_new]" -background > [$w.c cget -background] -font sboldf > bind $w.c.custom_new <Enter> [list $w.c.custom_new configure > -relief raised] > bind $w.c.custom_new <Leave> [list $w.c.custom_new configure > -relief flat] > - bind $w.c.custom_new <Button1-ButtonRelease> > "::smiley::newCustomEmoticonGUI; event generate $w <Leave>" > + bind $w.c.custom_new <Button1-ButtonRelease> > "::smiley::newCustomEmoticonGUI; wm state $w withdrawn" > > set ypos [expr {(($rows-1)*$smih + ($smih/2))}] > $w.c create window 0 $ypos -window $w.c.custom_new -width > [expr {$x_geo - 2}] -height $smih -anchor w > > > - bind $w <Enter> "bind $w <Leave> \"bind $w <Leave> \\\"wm state > $w withdrawn\\\"\"" > + bind $w <Enter> "bind $w <Leave> \"bind $w <Leave> > \\\"::smiley::handleLeaveEvent $w $x_geo $y_geo\\\"\"" > } > + > + > + > #/////////////////////////////////////////////////////////////////////////////// > + # proc handleLeaveEvent { w x_geo y_geo } > + # > + # Handle the Leave event, detecting if is truly generated from the > mouse exiting > + # from the menu, to work around the Compiz/Beryl bug > + > + proc handleLeaveEvent { w x_geo y_geo } { > + # Get the pointer and the window coordinates > + set pointer_x [winfo pointerx $w] > + set pointer_y [winfo pointery $w] > + set window_x [winfo rootx $w] > + set window_y [winfo rootx $w] > + # Calculate pointer coordinates relative to the menu > + set x [expr {$pointer_x-$window_x}] > + set y [expr {$pointer_y-$window_y}] > + # Check if the pointer is outside the menu > + # The first two conditions refers to the case in which the > pointe is no > + # more on the same screen of the menu (and is therefore outside > of it) > + if { $pointer_x == -1 || $pointer_y==-1 || $x < 0 || $x > > $x_geo || $x < 0 || $x > $x_geo } { > + wm state $w withdrawn > + } > + } > > > > #/////////////////////////////////////////////////////////////////////////////// > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Amsn-devel mailing list > Amsn-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/amsn-devel ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Amsn-devel mailing list Amsn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amsn-devel