Jacek Caban : winemac: Directly use win32u in more places.
Alexandre Julliard
julliard at winehq.org
Mon May 23 15:51:51 CDT 2022
Module: wine
Branch: master
Commit: 169a09b443fc193a73fd87f0a07447f969e30b9a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=169a09b443fc193a73fd87f0a07447f969e30b9a
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri May 20 21:09:17 2022 +0200
winemac: Directly use win32u in more places.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/winemac.drv/image.c | 6 +++---
dlls/winemac.drv/keyboard.c | 4 ++--
dlls/winemac.drv/macdrv.h | 7 +++++++
dlls/winemac.drv/macdrv_main.c | 2 +-
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/dlls/winemac.drv/image.c b/dlls/winemac.drv/image.c
index d501b27a3c3..943ad97b749 100644
--- a/dlls/winemac.drv/image.c
+++ b/dlls/winemac.drv/image.c
@@ -70,7 +70,7 @@ CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP hbmCol
/* draw the cursor frame to a temporary buffer then create a CGImage from that */
memset(color_bits, 0x00, color_size);
NtGdiSelectBitmap(hdc, hbmColor);
- if (!DrawIconEx(hdc, 0, 0, icon, width, height, istep, NULL, DI_NORMAL))
+ if (!NtUserDrawIconEx(hdc, 0, 0, icon, width, height, istep, NULL, DI_NORMAL))
{
WARN("Could not draw frame %d (walk past end of frames).\n", istep);
return NULL;
@@ -129,7 +129,7 @@ CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP hbmCol
/* draw the cursor mask to a temporary buffer */
memset(mask_bits, 0xFF, mask_size);
NtGdiSelectBitmap(hdc, hbmMask);
- if (!DrawIconEx(hdc, 0, 0, icon, width, height, istep, NULL, DI_MASK))
+ if (!NtUserDrawIconEx(hdc, 0, 0, icon, width, height, istep, NULL, DI_MASK))
{
WARN("Failed to draw frame mask %d.\n", istep);
CGImageRelease(cgimage);
@@ -199,7 +199,7 @@ CGImageRef create_cgimage_from_icon(HANDLE icon, int width, int height)
ICONINFO info;
BITMAP bm;
- if (!GetIconInfo(icon, &info))
+ if (!NtUserGetIconInfo(icon, &info, NULL, NULL, NULL, 0))
return NULL;
NtGdiExtGetObjectW(info.hbmMask, sizeof(bm), &bm);
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c
index 79f208edfc8..9dca17e5c4e 100644
--- a/dlls/winemac.drv/keyboard.c
+++ b/dlls/winemac.drv/keyboard.c
@@ -1045,9 +1045,9 @@ void macdrv_keyboard_changed(const macdrv_event *event)
macdrv_compute_keyboard_layout(thread_data);
- ActivateKeyboardLayout(thread_data->active_keyboard_layout, 0);
+ NtUserActivateKeyboardLayout(thread_data->active_keyboard_layout, 0);
- SendMessageW(GetActiveWindow(), WM_CANCELMODE, 0, 0);
+ send_message(get_active_window(), WM_CANCELMODE, 0, 0);
}
diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h
index 2cac6acf4f3..5cde6667a46 100644
--- a/dlls/winemac.drv/macdrv.h
+++ b/dlls/winemac.drv/macdrv.h
@@ -302,6 +302,13 @@ static inline LRESULT send_message(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
return NtUserMessageCall(hwnd, msg, wparam, lparam, NULL, NtUserSendMessage, FALSE);
}
+static inline HWND get_active_window(void)
+{
+ GUITHREADINFO info;
+ info.cbSize = sizeof(info);
+ return NtUserGetGUIThreadInfo(GetCurrentThreadId(), &info) ? info.hwndActive : 0;
+}
+
/* registry helpers */
extern HKEY open_hkcu_key( const char *name ) DECLSPEC_HIDDEN;
diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c
index f7b530f50a7..2f05e55cb23 100644
--- a/dlls/winemac.drv/macdrv_main.c
+++ b/dlls/winemac.drv/macdrv_main.c
@@ -558,7 +558,7 @@ struct macdrv_thread_data *macdrv_init_thread_data(void)
set_queue_display_fd(macdrv_get_event_queue_fd(data->queue));
TlsSetValue(thread_data_tls_index, data);
- ActivateKeyboardLayout(data->active_keyboard_layout, 0);
+ NtUserActivateKeyboardLayout(data->active_keyboard_layout, 0);
return data;
}
More information about the wine-cvs
mailing list