9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] cooked mouse mode.
@ 2005-01-13 16:30 Gorka Guardiola
  2005-01-13 20:59 ` rog
  0 siblings, 1 reply; 27+ messages in thread
From: Gorka Guardiola @ 2005-01-13 16:30 UTC (permalink / raw)
  To: 9fans

We have written and submitted a cooked-mouse mode patch. 
It means that while using mouse(2), setmousemode
can be called in order to stop getting raw mouse events and start getting them
cooked so the state machine for proccessing single clicks, double clicks, slides, 
chords and so on (which is difficult to get right) isn't rewritten
for every application and has a clear boundary. The state machine is implemented 
as an interpreter for a minilanguage with the program hardcoded in it, but all
that is isolated from the user of the library. A typical use for this would be:

1) call setmousemode

setmousemode(mousectl, MCOOKED);

2) receive events from the channel already processed:
	for (;;) {
		switch(alt(alts)) {
			case Akeyboard:
				if(r==DELETEKEY)
					threadexitsall(nil);
			break;	
			case Areshape:
				resized(1);
			break;
			case Amouse:
				if (button==(MCLICK|MEND|2)){
					//single click with the 2 button
   				}

				if (button==(MCLICK||MDOUBLE|MEND|1)) {
					//double click with the 1 button
				}
				if ((button&(MFLAGS|7)) == (MEND|MCHORD|MCLICK|4|1)){
					if (MCHORDB(m->buttons,0) == 1){
						//chord with buttons 1 and 3, the first being 1.
					}
				}
		}
	}

We are finding it very useful in Plan B. Oppinions, ideas, suggestions?.
The genealogy of this is funny:

squeak (language for the mouse) ->aleph->libthread->cooked mouse


										G.



^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2005-01-14 16:43 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-13 16:30 [9fans] cooked mouse mode Gorka Guardiola
2005-01-13 20:59 ` rog
2005-01-14  1:06   ` Gorka Guardiola Múzquiz
2005-01-14 13:57     ` rog
2005-01-14 13:54       ` Fco. J. Ballesteros
2005-01-14 14:05         ` rog
2005-01-14 14:02           ` Fco. J. Ballesteros
2005-01-14 14:26             ` rog
2005-01-14 14:24               ` Gorka Guardiola
2005-01-14 14:58                 ` rog
2005-01-14 14:57                   ` Fco. J. Ballesteros
2005-01-14 14:59                   ` Gorka Guardiola
2005-01-14 15:09                     ` rog
2005-01-14 15:06                       ` Gorka Guardiola
2005-01-14 16:43                         ` Rob Pike
2005-01-14 13:57       ` Gorka Guardiola
2005-01-14 14:18         ` Charles Forsyth
2005-01-14 14:06           ` Fco. J. Ballesteros
2005-01-14 14:12             ` Gorka Guardiola
2005-01-14 14:13             ` Gorka Guardiola
2005-01-14 14:15               ` Gorka Guardiola
2005-01-14 14:26             ` Charles Forsyth
2005-01-14 14:15               ` Fco. J. Ballesteros
2005-01-14 14:17                 ` Gorka Guardiola
2005-01-14 14:24                   ` Fco. J. Ballesteros
2005-01-14 14:38             ` Charles Forsyth
2005-01-14 14:28               ` Gorka Guardiola

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).