Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

fix(panel): stack labelled dropdowns like the section dropdowns (ray.30)

raymondchinsdb6cfb8d53ff
diff --git a/dylib/feats/webpatch.c b/dylib/feats/webpatch.c
index ea0dd18..4a60323 100644
--- a/dylib/feats/webpatch.c
+++ b/dylib/feats/webpatch.c
@@ -255,6 +255,9 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {
".MSCXPanel .MSCXRow{display:flex;flex-direction:row;padding:9px;margin:0;" \
"color:#dfe3e6;background:rgba(59,63,72,.5);border-radius:3px}" \
".MSCXPanel .MSCXRow:hover{box-shadow:0 6px 8px 0 rgba(0,0,0,.16)}" \
+ ".MSCXPanel .MSCXDrop{display:flex;flex-direction:column;align-items:stretch;gap:6px;" \
+ "padding:0;margin:10px 0;background:none}" \
+ ".MSCXPanel .MSCXDrop>*{width:100%;max-width:none;margin:0}" \
".MSCXNoBottomGap{margin-bottom:0}\""
// FEX runs arm64 Wine, which has no D3DMetal and never runs under Rosetta.
@@ -301,9 +304,10 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {
"T=(ks,l,on,off)=>(0," RT ".jsx)(" BARREL ".Yh,{className:\"MSCXRow\",label:l," \
"checked:ev(ks[0])===on," \
"onChange:v=>s(ks.map(k=>[k,v?(dv(k)===on?\"\":on):(dv(k)===on?(off||\"0\"):\"\")]))},ks[0])," \
- /* A labelled dropdown row. n turns a raw value, set or not, into an option's data, so \
+ /* A labelled dropdown: its label above it, full width, without a row box around it, \
+ like the section dropdowns. n turns a raw value, set or not, into an option's data, so \
picking what the confs already give drops the argument instead of writing it. */ \
- "D=(k,l,O,n)=>(0," RT ".jsx)(" BARREL ".m,{label:l,strClassName:\"MSCXRow\",rgOptions:O," \
+ "D=(k,l,O,n)=>(0," RT ".jsx)(" BARREL ".m,{label:l,strClassName:\"MSCXDrop\",rgOptions:O," \
"selectedOption:n(ev(k)),onChange:v=>s([[k,v.data===n(dv(k))?\"\":v.data]])},k)," \
"lc=z=>x=>(x||z).toLowerCase()," \
"fz=x=>{x=(x||\"\").toLowerCase();return x===\"1\"?\"2\":/^(0|off|false|no)?$/.test(x)?\"0\":x}," \
diff --git a/dylib/tests/panel-behavior/behavior.js b/dylib/tests/panel-behavior/behavior.js
index bf52a1d..f12f40c 100644
--- a/dylib/tests/panel-behavior/behavior.js
+++ b/dylib/tests/panel-behavior/behavior.js
@@ -133,8 +133,8 @@ for (const form of Object.keys(FORMS)) {
t.ok(nodes('').some(x => x.type === 'Section' && x.props.label === FGL),
'the frame generation section warns about latency');
const mode = fgrow('', 'Mode');
- t.ok(mode.type === 'Dropdown' && mode.props.className === undefined && mode.props.strClassName === 'MSCXRow',
- 'the mode is a dropdown row');
+ t.ok(mode.type === 'Dropdown' && mode.props.className === undefined && mode.props.strClassName === 'MSCXDrop',
+ 'the mode is a dropdown with its label above it');
t.ok(mode.props.rgOptions.map(x => x.label).join(',') === 'Off,2x,3x,Adaptive (fills to display refresh)' &&
mode.props.rgOptions.map(x => x.data).join(',') === '0,2,3,adaptive',
`the modes name themselves (${mode.props.rgOptions.map(x => x.label).join(',')})`);
@@ -145,8 +145,9 @@ for (const form of Object.keys(FORMS)) {
const ordered = fgRows('NOTPROTON_FRAMEGEN=2').map(x => x.props.label);
t.ok(ordered.join('|') === ['Mode', 'Quality', FGT.ui, FGT.fb, 'Engine'].join('|'),
`on shows five rows in order (${ordered.join('|')})`);
- t.ok(fgRows('NOTPROTON_FRAMEGEN=2').every(x => (x.props.className || x.props.strClassName) === 'MSCXRow'),
- 'every frame generation row carries the row class');
+ t.ok(fgRows('NOTPROTON_FRAMEGEN=2').every(x => x.type === 'Dropdown' ? x.props.strClassName === 'MSCXDrop'
+ : x.props.className === 'MSCXRow'),
+ 'frame generation toggles are rows and its dropdowns stack their label above');
for (const [v, want] of [['1', '2'], ['2', '2'], ['3', '3'], ['adaptive', 'adaptive'], ['Adaptive', 'adaptive']]) {
t.ok(fgrow('NOTPROTON_FRAMEGEN=' + v, 'Mode').props.selectedOption === want, `${v} reads as ${want}`);
}
@@ -255,7 +256,7 @@ for (const form of Object.keys(FORMS)) {
t.ok(pad.props.selectedOption === '', 'Automatic is selected when NP_PAD_MODE is unset everywhere');
t.ok(nrow(NAT + ' MTL_HUD_ENABLED=1 %command%', 'Controller layer').props.selectedOption === '',
'Automatic stays selected when other variables are set');
- t.ok(pad.props.strClassName === 'MSCXRow', 'the controller layer is a row');
+ t.ok(pad.props.strClassName === 'MSCXDrop', 'the controller layer is a stacked dropdown');
t.ok(nnodes('').some(x => x.type === 'Section' && x.props.label === 'Controllers'), 'the native controller section');
t.ok(P({ details: mac('', { unAppID: 3420702832 }) }).props.children.props.children.length > 4,
'a mac shortcut still gets the full panel');
diff --git a/dylib/version.h b/dylib/version.h
index ccbd83b..c24c880 100644
--- a/dylib/version.h
+++ b/dylib/version.h
@@ -2,6 +2,6 @@
#ifndef NOTPROTON_VERSION_H
#define NOTPROTON_VERSION_H
-#define NOTPROTON_VERSION "1.1.9-winehq.1-ray.29"
+#define NOTPROTON_VERSION "1.1.9-winehq.1-ray.30"
#endif // NOTPROTON_VERSION_H