You are currently browsing the tag archive for the ‘GtkWidget’ tag.

It could be more fun, actually. But nobody said it would be easy, so I stop complaining and present the newest achievements on Pixmap based animation Gtk+. 😀

I guess I have to explain what’s new about this. New is the handling of widgets like the text box or the calendar you have seen in the video. These widgets have their own windows which means they get an extra expose event which is independent from those their parent gets. This can be a big issue because you have to track them separately or you won’t be able to control them accordingly to the animation the parent triggered.

As I mentioned already this is not done yet. The code is buggy and doesn’t behave too well with Gtk+ applications other than my test app.  This will be the topic of the next days.

Before I forget, you’ll find the patch on bugzilla.  You might have some comments or ideas. 🙂

Cheers!

Advertisements

Disclaimer: This blog post is going to summarise the experiences I made while implementing animation for the GtkVBox< widget and my thoughts about widget animation in Gtk+ so far. This blog post is not going to be about animation in themes because this is another issue. Of course there are intersections, I’ll point to them when they arise.
 

By the way, this is one of the longer posts. If you’re interested in this topic you should bring a bit of time with you. 😉
 

The question is how can we support the application developer to create dynamic user interfaces and at the same time increase the user experience while preserving the advantages of Gtk+‘s box model? Let’s have a look on this short video to motivate this idea with a working example of how animation for widgets in Gtk+ can look like.

What have I done? First I derived from so the original implementation is not touched directly. Then I slightly modified the size_alloc function by saving the computed GtkAllocations and removing direct calls of gtk_widget_size_allocate. I modified add and remove so I can start the animation at the right time. I also added a function called my_vbox_pack_start_n which inserts a widget at a given position so one is able to preserve the original packaging order. You trigger the animation by simply adding or removing widgets to the vertical box as usual.
 

You find to code here: http://github.com/troja84/af/tree/master/

  • tests/myvbox_a.h

  • tests/myvbox_a.c

  • tests/test-vbox-animated.c

Let me talk about some points in regard to the main topic.
 

Implementation

In the example I derived my animated version of GtkVBox from the original one. The advantage is that the animation code is well separated so when an application developer wants an animated widget she has to explicitly select that version. On the other hand you increase the amount of redundant code because you have to slightly modify some functions in order to implement animations. The question is if an additional gtkvbox_animation.[h|c] would be more suitable in case of maintainability. Personally, I like the current implementation very much and I would prefer to add the slight modifications to the original class because these are not so harmful.

May you have noticed the problems when the widgets overlaped each other. At the moment I don’t know how to influence the, let’s call it z-position (the code draws the animated widget first but as you can see this doesn’t help…). That is why I’ve implemented the second animation which is more Gtk+ like (in the way that the widgets do not overlap each other while the animation is running) but this doesn’t work well with widgets which have a minimum size like the buttons in the example.

A further issue is artistic freedom. Should we provide standard animations or do we have to provide an API which enables artists to modify the animations in a significant way? The current implementation is following the first approach. I’m not sure if other widget toolkits or OSs offer more freedom so references are very welcome. 🙂

 

Infrastructure

Animations are not suitable at any place at any time be it by computing power, battery power or personal taste. That is why a discussion about the infrastructure is important. Furthermore, this is something which also affects the discussion about animation in themes.

Infrastructure in this case means an API which offers functions to influence the state of animation on the system level in a way that is transparent for the application and application developer. At least one should be able to turn animations on/off. 😉 There is already a property called gtk-enable-animations in GtkSettings which might be useful for the beginning.

 

That’s it for now. Remarks are very welcome! 🙂

 

Cheers!!!

Vellocet Club

A blog not only about my time in Sweden and Мiнск but also about the things I am concerned about.

RSS Dinge, die man so liest…

  • An error has occurred; the feed is probably down. Try again later.
December 2017
M T W T F S S
« Aug    
 123
45678910
11121314151617
18192021222324
25262728293031