Skip to content

Commit 9f5b9b9

Browse files
committed
Fix RmlUi compatibility issues
- Add Focus() method to RmlUiField base class for dialog compatibility - Fix abstract_state.lua to handle editors without window property - Remove invalid 'decorator: image' CSS rule, use filter instead - Prevents crashes when using file dialogs and editor states in RmlUi mode
1 parent b80cc8b commit 9f5b9b9

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

scen_edit/state/abstract_state.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@ function AbstractState:KeyPress(key, mods, isRepeat, label, unicode)
4242
end
4343

4444
local editor = self:__GetEditor()
45-
if editor and not editor.window.__disabled then
46-
if editor:KeyPress(key, mods, isRepeat, label, unicode) then
45+
if editor then
46+
-- In RmlUi mode, editors don't have a window property
47+
local canProcessKey = true
48+
if editor.window and editor.window.__disabled then
49+
canProcessKey = false
50+
end
51+
if canProcessKey and editor:KeyPress(key, mods, isRepeat, label, unicode) then
4752
return true
4853
end
4954
end

scen_edit/view/rcss/springboard.rcss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ body#springboard {
297297
}
298298

299299
.action-button.pressed .action-button-icon {
300-
decorator: image;
301-
image-color: #00ff00;
300+
/* Green tint for pressed state - using filter instead of decorator */
301+
filter: brightness(1.2) sepia(0.5) hue-rotate(70deg);
302302
}
303303

304304
.action-button-label {

scen_edit/view/rmlui_fields.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ function RmlUiField:Set(value)
4545
self:SetValue(value)
4646
end
4747

48+
function RmlUiField:Focus()
49+
-- Focus the input element (for dialogs)
50+
if SB.view and SB.view.mainDocument then
51+
local input = SB.view.mainDocument:GetElementById("field-" .. self.name)
52+
if input and input.Focus then
53+
input:Focus()
54+
end
55+
end
56+
end
57+
4858
function RmlUiField:UpdateDisplay()
4959
-- Override in subclass
5060
end

0 commit comments

Comments
 (0)