wineps: Build with nameless structs and unions.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-12-06 09:58:11 +00:00 committed by Alexandre Julliard
parent 62e0f51e6e
commit 78bd41afb3
3 changed files with 68 additions and 83 deletions

View File

@ -22,9 +22,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
@ -53,7 +50,7 @@ INPUTSLOT *find_slot( PPD *ppd, const PSDRV_DEVMODE *dm )
INPUTSLOT *slot; INPUTSLOT *slot;
LIST_FOR_EACH_ENTRY( slot, &ppd->InputSlots, INPUTSLOT, entry ) LIST_FOR_EACH_ENTRY( slot, &ppd->InputSlots, INPUTSLOT, entry )
if (slot->WinBin == dm->dmPublic.u1.s1.dmDefaultSource) if (slot->WinBin == dm->dmPublic.dmDefaultSource)
return slot; return slot;
return NULL; return NULL;
@ -64,7 +61,7 @@ PAGESIZE *find_pagesize( PPD *ppd, const PSDRV_DEVMODE *dm )
PAGESIZE *page; PAGESIZE *page;
LIST_FOR_EACH_ENTRY( page, &ppd->PageSizes, PAGESIZE, entry ) LIST_FOR_EACH_ENTRY( page, &ppd->PageSizes, PAGESIZE, entry )
if (page->WinPage == dm->dmPublic.u1.s1.dmPaperSize) if (page->WinPage == dm->dmPublic.dmPaperSize)
return page; return page;
return NULL; return NULL;
@ -96,12 +93,12 @@ void PSDRV_MergeDevmodes( PSDRV_DEVMODE *dm1, const PSDRV_DEVMODE *dm2, PRINTERI
/* some sanity checks here on dm2 */ /* some sanity checks here on dm2 */
if(dm2->dmPublic.dmFields & DM_ORIENTATION) { if(dm2->dmPublic.dmFields & DM_ORIENTATION) {
dm1->dmPublic.u1.s1.dmOrientation = dm2->dmPublic.u1.s1.dmOrientation; dm1->dmPublic.dmOrientation = dm2->dmPublic.dmOrientation;
TRACE("Changing orientation to %d (%s)\n", TRACE("Changing orientation to %d (%s)\n",
dm1->dmPublic.u1.s1.dmOrientation, dm1->dmPublic.dmOrientation,
dm1->dmPublic.u1.s1.dmOrientation == DMORIENT_PORTRAIT ? dm1->dmPublic.dmOrientation == DMORIENT_PORTRAIT ?
"Portrait" : "Portrait" :
(dm1->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE ? (dm1->dmPublic.dmOrientation == DMORIENT_LANDSCAPE ?
"Landscape" : "unknown")); "Landscape" : "unknown"));
} }
@ -112,13 +109,13 @@ void PSDRV_MergeDevmodes( PSDRV_DEVMODE *dm1, const PSDRV_DEVMODE *dm2, PRINTERI
if (page) if (page)
{ {
dm1->dmPublic.u1.s1.dmPaperSize = dm2->dmPublic.u1.s1.dmPaperSize; dm1->dmPublic.dmPaperSize = dm2->dmPublic.dmPaperSize;
dm1->dmPublic.u1.s1.dmPaperWidth = paper_size_from_points( page->PaperDimension->x ); dm1->dmPublic.dmPaperWidth = paper_size_from_points( page->PaperDimension->x );
dm1->dmPublic.u1.s1.dmPaperLength = paper_size_from_points( page->PaperDimension->y ); dm1->dmPublic.dmPaperLength = paper_size_from_points( page->PaperDimension->y );
dm1->dmPublic.dmFields |= DM_PAPERSIZE | DM_PAPERWIDTH | DM_PAPERLENGTH; dm1->dmPublic.dmFields |= DM_PAPERSIZE | DM_PAPERWIDTH | DM_PAPERLENGTH;
TRACE("Changing page to %s %d x %d\n", page->FullName, TRACE("Changing page to %s %d x %d\n", page->FullName,
dm1->dmPublic.u1.s1.dmPaperWidth, dm1->dmPublic.dmPaperWidth,
dm1->dmPublic.u1.s1.dmPaperLength ); dm1->dmPublic.dmPaperLength );
if (dm1->dmPublic.dmSize >= FIELD_OFFSET(DEVMODEW, dmFormName) + CCHFORMNAME * sizeof(WCHAR)) if (dm1->dmPublic.dmSize >= FIELD_OFFSET(DEVMODEW, dmFormName) + CCHFORMNAME * sizeof(WCHAR))
{ {
@ -127,16 +124,16 @@ void PSDRV_MergeDevmodes( PSDRV_DEVMODE *dm1, const PSDRV_DEVMODE *dm2, PRINTERI
} }
} }
else else
TRACE("Trying to change to unsupported pagesize %d\n", dm2->dmPublic.u1.s1.dmPaperSize); TRACE("Trying to change to unsupported pagesize %d\n", dm2->dmPublic.dmPaperSize);
} }
else if((dm2->dmPublic.dmFields & DM_PAPERLENGTH) && else if((dm2->dmPublic.dmFields & DM_PAPERLENGTH) &&
(dm2->dmPublic.dmFields & DM_PAPERWIDTH)) { (dm2->dmPublic.dmFields & DM_PAPERWIDTH)) {
dm1->dmPublic.u1.s1.dmPaperLength = dm2->dmPublic.u1.s1.dmPaperLength; dm1->dmPublic.dmPaperLength = dm2->dmPublic.dmPaperLength;
dm1->dmPublic.u1.s1.dmPaperWidth = dm2->dmPublic.u1.s1.dmPaperWidth; dm1->dmPublic.dmPaperWidth = dm2->dmPublic.dmPaperWidth;
TRACE("Changing PaperLength|Width to %dx%d\n", TRACE("Changing PaperLength|Width to %dx%d\n",
dm2->dmPublic.u1.s1.dmPaperLength, dm2->dmPublic.dmPaperLength,
dm2->dmPublic.u1.s1.dmPaperWidth); dm2->dmPublic.dmPaperWidth);
dm1->dmPublic.dmFields &= ~DM_PAPERSIZE; dm1->dmPublic.dmFields &= ~DM_PAPERSIZE;
dm1->dmPublic.dmFields |= (DM_PAPERLENGTH | DM_PAPERWIDTH); dm1->dmPublic.dmFields |= (DM_PAPERLENGTH | DM_PAPERWIDTH);
} else if(dm2->dmPublic.dmFields & (DM_PAPERLENGTH | DM_PAPERWIDTH)) { } else if(dm2->dmPublic.dmFields & (DM_PAPERLENGTH | DM_PAPERWIDTH)) {
@ -149,13 +146,13 @@ void PSDRV_MergeDevmodes( PSDRV_DEVMODE *dm1, const PSDRV_DEVMODE *dm2, PRINTERI
} }
if(dm2->dmPublic.dmFields & DM_SCALE) { if(dm2->dmPublic.dmFields & DM_SCALE) {
dm1->dmPublic.u1.s1.dmScale = dm2->dmPublic.u1.s1.dmScale; dm1->dmPublic.dmScale = dm2->dmPublic.dmScale;
TRACE("Changing Scale to %d\n", dm2->dmPublic.u1.s1.dmScale); TRACE("Changing Scale to %d\n", dm2->dmPublic.dmScale);
} }
if(dm2->dmPublic.dmFields & DM_COPIES) { if(dm2->dmPublic.dmFields & DM_COPIES) {
dm1->dmPublic.u1.s1.dmCopies = dm2->dmPublic.u1.s1.dmCopies; dm1->dmPublic.dmCopies = dm2->dmPublic.dmCopies;
TRACE("Changing Copies to %d\n", dm2->dmPublic.u1.s1.dmCopies); TRACE("Changing Copies to %d\n", dm2->dmPublic.dmCopies);
} }
if (dm2->dmPublic.dmFields & DM_DEFAULTSOURCE) if (dm2->dmPublic.dmFields & DM_DEFAULTSOURCE)
@ -164,17 +161,17 @@ void PSDRV_MergeDevmodes( PSDRV_DEVMODE *dm1, const PSDRV_DEVMODE *dm2, PRINTERI
if (slot) if (slot)
{ {
dm1->dmPublic.u1.s1.dmDefaultSource = dm2->dmPublic.u1.s1.dmDefaultSource; dm1->dmPublic.dmDefaultSource = dm2->dmPublic.dmDefaultSource;
TRACE("Changing bin to '%s'\n", slot->FullName); TRACE("Changing bin to '%s'\n", slot->FullName);
} }
else else
TRACE("Trying to change to unsupported bin %d\n", dm2->dmPublic.u1.s1.dmDefaultSource); TRACE("Trying to change to unsupported bin %d\n", dm2->dmPublic.dmDefaultSource);
} }
if (dm2->dmPublic.dmFields & DM_DEFAULTSOURCE ) if (dm2->dmPublic.dmFields & DM_DEFAULTSOURCE )
dm1->dmPublic.u1.s1.dmDefaultSource = dm2->dmPublic.u1.s1.dmDefaultSource; dm1->dmPublic.dmDefaultSource = dm2->dmPublic.dmDefaultSource;
if (dm2->dmPublic.dmFields & DM_PRINTQUALITY ) if (dm2->dmPublic.dmFields & DM_PRINTQUALITY )
dm1->dmPublic.u1.s1.dmPrintQuality = dm2->dmPublic.u1.s1.dmPrintQuality; dm1->dmPublic.dmPrintQuality = dm2->dmPublic.dmPrintQuality;
if (dm2->dmPublic.dmFields & DM_COLOR ) if (dm2->dmPublic.dmFields & DM_COLOR )
dm1->dmPublic.dmColor = dm2->dmPublic.dmColor; dm1->dmPublic.dmColor = dm2->dmPublic.dmColor;
if (dm2->dmPublic.dmFields & DM_DUPLEX && pi->ppd->DefaultDuplex && pi->ppd->DefaultDuplex->WinDuplex != 0) if (dm2->dmPublic.dmFields & DM_DUPLEX && pi->ppd->DefaultDuplex && pi->ppd->DefaultDuplex->WinDuplex != 0)
@ -194,11 +191,11 @@ void PSDRV_MergeDevmodes( PSDRV_DEVMODE *dm1, const PSDRV_DEVMODE *dm2, PRINTERI
if (dm2->dmPublic.dmFields & DM_PELSHEIGHT ) if (dm2->dmPublic.dmFields & DM_PELSHEIGHT )
dm1->dmPublic.dmPelsHeight = dm2->dmPublic.dmPelsHeight; dm1->dmPublic.dmPelsHeight = dm2->dmPublic.dmPelsHeight;
if (dm2->dmPublic.dmFields & DM_DISPLAYFLAGS ) if (dm2->dmPublic.dmFields & DM_DISPLAYFLAGS )
dm1->dmPublic.u2.dmDisplayFlags = dm2->dmPublic.u2.dmDisplayFlags; dm1->dmPublic.dmDisplayFlags = dm2->dmPublic.dmDisplayFlags;
if (dm2->dmPublic.dmFields & DM_DISPLAYFREQUENCY ) if (dm2->dmPublic.dmFields & DM_DISPLAYFREQUENCY )
dm1->dmPublic.dmDisplayFrequency = dm2->dmPublic.dmDisplayFrequency; dm1->dmPublic.dmDisplayFrequency = dm2->dmPublic.dmDisplayFrequency;
if (dm2->dmPublic.dmFields & DM_POSITION ) if (dm2->dmPublic.dmFields & DM_POSITION )
dm1->dmPublic.u1.s2.dmPosition = dm2->dmPublic.u1.s2.dmPosition; dm1->dmPublic.dmPosition = dm2->dmPublic.dmPosition;
if (dm2->dmPublic.dmFields & DM_LOGPIXELS ) if (dm2->dmPublic.dmFields & DM_LOGPIXELS )
dm1->dmPublic.dmLogPixels = dm2->dmPublic.dmLogPixels; dm1->dmPublic.dmLogPixels = dm2->dmPublic.dmLogPixels;
if (dm2->dmPublic.dmFields & DM_ICMMETHOD ) if (dm2->dmPublic.dmFields & DM_ICMMETHOD )
@ -247,14 +244,14 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
LIST_FOR_EACH_ENTRY(ps, &di->pi->ppd->PageSizes, PAGESIZE, entry) { LIST_FOR_EACH_ENTRY(ps, &di->pi->ppd->PageSizes, PAGESIZE, entry) {
SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_INSERTSTRING, i, SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_INSERTSTRING, i,
(LPARAM)ps->FullName); (LPARAM)ps->FullName);
if(di->pi->Devmode->dmPublic.u1.s1.dmPaperSize == ps->WinPage) if(di->pi->Devmode->dmPublic.dmPaperSize == ps->WinPage)
Cursel = i; Cursel = i;
i++; i++;
} }
SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_SETCURSEL, Cursel, 0); SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_SETCURSEL, Cursel, 0);
CheckRadioButton(hwnd, IDD_ORIENT_PORTRAIT, IDD_ORIENT_LANDSCAPE, CheckRadioButton(hwnd, IDD_ORIENT_PORTRAIT, IDD_ORIENT_LANDSCAPE,
di->pi->Devmode->dmPublic.u1.s1.dmOrientation == di->pi->Devmode->dmPublic.dmOrientation ==
DMORIENT_PORTRAIT ? IDD_ORIENT_PORTRAIT : DMORIENT_PORTRAIT ? IDD_ORIENT_PORTRAIT :
IDD_ORIENT_LANDSCAPE); IDD_ORIENT_LANDSCAPE);
@ -298,7 +295,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
resx = resy = di->pi->ppd->DefaultResolution; resx = resy = di->pi->ppd->DefaultResolution;
if (di->pi->Devmode->dmPublic.dmFields & DM_PRINTQUALITY) if (di->pi->Devmode->dmPublic.dmFields & DM_PRINTQUALITY)
resx = resy = di->pi->Devmode->dmPublic.u1.s1.dmPrintQuality; resx = resy = di->pi->Devmode->dmPublic.dmPrintQuality;
if (di->pi->Devmode->dmPublic.dmFields & DM_YRESOLUTION) if (di->pi->Devmode->dmPublic.dmFields & DM_YRESOLUTION)
resy = di->pi->Devmode->dmPublic.dmYResolution; resy = di->pi->Devmode->dmPublic.dmYResolution;
@ -342,11 +339,11 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
} }
TRACE("Setting pagesize to item %d, WinPage %d (%s), PaperSize %.2fx%.2f\n", Cursel, TRACE("Setting pagesize to item %d, WinPage %d (%s), PaperSize %.2fx%.2f\n", Cursel,
ps->WinPage, ps->FullName, ps->PaperDimension->x, ps->PaperDimension->y); ps->WinPage, ps->FullName, ps->PaperDimension->x, ps->PaperDimension->y);
di->dlgdm->dmPublic.u1.s1.dmPaperSize = ps->WinPage; di->dlgdm->dmPublic.dmPaperSize = ps->WinPage;
di->dlgdm->dmPublic.dmFields |= DM_PAPERSIZE; di->dlgdm->dmPublic.dmFields |= DM_PAPERSIZE;
di->dlgdm->dmPublic.u1.s1.dmPaperWidth = paper_size_from_points(ps->PaperDimension->x); di->dlgdm->dmPublic.dmPaperWidth = paper_size_from_points(ps->PaperDimension->x);
di->dlgdm->dmPublic.u1.s1.dmPaperLength = paper_size_from_points(ps->PaperDimension->y); di->dlgdm->dmPublic.dmPaperLength = paper_size_from_points(ps->PaperDimension->y);
di->dlgdm->dmPublic.dmFields |= DM_PAPERLENGTH | DM_PAPERWIDTH; di->dlgdm->dmPublic.dmFields |= DM_PAPERLENGTH | DM_PAPERWIDTH;
if (di->dlgdm->dmPublic.dmSize >= FIELD_OFFSET(DEVMODEW, dmFormName) + CCHFORMNAME * sizeof(WCHAR)) if (di->dlgdm->dmPublic.dmSize >= FIELD_OFFSET(DEVMODEW, dmFormName) + CCHFORMNAME * sizeof(WCHAR))
@ -361,7 +358,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
case IDD_ORIENT_LANDSCAPE: case IDD_ORIENT_LANDSCAPE:
TRACE("Setting orientation to %s\n", wParam == IDD_ORIENT_PORTRAIT ? TRACE("Setting orientation to %s\n", wParam == IDD_ORIENT_PORTRAIT ?
"portrait" : "landscape"); "portrait" : "landscape");
di->dlgdm->dmPublic.u1.s1.dmOrientation = wParam == IDD_ORIENT_PORTRAIT ? di->dlgdm->dmPublic.dmOrientation = wParam == IDD_ORIENT_PORTRAIT ?
DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE; DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE;
di->dlgdm->dmPublic.dmFields |= DM_ORIENTATION; di->dlgdm->dmPublic.dmFields |= DM_ORIENTATION;
SendMessageW(GetParent(hwnd), PSM_CHANGED, 0, 0); SendMessageW(GetParent(hwnd), PSM_CHANGED, 0, 0);
@ -395,7 +392,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
resy = HIWORD(data); resy = HIWORD(data);
TRACE("Setting resolution to %dx%d\n", resx, resy); TRACE("Setting resolution to %dx%d\n", resx, resy);
di->dlgdm->dmPublic.u1.s1.dmPrintQuality = resx; di->dlgdm->dmPublic.dmPrintQuality = resx;
di->dlgdm->dmPublic.dmFields |= DM_PRINTQUALITY; di->dlgdm->dmPublic.dmFields |= DM_PRINTQUALITY;
di->dlgdm->dmPublic.dmYResolution = resy; di->dlgdm->dmPublic.dmYResolution = resy;
@ -449,7 +446,7 @@ static int (WINAPI *pPropertySheet) (LPCPROPSHEETHEADERW);
* Returns size of DEVMODE structure if wMode is 0. Otherwise, IDOK is returned for success * Returns size of DEVMODE structure if wMode is 0. Otherwise, IDOK is returned for success
* for both dialog and non-dialog operations. IDCANCEL is returned if the dialog box was cancelled. * for both dialog and non-dialog operations. IDCANCEL is returned if the dialog box was cancelled.
* A return value less than zero is returned if a non-dialog operation fails. * A return value less than zero is returned if a non-dialog operation fails.
* *
* BUGS * BUGS
* *
* Just returns default devmode at the moment. No use of initialization file. * Just returns default devmode at the moment. No use of initialization file.
@ -496,8 +493,8 @@ INT WINAPI DrvDocumentProperties(HWND hwnd, const WCHAR *device, DEVMODEW *outpu
di.dlgdm = &dlgdm; di.dlgdm = &dlgdm;
psp.dwSize = sizeof(psp); psp.dwSize = sizeof(psp);
psp.hInstance = PSDRV_hInstance; psp.hInstance = PSDRV_hInstance;
psp.u.pszTemplate = L"PAPER"; psp.pszTemplate = L"PAPER";
psp.u2.pszIcon = NULL; psp.pszIcon = NULL;
psp.pfnDlgProc = PSDRV_PaperDlgProc; psp.pfnDlgProc = PSDRV_PaperDlgProc;
psp.lParam = (LPARAM)&di; psp.lParam = (LPARAM)&di;
hpsp[0] = pCreatePropertySheetPage(&psp); hpsp[0] = pCreatePropertySheetPage(&psp);
@ -507,12 +504,12 @@ INT WINAPI DrvDocumentProperties(HWND hwnd, const WCHAR *device, DEVMODEW *outpu
psh.pszCaption = SetupW; psh.pszCaption = SetupW;
psh.nPages = 1; psh.nPages = 1;
psh.hwndParent = hwnd; psh.hwndParent = hwnd;
psh.u3.phpage = hpsp; psh.phpage = hpsp;
pPropertySheet(&psh); pPropertySheet(&psh);
} }
/* If DM_UPDATE is set, should write settings to environment and initialization file */ /* If DM_UPDATE is set, should write settings to environment and initialization file */
if (mode & DM_UPDATE) if (mode & DM_UPDATE)
FIXME("Mode DM_UPDATE. Just do the same as DM_COPY\n"); FIXME("Mode DM_UPDATE. Just do the same as DM_COPY\n");
@ -814,7 +811,6 @@ DWORD WINAPI DrvDeviceCapabilities(HANDLE printer, WCHAR *device_name, WORD capa
* languages supported by the printer, unless pOutput is NULL. The return value is * languages supported by the printer, unless pOutput is NULL. The return value is
* number of array entries. (Win2k/XP only) * number of array entries. (Win2k/XP only)
*/ */
case DC_PERSONALITY: /* WINVER >= 0x0500 */ case DC_PERSONALITY: /* WINVER >= 0x0500 */
FIXME("DC_PERSONALITY: stub\n"); FIXME("DC_PERSONALITY: stub\n");
ret = -1; ret = -1;
@ -840,7 +836,7 @@ DWORD WINAPI DrvDeviceCapabilities(HANDLE printer, WCHAR *device_name, WORD capa
/* Returns the printer rate unit used for DC_PRINTRATE, which is one of /* Returns the printer rate unit used for DC_PRINTRATE, which is one of
* PRINTRATEUNIT_{CPS,IPM,LPM,PPM} (Win2k/XP only) * PRINTRATEUNIT_{CPS,IPM,LPM,PPM} (Win2k/XP only)
*/ */
case DC_PRINTRATEUNIT: /* WINVER >= 0x0500 */ case DC_PRINTRATEUNIT: /* WINVER >= 0x0500 */
FIXME("DC_PRINTRATEUNIT: stub\n"); FIXME("DC_PRINTRATEUNIT: stub\n");
ret = -1; ret = -1;

View File

@ -22,9 +22,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winerror.h" #include "winerror.h"
@ -210,14 +207,14 @@ static void dump_devmode(const DEVMODEW *dm)
TRACE("dmDriverExtra: 0x%04x\n", dm->dmDriverExtra); TRACE("dmDriverExtra: 0x%04x\n", dm->dmDriverExtra);
TRACE("dmFields: 0x%04x\n", dm->dmFields); TRACE("dmFields: 0x%04x\n", dm->dmFields);
dump_fields(dm->dmFields); dump_fields(dm->dmFields);
TRACE("dmOrientation: %d\n", dm->u1.s1.dmOrientation); TRACE("dmOrientation: %d\n", dm->dmOrientation);
TRACE("dmPaperSize: %d\n", dm->u1.s1.dmPaperSize); TRACE("dmPaperSize: %d\n", dm->dmPaperSize);
TRACE("dmPaperLength: %d\n", dm->u1.s1.dmPaperLength); TRACE("dmPaperLength: %d\n", dm->dmPaperLength);
TRACE("dmPaperWidth: %d\n", dm->u1.s1.dmPaperWidth); TRACE("dmPaperWidth: %d\n", dm->dmPaperWidth);
TRACE("dmScale: %d\n", dm->u1.s1.dmScale); TRACE("dmScale: %d\n", dm->dmScale);
TRACE("dmCopies: %d\n", dm->u1.s1.dmCopies); TRACE("dmCopies: %d\n", dm->dmCopies);
TRACE("dmDefaultSource: %d\n", dm->u1.s1.dmDefaultSource); TRACE("dmDefaultSource: %d\n", dm->dmDefaultSource);
TRACE("dmPrintQuality: %d\n", dm->u1.s1.dmPrintQuality); TRACE("dmPrintQuality: %d\n", dm->dmPrintQuality);
TRACE("dmColor: %d\n", dm->dmColor); TRACE("dmColor: %d\n", dm->dmColor);
TRACE("dmDuplex: %d\n", dm->dmDuplex); TRACE("dmDuplex: %d\n", dm->dmDuplex);
TRACE("dmYResolution: %d\n", dm->dmYResolution); TRACE("dmYResolution: %d\n", dm->dmYResolution);
@ -241,7 +238,7 @@ static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev )
if (physDev->Devmode->dmPublic.dmFields & (DM_PRINTQUALITY | DM_YRESOLUTION | DM_LOGPIXELS)) if (physDev->Devmode->dmPublic.dmFields & (DM_PRINTQUALITY | DM_YRESOLUTION | DM_LOGPIXELS))
{ {
if (physDev->Devmode->dmPublic.dmFields & DM_PRINTQUALITY) if (physDev->Devmode->dmPublic.dmFields & DM_PRINTQUALITY)
resx = resy = physDev->Devmode->dmPublic.u1.s1.dmPrintQuality; resx = resy = physDev->Devmode->dmPublic.dmPrintQuality;
if (physDev->Devmode->dmPublic.dmFields & DM_YRESOLUTION) if (physDev->Devmode->dmPublic.dmFields & DM_YRESOLUTION)
resy = physDev->Devmode->dmPublic.dmYResolution; resy = physDev->Devmode->dmPublic.dmYResolution;
@ -275,7 +272,7 @@ static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev )
if(physDev->Devmode->dmPublic.dmFields & DM_PAPERSIZE) { if(physDev->Devmode->dmPublic.dmFields & DM_PAPERSIZE) {
LIST_FOR_EACH_ENTRY(page, &physDev->pi->ppd->PageSizes, PAGESIZE, entry) { LIST_FOR_EACH_ENTRY(page, &physDev->pi->ppd->PageSizes, PAGESIZE, entry) {
if(page->WinPage == physDev->Devmode->dmPublic.u1.s1.dmPaperSize) if(page->WinPage == physDev->Devmode->dmPublic.dmPaperSize)
break; break;
} }
@ -306,11 +303,9 @@ static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev )
/* physDev sizes in device units; Devmode sizes in 1/10 mm */ /* physDev sizes in device units; Devmode sizes in 1/10 mm */
physDev->ImageableArea.left = physDev->ImageableArea.bottom = 0; physDev->ImageableArea.left = physDev->ImageableArea.bottom = 0;
physDev->ImageableArea.right = physDev->PageSize.cx = physDev->ImageableArea.right = physDev->PageSize.cx =
physDev->Devmode->dmPublic.u1.s1.dmPaperWidth * physDev->Devmode->dmPublic.dmPaperWidth * physDev->logPixelsX / 254;
physDev->logPixelsX / 254;
physDev->ImageableArea.top = physDev->PageSize.cy = physDev->ImageableArea.top = physDev->PageSize.cy =
physDev->Devmode->dmPublic.u1.s1.dmPaperLength * physDev->Devmode->dmPublic.dmPaperLength * physDev->logPixelsY / 254;
physDev->logPixelsY / 254;
} else { } else {
FIXME("Odd dmFields %x\n", physDev->Devmode->dmPublic.dmFields); FIXME("Odd dmFields %x\n", physDev->Devmode->dmPublic.dmFields);
SetRectEmpty(&physDev->ImageableArea); SetRectEmpty(&physDev->ImageableArea);
@ -325,7 +320,7 @@ static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev )
width = physDev->ImageableArea.right - physDev->ImageableArea.left; width = physDev->ImageableArea.right - physDev->ImageableArea.left;
height = physDev->ImageableArea.top - physDev->ImageableArea.bottom; height = physDev->ImageableArea.top - physDev->ImageableArea.bottom;
if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_PORTRAIT) { if(physDev->Devmode->dmPublic.dmOrientation == DMORIENT_PORTRAIT) {
physDev->horzRes = width; physDev->horzRes = width;
physDev->vertRes = height; physDev->vertRes = height;
} else { } else {
@ -475,11 +470,9 @@ static INT CDECL PSDRV_GetDeviceCaps( PHYSDEV dev, INT cap )
case TECHNOLOGY: case TECHNOLOGY:
return DT_RASPRINTER; return DT_RASPRINTER;
case HORZSIZE: case HORZSIZE:
return MulDiv(physDev->horzSize, 100, return MulDiv(physDev->horzSize, 100, physDev->Devmode->dmPublic.dmScale);
physDev->Devmode->dmPublic.u1.s1.dmScale);
case VERTSIZE: case VERTSIZE:
return MulDiv(physDev->vertSize, 100, return MulDiv(physDev->vertSize, 100, physDev->Devmode->dmPublic.dmScale);
physDev->Devmode->dmPublic.u1.s1.dmScale);
case HORZRES: case HORZRES:
return physDev->horzRes; return physDev->horzRes;
case VERTRES: case VERTRES:
@ -506,23 +499,21 @@ static INT CDECL PSDRV_GetDeviceCaps( PHYSDEV dev, INT cap )
case ASPECTY: case ASPECTY:
return physDev->logPixelsY; return physDev->logPixelsY;
case LOGPIXELSX: case LOGPIXELSX:
return MulDiv(physDev->logPixelsX, return MulDiv(physDev->logPixelsX, physDev->Devmode->dmPublic.dmScale, 100);
physDev->Devmode->dmPublic.u1.s1.dmScale, 100);
case LOGPIXELSY: case LOGPIXELSY:
return MulDiv(physDev->logPixelsY, return MulDiv(physDev->logPixelsY, physDev->Devmode->dmPublic.dmScale, 100);
physDev->Devmode->dmPublic.u1.s1.dmScale, 100);
case NUMRESERVED: case NUMRESERVED:
return 0; return 0;
case COLORRES: case COLORRES:
return 0; return 0;
case PHYSICALWIDTH: case PHYSICALWIDTH:
return (physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) ? return (physDev->Devmode->dmPublic.dmOrientation == DMORIENT_LANDSCAPE) ?
physDev->PageSize.cy : physDev->PageSize.cx; physDev->PageSize.cy : physDev->PageSize.cx;
case PHYSICALHEIGHT: case PHYSICALHEIGHT:
return (physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) ? return (physDev->Devmode->dmPublic.dmOrientation == DMORIENT_LANDSCAPE) ?
physDev->PageSize.cx : physDev->PageSize.cy; physDev->PageSize.cx : physDev->PageSize.cy;
case PHYSICALOFFSETX: case PHYSICALOFFSETX:
if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) { if(physDev->Devmode->dmPublic.dmOrientation == DMORIENT_LANDSCAPE) {
if(physDev->pi->ppd->LandscapeOrientation == -90) if(physDev->pi->ppd->LandscapeOrientation == -90)
return physDev->PageSize.cy - physDev->ImageableArea.top; return physDev->PageSize.cy - physDev->ImageableArea.top;
else else
@ -531,7 +522,7 @@ static INT CDECL PSDRV_GetDeviceCaps( PHYSDEV dev, INT cap )
return physDev->ImageableArea.left; return physDev->ImageableArea.left;
case PHYSICALOFFSETY: case PHYSICALOFFSETY:
if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) { if(physDev->Devmode->dmPublic.dmOrientation == DMORIENT_LANDSCAPE) {
if(physDev->pi->ppd->LandscapeOrientation == -90) if(physDev->pi->ppd->LandscapeOrientation == -90)
return physDev->PageSize.cx - physDev->ImageableArea.right; return physDev->PageSize.cx - physDev->ImageableArea.right;
else else
@ -709,7 +700,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name)
PSDRV_DEVMODE dm; PSDRV_DEVMODE dm;
memset(&dm, 0, sizeof(dm)); memset(&dm, 0, sizeof(dm));
dm.dmPublic.dmFields = DM_PAPERSIZE; dm.dmPublic.dmFields = DM_PAPERSIZE;
dm.dmPublic.u1.s1.dmPaperSize = papersize; dm.dmPublic.dmPaperSize = papersize;
PSDRV_MergeDevmodes(pi->Devmode, &dm, pi); PSDRV_MergeDevmodes(pi->Devmode, &dm, pi);
} }
} }
@ -718,7 +709,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name)
PSDRV_DEVMODE dm; PSDRV_DEVMODE dm;
memset(&dm, 0, sizeof(dm)); memset(&dm, 0, sizeof(dm));
dm.dmPublic.dmFields = DM_PAPERSIZE; dm.dmPublic.dmFields = DM_PAPERSIZE;
dm.dmPublic.u1.s1.dmPaperSize = pi->ppd->DefaultPageSize->WinPage; dm.dmPublic.dmPaperSize = pi->ppd->DefaultPageSize->WinPage;
PSDRV_MergeDevmodes(pi->Devmode, &dm, pi); PSDRV_MergeDevmodes(pi->Devmode, &dm, pi);
} }

View File

@ -25,8 +25,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <locale.h> #include <locale.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
@ -381,10 +379,10 @@ static void write_cups_job_ticket( PHYSDEV dev, const struct ticket_info *info )
} }
} }
if (physDev->Devmode->dmPublic.u1.s1.dmCopies > 1) if (physDev->Devmode->dmPublic.dmCopies > 1)
{ {
len = snprintf( buf, sizeof(buf), "%%cupsJobTicket: copies=%d\n", len = snprintf( buf, sizeof(buf), "%%cupsJobTicket: copies=%d\n",
physDev->Devmode->dmPublic.u1.s1.dmCopies ); physDev->Devmode->dmPublic.dmCopies );
if (len > 0 && len < sizeof(buf)) if (len > 0 && len < sizeof(buf))
write_spool( dev, buf, len ); write_spool( dev, buf, len );
@ -398,7 +396,7 @@ static void write_cups_job_ticket( PHYSDEV dev, const struct ticket_info *info )
} }
if (!(physDev->Devmode->dmPublic.dmFields & DM_DEFAULTSOURCE) || if (!(physDev->Devmode->dmPublic.dmFields & DM_DEFAULTSOURCE) ||
physDev->Devmode->dmPublic.u1.s1.dmDefaultSource == DMBIN_AUTO) physDev->Devmode->dmPublic.dmDefaultSource == DMBIN_AUTO)
write_spool( dev, cups_ap_d_inputslot, sizeof(cups_ap_d_inputslot) - 1 ); write_spool( dev, cups_ap_d_inputslot, sizeof(cups_ap_d_inputslot) - 1 );
} }
@ -444,7 +442,7 @@ INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title )
ury = physDev->ImageableArea.top * 72.0 / physDev->logPixelsY; ury = physDev->ImageableArea.top * 72.0 / physDev->logPixelsY;
/* FIXME should do something better with BBox */ /* FIXME should do something better with BBox */
dmOrientation = (physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE ? "Landscape" : "Portrait"); dmOrientation = (physDev->Devmode->dmPublic.dmOrientation == DMORIENT_LANDSCAPE ? "Landscape" : "Portrait");
sprintf(buf, psheader, escaped_title, llx, lly, urx, ury, dmOrientation); sprintf(buf, psheader, escaped_title, llx, lly, urx, ury, dmOrientation);
HeapFree(GetProcessHeap(), 0, escaped_title); HeapFree(GetProcessHeap(), 0, escaped_title);
@ -526,7 +524,7 @@ INT PSDRV_WriteNewPage( PHYSDEV dev )
return 0; return 0;
} }
if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) { if(physDev->Devmode->dmPublic.dmOrientation == DMORIENT_LANDSCAPE) {
if(physDev->pi->ppd->LandscapeOrientation == -90) { if(physDev->pi->ppd->LandscapeOrientation == -90) {
xtrans = physDev->ImageableArea.right; xtrans = physDev->ImageableArea.right;
ytrans = physDev->ImageableArea.top; ytrans = physDev->ImageableArea.top;