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
21c4fc33
Commit
21c4fc33
authored
Dec 20, 2012
by
Ken Thomases
Committed by
Alexandre Julliard
Dec 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac.drv: Implement EnumDisplayMonitors.
parent
49dc686a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
352 additions
and
58 deletions
+352
-58
Makefile.in
dlls/winemac.drv/Makefile.in
+5
-1
cocoa_display.m
dlls/winemac.drv/cocoa_display.m
+103
-0
display.c
dlls/winemac.drv/display.c
+107
-0
macdrv.h
dlls/winemac.drv/macdrv.h
+22
-57
macdrv_cocoa.h
dlls/winemac.drv/macdrv_cocoa.h
+111
-0
winemac.drv.spec
dlls/winemac.drv/winemac.drv.spec
+4
-0
No files found.
dlls/winemac.drv/Makefile.in
View file @
21c4fc33
MODULE
=
winemac.drv
IMPORTS
=
user32 gdi32 advapi32
EXTRALIBS
=
@APPLICATIONSERVICESLIB@
EXTRALIBS
=
-framework
AppKit
C_SRCS
=
\
display.c
\
gdi.c
\
macdrv_main.c
OBJC_SRCS
=
\
cocoa_display.m
@MAKE_DLL_RULES@
dlls/winemac.drv/cocoa_display.m
0 → 100644
View file @
21c4fc33
/*
* MACDRV Cocoa display settings
*
* Copyright 2011, 2012 Ken Thomases for CodeWeavers Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#import <AppKit/AppKit.h>
#include "macdrv_cocoa.h"
/***********************************************************************
* convert_display_rect
*
* Converts an NSRect in Cocoa's y-goes-up-from-bottom coordinate system
* to a CGRect in y-goes-down-from-top coordinates.
*/
static
inline
void
convert_display_rect
(
CGRect
*
out_rect
,
NSRect
in_rect
,
NSRect
primary_frame
)
{
*
out_rect
=
NSRectToCGRect
(
in_rect
);
out_rect
->
origin
.
y
=
NSMaxY
(
primary_frame
)
-
NSMaxY
(
in_rect
);
}
/***********************************************************************
* macdrv_get_displays
*
* Returns information about the displays.
*
* Returns 0 on success and *displays contains a newly-allocated array
* of macdrv_display structures and *count contains the number of
* elements in that array. The first element of the array is the
* primary display. When the caller is done with the array, it should
* use macdrv_free_displays() to deallocate it.
*
* Returns non-zero on failure and *displays and *count are unchanged.
*/
int
macdrv_get_displays
(
struct
macdrv_display
**
displays
,
int
*
count
)
{
int
ret
=
-
1
;
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSArray
*
screens
=
[
NSScreen
screens
];
if
(
screens
)
{
NSUInteger
num_screens
=
[
screens
count
];
struct
macdrv_display
*
disps
=
malloc
(
num_screens
*
sizeof
(
disps
[
0
]));
if
(
disps
)
{
NSRect
primary_frame
;
NSUInteger
i
;
for
(
i
=
0
;
i
<
num_screens
;
i
++
)
{
NSScreen
*
screen
=
[
screens
objectAtIndex
:
i
];
NSRect
frame
=
[
screen
frame
];
NSRect
visible_frame
=
[
screen
visibleFrame
];
if
(
i
==
0
)
primary_frame
=
frame
;
disps
[
i
].
displayID
=
[[[
screen
deviceDescription
]
objectForKey
:
@"NSScreenNumber"
]
unsignedIntValue
];
convert_display_rect
(
&
disps
[
i
].
frame
,
frame
,
primary_frame
);
convert_display_rect
(
&
disps
[
i
].
work_frame
,
visible_frame
,
primary_frame
);
}
*
displays
=
disps
;
*
count
=
num_screens
;
ret
=
0
;
}
}
[
pool
release
];
return
ret
;
}
/***********************************************************************
* macdrv_free_displays
*
* Deallocates an array of macdrv_display structures previously returned
* from macdrv_get_displays().
*/
void
macdrv_free_displays
(
struct
macdrv_display
*
displays
)
{
free
(
displays
);
}
dlls/winemac.drv/display.c
0 → 100644
View file @
21c4fc33
/*
* MACDRV display settings
*
* Copyright 2003 Alexander James Pasadyn
* Copyright 2011, 2012 Ken Thomases for CodeWeavers Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "macdrv.h"
#include "winuser.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
display
);
static
inline
HMONITOR
display_id_to_monitor
(
CGDirectDisplayID
display_id
)
{
return
(
HMONITOR
)(
UINT_PTR
)
display_id
;
}
static
inline
CGDirectDisplayID
monitor_to_display_id
(
HMONITOR
handle
)
{
return
(
CGDirectDisplayID
)(
UINT_PTR
)
handle
;
}
/***********************************************************************
* EnumDisplayMonitors (MACDRV.@)
*/
BOOL
CDECL
macdrv_EnumDisplayMonitors
(
HDC
hdc
,
LPRECT
rect
,
MONITORENUMPROC
proc
,
LPARAM
lparam
)
{
struct
macdrv_display
*
displays
;
int
num_displays
;
int
i
;
BOOL
ret
=
TRUE
;
TRACE
(
"%p, %s, %p, %#lx
\n
"
,
hdc
,
wine_dbgstr_rect
(
rect
),
proc
,
lparam
);
if
(
hdc
)
{
POINT
origin
;
RECT
limit
;
if
(
!
GetDCOrgEx
(
hdc
,
&
origin
))
return
FALSE
;
if
(
GetClipBox
(
hdc
,
&
limit
)
==
ERROR
)
return
FALSE
;
if
(
rect
&&
!
IntersectRect
(
&
limit
,
&
limit
,
rect
))
return
TRUE
;
if
(
macdrv_get_displays
(
&
displays
,
&
num_displays
))
return
FALSE
;
for
(
i
=
0
;
i
<
num_displays
;
i
++
)
{
RECT
monrect
=
rect_from_cgrect
(
displays
[
i
].
frame
);
OffsetRect
(
&
monrect
,
-
origin
.
x
,
-
origin
.
y
);
if
(
IntersectRect
(
&
monrect
,
&
monrect
,
&
limit
))
{
HMONITOR
monitor
=
display_id_to_monitor
(
displays
[
i
].
displayID
);
TRACE
(
"monitor %d handle %p @ %s
\n
"
,
i
,
monitor
,
wine_dbgstr_rect
(
&
monrect
));
if
(
!
proc
(
monitor
,
hdc
,
&
monrect
,
lparam
))
{
ret
=
FALSE
;
break
;
}
}
}
}
else
{
if
(
macdrv_get_displays
(
&
displays
,
&
num_displays
))
return
FALSE
;
for
(
i
=
0
;
i
<
num_displays
;
i
++
)
{
RECT
monrect
=
rect_from_cgrect
(
displays
[
i
].
frame
);
RECT
unused
;
if
(
!
rect
||
IntersectRect
(
&
unused
,
&
monrect
,
rect
))
{
HMONITOR
monitor
=
display_id_to_monitor
(
displays
[
i
].
displayID
);
TRACE
(
"monitor %d handle %p @ %s
\n
"
,
i
,
monitor
,
wine_dbgstr_rect
(
&
monrect
));
if
(
!
proc
(
monitor
,
0
,
&
monrect
,
lparam
))
{
ret
=
FALSE
;
break
;
}
}
}
}
macdrv_free_displays
(
displays
);
return
ret
;
}
dlls/winemac.drv/macdrv.h
View file @
21c4fc33
...
...
@@ -27,63 +27,7 @@
# error You must include config.h to use this header
#endif
#define GetCurrentProcess MacGetCurrentProcess
#define GetCurrentThread MacGetCurrentThread
#define LoadResource MacLoadResource
#define AnimatePalette MacAnimatePalette
#define EqualRgn MacEqualRgn
#define FillRgn MacFillRgn
#define FrameRgn MacFrameRgn
#define GetPixel MacGetPixel
#define InvertRgn MacInvertRgn
#define LineTo MacLineTo
#define OffsetRgn MacOffsetRgn
#define PaintRgn MacPaintRgn
#define Polygon MacPolygon
#define ResizePalette MacResizePalette
#define SetRectRgn MacSetRectRgn
#define EqualRect MacEqualRect
#define FillRect MacFillRect
#define FrameRect MacFrameRect
#define GetCursor MacGetCursor
#define InvertRect MacInvertRect
#define OffsetRect MacOffsetRect
#define PtInRect MacPtInRect
#define SetCursor MacSetCursor
#define SetRect MacSetRect
#define ShowCursor MacShowCursor
#define UnionRect MacUnionRect
#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
#undef DPRINTF
#include "macdrv_cocoa.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
...
...
@@ -91,6 +35,27 @@
#include "wine/gdi_driver.h"
static
inline
CGRect
cgrect_from_rect
(
RECT
rect
)
{
if
(
rect
.
left
>=
rect
.
right
||
rect
.
top
>=
rect
.
bottom
)
return
CGRectNull
;
return
CGRectMake
(
rect
.
left
,
rect
.
top
,
rect
.
right
-
rect
.
left
,
rect
.
bottom
-
rect
.
top
);
}
static
inline
RECT
rect_from_cgrect
(
CGRect
cgrect
)
{
static
const
RECT
empty
;
if
(
!
CGRectIsNull
(
cgrect
))
{
RECT
rect
=
{
CGRectGetMinX
(
cgrect
),
CGRectGetMinY
(
cgrect
),
CGRectGetMaxX
(
cgrect
),
CGRectGetMaxY
(
cgrect
)
};
return
rect
;
}
return
empty
;
}
static
inline
const
char
*
wine_dbgstr_cgrect
(
CGRect
cgrect
)
{
return
wine_dbg_sprintf
(
"(%g,%g)-(%g,%g)"
,
CGRectGetMinX
(
cgrect
),
CGRectGetMinY
(
cgrect
),
...
...
dlls/winemac.drv/macdrv_cocoa.h
0 → 100644
View file @
21c4fc33
/*
* MACDRV Cocoa interface declarations
*
* Copyright 2011, 2012 Ken Thomases for CodeWeavers Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* This header serves as a C interface between the Wine parts of MACDRV
* and the Objective-C parts. It should restrict itself to C and the C-based
* Mac APIs, avoiding both Wine and Objective-C/Cocoa features, so that it can
* be included by both sides without contaminating either.
*/
#ifndef __WINE_MACDRV_COCOA_H
#define __WINE_MACDRV_COCOA_H
#define GetCurrentProcess MacGetCurrentProcess
#define GetCurrentThread MacGetCurrentThread
#define LoadResource MacLoadResource
#define AnimatePalette MacAnimatePalette
#define EqualRgn MacEqualRgn
#define FillRgn MacFillRgn
#define FrameRgn MacFrameRgn
#define GetPixel MacGetPixel
#define InvertRgn MacInvertRgn
#define LineTo MacLineTo
#define OffsetRgn MacOffsetRgn
#define PaintRgn MacPaintRgn
#define Polygon MacPolygon
#define ResizePalette MacResizePalette
#define SetRectRgn MacSetRectRgn
#define EqualRect MacEqualRect
#define FillRect MacFillRect
#define FrameRect MacFrameRect
#define GetCursor MacGetCursor
#define InvertRect MacInvertRect
#define OffsetRect MacOffsetRect
#define PtInRect MacPtInRect
#define SetCursor MacSetCursor
#define SetRect MacSetRect
#define ShowCursor MacShowCursor
#define UnionRect MacUnionRect
#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
#undef DPRINTF
#ifndef DECLSPEC_HIDDEN
# if defined(__MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
# define DECLSPEC_HIDDEN
# elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
# define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
# else
# define DECLSPEC_HIDDEN
# endif
#endif
struct
macdrv_display
{
CGDirectDisplayID
displayID
;
CGRect
frame
;
CGRect
work_frame
;
};
/* display */
extern
int
macdrv_get_displays
(
struct
macdrv_display
**
displays
,
int
*
count
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_free_displays
(
struct
macdrv_display
*
displays
)
DECLSPEC_HIDDEN
;
#endif
/* __WINE_MACDRV_COCOA_H */
dlls/winemac.drv/winemac.drv.spec
View file @
21c4fc33
# GDI driver
@ cdecl wine_get_gdi_driver(long) macdrv_get_gdi_driver
# USER driver
@ cdecl EnumDisplayMonitors(long ptr ptr long) macdrv_EnumDisplayMonitors
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