Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
d30705bd
Commit
d30705bd
authored
Jul 02, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
Jul 02, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Use screen color space for windows covered by OpenGL views.
parent
b0a3d934
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
cocoa_window.m
dlls/winemac.drv/cocoa_window.m
+55
-0
No files found.
dlls/winemac.drv/cocoa_window.m
View file @
d30705bd
...
@@ -158,6 +158,8 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
...
@@ -158,6 +158,8 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
@property
(
assign
,
nonatomic
)
void
*
imeData
;
@property
(
assign
,
nonatomic
)
void
*
imeData
;
@property
(
nonatomic
)
BOOL
commandDone
;
@property
(
nonatomic
)
BOOL
commandDone
;
-
(
void
)
updateColorSpace
;
@end
@end
...
@@ -256,12 +258,14 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
...
@@ -256,12 +258,14 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
pendingGlContexts
=
[[
NSMutableArray
alloc
]
init
];
pendingGlContexts
=
[[
NSMutableArray
alloc
]
init
];
[
pendingGlContexts
addObject
:
context
];
[
pendingGlContexts
addObject
:
context
];
[
self
setNeedsDisplay
:
YES
];
[
self
setNeedsDisplay
:
YES
];
[(
WineWindow
*
)[
self
window
]
updateColorSpace
];
}
}
-
(
void
)
removeGLContext
:
(
WineOpenGLContext
*
)
context
-
(
void
)
removeGLContext
:
(
WineOpenGLContext
*
)
context
{
{
[
glContexts
removeObjectIdenticalTo
:
context
];
[
glContexts
removeObjectIdenticalTo
:
context
];
[
pendingGlContexts
removeObjectIdenticalTo
:
context
];
[
pendingGlContexts
removeObjectIdenticalTo
:
context
];
[(
WineWindow
*
)[
self
window
]
updateColorSpace
];
}
}
-
(
void
)
updateGLContexts
-
(
void
)
updateGLContexts
...
@@ -270,6 +274,11 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
...
@@ -270,6 +274,11 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
context
.
needsUpdate
=
TRUE
;
context
.
needsUpdate
=
TRUE
;
}
}
-
(
BOOL
)
hasGLContext
{
return
[
glContexts
count
]
||
[
pendingGlContexts
count
];
}
-
(
BOOL
)
acceptsFirstMouse
:
(
NSEvent
*
)
theEvent
-
(
BOOL
)
acceptsFirstMouse
:
(
NSEvent
*
)
theEvent
{
{
return
YES
;
return
YES
;
...
@@ -919,7 +928,10 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
...
@@ -919,7 +928,10 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
if
(
NSEqualSizes
(
frame
.
size
,
oldFrame
.
size
))
if
(
NSEqualSizes
(
frame
.
size
,
oldFrame
.
size
))
[
self
setFrameOrigin
:
frame
.
origin
];
[
self
setFrameOrigin
:
frame
.
origin
];
else
else
{
[
self
setFrame
:
frame
display
:
YES
];
[
self
setFrame
:
frame
display
:
YES
];
[
self
updateColorSpace
];
}
[
self
updateFullscreen
];
[
self
updateFullscreen
];
...
@@ -1032,6 +1044,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
...
@@ -1032,6 +1044,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
[
self
setFrameTopLeftPoint
:
NSMakePoint
(
NSMinX
(
frame
),
NSMaxY
(
frame
))];
[
self
setFrameTopLeftPoint
:
NSMakePoint
(
NSMinX
(
frame
),
NSMaxY
(
frame
))];
frame
=
[
self
constrainFrameRect
:[
self
frame
]
toScreen
:
primaryScreen
];
frame
=
[
self
constrainFrameRect
:[
self
frame
]
toScreen
:
primaryScreen
];
[
self
setFrame
:
frame
display
:
YES
];
[
self
setFrame
:
frame
display
:
YES
];
[
self
updateColorSpace
];
}
}
if
(
activate
)
if
(
activate
)
...
@@ -1182,6 +1195,37 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
...
@@ -1182,6 +1195,37 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
}
}
}
}
// We normally use the generic/calibrated RGB color space for the window,
// rather than the device color space, to avoid expensive color conversion
// which slows down drawing. However, for windows displaying OpenGL, having
// a different color space than the screen greatly reduces frame rates, often
// limiting it to the display refresh rate.
//
// To avoid this, we switch back to the screen color space whenever the
// window is covered by a view with an attached OpenGL context.
-
(
void
)
updateColorSpace
{
NSRect
contentRect
=
[[
self
contentView
]
frame
];
BOOL
coveredByGLView
=
FALSE
;
for
(
WineContentView
*
view
in
[[
self
contentView
]
subviews
])
{
if
([
view
hasGLContext
])
{
NSRect
frame
=
[
view
convertRect
:[
view
bounds
]
toView
:
nil
];
if
(
NSContainsRect
(
frame
,
contentRect
))
{
coveredByGLView
=
TRUE
;
break
;
}
}
}
if
(
coveredByGLView
)
[
self
setColorSpace
:
nil
];
else
[
self
setColorSpace
:[
NSColorSpace
genericRGBColorSpace
]];
}
/*
/*
* ---------- NSResponder method overrides ----------
* ---------- NSResponder method overrides ----------
...
@@ -1872,6 +1916,7 @@ macdrv_view macdrv_create_view(macdrv_window w, CGRect rect)
...
@@ -1872,6 +1916,7 @@ macdrv_view macdrv_create_view(macdrv_window w, CGRect rect)
name
:
NSApplicationDidChangeScreenParametersNotification
name
:
NSApplicationDidChangeScreenParametersNotification
object
:
NSApp
];
object
:
NSApp
];
[[
window
contentView
]
addSubview
:
view
];
[[
window
contentView
]
addSubview
:
view
];
[
window
updateColorSpace
];
});
});
[
pool
release
];
[
pool
release
];
...
@@ -1890,6 +1935,7 @@ void macdrv_dispose_view(macdrv_view v)
...
@@ -1890,6 +1935,7 @@ void macdrv_dispose_view(macdrv_view v)
OnMainThread
(
^
{
OnMainThread
(
^
{
NSNotificationCenter
*
nc
=
[
NSNotificationCenter
defaultCenter
];
NSNotificationCenter
*
nc
=
[
NSNotificationCenter
defaultCenter
];
WineWindow
*
window
=
(
WineWindow
*
)[
view
window
];
[
nc
removeObserver
:
view
[
nc
removeObserver
:
view
name
:
NSViewGlobalFrameDidChangeNotification
name
:
NSViewGlobalFrameDidChangeNotification
...
@@ -1899,6 +1945,7 @@ void macdrv_dispose_view(macdrv_view v)
...
@@ -1899,6 +1945,7 @@ void macdrv_dispose_view(macdrv_view v)
object
:
NSApp
];
object
:
NSApp
];
[
view
removeFromSuperview
];
[
view
removeFromSuperview
];
[
view
release
];
[
view
release
];
[
window
updateColorSpace
];
});
});
[
pool
release
];
[
pool
release
];
...
@@ -1923,11 +1970,15 @@ void macdrv_set_view_window_and_frame(macdrv_view v, macdrv_window w, CGRect rec
...
@@ -1923,11 +1970,15 @@ void macdrv_set_view_window_and_frame(macdrv_view v, macdrv_window w, CGRect rec
BOOL
changedWindow
=
(
window
&&
window
!=
[
view
window
]);
BOOL
changedWindow
=
(
window
&&
window
!=
[
view
window
]);
NSRect
newFrame
=
NSRectFromCGRect
(
rect
);
NSRect
newFrame
=
NSRectFromCGRect
(
rect
);
NSRect
oldFrame
=
[
view
frame
];
NSRect
oldFrame
=
[
view
frame
];
BOOL
needUpdateWindowColorSpace
=
FALSE
;
if
(
changedWindow
)
if
(
changedWindow
)
{
{
WineWindow
*
oldWindow
=
(
WineWindow
*
)[
view
window
];
[
view
removeFromSuperview
];
[
view
removeFromSuperview
];
[
oldWindow
updateColorSpace
];
[[
window
contentView
]
addSubview
:
view
];
[[
window
contentView
]
addSubview
:
view
];
needUpdateWindowColorSpace
=
TRUE
;
}
}
if
(
!
NSEqualRects
(
oldFrame
,
newFrame
))
if
(
!
NSEqualRects
(
oldFrame
,
newFrame
))
...
@@ -1941,7 +1992,11 @@ void macdrv_set_view_window_and_frame(macdrv_view v, macdrv_window w, CGRect rec
...
@@ -1941,7 +1992,11 @@ void macdrv_set_view_window_and_frame(macdrv_view v, macdrv_window w, CGRect rec
else
else
[
view
setFrame
:
newFrame
];
[
view
setFrame
:
newFrame
];
[
view
setNeedsDisplay
:
YES
];
[
view
setNeedsDisplay
:
YES
];
needUpdateWindowColorSpace
=
TRUE
;
}
}
if
(
needUpdateWindowColorSpace
)
[(
WineWindow
*
)[
view
window
]
updateColorSpace
];
});
});
[
pool
release
];
[
pool
release
];
...
...
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