]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/root.cpp
Only focus widgets if the container is focused
[libs/gltk.git] / source / root.cpp
index b31b53f2d7e2f767cd48fb253eef5e436afdb863..a76da5b84cc6abcbe49f5ae99ccf35e8e6d47774 100644 (file)
@@ -4,7 +4,6 @@
 #include <msp/gl/tests.h>
 #include <msp/gl/uniform.h>
 #include <msp/input/keys.h>
-#include <msp/time/units.h>
 #include <msp/time/utils.h>
 #include "label.h"
 #include "style.h"
@@ -59,6 +58,9 @@ void Root::init(Graphics::Window *window)
        else
                shprog = 0;
 
+       if(keyboard)
+               set_state(FOCUS);
+
        update_style();
 
        if(mouse)
@@ -92,6 +94,12 @@ Root::~Root()
 
 void Root::tick()
 {
+       Time::TimeStamp t = Time::now();
+       Time::TimeDelta dt = (last_tick ? t-last_tick : Time::zero);
+       last_tick = t;
+
+       animate(dt);
+
        if(tooltip_timeout && Time::now()>tooltip_timeout)
        {
                std::string tip;