]> git.tdb.fi Git - libs/gltk.git/commitdiff
Mark Entry for rebuild when cursor starts or stops blinking
authorMikko Rasa <tdb@tdb.fi>
Mon, 23 Sep 2019 21:00:06 +0000 (00:00 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 23 Sep 2019 21:00:06 +0000 (00:00 +0300)
source/entry.cpp

index ed0d7e2081a270a90894277f619f33c4daf4aeb5..11fd2423c8cffc3e6d25e4760f29bb33203b1eee 100644 (file)
@@ -446,18 +446,21 @@ void Entry::erase_selection(bool emit_change)
 
 void Entry::check_cursor_blink()
 {
+       const Part *cursor_part = style->get_part("cursor");
+       bool has_blink = (cursor_part && cursor_part->get_graphic(ACTIVE|FOCUS)!=cursor_part->get_graphic(NORMAL|FOCUS));
+
        cursor_blink = (state&FOCUS);
-       if((state&FOCUS) && style)
+       if((state&FOCUS) && style && has_blink)
        {
-               const Part *cursor_part = style->get_part("cursor");
-               if(cursor_part && cursor_part->get_graphic(ACTIVE|FOCUS)!=cursor_part->get_graphic(NORMAL|FOCUS))
-               {
-                       set_animation_interval(Time::sec/2);
-                       return;
-               }
+               set_animation_interval(Time::sec/2);
+               mark_rebuild();
+       }
+       else
+       {
+               if(has_blink)
+                       mark_rebuild();
+               stop_animation();
        }
-
-       stop_animation();
 }
 
 void Entry::check_view_range()