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
207c4d19
Commit
207c4d19
authored
Jan 21, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
Jan 21, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Associate an event queue with each thread that creates windows and with each window.
parent
3c995bb6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
137 additions
and
17 deletions
+137
-17
cocoa_window.h
dlls/winemac.drv/cocoa_window.h
+5
-0
cocoa_window.m
dlls/winemac.drv/cocoa_window.m
+11
-3
macdrv.h
dlls/winemac.drv/macdrv.h
+15
-0
macdrv_cocoa.h
dlls/winemac.drv/macdrv_cocoa.h
+2
-1
macdrv_main.c
dlls/winemac.drv/macdrv_main.c
+99
-12
window.c
dlls/winemac.drv/window.c
+5
-1
No files found.
dlls/winemac.drv/cocoa_window.h
View file @
207c4d19
...
...
@@ -21,6 +21,9 @@
#import <AppKit/AppKit.h>
@class
WineEventQueue
;
@interface
WineWindow
:
NSPanel
<
NSWindowDelegate
>
{
NSUInteger
normalStyleMask
;
...
...
@@ -29,6 +32,8 @@
BOOL
floating
;
WineWindow
*
latentParentWindow
;
WineEventQueue
*
queue
;
void
*
surface
;
pthread_mutex_t
*
surface_mutex
;
...
...
dlls/winemac.drv/cocoa_window.m
View file @
207c4d19
...
...
@@ -22,6 +22,7 @@
#include "macdrv_cocoa.h"
#import "cocoa_app.h"
#import "cocoa_event.h"
static
NSUInteger
style_mask_for_features
(
const
struct
macdrv_window_features
*
wf
)
...
...
@@ -65,6 +66,8 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
@property
(
nonatomic
)
BOOL
floating
;
@property
(
retain
,
nonatomic
)
NSWindow
*
latentParentWindow
;
@property
(
retain
,
nonatomic
)
WineEventQueue
*
queue
;
@property
(
nonatomic
)
void
*
surface
;
@property
(
nonatomic
)
pthread_mutex_t
*
surface_mutex
;
...
...
@@ -159,7 +162,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
@implementation
WineWindow
@synthesize
disabled
,
noActivate
,
floating
,
latentParentWindow
;
@synthesize
disabled
,
noActivate
,
floating
,
latentParentWindow
,
queue
;
@synthesize
surface
,
surface_mutex
;
@synthesize
shape
,
shapeChangedSinceLastDraw
;
@synthesize
colorKeyed
,
colorKeyRed
,
colorKeyGreen
,
colorKeyBlue
;
...
...
@@ -167,6 +170,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
+
(
WineWindow
*
)
createWindowWithFeatures
:(
const
struct
macdrv_window_features
*
)
wf
windowFrame
:(
NSRect
)
window_frame
queue
:(
WineEventQueue
*
)
queue
{
WineWindow
*
window
;
WineContentView
*
contentView
;
...
...
@@ -191,6 +195,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
[
window
setHasShadow
:
wf
->
shadow
];
[
window
setColorSpace
:[
NSColorSpace
genericRGBColorSpace
]];
[
window
setDelegate
:
window
];
window
.
queue
=
queue
;
contentView
=
[[[
WineContentView
alloc
]
initWithFrame
:
NSZeroRect
]
autorelease
];
if
(
!
contentView
)
...
...
@@ -204,6 +209,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
-
(
void
)
dealloc
{
[
queue
release
];
[
latentParentWindow
release
];
[
shape
release
];
[
super
dealloc
];
...
...
@@ -441,13 +447,14 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
* title bar, close box, etc.).
*/
macdrv_window
macdrv_create_cocoa_window
(
const
struct
macdrv_window_features
*
wf
,
CGRect
frame
)
CGRect
frame
,
macdrv_event_queue
queue
)
{
__block
WineWindow
*
window
;
OnMainThread
(
^
{
window
=
[[
WineWindow
createWindowWithFeatures
:
wf
windowFrame
:
NSRectFromCGRect
(
frame
)]
retain
];
windowFrame
:
NSRectFromCGRect
(
frame
)
queue
:(
WineEventQueue
*
)
queue
]
retain
];
});
return
(
macdrv_window
)
window
;
...
...
@@ -463,6 +470,7 @@ void macdrv_destroy_cocoa_window(macdrv_window w)
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
WineWindow
*
window
=
(
WineWindow
*
)
w
;
[
window
.
queue
discardEventsMatchingMask
:
-
1
forWindow
:
window
];
[
window
close
];
[
window
release
];
...
...
dlls/winemac.drv/macdrv.h
View file @
207c4d19
...
...
@@ -80,6 +80,21 @@ enum macdrv_window_messages
WM_MACDRV_SET_WIN_REGION
=
0x80001000
,
};
struct
macdrv_thread_data
{
macdrv_event_queue
queue
;
};
extern
DWORD
thread_data_tls_index
DECLSPEC_HIDDEN
;
extern
struct
macdrv_thread_data
*
macdrv_init_thread_data
(
void
)
DECLSPEC_HIDDEN
;
static
inline
struct
macdrv_thread_data
*
macdrv_thread_data
(
void
)
{
return
TlsGetValue
(
thread_data_tls_index
);
}
/* macdrv private window data */
struct
macdrv_win_data
{
...
...
dlls/winemac.drv/macdrv_cocoa.h
View file @
207c4d19
...
...
@@ -161,8 +161,9 @@ struct macdrv_window_state {
};
extern
macdrv_window
macdrv_create_cocoa_window
(
const
struct
macdrv_window_features
*
wf
,
CGRect
frame
)
DECLSPEC_HIDDEN
;
CGRect
frame
,
macdrv_event_queue
queue
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_destroy_cocoa_window
(
macdrv_window
w
)
DECLSPEC_HIDDEN
;
extern
void
*
macdrv_get_window_hwnd
(
macdrv_window
w
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_set_cocoa_window_features
(
macdrv_window
w
,
const
struct
macdrv_window_features
*
wf
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_set_cocoa_window_state
(
macdrv_window
w
,
...
...
dlls/winemac.drv/macdrv_main.c
View file @
207c4d19
...
...
@@ -22,32 +22,119 @@
#include "config.h"
#include "macdrv.h"
#include "wine/server.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
macdrv
);
DWORD
thread_data_tls_index
=
TLS_OUT_OF_INDEXES
;
/***********************************************************************
* process_attach
*/
static
BOOL
process_attach
(
void
)
{
if
((
thread_data_tls_index
=
TlsAlloc
())
==
TLS_OUT_OF_INDEXES
)
return
FALSE
;
macdrv_err_on
=
ERR_ON
(
macdrv
);
if
(
macdrv_start_cocoa_app
())
{
ERR
(
"Failed to start Cocoa app main loop
\n
"
);
return
FALSE
;
}
return
TRUE
;
}
/***********************************************************************
* thread_detach
*/
static
void
thread_detach
(
void
)
{
struct
macdrv_thread_data
*
data
=
macdrv_thread_data
();
if
(
data
)
{
macdrv_destroy_event_queue
(
data
->
queue
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
}
}
/***********************************************************************
* MACDRV initialisation routine
* set_queue_display_fd
*
* Store the event queue fd into the message queue
*/
BOOL
WINAPI
DllMain
(
HINSTANCE
hinst
,
DWORD
reason
,
LPVOID
reserved
)
static
void
set_queue_display_fd
(
int
fd
)
{
HANDLE
handle
;
int
ret
;
if
(
wine_server_fd_to_handle
(
fd
,
GENERIC_READ
|
SYNCHRONIZE
,
0
,
&
handle
))
{
MESSAGE
(
"macdrv: Can't allocate handle for event queue fd
\n
"
);
ExitProcess
(
1
);
}
SERVER_START_REQ
(
set_queue_fd
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
ret
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
if
(
ret
)
{
MESSAGE
(
"macdrv: Can't store handle for event queue fd
\n
"
);
ExitProcess
(
1
);
}
CloseHandle
(
handle
);
}
/***********************************************************************
* macdrv_init_thread_data
*/
struct
macdrv_thread_data
*
macdrv_init_thread_data
(
void
)
{
struct
macdrv_thread_data
*
data
=
macdrv_thread_data
();
if
(
data
)
return
data
;
if
(
!
(
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
data
))))
{
ERR
(
"could not create data
\n
"
);
ExitProcess
(
1
);
}
if
(
!
(
data
->
queue
=
macdrv_create_event_queue
()))
{
ERR
(
"macdrv: Can't create event queue.
\n
"
);
ExitProcess
(
1
);
}
set_queue_display_fd
(
macdrv_get_event_queue_fd
(
data
->
queue
));
TlsSetValue
(
thread_data_tls_index
,
data
);
return
data
;
}
/***********************************************************************
* DllMain
*/
BOOL
WINAPI
DllMain
(
HINSTANCE
hinst
,
DWORD
reason
,
LPVOID
reserved
)
{
BOOL
ret
=
TRUE
;
switch
(
reason
)
{
case
DLL_PROCESS_ATTACH
:
macdrv_err_on
=
ERR_ON
(
macdrv
);
if
(
macdrv_start_cocoa_app
())
{
ERR
(
"Failed to start Cocoa app main loop
\n
"
);
ret
=
FALSE
;
}
ret
=
process_attach
();
break
;
case
DLL_THREAD_DETACH
:
/* do thread detach */
break
;
case
DLL_PROCESS_DETACH
:
/* do detach */
thread_detach
();
break
;
}
return
ret
;
...
...
dlls/winemac.drv/window.c
View file @
207c4d19
...
...
@@ -478,6 +478,7 @@ static void sync_window_opacity(struct macdrv_win_data *data, COLORREF key, BYTE
*/
static
void
create_cocoa_window
(
struct
macdrv_win_data
*
data
)
{
struct
macdrv_thread_data
*
thread_data
=
macdrv_init_thread_data
();
WCHAR
text
[
1024
];
struct
macdrv_window_features
wf
;
CGRect
frame
;
...
...
@@ -510,7 +511,7 @@ static void create_cocoa_window(struct macdrv_win_data *data)
TRACE
(
"creating %p window %s whole %s client %s
\n
"
,
data
->
hwnd
,
wine_dbgstr_rect
(
&
data
->
window_rect
),
wine_dbgstr_rect
(
&
data
->
whole_rect
),
wine_dbgstr_rect
(
&
data
->
client_rect
));
data
->
cocoa_window
=
macdrv_create_cocoa_window
(
&
wf
,
frame
);
data
->
cocoa_window
=
macdrv_create_cocoa_window
(
&
wf
,
frame
,
thread_data
->
queue
);
if
(
!
data
->
cocoa_window
)
goto
done
;
set_cocoa_window_properties
(
data
);
...
...
@@ -565,7 +566,10 @@ static struct macdrv_win_data *macdrv_create_win_data(HWND hwnd, const RECT *win
if
(
GetWindowThreadProcessId
(
hwnd
,
NULL
)
!=
GetCurrentThreadId
())
return
NULL
;
if
(
!
(
parent
=
GetAncestor
(
hwnd
,
GA_PARENT
)))
/* desktop */
{
macdrv_init_thread_data
();
return
NULL
;
}
/* don't create win data for HWND_MESSAGE windows */
if
(
parent
!=
GetDesktopWindow
()
&&
!
GetAncestor
(
parent
,
GA_PARENT
))
return
NULL
;
...
...
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