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_display.h"
28 
29 /* Bring in externs for caller checking code.  */
30 GX_CALLER_CHECKING_EXTERNS
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gxe_display_create                                 PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function checks for errors in the display create function      */
45 /*    call.                                                               */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    display                               Display control block         */
50 /*    name                                  Name of display               */
51 /*    display_driver_setup                  Display driver setup function */
52 /*    width                                 Display width in pixels       */
53 /*    height                                Display height in pixels      */
54 /*    display_control_block_size            Size of the display control   */
55 /*                                            block                       */
56 /*                                                                        */
57 /*  OUTPUT                                                                */
58 /*                                                                        */
59 /*    status                                Completion status             */
60 /*                                                                        */
61 /*  CALLS                                                                 */
62 /*                                                                        */
63 /*    _gx_display_create                    Actual display create         */
64 /*                                            function                    */
65 /*                                                                        */
66 /*  CALLED BY                                                             */
67 /*                                                                        */
68 /*    Application Code                                                    */
69 /*                                                                        */
70 /*  RELEASE HISTORY                                                       */
71 /*                                                                        */
72 /*    DATE              NAME                      DESCRIPTION             */
73 /*                                                                        */
74 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
75 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
76 /*                                            resulting in version 6.1    */
77 /*                                                                        */
78 /**************************************************************************/
_gxe_display_create(GX_DISPLAY * display,GX_CONST GX_CHAR * name,UINT (* display_driver_setup)(GX_DISPLAY *),GX_VALUE width,GX_VALUE height,UINT display_control_block_size)79 UINT  _gxe_display_create(GX_DISPLAY *display, GX_CONST GX_CHAR *name,
80                           UINT (*display_driver_setup)(GX_DISPLAY *),
81                           GX_VALUE width, GX_VALUE height, UINT display_control_block_size)
82 {
83 UINT status;
84 
85     /* Check for appropriate caller.  */
86     GX_INIT_AND_THREADS_CALLER_CHECKING
87 
88     /* Check for invalid input pointers.  */
89     if ((display == GX_NULL) || (display_driver_setup == GX_NULL))
90     {
91         return(GX_PTR_ERROR);
92     }
93 
94     if (display_control_block_size != sizeof(GX_DISPLAY))
95     {
96         return(GX_INVALID_SIZE);
97     }
98 
99     if (display -> gx_display_id == GX_DISPLAY_ID)
100     {
101         return (GX_ALREADY_CREATED);
102     }
103 
104     /* Call actual window create function.  */
105     status = _gx_display_create(display, name, display_driver_setup, width, height);
106 
107     /* Return completion status.  */
108     return(status);
109 }
110 
111