Commit 1b69aae3 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winemac: Use platform-independent types for user callback params.

parent 4467589a
......@@ -245,7 +245,7 @@ static BOOL CALLBACK get_first_resource(HMODULE module, LPCWSTR type, LPWSTR nam
static NTSTATUS WINAPI macdrv_app_icon(void *arg, ULONG size)
{
struct app_icon_params *params = arg;
struct app_icon_result *result = params->result;
struct app_icon_result *result = param_ptr(params->result);
HRSRC res_info;
HGLOBAL res_data;
GRPICONDIR *icon_dir;
......@@ -337,17 +337,18 @@ static NTSTATUS WINAPI macdrv_app_icon(void *arg, ULONG size)
if (!memcmp(icon_bits, png_magic, sizeof(png_magic)))
{
entry->png = icon_bits;
entry->png = (UINT_PTR)icon_bits;
entry->icon = 0;
result->count++;
}
else
{
entry->icon = CreateIconFromResourceEx(icon_bits, icon_dir->idEntries[i].dwBytesInRes,
HICON icon = CreateIconFromResourceEx(icon_bits, icon_dir->idEntries[i].dwBytesInRes,
TRUE, 0x00030000, width, height, 0);
if (entry->icon)
if (icon)
{
entry->png = NULL;
entry->icon = HandleToUlong(icon);
entry->png = 0;
result->count++;
}
else
......
......@@ -428,7 +428,7 @@ NTSTATUS WINAPI macdrv_dnd_query_drop(void *arg, ULONG size)
BOOL ret = FALSE;
POINT pt;
TRACE("win %p x,y %d,%d effect %x pasteboard %s\n", params->hwnd, params->x, params->y,
TRACE("win %x x,y %d,%d effect %x pasteboard %s\n", params->hwnd, params->x, params->y,
params->effect, wine_dbgstr_longlong(params->handle));
pt.x = params->x;
......@@ -511,7 +511,7 @@ NTSTATUS WINAPI macdrv_dnd_query_drop(void *arg, ULONG size)
NTSTATUS WINAPI macdrv_dnd_query_exited(void *arg, ULONG size)
{
struct dnd_query_exited_params *params = arg;
HWND hwnd = params->hwnd;
HWND hwnd = UlongToHandle(params->hwnd);
IDropTarget *droptarget;
TRACE("win %p\n", hwnd);
......@@ -542,7 +542,7 @@ NTSTATUS WINAPI macdrv_dnd_query_exited(void *arg, ULONG size)
NTSTATUS WINAPI macdrv_dnd_query_drag(void *arg, ULONG size)
{
struct dnd_query_drag_params *params = arg;
HWND hwnd = params->hwnd;
HWND hwnd = UlongToHandle(params->hwnd);
BOOL ret = FALSE;
POINT pt;
DWORD effect;
......
......@@ -162,8 +162,8 @@ static void macdrv_im_set_text(const macdrv_event *event)
size = offsetof(struct ime_set_text_params, text[length]);
if (!(params = malloc(size))) return;
params->hwnd = hwnd;
params->data = event->im_set_text.data;
params->hwnd = HandleToUlong(hwnd);
params->data = (UINT_PTR)event->im_set_text.data;
params->cursor_pos = event->im_set_text.cursor_pos;
params->complete = event->im_set_text.complete;
......@@ -229,7 +229,7 @@ static BOOL query_drag_drop(macdrv_query *query)
return FALSE;
}
params.hwnd = hwnd;
params.hwnd = HandleToUlong(hwnd);
params.effect = drag_operations_to_dropeffects(query->drag_drop.op);
params.x = query->drag_drop.x + data->whole_rect.left;
params.y = query->drag_drop.y + data->whole_rect.top;
......@@ -244,7 +244,7 @@ static BOOL query_drag_drop(macdrv_query *query)
static BOOL query_drag_exited(macdrv_query *query)
{
struct dnd_query_exited_params params;
params.hwnd = macdrv_get_window_hwnd(query->window);
params.hwnd = HandleToUlong(macdrv_get_window_hwnd(query->window));
return macdrv_client_func(client_func_dnd_query_exited, &params, sizeof(params));
}
......@@ -265,7 +265,7 @@ static BOOL query_drag_operation(macdrv_query *query)
return FALSE;
}
params.hwnd = hwnd;
params.hwnd = HandleToUlong(hwnd);
params.effect = drag_operations_to_dropeffects(query->drag_operation.offered_ops);
params.x = query->drag_operation.x + data->whole_rect.left;
params.y = query->drag_operation.y + data->whole_rect.top;
......@@ -297,9 +297,9 @@ BOOL query_ime_char_rect(macdrv_query* query)
TRACE_(imm)("win %p/%p himc %p range %ld-%ld\n", hwnd, query->window, himc, range->location,
range->length);
params.hwnd = hwnd;
params.data = himc;
params.result = &result;
params.hwnd = HandleToUlong(hwnd);
params.data = (UINT_PTR)himc;
params.result = (UINT_PTR)&result;
params.location = range->location;
params.length = range->length;
ret = macdrv_client_func(client_func_ime_query_char_rect, &params, sizeof(params));
......
......@@ -250,7 +250,7 @@ cleanup:
CFArrayRef create_app_icon_images(void)
{
struct app_icon_result icons;
struct app_icon_params params = { .result = &icons };
struct app_icon_params params = { .result = (UINT_PTR)&icons };
CFMutableArrayRef images = NULL;
int i;
......@@ -274,7 +274,7 @@ CFArrayRef create_app_icon_images(void)
if (icon->png)
{
CFDataRef data = CFDataCreate(NULL, icon->png, icon->size);
CFDataRef data = CFDataCreate(NULL, param_ptr(icon->png), icon->size);
if (data)
{
CGDataProviderRef provider = CGDataProviderCreateWithCFData(data);
......@@ -289,8 +289,9 @@ CFArrayRef create_app_icon_images(void)
}
else
{
cgimage = create_cgimage_from_icon(icon->icon, icon->width, icon->height);
NtUserDestroyCursor(icon->icon, 0);
HICON handle = UlongToHandle(icon->icon);
cgimage = create_cgimage_from_icon(handle, icon->width, icon->height);
NtUserDestroyCursor(handle, 0);
}
if (cgimage)
......
......@@ -1397,7 +1397,8 @@ NTSTATUS WINAPI macdrv_ime_set_text(void *arg, ULONG size)
{
struct ime_set_text_params *params = arg;
ULONG length = (size - offsetof(struct ime_set_text_params, text)) / sizeof(WCHAR);
void *himc = params->data;
void *himc = param_ptr(params->data);
HWND hwnd = UlongToHandle(params->hwnd);
if (!himc) himc = RealIMC(FROM_MACDRV);
......@@ -1420,10 +1421,10 @@ NTSTATUS WINAPI macdrv_ime_set_text(void *arg, ULONG size)
{
input.ki.wScan = params->text[i];
input.ki.dwFlags = KEYEVENTF_UNICODE;
__wine_send_input(params->hwnd, &input, NULL);
__wine_send_input(hwnd, &input, NULL);
input.ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP;
__wine_send_input(params->hwnd, &input, NULL);
__wine_send_input(hwnd, &input, NULL);
}
}
}
......@@ -1439,8 +1440,8 @@ NTSTATUS WINAPI macdrv_ime_set_text(void *arg, ULONG size)
NTSTATUS WINAPI macdrv_ime_query_char_rect(void *arg, ULONG size)
{
struct ime_query_char_rect_params *params = arg;
struct ime_query_char_rect_result *result = params->result;
void *himc = params->data;
struct ime_query_char_rect_result *result = param_ptr(params->result);
void *himc = param_ptr(params->data);
IMECHARPOSITION charpos;
BOOL ret = FALSE;
......
......@@ -117,8 +117,8 @@ struct app_icon_entry
UINT32 width;
UINT32 height;
UINT32 size;
void *png;
HICON icon;
UINT32 icon;
UINT64 png;
};
struct app_icon_result
......@@ -130,7 +130,7 @@ struct app_icon_result
/* macdrv_app_icon params */
struct app_icon_params
{
struct app_icon_result *result; /* FIXME: Use NtCallbackReturn instead */
UINT64 result; /* FIXME: Use NtCallbackReturn instead */
};
/* macdrv_app_quit_request params */
......@@ -142,7 +142,7 @@ struct app_quit_request_params
/* macdrv_dnd_query_drag params */
struct dnd_query_drag_params
{
HWND hwnd;
UINT32 hwnd;
UINT32 effect;
INT32 x;
INT32 y;
......@@ -152,7 +152,7 @@ struct dnd_query_drag_params
/* macdrv_dnd_query_drop params */
struct dnd_query_drop_params
{
HWND hwnd;
UINT32 hwnd;
UINT32 effect;
INT32 x;
INT32 y;
......@@ -162,7 +162,7 @@ struct dnd_query_drop_params
/* macdrv_dnd_query_exited params */
struct dnd_query_exited_params
{
HWND hwnd;
UINT32 hwnd;
};
/* macdrv_ime_query_char_rect result */
......@@ -176,21 +176,26 @@ struct ime_query_char_rect_result
/* macdrv_ime_query_char_rect params */
struct ime_query_char_rect_params
{
HWND hwnd;
void *data;
UINT32 hwnd;
UINT32 location;
UINT64 data;
UINT64 result; /* FIXME: Use NtCallbackReturn instead */
UINT32 length;
struct ime_query_char_rect_result *result; /* FIXME: Use NtCallbackReturn instead */
};
/* macdrv_ime_set_text params */
struct ime_set_text_params
{
HWND hwnd;
void *data;
UINT32 hwnd;
UINT32 cursor_pos;
UINT64 data;
UINT32 complete;
WCHAR text[1];
};
static inline void *param_ptr(UINT64 param)
{
return (void *)(UINT_PTR)param;
}
C_ASSERT(client_func_last <= NtUserDriverCallbackLast + 1);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment