[Thread Prev][Thread Next]   >Date Index >Thread Index

Re: [wmx] sec4 tarball.

Lasse Rasinen - Tue Feb 23 15:37:44 1999

Stefan `Sec` Zehl <sec@42.org> writes:

> I did not use the mousbutton code from sven, since I think this should
> be handled a bit differently, which I will try to do myself this week.

How about using function pointers in #defines or possibly a static array,
like this:

function_t mouse_actions[] = {popupClientMenu, popupCommandMenu, 
	                      NULL, ...}

and then in Buttons.C/Border.C/somewhere else:

if (mouse_actions[CONFIG_ROOT_BUTTON1])

instead of any current functionality.

The idea would be to have a function of zero (maybe one, in case we need
some parameters thrown around) arguments to call when the button is
pressed. The if-clause would also let one disable functions by simply
setting them NULL. A smart compiler should see (if helped along with some
consts) that this if-clause is always true and can be optimized away.

Then one can also use #defines, like
#define CONFIG_ROOT_BUTTON1 popupClientMenu

and the code would be 

If C(++) only had lambda ;(

This trick might have a C++-equivalent, but I'm no C++-wizard ;)

> I'm not sure about what to do with quick-key code. Shall we make the
> keys fully (easily) user-configurable, too ? or simply provide two
> defaults (sun and non-sun) and a way for the user to switch ?

I don't know about quickkeys for client and command menus, which are,
after all, themselves shortcuts for mouse stuff ;)

I think that the current keyboard model is quite good, and if you're going
to add quickkeys, I'd wish that it'd be done in such a way that those of
us who are not interested in them, wouldn't even know there are there.