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 |
|
|
/** Display Management (Display) */ |
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_display.h" |
29 |
|
|
|
30 |
|
|
|
31 |
|
|
/**************************************************************************/ |
32 |
|
|
/* */ |
33 |
|
|
/* FUNCTION RELEASE */ |
34 |
|
|
/* */ |
35 |
|
|
/* _gx_display_delete PORTABLE C */ |
36 |
|
|
/* 6.1 */ |
37 |
|
|
/* AUTHOR */ |
38 |
|
|
/* */ |
39 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
40 |
|
|
/* */ |
41 |
|
|
/* DESCRIPTION */ |
42 |
|
|
/* */ |
43 |
|
|
/* This function deletes a previous-created display */ |
44 |
|
|
/* */ |
45 |
|
|
/* INPUT */ |
46 |
|
|
/* */ |
47 |
|
|
/* display Display control block */ |
48 |
|
|
/* display_driver_cleanup Display driver cleanup routine*/ |
49 |
|
|
/* */ |
50 |
|
|
/* OUTPUT */ |
51 |
|
|
/* */ |
52 |
|
|
/* status Completion status */ |
53 |
|
|
/* */ |
54 |
|
|
/* CALLS */ |
55 |
|
|
/* */ |
56 |
|
|
/* [display_driver_cleanup] Call the user-supplied */ |
57 |
|
|
/* display driver cleanup */ |
58 |
|
|
/* routine */ |
59 |
|
|
/* memset Cleanup the memory */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* Application 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 |
|
|
/* */ |
73 |
|
|
/**************************************************************************/ |
74 |
|
9 |
UINT _gx_display_delete(GX_DISPLAY *display, VOID (*display_driver_cleanup)(GX_DISPLAY *)) |
75 |
|
|
{ |
76 |
|
|
GX_DISPLAY *previous_display; |
77 |
|
|
|
78 |
✓✓ |
9 |
if (_gx_system_display_created_count > 0) |
79 |
|
|
{ |
80 |
|
8 |
display_driver_cleanup(display); |
81 |
|
8 |
_gx_system_display_created_count--; |
82 |
|
|
|
83 |
✓✓ |
8 |
if (display -> gx_display_created_previous) |
84 |
|
|
{ |
85 |
|
|
/* this is not first display, unlink it: */ |
86 |
|
|
|
87 |
|
2 |
previous_display = display -> gx_display_created_previous; |
88 |
|
2 |
previous_display -> gx_display_created_next = display -> gx_display_created_next; |
89 |
|
|
|
90 |
✓✓ |
2 |
if (display -> gx_display_created_next) |
91 |
|
|
{ |
92 |
|
1 |
display -> gx_display_created_next -> gx_display_created_previous = previous_display; |
93 |
|
|
} |
94 |
|
|
} |
95 |
|
|
else |
96 |
|
|
{ |
97 |
|
|
/* this is the first display, unlink it */ |
98 |
|
6 |
_gx_system_display_created_list = display -> gx_display_created_next; |
99 |
|
|
|
100 |
✓✓ |
6 |
if (_gx_system_display_created_list) |
101 |
|
|
{ |
102 |
|
1 |
_gx_system_display_created_list -> gx_display_created_previous = GX_NULL; |
103 |
|
|
} |
104 |
|
|
} |
105 |
|
8 |
memset(display, 0, sizeof(GX_DISPLAY)); |
106 |
|
|
|
107 |
|
|
/* Return successful status. */ |
108 |
|
8 |
return(GX_SUCCESS); |
109 |
|
|
} |
110 |
|
1 |
return GX_FAILURE; |
111 |
|
|
} |
112 |
|
|
|