GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_multi_line_text_input_home.c Lines: 14 14 100.0 %
Date: 2026-03-06 19:21:09 Branches: 4 4 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
/**   Multi Line Text Input                                               */
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_multi_line_text_input.h"
30
#include "gx_multi_line_text_view.h"
31
#include "gx_text_input_cursor.h"
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_multi_line_text_input_home                      PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function move the cursor to the position                       */
46
/*    before the first character.                                         */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    text_input                            Multi line text input         */
51
/*                                            control block               */
52
/*                                                                        */
53
/*  OUTPUT                                                                */
54
/*                                                                        */
55
/*    None                                                                */
56
/*                                                                        */
57
/*  CALLS                                                                 */
58
/*                                                                        */
59
/*    _gx_multi_line_text_input_cursor_pos_calculate                      */
60
/*                                          Calculate cursor position     */
61
/*                                            according to click point    */
62
/*    _gx_multi_line_text_input_cursor_rectangle_define                   */
63
/*                                          Define a rectangle for the    */
64
/*                                            cursor                      */
65
/*    _gx_system_dirty_partial_add          Add one dirty area to         */
66
/*                                            dirty list                  */
67
/*                                                                        */
68
/*  CALLED BY                                                             */
69
/*                                                                        */
70
/*    _gx_multi_line_text_input_keydown_process                           */
71
/*                                                                        */
72
/**************************************************************************/
73
269
UINT _gx_multi_line_text_input_home(GX_MULTI_LINE_TEXT_INPUT *text_input)
74
{
75
269
GX_TEXT_INPUT_CURSOR *cursor_ptr = &text_input -> gx_multi_line_text_input_cursor_instance;
76
GX_POINT              cur_pos;
77
GX_RECTANGLE          cur_rect;
78
79
269
    if (text_input -> gx_multi_line_text_input_start_mark != text_input -> gx_multi_line_text_input_end_mark)
80
    {
81
70
        _gx_multi_line_text_input_left_arrow(text_input);
82
    }
83
84
269
    cur_pos = cursor_ptr -> gx_text_input_cursor_pos;
85
86
269
    _gx_text_input_cursor_dirty_rectangle_get(&text_input -> gx_multi_line_text_input_cursor_instance, &cur_rect);
87
88
269
    cur_pos.gx_point_x = (GX_VALUE)(text_input -> gx_window_client.gx_rectangle_left +
89
269
                                    text_input -> gx_multi_line_text_view_whitespace);
90
91
    /* Calculate new cursor position. */
92
269
    _gx_multi_line_text_input_cursor_pos_calculate(text_input, cur_pos);
93
94
269
    if (cur_rect.gx_rectangle_left != cursor_ptr -> gx_text_input_cursor_pos.gx_point_x)
95
    {
96
        /* Mark old cursor rectangle dirty. */
97
102
        _gx_system_dirty_partial_add((GX_WIDGET *)text_input, &cur_rect);
98
99
        /* Mark new cursor rectangle dirty. */
100
102
        _gx_text_input_cursor_dirty_rectangle_get(&text_input -> gx_multi_line_text_input_cursor_instance, &cur_rect);
101
102
        _gx_system_dirty_partial_add((GX_WIDGET *)text_input, &cur_rect);
102
    }
103
104
269
    return GX_SUCCESS;
105
}
106