Re: [AD] swap mouse button 1 & 2 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Thursday 21 November 2002 02:04, Matthew Leverton wrote:
> The attached patch swaps the mouse buttons under Windows if the user has
> selected the "left hand" profile in the Control Panel. I'm not much of an
> optimizer, so there's probably a better way of doing it...
Applied. Every good compiler should have an optimization pass that converts
if-then-else statements into equivalent arithmetic expressions when possible,
in order to avoid branchements. For example, for the following function
int ret(int par)
{
return (par ? 2 : 1);
}
gcc 3.2 outputs the following assembly code at -O2:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
popl %ebp
testl %eax, %eax
setne %al
andl $255, %eax
incl %eax
ret
No branchement.
> I use the mouse on the left-hand position, and find it much more convenient
> to have it set up this way (ie, swap the primary button), although I
> suppose there's room for discussion here.
If the user has decided to swap the mouse buttons, we have to honor that.
--
Eric Botcazou