Fix:Core:Make vehicle cursor have priority over layout cursor
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 10 Mar 2011 12:14:18 +0000 (12:14 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 10 Mar 2011 12:14:18 +0000 (12:14 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4323 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/navit.c
navit/navit/vehicle.c
navit/navit/vehicle.h

index de342bb..73a5810 100644 (file)
@@ -1750,7 +1750,7 @@ navit_set_cursors(struct navit *this_)
                                c=layout_get_cursor(this_->layout_current, name.u.str);
                } else
                        c=layout_get_cursor(this_->layout_current, "default");
-               vehicle_set_cursor(nv->vehicle, c);
+               vehicle_set_cursor(nv->vehicle, c, 0);
                v=g_list_next(v);
        }
        return;
index ae404fc..bec635e 100644 (file)
@@ -50,6 +50,7 @@ struct vehicle {
 
        // cursor
        struct cursor *cursor;
+       int cursor_fixed;
        struct callback *animate_callback;
        struct event_timeout *animate_timer;
        struct point cursor_pnt;
@@ -235,7 +236,8 @@ vehicle_add_attr(struct vehicle *this_, struct attr *attr)
                break;
        // currently supporting oldstyle cursor config.
        case attr_cursor:
-               vehicle_set_cursor(this_, attr->u.cursor);
+               this_->cursor_fixed=1;
+               vehicle_set_cursor(this_, attr->u.cursor, 1);
                break;
        default:
                break;
@@ -284,9 +286,11 @@ vehicle_remove_attr(struct vehicle *this_, struct attr *attr)
  * @author Ralph Sennhauser (10/2009)
  */ 
 void
-vehicle_set_cursor(struct vehicle *this_, struct cursor *cursor)
+vehicle_set_cursor(struct vehicle *this_, struct cursor *cursor, int overwrite)
 {
        struct point sc;
+       if (this_->cursor_fixed && !overwrite)
+               return;
        if (this_->animate_callback) {
                event_remove_timeout(this_->animate_timer);
                this_->animate_timer=NULL;              // dangling pointer! prevent double freeing.
index 3c1dcda..d2a52a4 100644 (file)
@@ -49,7 +49,7 @@ int vehicle_get_attr(struct vehicle *this_, enum attr_type type, struct attr *at
 int vehicle_set_attr(struct vehicle *this_, struct attr *attr);
 int vehicle_add_attr(struct vehicle *this_, struct attr *attr);
 int vehicle_remove_attr(struct vehicle *this_, struct attr *attr);
-void vehicle_set_cursor(struct vehicle *this_, struct cursor *cursor);
+void vehicle_set_cursor(struct vehicle *this_, struct cursor *cursor, int overwrite);
 void vehicle_draw(struct vehicle *this_, struct graphics *gra, struct point *pnt, int lazy, int angle, int speed);
 int vehicle_get_cursor_data(struct vehicle *this_, struct point *pnt, int *angle, int *speed);
 void vehicle_log_gpx_add_tag(char *tag, char **logstr);