Tk Source Code

View Ticket
Login
Ticket UUID: 3609872
Title: Wrong handling of button events 8.5.13
Type: RFE Version: None
Submitter: wkechel Created on: 2013-04-03 08:40:34
Subsystem: 69. Events Assigned To: hobbs
Priority: 7 High Severity:
Status: Closed Last Modified: 2026-10-22 17:22:36
Resolution: Fixed Closed By: serhiy.storchaka
    Closed on: 2026-10-03 21:03:02
Description:
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;
      }
User Comments: serhiy.storchaka added on 2026-10-03 21:03:02:

Fixed in 2014 by [2a9f4ee008] (8.6) and [d093221415] (8.5) for [9e487e9f15]: BN_CLICKED with zero wParam and lParam is ignored.


wkechel added on 2013-04-03 15:40:35:

File Added - 462244: tkWinButton.c

Attachments: