Re: [UFO-devel] Events and layered panes
Status: Beta
Brought to you by:
schmidtjf
From: Johannes S. <sch...@us...> - 2005-12-01 15:37:13
|
Am Donnerstag 01 Dezember 2005 00:01 schrieb Andreas Beckermann: > Hi > attached is a patch that I have sent before, I believe (or at least > mentioned). Sorry, there are probably several patches which are lost in email flood. I've been very busy last weeks doing some uni stuff. > It implements layered pane compatible event handling. > Umm, well, this patch has been used in Boson for quite some time, here the > comment in my README about this patch: > > - Patch to uabstractcontext.hpp, uabstractcontext.cpp and uwidget.cpp > to improve events for our needs: > Instead of delivering a mouse event to root->getVisibleWidgetAt(), we > implement a getVisibleWidgetsDFS() function, that starts at the root and > finds > all currently visible widgets (at the relevant point) using a depth first > search > and returns them in a stack. > We then dispatch it to every widget on the stack until one widget > consumes the event (in that case we stop then). > This especially fixes layered panes: previously an event was delivered to > the > topmost layer only and to the layered pane itself, if the widget was not > interested in that event. Now the event is first delivered to the topmost > layer, then to the layers below it, then to the layered pane. > > > This patch makes pretty much the difference between "libufo is usable" and > "libufo is unusable" for us: it is extremely important that a click on a > button is dispatched to the button and clicks on everything else is > delivered to the stuff below that. (yeah, that was the simple version) Just a side note: Keep the GUI stuff clearly separated from your game engine stuff or you will end up in an unmaintainable, monolithic source tree. If the event haven't been processed by the GUI, send it to your game engine. To your problem: I thought of adding a separate event dispatcher (which can be added to the display), which chooses to which widget(s) the event is sent. Anyway, this may take some time, as I am really busy these days. cu, Johannes |