You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-18 14:21:41 +00:00
Add setting for when to show the focus state for mouse input
This commit is contained in:
@@ -1675,7 +1675,7 @@ ProjectSettings::ProjectSettings() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GLOBAL_DEF_BASIC("gui/common/snap_controls_to_pixels", true);
|
GLOBAL_DEF_BASIC("gui/common/snap_controls_to_pixels", true);
|
||||||
GLOBAL_DEF("gui/common/always_show_focus_state", false);
|
GLOBAL_DEF(PropertyInfo(Variant::INT, "gui/common/show_focus_state_on_pointer_event", PROPERTY_HINT_ENUM, "Never,Control Supports Keyboard Input,Always"), 1);
|
||||||
GLOBAL_DEF_BASIC("gui/fonts/dynamic_fonts/use_oversampling", true);
|
GLOBAL_DEF_BASIC("gui/fonts/dynamic_fonts/use_oversampling", true);
|
||||||
|
|
||||||
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/rendering_device/vsync/frame_queue_size", PROPERTY_HINT_RANGE, "2,3,1"), 2);
|
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/rendering_device/vsync/frame_queue_size", PROPERTY_HINT_RANGE, "2,3,1"), 2);
|
||||||
|
|||||||
@@ -621,7 +621,7 @@
|
|||||||
<param index="0" name="hide_focus" type="bool" default="false" />
|
<param index="0" name="hide_focus" type="bool" default="false" />
|
||||||
<description>
|
<description>
|
||||||
Steal the focus from another control and become the focused control (see [member focus_mode]).
|
Steal the focus from another control and become the focused control (see [member focus_mode]).
|
||||||
If [param hide_focus] is [code]true[/code], the control will not visually show its focused state. Has no effect if [member ProjectSettings.gui/common/always_show_focus_state] is set to [code]true[/code].
|
If [param hide_focus] is [code]true[/code], the control will not visually show its focused state. Has no effect for [LineEdit] and [TextEdit] when [member ProjectSettings.gui/common/show_focus_state_on_pointer_event] is set to [code]Control Supports Keyboard Input[/code], or for any control when it is set to [code]Always[/code].
|
||||||
[b]Note:[/b] Using this method together with [method Callable.call_deferred] makes it more reliable, especially when called inside [method Node._ready].
|
[b]Note:[/b] Using this method together with [method Callable.call_deferred] makes it more reliable, especially when called inside [method Node._ready].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@@ -1177,12 +1177,15 @@
|
|||||||
<member name="filesystem/import/fbx2gltf/enabled.web" type="bool" setter="" getter="" default="false">
|
<member name="filesystem/import/fbx2gltf/enabled.web" type="bool" setter="" getter="" default="false">
|
||||||
Override for [member filesystem/import/fbx2gltf/enabled] on the Web where FBX2glTF can't easily be accessed from Godot.
|
Override for [member filesystem/import/fbx2gltf/enabled] on the Web where FBX2glTF can't easily be accessed from Godot.
|
||||||
</member>
|
</member>
|
||||||
<member name="gui/common/always_show_focus_state" type="bool" setter="" getter="" default="false">
|
|
||||||
If [code]true[/code], [Control]s will always show if they're focused, even if said focus was gained via mouse/touch input.
|
|
||||||
</member>
|
|
||||||
<member name="gui/common/default_scroll_deadzone" type="int" setter="" getter="" default="0">
|
<member name="gui/common/default_scroll_deadzone" type="int" setter="" getter="" default="0">
|
||||||
Default value for [member ScrollContainer.scroll_deadzone], which will be used for all [ScrollContainer]s unless overridden.
|
Default value for [member ScrollContainer.scroll_deadzone], which will be used for all [ScrollContainer]s unless overridden.
|
||||||
</member>
|
</member>
|
||||||
|
<member name="gui/common/show_focus_state_on_pointer_event" type="int" setter="" getter="" default="1">
|
||||||
|
Determines whether a [Control] should visually indicate focus when said focus is gained using a mouse or touch input.
|
||||||
|
- [b]Never[/b] ([code]0[/code]) show the focused state for mouse/touch input.
|
||||||
|
- [b]Control Supports Keyboard Input[/b] ([code]1[/code]) shows the focused state even when gained via mouse/touch input (similar to how browsers handle focus).
|
||||||
|
- [b]Always[/b] ([code]2[/code]) show the focused state, even if said focus was gained via mouse/touch input.
|
||||||
|
</member>
|
||||||
<member name="gui/common/snap_controls_to_pixels" type="bool" setter="" getter="" default="true">
|
<member name="gui/common/snap_controls_to_pixels" type="bool" setter="" getter="" default="true">
|
||||||
If [code]true[/code], snaps [Control] node vertices to the nearest pixel to ensure they remain crisp even when the camera moves or zooms.
|
If [code]true[/code], snaps [Control] node vertices to the nearest pixel to ensure they remain crisp even when the camera moves or zooms.
|
||||||
</member>
|
</member>
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "line_edit.h"
|
#include "line_edit.h"
|
||||||
|
|
||||||
|
#include "core/config/project_settings.h"
|
||||||
#include "core/input/input_map.h"
|
#include "core/input/input_map.h"
|
||||||
#include "core/os/keyboard.h"
|
#include "core/os/keyboard.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
@@ -1343,7 +1344,7 @@ void LineEdit::_notification(int p_what) {
|
|||||||
style->draw(ci, Rect2(Point2(), size));
|
style->draw(ci, Rect2(Point2(), size));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_focus(true)) {
|
if (has_focus(Engine::get_singleton()->is_editor_hint() || GLOBAL_GET_CACHED(int, "gui/common/show_focus_state_on_pointer_event") != 1)) {
|
||||||
theme_cache.focus->draw(ci, Rect2(Point2(), size));
|
theme_cache.focus->draw(ci, Rect2(Point2(), size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -945,7 +945,7 @@ void TextEdit::_notification(int p_what) {
|
|||||||
theme_cache.style_readonly->draw(ci, Rect2(Point2(), size));
|
theme_cache.style_readonly->draw(ci, Rect2(Point2(), size));
|
||||||
draw_caret = is_drawing_caret_when_editable_disabled();
|
draw_caret = is_drawing_caret_when_editable_disabled();
|
||||||
}
|
}
|
||||||
if (has_focus(true)) {
|
if (has_focus(Engine::get_singleton()->is_editor_hint() || GLOBAL_GET_CACHED(int, "gui/common/show_focus_state_on_pointer_event") != 1)) {
|
||||||
theme_cache.style_focus->draw(ci, Rect2(Point2(), size));
|
theme_cache.style_focus->draw(ci, Rect2(Point2(), size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -532,7 +532,7 @@ void Viewport::_update_viewport_path() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Viewport::_can_hide_focus_state() {
|
bool Viewport::_can_hide_focus_state() {
|
||||||
return Engine::get_singleton()->is_editor_hint() || !GLOBAL_GET_CACHED(bool, "gui/common/always_show_focus_state");
|
return Engine::get_singleton()->is_editor_hint() || GLOBAL_GET_CACHED(int, "gui/common/show_focus_state_on_pointer_event") < 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewport::_on_settings_changed() {
|
void Viewport::_on_settings_changed() {
|
||||||
|
|||||||
Reference in New Issue
Block a user