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
ed367c50
Commit
ed367c50
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: Implement a WINDOW_CLOSE_REQUESTED event to allow closing windows.
parent
4e83d2fc
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
1 deletion
+77
-1
cocoa_window.m
dlls/winemac.drv/cocoa_window.m
+4
-0
event.c
dlls/winemac.drv/event.c
+15
-1
macdrv.h
dlls/winemac.drv/macdrv.h
+2
-0
macdrv_cocoa.h
dlls/winemac.drv/macdrv_cocoa.h
+5
-0
macdrv_main.c
dlls/winemac.drv/macdrv_main.c
+2
-0
window.c
dlls/winemac.drv/window.c
+49
-0
No files found.
dlls/winemac.drv/cocoa_window.m
View file @
ed367c50
...
@@ -437,6 +437,10 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
...
@@ -437,6 +437,10 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
*/
*/
-
(
BOOL
)
windowShouldClose
:
(
id
)
sender
-
(
BOOL
)
windowShouldClose
:
(
id
)
sender
{
{
macdrv_event
event
;
event
.
type
=
WINDOW_CLOSE_REQUESTED
;
event
.
window
=
(
macdrv_window
)[
self
retain
];
[
queue
postEvent
:
&
event
];
return
NO
;
return
NO
;
}
}
...
...
dlls/winemac.drv/event.c
View file @
ed367c50
...
@@ -31,6 +31,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(event);
...
@@ -31,6 +31,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(event);
/* return the name of an Mac event */
/* return the name of an Mac event */
static
const
char
*
dbgstr_event
(
int
type
)
static
const
char
*
dbgstr_event
(
int
type
)
{
{
static
const
char
*
const
event_names
[]
=
{
"WINDOW_CLOSE_REQUESTED"
,
};
if
(
0
<=
type
&&
type
<
NUM_EVENT_TYPES
)
return
event_names
[
type
];
return
wine_dbg_sprintf
(
"Unknown event %d"
,
type
);
return
wine_dbg_sprintf
(
"Unknown event %d"
,
type
);
}
}
...
@@ -40,8 +45,14 @@ static const char *dbgstr_event(int type)
...
@@ -40,8 +45,14 @@ static const char *dbgstr_event(int type)
*/
*/
static
macdrv_event_mask
get_event_mask
(
DWORD
mask
)
static
macdrv_event_mask
get_event_mask
(
DWORD
mask
)
{
{
macdrv_event_mask
event_mask
=
0
;
if
((
mask
&
QS_ALLINPUT
)
==
QS_ALLINPUT
)
return
-
1
;
if
((
mask
&
QS_ALLINPUT
)
==
QS_ALLINPUT
)
return
-
1
;
return
0
;
if
(
mask
&
QS_POSTMESSAGE
)
event_mask
|=
event_mask_for_type
(
WINDOW_CLOSE_REQUESTED
);
return
event_mask
;
}
}
...
@@ -62,6 +73,9 @@ void macdrv_handle_event(macdrv_event *event)
...
@@ -62,6 +73,9 @@ void macdrv_handle_event(macdrv_event *event)
switch
(
event
->
type
)
switch
(
event
->
type
)
{
{
case
WINDOW_CLOSE_REQUESTED
:
macdrv_window_close_requested
(
hwnd
);
break
;
default:
default:
TRACE
(
" ignoring
\n
"
);
TRACE
(
" ignoring
\n
"
);
break
;
break
;
...
...
dlls/winemac.drv/macdrv.h
View file @
ed367c50
...
@@ -117,4 +117,6 @@ extern struct window_surface *create_surface(macdrv_window window, const RECT *r
...
@@ -117,4 +117,6 @@ extern struct window_surface *create_surface(macdrv_window window, const RECT *r
extern
void
set_window_surface
(
macdrv_window
window
,
struct
window_surface
*
window_surface
)
DECLSPEC_HIDDEN
;
extern
void
set_window_surface
(
macdrv_window
window
,
struct
window_surface
*
window_surface
)
DECLSPEC_HIDDEN
;
extern
void
set_surface_use_alpha
(
struct
window_surface
*
window_surface
,
BOOL
use_alpha
)
DECLSPEC_HIDDEN
;
extern
void
set_surface_use_alpha
(
struct
window_surface
*
window_surface
,
BOOL
use_alpha
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_window_close_requested
(
HWND
hwnd
)
DECLSPEC_HIDDEN
;
#endif
/* __WINE_MACDRV_H */
#endif
/* __WINE_MACDRV_H */
dlls/winemac.drv/macdrv_cocoa.h
View file @
ed367c50
...
@@ -121,6 +121,11 @@ extern void macdrv_free_displays(struct macdrv_display* displays) DECLSPEC_HIDDE
...
@@ -121,6 +121,11 @@ extern void macdrv_free_displays(struct macdrv_display* displays) DECLSPEC_HIDDE
/* event */
/* event */
enum
{
WINDOW_CLOSE_REQUESTED
,
NUM_EVENT_TYPES
};
typedef
uint32_t
macdrv_event_mask
;
typedef
uint32_t
macdrv_event_mask
;
typedef
struct
macdrv_event
{
typedef
struct
macdrv_event
{
...
...
dlls/winemac.drv/macdrv_main.c
View file @
ed367c50
...
@@ -35,6 +35,8 @@ DWORD thread_data_tls_index = TLS_OUT_OF_INDEXES;
...
@@ -35,6 +35,8 @@ DWORD thread_data_tls_index = TLS_OUT_OF_INDEXES;
*/
*/
static
BOOL
process_attach
(
void
)
static
BOOL
process_attach
(
void
)
{
{
assert
(
NUM_EVENT_TYPES
<=
sizeof
(
macdrv_event_mask
)
*
8
);
if
((
thread_data_tls_index
=
TlsAlloc
())
==
TLS_OUT_OF_INDEXES
)
return
FALSE
;
if
((
thread_data_tls_index
=
TlsAlloc
())
==
TLS_OUT_OF_INDEXES
)
return
FALSE
;
macdrv_err_on
=
ERR_ON
(
macdrv
);
macdrv_err_on
=
ERR_ON
(
macdrv
);
...
...
dlls/winemac.drv/window.c
View file @
ed367c50
...
@@ -1230,3 +1230,52 @@ void CDECL macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags,
...
@@ -1230,3 +1230,52 @@ void CDECL macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags,
done:
done:
release_win_data
(
data
);
release_win_data
(
data
);
}
}
/***********************************************************************
* macdrv_window_close_requested
*
* Handler for WINDOW_CLOSE_REQUESTED events.
*/
void
macdrv_window_close_requested
(
HWND
hwnd
)
{
/* Ignore the delete window request if the window has been disabled. This
* is to disallow applications from being closed while in a modal state.
*/
if
(
IsWindowEnabled
(
hwnd
))
{
HMENU
hSysMenu
;
if
(
GetClassLongW
(
hwnd
,
GCL_STYLE
)
&
CS_NOCLOSE
)
return
;
hSysMenu
=
GetSystemMenu
(
hwnd
,
FALSE
);
if
(
hSysMenu
)
{
UINT
state
=
GetMenuState
(
hSysMenu
,
SC_CLOSE
,
MF_BYCOMMAND
);
if
(
state
==
0xFFFFFFFF
||
(
state
&
(
MF_DISABLED
|
MF_GRAYED
)))
return
;
}
if
(
GetActiveWindow
()
!=
hwnd
)
{
LRESULT
ma
=
SendMessageW
(
hwnd
,
WM_MOUSEACTIVATE
,
(
WPARAM
)
GetAncestor
(
hwnd
,
GA_ROOT
),
MAKELPARAM
(
HTCLOSE
,
WM_NCLBUTTONDOWN
));
switch
(
ma
)
{
case
MA_NOACTIVATEANDEAT
:
case
MA_ACTIVATEANDEAT
:
return
;
case
MA_NOACTIVATE
:
break
;
case
MA_ACTIVATE
:
case
0
:
SetActiveWindow
(
hwnd
);
break
;
default:
WARN
(
"unknown WM_MOUSEACTIVATE code %d
\n
"
,
(
int
)
ma
);
break
;
}
}
PostMessageW
(
hwnd
,
WM_SYSCOMMAND
,
SC_CLOSE
,
0
);
}
}
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