Skip to content

Commit fc50532

Browse files
committed
InputText: On OSX, inhibit usage of Alt key to toggle menu when active (used for work skip).
1 parent 5741cba commit fc50532

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ All changes:
4949
- Text: Tweaked rendering of three-dots "..." ellipsis variant. (#2775, #4269)
5050
- InputText: Added support for Ctrl+Delete to delete up to end-of-word. (#6067) [@ajweeks]
5151
(Not adding Super+Delete to delete to up to end-of-line on OSX, as OSX doesn't have it)
52+
- InputText: On OSX, inhibit usage of Alt key to toggle menu when active (used for work skip).
5253
- Menus: Fixed layout of MenuItem()/BeginMenu() when label contains a '\n'. (#6116) [@imkcy9]
5354
- PlotHistogram, PlotLines: Passing negative sizes honor alignment like other widgets.
5455
- ImDrawList: Added missing early-out in AddPolyline() and AddConvexPolyFilled() when

imgui_widgets.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4096,6 +4096,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
40964096
state->Stb.insert_mode = 1; // stb field name is indeed incorrect (see #2863)
40974097
}
40984098

4099+
const bool is_osx = io.ConfigMacOSXBehaviors;
40994100
if (g.ActiveId != id && init_make_active)
41004101
{
41014102
IM_ASSERT(state && state->ID == id);
@@ -4118,6 +4119,8 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
41184119
SetKeyOwner(ImGuiKey_PageUp, id);
41194120
SetKeyOwner(ImGuiKey_PageDown, id);
41204121
}
4122+
if (is_osx)
4123+
SetKeyOwner(ImGuiMod_Alt, id);
41214124
if (flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_AllowTabInput)) // Disable keyboard tabbing out as we will use the \t character.
41224125
SetKeyOwner(ImGuiKey_Tab, id);
41234126
}
@@ -4187,7 +4190,6 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
41874190
const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + state->ScrollX;
41884191
const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y) : (g.FontSize * 0.5f));
41894192

4190-
const bool is_osx = io.ConfigMacOSXBehaviors;
41914193
if (select_all)
41924194
{
41934195
state->SelectAll();
@@ -4288,7 +4290,6 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
42884290
state->Stb.row_count_per_page = row_count_per_page;
42894291

42904292
const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0);
4291-
const bool is_osx = io.ConfigMacOSXBehaviors;
42924293
const bool is_wordmove_key_down = is_osx ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl
42934294
const bool is_startend_key_down = is_osx && io.KeySuper && !io.KeyCtrl && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End
42944295

0 commit comments

Comments
 (0)