Author Topic: Splash Screen  (Read 12739 times)

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Splash Screen
« on: March 09, 2006, 06:22:10 pm »
After some coding I got a first version of a cbSplashScreen which is already usable.

It allows a Splash Screen to be drawn on both Windows and Linux (should be multiplatform) with a transparent mask. That way I got the splash screen used under Windows to work under Linux too.

Here's a screenshot.

The source code can be downloaded from here (splash.zip).

Would the devs mind to use it? :)

Since I know you like minimal effort, splash_multiple.zip has the sources in multiple files ready to be used in Code::Blocks.

[edit]
If the links aren't working, try with the ones a few posts below...
[/edit]
« Last Edit: March 09, 2006, 08:34:28 pm by Ceniza »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Splash Screen
« Reply #1 on: March 09, 2006, 06:32:38 pm »
Cool :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Splash Screen
« Reply #2 on: March 09, 2006, 06:44:21 pm »
Erm... result on Windows XP:

"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Splash Screen
« Reply #3 on: March 09, 2006, 06:57:51 pm »
Nice :)

Although I get the same picture as Thomas under Ubuntu.
It is fixed by replacing Manager::ProcessPendingEvents() with Manager::Yield() (right after the splash creation).
Still, when shown it displays like above for a fraction of a second (before it displays correctly) but this "artifact" is really annoying....
Be patient!
This bug will be fixed soon...

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Splash Screen
« Reply #4 on: March 09, 2006, 07:06:08 pm »
XP:



What's so special about your systems or mine? :?:
« Last Edit: March 09, 2006, 08:10:06 pm by Ceniza »

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Splash Screen
« Reply #5 on: March 09, 2006, 07:57:33 pm »
Could you try adding a call to Update() after Show(true) and see if it does the trick for Windows?

It's kinda hard to find a solution when it works here.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Splash Screen
« Reply #6 on: March 09, 2006, 08:27:26 pm »
It is fixed by replacing Manager::ProcessPendingEvents() with Manager::Yield() (right after the splash creation).
No difference here.

Could you try adding a call to Update() after Show(true) and see if it does the trick for Windows?
That seems to fix it for me, no artefacts.

EDIT: Sorry for the delay, it would not let me post for a while....
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Splash Screen
« Reply #7 on: March 09, 2006, 08:32:23 pm »
GDA seems to be offline and it could take the whole weekend (elections are this weekend and the University will be an information center), so the new links are:

Screenshot.
Files.

thomas: that's nice :)

I wonder if that fix will work for Don Corleone too...

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Splash Screen
« Reply #8 on: March 09, 2006, 08:36:56 pm »
GDA seems to be offline and it could take the whole weekend (elections are this weekend and the University will be an information center), so the new links are:

Screenshot.
Files.

Thanks for the new links :D. The old one were broken.

Nice job, you did. Hmmm....kubuntu..... 8).

Best wishes,
Michael

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Splash Screen
« Reply #9 on: March 09, 2006, 08:40:31 pm »
While trying about 100 times now, I could get a slight artefact by putting the CPU under heavy load. In that case, you can see a short flicker for a fraction of a second, but it is not so bad. I'll do some research, it should be possible to disable drawing the background (then it shouldn't flicker at all).

Another thing which we must change though is wxSTAY_ON_TOP. This is not good because it will freeze up the application if a dialog box (for example "the plugin ... failed to load") is showing during startup. We already had that issue once with this flag.

"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Splash Screen
« Reply #10 on: March 09, 2006, 08:55:15 pm »
It's a shame I have to leave now. If you find anything useful don't forget to post it.

Making cbSplashScreen receive the flags would solve the other problem. At least that one is quite easy to fix :)

I wish you luck!

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Splash Screen
« Reply #11 on: March 09, 2006, 09:18:07 pm »
Yay! I've got rid of the flickering for good, and it is really easy, too:

Code
EVT_ERASE_BACKGROUND(cbSplashScreen::Null)

void Null(wxEraseEvent &){};
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Splash Screen
« Reply #12 on: March 10, 2006, 02:05:55 am »
So that will do the whole trick for Windows but... for Linux?

I've got the grey frame with the default splash screen for Linux too before the real bitmap is shown (even more if the machine is "slow" (PIII 800MHz)). Only when I take a look carefully in my machine I can notice it sometimes, but it takes a short time, same thing for Windows.

I guess it's time for Don Corleone to check again in his Ubuntu. I'll try with Kubuntu in a few minutes and replace the splash_multiple.zip file with those things and the new constructor.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Splash Screen
« Reply #13 on: March 10, 2006, 03:48:58 am »
I've been trying many different things with no success.

Quote from: wxWidgets 2.6.2 about wxEraseEvent
On some platforms, such as GTK+, this event is simulated (simply generated just before the paint event) and may cause flicker. It is therefore recommended that you set the text background colour explicitly in order to prevent flicker. The default background colour under GTK+ is grey.

Quote from: wxWidgets 2.6.2 about wxWindow::SetBackgroundStyle
On GTK+, use of wxBG_STYLE_CUSTOM allows the flicker-free drawing of a custom background, such as a tiled bitmap. Currently the style has no effect on other platforms.

I've tried that one and got the same results (but continue reading).

Quote from: wxWidgets 2.6.2 about wxWindow::SetThemeEnabled
This function tells a window if it should use the system's "theme" code to draw the windows' background instead if its own background drawing code. This does not always have any effect since the underlying platform obviously needs to support the notion of themes in user defined windows. One such platform is GTK+ where windows can have (very colourful) backgrounds defined by a user's selected theme.

Quote from: wxWidgets 2.6.2 about wxTRANSPARENT_WINDOW
The window is transparent, that is, it will not receive paint events. Windows only.

I even tried with shapes and off-screen drawing (placing the frame out of the screen, which wxWidgets didn't like to do).

... SOME MINUTES LATER ...

Moving and moving all that stuff I finally got something that seems to be working :shock:

I just moved the SetBackgroundStyle() call after Show() and it works lovely under Linux!!! And it's also working under Windows!!!

Lets hope it works lovely for Don Corleone and everyone else too :)

This file will be saved in both servers as splash_multiple2.zip (splash not included, but can be extracted from splash.zip).

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Splash Screen
« Reply #14 on: March 10, 2006, 03:12:23 pm »
I just re-uploaded splash_multiple2.zip because of an unchecked pointer in the previous "version" (potential bug that could lead to a lovely segmentation fault).