wineps.drv: Keep track of all supported device resolutions.
Dmitry Timoshkov
dmitry at baikal.ru
Tue Dec 18 22:43:46 CST 2012
---
dlls/wineps.drv/driver.c | 22 +++++++++++++++-------
dlls/wineps.drv/ppd.c | 21 +++++++++++++++++++++
dlls/wineps.drv/psdrv.h | 8 ++++++++
3 files changed, 44 insertions(+), 7 deletions(-)
diff --git a/dlls/wineps.drv/driver.c b/dlls/wineps.drv/driver.c
index 70ee2b0..18be8e0 100644
--- a/dlls/wineps.drv/driver.c
+++ b/dlls/wineps.drv/driver.c
@@ -638,14 +638,22 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
case DC_ENUMRESOLUTIONS:
{
- LONG *lp = (LONG*)lpszOutput;
+ RESOLUTION *res;
+ LONG *lp = (LONG *)lpszOutput;
+ int i = 0;
- if(lpszOutput != NULL) {
- lp[0] = pi->ppd->DefaultResolution;
- lp[1] = pi->ppd->DefaultResolution;
- }
- ret = 1;
- break;
+ LIST_FOR_EACH_ENTRY(res, &pi->ppd->Resolutions, RESOLUTION, entry)
+ {
+ i++;
+ if (lpszOutput != NULL)
+ {
+ lp[0] = res->resx;
+ lp[1] = res->resy;
+ lp += 2;
+ }
+ }
+ ret = i;
+ break;
}
/* Windows returns 9999 too */
diff --git a/dlls/wineps.drv/ppd.c b/dlls/wineps.drv/ppd.c
index 1cba1b8..9d529b4 100644
--- a/dlls/wineps.drv/ppd.c
+++ b/dlls/wineps.drv/ppd.c
@@ -659,6 +659,7 @@ PPD *PSDRV_ParsePPD( char *fname, HANDLE printer )
ppd->ColorDevice = CD_NotSpecified;
+ list_init( &ppd->Resolutions );
list_init( &ppd->InstalledFonts );
list_init( &ppd->PageSizes );
list_init( &ppd->Constraints );
@@ -713,6 +714,26 @@ PPD *PSDRV_ParsePPD( char *fname, HANDLE printer )
WARN("failed to parse DefaultResolution %s\n", debugstr_a(tuple.value));
}
+ else if(!strcmp("*Resolution", tuple.key))
+ {
+ SIZE sz;
+ if (parse_resolution(tuple.option, &sz))
+ {
+ RESOLUTION *res;
+
+ TRACE("Resolution %dx%d, invocation %s\n", sz.cx, sz.cy, tuple.value);
+
+ res = HeapAlloc( GetProcessHeap(), 0, sizeof(*res) );
+ res->resx = sz.cx;
+ res->resy = sz.cy;
+ res->InvocationString = tuple.value;
+ tuple.value = NULL;
+ list_add_tail( &ppd->Resolutions, &res->entry );
+ }
+ else
+ WARN("failed to parse Resolution %s\n", debugstr_a(tuple.option));
+ }
+
else if(!strcmp("*Font", tuple.key))
{
FONTNAME *fn = HeapAlloc( PSDRV_Heap, 0, sizeof(*fn) );
diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h
index 428f7ba..12ce526 100644
--- a/dlls/wineps.drv/psdrv.h
+++ b/dlls/wineps.drv/psdrv.h
@@ -183,6 +183,13 @@ typedef struct
WORD WinDuplex; /* eg DMDUP_SIMPLEX */
} DUPLEX;
+typedef struct
+{
+ struct list entry;
+ int resx, resy;
+ char *InvocationString;
+} RESOLUTION;
+
/* Many Mac OS X based ppd files don't include a *ColorDevice line, so
we use a tristate here rather than a boolean. Code that
cares is expected to treat these as if they were colour. */
@@ -196,6 +203,7 @@ typedef struct {
char *NickName;
int LanguageLevel;
COLORDEVICE ColorDevice;
+ struct list Resolutions;
int DefaultResolution;
signed int LandscapeOrientation;
char *JCLBegin;
--
1.8.0.2
More information about the wine-patches
mailing list