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
6cde62ac
Commit
6cde62ac
authored
Jan 27, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
Jan 28, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Take control over when a window can become focused away from Cocoa.
parent
bd269786
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
1 deletion
+93
-1
cocoa_window.h
dlls/winemac.drv/cocoa_window.h
+2
-0
cocoa_window.m
dlls/winemac.drv/cocoa_window.m
+55
-1
macdrv_cocoa.h
dlls/winemac.drv/macdrv_cocoa.h
+1
-0
window.c
dlls/winemac.drv/window.c
+34
-0
winemac.drv.spec
dlls/winemac.drv/winemac.drv.spec
+1
-0
No files found.
dlls/winemac.drv/cocoa_window.h
View file @
6cde62ac
...
...
@@ -45,6 +45,8 @@
CGFloat
colorKeyRed
,
colorKeyGreen
,
colorKeyBlue
;
BOOL
usePerPixelAlpha
;
BOOL
causing_becomeKeyWindow
;
}
@end
dlls/winemac.drv/cocoa_window.m
View file @
6cde62ac
...
...
@@ -440,14 +440,52 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
[
queue
postEvent
:
&
event
];
}
-
(
void
)
makeFocused
{
NSArray
*
screens
;
[
NSApp
transformProcessToForeground
];
/* If a borderless window is offscreen, orderFront: won't move
it onscreen like it would for a titled window. Do that ourselves. */
screens
=
[
NSScreen
screens
];
if
(
!
([
self
styleMask
]
&
NSTitledWindowMask
)
&&
!
[
self
isVisible
]
&&
!
frame_intersects_screens
([
self
frame
],
screens
))
{
NSScreen
*
primaryScreen
=
[
screens
objectAtIndex
:
0
];
NSRect
frame
=
[
primaryScreen
frame
];
[
self
setFrameTopLeftPoint
:
NSMakePoint
(
NSMinX
(
frame
),
NSMaxY
(
frame
))];
frame
=
[
self
constrainFrameRect
:[
self
frame
]
toScreen
:
primaryScreen
];
[
self
setFrame
:
frame
display
:
YES
];
}
[
self
orderFront
:
nil
];
causing_becomeKeyWindow
=
TRUE
;
[
self
makeKeyWindow
];
causing_becomeKeyWindow
=
FALSE
;
if
(
latentParentWindow
)
{
[
latentParentWindow
addChildWindow
:
self
ordered
:
NSWindowAbove
];
self
.
latentParentWindow
=
nil
;
}
if
(
!
[
self
isExcludedFromWindowsMenu
])
[
NSApp
addWindowsItem
:
self
title
:[
self
title
]
filename
:
NO
];
/* Cocoa may adjust the frame when the window is ordered onto the screen.
Generate a frame-changed event just in case. The back end will ignore
it if nothing actually changed. */
[
self
windowDidResize
:
nil
];
}
/*
* ---------- NSWindow method overrides ----------
*/
-
(
BOOL
)
canBecomeKeyWindow
{
if
(
causing_becomeKeyWindow
)
return
YES
;
if
(
self
.
disabled
||
self
.
noActivate
)
return
NO
;
return
YES
;
return
[
self
isKeyWindow
]
;
}
-
(
BOOL
)
canBecomeMainWindow
...
...
@@ -841,3 +879,19 @@ void macdrv_window_use_per_pixel_alpha(macdrv_window w, int use_per_pixel_alpha)
[
pool
release
];
}
/***********************************************************************
* macdrv_give_cocoa_window_focus
*
* Makes the Cocoa window "key" (gives it keyboard focus). This also
* orders it front and, if its frame was not within the desktop bounds,
* Cocoa will typically move it on-screen.
*/
void
macdrv_give_cocoa_window_focus
(
macdrv_window
w
)
{
WineWindow
*
window
=
(
WineWindow
*
)
w
;
OnMainThread
(
^
{
[
window
makeFocused
];
});
}
dlls/winemac.drv/macdrv_cocoa.h
View file @
6cde62ac
...
...
@@ -205,5 +205,6 @@ extern void macdrv_set_window_color_key(macdrv_window w, CGFloat keyRed, CGFloat
CGFloat
keyBlue
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_clear_window_color_key
(
macdrv_window
w
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_window_use_per_pixel_alpha
(
macdrv_window
w
,
int
use_per_pixel_alpha
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_give_cocoa_window_focus
(
macdrv_window
w
)
DECLSPEC_HIDDEN
;
#endif
/* __WINE_MACDRV_COCOA_H */
dlls/winemac.drv/window.c
View file @
6cde62ac
...
...
@@ -43,6 +43,9 @@ static CRITICAL_SECTION win_data_section = { &critsect_debug, -1, 0, 0, 0, 0 };
static
CFMutableDictionaryRef
win_datas
;
void
CDECL
macdrv_SetFocus
(
HWND
hwnd
);
/***********************************************************************
* get_cocoa_window_features
*/
...
...
@@ -154,6 +157,12 @@ static void show_window(struct macdrv_win_data *data)
TRACE
(
"win %p/%p
\n
"
,
data
->
hwnd
,
data
->
cocoa_window
);
data
->
on_screen
=
macdrv_order_cocoa_window
(
data
->
cocoa_window
,
NULL
,
NULL
);
if
(
data
->
on_screen
)
{
HWND
hwndFocus
=
GetFocus
();
if
(
hwndFocus
&&
(
data
->
hwnd
==
hwndFocus
||
IsChild
(
data
->
hwnd
,
hwndFocus
)))
macdrv_SetFocus
(
hwndFocus
);
}
}
...
...
@@ -820,6 +829,31 @@ void CDECL macdrv_DestroyWindow(HWND hwnd)
}
/*****************************************************************
* SetFocus (MACDRV.@)
*
* Set the Mac focus.
*/
void
CDECL
macdrv_SetFocus
(
HWND
hwnd
)
{
struct
macdrv_win_data
*
data
;
TRACE
(
"%p
\n
"
,
hwnd
);
if
(
!
(
hwnd
=
GetAncestor
(
hwnd
,
GA_ROOT
)))
return
;
if
(
!
(
data
=
get_win_data
(
hwnd
)))
return
;
if
(
data
->
cocoa_window
)
{
/* Set Mac focus */
macdrv_give_cocoa_window_focus
(
data
->
cocoa_window
);
data
->
on_screen
=
TRUE
;
}
release_win_data
(
data
);
}
/***********************************************************************
* SetLayeredWindowAttributes (MACDRV.@)
*
...
...
dlls/winemac.drv/winemac.drv.spec
View file @
6cde62ac
...
...
@@ -10,6 +10,7 @@
@ cdecl EnumDisplayMonitors(long ptr ptr long) macdrv_EnumDisplayMonitors
@ cdecl GetMonitorInfo(long ptr) macdrv_GetMonitorInfo
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) macdrv_MsgWaitForMultipleObjectsEx
@ cdecl SetFocus(long) macdrv_SetFocus
@ cdecl SetLayeredWindowAttributes(long long long long) macdrv_SetLayeredWindowAttributes
@ cdecl SetParent(long long long) macdrv_SetParent
@ cdecl SetWindowRgn(long long long) macdrv_SetWindowRgn
...
...
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