Squashed commit of the following:
include/nuttx/nx/nxcursor.h: Add a header file descrbing the implementation of an NX cursor interface. There is no implementation in place yet. include/nuttx/video/cursor.h: Separate out cursor definitions from fb.h. Other graphic interfaces other than a framebuffer may support a cursor, possible a software cursor.
This commit is contained in:
parent
90ece2d917
commit
04b723e447
@ -160,12 +160,12 @@ static const struct fb_planeinfo_s g_planeinfo =
|
||||
/* Current cursor position */
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSOR
|
||||
static struct fb_cursorpos_s g_cpos;
|
||||
static struct cursor_pos_s g_cpos;
|
||||
|
||||
/* Current cursor size */
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSORSIZE
|
||||
static struct fb_cursorsize_s g_csize;
|
||||
static struct cursor_size_s g_csize;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -147,12 +147,12 @@ static const struct fb_planeinfo_s g_planeinfo =
|
||||
/* Current cursor position */
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSOR
|
||||
static struct fb_cursorpos_s g_cpos;
|
||||
static struct cursor_pos_s g_cpos;
|
||||
|
||||
/* Current cursor size */
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSORSIZE
|
||||
static struct fb_cursorsize_s g_csize;
|
||||
static struct cursor_size_s g_csize;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -645,9 +645,9 @@ struct sam_lcdc_s
|
||||
struct sam_layer_s layer[LCDC_NLAYERS];
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSOR
|
||||
struct fb_cursorpos_s cpos; /* Current cursor position */
|
||||
struct cursor_pos_s cpos; /* Current cursor position */
|
||||
#ifdef CONFIG_FB_HWCURSORSIZE
|
||||
struct fb_cursorsize_s csize; /* Current cursor size */
|
||||
struct cursor_size_s csize; /* Current cursor size */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -152,12 +152,12 @@ static struct fb_planeinfo_s g_planeinfo;
|
||||
/* Current cursor position */
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSOR
|
||||
static struct fb_cursorpos_s g_cpos;
|
||||
static struct cursor_pos_s g_cpos;
|
||||
|
||||
/* Current cursor size */
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSORSIZE
|
||||
static struct fb_cursorsize_s g_csize;
|
||||
static struct cursor_size_s g_csize;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -19,6 +19,10 @@ menuconfig LCD
|
||||
|
||||
if LCD
|
||||
|
||||
config LCD_HWCURSOR
|
||||
bool
|
||||
default n
|
||||
|
||||
config LCD_PACKEDMSFIRST
|
||||
bool
|
||||
default n
|
||||
|
@ -68,6 +68,28 @@ config NX_RAMBACKED
|
||||
NOTE: A significant amount of RAM, usually external SDRAM, may be
|
||||
required to use per-window framebuffers.
|
||||
|
||||
choice
|
||||
prompt "Cursor support"
|
||||
default NX_NOCURSOR
|
||||
|
||||
config NX_NOCURSOR
|
||||
bool "No cursor support"
|
||||
|
||||
config NX_SWCURSOR
|
||||
bool "Software cursor support"
|
||||
depends on NX_RAMBACKED && EXPERIMENTAL
|
||||
|
||||
config NX_HWCURSOR
|
||||
bool "Software cursor support"
|
||||
depends on (FB_HWCURSOR || LCD_HWCURSOR) && EXPERIMENTAL
|
||||
|
||||
endchoice # Cursor support
|
||||
|
||||
config NX_HWCURSORIMAGE
|
||||
bool "Support cursor images"
|
||||
default n
|
||||
depends on NX_HWCURSOR
|
||||
|
||||
config NX_BGCOLOR
|
||||
hex "Initial background color"
|
||||
default 0x0
|
||||
|
@ -132,12 +132,12 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable,
|
||||
/* Current cursor position */
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSOR
|
||||
static struct fb_cursorpos_s g_cpos;
|
||||
static struct cursor_pos_s g_cpos;
|
||||
|
||||
/* Current cursor size */
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSORSIZE
|
||||
static struct fb_cursorsize_s g_csize;
|
||||
static struct cursor_size_s g_csize;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
162
include/nuttx/nx/nxcursor.h
Normal file
162
include/nuttx/nx/nxcursor.h
Normal file
@ -0,0 +1,162 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/nx/cursor.h
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_NX_NXCURSOR_H
|
||||
#define __INCLUDE_NUTTX_NX_NXCURSOR_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <nuttx/video/cursor.h>
|
||||
|
||||
#ifndef defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxcursor_enable
|
||||
*
|
||||
* Description:
|
||||
* Enable/disable presentation of the cursor
|
||||
*
|
||||
* Input Parameters:
|
||||
* hnd - The server handle returned by nx_connect()
|
||||
* enable - True: show the cursor, false: hide the cursor.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void nxcursor_enable(NXHANDLE hnd, bool enable);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxcursor_set_image
|
||||
*
|
||||
* Description:
|
||||
* Set the cursor image
|
||||
*
|
||||
* Input Parameters:
|
||||
* hnd - The server handle returned by nx_connect()
|
||||
* image - Describes the cursor image in the expected format. For a
|
||||
* software cursor, this is the format used with the display. The
|
||||
* format may be different if a hardware cursor is used.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
|
||||
void nxcursor_set_image(NXHANDLE hnd, FAR struct cursor_image_s *image);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxcursor_set_position
|
||||
*
|
||||
* Description:
|
||||
* Move the cursor to the specified position
|
||||
*
|
||||
* Input Parameters:
|
||||
* hnd - The server handle returned by nx_connect()
|
||||
* pos -
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void nxcursor_set_position(NXHANDLE hnd, FAR const struct cursor_pos_s *pos);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxcursor_get_position
|
||||
*
|
||||
* Description:
|
||||
* Return the current cursor position.
|
||||
*
|
||||
* CAUTION: The current cursor position is not updated until the display
|
||||
* is actually changed. Due to asynchronies caused by queue, the new
|
||||
* current cursor position may not match the cursor position set until
|
||||
* the client and server are syncrhonized.
|
||||
*
|
||||
* Input Parameters:
|
||||
* hnd - The server handle returned by nx_connect()
|
||||
* pos - The location to return the cursor position
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void nxcursor_get_position(NXHANDLE hnd, FAR struct cursor_pos_s *pos);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_NX_SWCURSOR || CONFIG_NX_HWCURSOR */
|
||||
#endif /* __INCLUDE_NUTTX_NX_NXCURSOR_H */
|
||||
|
93
include/nuttx/video/cursor.h
Normal file
93
include/nuttx/video/cursor.h
Normal file
@ -0,0 +1,93 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/video/cursor.h
|
||||
*
|
||||
* Copyright (C) 2008-2011, 2013, 2016-2019 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_VIDIO_CURSOR_H
|
||||
#define __INCLUDE_NUTTX_VIDIO_CURSOR_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* If any dimension of the display exceeds 65,536 pixels, then the following
|
||||
* type will need to change. This should match the types of fb_coord_t and
|
||||
* nxgl_coord_t.
|
||||
*/
|
||||
|
||||
typedef uint16_t cursor_coord_t;
|
||||
|
||||
/* For cursor controllers that support custem cursor images, this structure
|
||||
* is used to provide the cursor image.
|
||||
*/
|
||||
|
||||
struct cursor_image_s
|
||||
{
|
||||
cursor_coord_t width; /* Width of the cursor image in pixels */
|
||||
cursor_coord_t height; /* Height of the cursor image in pixels */
|
||||
FAR const uint8_t *image; /* Pointer to image data */
|
||||
};
|
||||
|
||||
/* The following structure defines the cursor position */
|
||||
|
||||
struct cursor_pos_s
|
||||
{
|
||||
cursor_coord_t x; /* X position in pixels */
|
||||
cursor_coord_t y; /* Y position in rows */
|
||||
};
|
||||
|
||||
/* If the hardware supports setting the cursor size, then this structure
|
||||
* is used to provide the cursor size.
|
||||
*/
|
||||
|
||||
struct cursor_size_s
|
||||
{
|
||||
cursor_coord_t h; /* Height in rows */
|
||||
cursor_coord_t w; /* Width in pixels */
|
||||
};
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_VIDIO_CURSOR_H */
|
@ -45,7 +45,9 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/video/cursor.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor definitions
|
||||
@ -409,64 +411,30 @@ struct fb_cmap_s
|
||||
};
|
||||
#endif
|
||||
|
||||
/* If the video controller hardware supports a hardware cursor and
|
||||
* that hardware cursor supports user-provided images, then the
|
||||
* following structure may be used to provide the cursor image
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSOR
|
||||
#ifdef CONFIG_FB_HWCURSORIMAGE
|
||||
struct fb_cursorimage_s
|
||||
{
|
||||
fb_coord_t width; /* Width of the cursor image in pixels */
|
||||
fb_coord_t height /* Height of the cursor image in pixels */
|
||||
const uint8_t *image; /* Pointer to image data */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* The following structure defines the cursor position/size */
|
||||
|
||||
struct fb_cursorpos_s
|
||||
{
|
||||
fb_coord_t x; /* X position in pixels */
|
||||
fb_coord_t y; /* Y position in rows */
|
||||
};
|
||||
|
||||
/* If the hardware supports setting the cursor size, then this structure
|
||||
* is used to provide the size.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_FB_HWCURSORSIZE
|
||||
struct fb_cursorsize_s
|
||||
{
|
||||
fb_coord_t h; /* Height in rows */
|
||||
fb_coord_t w; /* Width in pixels */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* The following is used to get the cursor attributes */
|
||||
/* The following are used to get/get the cursor attributes via IOCTL command. */
|
||||
|
||||
struct fb_cursorattrib_s
|
||||
{
|
||||
#ifdef CONFIG_FB_HWCURSORIMAGE
|
||||
uint8_t fmt; /* Video format of cursor */
|
||||
#endif
|
||||
struct fb_cursorpos_s pos; /* Current cursor position */
|
||||
struct cursor_pos_s pos; /* Current cursor position */
|
||||
#ifdef CONFIG_FB_HWCURSORSIZE
|
||||
struct fb_cursorsize_s mxsize; /* Maximum cursor size */
|
||||
struct fb_cursorsize_s size; /* Current size */
|
||||
struct cursor_size_s mxsize; /* Maximum cursor size */
|
||||
struct cursor_size_s size; /* Current size */
|
||||
#endif
|
||||
};
|
||||
|
||||
struct fb_setcursor_s
|
||||
{
|
||||
uint8_t flags; /* See FB_CUR_* definitions */
|
||||
struct fb_cursorpos_s pos; /* Cursor position */
|
||||
struct cursor_pos_s pos; /* Cursor position */
|
||||
#ifdef CONFIG_FB_HWCURSORSIZE
|
||||
struct fb_cursorsize_s size; /* Cursor size */
|
||||
struct cursor_size_s size; /* Cursor size */
|
||||
#endif
|
||||
#ifdef CONFIG_FB_HWCURSORIMAGE
|
||||
struct fb_cursorimage_s img; /* Cursor image */
|
||||
struct cursor_image_s img; /* Cursor image */
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user