From 142e8b0e923ab97b90d59bc406e291f51a751978 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Mon, 21 Aug 2023 12:30:55 +0200 Subject: [PATCH] Fix #111238: Arrow keys in some menus work in the opposite direction Since menus are created flipped (from event handling point of view), the root layout block needs to be flagged `UI_BLOCK_IS_FLIP`. This was missing for a couple of `uiMenuCreateFunc`, namely: - creating worspaces menu - modifiers extra ops - constraints extra ops - GP modifiers extra ops - GP Shader FX extra ops Same fix as f51de2246c79. Not crtitcal, but could go into LTS I guess. --- source/blender/editors/interface/interface_templates.cc | 2 ++ source/blender/editors/screen/workspace_edit.cc | 2 ++ .../intern/MOD_gpencil_legacy_ui_common.cc | 2 ++ source/blender/modifiers/intern/MOD_ui_common.cc | 2 ++ source/blender/shader_fx/intern/FX_ui_common.cc | 2 ++ 5 files changed, 10 insertions(+) diff --git a/source/blender/editors/interface/interface_templates.cc b/source/blender/editors/interface/interface_templates.cc index 91f36f8891e..108837c9adc 100644 --- a/source/blender/editors/interface/interface_templates.cc +++ b/source/blender/editors/interface/interface_templates.cc @@ -2986,6 +2986,8 @@ static void constraint_ops_extra_draw(bContext *C, uiLayout *layout, void *con_v uiLayoutSetUnitsX(layout, 4.0f); + UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); + /* Apply. */ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), diff --git a/source/blender/editors/screen/workspace_edit.cc b/source/blender/editors/screen/workspace_edit.cc index 792c52f7839..9a2e9a238f8 100644 --- a/source/blender/editors/screen/workspace_edit.cc +++ b/source/blender/editors/screen/workspace_edit.cc @@ -473,6 +473,8 @@ static void workspace_add_menu(bContext * /*C*/, uiLayout *layout, void *templat WorkspaceConfigFileData *startup_config = workspace_config_file_read(app_template); WorkspaceConfigFileData *builtin_config = workspace_system_file_read(app_template); + UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); + if (startup_config) { LISTBASE_FOREACH (WorkSpace *, workspace, &startup_config->workspaces) { uiLayout *row = uiLayoutRow(layout, false); diff --git a/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_ui_common.cc b/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_ui_common.cc index 614f4d1fa42..60a452dbbcd 100644 --- a/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_ui_common.cc +++ b/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_ui_common.cc @@ -240,6 +240,8 @@ static void gpencil_modifier_ops_extra_draw(bContext *C, uiLayout *layout, void uiLayoutSetUnitsX(layout, 4.0f); + UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); + /* Apply. */ if (!(mti->flags & eGpencilModifierTypeFlag_NoApply)) { uiItemO(layout, diff --git a/source/blender/modifiers/intern/MOD_ui_common.cc b/source/blender/modifiers/intern/MOD_ui_common.cc index 69167120613..3d0406cd3a9 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.cc +++ b/source/blender/modifiers/intern/MOD_ui_common.cc @@ -206,6 +206,8 @@ static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v) uiLayoutSetUnitsX(layout, 4.0f); + UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); + /* Apply. */ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), diff --git a/source/blender/shader_fx/intern/FX_ui_common.cc b/source/blender/shader_fx/intern/FX_ui_common.cc index d949c57a947..09ad4817043 100644 --- a/source/blender/shader_fx/intern/FX_ui_common.cc +++ b/source/blender/shader_fx/intern/FX_ui_common.cc @@ -122,6 +122,8 @@ static void gpencil_shaderfx_ops_extra_draw(bContext *C, uiLayout *layout, void uiLayoutSetUnitsX(layout, 4.0f); + UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); + /* Duplicate. */ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"), -- 2.30.2