Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a75c1aa7
Commit
a75c1aa7
authored
Oct 26, 2021
by
Huw Davies
Committed by
Alexandre Julliard
Oct 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winspool: Move the default page size query to cups.c.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f5195358
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
95 deletions
+117
-95
cups.c
dlls/winspool.drv/cups.c
+97
-0
info.c
dlls/winspool.drv/info.c
+13
-95
wspool.h
dlls/winspool.drv/wspool.h
+7
-0
No files found.
dlls/winspool.drv/cups.c
View file @
a75c1aa7
...
...
@@ -32,6 +32,62 @@
#include <cups/ppd.h>
#endif
#ifdef HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H
#define GetCurrentProcess GetCurrentProcess_Mac
#define GetCurrentThread GetCurrentThread_Mac
#define LoadResource LoadResource_Mac
#define AnimatePalette AnimatePalette_Mac
#define EqualRgn EqualRgn_Mac
#define FillRgn FillRgn_Mac
#define FrameRgn FrameRgn_Mac
#define GetPixel GetPixel_Mac
#define InvertRgn InvertRgn_Mac
#define LineTo LineTo_Mac
#define OffsetRgn OffsetRgn_Mac
#define PaintRgn PaintRgn_Mac
#define Polygon Polygon_Mac
#define ResizePalette ResizePalette_Mac
#define SetRectRgn SetRectRgn_Mac
#define EqualRect EqualRect_Mac
#define FillRect FillRect_Mac
#define FrameRect FrameRect_Mac
#define GetCursor GetCursor_Mac
#define InvertRect InvertRect_Mac
#define OffsetRect OffsetRect_Mac
#define PtInRect PtInRect_Mac
#define SetCursor SetCursor_Mac
#define SetRect SetRect_Mac
#define ShowCursor ShowCursor_Mac
#define UnionRect UnionRect_Mac
#include <ApplicationServices/ApplicationServices.h>
#undef GetCurrentProcess
#undef GetCurrentThread
#undef LoadResource
#undef AnimatePalette
#undef EqualRgn
#undef FillRgn
#undef FrameRgn
#undef GetPixel
#undef InvertRgn
#undef LineTo
#undef OffsetRgn
#undef PaintRgn
#undef Polygon
#undef ResizePalette
#undef SetRectRgn
#undef EqualRect
#undef FillRect
#undef FrameRect
#undef GetCursor
#undef InvertRect
#undef OffsetRect
#undef PtInRect
#undef SetCursor
#undef SetRect
#undef ShowCursor
#undef UnionRect
#endif
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
...
...
@@ -341,3 +397,44 @@ NTSTATUS unix_get_ppd( void *args )
free
(
unix_ppd
);
return
status
;
}
NTSTATUS
unix_get_default_page_size
(
void
*
args
)
{
#ifdef HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H
struct
get_default_page_size_params
*
params
=
args
;
NTSTATUS
status
=
STATUS_UNSUCCESSFUL
;
PMPrintSession
session
=
NULL
;
PMPageFormat
format
=
NULL
;
CFStringRef
paper_name
;
PMPaper
paper
;
CFRange
range
;
int
size
;
if
(
PMCreateSession
(
&
session
))
goto
end
;
if
(
PMCreatePageFormat
(
&
format
))
goto
end
;
if
(
PMSessionDefaultPageFormat
(
session
,
format
))
goto
end
;
if
(
PMGetPageFormatPaper
(
format
,
&
paper
))
goto
end
;
if
(
PMPaperGetPPDPaperName
(
paper
,
&
paper_name
))
goto
end
;
range
.
location
=
0
;
range
.
length
=
CFStringGetLength
(
paper_name
);
size
=
(
range
.
length
+
1
)
*
sizeof
(
WCHAR
);
if
(
params
->
name_size
>=
size
)
{
CFStringGetCharacters
(
paper_name
,
range
,
(
UniChar
*
)
params
->
name
);
params
->
name
[
range
.
length
]
=
0
;
status
=
STATUS_SUCCESS
;
}
else
status
=
STATUS_BUFFER_OVERFLOW
;
params
->
name_size
=
size
;
end:
if
(
format
)
PMRelease
(
format
);
if
(
session
)
PMRelease
(
session
);
return
status
;
#else
return
STATUS_NOT_IMPLEMENTED
;
#endif
}
dlls/winspool.drv/info.c
View file @
a75c1aa7
...
...
@@ -48,62 +48,6 @@
# include <cups/ppd.h>
#endif
#ifdef HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H
#define GetCurrentProcess GetCurrentProcess_Mac
#define GetCurrentThread GetCurrentThread_Mac
#define LoadResource LoadResource_Mac
#define AnimatePalette AnimatePalette_Mac
#define EqualRgn EqualRgn_Mac
#define FillRgn FillRgn_Mac
#define FrameRgn FrameRgn_Mac
#define GetPixel GetPixel_Mac
#define InvertRgn InvertRgn_Mac
#define LineTo LineTo_Mac
#define OffsetRgn OffsetRgn_Mac
#define PaintRgn PaintRgn_Mac
#define Polygon Polygon_Mac
#define ResizePalette ResizePalette_Mac
#define SetRectRgn SetRectRgn_Mac
#define EqualRect EqualRect_Mac
#define FillRect FillRect_Mac
#define FrameRect FrameRect_Mac
#define GetCursor GetCursor_Mac
#define InvertRect InvertRect_Mac
#define OffsetRect OffsetRect_Mac
#define PtInRect PtInRect_Mac
#define SetCursor SetCursor_Mac
#define SetRect SetRect_Mac
#define ShowCursor ShowCursor_Mac
#define UnionRect UnionRect_Mac
#include <ApplicationServices/ApplicationServices.h>
#undef GetCurrentProcess
#undef GetCurrentThread
#undef LoadResource
#undef AnimatePalette
#undef EqualRgn
#undef FillRgn
#undef FrameRgn
#undef GetPixel
#undef InvertRgn
#undef LineTo
#undef OffsetRgn
#undef PaintRgn
#undef Polygon
#undef ResizePalette
#undef SetRectRgn
#undef EqualRect
#undef FillRect
#undef FrameRect
#undef GetCursor
#undef InvertRect
#undef OffsetRect
#undef PtInRect
#undef SetCursor
#undef SetRect
#undef ShowCursor
#undef UnionRect
#endif
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
...
...
@@ -987,46 +931,20 @@ end:
static
void
set_ppd_overrides
(
HANDLE
printer
)
{
WCHAR
*
wstr
=
NULL
;
int
size
=
0
;
#ifdef HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H
OSStatus
status
;
PMPrintSession
session
=
NULL
;
PMPageFormat
format
=
NULL
;
PMPaper
paper
;
CFStringRef
paper_name
;
CFRange
range
;
status
=
PMCreateSession
(
&
session
);
if
(
status
)
goto
end
;
status
=
PMCreatePageFormat
(
&
format
);
if
(
status
)
goto
end
;
status
=
PMSessionDefaultPageFormat
(
session
,
format
);
if
(
status
)
goto
end
;
status
=
PMGetPageFormatPaper
(
format
,
&
paper
);
if
(
status
)
goto
end
;
status
=
PMPaperGetPPDPaperName
(
paper
,
&
paper_name
);
if
(
status
)
goto
end
;
range
.
location
=
0
;
range
.
length
=
CFStringGetLength
(
paper_name
);
size
=
(
range
.
length
+
1
)
*
sizeof
(
WCHAR
);
wstr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
CFStringGetCharacters
(
paper_name
,
range
,
(
UniChar
*
)
wstr
);
wstr
[
range
.
length
]
=
0
;
end:
if
(
format
)
PMRelease
(
format
);
if
(
session
)
PMRelease
(
session
);
#endif
WCHAR
buffer
[
256
];
struct
get_default_page_size_params
params
=
{
.
name
=
buffer
,
.
name_size
=
sizeof
(
buffer
)
};
NTSTATUS
status
;
SetPrinterDataExW
(
printer
,
PPD_Overrides
,
DefaultPageSize
,
REG_SZ
,
(
BYTE
*
)
wstr
,
size
);
HeapFree
(
GetProcessHeap
(),
0
,
wstr
);
while
(
1
)
{
status
=
UNIX_CALL
(
get_default_page_size
,
&
params
);
if
(
status
!=
STATUS_BUFFER_OVERFLOW
)
break
;
if
(
params
.
name
!=
buffer
)
heap_free
(
params
.
name
);
params
.
name
=
heap_alloc
(
params
.
name_size
);
if
(
!
params
.
name
)
break
;
}
if
(
!
status
)
SetPrinterDataExW
(
printer
,
PPD_Overrides
,
DefaultPageSize
,
REG_SZ
,
(
BYTE
*
)
params
.
name
,
params
.
name_size
);
if
(
params
.
name
!=
buffer
)
heap_free
(
params
.
name
);
}
static
BOOL
update_driver
(
HANDLE
printer
)
...
...
dlls/winspool.drv/wspool.h
View file @
a75c1aa7
...
...
@@ -52,6 +52,12 @@ struct enum_printers_params
unsigned
int
num
;
};
struct
get_default_page_size_params
{
WCHAR
*
name
;
unsigned
int
name_size
;
};
struct
get_ppd_params
{
const
WCHAR
*
printer
;
/* set to NULL to unlink */
...
...
@@ -62,4 +68,5 @@ struct get_ppd_params
NTSTATUS
unix_process_attach
(
void
*
)
DECLSPEC_HIDDEN
;
NTSTATUS
unix_enum_printers
(
void
*
)
DECLSPEC_HIDDEN
;
NTSTATUS
unix_get_default_page_size
(
void
*
)
DECLSPEC_HIDDEN
;
NTSTATUS
unix_get_ppd
(
void
*
)
DECLSPEC_HIDDEN
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment