commit 63001843fde06f544d01985268481bd83d7acd25
parent a79c2ddbe29de4c6cc666e99f16457f08a287ee3
Author: pancake <pancake@nopcode.org>
Date: Wed, 28 Apr 2010 23:05:51 +0200
do not initialize twice the video (fix n900 100% cpu)
fix mousebuttondown scrolling
scroll two times
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gi_sdl.c b/gi_sdl.c
@@ -70,7 +70,6 @@ swk_gi_init(SwkWindow *w) {
fprintf(stderr, "Cannot initialize TTF: %s\n", TTF_GetError());
return 0;
}
- SDL_VideoInit(NULL, 0);
SDL_SetVideoMode(w->r.w, w->r.h, BPP, SDLFLAGS);
// double init is necesary to get window size
SDL_SetVideoMode(w->r.w, w->r.h, BPP, SDLFLAGS);
@@ -132,10 +131,12 @@ swk_gi_event(SwkWindow *w, int dowait) {
if(event.motion.y>mousedowny+fs) {
mousedowny = event.motion.y;
swk_scroll_up(w);
+ swk_scroll_up(w);
} else
if(event.motion.y<mousedowny-fs) {
mousedowny = event.motion.y;
swk_scroll_down(w);
+ swk_scroll_down(w);
}
} else {
ret->type = EMotion;
@@ -148,7 +149,7 @@ swk_gi_event(SwkWindow *w, int dowait) {
break;
case SDL_MOUSEBUTTONDOWN:
mousedown = 1;
- mousedowny = event.motion.y;
+ mousedowny = event.button.y;
fprintf(stderr, "event: click %d\n", event.button.button);
ret->type = EClick;
ret->data.click.button = event.button.button;