1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 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 /* RELEASE HISTORY */ 68 /* */ 69 /* DATE NAME DESCRIPTION */ 70 /* */ 71 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 72 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 73 /* resulting in version 6.1 */ 74 /* */ 75 /**************************************************************************/ 76 _gx_system_input_capture(GX_WIDGET * owner)77UINT _gx_system_input_capture(GX_WIDGET *owner) 78 { 79 GX_WIDGET **stackptr; 80 UINT status = GX_SUCCESS; 81 82 GX_ENTER_CRITICAL 83 if (_gx_system_capture_count < GX_MAX_INPUT_CAPTURE_NESTING) 84 { 85 if (!(owner -> gx_widget_status & GX_STATUS_OWNS_INPUT)) 86 { 87 stackptr = _gx_system_input_capture_stack + _gx_system_capture_count; 88 *stackptr = owner; 89 _gx_widget_status_add(owner, GX_STATUS_OWNS_INPUT); 90 _gx_system_capture_count++; 91 _gx_system_input_owner = owner; 92 } 93 else 94 { 95 status = GX_NO_CHANGE; 96 } 97 } 98 else 99 { 100 status = GX_INPUT_CAPTURE_NESTING_EXCEEDED; 101 } 102 103 GX_EXIT_CRITICAL 104 return status; 105 } 106 107