Enable the new event handling by default.

The code should act the same as the old event handling. The code has
been lightly tested and can be disabled by defining
GUI2_OLD_EVENT_HANDLING during compilation.

The old code is still fully there and shall be moved withing #ifdefs
soon. Also the event handler has theoretic support for nested event
handlers but this code hasn't been used yet, which will also happen
later on.
This commit is contained in:
Mark de Wever 2009-10-03 17:52:13 +00:00
parent eab5ee0219
commit 92b97608b4
7 changed files with 13 additions and 10 deletions

View file

@ -13,7 +13,8 @@ The release team should empty this file after each release.
***
REPLACE ME WITH CONTENT...
The code for the event handling has been rewritten, which might cause some new
glitches.
***

View file

@ -5,6 +5,8 @@ Version 1.7.6+svn:
* Updated translations: Estonian, German, Russian, Serbian.
* Units:
* New animation WML and macros for the Drakes
* User interface:
* Enabled the new event handler by default now
* Miscellaneous and bugfixes:
* Add-ons download list now takes filtering into account for
displaying descriptions

View file

@ -309,7 +309,7 @@ void thandler::connect(tdispatcher* dispatcher)
{
assert(std::find(dispatchers_.begin(), dispatchers_.end(), dispatcher)
== dispatchers_.end());
#ifdef GUI2_NEW_EVENT_HANDLING
#ifndef GUI2_OLD_EVENT_HANDLING
// Need to join unconditionally to get the events.
join();
#endif
@ -333,7 +333,7 @@ void thandler::disconnect(tdispatcher* dispatcher)
assert(std::find(dispatchers_.begin(), dispatchers_.end(), dispatcher)
== dispatchers_.end());
#ifdef GUI2_NEW_EVENT_HANDLING
#ifndef GUI2_OLD_EVENT_HANDLING
if(dispatchers_.empty()) {
// When we're the last dispatcher really leave.
leave();

View file

@ -94,7 +94,7 @@ static Uint32 popup_callback(Uint32 /*interval*/, void* /*param*/)
* blocker is used.
*/
tevent_handler::tevent_handler() :
#ifndef GUI2_NEW_EVENT_HANDLING
#ifdef GUI2_OLD_EVENT_HANDLING
events::handler(false) // don't join we haven't created a context yet
,
#endif
@ -155,7 +155,7 @@ tevent_handler::tevent_handler() :
}
// The event context is created now we join it.
#ifndef GUI2_NEW_EVENT_HANDLING
#ifdef GUI2_OLD_EVENT_HANDLING
join();
#endif
}

View file

@ -37,14 +37,14 @@ class twindow;
/** The event handler class for the widget library. */
class tevent_handler
#ifndef GUI2_NEW_EVENT_HANDLING
#ifdef GUI2_OLD_EVENT_HANDLING
: public events::handler
#endif
{
public:
tevent_handler();
#ifdef GUI2_NEW_EVENT_HANDLING
#ifndef GUI2_OLD_EVENT_HANDLING
virtual ~tevent_handler() {}
#else
~tevent_handler() { leave(); }

View file

@ -66,7 +66,7 @@ public:
* intended button on the addon panel. So we need to chain mouse events
* as well and also add a handled flag for them.
*/
#ifdef GUI2_NEW_EVENT_HANDLING
#ifndef GUI2_OLD_EVENT_HANDLING
twidget* result = tcontainer_::find_at(coordinate, must_be_active);
return result ? result : tcontrol::find_at(coordinate, must_be_active);
#else
@ -78,7 +78,7 @@ public:
const twidget* find_at(
const tpoint& coordinate, const bool must_be_active) const
{
#ifdef GUI2_NEW_EVENT_HANDLING
#ifndef GUI2_OLD_EVENT_HANDLING
const twidget* result =
tcontainer_::find_at(coordinate, must_be_active);
return result ? result : tcontrol::find_at(coordinate, must_be_active);

View file

@ -259,7 +259,7 @@ twindow::twindow(CVideo& video,
help_popup_.set_visible(twidget::HIDDEN);
tmanager::instance().add(*this);
#ifdef GUI2_NEW_EVENT_HANDLING
#ifndef GUI2_OLD_EVENT_HANDLING
tevent_handler::connect();
#endif