modify sdl driver to reduce the messages sent to rtgui server. add realtouch_ui_init

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2438 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
goprife@gmail.com 2012-11-23 13:32:56 +00:00
parent 6698e69fc8
commit 60fc67cb3d
2 changed files with 14 additions and 4 deletions

View File

@ -75,13 +75,16 @@ void rt_init_thread_entry(void* parameter)
}
#endif
#ifdef RT_USING_RTGUI
#if 0
{
extern void application_init(void);
rt_thread_delay(RT_TICK_PER_SECOND);
application_init();
}
#endif
#ifdef RT_USING_RTGUI
realtouch_ui_init();
#endif
}
void rt_test_thread_entry(void* parameter)

View File

@ -4,8 +4,8 @@
#include <rtdevice.h>
#include <rtgui/driver.h>
#define SDL_SCREEN_WIDTH 240
#define SDL_SCREEN_HEIGHT 320
#define SDL_SCREEN_WIDTH 800
#define SDL_SCREEN_HEIGHT 480
struct sdlfb_device
{
@ -31,10 +31,13 @@ static rt_err_t sdlfb_close(rt_device_t dev)
SDL_Quit();
return RT_EOK;
}
static rt_mutex_t sdllock;
static rt_err_t sdlfb_control(rt_device_t dev, rt_uint8_t cmd, void *args)
{
struct sdlfb_device *device;
rt_mutex_take(sdllock, RT_WAITING_FOREVER);
device = (struct sdlfb_device*)dev;
RT_ASSERT(device != RT_NULL);
RT_ASSERT(device->screen != RT_NULL);
@ -91,7 +94,7 @@ static rt_err_t sdlfb_control(rt_device_t dev, rt_uint8_t cmd, void *args)
}
break;
}
rt_mutex_release(sdllock);
return RT_EOK;
}
@ -125,6 +128,8 @@ static void sdlfb_hw_init(void)
SDL_WM_SetCaption ("RT-Thread/GUI Simulator", NULL);
rt_device_register(RT_DEVICE(&_device), "sdl", RT_DEVICE_FLAG_RDWR);
sdllock = rt_mutex_create("fb",RT_IPC_FLAG_FIFO);
}
#include <windows.h>
@ -156,6 +161,7 @@ static DWORD WINAPI sdl_loop(LPVOID lpParam)
switch (event.type)
{
case SDL_MOUSEMOTION:
#if 0
{
struct rtgui_event_mouse emouse;
emouse.parent.type = RTGUI_EVENT_MOUSE_MOTION;
@ -171,6 +177,7 @@ static DWORD WINAPI sdl_loop(LPVOID lpParam)
/* send event to server */
rtgui_server_post_event(&emouse.parent, sizeof(struct rtgui_event_mouse));
}
#endif
break;
case SDL_MOUSEBUTTONDOWN: