GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_system_event_remove.c Lines: 20 20 100.0 %
Date: 2024-12-05 08:52:37 Branches: 12 12 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
#include "gx_widget.h"
29
#include "gx_utility.h"
30
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_system_event_remove                             PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function removes events targetted to indicated widget          */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    remove                                Widget to be removed          */
49
/*                                                                        */
50
/*  OUTPUT                                                                */
51
/*                                                                        */
52
/*    None                                                                */
53
/*                                                                        */
54
/*  CALLS                                                                 */
55
/*                                                                        */
56
/*    _gx_widget_child_detect               Detect a child widget         */
57
/*                                                                        */
58
/*  CALLED BY                                                             */
59
/*                                                                        */
60
/*    _gx_widget_delete                     Delete a widget               */
61
/*                                                                        */
62
/*  RELEASE HISTORY                                                       */
63
/*                                                                        */
64
/*    DATE              NAME                      DESCRIPTION             */
65
/*                                                                        */
66
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
67
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
68
/*                                            resulting in version 6.1    */
69
/*                                                                        */
70
/**************************************************************************/
71
331
VOID  _gx_system_event_remove(GX_WIDGET *widget)
72
{
73
#ifdef GX_THREADX_BINDING
74
75
TX_INTERRUPT_SAVE_AREA
76
77
GX_EVENT *pEvent;
78
ULONG    *pSrc;
79
TX_QUEUE *pQueue;
80
GX_BOOL   Purge;
81
82
331
    TX_DISABLE
83
84
331
    pQueue = &_gx_system_event_queue;
85
86
331
    if (pQueue -> tx_queue_enqueued)
87
    {
88
79
        pSrc =  pQueue -> tx_queue_read;
89
90
        do
91
        {
92
2561
            pEvent = (GX_EVENT *)pSrc;
93
2561
            Purge = GX_FALSE;
94
95
2561
            if (pEvent -> gx_event_target)
96
            {
97
2540
                if (pEvent -> gx_event_target == widget)
98
                {
99
53
                    Purge = GX_TRUE;
100
                }
101
                else
102
                {
103
2487
                    _gx_widget_child_detect(widget, pEvent -> gx_event_target, &Purge);
104
                }
105
2540
                if (Purge)
106
                {
107
53
                    pEvent -> gx_event_target = GX_NULL;
108
53
                    pEvent -> gx_event_type = 0;
109
                }
110
            }
111
112
2561
            pSrc += pQueue -> tx_queue_message_size;
113
114
2561
            if (pSrc >= pQueue -> tx_queue_end)
115
            {
116
52
                pSrc = pQueue -> tx_queue_start;
117
            }
118
2561
        } while (pSrc != pQueue->tx_queue_write);
119
    }
120
331
    TX_RESTORE
121
#else
122
    GX_EVENT_PURGE(widget);
123
#endif
124
331
}
125