Re: GTK+3 - A common event handler - possible?
- From: Donn <donn ingle gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: GTK+3 - A common event handler - possible?
- Date: Wed, 22 May 2013 11:00:06 +0200
On 22/05/2013 09:29, Bernhard Schuster wrote:
In general factoring code is good (at least that's my opinion) - what
you are trying to do is the reverse and will give you one very big
function, hardly readable.
I take your very good point.
I really suggest you to go with seperate handlers. If you need cross
handler information, then you should create yourself a context object
and store desired information into that and obtain it from that, you can
simply pass the context object as the user_data gpointer.
I will attempt grokkage of this user_data thing. I've seen it in the C
docs, but I'm newly into Vala, and it looks ... weird:
https://live.gnome.org/Vala/SignalsAndCallbacks (at end)
Why do you want to disabel doublebuffering in the first case?
Two zones of reasons, both hopefully full of fail and new hope! :P
A:
As it seems now , in order to discover whether the cursor in inside a
shape, I have to draw a path and use cr_in_fill().
This can only happen when I have a Cairo context! That only happens in
the draw() signal handler!
So, in order to simply discover this fact, I have to force a complete
redraw (queue_draw()) and this then draws *all* my canvas objects again,
from scratch. A very heavy burden for one mouse motion event.
(Add to this that the object which I am motioning over may be under
several transforms. i.e. I have to transform several times before I get
to draw that path in order to test in_fill)
B:
Also, I'm still struggling with the various options - I can draw every
object from bottom to top, on every draw().
I can draw each object to a memory surface (cairo pattern) and then
compose them all, back to front, every draw().
The thing is - *if* the canvas has *not* changed, *but* I have a tool or
icon on the topmost layer that moves (I call it a sprite) by a few
pixels, then it makes more sense to do a small blit of the old
background and draw the sprite in a new position - rather than drawing
all my canvas objects again just so I can draw the sprite in a new position.
Thus, the double-buffering that blanks the canvas screws the pooch ;)
In case that is not really important to you, you could have a look at
goocanvas..
I guess I'm just keen to see if I can do this (a canvas vector art zui
draggy thing) on my own. I have the Goo source but it's just as
confusing to me as the Inkscape source. Still, I do try.
Thanks for your mail, I'd love to hear any further thoughts.
\d
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]