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_dirty_list_remove                        PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function removes a widget from the dirty list.                 */
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_system_dirty_list_remove          Remove widget from dirty list */
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 /**************************************************************************/
_gx_system_dirty_list_remove(GX_WIDGET * remove)71 VOID  _gx_system_dirty_list_remove(GX_WIDGET *remove)
72 {
73 GX_CANVAS     *canvas;
74 GX_DIRTY_AREA *dirty_entry;
75 UINT           index;
76 
77     /* pick up pointer to canvas */
78 
79     canvas = _gx_system_canvas_created_list;
80 
81     while (canvas)
82     {
83         /* Setup pointer to dirty list.  */
84 
85         dirty_entry = canvas -> gx_canvas_dirty_list;
86 
87         /* Check to see if widget already has an entry.  */
88         for (index = 0; index < canvas -> gx_canvas_dirty_count; index++)
89         {
90             /* Is the same widget is present. */
91             if (dirty_entry -> gx_dirty_area_widget)
92             {
93                 if (dirty_entry -> gx_dirty_area_widget == remove)
94                 {
95                     dirty_entry -> gx_dirty_area_widget = GX_NULL;
96                 }
97                 /* No need to test for the dirty list entry being a child of the widget being deleted,
98                    since child widgets are always deleted before the parent.
99                 */
100             }
101             dirty_entry++;
102         }
103         canvas = canvas -> gx_canvas_created_next;
104     }
105 }
106 
107