Commit 1990e194 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winspool: Add any default printer options that aren't set by the driver.

parent 92426b51
...@@ -786,6 +786,7 @@ static void unlink_ppd( const WCHAR *ppd ) ...@@ -786,6 +786,7 @@ static void unlink_ppd( const WCHAR *ppd )
static void *cupshandle; static void *cupshandle;
#define CUPS_FUNCS \ #define CUPS_FUNCS \
DO_FUNC(cupsAddOption); \
DO_FUNC(cupsFreeDests); \ DO_FUNC(cupsFreeDests); \
DO_FUNC(cupsFreeOptions); \ DO_FUNC(cupsFreeOptions); \
DO_FUNC(cupsGetDests); \ DO_FUNC(cupsGetDests); \
...@@ -794,12 +795,14 @@ static void *cupshandle; ...@@ -794,12 +795,14 @@ static void *cupshandle;
DO_FUNC(cupsParseOptions); \ DO_FUNC(cupsParseOptions); \
DO_FUNC(cupsPrintFile) DO_FUNC(cupsPrintFile)
#define CUPS_OPT_FUNCS \ #define CUPS_OPT_FUNCS \
DO_FUNC(cupsGetNamedDest); \
DO_FUNC(cupsGetPPD3) DO_FUNC(cupsGetPPD3)
#define DO_FUNC(f) static typeof(f) *p##f #define DO_FUNC(f) static typeof(f) *p##f
CUPS_FUNCS; CUPS_FUNCS;
#undef DO_FUNC #undef DO_FUNC
static http_status_t (*pcupsGetPPD3)(http_t *,const char *, time_t *, char *, size_t); static cups_dest_t * (*pcupsGetNamedDest)(http_t *, const char *, const char *);
static http_status_t (*pcupsGetPPD3)(http_t *, const char *, time_t *, char *, size_t);
static http_status_t cupsGetPPD3_wrapper( http_t *http, const char *name, static http_status_t cupsGetPPD3_wrapper( http_t *http, const char *name,
time_t *modtime, char *buffer, time_t *modtime, char *buffer,
...@@ -8165,6 +8168,27 @@ end: ...@@ -8165,6 +8168,27 @@ end:
fclose( fp ); fclose( fp );
return num_options; return num_options;
} }
static int get_cups_default_options( const char *printer, int num_options, cups_option_t **options )
{
cups_dest_t *dest;
int i;
if (!pcupsGetNamedDest) return num_options;
dest = pcupsGetNamedDest( NULL, printer, NULL );
if (!dest) return num_options;
for (i = 0; i < dest->num_options; i++)
{
if (!pcupsGetOption( dest->options[i].name, num_options, *options ))
num_options = pcupsAddOption( dest->options[i].name, dest->options[i].value,
num_options, options );
}
pcupsFreeDests( 1, dest );
return num_options;
}
#endif #endif
/***************************************************************************** /*****************************************************************************
...@@ -8193,6 +8217,7 @@ static BOOL schedule_cups(LPCWSTR printer_name, LPCWSTR filename, LPCWSTR docume ...@@ -8193,6 +8217,7 @@ static BOOL schedule_cups(LPCWSTR printer_name, LPCWSTR filename, LPCWSTR docume
WideCharToMultiByte(CP_UNIXCP, 0, document_title, -1, unix_doc_title, len, NULL, NULL); WideCharToMultiByte(CP_UNIXCP, 0, document_title, -1, unix_doc_title, len, NULL, NULL);
num_options = get_cups_job_ticket_options( unixname, num_options, &options ); num_options = get_cups_job_ticket_options( unixname, num_options, &options );
num_options = get_cups_default_options( queue, num_options, &options );
TRACE( "printing via cups with options:\n" ); TRACE( "printing via cups with options:\n" );
for (i = 0; i < num_options; i++) for (i = 0; i < num_options; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment