Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
guirender: simplify render stop
  • Loading branch information
Sebastien Bourdeauducq committed Jun 17, 2011
1 parent 813dc48 commit 38951f6
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions src/guirender.c
Expand Up @@ -106,27 +106,18 @@ static void adjust_contrast(int amount)
cp_notify_changed();
}

static int wait_release;

static void input_cb(mtk_event *e, int count)
{
int i;

for(i=0;i<count;i++) {
if(wait_release != -1) {
if((e[i].type == EVENT_TYPE_RELEASE) && (e[i].press.code == wait_release)) {
guirender_stop();
mtk_input(&e[i+1], count-i-1);
return;
}
} else {
if(e[i].type == EVENT_TYPE_PRESS) {
if((e[i].press.code == MTK_KEY_ENTER)
|| (e[i].press.code == MTK_KEY_F2)
|| (e[i].press.code == MTK_BTN_LEFT)
|| (e[i].press.code == MTK_BTN_RIGHT))
wait_release = e[i].press.code;
}
if((e[i].type == EVENT_TYPE_PRESS) &&
((e[i].press.code == MTK_KEY_ENTER)
|| (e[i].press.code == MTK_KEY_F2)
|| (e[i].press.code == MTK_BTN_LEFT)
|| (e[i].press.code == MTK_BTN_RIGHT))) {
guirender_stop();
mtk_input(&e[i+1], count-i-1);
}
if(e[i].type == EVENT_TYPE_PRESS) {
switch(e[i].press.code) {
Expand All @@ -150,7 +141,6 @@ static void input_cb(mtk_event *e, int count)
int guirender(int appid, struct patch *p, guirender_stop_callback cb)
{
if(guirender_running) return 0;
guirender_running = 1;

if(!resmgr_acquire_multiple("renderer",
RESOURCE_AUDIO,
Expand All @@ -160,10 +150,11 @@ int guirender(int appid, struct patch *p, guirender_stop_callback cb)
RESOURCE_SAMPLER,
INVALID_RESOURCE))
return 0;

guirender_running = 1;

renderer_start(framebuffer_fd, p);

wait_release = -1;
stop_appid = appid;
input_delete_callback(mtk_input);
input_add_callback(input_cb);
Expand Down

0 comments on commit 38951f6

Please sign in to comment.