Ucgui324按键单击响应

 
在gui的学习中,原本的响应过程是:第一次点击,先取消之前按键的焦点等状态,并在当前按键聚焦等,第二次点击才会动作当前按键,并重绘按键。
在函数:
/****************************************************************
*
*       WM_HandleHID      
*
* Polls the touch screen. If something has changed,
* sends a message to the concerned window.
*
* Return value:
*   0 if nothing has been done
*   1 if touch message has been sent
*/
int WM_HandleHID(void) {
  int r = 0;
  static GUI_TOUCH_tState StateLast;
  GUI_HID_STATE State;
  GUI_HID_GetState(&State);
  WM_LOCK();
  WM__pfDeleteWindowHook = _cbDeleteWindow;   /* TBD in the future... Hook function management in order to allow multiple hook functions */
  #if GUI_SUPPORT_CURSOR
    GUI_CURSOR_SetPosition(State.x, State.y);
  #endif
  if (StateLast.Pressed | State.Pressed) {
    if (   (StateLast.x != State.x)
        || (StateLast.y != State.y)
        || ((StateLast.Pressed ? 1:0) != (State.Pressed ? 1:0)))
    {
      WM_MESSAGE Msg;
      WM_HWIN hWin;
      StateLast = State;             /* Remember current values */
      r = 1;
      Msg.MsgId = WM_TOUCH;
      Msg.Data.p = (void*)&State;
      if (WM__hCapture == 0) {
        hWin = WM_Screen2hWin(State.x, State.y);
      } else {
        hWin = WM__hCapture;
      }
      // Tell window if it is no longer pressed
       /*if (_hWinLast != hWin) {
        if (_hWinLast != 0) {
          if (State.Pressed) {
            Msg.Data.p = NULL;    // no longer in this window
          } else {     // "Clicked" in this window
            StateLast.Pressed =0;
            Msg.Data.p = (void*)&StateLast;
          }
          GUI_DEBUG_LOG1 ("\nSending WM_Touch to LastWindow %d (out of area)", _hWinLast);
          WM_SendMessage(_hWinLast, &Msg);
          _hWinLast = 0;
         }
      }
      */
      if (hWin) {           /* Sending WM_Touch to Window */
        /* convert screen into window coordinates */
        WM_Obj* pWin = WM_H2P(hWin);
        State.x -= pWin->Rect.x0;
        State.y -= pWin->Rect.y0;
        WM_SendMessage(hWin, &Msg);
        /* Remember window */
        if (State.Pressed) {
      //    _hWinLast = hWin;
        } else {
          /* Handle automatic captue release */
          if (WM__CaptureReleaseAuto) {
            WM_ReleaseCapture();
          }
       //   _hWinLast = 0;
        }
      }
    }
  }
  WM_UNLOCK();
  return r;
}
注释掉红色部分,不把前一次的窗体和当前窗体比较,可以单击动作。
修改button.c中的重绘函数,使其每次重绘都是3d显示即可。

你可能感兴趣的:(function,null,hook,polls)