1 
2 /***************************************************************************
3  * Copyright (c) 2024 Microsoft Corporation
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 /**   Dispaly Management (Dispaly)                                        */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_display.h"
29 #include "gx_canvas.h"
30 
31 #if defined(GX_MOUSE_SUPPORT)
32 #if !defined(GX_HARDWARE_MOUSE_SUPPORT)
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gx_display_driver_generic_mouse_enable             PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This service sets the mouse status for software mouse support.      */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    display                               Display control block         */
50 /*    enable                                Mouse status                  */
51 /*                                                                        */
52 /*  OUTPUT                                                                */
53 /*                                                                        */
54 /*  CALLS                                                                 */
55 /*                                                                        */
56 /*                                                                        */
57 /*  CALLED BY                                                             */
58 /*                                                                        */
59 /*    Application Code                                                    */
60 /*                                                                        */
61 /*  RELEASE HISTORY                                                       */
62 /*                                                                        */
63 /*    DATE              NAME                      DESCRIPTION             */
64 /*                                                                        */
65 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
66 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
67 /*                                            resulting in version 6.1    */
68 /*                                                                        */
69 /**************************************************************************/
_gx_display_driver_generic_mouse_enable(GX_DISPLAY * display,GX_BOOL enable)70 VOID _gx_display_driver_generic_mouse_enable(GX_DISPLAY *display, GX_BOOL enable)
71 {
72     if (enable)
73     {
74         if (!(display -> gx_display_mouse.gx_mouse_status & GX_MOUSE_ENABLED))
75         {
76             display -> gx_display_mouse.gx_mouse_status |= GX_MOUSE_ENABLED;
77 
78             /* reset to current position to force redraw */
79             display -> gx_display_mouse_position_set(display, &display -> gx_display_mouse.gx_mouse_position);
80         }
81     }
82     else
83     {
84         if (display -> gx_display_mouse.gx_mouse_status & GX_MOUSE_ENABLED)
85         {
86             display -> gx_display_mouse.gx_mouse_status &= (GX_UBYTE)(~GX_MOUSE_ENABLED);
87 
88             if (display -> gx_display_mouse.gx_mouse_status & GX_MOUSE_VISIBLE)
89             {
90                 display -> gx_display_mouse_restore(display);
91             }
92         }
93     }
94 }
95 #endif
96 #endif
97 
98