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_capture PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* Temporarily direct all input events to specified widget */ |
45 |
|
|
/* */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* ownert Widget that wants to own */ |
50 |
|
|
/* input events */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* widget added to capture stack */ |
55 |
|
|
/* widget receives GX_STATUS_OWNS_INPUT */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* _GX_ENTER_CRITICAL Enter critical section */ |
60 |
|
|
/* _gx_widget_status_add Add status flag to the widget */ |
61 |
|
|
/* _GX_EXIT_CRITICAL Exit critical section */ |
62 |
|
|
/* */ |
63 |
|
|
/* CALLED BY */ |
64 |
|
|
/* */ |
65 |
|
|
/* GUIX Internal Code */ |
66 |
|
|
/* */ |
67 |
|
|
/**************************************************************************/ |
68 |
|
|
|
69 |
|
4977 |
UINT _gx_system_input_capture(GX_WIDGET *owner) |
70 |
|
|
{ |
71 |
|
|
GX_WIDGET **stackptr; |
72 |
|
4977 |
UINT status = GX_SUCCESS; |
73 |
|
|
|
74 |
|
4977 |
GX_ENTER_CRITICAL |
75 |
✓✓ |
4977 |
if (_gx_system_capture_count < GX_MAX_INPUT_CAPTURE_NESTING) |
76 |
|
|
{ |
77 |
✓✓ |
4931 |
if (!(owner -> gx_widget_status & GX_STATUS_OWNS_INPUT)) |
78 |
|
|
{ |
79 |
|
3815 |
stackptr = _gx_system_input_capture_stack + _gx_system_capture_count; |
80 |
|
3815 |
*stackptr = owner; |
81 |
|
3815 |
_gx_widget_status_add(owner, GX_STATUS_OWNS_INPUT); |
82 |
|
3815 |
_gx_system_capture_count++; |
83 |
|
3815 |
_gx_system_input_owner = owner; |
84 |
|
|
} |
85 |
|
|
else |
86 |
|
|
{ |
87 |
|
1116 |
status = GX_NO_CHANGE; |
88 |
|
|
} |
89 |
|
|
} |
90 |
|
|
else |
91 |
|
|
{ |
92 |
|
46 |
status = GX_INPUT_CAPTURE_NESTING_EXCEEDED; |
93 |
|
|
} |
94 |
|
|
|
95 |
|
4977 |
GX_EXIT_CRITICAL |
96 |
|
4977 |
return status; |
97 |
|
|
} |
98 |
|
|
|