diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-10 07:36:33 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-10 07:36:33 +0300 |
commit | 4a9ee46c1446603bf67b37e9970ddbbc1320fb73 (patch) | |
tree | 8afaaab719f3890c3cf00f4fb5c8843374e8ebde /source/blender/editors/space_time/space_time.c | |
parent | b205ec4f18b704edc63f914cefc2d16b2784803a (diff) |
UI: don't use operators anymore for handling user interface events, but rather
a special UI handler which makes the code clearer. This UI handler is attached
to the region along with other handlers, and also gets a callback when all
handlers for the region are removed to ensure things are properly cleaned up.
This should fix XXX's in the UI code related to events and context switching.
Most of the changes are in interface_handlers.c, which was renamed from
interface_ops.c, to convert operators to the UI handler. UI code notes:
* uiBeginBlock/uiEndBlock/uiFreeBlocks now takes a context argument, this is
required to properly cancel things like timers or tooltips when the region
gets removed.
* UI_add_region_handlers will add the region level UI handlers, to be used
when adding keymap handlers etc. This replaces the UI keymap.
* When the UI code starts a modal interaction (number sliding, text editing,
opening a menu, ..), it will add an UI handler at the window level which
will block events.
Windowmanager changes:
* Added an UI handler next to the existing keymap and operator modal handlers.
It has an event handling and remove callback, and like operator modal handlers
will remember the area and region if it is registered at the window level.
* Removed the MESSAGE event.
* Operator cancel and UI handler remove callbacks now get the
window/area/region restored in the context, like the operator modal and UI
handler event callbacks.
* Regions now receive MOUSEMOVE events for the mouse going outside of the
region. This was already happening for areas, but UI buttons are at the region
level so we need it there.
Issues:
* Tooltips and menus stay open when switching to another window, and button
highlight doesn't work without moving the mouse first when Blender starts up.
I tried using some events like Q_FIRSTTIME, WINTHAW, but those don't seem to
arrive..
* Timeline header buttons seem to be moving one pixel or so sometimes when
interacting with them.
* Seems not due to this commit, but UI and keymap handlers are leaking. It
seems that handlers are being added to regions in all screens, also in regions
of areas that are not visible, but these handlers are not removed. Probably
there should only be handlers in visible regions?
Diffstat (limited to 'source/blender/editors/space_time/space_time.c')
-rw-r--r-- | source/blender/editors/space_time/space_time.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 71446531cbb..51466e22944 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -182,7 +182,6 @@ static void time_header_area_draw(const bContext *C, ARegion *ar) static void time_header_area_free(ARegion *ar) { - uiFreeBlocks(&ar->uiblocks); } /* ******************** default callbacks for time space ***************** */ @@ -246,8 +245,7 @@ static void time_init(wmWindowManager *wm, ScrArea *sa) /* XXX fixme, should be smarter */ - keymap= WM_keymap_listbase(wm, "Interface", 0, 0); - WM_event_add_keymap_handler(&ar->handlers, keymap); + UI_add_region_handlers(&ar->handlers); keymap= WM_keymap_listbase(wm, "View2D", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); |