wxWinCE reports incorrect screensize...
-
- I live to help wx-kind
- Posts: 153
- Joined: Fri Feb 11, 2005 9:05 am
- Location: Stockholm, Sweden
wxWinCE reports incorrect screensize...
I'm playing around with my HTC Touch HD with a screensize of 480x800 pixels. It has Windows mobile 6.1. The SDK from Microsoft provide a close approximation of the device at the same screen resolution.
Using wxWidgets 2.8.9 and wxWince I'm doing a trivial Hello World with the sole purpose of printing the screen resolution on the window.
The problem is, that for a screen of that size, the reported resolution (reported by Windows itself) is just half of the actual truth, i.e 240x400 !
Creating the same program in native Win32, reports the correct resolution.
Further more, in wxWince, when splashing a bitmap to the screen, everything gets "blown up" a factor 2.
Oh, please help me, I woudn't want to go over to Win32, when I got wxWidgets.
PS. When running the program under a device/emulator with a small screen, it gets reported correctly.
Using wxWidgets 2.8.9 and wxWince I'm doing a trivial Hello World with the sole purpose of printing the screen resolution on the window.
The problem is, that for a screen of that size, the reported resolution (reported by Windows itself) is just half of the actual truth, i.e 240x400 !
Creating the same program in native Win32, reports the correct resolution.
Further more, in wxWince, when splashing a bitmap to the screen, everything gets "blown up" a factor 2.
Oh, please help me, I woudn't want to go over to Win32, when I got wxWidgets.
PS. When running the program under a device/emulator with a small screen, it gets reported correctly.
Last edited by acsMike on Sat Jan 10, 2009 8:25 am, edited 1 time in total.
/Michael Ljunggren, developer
Peavey Electronics
Windows: 2.6.3, 2.8.9 (VS2005) ** Mac: 2.6.3 (XCode 3) ** WinCE: 2.8.9 (VS2005), ** GTK: 2.8.9 (Kdevelop)
Peavey Electronics
Windows: 2.6.3, 2.8.9 (VS2005) ** Mac: 2.6.3 (XCode 3) ** WinCE: 2.8.9 (VS2005), ** GTK: 2.8.9 (Kdevelop)
-
- Experienced Solver
- Posts: 70
- Joined: Fri Nov 07, 2008 4:25 pm
- Location: Saint-Petersburg, Russia
-
- I live to help wx-kind
- Posts: 153
- Joined: Fri Feb 11, 2005 9:05 am
- Location: Stockholm, Sweden
All of them, so to speakradcapricorn wrote:What code do you use to fetch screen dimensions?
In wxWidgets I use wxSystemSettings::GetMetric(wxSYS_SCREEN_X) which is mapped to the Win32 call ::GetSystemMetrics.
But even trying the Win32 call ::GetDeviceCaps yields an incorrect answer.
I also tried the Win32 call ::GetClientRect(::GetDesktopWindow, &Rect); Same thing.
Now you might think that "maybe the screen actually has that size..." but no. It is a 480x800. The thing is that making the same calls from a native Win32 program yields the correct results! I suspect that wxWidgets do something to Windows that makes it in turn report the numbers incorrectly.
Also, the same thing happens with the real device and on the emulator.
/Michael Ljunggren, developer
Peavey Electronics
Windows: 2.6.3, 2.8.9 (VS2005) ** Mac: 2.6.3 (XCode 3) ** WinCE: 2.8.9 (VS2005), ** GTK: 2.8.9 (Kdevelop)
Peavey Electronics
Windows: 2.6.3, 2.8.9 (VS2005) ** Mac: 2.6.3 (XCode 3) ** WinCE: 2.8.9 (VS2005), ** GTK: 2.8.9 (Kdevelop)
-
- Experienced Solver
- Posts: 70
- Joined: Fri Nov 07, 2008 4:25 pm
- Location: Saint-Petersburg, Russia
-
- Experienced Solver
- Posts: 70
- Joined: Fri Nov 07, 2008 4:25 pm
- Location: Saint-Petersburg, Russia
Follow-up:
I'm not really sure about problem origin right now, need to get home and look into it in more detail, but this just came up in mind:
Are you using correct preprocessor directives for your platform? I mean, __POCKETPC__, __SMARTPHONE__, __HANDHELDPC__, so on?..
I'm not really sure about problem origin right now, need to get home and look into it in more detail, but this just came up in mind:
Are you using correct preprocessor directives for your platform? I mean, __POCKETPC__, __SMARTPHONE__, __HANDHELDPC__, so on?..
win xp pro sp3/VS Express 2008/MinGW;
win Vista Ultimate/VS 2005;
Debian Lenny/gcc/cegcc-mingw32ce;
wxWidgets-2.8.9 w/wxWinCE;
win Vista Ultimate/VS 2005;
Debian Lenny/gcc/cegcc-mingw32ce;
wxWidgets-2.8.9 w/wxWinCE;
-
- I live to help wx-kind
- Posts: 153
- Joined: Fri Feb 11, 2005 9:05 am
- Location: Stockholm, Sweden
I'm using the standard wxWidgets samples. I'm guessing...(?) there is nothing in setup.h I need to set manually?radcapricorn wrote:Follow-up:
I'm not really sure about problem origin right now, need to get home and look into it in more detail, but this just came up in mind:
Are you using correct preprocessor directives for your platform? I mean, __POCKETPC__, __SMARTPHONE__, __HANDHELDPC__, so on?..
/Michael Ljunggren, developer
Peavey Electronics
Windows: 2.6.3, 2.8.9 (VS2005) ** Mac: 2.6.3 (XCode 3) ** WinCE: 2.8.9 (VS2005), ** GTK: 2.8.9 (Kdevelop)
Peavey Electronics
Windows: 2.6.3, 2.8.9 (VS2005) ** Mac: 2.6.3 (XCode 3) ** WinCE: 2.8.9 (VS2005), ** GTK: 2.8.9 (Kdevelop)
-
- Experienced Solver
- Posts: 70
- Joined: Fri Nov 07, 2008 4:25 pm
- Location: Saint-Petersburg, Russia
It's not related to wxWidgets, it's compiler/SDK feature. Well, if you're using Visual Studio with appropriate SDK selected, it defines those for you. But I suggest you doublecheck your build command line to see what gets defined and if it's really appropriate for the platform you build for. Especially that concerns build command line when you build wxWinCE itself, because it should be built for the same platform (PocketPC, Smartphone or Handheld) you intend to build applications for. Otherwise you may get some strange looks/issues when you compile and run your software.
win xp pro sp3/VS Express 2008/MinGW;
win Vista Ultimate/VS 2005;
Debian Lenny/gcc/cegcc-mingw32ce;
wxWidgets-2.8.9 w/wxWinCE;
win Vista Ultimate/VS 2005;
Debian Lenny/gcc/cegcc-mingw32ce;
wxWidgets-2.8.9 w/wxWinCE;
-
- I live to help wx-kind
- Posts: 153
- Joined: Fri Feb 11, 2005 9:05 am
- Location: Stockholm, Sweden
After double checking, it appear that all defines are proper = __WXPOCKETPC__ which I'm targeting.radcapricorn wrote:It's not related to wxWidgets, it's compiler/SDK feature. Well, if you're using Visual Studio with appropriate SDK selected, it defines those for you. But I suggest you doublecheck your build command line to see what gets defined and if it's really appropriate for the platform you build for. Especially that concerns build command line when you build wxWinCE itself, because it should be built for the same platform (PocketPC, Smartphone or Handheld) you intend to build applications for. Otherwise you may get some strange looks/issues when you compile and run your software.
Thanks for all your help. I really appreciate you taking the time. Have you had an opportunity to develop for an 800x480 device?
/Michael Ljunggren, developer
Peavey Electronics
Windows: 2.6.3, 2.8.9 (VS2005) ** Mac: 2.6.3 (XCode 3) ** WinCE: 2.8.9 (VS2005), ** GTK: 2.8.9 (Kdevelop)
Peavey Electronics
Windows: 2.6.3, 2.8.9 (VS2005) ** Mac: 2.6.3 (XCode 3) ** WinCE: 2.8.9 (VS2005), ** GTK: 2.8.9 (Kdevelop)
-
- Experienced Solver
- Posts: 70
- Joined: Fri Nov 07, 2008 4:25 pm
- Location: Saint-Petersburg, Russia
Well, there wasn't really targeted development for those devices, but I used to play some of my apps on those and they seemed to run OK. Actually, all my WinCE projects are currently hobby ones (and not all of them are built with wxWinCE).
...Well, I guess then that your defines are all right (though I meant not wx defines but platform ones, but anyway the former gets declared after the latter, so it seems it's OK with them). I'll try and wipe some dust from my old code and see if this kind of problem shows up or not, but I regret that'd be only by the weekend.
...Well, I guess then that your defines are all right (though I meant not wx defines but platform ones, but anyway the former gets declared after the latter, so it seems it's OK with them). I'll try and wipe some dust from my old code and see if this kind of problem shows up or not, but I regret that'd be only by the weekend.
win xp pro sp3/VS Express 2008/MinGW;
win Vista Ultimate/VS 2005;
Debian Lenny/gcc/cegcc-mingw32ce;
wxWidgets-2.8.9 w/wxWinCE;
win Vista Ultimate/VS 2005;
Debian Lenny/gcc/cegcc-mingw32ce;
wxWidgets-2.8.9 w/wxWinCE;
-
- I live to help wx-kind
- Posts: 153
- Joined: Fri Feb 11, 2005 9:05 am
- Location: Stockholm, Sweden
I'd like to point out, that knowing the screen size is not as important as blitting bitmaps correctly on screen. Every access to the screen maps one (software) pixel to 2x2 (hardware) pixels on screen, so everything gets large and blocky.
I'm baffled by the behavior and I have only encountered this when running on large screens. Smaller screens runs fine. It's almost like there's a line somewhere in wx which says
I'm baffled by the behavior and I have only encountered this when running on large screens. Smaller screens runs fine. It's almost like there's a line somewhere in wx which says
Code: Select all
if (pocketpc && screen == huge)
{
// Unrealistic, correct
scaleupeverying(2);
}
/Michael Ljunggren, developer
Peavey Electronics
Windows: 2.6.3, 2.8.9 (VS2005) ** Mac: 2.6.3 (XCode 3) ** WinCE: 2.8.9 (VS2005), ** GTK: 2.8.9 (Kdevelop)
Peavey Electronics
Windows: 2.6.3, 2.8.9 (VS2005) ** Mac: 2.6.3 (XCode 3) ** WinCE: 2.8.9 (VS2005), ** GTK: 2.8.9 (Kdevelop)
-
- Experienced Solver
- Posts: 70
- Joined: Fri Nov 07, 2008 4:25 pm
- Location: Saint-Petersburg, Russia
-
- Experienced Solver
- Posts: 70
- Joined: Fri Nov 07, 2008 4:25 pm
- Location: Saint-Petersburg, Russia
You know, I've just found one of my old wxWinCE test apps here and made a quick test that displays a message box with values got from wxDisplaySize()... It reports correct size for QVGA (240x320), VGA (480x640) and Square VGA (480x480) emulators and also on 480x800 device (some Toshiba, don't know the model exactly, it's my friend's device). I haven't tried images because I don't have wx's image handling libs built here.
My wxWinCE is built from 2.8.9 release tree.
Maybe there's something with how you build wxWinCE?
My wxWinCE is built from 2.8.9 release tree.
Maybe there's something with how you build wxWinCE?
win xp pro sp3/VS Express 2008/MinGW;
win Vista Ultimate/VS 2005;
Debian Lenny/gcc/cegcc-mingw32ce;
wxWidgets-2.8.9 w/wxWinCE;
win Vista Ultimate/VS 2005;
Debian Lenny/gcc/cegcc-mingw32ce;
wxWidgets-2.8.9 w/wxWinCE;
-
- I live to help wx-kind
- Posts: 153
- Joined: Fri Feb 11, 2005 9:05 am
- Location: Stockholm, Sweden
I found it! It was apparently a link argument. Instead of supplying the Additional Options:radcapricorn wrote:You know, I've just found one of my old wxWinCE test apps here and made a quick test that displays a message box with values got from wxDisplaySize()... It reports correct size for QVGA (240x320), VGA (480x640) and Square VGA (480x480) emulators and also on 480x800 device (some Toshiba, don't know the model exactly, it's my friend's device). I haven't tried images because I don't have wx's image handling libs built here.
My wxWinCE is built from 2.8.9 release tree.
Maybe there's something with how you build wxWinCE?
Code: Select all
/ALIGN:4096 /subsystem:windowsce /MACHINE:ARM
Code: Select all
/ALIGN:4096 /subsystem:windowsce,5.01 /MACHINE:ARM
Thanks for your help radcapricorn.
/Michael Ljunggren, developer
Peavey Electronics
Windows: 2.6.3, 2.8.9 (VS2005) ** Mac: 2.6.3 (XCode 3) ** WinCE: 2.8.9 (VS2005), ** GTK: 2.8.9 (Kdevelop)
Peavey Electronics
Windows: 2.6.3, 2.8.9 (VS2005) ** Mac: 2.6.3 (XCode 3) ** WinCE: 2.8.9 (VS2005), ** GTK: 2.8.9 (Kdevelop)
-
- Experienced Solver
- Posts: 70
- Joined: Fri Nov 07, 2008 4:25 pm
- Location: Saint-Petersburg, Russia