Fix:Core:Redraw when appropriate
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 9 Nov 2009 17:27:05 +0000 (17:27 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 9 Nov 2009 17:27:05 +0000 (17:27 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@2734 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/gui/internal/gui_internal.c
navit/navit.c

index 3dfdb1b..8f49f48 100644 (file)
@@ -3741,16 +3741,18 @@ gui_internal_setup_gc(struct gui_priv *this)
 static void gui_internal_resize(void *data, int w, int h)
 {
        struct gui_priv *this=data;
+       int changed=0;
 
        gui_internal_setup_gc(this);
-       if( this->root.w==w && this->root.h==h)
-                return;
 
-       this->root.w=w;
-       this->root.h=h;
+       if (this->root.w != w || this->root.h != h) {
+               this->root.w=w;
+               this->root.h=h;
+               changed=1;
+       }
        dbg(1,"w=%d h=%d children=%p\n", w, h, this->root.children);
        navit_handle_resize(this->nav, w, h);
-       if (this->root.children) {
+       if (this->root.children && changed) {
                gui_internal_prune_menu(this, NULL);
                gui_internal_menu_root(this);
        }
index 0bddcda..0f94dc4 100644 (file)
@@ -244,15 +244,17 @@ void
 navit_handle_resize(struct navit *this_, int w, int h)
 {
        struct map_selection sel;
-       memset(&sel, 0, sizeof(sel));
-       this_->w=w;
-       this_->h=h;
-       sel.u.p_rect.rl.x=w;
-       sel.u.p_rect.rl.y=h;
-       transform_set_screen_selection(this_->trans, &sel);
-       graphics_init(this_->gra);
        this_->ready |= 2;
-       graphics_set_rect(this_->gra, &sel.u.p_rect);
+       if (this_->w != w || this_->h != h) {
+               memset(&sel, 0, sizeof(sel));
+               this_->w=w;
+               this_->h=h;
+               sel.u.p_rect.rl.x=w;
+               sel.u.p_rect.rl.y=h;
+               transform_set_screen_selection(this_->trans, &sel);
+               graphics_init(this_->gra);
+               graphics_set_rect(this_->gra, &sel.u.p_rect);
+       }
        if (this_->ready == 3)
                navit_draw(this_);
 }