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
bc75a9ba
Commit
bc75a9ba
authored
Feb 17, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
Feb 18, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Implement DISPLAYS_CHANGED event for when display configuration has changed.
parent
be6af9a1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
133 additions
and
2 deletions
+133
-2
cocoa_app.m
dlls/winemac.drv/cocoa_app.m
+15
-0
display.c
dlls/winemac.drv/display.c
+64
-1
event.c
dlls/winemac.drv/event.c
+5
-0
gdi.c
dlls/winemac.drv/gdi.c
+9
-1
macdrv.h
dlls/winemac.drv/macdrv.h
+6
-0
macdrv_cocoa.h
dlls/winemac.drv/macdrv_cocoa.h
+1
-0
window.c
dlls/winemac.drv/window.c
+33
-0
No files found.
dlls/winemac.drv/cocoa_app.m
View file @
bc75a9ba
...
...
@@ -312,6 +312,20 @@ int macdrv_err_on;
}
}
-
(
void
)
sendDisplaysChanged
{
macdrv_event
event
;
WineEventQueue
*
queue
;
event
.
type
=
DISPLAYS_CHANGED
;
event
.
window
=
NULL
;
[
eventQueuesLock
lock
];
for
(
queue
in
eventQueues
)
[
queue
postEvent
:
&
event
];
[
eventQueuesLock
unlock
];
}
/*
* ---------- NSApplication method overrides ----------
...
...
@@ -340,6 +354,7 @@ int macdrv_err_on;
-
(
void
)
applicationDidChangeScreenParameters
:
(
NSNotification
*
)
notification
{
primaryScreenHeightValid
=
FALSE
;
[
self
sendDisplaysChanged
];
}
-
(
void
)
applicationDidResignActive
:
(
NSNotification
*
)
notification
...
...
dlls/winemac.drv/display.c
View file @
bc75a9ba
...
...
@@ -2,7 +2,7 @@
* MACDRV display settings
*
* Copyright 2003 Alexander James Pasadyn
* Copyright 2011, 2012 Ken Thomases for CodeWeavers Inc.
* Copyright 2011, 2012
, 2013
Ken Thomases for CodeWeavers Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -38,6 +38,42 @@ static inline CGDirectDisplayID monitor_to_display_id(HMONITOR handle)
}
static
int
display_mode_bits_per_pixel
(
CGDisplayModeRef
display_mode
)
{
CFStringRef
pixel_encoding
;
int
bits_per_pixel
=
0
;
pixel_encoding
=
CGDisplayModeCopyPixelEncoding
(
display_mode
);
if
(
pixel_encoding
)
{
if
(
CFEqual
(
pixel_encoding
,
CFSTR
(
kIO32BitFloatPixels
)))
bits_per_pixel
=
128
;
else
if
(
CFEqual
(
pixel_encoding
,
CFSTR
(
kIO16BitFloatPixels
)))
bits_per_pixel
=
64
;
else
if
(
CFEqual
(
pixel_encoding
,
CFSTR
(
kIO64BitDirectPixels
)))
bits_per_pixel
=
64
;
else
if
(
CFEqual
(
pixel_encoding
,
CFSTR
(
kIO30BitDirectPixels
)))
bits_per_pixel
=
30
;
else
if
(
CFEqual
(
pixel_encoding
,
CFSTR
(
IO32BitDirectPixels
)))
bits_per_pixel
=
32
;
else
if
(
CFEqual
(
pixel_encoding
,
CFSTR
(
IO16BitDirectPixels
)))
bits_per_pixel
=
16
;
else
if
(
CFEqual
(
pixel_encoding
,
CFSTR
(
IO8BitIndexedPixels
)))
bits_per_pixel
=
8
;
else
if
(
CFEqual
(
pixel_encoding
,
CFSTR
(
IO4BitIndexedPixels
)))
bits_per_pixel
=
4
;
else
if
(
CFEqual
(
pixel_encoding
,
CFSTR
(
IO2BitIndexedPixels
)))
bits_per_pixel
=
2
;
else
if
(
CFEqual
(
pixel_encoding
,
CFSTR
(
IO1BitIndexedPixels
)))
bits_per_pixel
=
1
;
CFRelease
(
pixel_encoding
);
}
return
bits_per_pixel
;
}
/***********************************************************************
* EnumDisplayMonitors (MACDRV.@)
*/
...
...
@@ -156,3 +192,30 @@ BOOL CDECL macdrv_GetMonitorInfo(HMONITOR monitor, LPMONITORINFO info)
macdrv_free_displays
(
displays
);
return
(
i
<
num_displays
);
}
/***********************************************************************
* macdrv_displays_changed
*
* Handler for DISPLAYS_CHANGED events.
*/
void
macdrv_displays_changed
(
const
macdrv_event
*
event
)
{
HWND
hwnd
=
GetDesktopWindow
();
/* A system display change will get delivered to all GUI-attached threads,
so the desktop-window-owning thread will get it and all others should
ignore it. */
if
(
GetWindowThreadProcessId
(
hwnd
,
NULL
)
==
GetCurrentThreadId
())
{
CGDirectDisplayID
mainDisplay
=
CGMainDisplayID
();
CGDisplayModeRef
mode
=
CGDisplayCopyDisplayMode
(
mainDisplay
);
size_t
width
=
CGDisplayModeGetWidth
(
mode
);
size_t
height
=
CGDisplayModeGetHeight
(
mode
);
int
mode_bpp
=
display_mode_bits_per_pixel
(
mode
);
CGDisplayModeRelease
(
mode
);
SendMessageW
(
hwnd
,
WM_MACDRV_UPDATE_DESKTOP_RECT
,
mode_bpp
,
MAKELPARAM
(
width
,
height
));
}
}
dlls/winemac.drv/event.c
View file @
bc75a9ba
...
...
@@ -33,6 +33,7 @@ static const char *dbgstr_event(int type)
{
static
const
char
*
const
event_names
[]
=
{
"APP_DEACTIVATED"
,
"DISPLAYS_CHANGED"
,
"KEY_PRESS"
,
"KEY_RELEASE"
,
"KEYBOARD_CHANGED"
,
...
...
@@ -84,6 +85,7 @@ static macdrv_event_mask get_event_mask(DWORD mask)
if
(
mask
&
QS_POSTMESSAGE
)
{
event_mask
|=
event_mask_for_type
(
APP_DEACTIVATED
);
event_mask
|=
event_mask_for_type
(
DISPLAYS_CHANGED
);
event_mask
|=
event_mask_for_type
(
WINDOW_CLOSE_REQUESTED
);
event_mask
|=
event_mask_for_type
(
WINDOW_DID_MINIMIZE
);
event_mask
|=
event_mask_for_type
(
WINDOW_DID_UNMINIMIZE
);
...
...
@@ -116,6 +118,9 @@ void macdrv_handle_event(macdrv_event *event)
case
APP_DEACTIVATED
:
macdrv_app_deactivated
();
break
;
case
DISPLAYS_CHANGED
:
macdrv_displays_changed
(
event
);
break
;
case
KEY_PRESS
:
case
KEY_RELEASE
:
macdrv_key_event
(
hwnd
,
event
);
...
...
dlls/winemac.drv/gdi.c
View file @
bc75a9ba
...
...
@@ -2,7 +2,7 @@
* Mac graphics driver initialisation functions
*
* Copyright 1996 Alexandre Julliard
* Copyright 2011, 2012 Ken Thomases for CodeWeavers, Inc.
* Copyright 2011, 2012
, 2013
Ken Thomases for CodeWeavers, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -200,6 +200,14 @@ static void device_init(void)
}
void
macdrv_reset_device_metrics
(
void
)
{
EnterCriticalSection
(
&
device_data_section
);
device_data_valid
=
FALSE
;
LeaveCriticalSection
(
&
device_data_section
);
}
static
MACDRV_PDEVICE
*
create_mac_physdev
(
void
)
{
MACDRV_PDEVICE
*
physDev
;
...
...
dlls/winemac.drv/macdrv.h
View file @
bc75a9ba
...
...
@@ -68,6 +68,7 @@ static inline const char *wine_dbgstr_cgrect(CGRect cgrect)
*/
extern
CGRect
macdrv_get_desktop_rect
(
void
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_reset_device_metrics
(
void
)
DECLSPEC_HIDDEN
;
/**************************************************************************
...
...
@@ -78,6 +79,9 @@ extern CGRect macdrv_get_desktop_rect(void) DECLSPEC_HIDDEN;
enum
macdrv_window_messages
{
WM_MACDRV_SET_WIN_REGION
=
0x80001000
,
WM_MACDRV_UPDATE_DESKTOP_RECT
,
WM_MACDRV_RESET_DEVICE_METRICS
,
WM_MACDRV_DISPLAYCHANGE
,
};
struct
macdrv_thread_data
...
...
@@ -142,4 +146,6 @@ extern void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_dat
extern
void
macdrv_keyboard_changed
(
const
macdrv_event
*
event
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_key_event
(
HWND
hwnd
,
const
macdrv_event
*
event
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_displays_changed
(
const
macdrv_event
*
event
)
DECLSPEC_HIDDEN
;
#endif
/* __WINE_MACDRV_H */
dlls/winemac.drv/macdrv_cocoa.h
View file @
bc75a9ba
...
...
@@ -126,6 +126,7 @@ extern void macdrv_free_displays(struct macdrv_display* displays) DECLSPEC_HIDDE
/* event */
enum
{
APP_DEACTIVATED
,
DISPLAYS_CHANGED
,
KEY_PRESS
,
KEY_RELEASE
,
KEYBOARD_CHANGED
,
...
...
dlls/winemac.drv/window.c
View file @
bc75a9ba
...
...
@@ -1192,6 +1192,39 @@ LRESULT CDECL macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
release_win_data
(
data
);
}
return
0
;
case
WM_MACDRV_UPDATE_DESKTOP_RECT
:
if
(
hwnd
==
GetDesktopWindow
())
{
CGRect
new_desktop_rect
;
RECT
current_desktop_rect
;
macdrv_reset_device_metrics
();
new_desktop_rect
=
macdrv_get_desktop_rect
();
if
(
!
GetWindowRect
(
hwnd
,
&
current_desktop_rect
)
||
!
CGRectEqualToRect
(
cgrect_from_rect
(
current_desktop_rect
),
new_desktop_rect
))
{
SendMessageTimeoutW
(
HWND_BROADCAST
,
WM_MACDRV_RESET_DEVICE_METRICS
,
0
,
0
,
SMTO_ABORTIFHUNG
,
2000
,
NULL
);
SetWindowPos
(
hwnd
,
0
,
CGRectGetMinX
(
new_desktop_rect
),
CGRectGetMinY
(
new_desktop_rect
),
CGRectGetWidth
(
new_desktop_rect
),
CGRectGetHeight
(
new_desktop_rect
),
SWP_NOZORDER
|
SWP_NOACTIVATE
|
SWP_DEFERERASE
);
SendMessageTimeoutW
(
HWND_BROADCAST
,
WM_MACDRV_DISPLAYCHANGE
,
wp
,
lp
,
SMTO_ABORTIFHUNG
,
2000
,
NULL
);
}
}
return
0
;
case
WM_MACDRV_RESET_DEVICE_METRICS
:
macdrv_reset_device_metrics
();
return
0
;
case
WM_MACDRV_DISPLAYCHANGE
:
if
((
data
=
get_win_data
(
hwnd
)))
{
if
(
data
->
cocoa_window
&&
data
->
on_screen
)
sync_window_position
(
data
,
SWP_NOZORDER
|
SWP_NOACTIVATE
);
release_win_data
(
data
);
}
SendMessageW
(
hwnd
,
WM_DISPLAYCHANGE
,
wp
,
lp
);
return
0
;
}
FIXME
(
"unrecognized window msg %x hwnd %p wp %lx lp %lx
\n
"
,
msg
,
hwnd
,
wp
,
lp
);
...
...
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