Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Look and Chameleon Technology » Question to UPP developers: the issue with windows rendering (Windows XP)
Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29327 is a reply to message #29326] Fri, 15 October 2010 14:31 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
porto wrote on Fri, 15 October 2010 08:20

I understand. But what about the cases described above? Is it possible to fix this issue?

P.S. Sorry for posting .avi files.


I am unable to replay the video, but with the screenshot, the problem is not with U++.

Maybe you have not noticed the same issue with other apps, but that is just coincidence. The problem is not with top window, but with window behind...

Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29333 is a reply to message #29327] Fri, 15 October 2010 14:47 Go to previous messageGo to next message
porto is currently offline  porto
Messages: 51
Registered: March 2007
Member
I have examined in great detail other applications - native, QT apps, and I did not notice anything similar.
There is one screenshot from my video. (VirtualBox+clean WinXP)
In this case, even if the problem with window behind - it's UPP app's window too.

If you want to notice it, try:
Quote:

I found a better way to see this issue.
Download this app (it slows down the CPU):
http://www.cpukiller.com/cpukil305.zip
install it, set the "Slow Down Factor" (I set it on 95%), start slowing down CPU. Now, this issue will be visible very well.


  • Attachment: f0353.jpg
    (Size: 87.13KB, Downloaded 397 times)

[Updated on: Fri, 15 October 2010 17:31]

Report message to a moderator

Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29341 is a reply to message #29327] Fri, 15 October 2010 16:37 Go to previous messageGo to next message
porto is currently offline  porto
Messages: 51
Registered: March 2007
Member
I decided to make another animation to explain the issue:
http://www.ultimatepp.org/forum/index.php?t=getfile&id=2894&
This is an example application "RichTextObject" from UPP.
But if you think this is not a problem, never mind.
  • Attachment: 1.gif
    (Size: 99.83KB, Downloaded 869 times)

[Updated on: Fri, 15 October 2010 18:42]

Report message to a moderator

Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29364 is a reply to message #29341] Sat, 16 October 2010 08:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I know what the issue is, but I am not sure how to fix it. Win32 has control about it.
Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29365 is a reply to message #29364] Sat, 16 October 2010 08:38 Go to previous messageGo to next message
porto is currently offline  porto
Messages: 51
Registered: March 2007
Member
And the last question. Why I can't notice something like this issue with other apps (WinAPI native, Qt etc)? This is an animation of cold start UPP application:
http://www.ultimatepp.org/forum/index.php?t=getfile&id=2895&


P.S. Thanks for your replies. Sorry for my fault-finding and taken away your valuable time.
  • Attachment: nnnnnnnnn.gif
    (Size: 193.46KB, Downloaded 823 times)

[Updated on: Sat, 16 October 2010 09:59]

Report message to a moderator

Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29368 is a reply to message #29365] Sat, 16 October 2010 10:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
porto wrote on Sat, 16 October 2010 02:38

And the last question. Why I can't notice something like this issue with other apps?



My guess: Because you are not trying hard enough...

Quote:


This is an animation of cold start UPP application:

P.S. Thanks for your replies. Sorry for my fault-finding and taken away your valuable time.


Well, to be absolutely sure, I have tried to reproduce the problem on slowest computer I have around (Asus EEE with 1.6Ghz Atom, WinXP), found nothing.

My guess is that the effect is caused by particular setup of your machine.

Actually, within WinXP, this effect is normal - but with normal PC, it is so fast that black areas go away before they are send to the monitor.

For some reason, on your machine it is slower. Well, it CAN becaused by some particular set of flags we are using in call to CreateWindow or something like that, however we are not doing anything "illegal", just using normal Win32 API calls.

I would even tried to mingle with these flags to see if I can solve the problem for you, the problem is I cannot even reproduce the damned thing.

You might also consider upgrading your video driver...
Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29369 is a reply to message #29368] Sat, 16 October 2010 10:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, I did some test using CpuKiller (btw, useful utility, thanks), setting it at 98%.

It is true that U++ based apps show black corners. The same thing is true for following well known software:

Adobe Reader
IrfanView
Total Commander
DVD Shrink

(stopped testing there).

If Adobe does not see this as problem, neither do I.

Just technical sidenote, to me it looks like technical issue behind the problem is that it depends on the way how the main window is composed. If it has a lot of child widgets, Win32 split painting widget by widget to multiple messages and this way some messages in multitasking system reach other windows. U++ is highly optimized there and paints the window in single pass.

You can even notice that if you slow down things, those windows that do not show the black corners generally paint by parts and for quite a longer time...

I guess there is little I can add here - I did not want to dismiss the issue, but this really is non-issue...
Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29370 is a reply to message #29369] Sat, 16 October 2010 10:42 Go to previous messageGo to next message
porto is currently offline  porto
Messages: 51
Registered: March 2007
Member
Thanks, you gave a convincing explanation. Once again sorry for the time taken away from you and I wish you success in U++ development, it's a wonderful framework.

[Updated on: Sat, 16 October 2010 11:26]

Report message to a moderator

Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29513 is a reply to message #29369] Mon, 25 October 2010 16:11 Go to previous messageGo to next message
porto is currently offline  porto
Messages: 51
Registered: March 2007
Member
Delete this message, please

[Updated on: Tue, 26 October 2010 10:10]

Report message to a moderator

icon7.gif  Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29521 is a reply to message #29369] Tue, 26 October 2010 09:56 Go to previous messageGo to next message
porto is currently offline  porto
Messages: 51
Registered: March 2007
Member
I do not know why, but this dirty hack COMPLETELY eliminates this "issue":
void Ctrl::Create0(Ctrl::CreateBox *cr)
{
	GuiLock __;
	cr->exstyle = cr->exstyle | WS_EX_COMPOSITED;

[Updated on: Tue, 26 October 2010 12:39]

Report message to a moderator

Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29523 is a reply to message #29227] Tue, 26 October 2010 11:04 Go to previous messageGo to next message
porto is currently offline  porto
Messages: 51
Registered: March 2007
Member
But this is not the solution. Now it reduces a performance when I dragging any windows on top of UPP applications.
Partially solves my problem is forced set for each window CS_SAVEBITS style. But in this case, sometimes the "issue" is visible, for example, when TheIDE parses the source files when I open any project ...
I will dig further.

[Updated on: Tue, 26 October 2010 15:26]

Report message to a moderator

Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29534 is a reply to message #29369] Wed, 27 October 2010 14:56 Go to previous messageGo to next message
porto is currently offline  porto
Messages: 51
Registered: March 2007
Member
It seems a simple solution was found. In a method:
void Ctrl:: Create0 (Ctrl:: CreateBox * cr) (Win32Wnd.cpp)
Before showing the window, we add an extended style:
cr->exstyle = cr->exstyle | WS_EX_COMPOSITED;

After the window is shown, remove it:
::SetWindowLong(top->hwnd, GWL_EXSTYLE, cr->exstyle ^ WS_EX_COMPOSITED);

It would be nice before to check which version of Windows we have - do it if we have Windows XP or higher.

These simple changes fixed the problem, and the performance still the same.

Can I hope that someone of the developers will make these (or more correct than mine) changes to one of the following buids of UPP?

[Updated on: Wed, 27 October 2010 15:43]

Report message to a moderator

Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29539 is a reply to message #29534] Wed, 27 October 2010 19:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Hey, nice digging Smile It is sort of extreme workaround using some sideffect, but why not.

Do you have it as complete patch? I mean, where have you put

::SetWindowLong(top->hwnd, GWL_EXSTYLE, cr->exstyle ^ WS_EX_COMPOSITED);

?
Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29540 is a reply to message #29539] Wed, 27 October 2010 21:44 Go to previous messageGo to next message
porto is currently offline  porto
Messages: 51
Registered: March 2007
Member
I have put it after this line:
::ShowWindow(top->hwnd, visible ? cr->show : SW_HIDE);
Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29563 is a reply to message #29539] Sat, 30 October 2010 13:45 Go to previous messageGo to next message
porto is currently offline  porto
Messages: 51
Registered: March 2007
Member
There was found, I think, a good way to get away of this "issue" (the temporary addition to an extended style of windows a flag WS_EX_KOMPOSITED *) - but I want to find the reason of it.
Do not judge strictly an amateur in programming. Embarassed
After a series of experiments with MS Spy++ utility I made some conclusions, this "issue" has two causes:
1. Child windows of traditional Windows applications have a flag of style CS_SAVEBITS. Child windows of UPP apps, this style does not have (or have, but not all).
After the forced set of this flag to all windows, "issue" only occurs if UPP application is busy, for example when I opening a package in TheIDE or doing "Rescan Code".
2. If UPP app does not busy (idle) and it creates the child window, the parent window is not repainting. But if UPP app is busy and it creates the child window, in this case, for some reason is starting repainting of the parent window or region of it, and CS_SAVEBITS is no longer helps.
If in this case the parent window or region of it does not repaint and all the child windows would have a flag CS_SAVEBITS (like in traditional applications), then the "issue" would not appear (IMHO).
This was only my best guess, do not take very seriously. Rolling Eyes


* With WS_EX_COMPOSITED set, all descendants of a window get bottom-to-top painting order using double-buffering. Bottom-to-top painting order allows a descendent window to have translucency (alpha) and transparency (color-key) effects, but only if the descendent window also has the WS_EX_TRANSPARENT bit set. Double-buffering allows the window and its descendents to be painted without flicker.
Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29571 is a reply to message #29540] Mon, 01 November 2010 09:56 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
porto wrote on Wed, 27 October 2010 15:44

I have put it after this line:
::ShowWindow(top->hwnd, visible ? cr->show : SW_HIDE);


Lines have numbers. Files have names.

Is it so hard to cite the filename and the number of line? Smile

Eventually quoting couple of sourounding lines here (or the whole function, if that is not too big)?
Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29572 is a reply to message #29563] Mon, 01 November 2010 10:03 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
porto wrote on Sat, 30 October 2010 07:45

There was found, I think, a good way to get away of this "issue" (the temporary addition to an extended style of windows a flag WS_EX_KOMPOSITED *) - but I want to find the reason of it.
Do not judge strictly an amateur in programming. Embarassed
After a series of experiments with MS Spy++ utility I made some conclusions, this "issue" has two causes:
1. Child windows of traditional Windows applications have a flag of style CS_SAVEBITS. Child windows of UPP apps, this style does not have (or have, but not all).



I guess you have got the term "child window" wrong. CS_SAVEBITS is intended for popups.

Quote:


After the forced set of this flag to all windows, "issue" only occurs if UPP application is busy, for example when I opening a package in TheIDE or doing "Rescan Code".



For one thing, there are no child windows in U++... Smile (Except DHCtrl descendants, but that is a special case).

My guess is that WS_EX_COMPOSITED only helps accidentally - it changes repainting process of windows and as side-effect, the effect is gone. In the same time, it is not unlikely that this will still depend on actual windows version, graphics driver etc...
Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29573 is a reply to message #29571] Mon, 01 November 2010 10:21 Go to previous messageGo to next message
porto is currently offline  porto
Messages: 51
Registered: March 2007
Member
I made changes in file Wnd32Wnd.cpp, in method:
void Ctrl::Create0(Ctrl::CreateBox *cr) (begin at line 459)

Added lines are marked in bold:

void Ctrl::Create0(Ctrl::CreateBox *cr)
{
GuiLock __;
cr->exstyle = cr->exstyle | WS_EX_COMPOSITED;
... some code ...

::ShowWindow(top->hwnd, visible ? cr->show : SW_HIDE);
::SetWindowLong(top->hwnd, GWL_EXSTYLE, cr->exstyle ^ WS_EX_COMPOSITED);
... some code ...
}


I really want to find out the cause of this effect. So I want to ask you, if UPP apps windows need repainting some area, they are fully updated or update only the necessary area?


I have achieved the same effect in WinAPI application by locking update in underlying window by LockWindowUpdate():
   HWND hWnd, hWnd2;

   hInst = hInstance;

   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
   hWnd2 = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

   ShowWindow(hWnd, SW_MAXIMAZED);
   LockWindowUpdate(hWnd);
   ShowWindow(hWnd2, SW_NORMAL);
   Sleep(1000);


Without LockWindowUpdate() in this code the effect is gone.
My another suggestion (possibly incorrect again): in UPP apps for some reason MS Windows are not immediately sends WM_PAIN command to underlying windows.


I also tried to make the following changes: after the new window is shown, I just completely update the parent window. This is also a solution to the problem, but why Windows does not update a necessary area of parent window automatically not clear to me...

[Updated on: Mon, 01 November 2010 13:45]

Report message to a moderator

Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29608 is a reply to message #29572] Wed, 03 November 2010 17:07 Go to previous messageGo to next message
porto is currently offline  porto
Messages: 51
Registered: March 2007
Member
As I understood from the description in MSDN the flag of extended style "WS_EX_COMPOSITED" activates the double-buffering at the OS level (it's supported minimum in WinXP), so unlikely it will depend on the graphics card drivers. About making changes in UPP if you agree, I think the better off the flag after the full appearance of the window. About changes in UPP, if you agree, I think it's better to set off the flag after full window rendering instead after non client area rendering, it will give a smoother draw them.
You can make changes like that e.g., or more correctly: (added lines are marked in bold):
1. In file Wnd32Wnd.cpp, at begin of the method (line 459):
void Ctrl::Create0(Ctrl::CreateBox *cr)
{
cr->exstyle = cr->exstyle | WS_EX_COMPOSITED;
...some code...
}
2. In file TopWin32.cpp, at end of the method (line 173):
void TopWindow::Open(HWND hwnd)
{
...some code...
::SetWindowLong(hwnd, GWL_EXSTYLE, ::GetWindowLong(hwnd, GWL_EXSTYLE) ^ WS_EX_COMPOSITED);
}

[Updated on: Wed, 03 November 2010 17:08]

Report message to a moderator

Re: Question to UPP developers: the issue with windows rendering (Windows XP) [message #29624 is a reply to message #29573] Thu, 04 November 2010 14:27 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
porto wrote on Mon, 01 November 2010 05:21


I also tried to make the following changes: after the new window is shown, I just completely update the parent window. This is also a solution to the problem, but why Windows does not update a necessary area of parent window automatically not clear to me...



It does. Please note that everythings gets updated in the end, even when the effect is visible. What so much bothers you is the pause.

But all these things are affected by timing. Win32 simply sends some messages first, some others later, that is all. Accidentally, for U++ or IrfanView, with certain HW and system config, it means that messages required to repaint nonclient area of window are sent later.
Previous Topic: Style: DefaultInk / default
Next Topic: HotSpots usage HOWTO
Goto Forum:
  


Current Time: Tue Apr 16 21:05:42 CEST 2024

Total time taken to generate the page: 0.01540 seconds