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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-02-21 17:59:36 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-02-21 17:59:36 +0300
commit4653d253b390fbb61163610d60ac4c0d21db23ae (patch)
tree6e57fc8864f5d664afd74406fa9e8002740818ac /source/blender
parent803636f888c1f74d73bf4f09ed396647c869a4a3 (diff)
Fix T67805: Cursor doesn't update when switching tools via shortcuts
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/screen/screen_edit.c4
-rw-r--r--source/blender/makesdna/DNA_screen_types.h2
-rw-r--r--source/blender/windowmanager/intern/wm_toolsystem.c14
3 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 1520566cd9d..216f36775b2 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -406,7 +406,9 @@ static void region_cursor_set(wmWindow *win, bool swin_changed)
{
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar == screen->active_region) {
- if (swin_changed || (ar->type && ar->type->event_cursor)) {
+ if (swin_changed || (sa->flag & AREA_FLAG_CURSOR_UPDATE) ||
+ (ar->type && ar->type->event_cursor)) {
+ sa->flag &= ~AREA_FLAG_CURSOR_UPDATE;
if (ar->gizmo_map != NULL) {
if (WM_gizmomap_cursor_set(ar->gizmo_map, win)) {
return;
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 483e5c4a952..c0e62f01e66 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -474,8 +474,8 @@ enum {
/** Update size of regions within the area. */
AREA_FLAG_REGION_SIZE_UPDATE = (1 << 3),
AREA_FLAG_ACTIVE_TOOL_UPDATE = (1 << 4),
+ AREA_FLAG_CURSOR_UPDATE = (1 << 5),
- // AREA_FLAG_UNUSED_5 = (1 << 5),
AREA_FLAG_UNUSED_6 = (1 << 6), /* cleared */
/**
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c
index 616cb7613ba..24e9aa0028c 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -374,6 +374,16 @@ void WM_toolsystem_ref_set_from_runtime(struct bContext *C,
toolsystem_refresh_screen_from_active_tool(bmain, workspace, tref);
+ /* Set the cursor if possible, if not - it's fine as entering the region will refresh it. */
+ {
+ wmWindow *win = CTX_wm_window(C);
+ ScrArea *sa = CTX_wm_area(C);
+ if (win && sa) {
+ win->addmousemove = true;
+ sa->flag |= AREA_FLAG_CURSOR_UPDATE;
+ }
+ }
+
{
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
WM_msg_publish_rna_prop(mbus, &workspace->id, workspace, WorkSpace, tools);
@@ -651,6 +661,10 @@ static void toolsystem_refresh_screen_from_active_tool(Main *bmain,
if (mode == tref->mode) {
sa->runtime.tool = tref;
sa->runtime.is_tool_set = true;
+ /* We only need to do this for the active area,
+ * however at this point the context isn't available.
+ * Set this here since it doesn't cause any extra work. */
+ sa->flag |= AREA_FLAG_CURSOR_UPDATE;
}
}
}