1

It appears that if widget A is on top of widget B, for example, when using a GtkOverlay, and A and B has GDK_POINTER_MOTION_MASK set, the x and y members of the GdkEventMotion always refers to A coordinates, even in the event handler associated with B.

  1. Is this the intended behaviour, or if this is some kind of bug, that likely affects at least all version of GTK+-3

  2. What is the most convenient workaround for this issue, if not using x_root and y_root instead

I think that this is the root cause of erratic behavior seen in https://stackoverflow.com/questions/63099716/implement-a-node-editor-in-gtk3, because relatinig everything to root coordinates solved the problem.

It would require a lot of code to demonstrate the issue, but this link contains an illustrating git delta:

https://github.com/milasudril/texpainter/commit/a750d0c4bd6ab1f1a4bbde156e8f357f6da6540d

user877329
  • 6,717
  • 8
  • 46
  • 88
  • And the code is..... – Michi Aug 29 '20 at 14:00
  • https://github.com/milasudril/texpainter/commit/a750d0c4bd6ab1f1a4bbde156e8f357f6da6540d Shows how I "solved" the issue, but the question about GdkEventMotion contents remains open. It *should* be possible to answer this question without any code, as the issue has already been found: GdkEventMotion may refer to wrong widget coordinates. And as I said, I think it is a bug, but it is a bug that cannot be solved without breaking others code. – user877329 Aug 29 '20 at 14:19
  • The thing is that it is important the way how the event propagate based on what the callback returns. The fact that the event propagate from one widget to another means not that there is a bug, More over when it/could is/be wrong handled. Please refer to http://discourse.gnome.org – Michi Aug 30 '20 at 06:10
  • The question still remains: does this happen only when GtkOverlay is involved ... or it happens also with other containers? – Michi Aug 30 '20 at 06:15
  • 1
    @Michi Basically you say, that once event has hit the first widget, the content of the structure won't chnage. If so, that would work as an answer. – user877329 Aug 30 '20 at 08:02
  • The question about other containers? I guess it is sort of a "cannot happen". I mean, this is perhaps a very specialized scenario. GTK covers 90% of all usecases, but the remaining 10% may require dirty tricks to get it work. – user877329 Aug 30 '20 at 08:07

0 Answers0