Mercurial > dwindows
comparison gtk/dw.c @ 2132:42f8ad7a89e8
Added DW_POINTER_TO_(U)LONGLONG and DW_(U)LONGLONG_TO_POINTER macros.
This allows casting with intermediate (u)intptr_t cast to avoid compiler
warnings on different systems. Use these macros where necessary in the code.
Might need to check the compiler supports LONG LONG... since some compilers
we support might not, like old versions of VisualAge C and Watcom.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 04 Jul 2020 17:51:46 +0000 |
parents | 663467f6eee4 |
children | 2090d7f46de5 |
comparison
equal
deleted
inserted
replaced
2131:fc29c4c2d386 | 2132:42f8ad7a89e8 |
---|---|
1986 { | 1986 { |
1987 char textbuf[101] = {0}; | 1987 char textbuf[101] = {0}; |
1988 int (*func)(HWND, void *); | 1988 int (*func)(HWND, void *); |
1989 void *data; | 1989 void *data; |
1990 | 1990 |
1991 snprintf(textbuf, 100, "dw-notification-%llu-func", (unsigned long long)g_variant_get_uint64(param)); | 1991 snprintf(textbuf, 100, "dw-notification-%llu-func", DW_POINTER_TO_ULONGLONG(g_variant_get_uint64(param))); |
1992 func = g_object_get_data(G_OBJECT(_DWApp), textbuf); | 1992 func = g_object_get_data(G_OBJECT(_DWApp), textbuf); |
1993 g_object_set_data(G_OBJECT(_DWApp), textbuf, NULL); | 1993 g_object_set_data(G_OBJECT(_DWApp), textbuf, NULL); |
1994 snprintf(textbuf, 100, "dw-notification-%llu-data", (unsigned long long)g_variant_get_uint64(param)); | 1994 snprintf(textbuf, 100, "dw-notification-%llu-data", DW_POINTER_TO_ULONGLONG(g_variant_get_uint64(param))); |
1995 data = g_object_get_data(G_OBJECT(_DWApp), textbuf); | 1995 data = g_object_get_data(G_OBJECT(_DWApp), textbuf); |
1996 g_object_set_data(G_OBJECT(_DWApp), textbuf, NULL); | 1996 g_object_set_data(G_OBJECT(_DWApp), textbuf, NULL); |
1997 | 1997 |
1998 if(func) | 1998 if(func) |
1999 func((HWND)g_variant_get_uint64(param), data); | 1999 func((HWND)g_variant_get_uint64(param), data); |
12421 char id[101] = {0}; | 12421 char id[101] = {0}; |
12422 | 12422 |
12423 /* Generate a unique ID based on the notification handle, | 12423 /* Generate a unique ID based on the notification handle, |
12424 * so we can use it to remove the notification in dw_window_destroy(). | 12424 * so we can use it to remove the notification in dw_window_destroy(). |
12425 */ | 12425 */ |
12426 snprintf(id, 100, "dw-notification-%llu", (unsigned long long)notification); | 12426 snprintf(id, 100, "dw-notification-%llu", DW_POINTER_TO_ULONGLONG(notification)); |
12427 g_application_send_notification(_DWApp, id, (GNotification *)notification); | 12427 g_application_send_notification(_DWApp, id, (GNotification *)notification); |
12428 return DW_ERROR_NONE; | 12428 return DW_ERROR_NONE; |
12429 } | 12429 } |
12430 #endif | 12430 #endif |
12431 return DW_ERROR_UNKNOWN; | 12431 return DW_ERROR_UNKNOWN; |
13535 #if GLIB_CHECK_VERSION(2,40,0) | 13535 #if GLIB_CHECK_VERSION(2,40,0) |
13536 /* Special case for handling notification signals, which aren't really signals */ | 13536 /* Special case for handling notification signals, which aren't really signals */ |
13537 if (G_IS_NOTIFICATION(thiswindow) && strcmp(signame, DW_SIGNAL_CLICKED) == 0) | 13537 if (G_IS_NOTIFICATION(thiswindow) && strcmp(signame, DW_SIGNAL_CLICKED) == 0) |
13538 { | 13538 { |
13539 char textbuf[101] = {0}; | 13539 char textbuf[101] = {0}; |
13540 snprintf(textbuf, 100, "dw-notification-%llu-func", (unsigned long long)thiswindow); | 13540 snprintf(textbuf, 100, "dw-notification-%llu-func", DW_POINTER_TO_ULONGLONG(thiswindow)); |
13541 g_object_set_data(G_OBJECT(_DWApp), textbuf, DW_POINTER(sigfunc)); | 13541 g_object_set_data(G_OBJECT(_DWApp), textbuf, DW_POINTER(sigfunc)); |
13542 snprintf(textbuf, 100, "dw-notification-%llu-data", (unsigned long long)thiswindow); | 13542 snprintf(textbuf, 100, "dw-notification-%llu-data", DW_POINTER_TO_ULONGLONG(thiswindow)); |
13543 g_object_set_data(G_OBJECT(_DWApp), textbuf, DW_POINTER(data)); | 13543 g_object_set_data(G_OBJECT(_DWApp), textbuf, DW_POINTER(data)); |
13544 DW_MUTEX_UNLOCK; | 13544 DW_MUTEX_UNLOCK; |
13545 return; | 13545 return; |
13546 } | 13546 } |
13547 #endif | 13547 #endif |