diff -rc ./Fvwm.tmpl ../fvwm-2.0.45-stroke/Fvwm.tmpl *** ./Fvwm.tmpl Wed Jan 22 08:38:49 1997 --- ../fvwm-2.0.45-stroke/Fvwm.tmpl Mon Feb 24 02:49:54 1997 *************** *** 65,73 **** * XpmIncs to the paths where the library and include files are located. ***************************************************************************/ #define HasXpm YES /* NO */ ! /* #define XpmLibs -L/usr/local/lib */ ! /* #define XpmIncs -I/usr/local/include */ /*************************************************************************** * #define HasRPlay --- 65,89 ---- * XpmIncs to the paths where the library and include files are located. ***************************************************************************/ #define HasXpm YES /* NO */ ! #define XpmLibs -L/usr/local/lib ! #define XpmIncs -I/usr/local/include + /*************************************************************************** + * #define HasStroke + * + * If you want to use the libStroke interface, define HasStroke as YES, and + * get libStroke from + * http://hillres55-109.cc.purdue.edu/~willey/Projects/libstroke + * + * If libStroke is not installed with the rest of your X, set StrokeLibs and + * StrokeIncs to the paths where the library and include files are located. + * + * Ideally, we will just include the stroke source code (it's small) with + * the fvwm2 package. + ***************************************************************************/ + #define HasStroke YES /* NO */ + #define StrokeLibs -L/usr/local/lib + #define StrokeIncs -I/usr/local/include /*************************************************************************** * #define HasRPlay *************** *** 309,314 **** --- 325,333 ---- #ifndef HasXpm #define HasXpm NO #endif + #ifndef HasStroke + #define HasStroke NO + #endif #ifndef HasRPlay #define HasRPlay NO #endif *************** *** 340,345 **** --- 359,369 ---- XPM_LIBRARIES = XpmLibs -lXpm #endif + #if HasStroke + STROKE_DEFINES = -DHAVE_LIBSTROKE + STROKE_INCLUDES = StrokeIncs + STROKE_LIBRARIES = StrokeLibs -lstroke + #endif #if HasRPlay AUDIO_DEFINES = -DHAVE_RPLAY *************** *** 406,417 **** #endif /* HPArchitecture */ #endif /* AlphaArchitecture */ ! XCOMM FVWM_LIBS = -L$(FVWM_SRCDIR)/libs -l$(LIB) $(XPM_LIBRARIES) $(KLUDGE_LIBS) ! FVWM_LIBS = $(FVWM_SRCDIR)/libs/lib$(LIB).a $(XPM_LIBRARIES) $(KLUDGE_LIBS) FVWM_DEPLIB = $(FVWM_SRCDIR)/libs/lib$(LIB).a ! DEFINES = $(OPTION_DEFINES) $(XPM_DEFINES) $(AUDIO_DEFINES) ! INCLUDES = $(XPM_INCLUDES) $(AUDIO_INCLUDES) -I. -I$(FVWM_SRCDIR)/libs DEPLIBS = $(DEPXLIB) $(FVWM_DEPLIB) LINTLIBS = $(LINTXLIB) --- 430,441 ---- #endif /* HPArchitecture */ #endif /* AlphaArchitecture */ ! XCOMM FVWM_LIBS = -L$(FVWM_SRCDIR)/libs -l$(LIB) $(XPM_LIBRARIES) $(STROKE_LIBRARIES) $(KLUDGE_LIBS) ! FVWM_LIBS = $(FVWM_SRCDIR)/libs/lib$(LIB).a $(XPM_LIBRARIES) $(STROKE_LIBRARIES) $(KLUDGE_LIBS) FVWM_DEPLIB = $(FVWM_SRCDIR)/libs/lib$(LIB).a ! DEFINES = $(OPTION_DEFINES) $(XPM_DEFINES) $(AUDIO_DEFINES) $(STROKE_DEFINES) ! INCLUDES = $(XPM_INCLUDES) $(AUDIO_INCLUDES) $(STROKE_INCLUDES) -I. -I$(FVWM_SRCDIR)/libs DEPLIBS = $(DEPXLIB) $(FVWM_DEPLIB) LINTLIBS = $(LINTXLIB) diff -rc ./fvwm/bindings.c ../fvwm-2.0.45-stroke/fvwm/bindings.c *** ./fvwm/bindings.c Wed Jun 19 22:02:12 1996 --- ../fvwm-2.0.45-stroke/fvwm/bindings.c Mon Feb 24 02:49:54 1997 *************** *** 316,321 **** --- 316,402 ---- return; } + #ifdef HAVE_LIBSTROKE + /**************************************************************************** + * + * Processes a line with a stroke binding + * + ****************************************************************************/ + void ParseStrokeEntry(XEvent *eventp,Window w,FvwmWindow *tmp_win, + unsigned long junk, char *tline,int* Module) + { + char *action,context[20],modifiers[20],*ptr, *token; + Stroke_Binding *temp; + int i,min,max; + int n1=0,n2=0,n3=0,n4=0; + int contexts; + int mods; + int stroke; + int button; + + /* tline points after the key word "stroke" */ + ptr = tline; + + ptr = GetNextToken(ptr,&token); + if(token != NULL) + { + n1 = sscanf(token,"%d",&stroke); + free(token); + } + + ptr = GetNextToken(ptr,&token); + if(token != NULL) + { + n2 = sscanf(token,"%d",&button); + free(token); + } + + ptr = GetNextToken(ptr,&token); + if(token != NULL) + { + n3 = sscanf(token,"%19s",context); + free(token); + } + action = GetNextToken(ptr,&token); + if(token != NULL) + { + n4 = sscanf(token,"%19s",modifiers); + free(token); + } + + if((n1 != 1)||(n2 != 1)||(n3 != 1)||(n4 != 1)) + { + fvwm_msg(ERR,"ParseStrokeEntry","Syntax error in line %s",tline); + return; + } + + find_context(context,&contexts,win_contexts,tline); + find_context(modifiers,&mods,key_modifiers,tline); + + /* + ** strip leading whitespace from action if necessary + */ + while (*action && (*action == ' ' || *action == '\t')) + action++; + + if((mods & AnyModifier)&&(mods&(~AnyModifier))) + { + fvwm_msg(WARN,"ParseStrokeEntry", + "Binding specified AnyModifier and other modifers too. Excess modifiers will be ignored."); + } + + temp = Scr.StrokeBindings; + Scr.StrokeBindings = (Stroke_Binding *)safemalloc(sizeof(Stroke_Binding)); + Scr.StrokeBindings->Stroke = stroke; + Scr.StrokeBindings->Button = button; + Scr.StrokeBindings->Context = contexts; + Scr.StrokeBindings->Modifier = mods; + Scr.StrokeBindings->Action = stripcpy(action); + Scr.StrokeBindings->NextBinding = temp; + return; + } + #endif /* HAVE_LIBSTROKE */ + /**************************************************************************** * * Turns a string context of context or modifier values into an array of diff -rc ./fvwm/events.c ../fvwm-2.0.45-stroke/fvwm/events.c *** ./fvwm/events.c Wed Jan 22 08:37:39 1997 --- ../fvwm-2.0.45-stroke/fvwm/events.c Mon Feb 24 02:49:54 1997 *************** *** 64,69 **** --- 64,73 ---- #include #endif /* SHAPE */ #include "module.h" + #ifdef HAVE_LIBSTROKE + #include + #include "stroke.h" + #endif /* HAVE_LIBSTROKE */ unsigned int mods_used = (ShiftMask | ControlMask | Mod1Mask | Mod2Mask| Mod3Mask| Mod4Mask| Mod5Mask); *************** *** 80,85 **** --- 84,94 ---- int last_event_type=0; Window last_event_window=0; + #ifdef HAVE_LIBSTROKE + int send_motion; + char sequence[MAX_SEQUENCE+1]; + #endif /* HAVE_LIBSTROKE */ + #ifdef SHAPE extern int ShapeEventBase; void HandleShapeNotify(void); *************** *** 131,136 **** --- 140,156 ---- if (ShapesSupported) EventHandlerJumpTable[ShapeEventBase+ShapeNotify] = HandleShapeNotify; #endif /* SHAPE */ + #ifdef HAVE_LIBSTROKE + EventHandlerJumpTable[ButtonRelease] = HandleButtonRelease; + EventHandlerJumpTable[MotionNotify] = HandleMotionNotify; + #ifdef HAVE_LIBSTROKE + #ifdef MOUSE_DROPPINGS + stroke_init(dpy,DefaultRootWindow(dpy)); + #else /* no MOUSE_DROPPINGS */ + stroke_init(); + #endif /* MOUSE_DROPPINGS */ + #endif /* HAVE_LIBSTROKE */ + #endif /* HAVE_LIBSTROKE */ } /*********************************************************************** *************** *** 169,174 **** --- 189,197 ---- void HandleEvents() { DBUG("HandleEvents","Routine Entered"); + #ifdef HAVE_LIBSTROKE + send_motion = FALSE; + #endif /* HAVE_LIBSTROKE */ while (TRUE) { last_event_type = 0; *************** *** 1034,1039 **** --- 1057,1067 ---- /* we have to execute a function or pop up a menu */ + #ifdef HAVE_LIBSTROKE + stroke_init(); + send_motion = TRUE; + #endif /* HAVE_LIBSTROKE */ + modifier = (Event.xbutton.state & mods_used); /* need to search for an appropriate mouse binding */ for (MouseEntry = Scr.AllBindings; MouseEntry != NULL; *************** *** 1058,1063 **** --- 1086,1136 ---- SetTitleBar(ButtonWindow,(Scr.Hilite==ButtonWindow),False); ButtonWindow = NULL; } + + #ifdef HAVE_LIBSTROKE + void HandleButtonRelease() + { + unsigned int modifier; + Stroke_Binding *StrokeEntry; + int stroke; + + send_motion = FALSE; + stroke_trans (sequence); + stroke=atoi(sequence); + /* DEBUG printfs + if (stroke_trans (sequence) == TRUE) + printf ("Translation succeeded: "); + else + printf ("Translation failed: "); + printf ("Sequence=\"%s\"\n",sequence); + printf ("Stroke=\"%d\"\n",stroke); + */ + + Context = GetContext(Tmp_win,&Event, &PressedW); + + /* We currently ignore all modifiers, and contexts, too... */ + /* modifier = (Event.xbutton.state & mods_used); */ + + /* need to search for an appropriate stroke binding */ + for (StrokeEntry = Scr.StrokeBindings; StrokeEntry != NULL; + StrokeEntry= StrokeEntry->NextBinding) + { + if((StrokeEntry->Stroke == stroke)&& + (StrokeEntry->Button == Event.xbutton.button)) { + + /* got a match, now process it */ + ExecuteFunction(StrokeEntry->Action,Tmp_win, &Event,Context,-1); + break; + } + } + } + + void HandleMotionNotify() + { + if (send_motion == TRUE) + stroke_record (Event.xmotion.x,Event.xmotion.y); + } + #endif /* HAVE_LIBSTROKE */ /*********************************************************************** * diff -rc ./fvwm/functions.c ../fvwm-2.0.45-stroke/fvwm/functions.c *** ./fvwm/functions.c Tue Jan 14 09:06:33 1997 --- ../fvwm-2.0.45-stroke/fvwm/functions.c Mon Feb 24 02:49:54 1997 *************** *** 84,89 **** --- 84,92 ---- {"IconFont", LoadIconFont, F_ICONFONT, FUNC_NO_WINDOW}, {"IconPath", setIconPath, F_ICON_PATH, FUNC_NO_WINDOW}, {"Key", ParseKeyEntry, F_KEY, FUNC_NO_WINDOW}, + #ifdef HAVE_LIBSTROKE + {"Stroke", ParseStrokeEntry, F_STROKE, FUNC_NO_WINDOW}, + #endif /* HAVE_LIBSTROKE */ {"Lower", lower_function, F_LOWER, FUNC_NEEDS_WINDOW}, {"Maximize", Maximize, F_MAXIMIZE, FUNC_NEEDS_WINDOW}, {"Menustyle", SetMenuStyle, F_MENUSTYLE, FUNC_NO_WINDOW}, diff -rc ./fvwm/fvwm.c ../fvwm-2.0.45-stroke/fvwm/fvwm.c *** ./fvwm/fvwm.c Wed Jan 22 08:37:44 1997 --- ../fvwm-2.0.45-stroke/fvwm/fvwm.c Mon Feb 24 02:49:54 1997 *************** *** 347,352 **** --- 347,357 ---- LeaveWindowMask| EnterWindowMask | PropertyChangeMask | SubstructureRedirectMask | KeyPressMask | SubstructureNotifyMask| + #ifdef HAVE_LIBSTROKE + PointerMotionMask | + Button2MotionMask | + ButtonMotionMask | + #endif /* HAVE_LIBSTROKE */ ButtonPressMask | ButtonReleaseMask ); XSync(dpy, 0); *************** *** 1154,1159 **** --- 1159,1167 ---- /* initialize some lists */ Scr.AllBindings = NULL; + #ifdef HAVE_LIBSTROKE + Scr.StrokeBindings = NULL; + #endif /* HAVE_LIBSTROKE */ Scr.AllMenus = NULL; Scr.TheList = NULL; diff -rc ./fvwm/menus.h ../fvwm-2.0.45-stroke/fvwm/menus.h *** ./fvwm/menus.h Fri Mar 22 15:32:33 1996 --- ../fvwm-2.0.45-stroke/fvwm/menus.h Mon Feb 24 02:49:54 1997 *************** *** 97,106 **** --- 97,119 ---- int func; } MenuRoot; + #ifdef HAVE_LIBSTROKE + typedef struct Stroke_Binding + { + int Stroke; /* stroke sequence */ + int Button; /* button number of stroke */ + int Context; /* Contex is Fvwm context, ie titlebar, frame, etc */ + int Modifier; /* Modifiers for keyboard state */ + char *Action; /* What to do? */ + struct Stroke_Binding *NextBinding; + } Stroke_Binding; + #endif /* HAVE_LIBSTROKE */ + typedef struct Binding { char IsMouse; /* Is it a mouse or key binding 1= mouse; */ int Button_Key; /* Mouse Button number of Keycode */ + int Stroke; /* stroke sequence */ char *key_name; /* In case of keycode, give the key_name too */ int Context; /* Contex is Fvwm context, ie titlebar, frame, etc */ int Modifier; /* Modifiers for keyboard state */ diff -rc ./fvwm/misc.h ../fvwm-2.0.45-stroke/fvwm/misc.h *** ./fvwm/misc.h Mon Dec 23 17:07:47 1996 --- ../fvwm-2.0.45-stroke/fvwm/misc.h Mon Feb 24 02:49:54 1997 *************** *** 310,315 **** --- 310,319 ---- unsigned long context, char *tline,int* Module); void ParseKeyEntry(XEvent *eventp,Window w,FvwmWindow *tmp_win, unsigned long context, char *tline,int* Module); + #ifdef HAVE_LIBSTROKE + void ParseStrokeEntry(XEvent *eventp,Window w,FvwmWindow *tmp_win, + unsigned long context, char *tline,int* Module); + #endif /* HAVE_LIBSTROKE */ void SetOneStyle(char *text,FILE *,char **,int *); void AddToList(char *name, char *icon_name, #ifdef MINI_ICONS diff -rc ./fvwm/parse.h ../fvwm-2.0.45-stroke/fvwm/parse.h *** ./fvwm/parse.h Mon Dec 23 17:07:47 1996 --- ../fvwm-2.0.45-stroke/fvwm/parse.h Mon Feb 24 03:06:28 1997 *************** *** 101,106 **** --- 101,109 ---- #define F_DESTROY_DECOR 124 #define F_UPDATE_DECOR 125 #define F_WINDOW_SHADE 126 + #ifdef HAVE_LIBSTROKE + #define F_STROKE 127 + #endif /* HAVE_LIBSTROKE */ /* Functions for use by modules only! */ #define F_SEND_WINDOW_LIST 1000 diff -rc ./fvwm/screen.h ../fvwm-2.0.45-stroke/fvwm/screen.h *** ./fvwm/screen.h Wed Jan 22 08:37:49 1997 --- ../fvwm-2.0.45-stroke/fvwm/screen.h Mon Feb 24 02:49:54 1997 *************** *** 237,242 **** --- 237,245 ---- Pixmap sticky_gray_pixmap; /* light gray pattern for sticky borders */ Binding *AllBindings; + #ifdef HAVE_LIBSTROKE + Stroke_Binding *StrokeBindings; + #endif /* HAVE_LIBSTROKE */ MenuRoot *AllMenus; int root_pushes; /* current push level to install root diff -rc ./sample.fvwmrc/system.fvwmrc ../fvwm-2.0.45-stroke/sample.fvwmrc/system.fvwmrc *** ./sample.fvwmrc/system.fvwmrc Wed Jan 15 15:29:42 1997 --- ../fvwm-2.0.45-stroke/sample.fvwmrc/system.fvwmrc Mon Feb 24 02:54:52 1997 *************** *** 62,68 **** # some simple default mouse bindings: # for the root window: Mouse 1 R A Menu RootMenu Nop ! Mouse 2 R A Menu Window-Ops Nop Mouse 3 R A WindowList # for the title bar buttons: --- 62,68 ---- # some simple default mouse bindings: # for the root window: Mouse 1 R A Menu RootMenu Nop ! #Mouse 2 R A Menu Window-Ops Nop Mouse 3 R A WindowList # for the title bar buttons: *************** *** 77,82 **** --- 77,121 ---- Mouse 2 I A Iconify Mouse 2 FST A Menu Window-Ops2 Nop Mouse 3 TSIF A RaiseLower + + # Strokes + # num button context mod. action + Stroke 14789 2 A N Exec exec xlock -mode blank& + + Stroke 258 2 A N Exec exec xterm& + + Stroke 563214789 2 A N Exec exec exmh& + Stroke 53214789 2 A N Exec exec exmh& + Stroke 5321478 2 A N Exec exec exmh& + Stroke 5214789 2 A N Exec exec exmh& + Stroke 521478 2 A N Exec exec exmh& + Stroke 5321478 2 A N Exec exec exmh& + Stroke 453214789 2 A N Exec exec exmh& + Stroke 45321478 2 A N Exec exec exmh& + Stroke 4563214789 2 A N Exec exec exmh& + Stroke 456321478 2 A N Exec exec exmh& + Stroke 456214789 2 A N Exec exec exmh& + Stroke 45621478 2 A N Exec exec exmh& + + Stroke 7415963 2 A N Exec exec netscape& + Stroke 74148963 2 A N Exec exec netscape& + Stroke 74158963 2 A N Exec exec netscape& + Stroke 7418963 2 A N Exec exec netscape& + + Stroke 741236987 2 A N Destroy + + Stroke 1478963 2 A N Popup "Apps" + + Stroke 74123 2 A N Module "winlist" FvwmWinList transient + + Stroke 74159 2 A N Move + Stroke 741569 2 A N Move + Stroke 741259 2 A N Move + Stroke 7412569 2 A N Move + Stroke 7415369 2 A N Move + + Stroke 852 2 A N Menu "Apps" Nop + ######################## Initialization Functions ############################ AddToFunc InitFunction "I" Module FvwmButtons