#253 Wrong handling of button events 8.5.13

open
Jeffrey Hobbs
69. Events (11)
7
2013-04-03
2013-04-03
No

tkWinButton.c handles BN_CLICKED message. BN_SLIDER == WM_NULL and some browser (namely chromium) send a WM_NULL message periodically to check if the plugin is still alive. When using Tk via the Tcl plugin, this causes all buttons to fire regularly in a one-second interval. I have added an additional check in the event handler which avoids treatment of WM_NULL with 0 wParam/lParam as a button event in tkWinButton.c:ButtonProc. Without this modification, buttons are unusable in the Tcl/Tk plugin in some browsers since the command fire regularly without user interaction.

case BN_CLICKED:
/*
* OOPS: chromium fires WM_NULL regularly to ping if plugin is still
* alive. When using an external window (i.e. via th etcl plugin), this
* causes all buttons to fire once a second, so we need to make sure
* that we are not dealing with the chromium life check.
*/
if(!(message == WM_NULL && wParam == 0 && lParam == 0)) {
int code;
Tcl_Interp *interp = butPtr->info.interp;

if (butPtr->info.state != STATE_DISABLED) {
Tcl_Preserve((ClientData)interp);
code = TkInvokeButton((TkButton*)butPtr);
if (code != TCL_OK && code != TCL_CONTINUE
&& code != TCL_BREAK) {
Tcl_AddErrorInfo(interp, "\n (button invoke)");
Tcl_BackgroundError(interp);
}
Tcl_Release((ClientData)interp);
}
Tcl_ServiceAll();
return 0;
}

Discussion

  • Corrected event handler for BN_SLIDER/WM_NULL

     
    Attachments
    • summary: Wrong handling of button events --> Wrong handling of button events 8.5.13
    • priority: 5 --> 7