summaryrefslogtreecommitdiff
path: root/components/rtgui/server/driver.c
diff options
context:
space:
mode:
authorGrissiom <[email protected]>2013-02-01 10:27:10 +0800
committerGrissiom <[email protected]>2013-02-01 10:27:10 +0800
commitf06c70feed0941b5bceedcecf89e9aa22034aca8 (patch)
tree89fd3a989b4d88fc72b39eaad6567de3a3d23874 /components/rtgui/server/driver.c
parent4f02e67bef7eacee5102d7730356663d9c889e15 (diff)
sync with rtgui-0.6
Diffstat (limited to 'components/rtgui/server/driver.c')
-rw-r--r--components/rtgui/server/driver.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/components/rtgui/server/driver.c b/components/rtgui/server/driver.c
index 2fe19347b5..dd441afb88 100644
--- a/components/rtgui/server/driver.c
+++ b/components/rtgui/server/driver.c
@@ -41,6 +41,7 @@ rt_err_t rtgui_graphic_set_device(rt_device_t device)
{
rt_err_t result;
struct rt_device_graphic_info info;
+ struct rtgui_graphic_ext_ops *ext_ops;
/* get framebuffer address */
result = rt_device_control(device, RTGRAPHIC_CTRL_GET_INFO, &info);
@@ -59,6 +60,13 @@ rt_err_t rtgui_graphic_set_device(rt_device_t device)
_driver.pitch = _driver.width * _driver.bits_per_pixel / 8;
_driver.framebuffer = info.framebuffer;
+ /* get graphic extension operations */
+ result = rt_device_control(device, RTGRAPHIC_CTRL_GET_EXT, &ext_ops);
+ if (result == RT_EOK)
+ {
+ _driver.ext_ops = ext_ops;
+ }
+
if (info.framebuffer != RT_NULL)
{
/* is a frame buffer device */
@@ -70,6 +78,11 @@ rt_err_t rtgui_graphic_set_device(rt_device_t device)
_driver.ops = rtgui_pixel_device_get_ops(_driver.pixel_format);
}
+#ifdef RTGUI_USING_HW_CURSOR
+ /* set default cursor image */
+ rtgui_cursor_set_image(RTGUI_CURSOR_ARROW);
+#endif
+
return RT_EOK;
}
RTM_EXPORT(rtgui_graphic_set_device);
@@ -100,3 +113,27 @@ rt_uint8_t *rtgui_graphic_driver_get_default_framebuffer(void)
}
RTM_EXPORT(rtgui_graphic_driver_get_default_framebuffer);
+#ifdef RTGUI_USING_HW_CURSOR
+void rtgui_cursor_set_position(rt_uint16_t x, rt_uint16_t y)
+{
+ rt_uint32_t value;
+
+ if (_driver.device != RT_NULL)
+ {
+ value = (x << 16 | y);
+ rt_device_control(_driver.device, RT_DEVICE_CTRL_CURSOR_SET_POSITION, &value);
+ }
+}
+
+void rtgui_cursor_set_image(enum rtgui_cursor_type type)
+{
+ rt_uint32_t value;
+
+ if (_driver.device != RT_NULL)
+ {
+ value = type;
+ rt_device_control(_driver.device, RT_DEVICE_CTRL_CURSOR_SET_TYPE, &value);
+ }
+};
+#endif
+