Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-12-10 07:36:33 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-12-10 07:36:33 +0300
commit4a9ee46c1446603bf67b37e9970ddbbc1320fb73 (patch)
tree8afaaab719f3890c3cf00f4fb5c8843374e8ebde /source/blender/editors/screen
parentb205ec4f18b704edc63f914cefc2d16b2784803a (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/screen')
-rw-r--r--source/blender/editors/screen/area.c4
-rw-r--r--source/blender/editors/screen/screen_edit.c10
-rw-r--r--source/blender/editors/screen/spacetypes.c2
3 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 54bfdcf4d65..c959e1da17d 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -167,7 +167,9 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
glColor3f(fac, fac, fac);
glRecti(20, 2, 30, 12);
}
- region_draw_emboss(ar);
+
+ if(C->area)
+ region_draw_emboss(ar);
/* XXX test: add convention to end regions always in pixel space, for drawing of borders/gestures etc */
ED_region_pixelspace(C, ar);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index d7a43680b97..e2ac4d90645 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -920,24 +920,33 @@ void ED_screens_initialize(wmWindowManager *wm)
void ED_region_exit(bContext *C, ARegion *ar)
{
+ ARegion *prevar= C->region;
+
+ C->region= ar;
WM_event_remove_handlers(C, &ar->handlers);
+ C->region= prevar;
}
void ED_area_exit(bContext *C, ScrArea *sa)
{
+ ScrArea *prevsa= C->area;
ARegion *ar;
+ C->area= sa;
for(ar= sa->regionbase.first; ar; ar= ar->next)
ED_region_exit(C, ar);
WM_event_remove_handlers(C, &sa->handlers);
+ C->area= prevsa;
}
void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
{
+ wmWindow *prevwin= C->window;
ScrArea *sa;
ARegion *ar;
+ C->window= window;
for(ar= screen->regionbase.first; ar; ar= ar->next)
ED_region_exit(C, ar);
@@ -945,6 +954,7 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
ED_area_exit(C, sa);
WM_event_remove_handlers(C, &window->handlers);
+ C->window= prevwin;
}
diff --git a/source/blender/editors/screen/spacetypes.c b/source/blender/editors/screen/spacetypes.c
index ec348882acb..514a459df4f 100644
--- a/source/blender/editors/screen/spacetypes.c
+++ b/source/blender/editors/screen/spacetypes.c
@@ -71,7 +71,6 @@ void ED_spacetypes_init(void)
/* register operator types for screen and all spaces */
ED_operatortypes_screen();
- UI_operatortypes();
ui_view2d_operatortypes();
spacetypes = BKE_spacetypes_list();
@@ -89,7 +88,6 @@ void ED_spacetypes_keymap(wmWindowManager *wm)
ED_keymap_screen(wm);
UI_view2d_keymap(wm);
- UI_keymap(wm);
spacetypes = BKE_spacetypes_list();
for(type=spacetypes->first; type; type=type->next)