GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_system_root_view_add.c Lines: 14 14 100.0 %
Date: 2026-03-06 19:21:09 Branches: 10 10 100.0 %

Line Branch Exec Source
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_utility.h"
30
#include "gx_widget.h"
31
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_system_root_view_add                            PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    Adds a view to a root window, checking to detect if the view is     */
46
/*    obscured by a child window                                          */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    root                                  Root window that we want to   */
51
/*                                            add the view to.            */
52
/*    inrect                                Rectangle defining the view   */
53
/*                                            that we want to add.        */
54
/*                                                                        */
55
/*  OUTPUT                                                                */
56
/*                                                                        */
57
/*    view is added to root window or split into smaller views.           */
58
/*                                                                        */
59
/*  CALLS                                                                 */
60
/*                                                                        */
61
/*    _gx_system_view_split                 Split a view                  */
62
/*    _gx_system_view_add                   Add view to window            */
63
/*    _gx_utility_rectangle_overlap_detect  Detect overlap of rectangles  */
64
/*                                                                        */
65
/*  CALLED BY                                                             */
66
/*                                                                        */
67
/*    GUIX Internal Code                                                  */
68
/*                                                                        */
69
/**************************************************************************/
70
7141
VOID _gx_system_root_view_add(GX_WINDOW_ROOT *root, GX_RECTANGLE *inrect)
71
{
72
GX_RECTANGLE overlap;
73
7141
GX_WINDOW   *win = GX_NULL;
74
GX_WIDGET   *widget;
75
76
    /* pick up pointer to frontmost child window */
77
7141
    widget = root -> gx_widget_last_child;
78
79
20949
    while (widget)
80
    {
81
15957
        if (widget -> gx_widget_type >= GX_TYPE_WINDOW &&
82
15714
            (widget -> gx_widget_status & GX_STATUS_VISIBLE))
83
        {
84
            /* if this window is non-transparent, give it views */
85
9239
            if (!(widget -> gx_widget_status & GX_STATUS_TRANSPARENT))
86
            {
87
9018
                win = (GX_WINDOW *)widget;
88
9018
                if (_gx_utility_rectangle_overlap_detect(inrect, &win -> gx_widget_size, &overlap))
89
                {
90
                    /* split the viewport into pieces */
91
2149
                    _gx_system_view_split(win, root, inrect);
92
93
                    /* add the overlap to the over window: */
94
2149
                    _gx_system_view_add(win, &overlap);
95
2149
                    return;
96
                }
97
            }
98
        }
99
13808
        widget = widget -> gx_widget_previous;
100
    }
101
102
    /* if we didn't split the view, then add it here */
103
4992
    _gx_system_view_add((GX_WINDOW *)root, inrect);
104
}
105