2.5
Notifier system upgrade, based on Brecht's doc. Implementation notes: http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers#Implementation In short: let's try to strictly communicate in a notifier what happened. The listeners then can act themselves. It also means that a frame-changed notifier doesn't send out redraws, the editors themselves can decide.
This commit is contained in:
@@ -200,7 +200,7 @@ static int ed_marker_add(bContext *C, wmOperator *op)
|
||||
sprintf(marker->name, "Frame %d", frame); // XXX - temp code only
|
||||
BLI_addtail(markers, marker);
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
//BIF_undo_push("Add Marker");
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -336,7 +336,7 @@ static void ed_marker_move_cancel(bContext *C, wmOperator *op)
|
||||
ed_marker_move_apply(C, op);
|
||||
ed_marker_move_exit(C, op);
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
|
||||
case RIGHTMOUSE:
|
||||
if(WM_modal_tweak_check(evt, mm->event_type)) {
|
||||
ed_marker_move_exit(C, op);
|
||||
WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ XXX else if (mm->slink->spacetype == SPACE_ACTION) {
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
// headerprint(str); XXX
|
||||
}
|
||||
}
|
||||
@@ -623,7 +623,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend)
|
||||
else
|
||||
select_timeline_marker_frame(markers, cfra, 0);
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
@@ -716,7 +716,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -769,7 +769,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
|
||||
marker->flag &= ~SELECT;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -816,7 +816,7 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
if(changed) {
|
||||
WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
}
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -101,8 +101,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
|
||||
if (cfra != scene->r.cfra)
|
||||
scene->r.cfra= cfra;
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
/* XXX: add WM_NOTE_TIME_CHANGED? */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
|
||||
}
|
||||
|
||||
/* Clear any temp flags */
|
||||
|
||||
@@ -392,7 +392,7 @@ void ui_tooltip_free(bContext *C, ARegion *ar)
|
||||
{
|
||||
ui_remove_temporary_region(C, CTX_wm_screen(C), ar);
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL); // XXX provide rect for window
|
||||
}
|
||||
|
||||
/************************* Creating Menu Blocks **********************/
|
||||
@@ -710,7 +710,7 @@ void ui_menu_block_free(bContext *C, uiMenuBlockHandle *handle)
|
||||
ui_remove_temporary_region(C, CTX_wm_screen(C), handle->region);
|
||||
MEM_freeN(handle);
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL); // XXX provide rect for window
|
||||
}
|
||||
|
||||
/***************************** Menu Button ***************************/
|
||||
|
||||
@@ -107,13 +107,12 @@ void ED_region_pixelspace(ARegion *ar)
|
||||
void ED_region_do_listen(ARegion *ar, wmNotifier *note)
|
||||
{
|
||||
/* generic notes first */
|
||||
switch(note->type) {
|
||||
case WM_NOTE_WINDOW_REDRAW:
|
||||
case WM_NOTE_SCREEN_CHANGED:
|
||||
switch(note->category) {
|
||||
case NC_WINDOW:
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
case WM_NOTE_GESTURE_REDRAW:
|
||||
if(note->swinid==ar->swinid)
|
||||
case NC_SCREEN:
|
||||
if(note->action==NA_EDITED)
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -912,15 +912,13 @@ void ED_screen_do_listen(wmWindow *win, wmNotifier *note)
|
||||
{
|
||||
|
||||
/* generic notes */
|
||||
switch(note->type) {
|
||||
case WM_NOTE_WINDOW_REDRAW:
|
||||
switch(note->category) {
|
||||
case NC_WINDOW:
|
||||
win->screen->do_draw= 1;
|
||||
break;
|
||||
case WM_NOTE_SCREEN_CHANGED:
|
||||
win->screen->do_draw= win->screen->do_refresh= 1;
|
||||
break;
|
||||
case WM_NOTE_GESTURE_REDRAW:
|
||||
win->screen->do_gesture= 1; /* XXX gestures are stored in window, draw per region... a bit weak? wait for proper composite? (ton) */
|
||||
case NC_SCREEN:
|
||||
if(note->action==NA_EDITED)
|
||||
win->screen->do_draw= win->screen->do_refresh= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1207,7 +1205,7 @@ void ed_screen_set(bContext *C, bScreen *sc)
|
||||
CTX_wm_window(C)->screen= sc;
|
||||
|
||||
ED_screen_refresh(CTX_wm_manager(C), CTX_wm_window(C));
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ static int screen_area_rip_op(bContext *C, wmOperator *op)
|
||||
area_copy_data((ScrArea *)newsc->areabase.first, sa, 0);
|
||||
|
||||
/* screen, areas init */
|
||||
WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -473,7 +473,7 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
|
||||
}
|
||||
|
||||
static void area_move_apply(bContext *C, wmOperator *op)
|
||||
@@ -727,7 +727,7 @@ static int area_split_apply(bContext *C, wmOperator *op)
|
||||
if(dir=='h') sd->origval= sd->nedge->v1->vec.y;
|
||||
else sd->origval= sd->nedge->v1->vec.x;
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -742,7 +742,7 @@ static void area_split_exit(bContext *C, wmOperator *op)
|
||||
op->customdata = NULL;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
|
||||
|
||||
/* this makes sure aligned edges will result in aligned grabbing */
|
||||
removedouble_scrverts(CTX_wm_screen(C));
|
||||
@@ -853,7 +853,7 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
fac= (dir == 'v') ? event->x-sd->origmin : event->y-sd->origmin;
|
||||
RNA_float_set(op->ptr, "fac", fac / (float)sd->origsize);
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
|
||||
break;
|
||||
|
||||
case LEFTMOUSE:
|
||||
@@ -910,8 +910,7 @@ static int frame_offset_exec(bContext *C, wmOperator *op)
|
||||
delta = RNA_int_get(op->ptr, "delta");
|
||||
|
||||
CTX_data_scene(C)->r.cfra += delta;
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
/* XXX: add WM_NOTE_TIME_CHANGED? */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C));
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1156,7 +1155,7 @@ static int area_join_cancel(bContext *C, wmOperator *op)
|
||||
jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
|
||||
area_join_exit(C, op);
|
||||
|
||||
@@ -1204,7 +1203,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
jd->sa2 = NULL;
|
||||
}
|
||||
}
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
}
|
||||
else {
|
||||
/* we are back in the area previously selected for keeping
|
||||
@@ -1229,7 +1228,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
|
||||
}
|
||||
}
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1237,7 +1236,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
case LEFTMOUSE:
|
||||
if(event->val==0) {
|
||||
area_join_apply(C, op);
|
||||
WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
|
||||
area_join_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1324,7 +1323,7 @@ static int region_split_exec(bContext *C, wmOperator *op)
|
||||
else
|
||||
ar->alignment= RGN_ALIGN_VSPLIT;
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1363,7 +1362,7 @@ static int region_flip_exec(bContext *C, wmOperator *op)
|
||||
else if(ar->alignment==RGN_ALIGN_RIGHT)
|
||||
ar->alignment= RGN_ALIGN_LEFT;
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1401,7 +1400,7 @@ static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event)
|
||||
scene->r.cfra= scene->r.sfra;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C));
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ static void do_action_buttons(bContext *C, void *arg, int event)
|
||||
{
|
||||
switch(event) {
|
||||
case B_REDR:
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
ED_region_tag_redraw(CTX_wm_region(C));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,9 +289,14 @@ static void action_header_area_draw(const bContext *C, ARegion *ar)
|
||||
static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
|
||||
{
|
||||
/* context changes */
|
||||
switch(wmn->type) {
|
||||
case WM_NOTE_MARKERS_CHANGED:
|
||||
ED_region_tag_redraw(ar);
|
||||
switch(wmn->category) {
|
||||
case NC_SCENE:
|
||||
switch(wmn->data) {
|
||||
case ND_FRAME:
|
||||
case ND_MARKERS:
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ static void do_buttons_buttons(bContext *C, void *arg, int event)
|
||||
{
|
||||
switch(event) {
|
||||
case B_NEWFRAME:
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, NULL);
|
||||
break;
|
||||
case B_CONTEXT_SWITCH:
|
||||
ED_area_tag_redraw(CTX_wm_area(C));
|
||||
|
||||
@@ -275,10 +275,15 @@ static void ipo_header_area_draw(const bContext *C, ARegion *ar)
|
||||
static void ipo_main_area_listener(ARegion *ar, wmNotifier *wmn)
|
||||
{
|
||||
/* context changes */
|
||||
switch(wmn->type) {
|
||||
switch(wmn->category) {
|
||||
|
||||
case WM_NOTE_MARKERS_CHANGED:
|
||||
ED_region_tag_redraw(ar);
|
||||
case NC_SCENE:
|
||||
switch(wmn->data) {
|
||||
case ND_FRAME:
|
||||
case ND_MARKERS:
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,9 +164,10 @@ static void time_main_area_draw(const bContext *C, ARegion *ar)
|
||||
static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
|
||||
{
|
||||
/* context changes */
|
||||
switch(wmn->type) {
|
||||
switch(wmn->category) {
|
||||
|
||||
case WM_NOTE_MARKERS_CHANGED:
|
||||
case NC_SCENE:
|
||||
/* any scene change for now */
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ static void do_time_framemenu(bContext *C, void *arg, int event)
|
||||
}
|
||||
else
|
||||
scene->r.sfra = scene->r.cfra;
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
|
||||
break;
|
||||
case 2: /* Set as End */
|
||||
if (scene->r.psfra) {
|
||||
@@ -285,7 +285,7 @@ static void do_time_framemenu(bContext *C, void *arg, int event)
|
||||
}
|
||||
else
|
||||
scene->r.efra = scene->r.cfra;
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
|
||||
break;
|
||||
case 3: /* Rename Marker */
|
||||
//rename_marker();
|
||||
@@ -362,8 +362,10 @@ void do_time_buttons(bContext *C, void *arg, int event)
|
||||
|
||||
switch(event) {
|
||||
case B_REDRAWALL:
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
|
||||
break;
|
||||
case B_NEWFRAME:
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
|
||||
break;
|
||||
case B_TL_REW:
|
||||
scene->r.cfra= PSFRA;
|
||||
@@ -374,7 +376,6 @@ void do_time_buttons(bContext *C, void *arg, int event)
|
||||
break;
|
||||
case B_TL_STOP:
|
||||
ED_screen_animation_timer(C, 0);
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
break;
|
||||
case B_TL_FF:
|
||||
/* end frame */
|
||||
@@ -402,7 +403,7 @@ void do_time_buttons(bContext *C, void *arg, int event)
|
||||
scene->r.pefra= 0;
|
||||
}
|
||||
//BIF_undo_push("Set anim-preview range");
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
|
||||
break;
|
||||
|
||||
case B_TL_INSERTKEY:
|
||||
|
||||
@@ -95,7 +95,7 @@ void WM_event_remove_handlers(struct bContext *C, ListBase *handlers);
|
||||
|
||||
void WM_event_add_mousemove(struct bContext *C);
|
||||
|
||||
void WM_event_add_notifier(struct bContext *C, int type, int value, void *data);
|
||||
void WM_event_add_notifier(struct bContext *C, unsigned int type, void *data);
|
||||
|
||||
void wm_event_add (wmWindow *win, struct wmEvent *event_to_add); /* XXX only for warning */
|
||||
|
||||
|
||||
@@ -117,21 +117,53 @@ typedef struct wmNotifier {
|
||||
struct wmWindow *window;
|
||||
|
||||
int swinid;
|
||||
int type;
|
||||
int value;
|
||||
void *data;
|
||||
unsigned int category, data, subtype, action;
|
||||
|
||||
void *reference;
|
||||
|
||||
} wmNotifier;
|
||||
|
||||
|
||||
enum {
|
||||
WM_NOTE_WINDOW_REDRAW,
|
||||
WM_NOTE_SCREEN_CHANGED,
|
||||
WM_NOTE_GESTURE_REDRAW,
|
||||
WM_NOTE_MARKERS_CHANGED,
|
||||
WM_NOTE_OBJECT_CHANGED,
|
||||
WM_NOTE_LAST
|
||||
};
|
||||
/* 4 levels
|
||||
|
||||
0xFF000000; category
|
||||
0x00FF0000; data
|
||||
0x0000FF00; data subtype (unused?)
|
||||
0x000000FF; action
|
||||
*/
|
||||
|
||||
/* category */
|
||||
#define NOTE_CATEGORY 0xFF000000
|
||||
#define NC_WINDOW (1<<24)
|
||||
#define NC_SCREEN (2<<24)
|
||||
#define NC_SCENE (3<<24)
|
||||
#define NC_OBJECT (4<<24)
|
||||
#define NC_MATERIAL (5<<24)
|
||||
#define NC_TEXTURE (6<<24)
|
||||
|
||||
/* data type, 256 entries is enough, it can overlap */
|
||||
#define NOTE_DATA 0x00FF0000
|
||||
|
||||
/* Scene, node users level */
|
||||
#define ND_MARKERS (2<<16)
|
||||
#define ND_FRAME (3<<16)
|
||||
#define ND_RENDER_OPTIONS (4<<16)
|
||||
#define ND_NODES (5<<16)
|
||||
#define ND_SEQUENCER (6<<16)
|
||||
/* Object */
|
||||
#define ND_TRANSFORM (16<<16)
|
||||
#define ND_SHADING (17<<16)
|
||||
|
||||
/* subtype, 256 entries too */
|
||||
#define NOTE_SUBTYPE 0x0000FF00
|
||||
|
||||
/* action classification */
|
||||
#define NOTE_ACTION (0x000000FF)
|
||||
#define NA_EDITED 1
|
||||
#define NA_EVALUATED 2
|
||||
#define NA_ADDED 3
|
||||
#define NA_REMOVED 4
|
||||
|
||||
|
||||
/* ************** Gesture Manager data ************** */
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ void wm_event_free_all(wmWindow *win)
|
||||
/* ********************* notifiers, listeners *************** */
|
||||
|
||||
/* XXX: in future, which notifiers to send to other windows? */
|
||||
void WM_event_add_notifier(bContext *C, int type, int value, void *data)
|
||||
void WM_event_add_notifier(bContext *C, unsigned int type, void *reference)
|
||||
{
|
||||
wmNotifier *note= MEM_callocN(sizeof(wmNotifier), "notifier");
|
||||
|
||||
@@ -105,9 +105,13 @@ void WM_event_add_notifier(bContext *C, int type, int value, void *data)
|
||||
note->window= CTX_wm_window(C);
|
||||
if(CTX_wm_region(C))
|
||||
note->swinid= CTX_wm_region(C)->swinid;
|
||||
note->type= type;
|
||||
note->value= value;
|
||||
note->data= data;
|
||||
|
||||
note->category= type & NOTE_CATEGORY;
|
||||
note->data= type & NOTE_DATA;
|
||||
note->subtype= type & NOTE_SUBTYPE;
|
||||
note->action= type & NOTE_ACTION;
|
||||
|
||||
note->reference= reference;
|
||||
}
|
||||
|
||||
static wmNotifier *wm_notifier_next(wmWindowManager *wm)
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
#include "wm_event_system.h"
|
||||
#include "wm_subwindow.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "BIF_gl.h"
|
||||
#include "BIF_glutil.h"
|
||||
|
||||
@@ -227,4 +229,13 @@ void wm_gesture_draw(wmWindow *win)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wm_gesture_tag_redraw(bContext *C)
|
||||
{
|
||||
bScreen *screen= CTX_wm_screen(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
|
||||
if(screen)
|
||||
screen->do_gesture= 1;
|
||||
if(ar)
|
||||
ED_region_tag_redraw(ar);
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ int WM_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
/* add modal handler */
|
||||
WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
|
||||
wm_gesture_tag_redraw(C);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
@@ -412,7 +412,7 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
rect->ymax= event->y - sy;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
|
||||
wm_gesture_tag_redraw(C);
|
||||
|
||||
break;
|
||||
|
||||
@@ -422,7 +422,7 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
if(event->val==1) {
|
||||
if(gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
|
||||
gesture->mode= 1;
|
||||
WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
|
||||
wm_gesture_tag_redraw(C);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -448,7 +448,7 @@ int WM_gesture_circle_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
/* add modal handler */
|
||||
WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
|
||||
wm_gesture_tag_redraw(C);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
@@ -493,7 +493,7 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
rect->xmin= event->x - sx;
|
||||
rect->ymin= event->y - sy;
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
|
||||
wm_gesture_tag_redraw(C);
|
||||
|
||||
if(gesture->mode)
|
||||
gesture_circle_apply(C, op, event->type);
|
||||
@@ -501,12 +501,12 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
break;
|
||||
case WHEELUPMOUSE:
|
||||
rect->xmax += 2 + rect->xmax/10;
|
||||
WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
|
||||
wm_gesture_tag_redraw(C);
|
||||
break;
|
||||
case WHEELDOWNMOUSE:
|
||||
rect->xmax -= 2 + rect->xmax/10;
|
||||
if(rect->xmax < 1) rect->xmax= 1;
|
||||
WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
|
||||
wm_gesture_tag_redraw(C);
|
||||
break;
|
||||
case LEFTMOUSE:
|
||||
case MIDDLEMOUSE:
|
||||
@@ -554,7 +554,7 @@ static int tweak_gesture_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
/* add modal handler */
|
||||
WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
|
||||
|
||||
WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
|
||||
wm_gesture_tag_redraw(C);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
@@ -603,7 +603,7 @@ static int tweak_gesture_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else
|
||||
WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
|
||||
wm_gesture_tag_redraw(C);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -441,7 +441,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
|
||||
if(G.f & G_DEBUG) printf("ghost redraw\n");
|
||||
|
||||
wm_window_make_drawable(C, win);
|
||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -486,7 +486,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
|
||||
}
|
||||
|
||||
wm_window_make_drawable(C, win);
|
||||
WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
|
||||
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ void wm_window_keymap(wmWindowManager *wm);
|
||||
/* wm_gesture.c */
|
||||
void wm_gesture_draw(struct wmWindow *win);
|
||||
int wm_gesture_evaluate(bContext *C, wmGesture *gesture);
|
||||
void wm_gesture_tag_redraw(bContext *C);
|
||||
|
||||
#endif /* WM_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user