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 |
|
|
/** Window Management (Window) */ |
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 |
|
|
#include "gx_window.h" |
31 |
|
|
#include "gx_canvas.h" |
32 |
|
|
#include "gx_utility.h" |
33 |
|
|
|
34 |
|
|
|
35 |
|
|
/**************************************************************************/ |
36 |
|
|
/* */ |
37 |
|
|
/* FUNCTION RELEASE */ |
38 |
|
|
/* */ |
39 |
|
|
/* _gx_window_root_event_process PORTABLE C */ |
40 |
|
|
/* 6.1 */ |
41 |
|
|
/* AUTHOR */ |
42 |
|
|
/* */ |
43 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
44 |
|
|
/* */ |
45 |
|
|
/* DESCRIPTION */ |
46 |
|
|
/* */ |
47 |
|
|
/* This function processes events for the specified root window. */ |
48 |
|
|
/* */ |
49 |
|
|
/* INPUT */ |
50 |
|
|
/* */ |
51 |
|
|
/* widget Window's widget control block */ |
52 |
|
|
/* event_ptr Incoming event to process */ |
53 |
|
|
/* */ |
54 |
|
|
/* OUTPUT */ |
55 |
|
|
/* */ |
56 |
|
|
/* status Completion status */ |
57 |
|
|
/* */ |
58 |
|
|
/* CALLS */ |
59 |
|
|
/* */ |
60 |
|
|
/* _gx_canvas_shift Shift the canvas */ |
61 |
|
|
/* _gx_window_event_process Call widget event processing */ |
62 |
|
|
/* */ |
63 |
|
|
/* CALLED BY */ |
64 |
|
|
/* */ |
65 |
|
|
/* GUIX Internal Code */ |
66 |
|
|
/* */ |
67 |
|
|
/**************************************************************************/ |
68 |
|
14071 |
UINT _gx_window_root_event_process(GX_WINDOW_ROOT *win, GX_EVENT *event_ptr) |
69 |
|
|
{ |
70 |
|
|
UINT status; |
71 |
|
|
GX_VALUE xShift; |
72 |
|
|
GX_VALUE yShift; |
73 |
|
|
|
74 |
|
14071 |
status = GX_SUCCESS; |
75 |
|
|
|
76 |
|
|
/* Process relative to the type of event. */ |
77 |
✓✓ |
14071 |
switch (event_ptr -> gx_event_type) |
78 |
|
|
{ |
79 |
|
151 |
case GX_EVENT_PEN_DRAG: |
80 |
✓✓ |
151 |
if (win -> gx_window_move_mode) |
81 |
|
|
{ |
82 |
|
|
/* to move a root window we have to move the canvas. Calculate |
83 |
|
|
the x,y shift amounts |
84 |
|
|
*/ |
85 |
|
10 |
xShift = (GX_VALUE)(event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_x - |
86 |
|
10 |
win -> gx_window_move_start.gx_point_x); |
87 |
|
10 |
yShift = (GX_VALUE)(event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_y - |
88 |
|
10 |
win -> gx_window_move_start.gx_point_y); |
89 |
|
|
|
90 |
|
|
/* reset the starting point for next time */ |
91 |
|
10 |
win -> gx_window_move_start.gx_point_x = |
92 |
|
10 |
(GX_VALUE)(event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_x - xShift); |
93 |
|
10 |
win -> gx_window_move_start.gx_point_y = |
94 |
|
10 |
(GX_VALUE)(event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_y - yShift); |
95 |
|
|
|
96 |
|
|
/* move the canvas */ |
97 |
|
10 |
_gx_canvas_shift(win -> gx_window_root_canvas, xShift, yShift); |
98 |
|
|
} |
99 |
|
151 |
return(GX_SUCCESS); |
100 |
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
13920 |
default: |
104 |
|
|
|
105 |
|
|
/* Call the window default processing function. */ |
106 |
|
13920 |
status = _gx_window_event_process((GX_WINDOW *)win, event_ptr); |
107 |
|
|
} |
108 |
|
|
/* Return widget event processing status. */ |
109 |
|
13920 |
return(status); |
110 |
|
|
} |
111 |
|
|
|