forked from bartvdbraak/blender
2.5
Work on getting notifiers in shape. - Most important: local (to own region or area) redraw notifiers have been depricated. This is not a good or correct notifier anyway. Notifiers should be signals to other areas. - Instead use these 2 functions: ED_area_tag_redraw(area); ED_region_tag_redraw(region); It seems to me good convention to keep the area/region redraw tag itself protected everywhere, for future improvements. - Also added a basic WM function that checks overlapping regions, and flushes redraws to underlying regions. This makes menus and buttons allow to only send local region redraws. (Brought back two "swapbuffer indicators" to test this. - Todo: area 'action zone' redraws, and fixing other notifiers... sending data pointers in a notifier seems to be bad idea.
This commit is contained in:
parent
f518fa8ea7
commit
6fe19cfc85
@ -47,6 +47,7 @@ void ED_region_do_draw(struct bContext *C, struct ARegion *ar);
|
|||||||
void ED_region_exit(struct bContext *C, struct ARegion *ar);
|
void ED_region_exit(struct bContext *C, struct ARegion *ar);
|
||||||
void ED_region_pixelspace(const struct bContext *C, struct ARegion *ar);
|
void ED_region_pixelspace(const struct bContext *C, struct ARegion *ar);
|
||||||
void ED_region_init(struct bContext *C, struct ARegion *ar);
|
void ED_region_init(struct bContext *C, struct ARegion *ar);
|
||||||
|
void ED_region_tag_redraw(struct ARegion *ar);
|
||||||
|
|
||||||
/* spaces */
|
/* spaces */
|
||||||
void ED_spacetypes_init(void);
|
void ED_spacetypes_init(void);
|
||||||
@ -59,6 +60,7 @@ void ED_area_initialize(struct wmWindowManager *wm, struct wmWindow *win, struct
|
|||||||
void ED_area_exit(struct bContext *C, struct ScrArea *sa);
|
void ED_area_exit(struct bContext *C, struct ScrArea *sa);
|
||||||
void ED_area_do_draw(struct bContext *C, struct ScrArea *sa);
|
void ED_area_do_draw(struct bContext *C, struct ScrArea *sa);
|
||||||
int ED_screen_area_active(const struct bContext *C);
|
int ED_screen_area_active(const struct bContext *C);
|
||||||
|
void ED_area_tag_redraw(ScrArea *sa);
|
||||||
|
|
||||||
/* screens */
|
/* screens */
|
||||||
void ED_screens_initialize(struct wmWindowManager *wm);
|
void ED_screens_initialize(struct wmWindowManager *wm);
|
||||||
|
@ -101,7 +101,9 @@ enum {
|
|||||||
|
|
||||||
/* ------ Define for UI_view2d_sync ----- */
|
/* ------ Define for UI_view2d_sync ----- */
|
||||||
|
|
||||||
/* means copy it from the other v2d */
|
/* means copy it from another v2d */
|
||||||
|
#define V2D_LOCK_SET 0
|
||||||
|
/* means copy it to the other v2ds */
|
||||||
#define V2D_LOCK_COPY 1
|
#define V2D_LOCK_COPY 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
#include "BKE_texture.h"
|
#include "BKE_texture.h"
|
||||||
#include "BKE_utildefines.h"
|
#include "BKE_utildefines.h"
|
||||||
|
|
||||||
|
#include "ED_screen.h"
|
||||||
|
|
||||||
#include "UI_interface.h"
|
#include "UI_interface.h"
|
||||||
#include "UI_text.h"
|
#include "UI_text.h"
|
||||||
#include "interface.h"
|
#include "interface.h"
|
||||||
@ -1272,7 +1274,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(changed || (retval == WM_UI_HANDLER_BREAK))
|
if(changed || (retval == WM_UI_HANDLER_BREAK))
|
||||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
ED_region_tag_redraw(data->region);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
|
static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
|
||||||
@ -1298,7 +1300,7 @@ static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, u
|
|||||||
|
|
||||||
if(retval == WM_UI_HANDLER_BREAK) {
|
if(retval == WM_UI_HANDLER_BREAK) {
|
||||||
ui_check_but(but);
|
ui_check_but(but);
|
||||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
ED_region_tag_redraw(data->region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1354,7 +1356,7 @@ static void ui_numedit_apply(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
|
|||||||
if(data->interactive) ui_apply_button(C, block, but, data, 1);
|
if(data->interactive) ui_apply_button(C, block, but, data, 1);
|
||||||
else ui_check_but(but);
|
else ui_check_but(but);
|
||||||
|
|
||||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
ED_region_tag_redraw(data->region);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ****************** menu opening for various types **************** */
|
/* ****************** menu opening for various types **************** */
|
||||||
@ -2808,7 +2810,6 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
|
|||||||
}
|
}
|
||||||
|
|
||||||
data->state= state;
|
data->state= state;
|
||||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type)
|
static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type)
|
||||||
@ -2880,7 +2881,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
|
|||||||
but->flag &= ~(UI_ACTIVE|UI_SELECT);
|
but->flag &= ~(UI_ACTIVE|UI_SELECT);
|
||||||
|
|
||||||
/* redraw */
|
/* redraw */
|
||||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
ED_region_tag_redraw(data->region);
|
||||||
|
|
||||||
/* adds empty mousemove in queue for re-init handler, in case mouse is
|
/* adds empty mousemove in queue for re-init handler, in case mouse is
|
||||||
* still over a button. we cannot just check for this ourselfs because
|
* still over a button. we cannot just check for this ourselfs because
|
||||||
@ -2978,7 +2979,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
|
|||||||
|
|
||||||
if(!data->tooltip) {
|
if(!data->tooltip) {
|
||||||
data->tooltip= ui_tooltip_create(C, data->region, but);
|
data->tooltip= ui_tooltip_create(C, data->region, but);
|
||||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
ED_region_tag_redraw(data->region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* handle menu auto open timer */
|
/* handle menu auto open timer */
|
||||||
@ -3014,14 +3015,14 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
|
|||||||
if(!(but->flag & UI_SELECT)) {
|
if(!(but->flag & UI_SELECT)) {
|
||||||
but->flag |= UI_SELECT;
|
but->flag |= UI_SELECT;
|
||||||
data->cancel= 0;
|
data->cancel= 0;
|
||||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
ED_region_tag_redraw(data->region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(but->flag & UI_SELECT) {
|
if(but->flag & UI_SELECT) {
|
||||||
but->flag &= ~UI_SELECT;
|
but->flag &= ~UI_SELECT;
|
||||||
data->cancel= 1;
|
data->cancel= 1;
|
||||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
ED_region_tag_redraw(data->region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -355,7 +355,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
|
|||||||
ED_region_init(C, ar);
|
ED_region_init(C, ar);
|
||||||
|
|
||||||
/* notify change and redraw */
|
/* notify change and redraw */
|
||||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
ED_region_tag_redraw(ar);
|
||||||
|
|
||||||
return ar;
|
return ar;
|
||||||
}
|
}
|
||||||
@ -671,7 +671,7 @@ uiMenuBlockHandle *ui_menu_block_create(bContext *C, ARegion *butregion, uiBut *
|
|||||||
wm_subwindow_getmatrix(C->window, ar->swinid, block->winmat);
|
wm_subwindow_getmatrix(C->window, ar->swinid, block->winmat);
|
||||||
|
|
||||||
/* notify change and redraw */
|
/* notify change and redraw */
|
||||||
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
|
ED_region_tag_redraw(ar);
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
@ -1526,7 +1526,7 @@ void UI_view2d_getscale(View2D *v2d, float *x, float *y)
|
|||||||
if (y) *y = (v2d->mask.ymax - v2d->mask.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
|
if (y) *y = (v2d->mask.ymax - v2d->mask.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* called by notifier WM_NOTE_TIMELINE_SYNC */
|
||||||
void UI_view2d_sync(View2D *v2d, View2D *v2dfrom, int flag)
|
void UI_view2d_sync(View2D *v2d, View2D *v2dfrom, int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -48,6 +48,8 @@
|
|||||||
|
|
||||||
#include "BIF_gl.h"
|
#include "BIF_gl.h"
|
||||||
|
|
||||||
|
#include "ED_screen.h"
|
||||||
|
|
||||||
#include "UI_resources.h"
|
#include "UI_resources.h"
|
||||||
#include "UI_view2d.h"
|
#include "UI_view2d.h"
|
||||||
|
|
||||||
@ -164,7 +166,7 @@ static void view_pan_apply(bContext *C, wmOperator *op)
|
|||||||
UI_view2d_curRect_validate(v2d);
|
UI_view2d_curRect_validate(v2d);
|
||||||
|
|
||||||
/* request updates to be done... */
|
/* request updates to be done... */
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
if(v2d->flag & V2D_VIEWSYNC_X)
|
if(v2d->flag & V2D_VIEWSYNC_X)
|
||||||
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
|
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
|
||||||
}
|
}
|
||||||
@ -493,7 +495,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
|
|||||||
UI_view2d_curRect_validate(v2d);
|
UI_view2d_curRect_validate(v2d);
|
||||||
|
|
||||||
/* request updates to be done... */
|
/* request updates to be done... */
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
if(v2d->flag & V2D_VIEWSYNC_X)
|
if(v2d->flag & V2D_VIEWSYNC_X)
|
||||||
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
|
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
|
||||||
}
|
}
|
||||||
@ -646,7 +648,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
|
|||||||
UI_view2d_curRect_validate(v2d);
|
UI_view2d_curRect_validate(v2d);
|
||||||
|
|
||||||
/* request updates to be done... */
|
/* request updates to be done... */
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
if(v2d->flag & V2D_VIEWSYNC_X)
|
if(v2d->flag & V2D_VIEWSYNC_X)
|
||||||
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
|
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
|
||||||
}
|
}
|
||||||
@ -1027,7 +1029,7 @@ static void scroller_activate_apply(bContext *C, wmOperator *op)
|
|||||||
UI_view2d_curRect_validate(v2d);
|
UI_view2d_curRect_validate(v2d);
|
||||||
|
|
||||||
/* request updates to be done... */
|
/* request updates to be done... */
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
if(v2d->flag & V2D_VIEWSYNC_X)
|
if(v2d->flag & V2D_VIEWSYNC_X)
|
||||||
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
|
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_COPY, v2d);
|
||||||
}
|
}
|
||||||
|
@ -108,11 +108,9 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note)
|
|||||||
/* generic notes first */
|
/* generic notes first */
|
||||||
switch(note->type) {
|
switch(note->type) {
|
||||||
case WM_NOTE_WINDOW_REDRAW:
|
case WM_NOTE_WINDOW_REDRAW:
|
||||||
case WM_NOTE_AREA_REDRAW:
|
|
||||||
case WM_NOTE_REGION_REDRAW:
|
|
||||||
case WM_NOTE_GESTURE_REDRAW:
|
case WM_NOTE_GESTURE_REDRAW:
|
||||||
case WM_NOTE_SCREEN_CHANGED:
|
case WM_NOTE_SCREEN_CHANGED:
|
||||||
ar->do_draw= 1;
|
ED_region_tag_redraw(ar);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if(ar->type->listener)
|
if(ar->type->listener)
|
||||||
@ -175,6 +173,26 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
|
|||||||
ar->do_draw= 0;
|
ar->do_draw= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* **********************************
|
||||||
|
maybe silly, but let's try for now
|
||||||
|
to keep do_draw tags protected
|
||||||
|
********************************** */
|
||||||
|
|
||||||
|
void ED_region_tag_redraw(ARegion *ar)
|
||||||
|
{
|
||||||
|
ar->do_draw= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ED_area_tag_redraw(ScrArea *sa)
|
||||||
|
{
|
||||||
|
ARegion *ar;
|
||||||
|
|
||||||
|
for(ar= sa->regionbase.first; ar; ar= ar->next)
|
||||||
|
ar->do_draw= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* *************************************************************** */
|
/* *************************************************************** */
|
||||||
|
|
||||||
/* dir is direction to check, not the splitting edge direction! */
|
/* dir is direction to check, not the splitting edge direction! */
|
||||||
@ -489,7 +507,7 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
|
|||||||
/* *********** Space switching code, local now *********** */
|
/* *********** Space switching code, local now *********** */
|
||||||
/* XXX make operator for this */
|
/* XXX make operator for this */
|
||||||
|
|
||||||
static void newspace(bContext *C, ScrArea *sa, int type)
|
static void area_newspace(bContext *C, ScrArea *sa, int type)
|
||||||
{
|
{
|
||||||
if(sa->spacetype != type) {
|
if(sa->spacetype != type) {
|
||||||
SpaceType *st;
|
SpaceType *st;
|
||||||
@ -538,11 +556,11 @@ static void newspace(bContext *C, ScrArea *sa, int type)
|
|||||||
slold->regionbase= sa->regionbase;
|
slold->regionbase= sa->regionbase;
|
||||||
sa->regionbase= sl->regionbase;
|
sa->regionbase= sl->regionbase;
|
||||||
sl->regionbase.first= sl->regionbase.last= NULL;
|
sl->regionbase.first= sl->regionbase.last= NULL;
|
||||||
|
|
||||||
ED_area_initialize(C->wm, C->window, sa);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ED_area_initialize(C->wm, C->window, sa);
|
||||||
|
|
||||||
/* tell WM to refresh, cursor types etc */
|
/* tell WM to refresh, cursor types etc */
|
||||||
WM_event_add_mousemove(C);
|
WM_event_add_mousemove(C);
|
||||||
}
|
}
|
||||||
@ -588,8 +606,8 @@ static char *windowtype_pup(void)
|
|||||||
|
|
||||||
static void spacefunc(struct bContext *C, void *arg1, void *arg2)
|
static void spacefunc(struct bContext *C, void *arg1, void *arg2)
|
||||||
{
|
{
|
||||||
newspace(C, C->area, C->area->butspacetype);
|
area_newspace(C, C->area, C->area->butspacetype);
|
||||||
WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns offset for next button in header */
|
/* returns offset for next button in header */
|
||||||
|
@ -924,7 +924,7 @@ void ED_screen_do_listen(wmWindow *win, wmNotifier *note)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* only for edge lines between areas, and the blended join arrows */
|
||||||
void ED_screen_draw(wmWindow *win)
|
void ED_screen_draw(wmWindow *win)
|
||||||
{
|
{
|
||||||
ScrArea *sa;
|
ScrArea *sa;
|
||||||
@ -1010,6 +1010,9 @@ void ED_screens_initialize(wmWindowManager *wm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* *********** exit calls are for closing running stuff ******** */
|
||||||
|
|
||||||
void ED_region_exit(bContext *C, ARegion *ar)
|
void ED_region_exit(bContext *C, ARegion *ar)
|
||||||
{
|
{
|
||||||
ARegion *prevar= C->region;
|
ARegion *prevar= C->region;
|
||||||
@ -1110,7 +1113,7 @@ void ED_screen_set_subwinactive(wmWindow *win, wmEvent *event)
|
|||||||
if(do_draw) {
|
if(do_draw) {
|
||||||
for(ar= sa->regionbase.first; ar; ar= ar->next)
|
for(ar= sa->regionbase.first; ar; ar= ar->next)
|
||||||
if(ar->regiontype==RGN_TYPE_HEADER)
|
if(ar->regiontype==RGN_TYPE_HEADER)
|
||||||
ar->do_draw= 1; /* XXX */
|
ED_region_tag_redraw(ar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
|
|||||||
/* draw entirely, view changes should be handled here */
|
/* draw entirely, view changes should be handled here */
|
||||||
// SpaceButs *sbuts= C->area->spacedata.first;
|
// SpaceButs *sbuts= C->area->spacedata.first;
|
||||||
View2D *v2d= &ar->v2d;
|
View2D *v2d= &ar->v2d;
|
||||||
float col[3];
|
float col[3], fac;
|
||||||
|
|
||||||
/* clear and setup matrix */
|
/* clear and setup matrix */
|
||||||
UI_GetThemeColor3fv(TH_BACK, col);
|
UI_GetThemeColor3fv(TH_BACK, col);
|
||||||
@ -167,6 +167,11 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
|
|||||||
|
|
||||||
UI_view2d_view_ortho(C, v2d);
|
UI_view2d_view_ortho(C, v2d);
|
||||||
|
|
||||||
|
/* swapbuffers indicator */
|
||||||
|
fac= BLI_frand();
|
||||||
|
glColor3f(fac, fac, fac);
|
||||||
|
glRecti(20, 2, 30, 12);
|
||||||
|
|
||||||
/* data... */
|
/* data... */
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ static void ed_marker_move_cancel(bContext *C, wmOperator *op)
|
|||||||
ed_marker_move_apply(C, op);
|
ed_marker_move_apply(C, op);
|
||||||
ed_marker_move_exit(C, op);
|
ed_marker_move_exit(C, op);
|
||||||
|
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
|
|||||||
case RIGHTMOUSE:
|
case RIGHTMOUSE:
|
||||||
if(WM_modal_tweak_check(evt, mm->event_type)) {
|
if(WM_modal_tweak_check(evt, mm->event_type)) {
|
||||||
ed_marker_move_exit(C, op);
|
ed_marker_move_exit(C, op);
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ XXX else if (mm->slink->spacetype == SPACE_ACTION) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
// headerprint(str); XXX
|
// headerprint(str); XXX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -619,7 +619,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend)
|
|||||||
select_timeline_marker_frame(cfra, 0);
|
select_timeline_marker_frame(cfra, 0);
|
||||||
|
|
||||||
/* XXX notifier for markers... */
|
/* XXX notifier for markers... */
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
|
|
||||||
return OPERATOR_PASS_THROUGH;
|
return OPERATOR_PASS_THROUGH;
|
||||||
}
|
}
|
||||||
@ -713,7 +713,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* XXX notifier for markers... */
|
/* XXX notifier for markers... */
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -767,7 +767,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* XXX notifier for markers... */
|
/* XXX notifier for markers... */
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@ -815,7 +815,7 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
/* XXX notifier for markers... */
|
/* XXX notifier for markers... */
|
||||||
if(changed)
|
if(changed)
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
|
|||||||
switch(wmn->type) {
|
switch(wmn->type) {
|
||||||
case WM_NOTE_TIMELINE_SYNC:
|
case WM_NOTE_TIMELINE_SYNC:
|
||||||
if(ar->v2d.flag & V2D_VIEWSYNC_X) {
|
if(ar->v2d.flag & V2D_VIEWSYNC_X) {
|
||||||
ar->do_draw= 1; /* XXX GAH! */
|
ED_region_tag_redraw(ar);
|
||||||
UI_view2d_sync(&ar->v2d, wmn->data, wmn->value);
|
UI_view2d_sync(&ar->v2d, wmn->data, wmn->value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -162,7 +162,7 @@ static void do_time_viewmenu(bContext *C, void *arg, int event)
|
|||||||
v2d->cur.xmin=v2d->tot.xmin= (float)first-2;
|
v2d->cur.xmin=v2d->tot.xmin= (float)first-2;
|
||||||
v2d->cur.xmax=v2d->tot.xmax= (float)C->scene->r.efra+2;
|
v2d->cur.xmax=v2d->tot.xmax= (float)C->scene->r.efra+2;
|
||||||
|
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: /* Maximize Window */
|
case 4: /* Maximize Window */
|
||||||
@ -170,7 +170,7 @@ static void do_time_viewmenu(bContext *C, void *arg, int event)
|
|||||||
break;
|
break;
|
||||||
case 5: /* show time or frames */
|
case 5: /* show time or frames */
|
||||||
stime->flag ^= TIME_DRAWFRAMES;
|
stime->flag ^= TIME_DRAWFRAMES;
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
//nextprev_marker(1);
|
//nextprev_marker(1);
|
||||||
@ -191,12 +191,12 @@ static void do_time_viewmenu(bContext *C, void *arg, int event)
|
|||||||
if(v2d) {
|
if(v2d) {
|
||||||
v2d->flag ^= V2D_VIEWSYNC_X;
|
v2d->flag ^= V2D_VIEWSYNC_X;
|
||||||
if(v2d->flag & V2D_VIEWSYNC_X)
|
if(v2d->flag & V2D_VIEWSYNC_X)
|
||||||
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, 0, v2d); /* XXX can notifier be called after data free? */
|
WM_event_add_notifier(C, WM_NOTE_TIMELINE_SYNC, V2D_LOCK_SET, v2d);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 12: /* only show keyframes from selected data */
|
case 12: /* only show keyframes from selected data */
|
||||||
stime->flag ^= TIME_ONLYACTSEL;
|
stime->flag ^= TIME_ONLYACTSEL;
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,13 +188,17 @@ void view3d_keymap(struct wmWindowManager *wm)
|
|||||||
static void view3d_main_area_draw(const bContext *C, ARegion *ar)
|
static void view3d_main_area_draw(const bContext *C, ARegion *ar)
|
||||||
{
|
{
|
||||||
/* draw entirely, view changes should be handled here */
|
/* draw entirely, view changes should be handled here */
|
||||||
float col[3];
|
float col[3], fac;
|
||||||
|
|
||||||
/* clear and setup matrix */
|
/* clear and setup matrix */
|
||||||
UI_GetThemeColor3fv(TH_BACK, col);
|
UI_GetThemeColor3fv(TH_BACK, col);
|
||||||
glClearColor(col[0], col[1], col[2], 0.0);
|
glClearColor(col[0], col[1], col[2], 0.0);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
/* swapbuffers indicator */
|
||||||
|
fac= BLI_frand();
|
||||||
|
glColor3f(fac, fac, fac);
|
||||||
|
glRecti(20, 2, 30, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,8 +120,6 @@ typedef struct wmNotifier {
|
|||||||
enum {
|
enum {
|
||||||
WM_NOTE_WINDOW_REDRAW,
|
WM_NOTE_WINDOW_REDRAW,
|
||||||
WM_NOTE_SCREEN_CHANGED,
|
WM_NOTE_SCREEN_CHANGED,
|
||||||
WM_NOTE_AREA_REDRAW,
|
|
||||||
WM_NOTE_REGION_REDRAW,
|
|
||||||
WM_NOTE_GESTURE_REDRAW,
|
WM_NOTE_GESTURE_REDRAW,
|
||||||
|
|
||||||
WM_NOTE_TIMELINE_SYNC,
|
WM_NOTE_TIMELINE_SYNC,
|
||||||
|
@ -104,8 +104,6 @@ void WM_event_add_notifier(bContext *C, int type, int value, void *data)
|
|||||||
|
|
||||||
/* catch local notifications here */
|
/* catch local notifications here */
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case WM_NOTE_AREA_REDRAW:
|
|
||||||
case WM_NOTE_REGION_REDRAW:
|
|
||||||
case WM_NOTE_GESTURE_REDRAW:
|
case WM_NOTE_GESTURE_REDRAW:
|
||||||
if(C->region)
|
if(C->region)
|
||||||
note->swinid= C->region->swinid;
|
note->swinid= C->region->swinid;
|
||||||
@ -180,24 +178,39 @@ void wm_event_do_notifiers(bContext *C)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wm_flush_draw_updates(bScreen *screen, rcti *dirty)
|
||||||
|
{
|
||||||
|
ScrArea *sa;
|
||||||
|
ARegion *ar;
|
||||||
|
|
||||||
|
for(sa= screen->areabase.first; sa; sa= sa->next) {
|
||||||
|
for(ar=sa->regionbase.first; ar; ar= ar->next) {
|
||||||
|
if( BLI_isect_rcti(dirty, &ar->winrct, NULL) )
|
||||||
|
ar->do_draw= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* quick test to prevent changing window drawable */
|
/* quick test to prevent changing window drawable */
|
||||||
static int wm_draw_update_test_window(wmWindow *win)
|
static int wm_draw_update_test_window(wmWindow *win)
|
||||||
{
|
{
|
||||||
ScrArea *sa;
|
ScrArea *sa;
|
||||||
ARegion *ar;
|
ARegion *ar;
|
||||||
|
|
||||||
|
/* flush */
|
||||||
|
for(ar=win->screen->regionbase.first; ar; ar= ar->next) {
|
||||||
|
if(ar->swinid && ar->do_draw) {
|
||||||
|
wm_flush_draw_updates(win->screen, &ar->winrct);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(win->screen->do_refresh)
|
if(win->screen->do_refresh)
|
||||||
return 1;
|
return 1;
|
||||||
if(win->screen->do_draw)
|
if(win->screen->do_draw)
|
||||||
return 1;
|
return 1;
|
||||||
if(win->screen->do_gesture)
|
if(win->screen->do_gesture)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for(ar=win->screen->regionbase.first; ar; ar= ar->next) {
|
|
||||||
if(ar->swinid && ar->do_draw)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
|
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
|
||||||
for(ar=sa->regionbase.first; ar; ar= ar->next) {
|
for(ar=sa->regionbase.first; ar; ar= ar->next) {
|
||||||
if(ar->swinid && ar->do_draw)
|
if(ar->swinid && ar->do_draw)
|
||||||
|
@ -201,7 +201,7 @@ static void border_select_end(bContext *C, wmOperator *op)
|
|||||||
WM_gesture_end(C, gesture); /* frees gesture itself, and unregisters from window */
|
WM_gesture_end(C, gesture); /* frees gesture itself, and unregisters from window */
|
||||||
op->customdata= NULL;
|
op->customdata= NULL;
|
||||||
|
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ static void tweak_gesture_end(bContext *C, wmOperator *op)
|
|||||||
WM_gesture_end(C, gesture); /* frees gesture itself, and unregisters from window */
|
WM_gesture_end(C, gesture); /* frees gesture itself, and unregisters from window */
|
||||||
op->customdata= NULL;
|
op->customdata= NULL;
|
||||||
|
|
||||||
WM_event_add_notifier(C, WM_NOTE_AREA_REDRAW, 0, NULL);
|
ED_area_tag_redraw(C->area);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user