mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 04:43:38 +00:00
winemac: Use platform-independent types for user callback params.
This commit is contained in:
parent
4467589a4a
commit
1b69aae3f4
|
@ -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)
|
static NTSTATUS WINAPI macdrv_app_icon(void *arg, ULONG size)
|
||||||
{
|
{
|
||||||
struct app_icon_params *params = arg;
|
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;
|
HRSRC res_info;
|
||||||
HGLOBAL res_data;
|
HGLOBAL res_data;
|
||||||
GRPICONDIR *icon_dir;
|
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)))
|
if (!memcmp(icon_bits, png_magic, sizeof(png_magic)))
|
||||||
{
|
{
|
||||||
entry->png = icon_bits;
|
entry->png = (UINT_PTR)icon_bits;
|
||||||
entry->icon = 0;
|
entry->icon = 0;
|
||||||
result->count++;
|
result->count++;
|
||||||
}
|
}
|
||||||
else
|
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);
|
TRUE, 0x00030000, width, height, 0);
|
||||||
if (entry->icon)
|
if (icon)
|
||||||
{
|
{
|
||||||
entry->png = NULL;
|
entry->icon = HandleToUlong(icon);
|
||||||
|
entry->png = 0;
|
||||||
result->count++;
|
result->count++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -428,7 +428,7 @@ NTSTATUS WINAPI macdrv_dnd_query_drop(void *arg, ULONG size)
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
POINT pt;
|
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));
|
params->effect, wine_dbgstr_longlong(params->handle));
|
||||||
|
|
||||||
pt.x = params->x;
|
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)
|
NTSTATUS WINAPI macdrv_dnd_query_exited(void *arg, ULONG size)
|
||||||
{
|
{
|
||||||
struct dnd_query_exited_params *params = arg;
|
struct dnd_query_exited_params *params = arg;
|
||||||
HWND hwnd = params->hwnd;
|
HWND hwnd = UlongToHandle(params->hwnd);
|
||||||
IDropTarget *droptarget;
|
IDropTarget *droptarget;
|
||||||
|
|
||||||
TRACE("win %p\n", hwnd);
|
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)
|
NTSTATUS WINAPI macdrv_dnd_query_drag(void *arg, ULONG size)
|
||||||
{
|
{
|
||||||
struct dnd_query_drag_params *params = arg;
|
struct dnd_query_drag_params *params = arg;
|
||||||
HWND hwnd = params->hwnd;
|
HWND hwnd = UlongToHandle(params->hwnd);
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
POINT pt;
|
POINT pt;
|
||||||
DWORD effect;
|
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]);
|
size = offsetof(struct ime_set_text_params, text[length]);
|
||||||
if (!(params = malloc(size))) return;
|
if (!(params = malloc(size))) return;
|
||||||
params->hwnd = hwnd;
|
params->hwnd = HandleToUlong(hwnd);
|
||||||
params->data = event->im_set_text.data;
|
params->data = (UINT_PTR)event->im_set_text.data;
|
||||||
params->cursor_pos = event->im_set_text.cursor_pos;
|
params->cursor_pos = event->im_set_text.cursor_pos;
|
||||||
params->complete = event->im_set_text.complete;
|
params->complete = event->im_set_text.complete;
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ static BOOL query_drag_drop(macdrv_query *query)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
params.hwnd = hwnd;
|
params.hwnd = HandleToUlong(hwnd);
|
||||||
params.effect = drag_operations_to_dropeffects(query->drag_drop.op);
|
params.effect = drag_operations_to_dropeffects(query->drag_drop.op);
|
||||||
params.x = query->drag_drop.x + data->whole_rect.left;
|
params.x = query->drag_drop.x + data->whole_rect.left;
|
||||||
params.y = query->drag_drop.y + data->whole_rect.top;
|
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)
|
static BOOL query_drag_exited(macdrv_query *query)
|
||||||
{
|
{
|
||||||
struct dnd_query_exited_params params;
|
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, ¶ms, sizeof(params));
|
return macdrv_client_func(client_func_dnd_query_exited, ¶ms, sizeof(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ static BOOL query_drag_operation(macdrv_query *query)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
params.hwnd = hwnd;
|
params.hwnd = HandleToUlong(hwnd);
|
||||||
params.effect = drag_operations_to_dropeffects(query->drag_operation.offered_ops);
|
params.effect = drag_operations_to_dropeffects(query->drag_operation.offered_ops);
|
||||||
params.x = query->drag_operation.x + data->whole_rect.left;
|
params.x = query->drag_operation.x + data->whole_rect.left;
|
||||||
params.y = query->drag_operation.y + data->whole_rect.top;
|
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,
|
TRACE_(imm)("win %p/%p himc %p range %ld-%ld\n", hwnd, query->window, himc, range->location,
|
||||||
range->length);
|
range->length);
|
||||||
|
|
||||||
params.hwnd = hwnd;
|
params.hwnd = HandleToUlong(hwnd);
|
||||||
params.data = himc;
|
params.data = (UINT_PTR)himc;
|
||||||
params.result = &result;
|
params.result = (UINT_PTR)&result;
|
||||||
params.location = range->location;
|
params.location = range->location;
|
||||||
params.length = range->length;
|
params.length = range->length;
|
||||||
ret = macdrv_client_func(client_func_ime_query_char_rect, ¶ms, sizeof(params));
|
ret = macdrv_client_func(client_func_ime_query_char_rect, ¶ms, sizeof(params));
|
||||||
|
|
|
@ -250,7 +250,7 @@ cleanup:
|
||||||
CFArrayRef create_app_icon_images(void)
|
CFArrayRef create_app_icon_images(void)
|
||||||
{
|
{
|
||||||
struct app_icon_result icons;
|
struct app_icon_result icons;
|
||||||
struct app_icon_params params = { .result = &icons };
|
struct app_icon_params params = { .result = (UINT_PTR)&icons };
|
||||||
CFMutableArrayRef images = NULL;
|
CFMutableArrayRef images = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ CFArrayRef create_app_icon_images(void)
|
||||||
|
|
||||||
if (icon->png)
|
if (icon->png)
|
||||||
{
|
{
|
||||||
CFDataRef data = CFDataCreate(NULL, icon->png, icon->size);
|
CFDataRef data = CFDataCreate(NULL, param_ptr(icon->png), icon->size);
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
CGDataProviderRef provider = CGDataProviderCreateWithCFData(data);
|
CGDataProviderRef provider = CGDataProviderCreateWithCFData(data);
|
||||||
|
@ -289,8 +289,9 @@ CFArrayRef create_app_icon_images(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cgimage = create_cgimage_from_icon(icon->icon, icon->width, icon->height);
|
HICON handle = UlongToHandle(icon->icon);
|
||||||
NtUserDestroyCursor(icon->icon, 0);
|
cgimage = create_cgimage_from_icon(handle, icon->width, icon->height);
|
||||||
|
NtUserDestroyCursor(handle, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cgimage)
|
if (cgimage)
|
||||||
|
|
|
@ -1397,7 +1397,8 @@ NTSTATUS WINAPI macdrv_ime_set_text(void *arg, ULONG size)
|
||||||
{
|
{
|
||||||
struct ime_set_text_params *params = arg;
|
struct ime_set_text_params *params = arg;
|
||||||
ULONG length = (size - offsetof(struct ime_set_text_params, text)) / sizeof(WCHAR);
|
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);
|
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.wScan = params->text[i];
|
||||||
input.ki.dwFlags = KEYEVENTF_UNICODE;
|
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;
|
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)
|
NTSTATUS WINAPI macdrv_ime_query_char_rect(void *arg, ULONG size)
|
||||||
{
|
{
|
||||||
struct ime_query_char_rect_params *params = arg;
|
struct ime_query_char_rect_params *params = arg;
|
||||||
struct ime_query_char_rect_result *result = params->result;
|
struct ime_query_char_rect_result *result = param_ptr(params->result);
|
||||||
void *himc = params->data;
|
void *himc = param_ptr(params->data);
|
||||||
IMECHARPOSITION charpos;
|
IMECHARPOSITION charpos;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
|
|
|
@ -117,8 +117,8 @@
|
||||||
UINT32 width;
|
UINT32 width;
|
||||||
UINT32 height;
|
UINT32 height;
|
||||||
UINT32 size;
|
UINT32 size;
|
||||||
void *png;
|
UINT32 icon;
|
||||||
HICON icon;
|
UINT64 png;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct app_icon_result
|
struct app_icon_result
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
/* macdrv_app_icon params */
|
/* macdrv_app_icon params */
|
||||||
struct 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 */
|
/* macdrv_app_quit_request params */
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
/* macdrv_dnd_query_drag params */
|
/* macdrv_dnd_query_drag params */
|
||||||
struct dnd_query_drag_params
|
struct dnd_query_drag_params
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
UINT32 hwnd;
|
||||||
UINT32 effect;
|
UINT32 effect;
|
||||||
INT32 x;
|
INT32 x;
|
||||||
INT32 y;
|
INT32 y;
|
||||||
|
@ -152,7 +152,7 @@
|
||||||
/* macdrv_dnd_query_drop params */
|
/* macdrv_dnd_query_drop params */
|
||||||
struct dnd_query_drop_params
|
struct dnd_query_drop_params
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
UINT32 hwnd;
|
||||||
UINT32 effect;
|
UINT32 effect;
|
||||||
INT32 x;
|
INT32 x;
|
||||||
INT32 y;
|
INT32 y;
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
/* macdrv_dnd_query_exited params */
|
/* macdrv_dnd_query_exited params */
|
||||||
struct dnd_query_exited_params
|
struct dnd_query_exited_params
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
UINT32 hwnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* macdrv_ime_query_char_rect result */
|
/* macdrv_ime_query_char_rect result */
|
||||||
|
@ -176,21 +176,26 @@
|
||||||
/* macdrv_ime_query_char_rect params */
|
/* macdrv_ime_query_char_rect params */
|
||||||
struct ime_query_char_rect_params
|
struct ime_query_char_rect_params
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
UINT32 hwnd;
|
||||||
void *data;
|
|
||||||
UINT32 location;
|
UINT32 location;
|
||||||
|
UINT64 data;
|
||||||
|
UINT64 result; /* FIXME: Use NtCallbackReturn instead */
|
||||||
UINT32 length;
|
UINT32 length;
|
||||||
struct ime_query_char_rect_result *result; /* FIXME: Use NtCallbackReturn instead */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* macdrv_ime_set_text params */
|
/* macdrv_ime_set_text params */
|
||||||
struct ime_set_text_params
|
struct ime_set_text_params
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
UINT32 hwnd;
|
||||||
void *data;
|
|
||||||
UINT32 cursor_pos;
|
UINT32 cursor_pos;
|
||||||
|
UINT64 data;
|
||||||
UINT32 complete;
|
UINT32 complete;
|
||||||
WCHAR text[1];
|
WCHAR text[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline void *param_ptr(UINT64 param)
|
||||||
|
{
|
||||||
|
return (void *)(UINT_PTR)param;
|
||||||
|
}
|
||||||
|
|
||||||
C_ASSERT(client_func_last <= NtUserDriverCallbackLast + 1);
|
C_ASSERT(client_func_last <= NtUserDriverCallbackLast + 1);
|
||||||
|
|
Loading…
Reference in a new issue