From 60afa8f7b82cdcb969cac1b0edf7ce25a58dc492 Mon Sep 17 00:00:00 2001 From: norad Date: Wed, 13 Apr 2011 07:46:11 +0000 Subject: [PATCH] Fix:graphics/sdl:Prevent creating the rotation event if the orientation didn't change git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4423 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/graphics/sdl/graphics_sdl.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/navit/navit/graphics/sdl/graphics_sdl.c b/navit/navit/graphics/sdl/graphics_sdl.c index cf3736f..72164fd 100644 --- a/navit/navit/graphics/sdl/graphics_sdl.c +++ b/navit/navit/graphics/sdl/graphics_sdl.c @@ -1619,21 +1619,23 @@ sdl_accelerometer_handler(void* param) { sdl_orientation_count++; - dbg(1,"x(%d) y(%d) z(%d) o(%d)\n",xAxis, yAxis, zAxis, new_orientation); - gr->orientation = new_orientation; + if (new_orientation != gr->orientation) { + dbg(1,"x(%d) y(%d) z(%d) o(%d)\n",xAxis, yAxis, zAxis, new_orientation); + gr->orientation = new_orientation; - SDL_Event event; - SDL_UserEvent userevent; + SDL_Event event; + SDL_UserEvent userevent; - userevent.type = SDL_USEREVENT; - userevent.code = SDL_USEREVENT_CODE_ROTATE; - userevent.data1 = NULL; - userevent.data2 = NULL; + userevent.type = SDL_USEREVENT; + userevent.code = SDL_USEREVENT_CODE_ROTATE; + userevent.data1 = NULL; + userevent.data2 = NULL; - event.type = SDL_USEREVENT; - event.user = userevent; + event.type = SDL_USEREVENT; + event.user = userevent; - SDL_PushEvent (&event); + SDL_PushEvent (&event); + } } } #endif -- 2.7.4