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 /**   Port Specific                                                       */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 /**************************************************************************/
22 /*                                                                        */
23 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
24 /*                                                                        */
25 /*    gx_api.h                                           Win32/Visual     */
26 /*                                                           6.0          */
27 /*  AUTHOR                                                                */
28 /*                                                                        */
29 /*    Kenneth Maxwell, Microsoft Corporation                              */
30 /*                                                                        */
31 /*  DESCRIPTION                                                           */
32 /*                                                                        */
33 /*    This file contains data type definitions and constants specific     */
34 /*    to the implementation of high-performance GUIX UI framework.        */
35 /*                                                                        */
36 /*  RELEASE HISTORY                                                       */
37 /*                                                                        */
38 /*    DATE              NAME                      DESCRIPTION             */
39 /*                                                                        */
40 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
41 /*                                                                        */
42 /**************************************************************************/
43 
44 #ifndef GX_PORT_H
45 #define GX_PORT_H
46 
47 /* define target for build */
48 #define GX_TARGET_WIN32
49 
50 /* Determine if the optional GUIX user define file should be used.  */
51 
52 #ifdef GX_INCLUDE_USER_DEFINE_FILE
53 
54 /* Include the user defines in gx_user.h. The defines in this file may
55    alternately be defined on the command line.  */
56 
57 #include "gx_user.h"
58 #endif
59 
60 
61 typedef INT           GX_BOOL;
62 
63 #if defined(GUIX_STUDIO)
64 
65 /* Define Win32 event thread create. */
66 #define GX_WIN32_EVENT_THREAD_CREATE(driver_data, thread_name)
67 
68 /* Define Win32 event thread exit. */
69 #define GX_WIN32_EVENT_THREAD_EXIT(code)                       ExitThread(code)
70 
71 #define GX_WIN32_DISPLAY_DRIVER_EXTRA_MEMBERS_DECLEARE \
72     GX_DISPLAY     *win32_display;                     \
73     GX_CANVAS      *win32_canvas;                      \
74     GX_WINDOW_ROOT *win32_root_win;                    \
75     GX_WIDGET     **win32_screens;                     \
76     INT             win32_screen_count;                \
77     INT             win32_display_index;               \
78     LONG            win32_window_xpos;                 \
79     LONG            win32_window_ypos;                 \
80     LONG            win32_guix_ThreadId;               \
81     LONG            win32_window_ThreadId;
82 
83 
84 typedef SHORT  GX_VALUE;
85 #define GX_UTF8_SUPPORT
86 #define GX_EXTENDED_UNICODE_SUPPORT
87 #define GX_SYNERGY_FONT_FORMAT_SUPPORT
88 #define GX_DISABLE_DEPRECATED_STRING_API
89 
90 #ifndef GX_FONT_KERNING_SUPPORT
91 #define GX_FONT_KERNING_SUPPORT
92 #endif
93 
94 #ifndef GX_DYNAMIC_BIDI_TEXT_SUPPORT
95 #define GX_DYNAMIC_BIDI_TEXT_SUPPORT
96 #endif
97 
98 #ifndef GX_DYNAMIC_ARABIC_SHAPING_SUPPORT
99 #define GX_DYNAMIC_ARABIC_SHAPING_SUPPORT
100 #endif
101 
102 #ifndef GX_THAI_GLYPH_SHAPING_SUPPORT
103 #define GX_THAI_GLYPH_SHAPING_SUPPORT
104 #endif
105 
106 #else
107 typedef SHORT  GX_VALUE;
108 #endif
109 
110 #define GX_VALUE_MAX   0x7FFF
111 
112 
113 /* For the win32 port, the entry point is WinMain, which is defined
114    in the win32 driver file.  The entry point for GUIX demo is gx_main(). */
115 #define main(a, b)                          gx_main(a, b)
116 
117 #define GX_WIDGET_USER_DATA
118 
119 /* Define the basic system parameters.  */
120 
121 #ifndef GX_THREAD_STACK_SIZE
122 #define GX_THREAD_STACK_SIZE                4096
123 #endif
124 
125 #ifndef GX_TICKS_SECOND
126 #define GX_TICKS_SECOND                     50
127 #endif
128 
129 
130 #define GX_CONST                            const
131 
132 #define GX_MAX_ACTIVE_TIMERS                32
133 
134 #define GX_MAX_VIEWS                        32
135 
136 #define GX_MAX_DISPLAY_HEIGHT               800
137 
138 /* Define several macros for the error checking shell in GUIX.  */
139 
140 #ifndef GX_DISABLE_THREADX_BINDING
141 
142 #ifndef TX_TIMER_PROCESS_IN_ISR
143 
144 #define GX_CALLER_CHECKING_EXTERNS          extern  TX_THREAD           *_tx_thread_current_ptr; \
145                                             extern  TX_THREAD           _tx_timer_thread; \
146                                             extern  volatile ULONG      _tx_thread_system_state;
147 
148 #define GX_THREADS_ONLY_CALLER_CHECKING     if ((_tx_thread_system_state) || \
149                                                 (_tx_thread_current_ptr == TX_NULL) || \
150                                                 (_tx_thread_current_ptr == &_tx_timer_thread)) \
151                                                 return(GX_CALLER_ERROR);
152 
153 #define GX_INIT_AND_THREADS_CALLER_CHECKING if (((_tx_thread_system_state) && (_tx_thread_system_state < ((ULONG) 0xF0F0F0F0))) || \
154                                                 (_tx_thread_current_ptr == &_tx_timer_thread)) \
155                                                 return(GX_CALLER_ERROR);
156 
157 
158 #define GX_NOT_ISR_CALLER_CHECKING          if ((_tx_thread_system_state) && (_tx_thread_system_state < ((ULONG) 0xF0F0F0F0))) \
159                                                 return(GX_CALLER_ERROR);
160 
161 #define GX_THREAD_WAIT_CALLER_CHECKING      if ((wait_option) && \
162                                                ((_tx_thread_current_ptr == NX_NULL) || (_tx_thread_system_state) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
163                                             return(GX_CALLER_ERROR);
164 
165 
166 #else
167 
168 
169 
170 #define GX_CALLER_CHECKING_EXTERNS          extern  TX_THREAD           *_tx_thread_current_ptr; \
171                                             extern  volatile ULONG      _tx_thread_system_state;
172 
173 #define GX_THREADS_ONLY_CALLER_CHECKING     if ((_tx_thread_system_state) || \
174                                                 (_tx_thread_current_ptr == TX_NULL)) \
175                                                 return(GX_CALLER_ERROR);
176 
177 #define GX_INIT_AND_THREADS_CALLER_CHECKING if (((_tx_thread_system_state) && (_tx_thread_system_state < ((ULONG) 0xF0F0F0F0)))) \
178                                                 return(GX_CALLER_ERROR);
179 
180 #define GX_NOT_ISR_CALLER_CHECKING          if ((_tx_thread_system_state) && (_tx_thread_system_state < ((ULONG) 0xF0F0F0F0))) \
181                                                 return(GX_CALLER_ERROR);
182 
183 #define GX_THREAD_WAIT_CALLER_CHECKING      if ((wait_option) && \
184                                                ((_tx_thread_current_ptr == NX_NULL) || (_tx_thread_system_state))) \
185                                             return(GX_CALLER_ERROR);
186 
187 #endif
188 
189 #else
190 #define GX_CALLER_CHECKING_EXTERNS
191 #define GX_THREADS_ONLY_CALLER_CHECKING
192 #define GX_INIT_AND_THREADS_CALLER_CHECKING
193 #define GX_NOT_ISR_CALLER_CHECKING
194 #define GX_THREAD_WAIT_CALLER_CHECKING
195 #endif
196 
197 /* Define the version ID of GUIX.  This may be utilized by the application.  */
198 
199 #ifdef GX_SYSTEM_INIT
200 CHAR _gx_version_id[] =
201     "Copyright (c) 1996-2015 Express Logic Inc. * GUIX Win32/Visual C/C++ Version G5.2.6.5.4 SN: GUIX_Studio_Distribution *";
202 #else
203 extern  CHAR _gx_version_id[];
204 #endif
205 
206 #endif
207 
208 
209