Package: fvwm Followup-For: Bug #278443 Tags: patch * Hugo Haas <[EMAIL PROTECTED]> [2005-04-06 22:03+0200] > Would it please be possible to have the fix which went in the CVS > repository applied to the Debian package?
Attached is the fix, I think. I did: cvs -d :pserver:[EMAIL PROTECTED]:/home/cvs/fvwm update -D 2004-10-25 cvs -d :pserver:[EMAIL PROTECTED]:/home/cvs/fvwm update -D 2004-10-27 and then diffed the two branches to get the changes for: 2004-10-26 Dominik Vogt <[EMAIL PROTECTED]> * fvwm/bindings.c (ParseBinding): reformatted * libs/Bindings.c (bindingAppliesToWindow): (__compare_binding): * fvwm/module_interface.c (CMD_ModuleSynchronous): * fvwm/builtins.c (CMD_Wait): (CMD_StrokeFunc): * fvwm/events.c (__handle_bpress_on_root): (HandleButtonRelease): fixed crash in window specific binding code fixed handling of root window in window specific binding code renamed some functions Cheers, Hugo -- Hugo Haas - http://larve.net/people/hugo/
diff -X ex -ur a/fvwm/ChangeLog fvwm/ChangeLog --- a/fvwm/ChangeLog 2005-04-07 09:49:54.058601536 +0200 +++ fvwm/ChangeLog 2005-04-07 09:49:20.331645818 +0200 @@ -1,3 +1,18 @@ +2004-10-26 Dominik Vogt <[EMAIL PROTECTED]> + + * fvwm/bindings.c (ParseBinding): + reformatted + * libs/Bindings.c (bindingAppliesToWindow): + (__compare_binding): + * fvwm/module_interface.c (CMD_ModuleSynchronous): + * fvwm/builtins.c (CMD_Wait): + (CMD_StrokeFunc): + * fvwm/events.c (__handle_bpress_on_root): + (HandleButtonRelease): + fixed crash in window specific binding code + fixed handling of root window in window specific binding code + renamed some functions + 2004-10-17 Dominik Vogt <[EMAIL PROTECTED]> * fvwm/focus.c (__update_windowlist): diff -X ex -ur a/fvwm/fvwm/bindings.c fvwm/fvwm/bindings.c --- a/fvwm/fvwm/bindings.c 2005-04-07 09:49:54.156589786 +0200 +++ fvwm/fvwm/bindings.c 2005-04-07 09:49:09.346963011 +0200 @@ -243,11 +243,12 @@ char key_string[201] = "", buffer[80], *windowName = NULL, *p; int button = 0; int n1=0,n2=0,n3=0; - KeySym keysym = NoSymbol; int context; int modifier; - Bool is_unbind_request = False, is_pass_thru = False; int rc; + KeySym keysym = NoSymbol; + Bool is_unbind_request = False; + Bool is_pass_through = False; Bool is_binding_removed = False; Binding *b; Binding *rmlist = NULL; @@ -268,8 +269,12 @@ if (*p == '\0') { if (!is_silent) - fvwm_msg(ERR, "ParseBinding", - "Syntax error in line %s - missing ')'", tline); + { + fvwm_msg( + ERR, "ParseBinding", + "Syntax error in line %s -" + " missing ')'", tline); + } return 0; } ++p; @@ -279,8 +284,12 @@ if (*p != '\0') { if (!is_silent) - fvwm_msg(ERR, "ParseBinding", - "Syntax error in line %s - trailing text after specified window", tline); + { + fvwm_msg( + ERR, "ParseBinding", + "Syntax error in line %s - trailing" + " text after specified window", tline); + } return 0; } token = PeekToken(ptr, &ptr); @@ -454,8 +463,8 @@ if (action) { - is_pass_thru = actionIsPassThru(action); - if (is_pass_thru) + is_pass_through = is_pass_through_action(action); + if (is_pass_through) { /* pass-through actions indicate that the event be * allowed to pass through to the underlying window. */ @@ -472,7 +481,7 @@ } } /* see if it is an unbind request */ - if (!action || (action[0] == '-' && !is_pass_thru)) + if (!action || (action[0] == '-' && !is_pass_through)) { is_unbind_request = True; } diff -X ex -ur a/fvwm/fvwm/builtins.c fvwm/fvwm/builtins.c --- a/fvwm/fvwm/builtins.c 2005-04-07 09:49:54.163588947 +0200 +++ fvwm/fvwm/builtins.c 2005-04-07 09:49:09.353962172 +0200 @@ -2553,14 +2553,29 @@ } else if (e.type == KeyPress) { - /* TODO: should I be using <t> or <exc->w.fw>? + /* should I be using <t> or <exc->w.fw>? + * DV: t */ - int context = GetContext(&t, t, &e, &nonewin); + int context; + XClassHint *class; + char *name; + + context = GetContext(&t, t, &e, &nonewin); + if (t != NULL) + { + class = &(t->class); + name = t->name.name; + } + else + { + class = NULL; + name = NULL; + } escape = CheckBinding( Scr.AllBindings, STROKE_ARG(0) e.xkey.keycode, e.xkey.state, GetUnusedModifiers(), context, - BIND_KEYPRESS, &t->class, t->name.name); + BIND_KEYPRESS, class, name); if (escape != NULL) { if (!strcasecmp(escape,"escapefunc")) @@ -4062,7 +4077,7 @@ Bool feed_back = False; int stroke_width = 1; XEvent e; - XClassHint tmp, *pClass; + XClassHint *class; @@ -4326,27 +4341,24 @@ fvwm_msg(INFO, "StrokeFunc", "stroke sequence: %s (N%s)", sequence, num_seq); } - if (abort) { return; } - if (exc->w.fw == NULL) { - tmp.res_class = tmp.res_name = name = "root"; - pClass = &tmp; + class = NULL; + name = NULL; } else { - pClass = &exc->w.fw->class; + class = &exc->w.fw->class; name = exc->w.fw->name.name; } - /* check for a binding */ stroke_action = CheckBinding( Scr.AllBindings, sequence, 0, modifiers, GetUnusedModifiers(), - exc->w.wcontext, BIND_STROKE, pClass, name); + exc->w.wcontext, BIND_STROKE, class, name); /* execute the action */ if (stroke_action != NULL) diff -X ex -ur a/fvwm/fvwm/events.c fvwm/fvwm/events.c --- a/fvwm/fvwm/events.c 2005-04-07 09:49:54.223581753 +0200 +++ fvwm/fvwm/events.c 2004-10-26 11:06:53.000000000 +0200 @@ -1561,18 +1561,14 @@ static void __handle_bpress_on_root(const exec_context_t *exc) { char *action; - XClassHint tmp; PressedW = None; __handle_bpress_stroke(); /* search for an appropriate mouse binding */ - /* exc->w.fw is always NULL, hence why we use "root". */ - tmp.res_class = tmp.res_name = "root"; action = CheckBinding( Scr.AllBindings, STROKE_ARG(0) exc->x.etrigger->xbutton.button, exc->x.etrigger->xbutton.state, GetUnusedModifiers(), C_ROOT, - BIND_BUTTONPRESS, &tmp, tmp.res_class); - + BIND_BUTTONPRESS, NULL, NULL); if (action && *action) { const exec_context_t *exc2; @@ -1705,36 +1701,33 @@ #ifdef HAVE_STROKE void HandleButtonRelease(const evh_args_t *ea) { - char *action, *name; + char *action; + char *name; int real_modifier; const XEvent *te = ea->exc->x.etrigger; - XClassHint tmp, *pClass; + XClassHint *class; DBUG("HandleButtonRelease", "Routine Entered"); - send_motion = False; stroke_trans (sequence); - DBUG("HandleButtonRelease",sequence); - /* Allows modifier to work (Only R context works here). */ real_modifier = te->xbutton.state - (1 << (7 + te->xbutton.button)); if (ea->exc->w.fw == NULL) { - tmp.res_class = tmp.res_name = name = "root"; - pClass = &tmp; + class = NULL; + name = NULL; } else { - pClass = &ea->exc->w.fw->class; + class = &ea->exc->w.fw->class; name = ea->exc->w.fw->name.name; } /* need to search for an appropriate stroke binding */ action = CheckBinding( Scr.AllBindings, sequence, te->xbutton.button, real_modifier, GetUnusedModifiers(), ea->exc->w.wcontext, BIND_STROKE, - pClass, name); - + class, name); /* got a match, now process it */ if (action != NULL && (action[0] != 0)) { diff -X ex -ur a/fvwm/fvwm/module_interface.c fvwm/fvwm/module_interface.c --- a/fvwm/fvwm/module_interface.c 2005-04-07 09:49:54.341567605 +0200 +++ fvwm/fvwm/module_interface.c 2005-04-07 09:49:20.517623517 +0200 @@ -611,15 +611,27 @@ if (FPending(dpy) && FCheckMaskEvent(dpy, KeyPressMask, &tmpevent)) { + int context; + XClassHint *class; + char *name; + + context = GetContext( + NULL, exc->w.fw, &tmpevent, &targetWindow); + if (exc->w.fw != NULL) + { + class = &(exc->w.fw->class); + name = exc->w.fw->name.name; + } + else + { + class = NULL; + name = NULL; + } escape = CheckBinding( Scr.AllBindings, STROKE_ARG(0) tmpevent.xkey.keycode, tmpevent.xkey.state, - GetUnusedModifiers(), - GetContext( - NULL, exc->w.fw, &tmpevent, - &targetWindow), - BIND_KEYPRESS, &exc->w.fw->class, - exc->w.fw->name.name); + GetUnusedModifiers(), context, BIND_KEYPRESS, + class, name); if (escape != NULL) { if (!strcasecmp(escape,"escapefunc")) diff -X ex -ur a/fvwm/libs/Bindings.c fvwm/libs/Bindings.c --- a/fvwm/libs/Bindings.c 2005-04-07 09:49:54.428557174 +0200 +++ fvwm/libs/Bindings.c 2004-10-26 11:06:53.000000000 +0200 @@ -380,28 +380,34 @@ * if the binding actually applies to a window based on its * name/class/resource. */ -Bool bindingAppliesToWindow(Binding *binding, const XClassHint *winClass, - const char *winName) +static Bool does_binding_apply_to_window( + Binding *binding, const XClassHint *win_class, const char *win_name) { /* If no window name is specified with the binding then that means * the binding applies to ALL windows. */ if (binding->windowName == NULL) + { return True; - - if (matchWildcards(binding->windowName, winName) == TRUE || - matchWildcards(binding->windowName, winClass->res_name) == TRUE || - matchWildcards(binding->windowName, winClass->res_class) == TRUE) + } + else if (win_class == NULL || win_name == NULL) + { + return False; + } + if (matchWildcards(binding->windowName, win_name) == True || + matchWildcards(binding->windowName, win_class->res_name) == True || + matchWildcards(binding->windowName, win_class->res_class) == True) { return True; } + return False; } -Bool __compare_binding( +static Bool __compare_binding( Binding *b, STROKE_ARG(char *stroke) int button_keycode, unsigned int modifier, unsigned int used_modifiers, - int Context, binding_t type, const XClassHint *winClass, - const char *winName) + int Context, binding_t type, const XClassHint *win_class, + const char *win_name) { if (b->type != type || !(b->Context & Context)) { @@ -412,7 +418,6 @@ { return False; } - if (BIND_IS_MOUSE_BINDING(type) && (b->Button_Key != button_keycode && b->Button_Key != 0)) { @@ -430,20 +435,20 @@ return False; } #endif - - if (!bindingAppliesToWindow(b, winClass, winName)) + if (!does_binding_apply_to_window(b, win_class, win_name)) { return False; } + return True; } -/* actionIsPassThru() - returns true if the action indicates that the +/* is_pass_through_action() - returns true if the action indicates that the * binding should be ignored by FVWM & passed through to the underlying * window. * Note: it is only meaningful to check for pass-thru actions on * window-specific bindings. */ -Bool actionIsPassThru (const char *action) +Bool is_pass_through_action(const char *action) { /* action should never be NULL. */ return (strncmp(action, "--", 2) == 0); @@ -454,8 +459,8 @@ void *CheckBinding( Binding *blist, STROKE_ARG(char *stroke) int button_keycode, unsigned int modifier,unsigned int dead_modifiers, - int Context, binding_t type, const XClassHint *winClass, - const char *winName) + int Context, binding_t type, const XClassHint *win_class, + const char *win_name) { Binding *b; unsigned int used_modifiers = ~dead_modifiers; @@ -464,9 +469,10 @@ modifier &= (used_modifiers & ALL_MODIFIERS); for (b = blist; b != NULL; b = b->NextBinding) { - if (__compare_binding( - b, STROKE_ARG(stroke) button_keycode, modifier, - used_modifiers, Context, type, winClass, winName) == True) + if (__compare_binding( + b, STROKE_ARG(stroke) button_keycode, modifier, + used_modifiers, Context, type, win_class, + win_name) == True) { /* If this is a global binding, keep searching <blist> * in the hope of finding a window-specific binding. @@ -477,7 +483,7 @@ action = b->Action; if (b->windowName) { - if (actionIsPassThru(action)) + if (is_pass_through_action(action)) { action = NULL; } @@ -493,9 +499,9 @@ void *CheckTwoBindings( Bool *ret_is_second_binding, Binding *blist, STROKE_ARG(char *stroke) int button_keycode, unsigned int modifier,unsigned int dead_modifiers, - int Context, binding_t type, const XClassHint *winClass, - const char *winName, int Context2, binding_t type2, - const XClassHint *winClass2, const char *winName2) + int Context, binding_t type, const XClassHint *win_class, + const char *win_name, int Context2, binding_t type2, + const XClassHint *win_class2, const char *win_name2) { Binding *b; unsigned int used_modifiers = ~dead_modifiers; @@ -506,7 +512,7 @@ { if (__compare_binding( b, STROKE_ARG(stroke) button_keycode, modifier, - used_modifiers, Context, type, winClass, winName) + used_modifiers, Context, type, win_class, win_name) == True) { if (action == NULL || b->windowName) @@ -515,7 +521,7 @@ action = b->Action; if (b->windowName) { - if (actionIsPassThru(action)) + if (is_pass_through_action(action)) action = NULL; break; } @@ -523,8 +529,8 @@ } if (__compare_binding( b, STROKE_ARG(stroke) button_keycode, modifier, - used_modifiers, Context2, type2, winClass2, - winName2) == True) + used_modifiers, Context2, type2, win_class2, + win_name2) == True) { if (action == NULL || b->windowName) { @@ -532,8 +538,10 @@ action = b->Action; if (b->windowName) { - if (actionIsPassThru(action)) + if (is_pass_through_action(action)) + { action = NULL; + } break; } } diff -X ex -ur a/fvwm/libs/Bindings.h fvwm/libs/Bindings.h --- a/fvwm/libs/Bindings.h 2005-04-07 09:49:54.429557054 +0200 +++ fvwm/libs/Bindings.h 2004-10-26 11:06:53.000000000 +0200 @@ -65,13 +65,13 @@ void *CheckBinding( Binding *blist, STROKE_ARG(char *stroke) int button_keycode, unsigned int modifier, unsigned int dead_modifiers, int Context, - binding_t type, const XClassHint *winClass, const char *winName); + binding_t type, const XClassHint *win_class, const char *win_name); void *CheckTwoBindings( Bool *ret_is_second_binding, Binding *blist, STROKE_ARG(char *stroke) int button_keycode, unsigned int modifier,unsigned int dead_modifiers, - int Context, binding_t type, const XClassHint *winClass, - const char *winName, int Context2, binding_t type2, - const XClassHint *winClass2, const char *winName2); + int Context, binding_t type, const XClassHint *win_class, + const char *win_name, int Context2, binding_t type2, + const XClassHint *win_class2, const char *win_name2); void GrabWindowKey( Display *dpy, Window w, Binding *binding, unsigned int contexts, unsigned int dead_modifiers, Bool fGrab); @@ -91,9 +91,9 @@ Display *dpy, Window w, Binding *binding, unsigned int contexts, unsigned int dead_modifiers, Cursor cursor, Bool fGrab); KeySym FvwmStringToKeysym(Display *dpy, char *key); -Bool bindingAppliesToWindow(Binding *binding, const XClassHint *winClass, - const char *winName); -Bool actionIsPassThru (const char *action); +Bool bindingAppliesToWindow(Binding *binding, const XClassHint *win_class, + const char *win_name); +Bool is_pass_through_action(const char *action); #endif /* FVWMLIB_BINDINGS_H_H */
signature.asc
Description: Digital signature