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:
-rw-r--r--source/blender/blenkernel/BKE_screen.h5
-rw-r--r--source/blender/editors/include/ED_screen.h3
-rw-r--r--source/blender/editors/screen/area.c30
-rw-r--r--source/blender/editors/space_action/space_action.c21
-rw-r--r--source/blender/makesdna/DNA_screen_types.h5
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c13
6 files changed, 72 insertions, 5 deletions
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 60072ec2553..ab91612defe 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -63,7 +63,10 @@ typedef struct SpaceType {
/* init is to cope with file load, screen (size) changes, check handlers */
void (*init)(struct wmWindowManager *, struct ScrArea *);
/* Listeners can react to bContext changes */
- void (*listener)(struct ARegion *, struct wmNotifier *);
+ void (*listener)(struct ScrArea *, struct wmNotifier *);
+
+ /* refresh context, called after filereads, ED_area_tag_refresh() */
+ void (*refresh)(const struct bContext *, struct ScrArea *);
/* after a spacedata copy, an init should result in exact same situation */
struct SpaceLink *(*duplicate)(struct SpaceLink *);
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 7d896c91fd4..7f01cc36c7c 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -63,7 +63,10 @@ void ED_area_overdraw_flush(struct bContext *C);
void ED_area_initialize(struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *sa);
void ED_area_exit(struct bContext *C, struct ScrArea *sa);
int ED_screen_area_active(const struct bContext *C);
+void ED_area_do_listen(ScrArea *sa, struct wmNotifier *note);
void ED_area_tag_redraw(ScrArea *sa);
+void ED_area_tag_refresh(ScrArea *sa);
+void ED_area_do_refresh(struct bContext *C, ScrArea *sa);
void ED_area_headerprint(ScrArea *sa, const char *str);
/* screens */
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index bf7b76cc7f8..6f912ce393f 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -104,6 +104,7 @@ void ED_region_pixelspace(ARegion *ar)
wmLoadIdentity();
}
+/* only exported for WM */
void ED_region_do_listen(ARegion *ar, wmNotifier *note)
{
/* generic notes first */
@@ -121,7 +122,27 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note)
}
}
+/* only exported for WM */
+void ED_area_do_listen(ScrArea *sa, wmNotifier *note)
+{
+ /* no generic notes? */
+ if(sa->type && sa->type->listener) {
+ sa->type->listener(sa, note);
+ }
+}
+
+/* only exported for WM */
+void ED_area_do_refresh(bContext *C, ScrArea *sa)
+{
+ /* no generic notes? */
+ if(sa->type && sa->type->refresh) {
+ sa->type->refresh(C, sa);
+ }
+ sa->do_refresh= 0;
+}
+
/* based on screen region draw tags, set draw tags in azones, and future region tabs etc */
+/* only exported for WM */
void ED_area_overdraw_flush(bContext *C)
{
ScrArea *sa;
@@ -146,6 +167,7 @@ void ED_area_overdraw_flush(bContext *C)
}
}
+/* only exported for WM */
void ED_area_overdraw(bContext *C)
{
wmWindow *win= CTX_wm_window(C);
@@ -174,6 +196,7 @@ void ED_area_overdraw(bContext *C)
}
+/* only exported for WM */
void ED_region_do_draw(bContext *C, ARegion *ar)
{
wmWindow *win= CTX_wm_window(C);
@@ -216,7 +239,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
/* **********************************
maybe silly, but let's try for now
- to keep do_draw tags protected
+ to keep these tags protected
********************************** */
void ED_region_tag_redraw(ARegion *ar)
@@ -234,6 +257,11 @@ void ED_area_tag_redraw(ScrArea *sa)
ar->do_draw= 1;
}
+void ED_area_tag_refresh(ScrArea *sa)
+{
+ if(sa)
+ sa->do_refresh= 1;
+}
/* *************************************************************** */
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 44ed692ba48..172e5d1d839 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -329,6 +329,25 @@ static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
}
+/* editor level listener */
+static void action_listener(ScrArea *sa, wmNotifier *wmn)
+{
+ /* context changes */
+ switch(wmn->category) {
+ case NC_SCENE:
+ switch(wmn->data) {
+ case ND_OB_ACTIVE:
+ ED_area_tag_refresh(sa);
+ break;
+ }
+ }
+}
+
+static void action_refresh(const bContext *C, ScrArea *sa)
+{
+ printf("Heya, Action refresh needed!\n");
+}
+
/* only called once, from space/spacetypes.c */
void ED_spacetype_action(void)
{
@@ -343,6 +362,8 @@ void ED_spacetype_action(void)
st->duplicate= action_duplicate;
st->operatortypes= action_operatortypes;
st->keymap= action_keymap;
+ st->listener= action_listener;
+ st->refresh= action_refresh;
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype action region");
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 9de835da9f1..353bacf7a43 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -106,7 +106,8 @@ typedef struct ScrArea {
short winx, winy; /* size */
short headertype; /* OLD! 0=no header, 1= down, 2= up */
- int pad;
+ short pad;
+ short do_refresh; /* private, for spacetype refresh callback */
short cursor, flag;
ScriptLink scriptlink;
@@ -134,7 +135,7 @@ typedef struct ARegion {
float fsize; /* current split size in float */
- short do_draw; /* cached notifier events */
+ short do_draw; /* private, cached notifier events */
short pad;
int pad1;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 6cc29921bc6..caa4731a524 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -153,6 +153,7 @@ void wm_event_do_notifiers(bContext *C)
}
}
+ /* the notifiers are sent without context, to keep it clean */
while( (note=wm_notifier_next(wm)) ) {
wmWindow *win;
@@ -171,6 +172,7 @@ void wm_event_do_notifiers(bContext *C)
}
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+ ED_area_do_listen(sa, note);
for(ar=sa->regionbase.first; ar; ar= ar->next) {
ED_region_do_listen(ar, note);
}
@@ -180,7 +182,16 @@ void wm_event_do_notifiers(bContext *C)
}
MEM_freeN(note);
- }
+ }
+
+ /* cached: editor refresh callbacks now, they get context */
+ for(win= wm->windows.first; win; win= win->next) {
+ ScrArea *sa;
+ for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+ if(sa->do_refresh)
+ ED_area_do_refresh(C, sa);
+ }
+ }
}
/* mark area-regions to redraw if overlapped with rect */