News for hackers. Stuff that matters.
Re:Ask HN: What's your "it's not stupid if it works" story? by sowbug on Saturday December 23, 2023 @01:35AM (#38742173)
Not my idea or implementation.

Our startup built a plugin for Microsoft Outlook. It was successful, and customers wanted the same thing but for Outlook Express. Unfortunately, OE had no plugin architecture. But Windows has Windows hooks and DLL injection. So we were able to build a macro-like system that clicked here and dragged there and did what we needed it to. The only problem was that you could see all the actions happening on the screen. It worked perfectly, but the flickering looked awful.

At lunch, someone joked that we just had to convince OE users not to look at the screen while our product did its thing. We all laughed, then paused. We looked around at each other and said "no, that can't work."

That afternoon someone coded up a routine to screenshot the entire desktop, display the screenshot full-screen, do our GUI manipulations, wait for the event loop to drain so that we knew OE had updated, and then kill the full-screen overlay. Since the overlay was a screenshot of the screen, it shouldn't have been noticable.

It totally worked. The flickering was gone. We shipped the OE version with the overlay hiding the GUI updates. Users loved the product.

Re:Ask HN: What's your "it's not stupid if it works" story? by xxs on Saturday December 23, 2023 @03:23AM (#38742574)
The thing (screenshot and all) was routine done in the 90s with all those fancy non-rectangular applications/demos/launchers [usually available on CDs that came w/ magazines]. They had transparent/alpha zones that copied the screen under them.
Re:Ask HN: What's your "it's not stupid if it works" story? by Maxion on Saturday December 23, 2023 @04:38AM (#38742905)
Ahh so THAT's how they did that!
Re:Ask HN: What's your "it's not stupid if it works" story? by firebot on Saturday December 23, 2023 @05:23AM (#38743101)
It depends. Windows can be set to shapes going back to like Windows 95, iirc.

But alpha, specifically, would be faked at that point. Windows 2000 supported alpha for such things in a basic way, like XP. Vista with Aero and 7 then really expanded the themes and the window compositing.

Re:Ask HN: What's your "it's not stupid if it works" story? by anthk on Saturday December 23, 2023 @04:47AM (#38742948)
Back in the day terminals under Linux did that to fake transparency: they just copied a chunk of the root window (where you put some wallpaper) as the terminal background and applied an alpha layer if the user wanted a translucid color.
Re:Ask HN: What's your "it's not stupid if it works" story? by onli on Saturday December 23, 2023 @05:07AM (#38743042)
Fake transparency is still a thing, for desktops without compositor. Not only in terminals, but also in docks.
Re:Ask HN: What's your "it's not stupid if it works" story? by anthk on Saturday December 23, 2023 @05:49AM (#38743222)
But docks work in a different way, such as XRender or just a PNG with an alpha layer. Much less expensive than copying a chunk of the backdrop and then "pasted" at your terminal background.

Often docks will be able to show you the underlying windows behind it, even without compositing. But under the terminal with fake transparency you couldn't see another window behind it, just the backdrop part.

I think X11 had some extensions to allow translucency too for software like oneko, xroach or such.

Re:Ask HN: What's your "it's not stupid if it works" story? by onli on Saturday December 23, 2023 @08:32AM (#38744113)
From my experience this is wrong. If you set a transparent background in wxwidgets/gtk it will show you a grey background. And gtk3 even removed the ability to query the x background pixmap. So if there is better support for this at an X level, this is not available above.

See https://github.com/onli/simdock/issues/11, and if there really are good alternative solutions I'd be happy for some help.

Re:Ask HN: What's your "it's not stupid if it works" story? by anthk on Saturday December 23, 2023 @02:15PM (#38747148)
Ah, too bad then. So, lots of stuff got deprecated, I didn't notice that until right now.

Still, there was another tech not querying the background pixmaps, but used from old X11 software to do non-rectangular windows. Oclock, maybe.

Re:Ask HN: What's your "it's not stupid if it works" story? by stavros on Saturday December 23, 2023 @05:54AM (#38743245)
Why is it less expensive? Sounds like the exact same operation, except the OS is doing it.
Re:Ask HN: What's your "it's not stupid if it works" story? by anthk on Saturday December 23, 2023 @08:11AM (#38744012)
No. XRender worked in a different way than ATerm/Eterm.
Re:Ask HN: What's your "it's not stupid if it works" story? by TonyTrapp on Saturday December 23, 2023 @05:11AM (#38743058)
Maybe some incompetent people did it that way, but 1-bit transparency was very well possible with native Windows APIs in the 90s (see SetWindowRgn). Later on (starting with Windows 2000 IIRC) it was also possible to have semi-transparent (alpha-blended) regions.
Re:Ask HN: What's your "it's not stupid if it works" story? by timbaboon on Saturday December 23, 2023 @06:07AM (#38743304)
It's not stupid if it works...
Re:Ask HN: What's your "it's not stupid if it works" story? by stormking on Saturday December 23, 2023 @05:33AM (#38743148)
Please educate yourself before you accuse people of incompetency. Of course it was about (pseudo) alpha blending because "smooth shadows" around everything became very popular in the late 90s.
Re:Ask HN: What's your "it's not stupid if it works" story? by constantly on Saturday December 23, 2023 @06:03AM (#38743284)
In a thread about “if it’s not stupid if it works” you accuse people of doing something “incompetent” by doing something ostensibly “stupid but works” but totally miss on what was even possible “non-stupidly.” There feels like some form of irony here.
Re:Ask HN: What's your "it's not stupid if it works" story? by TonyTrapp on Saturday December 23, 2023 @06:29AM (#38743436)
Yes, obviously there a grain of irony in the reply. ;)
Re:Ask HN: What's your "it's not stupid if it works" story? by 8n4vidtmkvmk on Saturday December 23, 2023 @10:53PM (#38750950)
I'm not convinced it works though. A screenshot would break any animations playing underneath
Re:Ask HN: What's your "it's not stupid if it works" story? by firebot on Saturday December 23, 2023 @05:49AM (#38743224)
Not exactly. With 2000/XP you can set the entire window opacity. Still no gdi+ native. So regions were still just shapes(1bit mask). Trying to set a pre-multiplied bitmap to a window will just give you a brightened version(the multiplied version).

Though there was some support for cursor shadow at this point, and the improved GDI heap really helped, making faking a window drop shadow actually pretty feasible. Vista and Aero is the first native support for Windows with alpha channels.

I actually liked Vista. It worked just fine and wasn't unnecessarily reorganized. Plus the improvements to the OS threading model were excellent, which is why 7 is so incredibly rock solid, probably peak Windows.

Re:Ask HN: What's your "it's not stupid if it works" story? by stormking on Saturday December 23, 2023 @03:27AM (#38742587)
That's called double-buffering.
Re:Ask HN: What's your "it's not stupid if it works" story? by givemeethekeys on Saturday December 23, 2023 @03:57AM (#38742711)
They invented double-buffering! :)
Re:Ask HN: What's your "it's not stupid if it works" story? by hutzlibu on Saturday December 23, 2023 @04:34AM (#38742886)
I think it was meant as a joke, so for anyone else reading it, no it is not actually double-buffering.
Re:Ask HN: What's your "it's not stupid if it works" story? by stormking on Saturday December 23, 2023 @05:35AM (#38743162)
Half a joke, because the concept is very much the same. You "paint" to an invisible buffer and then you swap.
Re:Ask HN: What's your "it's not stupid if it works" story? by hutzlibu on Saturday December 23, 2023 @05:43AM (#38743196)
Yeah, but the concept of double buffering is to swap every frame, for performance gains.

Here nothing gets swapped, and just temporary the screen gets hidden. So vaguely similar ... but not very much the same in my opinion.

Re:Ask HN: What's your "it's not stupid if it works" story? by mycall on Saturday December 23, 2023 @10:05AM (#38744694)
freeze-frame buffering
Re:Ask HN: What's your "it's not stupid if it works" story? by 3836293648 on Sunday December 24, 2023 @06:55AM (#38752913)
Performance gains is kinda iffy. You actively hurt latency for the sake of consistency. Even more with triple buffering.
Re:Ask HN: What's your "it's not stupid if it works" story? by thebruce87m on Saturday December 23, 2023 @04:37AM (#38742901)
double-bluffering?
Re:Ask HN: What's your "it's not stupid if it works" story? by zerr on Saturday December 23, 2023 @02:56AM (#38742473)
You could just overlay the Outlook window.
Re:Ask HN: What's your "it's not stupid if it works" story? by faloppad on Saturday December 23, 2023 @02:54AM (#38742464)
Love it, lol
Re:Ask HN: What's your "it's not stupid if it works" story? by rewgs on Saturday December 23, 2023 @10:18AM (#38744798)
I absolutely love this.
Re:Ask HN: What's your "it's not stupid if it works" story? by nonfamous on Saturday December 23, 2023 @10:53AM (#38745104)
Early versions of iOS did this too. You’d tap an app icon and the app would appear instantly in its prior state … but it was just a saved screenshot that iOS displayed while the app was actually loading.
Re:Ask HN: What's your "it's not stupid if it works" story? by MBCook on Saturday December 23, 2023 @01:00PM (#38746373)
Really it still does, in a way. The ”apps” in the app switcher work that way. Even if the app is still live in memory, it’s not rendering to the switcher all the time. And if it was killed, then the pic is all that’s left.
Re:Ask HN: What's your "it's not stupid if it works" story? by justsid on Saturday December 23, 2023 @04:27PM (#38748393)
While this is a great hack, this feels like a terrible product to sell to customers. I work on a game with an SDK for plugin development, but sometimes third party developers go off and want to do things that the SDK doesn't offer. Since they get to be in our address space, it's pretty trivial to snoop around internal resources if you really wanted to. The problem is, when we update some core parts of the engine, we tend to break these things. Then users get upset with us and the third parties start to complain that we broke their hacks. It's just a bad experience for everyone.
Re:Ask HN: What's your "it's not stupid if it works" story? by kidfiji on Sunday December 24, 2023 @06:19AM (#38752740)
Out of sheer curiosity, could you name this game?
Re:Ask HN: What's your "it's not stupid if it works" story? by justsid on Sunday December 24, 2023 @11:55AM (#38754741)
Sure, it’s X-Plane 12. But this really is a problem for any software that is continuously being developed and that sees active releases. Any time the internal API or ABI breaks, chances are you break someone’s work with it.
Re:Ask HN: What's your "it's not stupid if it works" story? by kidfiji on Tuesday December 26, 2023 @07:05PM (#38777477)
Thanks for sharing, again - I was just curious. That's a fair statement indeed :)