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