SWIPELIST, stop moving with zero overlap

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • SWIPELIST, stop moving with zero overlap

      Hello,
      WM_MOTION module continues to run when SWIPELIST reaches its top or bottom position. It seems that SWIPELIST_Callback does not stop motion while handling WM_MOTION message with WM_MOTION_MOVE command.
    • Hello, Florian.

      Here you are.

      C Source Code

      1. static WM_HWIN swipelist;
      2. //===============================================
      3. static char const *motion_cmd_str(size_t cmd)
      4. {
      5. char const *p;
      6. switch (cmd)
      7. {
      8. case WM_MOTION_INIT:
      9. p = "INIT";
      10. break;
      11. case WM_MOTION_MOVE:
      12. p = "MOVE";
      13. break;
      14. case WM_MOTION_GETPOS:
      15. p = "GETPOS";
      16. break;
      17. case WM_MOTION_GETCONTEXT:
      18. p = "GETCONTEXT";
      19. break;
      20. default:
      21. p = "???";
      22. break;
      23. }
      24. return p;
      25. }
      26. //===============================================
      27. static void swipelist_cb(WM_MESSAGE *pMsg)
      28. {
      29. switch (pMsg->MsgId)
      30. {
      31. case WM_MOTION:
      32. {
      33. WM_MOTION_INFO *pInfo = (WM_MOTION_INFO *)pMsg->Data.p;
      34. log("WM_MOTION: %s, idr %u, dx %d, dy %d, da %d", motion_cmd_str(pInfo->Cmd),
      35. pInfo->IsDragging, pInfo->dx, pInfo->dy, pInfo->da);
      36. SWIPELIST_Callback(pMsg);
      37. }
      38. break;
      39. default:
      40. SWIPELIST_Callback(pMsg);
      41. break;
      42. }
      43. }
      44. //===============================================
      45. static void win_handler(WM_MESSAGE *pMsg)
      46. {
      47. switch (pMsg->MsgId)
      48. {
      49. case WM_CREATE:
      50. swipelist = SWIPELIST_CreateUser(20, 20, 480 - 2 * 20, 750 - 2 * 20,
      51. pMsg->hWin, WM_CF_SHOW, 0, ID_SWIPELIST, 0);
      52. WM_SetCallback(priv->swipelist, swipelist_cb);
      53. WM_MOTION_SetDefaultPeriod(1000);
      54. break;
      55. default:
      56. WM_DefaultProc(pMsg);
      57. break;
      58. }
      59. }
      60. //===============================================
      61. void main(void)
      62. {
      63. GUI_Init();
      64. WM_CreateWindowAsChild(0, 0, LCD_GetXSize(), LCD_GetYSize(), WM_HBKWIN,
      65. WM_CF_SHOW, win_handler, 0);
      66. while (1)
      67. {
      68. GUI_Delay(100);
      69. }
      70. }
      Display All

      Here is the log output:

      Source Code

      1. 10:24:50.525 GUI_Exec++
      2. 10:24:50.525 WM_MOTION: GETCONTEXT, idr 0, dx 0, dy 0, da 0
      3. 10:24:50.525 WM_MOTION: INIT, idr 0, dx 0, dy 0, da 0
      4. 10:24:50.525 GUI_Exec 0
      5. 10:24:50.525 GUI_Exec++
      6. 10:24:50.525 GUI_Exec 0
      7. 10:24:50.612 GUI_Exec++
      8. 10:24:50.612 WM_MOTION: GETCONTEXT, idr 0, dx 0, dy 0, da 0
      9. 10:24:50.612 WM_MOTION: MOVE, idr 1, dx 0, dy 4, da 0
      10. 10:24:50.654 GUI_Exec 42
      11. 10:24:50.654 GUI_Exec++
      12. 10:24:50.654 WM_MOTION: GETCONTEXT, idr 0, dx 0, dy 0, da 0
      13. 10:24:50.654 WM_MOTION: MOVE, idr 1, dx 0, dy 30, da 0
      14. 10:24:50.688 GUI_Exec 35
      15. 10:24:50.688 GUI_Exec++
      16. 10:24:50.688 WM_MOTION: GETCONTEXT, idr 0, dx 0, dy 0, da 0
      17. 10:24:50.688 WM_MOTION: MOVE, idr 1, dx 0, dy 42, da 0
      18. 10:24:50.689 WM_MOTION: GETCONTEXT, idr 0, dx 0, dy 0, da 0
      19. 10:24:50.724 GUI_Exec 35
      20. 10:24:50.724 GUI_Exec++
      21. 10:24:50.724 WM_MOTION: GETCONTEXT, idr 0, dx 0, dy 0, da 0
      22. 10:24:50.724 WM_MOTION: MOVE, idr 1, dx 0, dy 93, da 0
      23. 10:24:50.724 WM_MOTION: GETCONTEXT, idr 0, dx 0, dy 0, da 0
      24. 10:24:50.759 WM_MOTION: MOVE, idr 0, dx 0, dy 89, da 0
      25. 10:24:50.793 WM_MOTION: MOVE, idr 0, dx 0, dy 89, da 0
      26. 10:24:50.828 WM_MOTION: MOVE, idr 0, dx 0, dy 85, da 0
      27. 10:24:50.863 WM_MOTION: MOVE, idr 0, dx 0, dy 81, da 0
      28. 10:24:50.897 WM_MOTION: MOVE, idr 0, dx 0, dy 78, da 0
      29. 10:24:50.933 WM_MOTION: MOVE, idr 0, dx 0, dy 76, da 0
      30. 10:24:50.968 WM_MOTION: MOVE, idr 0, dx 0, dy 69, da 0
      31. 10:24:51.002 WM_MOTION: MOVE, idr 0, dx 0, dy 69, da 0
      32. 10:24:51.037 WM_MOTION: MOVE, idr 0, dx 0, dy 66, da 0
      33. 10:24:51.072 WM_MOTION: MOVE, idr 0, dx 0, dy 61, da 0
      34. 10:24:51.106 WM_MOTION: MOVE, idr 0, dx 0, dy 60, da 0
      35. 10:24:51.142 WM_MOTION: MOVE, idr 0, dx 0, dy 55, da 0
      36. 10:24:51.177 WM_MOTION: MOVE, idr 0, dx 0, dy 51, da 0
      37. 10:24:51.211 WM_MOTION: MOVE, idr 0, dx 0, dy 50, da 0
      38. 10:24:51.246 WM_MOTION: MOVE, idr 0, dx 0, dy 46, da 0
      39. 10:24:51.281 WM_MOTION: MOVE, idr 0, dx 0, dy 43, da 0
      40. 10:24:51.315 WM_MOTION: MOVE, idr 0, dx 0, dy 38, da 0
      41. 10:24:51.351 WM_MOTION: MOVE, idr 0, dx 0, dy 37, da 0
      42. 10:24:51.385 WM_MOTION: MOVE, idr 0, dx 0, dy 34, da 0
      43. 10:24:51.420 WM_MOTION: MOVE, idr 0, dx 0, dy 29, da 0
      44. 10:24:51.455 WM_MOTION: MOVE, idr 0, dx 0, dy 26, da 0
      45. 10:24:51.489 WM_MOTION: MOVE, idr 0, dx 0, dy 23, da 0
      46. 10:24:51.524 WM_MOTION: MOVE, idr 0, dx 0, dy 20, da 0
      47. 10:24:51.560 WM_MOTION: MOVE, idr 0, dx 0, dy 17, da 0
      48. 10:24:51.594 WM_MOTION: MOVE, idr 0, dx 0, dy 15, da 0
      49. 10:24:51.629 WM_MOTION: MOVE, idr 0, dx 0, dy 9, da 0
      50. 10:24:51.664 WM_MOTION: MOVE, idr 0, dx 0, dy 8, da 0
      51. 10:24:51.698 WM_MOTION: MOVE, idr 0, dx 0, dy 4, da 0
      52. 10:24:51.733 GUI_Exec 1009
      53. 10:24:51.733 GUI_Exec++
      54. 10:24:51.733 GUI_Exec 0
      55. 10:24:51.763 GUI_Exec++
      56. 10:24:51.763 WM_MOTION: MOVE, idr 0, dx 0, dy 0, da 0
      57. 10:24:51.763 GUI_Exec 0
      Display All