Some colours reversed in Windows Gluxe when restart game using Simple Graphical Window by Emily Short

I’ve downloaded this extension from the Friends of Inform github repository together with the half dozen other extensions it relies upon, and it works well.

However, when I restart the game in Windows Gluxe some of the colours are reversed. Ordinarily I have white on black text throughout, but now it is black-on-white generally, with white-on-black characters for the game title, room titles, and player inputs.

This doesn’t happen using Quixe or Windows Git.

I haven’t looked into this fully myself but thought I’d mention it here in case it’s a known problem that could easily be worked around. Thanks.

PS I’ve just changed my Gluxe defaults to white on pink! When restarting the game it’s black-on-white generally, with white-on-pink for the characters mentioned above.

I’m not aware of any problems with Windows Glulxe in this area. If you can provide a test case it can be looked into …

1 Like

Thanks for getting back to me so quickly.

It happens with this game:

"Testing Simple Graphical Window" by Jonathan

Include Simple Graphical Window by Emily Short.

The Study is a room.

I’m using Windows Gluxe

The extensions are all from the Friends of I7, downloaded this week.

Here are the extensions that SGW depends on:

Simple Graphical Window by Emily Short

  • Include version 15/160929 of Flexible Windows by Jon Ingold.
    • Include version 1/140516 of Alternative Startup Rules by Dannii Willis.
    • Include version 10/160919 of Glulx Entry Points by Emily Short.
      • Include version 1/160919 of Glulx Definitions by Dannii Willis.
      • Include version 1/160919 of Glk Object Recovery by Dannii Willis.
      • Include version 1/160919 of Glk Events by Dannii Willis.
        • Include version 1/160919 of Glulx Definitions by Dannii Willis.
    • Include version 5/140516 of Glulx Text Effects by Emily Short.

I’ve not yet checked my downloaded versions of the extensions, except for Glulx Text Effects which seemed the most likely problem. I was using Version 5/140516 (built-in with Inform 7 for Windows) and today upgraded to Version 5/150123 (from Friends of I7) but it’s just the same. (Probably the version numbers in the Include lines ensure the intended version is used - I don’t know.)

So you can reproduce the problem with just the version of the extensions built into Inform 7?

Glulx Text Effects is the only one that would be changing colours, however it shouldn’t be required by Simple Graphical Window.

Edit: oops I remembered wrong, FW includes GTE directly.

These extensions should mostly not be setting text colours. Flexible Windows does set a couple, if I remember correctly in order to patch over problems with things like Gargoyle’s cursor colour. Normally these aren’t noticeable because the stylehints are set after windows are opened. And restarting shouldn’t close or reopen windows either. Possibly Simple Graphical Window changes something in that regard.

1 Like

It’s only when I include SGW, which I don’t think is built into Inform 7. I can try old versions of SGW and GTE.

Edit: it turns out SGW v9 is bundled with Inform 7 (just not all v10’s dependencies).

It would be good to try with the versions from the Public Library, i.e. the “Public Library” sub-tab of the “Extensions” tab in the Inform 7 front-end.

1 Like

I’ll try different versions of everything tonight and report back here.

I’ve gone on the laptop instead and downloaded Inform 7 and every built-in extension, from scratch, together with downloading Windows Gluxe. The inverted colour problem doesn’t arise using the sample game above.

So it sounds like a bug introduced by one of the Friends of I7 extensions, or some interaction between them.

1 Like

I’m not sure that sounds quite right to me. Anything that ends up calling VM_SetWindowColours() (in Glulx.i6t) will end up closing and re-opening windows. Any style hints set will definitely affect this. Setting stylehints to patch round Gargoyle problems is probably not the way to go …

Nothing should be calling VM_SetWindowColours, that function is legacy code that nothing uses, I’m pretty sure. Stylehints are perfectly safe to add after a window has been opened, they only affect the next window to be opened (except for a few edge cases, such as the Garglk cursor.)

The problem I have is I don’t yet know how to do the same things with the built-in extensions. I’ve added a question to the relevant topic about that: Simple Graphical Window by Emily Short - #20 by Jonathan

Are you able to reproduce the problem using the simple game above and the Friends of Inform versions of the extensions?

Maybe it’s some other problem with the Inform/Glulxe setup on my computer.

I think I’ve got to the bottom of this.

The problem only occurs when the “Style hints override user settings” option is ticked in Windows Gluxe. You wouldn’t notice anything wrong if you your user settings were white text on black background.

There are two problematic parts of Version 15/200828 of Flexible Windows (for Glulx only) by Jon Ingold, both of which use stylehints as Gargoyle hacks, which take effect when the game is restarted.

My temporary solution is to add the following to my story file:

The Gargoyle cursor color rule is not listed in any rulebook.
The Gargoyle window padding rule is not listed in any rulebook. 

For completeness, the first part is:

[ Gargoyle sets the cursor color to whatever the last text-buffer color hint was. We will reset it using a variable the story author can change.
This is apparently by design, but seems unuseful and buggy to me. I raised the issue at!topic/garglk-dev/DdqG0Ppt2lY ]

The Gargoyle cursor color is initially "#000000".
After constructing a textual g-window (this is the Gargoyle cursor color rule):
	set the color of wintype 3 for normal-style to the Gargoyle cursor color;

And the second part is:

[ As explained by Ben Cressey (
Gargoyle sets the colour of its window padding based on the last background colour style hint given to the normal style. So after clearing all the background colours and styles, we set it based on the background color of the main window, or just set white if it isn't set. ]

[ This phrase is made available in case you want to set the colour at some other time (such as when opening a pop-over window) ]
To set the Gargoyle window padding to (T - a text):
	set the background color of wintype 3 for normal-style to T;

To set the Gargoyle background color to the color (T - a text) (deprecated):
	set the background color of wintype 3 for normal-style to T;

After constructing a textual g-window (this is the Gargoyle window padding rule):
	let T be the background color of the acting main window;
	if T is empty:
		let T be "#ffffff";
	set the Gargoyle window padding to T;
1 Like

I think you’re right, I can now reproduce this. It’s not completely obvious to me why these Gargoyle hacks cause this to happen, but I’ll try to see what’s happening from the interpreter / Glk layer point of view.

1 Like

This sounds suspiciously similar to this bug (from 2018): Help me fix this Counterfeit Monkey bug


Oh yeah. Does adding this code fix it?

The recalibrate windows rule is not listed in the glulx object-updating rules.
A first glulx object-updating rule (this is the new recalibrate windows rule):
	if the starting the virtual machine activity is going on:
		if the main window is g-present:
			now the main window is g-required;
		if the status window is g-present and the no status line option is not active:
			now the status window is g-required;
	calibrate windows;
	focus the current focus window;

After diagnosing the bug I guess I forgot to add the fix into Flexible Windows.

What does that code do? I would be happy to try it out.

The following seemed to fix it (though I’ve not tried Gargoyle so maybe that is now broken):

The Gargoyle cursor color rule is not listed in any rulebook.
The Gargoyle window padding rule is not listed in any rulebook. 

The final sentence of the old topic mentions pretty much the same thing:

Note that to make Gargoyle colors work as expected, The Gargoyle cursor color rule and the Gargoyle window padding rule in Flexible Windows still have to be commented out

I’m not sure how to interpret that, but if the rules are required for something then there’s a way of disapplying them unless required.