1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** GUIX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** System Management (System) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_system.h" |
29 |
|
|
#include "gx_widget.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gx_system_input_release PORTABLE C */ |
37 |
|
|
/* 6.2.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* Release previously captured input events */ |
45 |
|
|
/* */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* owner Widget that releases input */ |
50 |
|
|
/* */ |
51 |
|
|
/* OUTPUT */ |
52 |
|
|
/* */ |
53 |
|
|
/* status Return status */ |
54 |
|
|
/* */ |
55 |
|
|
/* CALLS */ |
56 |
|
|
/* */ |
57 |
|
|
/* _GX_ENTER_CRITICAL Enter critical section */ |
58 |
|
|
/* _gx_widget_status_remove Remove a flag from the widget */ |
59 |
|
|
/* _GX_EXIT_CRITICAL Exit critical section */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* GUIX Internal Code */ |
64 |
|
|
/* */ |
65 |
|
|
/**************************************************************************/ |
66 |
|
|
|
67 |
|
3762 |
UINT _gx_system_input_release(GX_WIDGET *owner) |
68 |
|
|
{ |
69 |
|
3762 |
UINT status = GX_PTR_ERROR; |
70 |
|
|
GX_WIDGET **stack; |
71 |
|
|
INT current; |
72 |
|
|
INT top; |
73 |
|
|
|
74 |
|
3762 |
GX_ENTER_CRITICAL |
75 |
✓✓ |
3762 |
if (_gx_system_capture_count > 0) |
76 |
|
|
{ |
77 |
✓✓ |
3755 |
if (owner -> gx_widget_status & GX_STATUS_OWNS_INPUT) |
78 |
|
|
{ |
79 |
|
3754 |
stack = _gx_system_input_capture_stack; |
80 |
|
3754 |
top = _gx_system_capture_count - 1; |
81 |
|
3754 |
current = 0; |
82 |
|
|
|
83 |
✓✓ |
3755 |
while (current <= top) |
84 |
|
|
{ |
85 |
✓✓ |
3754 |
if (stack[current] == owner) |
86 |
|
|
{ |
87 |
|
3753 |
_gx_widget_status_remove(owner, GX_STATUS_OWNS_INPUT); |
88 |
|
3753 |
_gx_system_capture_count--; |
89 |
|
3753 |
status = GX_SUCCESS; |
90 |
|
3753 |
break; |
91 |
|
|
} |
92 |
|
1 |
current++; |
93 |
|
|
} |
94 |
|
|
|
95 |
✓✓ |
3754 |
if (status == GX_SUCCESS) |
96 |
|
|
{ |
97 |
|
|
/* collapse the stack if this entry was in the middle */ |
98 |
✓✓ |
3871 |
while (current < top) |
99 |
|
|
{ |
100 |
|
118 |
stack[current] = stack[current + 1]; |
101 |
|
118 |
current++; |
102 |
|
|
} |
103 |
|
3753 |
stack[current] = GX_NULL; |
104 |
|
|
|
105 |
✓✓ |
3753 |
if (top > 0) |
106 |
|
|
{ |
107 |
|
118 |
_gx_system_input_owner = stack[top - 1]; |
108 |
|
|
} |
109 |
|
|
else |
110 |
|
|
{ |
111 |
|
3635 |
_gx_system_input_owner = GX_NULL; |
112 |
|
|
} |
113 |
|
|
} |
114 |
|
|
} |
115 |
|
|
else |
116 |
|
|
{ |
117 |
|
1 |
status = GX_NO_CHANGE; |
118 |
|
|
} |
119 |
|
|
} |
120 |
|
|
else |
121 |
|
|
{ |
122 |
|
7 |
status = GX_NO_CHANGE; |
123 |
|
|
} |
124 |
|
|
|
125 |
|
3762 |
GX_EXIT_CRITICAL |
126 |
|
3762 |
return status; |
127 |
|
|
} |
128 |
|
|
|