Skip to content

Commit

Permalink
Mask long press subconfig on Apple platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
ksqsf authored and wengxt committed Jun 11, 2024
1 parent b553f55 commit 4ea4aa7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/im/keyboard/keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ FCITX_CONFIGURATION(
"LongPressBlocklist",
_("Applications disabled for long press"),
{"konsole"}};
SubConfigOption longPress{this, "LongPress", _("Long Press behavior"),
"fcitx://config/addon/keyboard/longpress"};);
ConditionalHidden<isApple(), SubConfigOption> longPress{
this, "LongPress", _("Long Press behavior"),
"fcitx://config/addon/keyboard/longpress"};);

class KeyboardEngine;

Expand Down
15 changes: 15 additions & 0 deletions src/lib/fcitx-config/option.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,21 @@ struct ConditionalHiddenHelper<true,
using OptionType = HiddenOption<T, Constrain, Marshaller, Annotation>;
};

template <>
struct ConditionalHiddenHelper<false, SubConfigOption> {
using OptionType = SubConfigOption;
};

template <>
struct ConditionalHiddenHelper<true, SubConfigOption> {
class HiddenSubConfigOption : public SubConfigOption {
public:
using SubConfigOption::SubConfigOption;
bool skipDescription() const { return true; }
};
using OptionType = HiddenSubConfigOption;
};

template <bool hidden, typename T>
using ConditionalHidden =
typename ConditionalHiddenHelper<hidden, T>::OptionType;
Expand Down

0 comments on commit 4ea4aa7

Please sign in to comment.