I wonder if we shouldn't add a "<dpiAware>true</dpiAware>" to our manifest
or call SetProcessDPIAware() in wxMSW startup code as hopefully wx apps
should indeed be "DPI aware", i.e. work with different/higher than default
DPI. Has anyone already tested doing this by chance? If so, did this result
in any problems?
Thanks,
VZ
MSDN recommends against this. Plus, it would be the wrong thing to do
when using wx in extensions loaded into host processes (WinSparkle,
plugins, ...).
Vaclav
VS> On Fri, 2010-03-12 at 10:10 +0100, Vadim Zeitlin wrote:
VS> > or call SetProcessDPIAware()
VS>
VS> MSDN recommends against this.
It does but I don't understand their explanation (what race condition?) so
I don't know why exactly shouldn't we do this.
VS> Plus, it would be the wrong thing to do when using wx in extensions
VS> loaded into host processes (WinSparkle, plugins, ...).
This is a good point though. However if we call it from IMPLEMENT_APP (but
not IMPLEMENT_APP_NO_MAIN), i.e. from application entry point only, it
should address this problem, shouldn't it?
Regards,
VZ
As they say, if something caches the value at startup. "Race condition"
is misnomer.
Anyway, using manifest is the recommended solution, so why not do it?
IOW, what benefit does doing it in code have? I don't see any.
Another advantage to keeping it in the manifest: if the wx-using app
itself is not DPI aware (say, because of some custom drawing code), then
it can be fixed by modifying the manifest, without having to patch wx
source code.
> This is a good point though. However if we call it from IMPLEMENT_APP (but
> not IMPLEMENT_APP_NO_MAIN), i.e. from application entry point only, it
> should address this problem, shouldn't it?
Yes, but see above.
Vaclav
VS> Anyway, using manifest is the recommended solution, so why not do it?
Because our manifest is used with very few compilers. In fact I think it's
only used with VC7 as other compilers don't support manifests and later
versions of VC use the manifest generated by the compiler.
VS> Another advantage to keeping it in the manifest: if the wx-using app
VS> itself is not DPI aware (say, because of some custom drawing code), then
VS> it can be fixed by modifying the manifest, without having to patch wx
VS> source code.
VS>
VS> > This is a good point though. However if we call it from IMPLEMENT_APP (but
VS> > not IMPLEMENT_APP_NO_MAIN), i.e. from application entry point only, it
VS> > should address this problem, shouldn't it?
VS>
VS> Yes, but see above.
Presumably we could have some wxApp::MSWDisableDPIAware() or something
like this if the need really arises...
Regards,
VZ
Are you sure? An executable *must* have a manifest to be able to use
Common Controls 6...
> other compilers don't support manifests
It's just a resource item, any resource compiler supports them, VC just
adds friendlier UI for them.
Vaclav
VS> On Fri, 2010-03-12 at 12:55 +0100, Vadim Zeitlin wrote:
VS> > Because our manifest is used with very few compilers.
VS>
VS> Are you sure?
I'm sure that we don't use our manifest with VC8+ as the compiler
generates one itself. But while in VC10 you can check the "DPI aware"
option in the manifest options page, you don't have it in VC[89]. And even
with VC10 you need to know about it and remember to do it. Which is an
extra burden I'd like to avoid.
VS> > other compilers don't support manifests
VS>
VS> It's just a resource item, any resource compiler supports them, VC just
VS> adds friendlier UI for them.
Yes, you're right, the other compilers should be fine. But the problem
still remains for VC8+... I guess the official way to fix it for VC10 would
be to provide a .props file for wx which would define this option. But I
don't know how does it work exactly and this still wouldn't work for 8 and
9. So you probably start seeing why I prefer to just call a function...
Regards,
VZ
VC8 and VC9 get the appropriate code in their manifest files due to
this section of wx/defs.h:
#if (!defined wxUSE_NO_MANIFEST || wxUSE_NO_MANIFEST == 0 ) && \
( defined _MSC_FULL_VER && _MSC_FULL_VER >= 140040130 )
#define WX_CC_MANIFEST(cpu) \
"/manifestdependency:\"type='win32' \
name='Microsoft.Windows.Common-Controls' \
version='6.0.0.0' \
processorArchitecture='"cpu"' \
publicKeyToken='6595b64144ccf1df' \
language='*'\""
#if defined _M_IX86
#pragma comment(linker, WX_CC_MANIFEST("x86"))
#elif defined _M_X64
#pragma comment(linker, WX_CC_MANIFEST("amd64"))
#elif defined _M_IA64
#pragma comment(linker, WX_CC_MANIFEST("ia64"))
#else
#pragma comment(linker, WX_CC_MANIFEST("*"))
#endif
#endif /* !wxUSE_NO_MANIFEST && _MSC_FULL_VER >= 140040130 */
Other compilers get the entire manifest from this bit in wx.rc:
// Visual Studio 2005 generates the manifest automatically and so we
// shouldn't include it in the resources manually:
#if !defined(WX_MSC_FULL_VER) || WX_MSC_FULL_VER < 140040130
// see "about isolated applications" topic in MSDN
#ifdef ISOLATION_AWARE_ENABLED
#define wxMANIFEST_ID 2
#else
#define wxMANIFEST_ID 1
#endif
#if defined(WX_CPU_AMD64)
wxMANIFEST_ID 24 "wx/msw/amd64.manifest"
#elif defined(WX_CPU_IA64)
wxMANIFEST_ID 24 "wx/msw/ia64.manifest"
#elif defined(WX_CPU_X86)
wxMANIFEST_ID 24 "wx/msw/wx.manifest"
#endif
#endif // !defined(WX_MSC_FULL_VER) || WX_MSC_FULL_VER < 140040130
VC9 (and maybe VC8, but I don't have a copy on-hand) has a project
property "Additional Manifest Files" for listing "additional user
manifest fragment files to merge into the manifest", which looks like
a good way to add stuff to the compiler-generated manifest, but it
seems that there is no way to automatically set that setting from a
#pragma or similar directive.
To (finally) answer your question, Poedit seems to work just fine when
compiled as "DPI aware".
Vaclav