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
e7d5f329
Commit
e7d5f329
authored
Apr 16, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
Apr 16, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Refactor WineApplication class to separate most logic into a controller class.
parent
304463b4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
7 deletions
+41
-7
cocoa_app.h
dlls/winemac.drv/cocoa_app.h
+17
-1
cocoa_app.m
dlls/winemac.drv/cocoa_app.m
+0
-0
cocoa_event.m
dlls/winemac.drv/cocoa_event.m
+5
-3
cocoa_main.m
dlls/winemac.drv/cocoa_main.m
+19
-3
cocoa_window.m
dlls/winemac.drv/cocoa_window.m
+0
-0
No files found.
dlls/winemac.drv/cocoa_app.h
View file @
e7d5f329
...
@@ -35,7 +35,7 @@ enum {
...
@@ -35,7 +35,7 @@ enum {
@class
WineWindow
;
@class
WineWindow
;
@interface
WineApplication
:
NSApplication
<
NSApplicationDelegate
>
@interface
WineApplication
Controller
:
NSObject
<
NSApplicationDelegate
>
{
{
CFRunLoopSourceRef
requestSource
;
CFRunLoopSourceRef
requestSource
;
NSMutableArray
*
requests
;
NSMutableArray
*
requests
;
...
@@ -84,6 +84,8 @@ enum {
...
@@ -84,6 +84,8 @@ enum {
@property
(
readonly
,
nonatomic
)
NSArray
*
orderedWineWindows
;
@property
(
readonly
,
nonatomic
)
NSArray
*
orderedWineWindows
;
@property
(
readonly
,
nonatomic
)
BOOL
areDisplaysCaptured
;
@property
(
readonly
,
nonatomic
)
BOOL
areDisplaysCaptured
;
+
(
WineApplicationController
*
)
sharedController
;
-
(
void
)
transformProcessToForeground
;
-
(
void
)
transformProcessToForeground
;
-
(
BOOL
)
registerEventQueue
:(
WineEventQueue
*
)
queue
;
-
(
BOOL
)
registerEventQueue
:(
WineEventQueue
*
)
queue
;
...
@@ -104,8 +106,22 @@ enum {
...
@@ -104,8 +106,22 @@ enum {
ordered
:(
NSWindowOrderingMode
)
order
ordered
:(
NSWindowOrderingMode
)
order
relativeTo
:(
WineWindow
*
)
otherWindow
;
relativeTo
:(
WineWindow
*
)
otherWindow
;
-
(
BOOL
)
handleEvent
:(
NSEvent
*
)
anEvent
;
-
(
void
)
didSendEvent
:(
NSEvent
*
)
anEvent
;
@end
@interface
WineApplication
:
NSApplication
{
WineApplicationController
*
wineController
;
}
@property
(
readwrite
,
assign
,
nonatomic
)
WineApplicationController
*
wineController
;
@end
@end
void
OnMainThreadAsync
(
dispatch_block_t
block
);
void
OnMainThreadAsync
(
dispatch_block_t
block
);
void
LogError
(
const
char
*
func
,
NSString
*
format
,
...);
void
LogError
(
const
char
*
func
,
NSString
*
format
,
...);
...
...
dlls/winemac.drv/cocoa_app.m
View file @
e7d5f329
This diff is collapsed.
Click to expand it.
dlls/winemac.drv/cocoa_event.m
View file @
e7d5f329
...
@@ -269,7 +269,9 @@ static NSString* const WineEventQueueThreadDictionaryKey = @"WineEventQueueThrea
...
@@ -269,7 +269,9 @@ static NSString* const WineEventQueueThreadDictionaryKey = @"WineEventQueueThrea
[
self
postEvent
:
event
];
[
self
postEvent
:
event
];
macdrv_release_event
(
event
);
macdrv_release_event
(
event
);
timedout
=
!
[
NSApp
waitUntilQueryDone
:
&
query
->
done
timeout
:
timeoutDate
processEvents
:
processEvents
];
timedout
=
!
[[
WineApplicationController
sharedController
]
waitUntilQueryDone
:
&
query
->
done
timeout
:
timeoutDate
processEvents
:
processEvents
];
return
!
timedout
&&
query
->
status
;
return
!
timedout
&&
query
->
status
;
}
}
...
@@ -347,7 +349,7 @@ macdrv_event_queue macdrv_create_event_queue(macdrv_event_handler handler)
...
@@ -347,7 +349,7 @@ macdrv_event_queue macdrv_create_event_queue(macdrv_event_handler handler)
queue
=
[[[
WineEventQueue
alloc
]
initWithEventHandler
:
handler
]
autorelease
];
queue
=
[[[
WineEventQueue
alloc
]
initWithEventHandler
:
handler
]
autorelease
];
if
(
queue
)
if
(
queue
)
{
{
if
([
NSApp
registerEventQueue
:
queue
])
if
([
[
WineApplicationController
sharedController
]
registerEventQueue
:
queue
])
[
threadDict
setObject
:
queue
forKey
:
WineEventQueueThreadDictionaryKey
];
[
threadDict
setObject
:
queue
forKey
:
WineEventQueueThreadDictionaryKey
];
else
else
queue
=
nil
;
queue
=
nil
;
...
@@ -370,7 +372,7 @@ void macdrv_destroy_event_queue(macdrv_event_queue queue)
...
@@ -370,7 +372,7 @@ void macdrv_destroy_event_queue(macdrv_event_queue queue)
WineEventQueue
*
q
=
(
WineEventQueue
*
)
queue
;
WineEventQueue
*
q
=
(
WineEventQueue
*
)
queue
;
NSMutableDictionary
*
threadDict
=
[[
NSThread
currentThread
]
threadDictionary
];
NSMutableDictionary
*
threadDict
=
[[
NSThread
currentThread
]
threadDictionary
];
[
NSApp
unregisterEventQueue
:
q
];
[
[
WineApplicationController
sharedController
]
unregisterEventQueue
:
q
];
[
threadDict
removeObjectForKey
:
WineEventQueueThreadDictionaryKey
];
[
threadDict
removeObjectForKey
:
WineEventQueueThreadDictionaryKey
];
[
pool
release
];
[
pool
release
];
...
...
dlls/winemac.drv/cocoa_main.m
View file @
e7d5f329
...
@@ -39,6 +39,7 @@ struct cocoa_app_startup_info {
...
@@ -39,6 +39,7 @@ struct cocoa_app_startup_info {
NSConditionLock
*
lock
;
NSConditionLock
*
lock
;
unsigned
long
long
tickcount
;
unsigned
long
long
tickcount
;
uint64_t
uptime_ns
;
uint64_t
uptime_ns
;
BOOL
success
;
};
};
...
@@ -61,12 +62,23 @@ static void run_cocoa_app(void* info)
...
@@ -61,12 +62,23 @@ static void run_cocoa_app(void* info)
{
{
struct
cocoa_app_startup_info
*
startup_info
=
info
;
struct
cocoa_app_startup_info
*
startup_info
=
info
;
NSConditionLock
*
lock
=
startup_info
->
lock
;
NSConditionLock
*
lock
=
startup_info
->
lock
;
BOOL
created_app
=
FALSE
;
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
if
(
!
NSApp
)
{
[
WineApplication
sharedApplication
];
[
WineApplication
sharedApplication
];
[
NSApp
setDelegate
:(
WineApplication
*
)
NSApp
];
created_app
=
TRUE
;
[
NSApp
computeEventTimeAdjustmentFromTicks
:
startup_info
->
tickcount
uptime
:
startup_info
->
uptime_ns
];
}
if
([
NSApp
respondsToSelector
:
@
selector
(
setWineController
:)])
{
WineApplicationController
*
controller
=
[
WineApplicationController
sharedController
];
[
NSApp
setWineController
:
controller
];
[
controller
computeEventTimeAdjustmentFromTicks
:
startup_info
->
tickcount
uptime
:
startup_info
->
uptime_ns
];
startup_info
->
success
=
TRUE
;
}
/
*
Retain
the
lock
while
we
'
re
using
it
,
so
macdrv_start_cocoa_app
()
/
*
Retain
the
lock
while
we
'
re
using
it
,
so
macdrv_start_cocoa_app
()
doesn
'
t
deallocate
it
in
the
middle
of
us
unlocking
it
.
*
/
doesn
'
t
deallocate
it
in
the
middle
of
us
unlocking
it
.
*
/
...
@@ -77,8 +89,11 @@ static void run_cocoa_app(void* info)
...
@@ -77,8 +89,11 @@ static void run_cocoa_app(void* info)
[
pool
release
];
[
pool
release
];
if
(
created_app
&&
startup_info
->
success
)
{
/
*
Never
returns
*
/
/
*
Never
returns
*
/
[
NSApp
run
];
[
NSApp
run
];
}
}
}
...
@@ -109,6 +124,7 @@ int macdrv_start_cocoa_app(unsigned long long tickcount)
...
@@ -109,6 +124,7 @@ int macdrv_start_cocoa_app(unsigned long long tickcount)
startup_info
.
lock
=
[[
NSConditionLock
alloc
]
initWithCondition
:
COCOA_APP_NOT_RUNNING
];
startup_info
.
lock
=
[[
NSConditionLock
alloc
]
initWithCondition
:
COCOA_APP_NOT_RUNNING
];
startup_info
.
tickcount
=
tickcount
;
startup_info
.
tickcount
=
tickcount
;
startup_info
.
success
=
FALSE
;
mach_timebase_info
(
&
mach_timebase
);
mach_timebase_info
(
&
mach_timebase
);
startup_info
.
uptime_ns
=
uptime_mach
*
mach_timebase
.
numer
/
mach_timebase
.
denom
;
startup_info
.
uptime_ns
=
uptime_mach
*
mach_timebase
.
numer
/
mach_timebase
.
denom
;
...
@@ -128,7 +144,7 @@ int macdrv_start_cocoa_app(unsigned long long tickcount)
...
@@ -128,7 +144,7 @@ int macdrv_start_cocoa_app(unsigned long long tickcount)
if
([
startup_info
.
lock
lockWhenCondition
:
COCOA_APP_RUNNING
beforeDate
:
timeLimit
])
if
([
startup_info
.
lock
lockWhenCondition
:
COCOA_APP_RUNNING
beforeDate
:
timeLimit
])
{
{
[
startup_info
.
lock
unlock
];
[
startup_info
.
lock
unlock
];
ret
=
0
;
ret
=
!
startup_info
.
success
;
}
}
}
}
...
...
dlls/winemac.drv/cocoa_window.m
View file @
e7d5f329
This diff is collapsed.
Click to expand it.
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