diff options
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_cursors.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_dragdrop.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 358 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 152 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 18 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture_ops.c | 20 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 30 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operator_type.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operator_utils.c | 6 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 36 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_splash_screen.c | 6 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_stereo.c | 20 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_subwindow.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_tooltip.c | 12 |
15 files changed, 348 insertions, 338 deletions
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 41987f6d6d7..f69bc822f44 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -183,9 +183,9 @@ void WM_cursor_set(wmWindow *win, int curs) } } -bool WM_cursor_set_from_tool(struct wmWindow *win, const ScrArea *sa, const ARegion *ar) +bool WM_cursor_set_from_tool(struct wmWindow *win, const ScrArea *sa, const ARegion *region) { - if (ar && (ar->regiontype != RGN_TYPE_WINDOW)) { + if (region && (region->regiontype != RGN_TYPE_WINDOW)) { return false; } diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index e2462bb59b1..a45c8af0b5a 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -223,7 +223,7 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, const wmEvent *e { wmWindow *win = CTX_wm_window(C); ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); const char *name; name = dropbox_active(C, &win->handlers, drag, event); @@ -236,7 +236,7 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, const wmEvent *e return name; } - name = dropbox_active(C, &ar->handlers, drag, event); + name = dropbox_active(C, ®ion->handlers, drag, event); if (name) { return name; } diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 0d33ce87366..9ccff2a3e3d 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -74,31 +74,31 @@ /* ******************* paint cursor *************** */ -static void wm_paintcursor_draw(bContext *C, ScrArea *sa, ARegion *ar) +static void wm_paintcursor_draw(bContext *C, ScrArea *sa, ARegion *region) { wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); bScreen *screen = WM_window_get_active_screen(win); wmPaintCursor *pc; - if (ar->visible && ar == screen->active_region) { + if (region->visible && region == screen->active_region) { for (pc = wm->paintcursors.first; pc; pc = pc->next) { if ((pc->space_type != SPACE_TYPE_ANY) && (sa->spacetype != pc->space_type)) { continue; } - if ((pc->region_type != RGN_TYPE_ANY) && (ar->regiontype != pc->region_type)) { + if ((pc->region_type != RGN_TYPE_ANY) && (region->regiontype != pc->region_type)) { continue; } if (pc->poll == NULL || pc->poll(C)) { /* Prevent drawing outside region. */ glEnable(GL_SCISSOR_TEST); - glScissor(ar->winrct.xmin, - ar->winrct.ymin, - BLI_rcti_size_x(&ar->winrct) + 1, - BLI_rcti_size_y(&ar->winrct) + 1); + glScissor(region->winrct.xmin, + region->winrct.ymin, + BLI_rcti_size_x(®ion->winrct) + 1, + BLI_rcti_size_y(®ion->winrct) + 1); if (ELEM(win->grabcursor, GHOST_kGrabWrap, GHOST_kGrabHide)) { int x = 0, y = 0; @@ -115,17 +115,20 @@ static void wm_paintcursor_draw(bContext *C, ScrArea *sa, ARegion *ar) } } -static bool wm_draw_region_stereo_set(Main *bmain, ScrArea *sa, ARegion *ar, eStereoViews sview) +static bool wm_draw_region_stereo_set(Main *bmain, + ScrArea *sa, + ARegion *region, + eStereoViews sview) { /* We could detect better when stereo is actually needed, by inspecting the * image in the image editor and sequencer. */ - if (!ELEM(ar->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_PREVIEW)) { + if (!ELEM(region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_PREVIEW)) { return false; } switch (sa->spacetype) { case SPACE_IMAGE: { - if (ar->regiontype == RGN_TYPE_WINDOW) { + if (region->regiontype == RGN_TYPE_WINDOW) { SpaceImage *sima = sa->spacedata.first; sima->iuser.multiview_eye = sview; return true; @@ -133,7 +136,7 @@ static bool wm_draw_region_stereo_set(Main *bmain, ScrArea *sa, ARegion *ar, eSt break; } case SPACE_VIEW3D: { - if (ar->regiontype == RGN_TYPE_WINDOW) { + if (region->regiontype == RGN_TYPE_WINDOW) { View3D *v3d = sa->spacedata.first; if (v3d->camera && v3d->camera->type == OB_CAMERA) { Camera *cam = v3d->camera->data; @@ -148,7 +151,7 @@ static bool wm_draw_region_stereo_set(Main *bmain, ScrArea *sa, ARegion *ar, eSt break; } case SPACE_NODE: { - if (ar->regiontype == RGN_TYPE_WINDOW) { + if (region->regiontype == RGN_TYPE_WINDOW) { SpaceNode *snode = sa->spacedata.first; if ((snode->flag & SNODE_BACKDRAW) && ED_node_is_compositor(snode)) { Image *ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); @@ -162,10 +165,10 @@ static bool wm_draw_region_stereo_set(Main *bmain, ScrArea *sa, ARegion *ar, eSt SpaceSeq *sseq = sa->spacedata.first; sseq->multiview_eye = sview; - if (ar->regiontype == RGN_TYPE_PREVIEW) { + if (region->regiontype == RGN_TYPE_PREVIEW) { return true; } - else if (ar->regiontype == RGN_TYPE_WINDOW) { + else if (region->regiontype == RGN_TYPE_WINDOW) { return (sseq->draw_flag & SEQ_DRAW_BACKDROP) != 0; } } @@ -183,19 +186,19 @@ static void wm_area_mark_invalid_backbuf(ScrArea *sa) } } -static void wm_region_test_gizmo_do_draw(ARegion *ar, bool tag_redraw) +static void wm_region_test_gizmo_do_draw(ARegion *region, bool tag_redraw) { - if (ar->gizmo_map == NULL) { + if (region->gizmo_map == NULL) { return; } - wmGizmoMap *gzmap = ar->gizmo_map; + wmGizmoMap *gzmap = region->gizmo_map; for (wmGizmoGroup *gzgroup = WM_gizmomap_group_list(gzmap)->first; gzgroup; gzgroup = gzgroup->next) { for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) { if (gz->do_draw) { if (tag_redraw) { - ED_region_tag_redraw_no_rebuild(ar); + ED_region_tag_redraw_no_rebuild(region); } gz->do_draw = false; } @@ -206,30 +209,30 @@ static void wm_region_test_gizmo_do_draw(ARegion *ar, bool tag_redraw) static void wm_region_test_render_do_draw(const Scene *scene, struct Depsgraph *depsgraph, ScrArea *sa, - ARegion *ar) + ARegion *region) { /* tag region for redraw from render engine preview running inside of it */ - if (sa->spacetype == SPACE_VIEW3D && ar->regiontype == RGN_TYPE_WINDOW) { - RegionView3D *rv3d = ar->regiondata; + if (sa->spacetype == SPACE_VIEW3D && region->regiontype == RGN_TYPE_WINDOW) { + RegionView3D *rv3d = region->regiondata; RenderEngine *engine = rv3d->render_engine; - GPUViewport *viewport = WM_draw_region_get_viewport(ar, 0); + GPUViewport *viewport = WM_draw_region_get_viewport(region, 0); if (engine && (engine->flag & RE_ENGINE_DO_DRAW)) { View3D *v3d = sa->spacedata.first; rcti border_rect; /* do partial redraw when possible */ - if (ED_view3d_calc_render_border(scene, depsgraph, v3d, ar, &border_rect)) { - ED_region_tag_redraw_partial(ar, &border_rect, false); + if (ED_view3d_calc_render_border(scene, depsgraph, v3d, region, &border_rect)) { + ED_region_tag_redraw_partial(region, &border_rect, false); } else { - ED_region_tag_redraw_no_rebuild(ar); + ED_region_tag_redraw_no_rebuild(region); } engine->flag &= ~RE_ENGINE_DO_DRAW; } else if (viewport && GPU_viewport_do_update(viewport)) { - ED_region_tag_redraw_no_rebuild(ar); + ED_region_tag_redraw_no_rebuild(region); } } } @@ -239,9 +242,9 @@ static bool wm_region_use_viewport_by_type(short space_type, short region_type) return (ELEM(space_type, SPACE_VIEW3D, SPACE_IMAGE) && region_type == RGN_TYPE_WINDOW); } -static bool wm_region_use_viewport(ScrArea *sa, ARegion *ar) +static bool wm_region_use_viewport(ScrArea *sa, ARegion *region) { - return wm_region_use_viewport_by_type(sa->spacetype, ar->regiontype); + return wm_region_use_viewport_by_type(sa->spacetype, region->regiontype); } /********************** draw all **************************/ @@ -293,20 +296,20 @@ static void wm_draw_callbacks(wmWindow *win) * change. It also means we can share a single context for multiple windows, * so that for example VAOs can be shared between windows. */ -static void wm_draw_region_buffer_free(ARegion *ar) +static void wm_draw_region_buffer_free(ARegion *region) { - if (ar->draw_buffer) { + if (region->draw_buffer) { for (int view = 0; view < 2; view++) { - if (ar->draw_buffer->offscreen[view]) { - GPU_offscreen_free(ar->draw_buffer->offscreen[view]); + if (region->draw_buffer->offscreen[view]) { + GPU_offscreen_free(region->draw_buffer->offscreen[view]); } - if (ar->draw_buffer->viewport[view]) { - GPU_viewport_free(ar->draw_buffer->viewport[view]); + if (region->draw_buffer->viewport[view]) { + GPU_viewport_free(region->draw_buffer->viewport[view]); } } - MEM_freeN(ar->draw_buffer); - ar->draw_buffer = NULL; + MEM_freeN(region->draw_buffer); + region->draw_buffer = NULL; } } @@ -329,36 +332,37 @@ static void wm_draw_offscreen_texture_parameters(GPUOffScreen *offscreen) glBindTexture(GL_TEXTURE_2D, 0); } -static void wm_draw_region_buffer_create(ARegion *ar, bool stereo, bool use_viewport) +static void wm_draw_region_buffer_create(ARegion *region, bool stereo, bool use_viewport) { - if (ar->draw_buffer) { - if (ar->draw_buffer->stereo != stereo) { + if (region->draw_buffer) { + if (region->draw_buffer->stereo != stereo) { /* Free draw buffer on stereo changes. */ - wm_draw_region_buffer_free(ar); + wm_draw_region_buffer_free(region); } else { /* Free offscreen buffer on size changes. Viewport auto resizes. */ - GPUOffScreen *offscreen = ar->draw_buffer->offscreen[0]; - if (offscreen && (GPU_offscreen_width(offscreen) != ar->winx || - GPU_offscreen_height(offscreen) != ar->winy)) { - wm_draw_region_buffer_free(ar); + GPUOffScreen *offscreen = region->draw_buffer->offscreen[0]; + if (offscreen && (GPU_offscreen_width(offscreen) != region->winx || + GPU_offscreen_height(offscreen) != region->winy)) { + wm_draw_region_buffer_free(region); } } } - if (!ar->draw_buffer) { + if (!region->draw_buffer) { if (use_viewport) { /* Allocate viewport which includes an offscreen buffer with depth * multisample, etc. */ - ar->draw_buffer = MEM_callocN(sizeof(wmDrawBuffer), "wmDrawBuffer"); - ar->draw_buffer->viewport[0] = GPU_viewport_create(); - ar->draw_buffer->viewport[1] = (stereo) ? GPU_viewport_create() : NULL; + region->draw_buffer = MEM_callocN(sizeof(wmDrawBuffer), "wmDrawBuffer"); + region->draw_buffer->viewport[0] = GPU_viewport_create(); + region->draw_buffer->viewport[1] = (stereo) ? GPU_viewport_create() : NULL; } else { /* Allocate offscreen buffer if it does not exist. This one has no * depth or multisample buffers. 3D view creates own buffers with * the data it needs. */ - GPUOffScreen *offscreen = GPU_offscreen_create(ar->winx, ar->winy, 0, false, false, NULL); + GPUOffScreen *offscreen = GPU_offscreen_create( + region->winx, region->winy, 0, false, false, NULL); if (!offscreen) { return; } @@ -367,7 +371,7 @@ static void wm_draw_region_buffer_create(ARegion *ar, bool stereo, bool use_view GPUOffScreen *offscreen_right = NULL; if (stereo) { - offscreen_right = GPU_offscreen_create(ar->winx, ar->winy, 0, false, false, NULL); + offscreen_right = GPU_offscreen_create(region->winx, region->winy, 0, false, false, NULL); if (!offscreen_right) { GPU_offscreen_free(offscreen); @@ -377,57 +381,57 @@ static void wm_draw_region_buffer_create(ARegion *ar, bool stereo, bool use_view wm_draw_offscreen_texture_parameters(offscreen_right); } - ar->draw_buffer = MEM_callocN(sizeof(wmDrawBuffer), "wmDrawBuffer"); - ar->draw_buffer->offscreen[0] = offscreen; - ar->draw_buffer->offscreen[1] = offscreen_right; + region->draw_buffer = MEM_callocN(sizeof(wmDrawBuffer), "wmDrawBuffer"); + region->draw_buffer->offscreen[0] = offscreen; + region->draw_buffer->offscreen[1] = offscreen_right; } - ar->draw_buffer->bound_view = -1; - ar->draw_buffer->stereo = stereo; + region->draw_buffer->bound_view = -1; + region->draw_buffer->stereo = stereo; } } -static void wm_draw_region_bind(ARegion *ar, int view) +static void wm_draw_region_bind(ARegion *region, int view) { - if (!ar->draw_buffer) { + if (!region->draw_buffer) { return; } - if (ar->draw_buffer->viewport[view]) { - GPU_viewport_bind(ar->draw_buffer->viewport[view], &ar->winrct); + if (region->draw_buffer->viewport[view]) { + GPU_viewport_bind(region->draw_buffer->viewport[view], ®ion->winrct); } else { - GPU_offscreen_bind(ar->draw_buffer->offscreen[view], false); + GPU_offscreen_bind(region->draw_buffer->offscreen[view], false); /* For now scissor is expected by region drawing, we could disable it * and do the enable/disable in the specific cases that setup scissor. */ glEnable(GL_SCISSOR_TEST); - glScissor(0, 0, ar->winx, ar->winy); + glScissor(0, 0, region->winx, region->winy); } - ar->draw_buffer->bound_view = view; + region->draw_buffer->bound_view = view; } -static void wm_draw_region_unbind(ARegion *ar, int view) +static void wm_draw_region_unbind(ARegion *region, int view) { - if (!ar->draw_buffer) { + if (!region->draw_buffer) { return; } - ar->draw_buffer->bound_view = -1; + region->draw_buffer->bound_view = -1; - if (ar->draw_buffer->viewport[view]) { - GPU_viewport_unbind(ar->draw_buffer->viewport[view]); + if (region->draw_buffer->viewport[view]) { + GPU_viewport_unbind(region->draw_buffer->viewport[view]); } else { glDisable(GL_SCISSOR_TEST); - GPU_offscreen_unbind(ar->draw_buffer->offscreen[view], false); + GPU_offscreen_unbind(region->draw_buffer->offscreen[view], false); } } -static void wm_draw_region_blit(ARegion *ar, int view) +static void wm_draw_region_blit(ARegion *region, int view) { - if (!ar->draw_buffer) { + if (!region->draw_buffer) { return; } @@ -436,43 +440,44 @@ static void wm_draw_region_blit(ARegion *ar, int view) view = 0; } else if (view > 0) { - if (ar->draw_buffer->viewport[view] == NULL && ar->draw_buffer->offscreen[view] == NULL) { + if (region->draw_buffer->viewport[view] == NULL && + region->draw_buffer->offscreen[view] == NULL) { /* Region does not need stereo or failed to allocate stereo buffers. */ view = 0; } } - if (ar->draw_buffer->viewport[view]) { - GPU_viewport_draw_to_screen(ar->draw_buffer->viewport[view], &ar->winrct); + if (region->draw_buffer->viewport[view]) { + GPU_viewport_draw_to_screen(region->draw_buffer->viewport[view], ®ion->winrct); } else { GPU_offscreen_draw_to_screen( - ar->draw_buffer->offscreen[view], ar->winrct.xmin, ar->winrct.ymin); + region->draw_buffer->offscreen[view], region->winrct.xmin, region->winrct.ymin); } } -GPUTexture *wm_draw_region_texture(ARegion *ar, int view) +GPUTexture *wm_draw_region_texture(ARegion *region, int view) { - if (!ar->draw_buffer) { + if (!region->draw_buffer) { return NULL; } - if (ar->draw_buffer->viewport[view]) { - return GPU_viewport_color_texture(ar->draw_buffer->viewport[view]); + if (region->draw_buffer->viewport[view]) { + return GPU_viewport_color_texture(region->draw_buffer->viewport[view]); } else { - return GPU_offscreen_color_texture(ar->draw_buffer->offscreen[view]); + return GPU_offscreen_color_texture(region->draw_buffer->offscreen[view]); } } -void wm_draw_region_blend(ARegion *ar, int view, bool blend) +void wm_draw_region_blend(ARegion *region, int view, bool blend) { - if (!ar->draw_buffer) { + if (!region->draw_buffer) { return; } /* Alpha is always 1, except when blend timer is running. */ - float alpha = ED_region_blend_alpha(ar); + float alpha = ED_region_blend_alpha(region); if (alpha <= 0.0f) { return; } @@ -482,13 +487,13 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend) } /* setup actual texture */ - GPUTexture *texture = wm_draw_region_texture(ar, view); + GPUTexture *texture = wm_draw_region_texture(region, view); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, GPU_texture_opengl_bindcode(texture)); /* wmOrtho for the screen has this same offset */ - const float halfx = GLA_PIXEL_OFS / (BLI_rcti_size_x(&ar->winrct) + 1); - const float halfy = GLA_PIXEL_OFS / (BLI_rcti_size_y(&ar->winrct) + 1); + const float halfx = GLA_PIXEL_OFS / (BLI_rcti_size_x(®ion->winrct) + 1); + const float halfy = GLA_PIXEL_OFS / (BLI_rcti_size_y(®ion->winrct) + 1); if (blend) { /* GL_ONE because regions drawn offscreen have premultiplied alpha. */ @@ -499,7 +504,7 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend) GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE_RECT_COLOR); GPU_shader_bind(shader); - rcti rect_geo = ar->winrct; + rcti rect_geo = region->winrct; rect_geo.xmax += 1; rect_geo.ymax += 1; @@ -513,13 +518,13 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend) alpha_easing = 1.0f - alpha_easing * alpha_easing; /* Slide vertical panels */ - float ofs_x = BLI_rcti_size_x(&ar->winrct) * (1.0f - alpha_easing); - if (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) == RGN_ALIGN_RIGHT) { + float ofs_x = BLI_rcti_size_x(®ion->winrct) * (1.0f - alpha_easing); + if (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_RIGHT) { rect_geo.xmin += ofs_x; rect_tex.xmax *= alpha_easing; alpha = 1.0f; } - else if (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) == RGN_ALIGN_LEFT) { + else if (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_LEFT) { rect_geo.xmax -= ofs_x; rect_tex.xmin += 1.0f - alpha_easing; alpha = 1.0f; @@ -549,23 +554,23 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend) } } -GPUViewport *WM_draw_region_get_viewport(ARegion *ar, int view) +GPUViewport *WM_draw_region_get_viewport(ARegion *region, int view) { - if (!ar->draw_buffer) { + if (!region->draw_buffer) { return NULL; } - return ar->draw_buffer->viewport[view]; + return region->draw_buffer->viewport[view]; } -GPUViewport *WM_draw_region_get_bound_viewport(ARegion *ar) +GPUViewport *WM_draw_region_get_bound_viewport(ARegion *region) { - if (!ar->draw_buffer || ar->draw_buffer->bound_view == -1) { + if (!region->draw_buffer || region->draw_buffer->bound_view == -1) { return NULL; } - int view = ar->draw_buffer->bound_view; - return ar->draw_buffer->viewport[view]; + int view = region->draw_buffer->bound_view; + return region->draw_buffer->viewport[view]; } static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo) @@ -580,17 +585,18 @@ static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo) CTX_wm_area_set(C, sa); /* Compute UI layouts for dynamically size regions. */ - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { + for (ARegion *region = sa->regionbase.first; region; region = region->next) { /* Dynamic region may have been flagged as too small because their size on init is 0. * ARegion.visible is false then, as expected. The layout should still be created then, so * the region size can be updated (it may turn out to be not too small then). */ - const bool ignore_visibility = (ar->flag & RGN_FLAG_DYNAMIC_SIZE) && - (ar->flag & RGN_FLAG_TOO_SMALL) && - !(ar->flag & RGN_FLAG_HIDDEN); - - if ((ar->visible || ignore_visibility) && ar->do_draw && ar->type && ar->type->layout) { - CTX_wm_region_set(C, ar); - ED_region_do_layout(C, ar); + const bool ignore_visibility = (region->flag & RGN_FLAG_DYNAMIC_SIZE) && + (region->flag & RGN_FLAG_TOO_SMALL) && + !(region->flag & RGN_FLAG_HIDDEN); + + if ((region->visible || ignore_visibility) && region->do_draw && region->type && + region->type->layout) { + CTX_wm_region_set(C, region); + ED_region_do_layout(C, region); CTX_wm_region_set(C, NULL); } } @@ -605,13 +611,13 @@ static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo) } /* Then do actual drawing of regions. */ - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->visible && ar->do_draw) { - CTX_wm_region_set(C, ar); - bool use_viewport = wm_region_use_viewport(sa, ar); + for (ARegion *region = sa->regionbase.first; region; region = region->next) { + if (region->visible && region->do_draw) { + CTX_wm_region_set(C, region); + bool use_viewport = wm_region_use_viewport(sa, region); - if (stereo && wm_draw_region_stereo_set(bmain, sa, ar, STEREO_LEFT_ID)) { - wm_draw_region_buffer_create(ar, true, use_viewport); + if (stereo && wm_draw_region_stereo_set(bmain, sa, region, STEREO_LEFT_ID)) { + wm_draw_region_buffer_create(region, true, use_viewport); for (int view = 0; view < 2; view++) { eStereoViews sview; @@ -620,22 +626,22 @@ static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo) } else { sview = STEREO_RIGHT_ID; - wm_draw_region_stereo_set(bmain, sa, ar, sview); + wm_draw_region_stereo_set(bmain, sa, region, sview); } - wm_draw_region_bind(ar, view); - ED_region_do_draw(C, ar); - wm_draw_region_unbind(ar, view); + wm_draw_region_bind(region, view); + ED_region_do_draw(C, region); + wm_draw_region_unbind(region, view); } } else { - wm_draw_region_buffer_create(ar, false, use_viewport); - wm_draw_region_bind(ar, 0); - ED_region_do_draw(C, ar); - wm_draw_region_unbind(ar, 0); + wm_draw_region_buffer_create(region, false, use_viewport); + wm_draw_region_bind(region, 0); + ED_region_do_draw(C, region); + wm_draw_region_unbind(region, 0); } - ar->do_draw = false; + region->do_draw = false; CTX_wm_region_set(C, NULL); } } @@ -645,25 +651,25 @@ static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo) } /* Draw menus into their own framebuffer. */ - for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) { - if (ar->visible) { - CTX_wm_menu_set(C, ar); + for (ARegion *region = screen->regionbase.first; region; region = region->next) { + if (region->visible) { + CTX_wm_menu_set(C, region); - if (ar->type && ar->type->layout) { + if (region->type && region->type->layout) { /* UI code reads the OpenGL state, but we have to refresh * the UI layout beforehand in case the menu size changes. */ - wmViewport(&ar->winrct); - ar->type->layout(C, ar); + wmViewport(®ion->winrct); + region->type->layout(C, region); } - wm_draw_region_buffer_create(ar, false, false); - wm_draw_region_bind(ar, 0); + wm_draw_region_buffer_create(region, false, false); + wm_draw_region_bind(region, 0); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); - ED_region_do_draw(C, ar); - wm_draw_region_unbind(ar, 0); + ED_region_do_draw(C, region); + wm_draw_region_unbind(region, 0); - ar->do_draw = false; + region->do_draw = false; CTX_wm_menu_set(C, NULL); } } @@ -688,20 +694,20 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view) /* Blit non-overlapping area regions. */ ED_screen_areas_iter(win, screen, sa) { - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->visible && ar->overlap == false) { - if (view == -1 && ar->draw_buffer && ar->draw_buffer->stereo) { + for (ARegion *region = sa->regionbase.first; region; region = region->next) { + if (region->visible && region->overlap == false) { + if (view == -1 && region->draw_buffer && region->draw_buffer->stereo) { /* Stereo drawing from textures. */ if (win->stereo3d_format->display_mode == S3D_DISPLAY_ANAGLYPH) { - wm_stereo3d_draw_anaglyph(win, ar); + wm_stereo3d_draw_anaglyph(win, region); } else { - wm_stereo3d_draw_interlace(win, ar); + wm_stereo3d_draw_interlace(win, region); } } else { /* Blit from offscreen buffer. */ - wm_draw_region_blit(ar, view); + wm_draw_region_blit(region, view); } } } @@ -711,13 +717,13 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view) if (wm->paintcursors.first) { ED_screen_areas_iter(win, screen, sa) { - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->visible && ar == screen->active_region) { + for (ARegion *region = sa->regionbase.first; region; region = region->next) { + if (region->visible && region == screen->active_region) { CTX_wm_area_set(C, sa); - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); /* make region ready for draw, scissor, pixelspace */ - wm_paintcursor_draw(C, sa, ar); + wm_paintcursor_draw(C, sa, region); CTX_wm_region_set(C, NULL); CTX_wm_area_set(C, NULL); @@ -731,9 +737,9 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view) /* Blend in overlapping area regions */ ED_screen_areas_iter(win, screen, sa) { - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->visible && ar->overlap) { - wm_draw_region_blend(ar, 0, true); + for (ARegion *region = sa->regionbase.first; region; region = region->next) { + if (region->visible && region->overlap) { + wm_draw_region_blend(region, 0, true); } } } @@ -743,9 +749,9 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view) wm_draw_callbacks(win); /* Blend in floating regions (menus). */ - for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) { - if (ar->visible) { - wm_draw_region_blend(ar, 0, true); + for (ARegion *region = screen->regionbase.first; region; region = region->next) { + if (region->visible) { + wm_draw_region_blend(region, 0, true); } } @@ -839,26 +845,26 @@ static bool wm_draw_update_test_window(Main *bmain, wmWindow *win) ViewLayer *view_layer = WM_window_get_active_view_layer(win); struct Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); bScreen *screen = WM_window_get_active_screen(win); - ARegion *ar; + ARegion *region; bool do_draw = false; - for (ar = screen->regionbase.first; ar; ar = ar->next) { - if (ar->do_draw_overlay) { + for (region = screen->regionbase.first; region; region = region->next) { + if (region->do_draw_overlay) { screen->do_draw_paintcursor = true; - ar->do_draw_overlay = false; + region->do_draw_overlay = false; } - if (ar->visible && ar->do_draw) { + if (region->visible && region->do_draw) { do_draw = true; } } ED_screen_areas_iter(win, screen, sa) { - for (ar = sa->regionbase.first; ar; ar = ar->next) { - wm_region_test_gizmo_do_draw(ar, true); - wm_region_test_render_do_draw(scene, depsgraph, sa, ar); + for (region = sa->regionbase.first; region; region = region->next) { + wm_region_test_gizmo_do_draw(region, true); + wm_region_test_render_do_draw(scene, depsgraph, sa, region); - if (ar->visible && ar->do_draw) { + if (region->visible && region->do_draw) { do_draw = true; } } @@ -895,8 +901,8 @@ static void wm_draw_update_clear_window(wmWindow *win) ED_screen_areas_iter(win, screen, sa) { - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - wm_region_test_gizmo_do_draw(ar, false); + for (ARegion *region = sa->regionbase.first; region; region = region->next) { + wm_region_test_gizmo_do_draw(region, false); } } @@ -905,7 +911,7 @@ static void wm_draw_update_clear_window(wmWindow *win) screen->do_draw_drag = false; } -void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *UNUSED(ar)) +void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *UNUSED(region)) { if (win) { bScreen *screen = WM_window_get_active_screen(win); @@ -959,27 +965,27 @@ void wm_draw_update(bContext *C) } } -void wm_draw_region_clear(wmWindow *win, ARegion *UNUSED(ar)) +void wm_draw_region_clear(wmWindow *win, ARegion *UNUSED(region)) { bScreen *screen = WM_window_get_active_screen(win); screen->do_draw = true; } -void WM_draw_region_free(ARegion *ar) +void WM_draw_region_free(ARegion *region) { - wm_draw_region_buffer_free(ar); - ar->visible = 0; + wm_draw_region_buffer_free(region); + region->visible = 0; } -void wm_draw_region_test(bContext *C, ScrArea *sa, ARegion *ar) +void wm_draw_region_test(bContext *C, ScrArea *sa, ARegion *region) { /* Function for redraw timer benchmark. */ - bool use_viewport = wm_region_use_viewport(sa, ar); - wm_draw_region_buffer_create(ar, false, use_viewport); - wm_draw_region_bind(ar, 0); - ED_region_do_draw(C, ar); - wm_draw_region_unbind(ar, 0); - ar->do_draw = false; + bool use_viewport = wm_region_use_viewport(sa, region); + wm_draw_region_buffer_create(region, false, use_viewport); + wm_draw_region_bind(region, 0); + ED_region_do_draw(C, region); + wm_draw_region_unbind(region, 0); + region->do_draw = false; } void WM_redraw_windows(bContext *C) @@ -1005,20 +1011,20 @@ void WM_redraw_windows(bContext *C) * * \{ */ -void WM_draw_region_viewport_ensure(ARegion *ar, short space_type) +void WM_draw_region_viewport_ensure(ARegion *region, short space_type) { - bool use_viewport = wm_region_use_viewport_by_type(space_type, ar->regiontype); - wm_draw_region_buffer_create(ar, false, use_viewport); + bool use_viewport = wm_region_use_viewport_by_type(space_type, region->regiontype); + wm_draw_region_buffer_create(region, false, use_viewport); } -void WM_draw_region_viewport_bind(ARegion *ar) +void WM_draw_region_viewport_bind(ARegion *region) { - wm_draw_region_bind(ar, 0); + wm_draw_region_bind(region, 0); } -void WM_draw_region_viewport_unbind(ARegion *ar) +void WM_draw_region_viewport_unbind(ARegion *region) { - wm_draw_region_unbind(ar, 0); + wm_draw_region_unbind(region, 0); } /** \} */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 6247cc5d5ea..3a7383bf38d 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -507,7 +507,7 @@ void wm_event_do_notifiers(bContext *C) /* pass */ } else { - ARegion *ar; + ARegion *region; /* XXX context in notifiers? */ CTX_wm_window_set(C, win); @@ -520,15 +520,15 @@ void wm_event_do_notifiers(bContext *C) # endif ED_screen_do_listen(C, note); - for (ar = screen->regionbase.first; ar; ar = ar->next) { - ED_region_do_listen(win, NULL, ar, note, scene); + for (region = screen->regionbase.first; region; region = region->next) { + ED_region_do_listen(win, NULL, region, note, scene); } ED_screen_areas_iter(win, screen, sa) { ED_area_do_listen(win, sa, note, scene); - for (ar = sa->regionbase.first; ar; ar = ar->next) { - ED_region_do_listen(win, sa, ar, note, scene); + for (region = sa->regionbase.first; region; region = region->next) { + ED_region_do_listen(win, sa, region, note, scene); } } } @@ -644,13 +644,13 @@ static int wm_handler_ui_call(bContext *C, static void wm_handler_ui_cancel(bContext *C) { wmWindow *win = CTX_wm_window(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); - if (!ar) { + if (!region) { return; } - LISTBASE_FOREACH_MUTABLE (wmEventHandler *, handler_base, &ar->handlers) { + LISTBASE_FOREACH_MUTABLE (wmEventHandler *, handler_base, ®ion->handlers) { if (handler_base->type == WM_HANDLER_TYPE_UI) { wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base; BLI_assert(handler->handle_fn != NULL); @@ -824,9 +824,9 @@ void WM_operator_region_active_win_set(bContext *C) { ScrArea *sa = CTX_wm_area(C); if (sa) { - ARegion *ar = CTX_wm_region(C); - if (ar && ar->regiontype == RGN_TYPE_WINDOW) { - sa->region_active_win = BLI_findindex(&sa->regionbase, ar); + ARegion *region = CTX_wm_region(C); + if (region && region->regiontype == RGN_TYPE_WINDOW) { + sa->region_active_win = BLI_findindex(&sa->regionbase, region); } } } @@ -1199,11 +1199,11 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, static void wm_region_mouse_co(bContext *C, wmEvent *event) { - ARegion *ar = CTX_wm_region(C); - if (ar) { + ARegion *region = CTX_wm_region(C); + if (region) { /* compatibility convention */ - event->mval[0] = event->x - ar->winrct.xmin; - event->mval[1] = event->y - ar->winrct.ymin; + event->mval[0] = event->x - region->winrct.xmin; + event->mval[1] = event->y - region->winrct.ymin; } else { /* these values are invalid (avoid odd behavior by relying on old mval values) */ @@ -1330,17 +1330,18 @@ static int wm_operator_invoke(bContext *C, if (wrap) { const rcti *winrect = NULL; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); ScrArea *sa = CTX_wm_area(C); /* Wrap only in X for header. */ - if (ar && ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER)) { + if (region && + ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER)) { wrap = WM_CURSOR_WRAP_X; } - if (ar && ar->regiontype == RGN_TYPE_WINDOW && - BLI_rcti_isect_pt_v(&ar->winrct, &event->x)) { - winrect = &ar->winrct; + if (region && region->regiontype == RGN_TYPE_WINDOW && + BLI_rcti_isect_pt_v(®ion->winrct, &event->x)) { + winrect = ®ion->winrct; } else if (sa && BLI_rcti_isect_pt_v(&sa->totrct, &event->x)) { winrect = &sa->totrct; @@ -1441,7 +1442,7 @@ static int wm_operator_call_internal(bContext *C, /* forces operator to go to the region window/channels/preview, for header menus * but we stay in the same region if we are already in one */ - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); ScrArea *area = CTX_wm_area(C); int type = RGN_TYPE_WINDOW; @@ -1463,7 +1464,7 @@ static int wm_operator_call_internal(bContext *C, break; } - if (!(ar && ar->regiontype == type) && area) { + if (!(region && region->regiontype == type) && area) { ARegion *ar1; if (type == RGN_TYPE_WINDOW) { ar1 = BKE_area_find_region_active_win(area); @@ -1480,32 +1481,32 @@ static int wm_operator_call_internal(bContext *C, retval = wm_operator_invoke(C, ot, event, properties, reports, poll_only, true); /* set region back */ - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); return retval; } case WM_OP_EXEC_AREA: case WM_OP_INVOKE_AREA: { /* remove region from context */ - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); CTX_wm_region_set(C, NULL); retval = wm_operator_invoke(C, ot, event, properties, reports, poll_only, true); - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); return retval; } case WM_OP_EXEC_SCREEN: case WM_OP_INVOKE_SCREEN: { /* remove region + area from context */ - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); ScrArea *area = CTX_wm_area(C); CTX_wm_region_set(C, NULL); CTX_wm_area_set(C, NULL); retval = wm_operator_invoke(C, ot, event, properties, reports, poll_only, true); CTX_wm_area_set(C, area); - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); return retval; } @@ -1668,31 +1669,31 @@ static void wm_handler_op_context(bContext *C, wmEventHandler_Op *handler, const } } else { - ARegion *ar; + ARegion *region; wmOperator *op = handler->op ? (handler->op->opm ? handler->op->opm : handler->op) : NULL; CTX_wm_area_set(C, sa); if (op && (op->flag & OP_IS_MODAL_CURSOR_REGION)) { - ar = BKE_area_find_region_xy(sa, handler->context.region_type, event->x, event->y); - if (ar) { - handler->context.region = ar; + region = BKE_area_find_region_xy(sa, handler->context.region_type, event->x, event->y); + if (region) { + handler->context.region = region; } } else { - ar = NULL; + region = NULL; } - if (ar == NULL) { - for (ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar == handler->context.region) { + if (region == NULL) { + for (region = sa->regionbase.first; region; region = region->next) { + if (region == handler->context.region) { break; } } } /* XXX no warning print here, after full-area and back regions are remade */ - if (ar) { - CTX_wm_region_set(C, ar); + if (region) { + CTX_wm_region_set(C, region); } } } @@ -2109,12 +2110,12 @@ static int wm_handler_operator_call(bContext *C, wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false); if (gzgt != NULL) { if ((gzgt->flag & WM_GIZMOGROUPTYPE_TOOL_INIT) != 0) { - ARegion *ar = CTX_wm_region(C); - if (ar != NULL) { + ARegion *region = CTX_wm_region(C); + if (region != NULL) { wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&gzgt->gzmap_params); WM_gizmo_group_type_ensure_ptr_ex(gzgt, gzmap_type); wmGizmoGroup *gzgroup = WM_gizmomaptype_group_init_runtime_with_region( - gzmap_type, gzgt, ar); + gzmap_type, gzgt, region); /* We can't rely on drawing to initialize gizmo's since disabling * overlays/gizmos will prevent pre-drawing setup calls. (see T60905) */ WM_gizmogroup_ensure_init(C, gzgroup); @@ -2928,12 +2929,12 @@ static bool wm_event_inside_rect(const wmEvent *event, const rcti *rect) return false; } -static bool wm_event_inside_region(const wmEvent *event, const ARegion *ar) +static bool wm_event_inside_region(const wmEvent *event, const ARegion *region) { if (wm_event_always_pass(event)) { return true; } - return ED_region_contains_xy(ar, &event->x); + return ED_region_contains_xy(region, &event->x); } static ScrArea *area_event_inside(bContext *C, const int xy[2]) @@ -2956,25 +2957,25 @@ static ARegion *region_event_inside(bContext *C, const int xy[2]) { bScreen *screen = CTX_wm_screen(C); ScrArea *area = CTX_wm_area(C); - ARegion *ar; + ARegion *region; if (screen && area) { - for (ar = area->regionbase.first; ar; ar = ar->next) { - if (BLI_rcti_isect_pt_v(&ar->winrct, xy)) { - return ar; + for (region = area->regionbase.first; region; region = region->next) { + if (BLI_rcti_isect_pt_v(®ion->winrct, xy)) { + return region; } } } return NULL; } -static void wm_paintcursor_tag(bContext *C, wmPaintCursor *pc, ARegion *ar) +static void wm_paintcursor_tag(bContext *C, wmPaintCursor *pc, ARegion *region) { - if (ar) { + if (region) { for (; pc; pc = pc->next) { if (pc->poll == NULL || pc->poll(C)) { wmWindow *win = CTX_wm_window(C); - WM_paint_cursor_tag_redraw(win, ar); + WM_paint_cursor_tag_redraw(win, region); } } } @@ -2987,14 +2988,14 @@ static void wm_paintcursor_test(bContext *C, const wmEvent *event) wmWindowManager *wm = CTX_wm_manager(C); if (wm->paintcursors.first) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); - if (ar) { - wm_paintcursor_tag(C, wm->paintcursors.first, ar); + if (region) { + wm_paintcursor_tag(C, wm->paintcursors.first, region); } /* if previous position was not in current region, we have to set a temp new context */ - if (ar == NULL || !BLI_rcti_isect_pt_v(&ar->winrct, &event->prevx)) { + if (region == NULL || !BLI_rcti_isect_pt_v(®ion->winrct, &event->prevx)) { ScrArea *sa = CTX_wm_area(C); CTX_wm_area_set(C, area_event_inside(C, &event->prevx)); @@ -3003,7 +3004,7 @@ static void wm_paintcursor_test(bContext *C, const wmEvent *event) wm_paintcursor_tag(C, wm->paintcursors.first, CTX_wm_region(C)); CTX_wm_area_set(C, sa); - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); } } } @@ -3204,7 +3205,7 @@ void wm_event_do_handlers(bContext *C) wm_tweakevent_test(C, event, action); if ((action & WM_HANDLER_BREAK) == 0) { - ARegion *ar; + ARegion *region; /* Note: setting subwin active should be done here, after modal handlers have been done */ if (event->type == MOUSEMOVE) { @@ -3239,10 +3240,10 @@ void wm_event_do_handlers(bContext *C) CTX_wm_area_set(C, sa); if ((action & WM_HANDLER_BREAK) == 0) { - for (ar = sa->regionbase.first; ar; ar = ar->next) { - if (wm_event_inside_region(event, ar)) { + for (region = sa->regionbase.first; region; region = region->next) { + if (wm_event_inside_region(event, region)) { - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); /* call even on non mouse events, since the */ wm_region_mouse_co(C, event); @@ -3255,7 +3256,7 @@ void wm_event_do_handlers(bContext *C) } } - action |= wm_handlers_do(C, event, &ar->handlers); + action |= wm_handlers_do(C, event, ®ion->handlers); /* fileread case (python), [#29489] */ if (CTX_wm_window(C) == NULL) { @@ -3568,9 +3569,9 @@ wmKeyMap *WM_event_get_keymap_from_toolsystem_fallback(wmWindowManager *wm, if (tref_rt->gizmo_group[0] != '\0' && tref_rt->keymap_fallback[0] != '\n') { wmGizmoMap *gzmap = NULL; wmGizmoGroup *gzgroup = NULL; - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->gizmo_map != NULL) { - gzmap = ar->gizmo_map; + for (ARegion *region = sa->regionbase.first; region; region = region->next) { + if (region->gizmo_map != NULL) { + gzmap = region->gizmo_map; gzgroup = WM_gizmomap_group_find(gzmap, tref_rt->gizmo_group); if (gzgroup != NULL) { break; @@ -3689,10 +3690,10 @@ static bool event_or_prev_in_rect(const wmEvent *event, const rcti *rect) } } -static bool handler_region_v2d_mask_test(const ARegion *ar, const wmEvent *event) +static bool handler_region_v2d_mask_test(const ARegion *region, const wmEvent *event) { - rcti rect = ar->v2d.mask; - BLI_rcti_translate(&rect, ar->winrct.xmin, ar->winrct.ymin); + rcti rect = region->v2d.mask; + BLI_rcti_translate(&rect, region->winrct.xmin, region->winrct.ymin); return event_or_prev_in_rect(event, &rect); } @@ -4879,15 +4880,15 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win) cd->state_event = *win->eventstate; /* Find active region and associated area. */ - ARegion *ar = screen->active_region; - if (ar == NULL) { + ARegion *region = screen->active_region; + if (region == NULL) { return; } ScrArea *sa = NULL; ED_screen_areas_iter(win, screen, sa_iter) { - if (BLI_findindex(&sa_iter->regionbase, ar) != -1) { + if (BLI_findindex(&sa_iter->regionbase, region) != -1) { sa = sa_iter; break; } @@ -4900,7 +4901,7 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win) if (ELEM(sa->spacetype, SPACE_STATUSBAR, SPACE_TOPBAR)) { return; } - if (ELEM(ar->regiontype, + if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER, @@ -4909,14 +4910,15 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win) return; } /* Fallback to window. */ - if (ELEM(ar->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) { - ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + if (ELEM(region->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) { + region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); } /* Detect changes to the state. */ { bToolRef *tref = NULL; - if ((ar->regiontype == RGN_TYPE_WINDOW) && ((1 << sa->spacetype) & WM_TOOLSYSTEM_SPACE_MASK)) { + if ((region->regiontype == RGN_TYPE_WINDOW) && + ((1 << sa->spacetype) & WM_TOOLSYSTEM_SPACE_MASK)) { ViewLayer *view_layer = WM_window_get_active_view_layer(win); WorkSpace *workspace = WM_window_get_active_workspace(win); const bToolKey tkey = { @@ -4925,7 +4927,7 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win) }; tref = WM_toolsystem_ref_find(workspace, &tkey); } - wm_event_cursor_store(&cd->state, win->eventstate, sa->spacetype, ar->regiontype, tref); + wm_event_cursor_store(&cd->state, win->eventstate, sa->spacetype, region->regiontype, tref); if (memcmp(&cd->state, &cd_prev.state, sizeof(cd->state)) == 0) { return; } @@ -4958,10 +4960,10 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win) CTX_wm_window_set(C, win); CTX_wm_area_set(C, sa); - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); ListBase *handlers[] = { - &ar->handlers, + ®ion->handlers, &sa->handlers, &win->handlers, }; diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 160fbe95b25..1ce56ad2dfc 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1219,7 +1219,7 @@ static ImBuf *blend_file_thumb(const bContext *C, /* screen if no camera found */ ScrArea *sa = NULL; - ARegion *ar = NULL; + ARegion *region = NULL; View3D *v3d = NULL; /* In case we are given a valid thumbnail data, just generate image from it. */ @@ -1235,8 +1235,8 @@ static ImBuf *blend_file_thumb(const bContext *C, if ((scene->camera == NULL) && (screen != NULL)) { sa = BKE_screen_find_big_area(screen, SPACE_VIEW3D, 0); - ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); - if (ar) { + region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + if (region) { v3d = sa->spacedata.first; } } @@ -1268,7 +1268,7 @@ static ImBuf *blend_file_thumb(const bContext *C, scene, OB_SOLID, v3d, - ar, + region, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, IB_rect, @@ -2813,12 +2813,12 @@ static void wm_block_autorun_warning_enable_scripts(bContext *C, /* Build the autorun warning dialog UI */ static uiBlock *block_create_autorun_warning(struct bContext *C, - struct ARegion *ar, + struct ARegion *region, void *UNUSED(arg1)) { wmWindowManager *wm = CTX_wm_manager(C); uiStyle *style = UI_style_get_dpi(); - uiBlock *block = UI_block_begin(C, ar, "autorun_warning_popup", UI_EMBOSS); + uiBlock *block = UI_block_begin(C, region, "autorun_warning_popup", UI_EMBOSS); UI_block_flag_enable( block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP | UI_BLOCK_NUMSELECT); @@ -3049,7 +3049,9 @@ static void wm_block_file_close_save_button(uiBlock *block, wmGenericCallback *p static const char *close_file_dialog_name = "file_close_popup"; -static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegion *ar, void *arg1) +static uiBlock *block_create__close_file_dialog(struct bContext *C, + struct ARegion *region, + void *arg1) { wmGenericCallback *post_action = (wmGenericCallback *)arg1; Main *bmain = CTX_data_main(C); @@ -3075,7 +3077,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegi int title_width = MAX2(UI_fontstyle_string_width(fs, title), U.widget_unit * 22); /* Create dialog */ - uiBlock *block = UI_block_begin(C, ar, close_file_dialog_name, UI_EMBOSS); + uiBlock *block = UI_block_begin(C, region, close_file_dialog_name, UI_EMBOSS); style = UI_style_get_dpi(); UI_block_flag_enable( diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index bd9a6464332..ffb37544e49 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -51,7 +51,7 @@ #include "BIF_glutil.h" /* context checked on having screen, window and area */ -wmGesture *WM_gesture_new(wmWindow *window, const ARegion *ar, const wmEvent *event, int type) +wmGesture *WM_gesture_new(wmWindow *window, const ARegion *region, const wmEvent *event, int type) { wmGesture *gesture = MEM_callocN(sizeof(wmGesture), "new gesture"); @@ -59,7 +59,7 @@ wmGesture *WM_gesture_new(wmWindow *window, const ARegion *ar, const wmEvent *ev gesture->type = type; gesture->event_type = event->type; - gesture->winrct = ar->winrct; + gesture->winrct = region->winrct; gesture->user_data.use_free = true; /* Free if userdata is set. */ gesture->modal_state = GESTURE_MODAL_NOP; diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c index c78f0d7376d..82bc591e2a4 100644 --- a/source/blender/windowmanager/intern/wm_gesture_ops.c +++ b/source/blender/windowmanager/intern/wm_gesture_ops.c @@ -175,14 +175,14 @@ static bool gesture_box_apply(bContext *C, wmOperator *op) int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event) { wmWindow *win = CTX_wm_window(C); - const ARegion *ar = CTX_wm_region(C); + const ARegion *region = CTX_wm_region(C); const bool wait_for_input = !ISTWEAK(event->type) && RNA_boolean_get(op->ptr, "wait_for_input"); if (wait_for_input) { - op->customdata = WM_gesture_new(win, ar, event, WM_GESTURE_CROSS_RECT); + op->customdata = WM_gesture_new(win, region, event, WM_GESTURE_CROSS_RECT); } else { - op->customdata = WM_gesture_new(win, ar, event, WM_GESTURE_RECT); + op->customdata = WM_gesture_new(win, region, event, WM_GESTURE_RECT); } { @@ -538,10 +538,10 @@ static void gesture_tweak_modal(bContext *C, const wmEvent *event) /* This isn't very nice but needed to redraw gizmos which are hidden while tweaking, * See #WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK for details. */ - ARegion *ar = CTX_wm_region(C); - if ((ar != NULL) && (ar->gizmo_map != NULL)) { - if (WM_gizmomap_tag_delay_refresh_for_tweak_check(ar->gizmo_map)) { - ED_region_tag_redraw(ar); + ARegion *region = CTX_wm_region(C); + if ((region != NULL) && (region->gizmo_map != NULL)) { + if (WM_gizmomap_tag_delay_refresh_for_tweak_check(region->gizmo_map)) { + ED_region_tag_redraw(region); } } } @@ -553,12 +553,12 @@ void wm_tweakevent_test(bContext *C, const wmEvent *event, int action) wmWindow *win = CTX_wm_window(C); if (win->tweak == NULL) { - const ARegion *ar = CTX_wm_region(C); + const ARegion *region = CTX_wm_region(C); - if (ar) { + if (region) { if (event->val == KM_PRESS) { if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) { - win->tweak = WM_gesture_new(win, ar, event, WM_GESTURE_TWEAK); + win->tweak = WM_gesture_new(win, region, event, WM_GESTURE_TWEAK); } } } diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 9d587ff9e9b..0aa146bbc83 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -1450,7 +1450,7 @@ static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C, { wmWindow *win = CTX_wm_window(C); ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); wmKeyMapItem *found = NULL; /* look into multiple handler lists to find the item */ @@ -1471,40 +1471,40 @@ static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C, if (found == NULL) { if (ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) { if (sa) { - if (!(ar && ar->regiontype == RGN_TYPE_WINDOW)) { - ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + if (!(region && region->regiontype == RGN_TYPE_WINDOW)) { + region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); } - if (ar) { + if (region) { found = wm_keymap_item_find_handlers( - C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap); + C, ®ion->handlers, opname, opcontext, properties, is_strict, params, r_keymap); } } } else if (ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) { - if (!(ar && ar->regiontype == RGN_TYPE_CHANNELS)) { - ar = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS); + if (!(region && region->regiontype == RGN_TYPE_CHANNELS)) { + region = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS); } - if (ar) { + if (region) { found = wm_keymap_item_find_handlers( - C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap); + C, ®ion->handlers, opname, opcontext, properties, is_strict, params, r_keymap); } } else if (ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) { - if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW)) { - ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW); + if (!(region && region->regiontype == RGN_TYPE_PREVIEW)) { + region = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW); } - if (ar) { + if (region) { found = wm_keymap_item_find_handlers( - C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap); + C, ®ion->handlers, opname, opcontext, properties, is_strict, params, r_keymap); } } else { - if (ar) { + if (region) { found = wm_keymap_item_find_handlers( - C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap); + C, ®ion->handlers, opname, opcontext, properties, is_strict, params, r_keymap); } } } diff --git a/source/blender/windowmanager/intern/wm_operator_type.c b/source/blender/windowmanager/intern/wm_operator_type.c index e3fe8892515..7244b0a0d9a 100644 --- a/source/blender/windowmanager/intern/wm_operator_type.c +++ b/source/blender/windowmanager/intern/wm_operator_type.c @@ -444,12 +444,12 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event) } if (wrap) { - ARegion *ar = CTX_wm_region(C); - if (ar) { - bounds[0] = ar->winrct.xmin; - bounds[1] = ar->winrct.ymax; - bounds[2] = ar->winrct.xmax; - bounds[3] = ar->winrct.ymin; + ARegion *region = CTX_wm_region(C); + if (region) { + bounds[0] = region->winrct.xmin; + bounds[1] = region->winrct.ymax; + bounds[2] = region->winrct.xmax; + bounds[3] = region->winrct.ymin; } } diff --git a/source/blender/windowmanager/intern/wm_operator_utils.c b/source/blender/windowmanager/intern/wm_operator_utils.c index 44afa708136..d0abdec1376 100644 --- a/source/blender/windowmanager/intern/wm_operator_utils.c +++ b/source/blender/windowmanager/intern/wm_operator_utils.c @@ -63,7 +63,7 @@ typedef struct ValueInteraction { struct { ScrArea *sa; - ARegion *ar; + ARegion *region; } context_vars; } ValueInteraction; @@ -75,7 +75,7 @@ static void interactive_value_init(bContext *C, { inter->context_vars.sa = CTX_wm_area(C); - inter->context_vars.ar = CTX_wm_region(C); + inter->context_vars.region = CTX_wm_region(C); inter->init.mval[0] = event->mval[0]; inter->init.mval[1] = event->mval[1]; @@ -111,7 +111,7 @@ static bool interactive_value_update(ValueInteraction *inter, const int mval_curr = event->mval[mval_axis]; const int mval_init = inter->init.mval[mval_axis]; float value_delta = (inter->init.prop_value + - (((float)(mval_curr - mval_init) / inter->context_vars.ar->winx) * + (((float)(mval_curr - mval_init) / inter->context_vars.region->winx) * value_range)) * value_scale; if (event->ctrl) { diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 02ac94112ad..fc23cec3044 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1000,7 +1000,7 @@ struct EnumSearchMenu { }; /** Generic enum search invoke popup. */ -static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg) +static uiBlock *wm_enum_search_menu(bContext *C, ARegion *region, void *arg) { struct EnumSearchMenu *search_menu = arg; wmWindow *win = CTX_wm_window(C); @@ -1015,7 +1015,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg) uiBlock *block; uiBut *but; - block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + block = UI_block_begin(C, region, "_popup", UI_EMBOSS); UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); @@ -1314,7 +1314,7 @@ static void wm_block_redo_cancel_cb(bContext *C, void *arg_op) } } -static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) +static uiBlock *wm_block_create_redo(bContext *C, ARegion *region, void *arg_op) { wmOperator *op = arg_op; uiBlock *block; @@ -1322,7 +1322,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) uiStyle *style = UI_style_get_dpi(); int width = 15 * UI_UNIT_X; - block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + block = UI_block_begin(C, region, __func__, UI_EMBOSS); UI_block_flag_disable(block, UI_BLOCK_LOOP); UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_REGULAR); @@ -1395,7 +1395,7 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2) } /* Dialogs are popups that require user verification (click OK) before exec */ -static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData) +static uiBlock *wm_block_dialog_create(bContext *C, ARegion *region, void *userData) { wmOpPopUp *data = userData; wmOperator *op = data->op; @@ -1403,7 +1403,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData) uiLayout *layout; uiStyle *style = UI_style_get_dpi(); - block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + block = UI_block_begin(C, region, __func__, UI_EMBOSS); UI_block_flag_disable(block, UI_BLOCK_LOOP); UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_REGULAR); @@ -1439,12 +1439,12 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData) UI_block_bounds_set_popup( block, 6 * U.dpi_fac, (const int[2]){data->width / -2, data->height / 2}); - UI_block_active_only_flagged_buttons(C, ar, block); + UI_block_active_only_flagged_buttons(C, region, block); return block; } -static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData) +static uiBlock *wm_operator_ui_create(bContext *C, ARegion *region, void *userData) { wmOpPopUp *data = userData; wmOperator *op = data->op; @@ -1452,7 +1452,7 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData) uiLayout *layout; uiStyle *style = UI_style_get_dpi(); - block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + block = UI_block_begin(C, region, __func__, UI_EMBOSS); UI_block_flag_disable(block, UI_BLOCK_LOOP); UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT); UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_REGULAR); @@ -1693,14 +1693,14 @@ struct SearchPopupInit_Data { int size[2]; }; -static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *userdata) +static uiBlock *wm_block_search_menu(bContext *C, ARegion *region, void *userdata) { const struct SearchPopupInit_Data *init_data = userdata; static char search[256] = ""; uiBlock *block; uiBut *but; - block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); + block = UI_block_begin(C, region, "_popup", UI_EMBOSS); UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); @@ -3141,19 +3141,19 @@ static void redraw_timer_step(bContext *C, struct Depsgraph *depsgraph, wmWindow *win, ScrArea *sa, - ARegion *ar, + ARegion *region, const int type, const int cfra) { if (type == eRTDrawRegion) { - if (ar) { - wm_draw_region_test(C, sa, ar); + if (region) { + wm_draw_region_test(C, sa, region); } } else if (type == eRTDrawRegionSwap) { CTX_wm_menu_set(C, NULL); - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); wm_draw_update(C); CTX_wm_window_set(C, win); /* XXX context manipulation warning! */ @@ -3179,7 +3179,7 @@ static void redraw_timer_step(bContext *C, CTX_wm_window_set(C, win); /* XXX context manipulation warning! */ CTX_wm_area_set(C, sa); - CTX_wm_region_set(C, ar); + CTX_wm_region_set(C, region); } else if (type == eRTDrawWindowSwap) { redraw_timer_window_swap(C); @@ -3215,7 +3215,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); wmWindow *win = CTX_wm_window(C); ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); wmWindowManager *wm = CTX_wm_manager(C); double time_start, time_delta; const int type = RNA_enum_get(op->ptr, "type"); @@ -3236,7 +3236,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) wm_window_make_drawable(wm, win); for (a = 0; a < iter; a++) { - redraw_timer_step(C, bmain, scene, depsgraph, win, sa, ar, type, cfra); + redraw_timer_step(C, bmain, scene, depsgraph, win, sa, region, type, cfra); iter_steps += 1; if (time_limit != 0.0) { diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c index 7f6eebb95ab..97490f7cc3b 100644 --- a/source/blender/windowmanager/intern/wm_splash_screen.c +++ b/source/blender/windowmanager/intern/wm_splash_screen.c @@ -67,7 +67,7 @@ static void wm_block_splash_close(bContext *C, void *arg_block, void *UNUSED(arg UI_popup_block_close(C, win, arg_block); } -static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused); +static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *arg_unused); static void wm_block_splash_refreshmenu(bContext *C, void *UNUSED(arg_block), void *UNUSED(arg)) { @@ -255,13 +255,13 @@ static ImBuf *wm_block_splash_image(int r_unit_size[2]) #endif } -static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(arg)) +static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *UNUSED(arg)) { uiBlock *block; uiBut *but; uiStyle *style = UI_style_get_dpi(); - block = UI_block_begin(C, ar, "splash", UI_EMBOSS); + block = UI_block_begin(C, region, "splash", UI_EMBOSS); /* note on UI_BLOCK_NO_WIN_CLIP, the window size is not always synchronized * with the OS when the splash shows, window clipping in this case gives diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c index 735d44a00b5..c5f8fb71b60 100644 --- a/source/blender/windowmanager/intern/wm_stereo.c +++ b/source/blender/windowmanager/intern/wm_stereo.c @@ -66,14 +66,14 @@ static eGPUInterlaceShader interlace_gpu_id_from_type(eStereo3dInterlaceType int } } -void wm_stereo3d_draw_interlace(wmWindow *win, ARegion *ar) +void wm_stereo3d_draw_interlace(wmWindow *win, ARegion *region) { bool swap = (win->stereo3d_format->flag & S3D_INTERLACE_SWAP) != 0; enum eStereo3dInterlaceType interlace_type = win->stereo3d_format->interlace_type; /* wmOrtho for the screen has this same offset */ - float halfx = GLA_PIXEL_OFS / ar->winx; - float halfy = GLA_PIXEL_OFS / ar->winy; + float halfx = GLA_PIXEL_OFS / region->winx; + float halfy = GLA_PIXEL_OFS / region->winy; GPUVertFormat *format = immVertexFormat(); uint texcoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -81,7 +81,7 @@ void wm_stereo3d_draw_interlace(wmWindow *win, ARegion *ar) /* leave GL_TEXTURE0 as the latest active texture */ for (int view = 1; view >= 0; view--) { - GPUTexture *texture = wm_draw_region_texture(ar, view); + GPUTexture *texture = wm_draw_region_texture(region, view); glActiveTexture(GL_TEXTURE0 + view); glBindTexture(GL_TEXTURE_2D, GPU_texture_opengl_bindcode(texture)); } @@ -95,16 +95,16 @@ void wm_stereo3d_draw_interlace(wmWindow *win, ARegion *ar) immBegin(GPU_PRIM_TRI_FAN, 4); immAttr2f(texcoord, halfx, halfy); - immVertex2f(pos, ar->winrct.xmin, ar->winrct.ymin); + immVertex2f(pos, region->winrct.xmin, region->winrct.ymin); immAttr2f(texcoord, 1.0f + halfx, halfy); - immVertex2f(pos, ar->winrct.xmax + 1, ar->winrct.ymin); + immVertex2f(pos, region->winrct.xmax + 1, region->winrct.ymin); immAttr2f(texcoord, 1.0f + halfx, 1.0f + halfy); - immVertex2f(pos, ar->winrct.xmax + 1, ar->winrct.ymax + 1); + immVertex2f(pos, region->winrct.xmax + 1, region->winrct.ymax + 1); immAttr2f(texcoord, halfx, 1.0f + halfy); - immVertex2f(pos, ar->winrct.xmin, ar->winrct.ymax + 1); + immVertex2f(pos, region->winrct.xmin, region->winrct.ymax + 1); immEnd(); immUnbindProgram(); @@ -115,7 +115,7 @@ void wm_stereo3d_draw_interlace(wmWindow *win, ARegion *ar) } } -void wm_stereo3d_draw_anaglyph(wmWindow *win, ARegion *ar) +void wm_stereo3d_draw_anaglyph(wmWindow *win, ARegion *region) { for (int view = 0; view < 2; view++) { int bit = view + 1; @@ -141,7 +141,7 @@ void wm_stereo3d_draw_anaglyph(wmWindow *win, ARegion *ar) break; } - wm_draw_region_blend(ar, view, false); + wm_draw_region_blend(region, view, false); } glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c index 5ef78723a2a..5483d79c075 100644 --- a/source/blender/windowmanager/intern/wm_subwindow.c +++ b/source/blender/windowmanager/intern/wm_subwindow.c @@ -118,9 +118,9 @@ static void wmOrtho2_offset(const float x, const float y, const float ofs) } /* Default pixel alignment for regions. */ -void wmOrtho2_region_pixelspace(const ARegion *ar) +void wmOrtho2_region_pixelspace(const ARegion *region) { - wmOrtho2_offset(ar->winx, ar->winy, -0.01f); + wmOrtho2_offset(region->winx, region->winy, -0.01f); } void wmOrtho2_pixelspace(const float x, const float y) diff --git a/source/blender/windowmanager/intern/wm_tooltip.c b/source/blender/windowmanager/intern/wm_tooltip.c index b192ea94010..da2afda5e24 100644 --- a/source/blender/windowmanager/intern/wm_tooltip.c +++ b/source/blender/windowmanager/intern/wm_tooltip.c @@ -43,7 +43,7 @@ double WM_tooltip_time_closed(void) } void WM_tooltip_immediate_init( - bContext *C, wmWindow *win, ScrArea *sa, ARegion *ar, wmTooltipInitFn init) + bContext *C, wmWindow *win, ScrArea *sa, ARegion *region, wmTooltipInitFn init) { WM_tooltip_timer_clear(C, win); @@ -52,13 +52,13 @@ void WM_tooltip_immediate_init( screen->tool_tip = MEM_callocN(sizeof(*screen->tool_tip), __func__); } screen->tool_tip->area_from = sa; - screen->tool_tip->region_from = ar; + screen->tool_tip->region_from = region; screen->tool_tip->init = init; WM_tooltip_init(C, win); } void WM_tooltip_timer_init_ex( - bContext *C, wmWindow *win, ScrArea *sa, ARegion *ar, wmTooltipInitFn init, double delay) + bContext *C, wmWindow *win, ScrArea *sa, ARegion *region, wmTooltipInitFn init, double delay) { WM_tooltip_timer_clear(C, win); @@ -68,15 +68,15 @@ void WM_tooltip_timer_init_ex( screen->tool_tip = MEM_callocN(sizeof(*screen->tool_tip), __func__); } screen->tool_tip->area_from = sa; - screen->tool_tip->region_from = ar; + screen->tool_tip->region_from = region; screen->tool_tip->timer = WM_event_add_timer(wm, win, TIMER, delay); screen->tool_tip->init = init; } void WM_tooltip_timer_init( - bContext *C, wmWindow *win, ScrArea *sa, ARegion *ar, wmTooltipInitFn init) + bContext *C, wmWindow *win, ScrArea *sa, ARegion *region, wmTooltipInitFn init) { - WM_tooltip_timer_init_ex(C, win, sa, ar, init, UI_TOOLTIP_DELAY); + WM_tooltip_timer_init_ex(C, win, sa, region, init, UI_TOOLTIP_DELAY); } void WM_tooltip_timer_clear(bContext *C, wmWindow *win) |