Thanks Ineiev and Steven for looking at it, attached is a modified patch to address your comments, with replies inlined below. Additional comments are of course always welcome On Mon, Jun 1, 2009 at 11:20 PM, Ineiev <ineiev@xxxxxxxxx> wrote: > Nice work. I tried it a little and found only one small shortcoming: > when ctrl-rightclicked, PCB switches to panning (the board moves > with the cursor); when right-clicked (without ctrl) again, it exits > panning. I think you'll be able to fix this easily. > Good catch, it was just a bug in the default gpcb-menu.res, there was no ctrl-right click resource defined so it would start a pan, but there was a ctrl-right release defined, so it do that instead of un-pan. I just made it do the ctrl-right click action (change the cross hairs) on the down click, not sure why it was on the release before. On Tue, Jun 2, 2009 at 3:16 PM, Steven Michalske <smichalske@xxxxxxxxx> wrote: > need to look at gtk code for mod1, and OSX..... > see patch 1 from http://archives.seul.org/geda/user/May-2009/msg00457.html > option (alt) returns 1<<13, not GDK_MOD1_MASK > > Might want to define a list of modifier masks, and allow for > translation in the HIDs > You have it now no translation needed, except that under GTK and OSX, > the option(alt) key needs translation. > I think fixes for the OSX stuff is an orthogonal patch, but I made the modifier code in the mouse handling stuff more general. hid_resource.h #define's M_Shift, M_Ctrl, and M_Mod(n), which the gui hid's use to set the masks passed to the mouse stuff. So the hid's can use any number of modifier keys up to the number of bits in a uint minus three. I left M_Alt as an alias for M_Mod(1) and M_Multi as an alias for M_Mod(2) from the lesstif hid. I was using (less general) #define's before, but wasn't explicit in their use in the gtk hid, I made it more explicit in gtk/gui.h. You can now also use "mod#" in the resource file. > Could use strstr and tolower for parse modifiers to be more robust. > done. > I have a 10 button mouse....... > +#define MAX_MOUSE_BUTTON 5 > But laptop trackpads are normally 7, to include left and right scroll. > I made everything dynamically allocated so you can have as many buttons as you want. The method I ended up using adds a bit of overhead at runtime handling each click to find the right actions to take, but it seemed negligible. The basic approach was to use an array of button numbers, an array of modifier masks, and an array of Resource*'s, all dynamically allocated, and find the index into the button numbers and mod masks that match what happened, then perform the actions in the corresponding Resource*. It ended up slightly more complicated to try and reduce the runtime overhead, but not much more. Jared
Attachment:
0001-Teaching-GTK-hid-to-use-mouse-resources.patch
Description: Binary data
_______________________________________________ geda-user mailing list geda-user@xxxxxxxxxxxxxx http://www.seul.org/cgi-bin/mailman/listinfo/geda-user