Skip to content

Commit 9c94486

Browse files
vchelaruclaude
andauthored
Collapse dead post-GumCommon platform #if branches in Forms header usings (#3541)
* Collapse dead post-GumCommon platform #if branches in Forms header usings The Gum Forms control files physically live in MonoGameGum/Forms/ but are compiled exactly once — into GumCommon (net8.0), which defines none of XNALIKE/RAYLIB/SOKOL/SKIA/FRB. Every runtime (MonoGame/KNI/FNA/Raylib/Sokol) compile-Removes them and consumes them from the GumCommon reference; FRB is the one exception, compiling these same files separately with FRB defined. So in each file's top-of-file using-selection block, the #elif XNALIKE / #elif RAYLIB / #elif SOKOL branches were dead code that nothing compiled — and actively misleading (they read as if MonoGame uses XNA Keys, which it no longer does after the shipped neutral-Keys migration). Collapsed each to just #if FRB / neutral #else. KeyCombo.cs rewritten from '#if !XNALIKE && !FRB' to the same '#if FRB / #else' shape (behavior-identical). Also deleted the dead '#if MONOGAME' block in FrameworkElementExt.cs (unused 'using Microsoft.Xna.Framework;' whose only consumer is a commented-out AddDebugOverlay), and corrected a KeyCombo comment made stale by the migration. Content-only edits: no files added/renamed/deleted, so no projitems changes. FRB #if branches and body platform #if blocks (TextBoxBase caret/native-keyboard, RangeBase MONOGAME, ANDROID) left untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Document why TextBox caret fast-path stays #if XNALIKE, link #3542 The #if XNALIKE caret block in GetIndex is only compiled by FRB's XNA-family builds post-GumCommon migration; it gates an XNA bitmap-font capability (not FRB-ness), so it is intentionally not #if FRB. Tracks the IFormsText lift in #3542. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Document ListBox selection-modifier-key type change in May migration doc The four public static ListBox multi-select modifier keys (ToggleSelectionModifierKey, AlternateToggleSelectionModifierKey, RangeSelectionModifierKey, AlternateRangeSelectionModifierKey) also flipped from XNA Keys to Gum.Forms.Input.Keys when Forms moved to GumCommon, but were missing from the migration doc's widened-input-types section. Adds the table row plus a short subsection. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b684e57 commit 9c94486

12 files changed

Lines changed: 36 additions & 61 deletions

File tree

MonoGameGum/Forms/Controls/ComboBox.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020
using Buttons = FlatRedBall.Input.Xbox360GamePad.Button;
2121
using GamepadButton = FlatRedBall.Input.Xbox360GamePad.Button;
2222
namespace FlatRedBall.Forms.Controls;
23-
#elif XNALIKE
24-
using MonoGameGum.Input;
25-
using Gum.Input;
26-
using GamepadButton = Gum.Input.GamepadButton;
27-
using Microsoft.Xna.Framework.Input;
2823
#else
2924
using Gum.Input;
3025
using GamepadButton = Gum.Input.GamepadButton;

MonoGameGum/Forms/Controls/FrameworkElement.cs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,13 @@
3232
using Buttons = FlatRedBall.Input.Xbox360GamePad.Button;
3333
using GamepadButton = FlatRedBall.Input.Xbox360GamePad.Button;
3434
namespace FlatRedBall.Forms.Controls;
35-
#elif XNALIKE
36-
using Keys = Microsoft.Xna.Framework.Input.Keys;
37-
using Microsoft.Xna.Framework.Input;
38-
using MonoGameGum.Input;
39-
using Gum.Input;
40-
using GamepadButton = Gum.Input.GamepadButton;
41-
using Gum.Converters;
42-
#elif RAYLIB
43-
using RaylibGum;
44-
using Gum.Input;
45-
using Keys = Gum.Forms.Input.Keys;
46-
#elif SOKOL
47-
using Gum.Input;
48-
using Keys = Gum.Forms.Input.Keys;
4935
#else
50-
// Default branch — used when this file is compiled into GumCommon, which defines
51-
// none of FRB/XNALIKE/RAYLIB/SOKOL. The Forms abstraction lives in Gum.Input /
52-
// Gum.Forms.Input, so the headless build picks up the same shared types Raylib/Sokol use.
36+
// Non-FRB branch. These Forms control files compile exactly once — into GumCommon
37+
// (net8.0), which defines none of XNALIKE/RAYLIB/SOKOL/SKIA. Every runtime
38+
// (MonoGame/KNI/FNA/Raylib/Sokol) compile-Removes them and consumes them from that
39+
// GumCommon reference, so the former per-platform #elif branches were dead code and
40+
// were removed; only FRB compiles these files separately and keeps its own branch above.
41+
// The Forms abstraction lives in Gum.Input / Gum.Forms.Input.
5342
using Gum.Input;
5443
using Keys = Gum.Forms.Input.Keys;
5544
#endif

MonoGameGum/Forms/Controls/FrameworkElementExt.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ namespace MonoGameGum.Forms.Controls;
2020
namespace Gum.Forms.Controls;
2121
#endif
2222

23-
#if MONOGAME
24-
25-
using Microsoft.Xna.Framework;
26-
27-
#endif
28-
2923

3024
public static class FrameworkElementExt
3125
{

MonoGameGum/Forms/Controls/ListBox.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@
2424
using Buttons = FlatRedBall.Input.Xbox360GamePad.Button;
2525
using static FlatRedBall.Input.Xbox360GamePad;
2626
namespace FlatRedBall.Forms.Controls;
27-
#elif XNALIKE
28-
using MonoGameGum.Input;
29-
using Gum.Input;
30-
using GamepadButton = Gum.Input.GamepadButton;
31-
using Microsoft.Xna.Framework.Input;
3227
#else
3328
using Gum.Input;
3429
using GamepadButton = Gum.Input.GamepadButton;

MonoGameGum/Forms/Controls/Primitives/ButtonBase.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515
using GamepadButton = FlatRedBall.Input.Xbox360GamePad.Button;
1616
using static FlatRedBall.Input.Xbox360GamePad;
1717
namespace FlatRedBall.Forms.Controls.Primitives;
18-
#elif XNALIKE
19-
using Microsoft.Xna.Framework.Input;
20-
using MonoGameGum.Input;
21-
using Gum.Input;
22-
using GamepadButton = Gum.Input.GamepadButton;
2318
#else
2419
using Gum.Input;
2520
using GamepadButton = Gum.Input.GamepadButton;

MonoGameGum/Forms/Controls/Primitives/RangeBase.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
using FlatRedBall.Gui;
1313
using InteractiveGue = global::Gum.Wireframe.GraphicalUiElement;
1414
namespace FlatRedBall.Forms.Controls.Primitives;
15-
#elif XNALIKE
16-
using MonoGameGum.Input;
1715
#endif
1816

1917

MonoGameGum/Forms/Controls/ScrollBar.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
using FlatRedBall.Forms.Controls.Primitives;
1111
using InteractiveGue = global::Gum.Wireframe.GraphicalUiElement;
1212
namespace FlatRedBall.Forms.Controls;
13-
#elif XNALIKE
14-
using Microsoft.Xna.Framework;
15-
using MonoGameGum.Input;
1613
#endif
1714

1815
#if !FRB

MonoGameGum/Forms/Controls/ScrollViewer.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
using InteractiveGue = global::Gum.Wireframe.GraphicalUiElement;
1818
using Buttons = FlatRedBall.Input.Xbox360GamePad.Button;
1919
namespace FlatRedBall.Forms.Controls;
20-
#elif XNALIKE
21-
using GamepadButton = Gum.Input.GamepadButton;
22-
using Microsoft.Xna.Framework.Input;
23-
using MonoGameGum.Input;
2420
#else
2521
using Gum.Input;
2622
using GamepadButton = Gum.Input.GamepadButton;

MonoGameGum/Forms/Controls/Slider.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
using static FlatRedBall.Input.Xbox360GamePad;
1818
using GamepadButton = FlatRedBall.Input.Xbox360GamePad.Button;
1919
namespace FlatRedBall.Forms.Controls;
20-
#elif XNALIKE
21-
using Microsoft.Xna.Framework.Input;
22-
using MonoGameGum.Input;
23-
using Gum.Input;
24-
using GamepadButton = Gum.Input.GamepadButton;
2520
#else
2621
using Gum.Input;
2722
using GamepadButton = Gum.Input.GamepadButton;

MonoGameGum/Forms/Controls/TextBoxBase.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020
using GamepadButton = FlatRedBall.Input.Xbox360GamePad.Button;
2121
using RenderingLibrary.Graphics;
2222
namespace FlatRedBall.Forms.Controls;
23-
#elif XNALIKE
24-
using Microsoft.Xna.Framework.Input;
25-
using RenderingLibrary.Graphics;
26-
using MonoGameGum.Input;
27-
using GamepadButton = Gum.Input.GamepadButton;
2823
#else
2924
using Gum.Input;
3025
using GamepadButton = Gum.Input.GamepadButton;
@@ -771,6 +766,15 @@ internal int GetCaretIndexAtPosition(float screenX, float screenY)
771766
// long lines. If you change behavior here, **change BOTH branches**
772767
// and verify with a test that exercises GetCaretIndexAtPosition under
773768
// XNALIKE (typing alone does not hit GetIndex).
769+
//
770+
// NOTE (post-GumCommon migration): these control files now compile in
771+
// GumCommon (which defines no XNALIKE), so standalone MonoGame/KNI/FNA/
772+
// Raylib/Skia all take the #else path — only FRB's XNA-family builds still
773+
// compile the #if XNALIKE fast path. It stays #if XNALIKE (not #if FRB) on
774+
// purpose: it gates an XNA bitmap-font *capability*, and FRB has non-XNA
775+
// builds (e.g. FlatRedBall.Forms.DesktopGL, SkiaInGum) that correctly use
776+
// the #else path. Lifting this into IFormsText so every backend gets the
777+
// fast path is tracked in https://github.com/vchelaru/Gum/issues/3542
774778
private int GetIndex(float cursorOffset, string textToUse)
775779
{
776780
var index = textToUse?.Length ?? 0;

0 commit comments

Comments
 (0)