| 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 |  |  | /**   System Management (System)                                          */ | 
    
    | 18 |  |  | /**                                                                       */ | 
    
    | 19 |  |  | /**************************************************************************/ | 
    
    | 20 |  |  |  | 
    
    | 21 |  |  | #define GX_SOURCE_CODE | 
    
    | 22 |  |  |  | 
    
    | 23 |  |  |  | 
    
    | 24 |  |  | /* Include necessary system files.  */ | 
    
    | 25 |  |  |  | 
    
    | 26 |  |  | #include "gx_api.h" | 
    
    | 27 |  |  | #include "gx_system.h" | 
    
    | 28 |  |  | #include "gx_utility.h" | 
    
    | 29 |  |  | #include "gx_widget.h" | 
    
    | 30 |  |  |  | 
    
    | 31 |  |  |  | 
    
    | 32 |  |  | /**************************************************************************/ | 
    
    | 33 |  |  | /*                                                                        */ | 
    
    | 34 |  |  | /*  FUNCTION                                               RELEASE        */ | 
    
    | 35 |  |  | /*                                                                        */ | 
    
    | 36 |  |  | /*    _gx_system_root_view_add                            PORTABLE C      */ | 
    
    | 37 |  |  | /*                                                           6.1          */ | 
    
    | 38 |  |  | /*  AUTHOR                                                                */ | 
    
    | 39 |  |  | /*                                                                        */ | 
    
    | 40 |  |  | /*    Kenneth Maxwell, Microsoft Corporation                              */ | 
    
    | 41 |  |  | /*                                                                        */ | 
    
    | 42 |  |  | /*  DESCRIPTION                                                           */ | 
    
    | 43 |  |  | /*                                                                        */ | 
    
    | 44 |  |  | /*    Adds a view to a root window, checking to detect if the view is     */ | 
    
    | 45 |  |  | /*    obscured by a child window                                          */ | 
    
    | 46 |  |  | /*                                                                        */ | 
    
    | 47 |  |  | /*  INPUT                                                                 */ | 
    
    | 48 |  |  | /*                                                                        */ | 
    
    | 49 |  |  | /*    root                                  Root window that we want to   */ | 
    
    | 50 |  |  | /*                                            add the view to.            */ | 
    
    | 51 |  |  | /*    inrect                                Rectangle defining the view   */ | 
    
    | 52 |  |  | /*                                            that we want to add.        */ | 
    
    | 53 |  |  | /*                                                                        */ | 
    
    | 54 |  |  | /*  OUTPUT                                                                */ | 
    
    | 55 |  |  | /*                                                                        */ | 
    
    | 56 |  |  | /*    view is added to root window or split into smaller views.           */ | 
    
    | 57 |  |  | /*                                                                        */ | 
    
    | 58 |  |  | /*  CALLS                                                                 */ | 
    
    | 59 |  |  | /*                                                                        */ | 
    
    | 60 |  |  | /*    _gx_system_view_split                 Split a view                  */ | 
    
    | 61 |  |  | /*    _gx_system_view_add                   Add view to window            */ | 
    
    | 62 |  |  | /*    _gx_utility_rectangle_overlap_detect  Detect overlap of rectangles  */ | 
    
    | 63 |  |  | /*                                                                        */ | 
    
    | 64 |  |  | /*  CALLED BY                                                             */ | 
    
    | 65 |  |  | /*                                                                        */ | 
    
    | 66 |  |  | /*    GUIX Internal Code                                                  */ | 
    
    | 67 |  |  | /*                                                                        */ | 
    
    | 68 |  |  | /*  RELEASE HISTORY                                                       */ | 
    
    | 69 |  |  | /*                                                                        */ | 
    
    | 70 |  |  | /*    DATE              NAME                      DESCRIPTION             */ | 
    
    | 71 |  |  | /*                                                                        */ | 
    
    | 72 |  |  | /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */ | 
    
    | 73 |  |  | /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */ | 
    
    | 74 |  |  | /*                                            resulting in version 6.1    */ | 
    
    | 75 |  |  | /*                                                                        */ | 
    
    | 76 |  |  | /**************************************************************************/ | 
    
    | 77 |  | 7141 | VOID _gx_system_root_view_add(GX_WINDOW_ROOT *root, GX_RECTANGLE *inrect) | 
    
    | 78 |  |  | { | 
    
    | 79 |  |  | GX_RECTANGLE overlap; | 
    
    | 80 |  | 7141 | GX_WINDOW   *win = GX_NULL; | 
    
    | 81 |  |  | GX_WIDGET   *widget; | 
    
    | 82 |  |  |  | 
    
    | 83 |  |  |     /* pick up pointer to frontmost child window */ | 
    
    | 84 |  | 7141 |     widget = root -> gx_widget_last_child; | 
    
    | 85 |  |  |  | 
    
    | 86 | ✓✓ | 20949 |     while (widget) | 
    
    | 87 |  |  |     { | 
    
    | 88 | ✓✓ | 15957 |         if (widget -> gx_widget_type >= GX_TYPE_WINDOW && | 
    
    | 89 | ✓✓ | 15714 |             (widget -> gx_widget_status & GX_STATUS_VISIBLE)) | 
    
    | 90 |  |  |         { | 
    
    | 91 |  |  |             /* if this window is non-transparent, give it views */ | 
    
    | 92 | ✓✓ | 9239 |             if (!(widget -> gx_widget_status & GX_STATUS_TRANSPARENT)) | 
    
    | 93 |  |  |             { | 
    
    | 94 |  | 9018 |                 win = (GX_WINDOW *)widget; | 
    
    | 95 | ✓✓ | 9018 |                 if (_gx_utility_rectangle_overlap_detect(inrect, &win -> gx_widget_size, &overlap)) | 
    
    | 96 |  |  |                 { | 
    
    | 97 |  |  |                     /* split the viewport into pieces */ | 
    
    | 98 |  | 2149 |                     _gx_system_view_split(win, root, inrect); | 
    
    | 99 |  |  |  | 
    
    | 100 |  |  |                     /* add the overlap to the over window: */ | 
    
    | 101 |  | 2149 |                     _gx_system_view_add(win, &overlap); | 
    
    | 102 |  | 2149 |                     return; | 
    
    | 103 |  |  |                 } | 
    
    | 104 |  |  |             } | 
    
    | 105 |  |  |         } | 
    
    | 106 |  | 13808 |         widget = widget -> gx_widget_previous; | 
    
    | 107 |  |  |     } | 
    
    | 108 |  |  |  | 
    
    | 109 |  |  |     /* if we didn't split the view, then add it here */ | 
    
    | 110 |  | 4992 |     _gx_system_view_add((GX_WINDOW *)root, inrect); | 
    
    | 111 |  |  | } | 
    
    | 112 |  |  |  |