GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_system_event_send.c Lines: 21 21 100.0 %
Date: 2024-12-05 08:52:37 Branches: 10 10 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 *
4
 * This program and the accompanying materials are made available under the
5
 * terms of the MIT License which is available at
6
 * https://opensource.org/licenses/MIT.
7
 *
8
 * SPDX-License-Identifier: MIT
9
 **************************************************************************/
10
11
12
/**************************************************************************/
13
/**************************************************************************/
14
/**                                                                       */
15
/** GUIX Component                                                        */
16
/**                                                                       */
17
/**   System Management (System)                                          */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_system.h"
28
29
/**************************************************************************/
30
/*                                                                        */
31
/*  FUNCTION                                               RELEASE        */
32
/*                                                                        */
33
/*    _gx_system_event_send                               PORTABLE C      */
34
/*                                                           6.1.11       */
35
/*  AUTHOR                                                                */
36
/*                                                                        */
37
/*    Kenneth Maxwell, Microsoft Corporation                              */
38
/*                                                                        */
39
/*  DESCRIPTION                                                           */
40
/*                                                                        */
41
/*    This service sends the specified event for processing.              */
42
/*                                                                        */
43
/*  INPUT                                                                 */
44
/*                                                                        */
45
/*    event                                 Pointer to event              */
46
/*                                                                        */
47
/*  OUTPUT                                                                */
48
/*                                                                        */
49
/*    status                                Completion status             */
50
/*                                                                        */
51
/*  CALLS                                                                 */
52
/*                                                                        */
53
/*    GX_ABS                                Compute the absolute value    */
54
/*    tx_queue_send                         Send message through ThreadX  */
55
/*                                            queue                       */
56
/*    _gx_system_pen_speed_init             Initialize pen speed          */
57
/*    _gx_system_pen_speed_update           Update pen speed              */
58
/*    _gx_system_pen_flick_test             Check for pen flick event     */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    GUIX Application                                                    */
63
/*    GUIX Internal Code                                                  */
64
/*                                                                        */
65
/*  RELEASE HISTORY                                                       */
66
/*                                                                        */
67
/*    DATE              NAME                      DESCRIPTION             */
68
/*                                                                        */
69
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
70
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
71
/*                                            resulting in version 6.1    */
72
/*  04-25-2022     Ting Zhu                 Modified comment(s),          */
73
/*                                            improved logic,             */
74
/*                                            resulting in version 6.1.11 */
75
/*                                                                        */
76
/**************************************************************************/
77
159169
UINT  _gx_system_event_send(GX_EVENT *in_event)
78
{
79
159169
UINT       status = GX_SYSTEM_ERROR;
80
159169
GX_BOOL    check_send_flick = GX_FALSE;
81
159169
GX_WIDGET *target = GX_NULL;
82
83

159169
    switch (in_event -> gx_event_type)
84
    {
85
13409
    case GX_EVENT_PEN_DOWN:
86
13409
        _gx_system_pen_speed_init(&in_event -> gx_event_payload.gx_event_pointdata);
87
13409
        break;
88
89
6654
    case GX_EVENT_PEN_DRAG:
90
6654
        _gx_system_pen_speed_update(&in_event -> gx_event_payload.gx_event_pointdata);
91
6654
        break;
92
93
9300
    case GX_EVENT_PEN_UP:
94
9300
        check_send_flick = GX_TRUE;
95
96
9300
        if (_gx_system_capture_count > 0)
97
        {
98
            /* Get the widget that owns the system input.  */
99
3312
            target = *_gx_system_input_capture_stack;
100
        }
101
9300
        break;
102
    }
103
104
#ifdef GX_THREADX_BINDING
105
159169
    if (tx_queue_send(&_gx_system_event_queue, in_event, TX_NO_WAIT) ==
106
        TX_SUCCESS)
107
    {
108
109
159166
        status = GX_SUCCESS;
110
    }
111
#else
112
    GX_EVENT_PUSH(in_event);
113
#endif
114
115
159169
    if (check_send_flick)
116
    {
117
9300
        _gx_system_pen_flick_test(target);
118
    }
119
159169
    return status;
120
}
121