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_utility.h" 29 #include "gx_system.h" 30 31 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _gx_system_top_root_find PORTABLE C */ 37 /* 6.1 */ 38 /* AUTHOR */ 39 /* */ 40 /* Kenneth Maxwell, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This function finds the top root window for a given incoming event. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* in_event Pointer to event */ 49 /* */ 50 /* OUTPUT */ 51 /* */ 52 /* GX_WINDOW_ROOT Pointer to found root window */ 53 /* */ 54 /* CALLS */ 55 /* */ 56 /* _gx_utility_rectangle_shift Shift a rectangle */ 57 /* _gx_utility_rectangle_point_detect Detect point in rectangle */ 58 /* */ 59 /* CALLED BY */ 60 /* */ 61 /* _gx_system_event_dispatch Dispatch GUIX event */ 62 /* */ 63 /* RELEASE HISTORY */ 64 /* */ 65 /* DATE NAME DESCRIPTION */ 66 /* */ 67 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 68 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 69 /* resulting in version 6.1 */ 70 /* */ 71 /**************************************************************************/ _gx_system_top_root_find(GX_EVENT * in_event)72GX_WINDOW_ROOT *_gx_system_top_root_find(GX_EVENT *in_event) 73 { 74 GX_WINDOW_ROOT *root = _gx_system_root_window_created_list; 75 GX_RECTANGLE testsize; 76 77 /* Loop through the widgets in reverse order. */ 78 while (root) 79 { 80 if (root -> gx_widget_status & GX_STATUS_VISIBLE) 81 { 82 if (in_event -> gx_event_display_handle == (ULONG)(root -> gx_window_root_canvas -> gx_canvas_display -> gx_display_driver_data)) 83 { 84 /* get the root window size */ 85 testsize = root -> gx_widget_size; 86 87 /* offset the size by the canvas offset */ 88 _gx_utility_rectangle_shift(&testsize, 89 root -> gx_window_root_canvas -> gx_canvas_display_offset_x, 90 root -> gx_window_root_canvas -> gx_canvas_display_offset_y); 91 92 /* Is the point in this widget? */ 93 if (_gx_utility_rectangle_point_detect(&testsize, in_event -> gx_event_payload.gx_event_pointdata)) 94 { 95 break; 96 } 97 } 98 } 99 100 /* Move to the next root window. */ 101 root = (GX_WINDOW_ROOT *)root -> gx_widget_next; 102 } 103 104 /* Return the root widget. */ 105 return(root); 106 } 107 108