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

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 https://groups.google.com/forum/#!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 (http://groups.google.com/group/rec.arts.int-fiction/msg/b88316e2dcf1bb6b)
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

2 Likes

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.

It will stop the main window from being deleted, which should then mean the stylehints are ignored. Counterfeit Monkey was doing some further things which shouldn’t apply to a simple example using Simple Graphical Window.

Edit: I’ve added the fix to Flexible Windows on Github.

1 Like

That fixes the problem with the stylehints, but seems to introduce a new problem: the initial text printed on restarting is now missing, entering restart just leaves you with an input prompt in a blank window. Testing shows that the game has actually restarted, so I’m not sure where the initial output has gone.

It may be that the “recalibrate windows rule” just doesn’t work for this purpose. The final comment on the 2018 thread suggests that may be the case. It would be worth checking.

Ugh. Sorry for not testing it properly. I’ll look into it more. My guess would be that it’s not focusing the correct window after restarting?

I downloaded Gargoyle and the following game works fine, except that no cursor is displayed until you type the first character of your first command.

"Testing Simple Graphical Window" by Jonathan

Include Simple Graphical Window by Emily Short.

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

The Study is a room. 

Would there be a way for Gargoyle itself to ensure that the cursor is always visible?

Sorry for taking a while to respond to this. Yes, that looks to be the problem, when the game is restarted the current stream is the window stream for the status window, so all the initial game text goes to the status window and therefore is lost.

For my game I used the extension as it was, with the temporary solution mentioned above. But what are the future plans for the extension? Thanks.

@Dannii has filed an issue about this (FW: Fix the acting main window on restart · Issue #70 · i7/extensions · GitHub) so I don’t think it’s been forgotten.

2 Likes

Sorry for taking too long, but I think I’ve fixed the bug where nothing was being printed after restarting. Latest code on Github.

1 Like