notsecure/uTox — pull request #653 by new-account (2014-10-31 14:24:26+00:00)
Title: Added tooltip feature for buttons. notsecure/uTox#277

When moving over a button, which has a tooltip set, a thread will start and check the mouse position. Once the mouse stops moving and is still over a button it will display the buttons tooltip next to the cursor.

To add a tooltip to a button, you can define a i18nal string in "ui_button.h" with tooltip_text as you would define button_text.
Example:
```c
button_chat2 = {
.bm = BM_CB2,
.c1 = C_GREEN,
.c2 = C_GREEN_LIGHT,
.c3 = C_GREEN_LIGHT,
.tooltip_text = { .i18nal = STR_YES },
},
```
The thread will continue running until the mouse stops for atleast 1 second. It is then checked whether a tooltip is to be shown or not and the thread will terminate.

I am not experienced with C and threading, so if you see anything that might break during certain scenarios, leak memory or behave strangely, please point them out.

In that regard, here are some notes I've been wondering about:
- Are locks neccessary for the thread regarding the struct members "timer_running" and "can_show"? Is it possible for another thread to start in the time "timer_running" is set and another thread is being initialized?

- I think the the thread can be terminated the moment the mouse stops moving when checking for "can_show" instead of waiting another second.

- Creation of another redraw function. And the only reason was the blocking of XNextEvent. My idea was to add a parameter for the redraw function for this case, but since it would need alot of refactoring I rather wait for some feedback on this.

- I have no idea how the android client looks like and how this will even work UI wise...