Mercurial > dwindows
comparison gtk3/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 |
---|---|
1961 { | 1961 { |
1962 char textbuf[101] = {0}; | 1962 char textbuf[101] = {0}; |
1963 int (*func)(HWND, void *); | 1963 int (*func)(HWND, void *); |
1964 void *data; | 1964 void *data; |
1965 | 1965 |
1966 snprintf(textbuf, 100, "dw-notification-%llu-func", (unsigned long long)g_variant_get_uint64(param)); | 1966 snprintf(textbuf, 100, "dw-notification-%llu-func", DW_POINTER_TO_ULONGLONG(g_variant_get_uint64(param))); |
1967 func = g_object_get_data(G_OBJECT(_DWApp), textbuf); | 1967 func = g_object_get_data(G_OBJECT(_DWApp), textbuf); |
1968 g_object_set_data(G_OBJECT(_DWApp), textbuf, NULL); | 1968 g_object_set_data(G_OBJECT(_DWApp), textbuf, NULL); |
1969 snprintf(textbuf, 100, "dw-notification-%llu-data", (unsigned long long)g_variant_get_uint64(param)); | 1969 snprintf(textbuf, 100, "dw-notification-%llu-data", DW_POINTER_TO_ULONGLONG(g_variant_get_uint64(param))); |
1970 data = g_object_get_data(G_OBJECT(_DWApp), textbuf); | 1970 data = g_object_get_data(G_OBJECT(_DWApp), textbuf); |
1971 g_object_set_data(G_OBJECT(_DWApp), textbuf, NULL); | 1971 g_object_set_data(G_OBJECT(_DWApp), textbuf, NULL); |
1972 | 1972 |
1973 if(func) | 1973 if(func) |
1974 func((HWND)g_variant_get_uint64(param), data); | 1974 func((HWND)g_variant_get_uint64(param), data); |
11126 char id[101] = {0}; | 11126 char id[101] = {0}; |
11127 | 11127 |
11128 /* Generate a unique ID based on the notification handle, | 11128 /* Generate a unique ID based on the notification handle, |
11129 * so we can use it to remove the notification in dw_window_destroy(). | 11129 * so we can use it to remove the notification in dw_window_destroy(). |
11130 */ | 11130 */ |
11131 snprintf(id, 100, "dw-notification-%llu", (unsigned long long)notification); | 11131 snprintf(id, 100, "dw-notification-%llu", DW_POINTER_TO_ULONGLONG(notification)); |
11132 g_application_send_notification(_DWApp, id, (GNotification *)notification); | 11132 g_application_send_notification(_DWApp, id, (GNotification *)notification); |
11133 return DW_ERROR_NONE; | 11133 return DW_ERROR_NONE; |
11134 } | 11134 } |
11135 #endif | 11135 #endif |
11136 return DW_ERROR_UNKNOWN; | 11136 return DW_ERROR_UNKNOWN; |
12062 #if GLIB_CHECK_VERSION(2,40,0) | 12062 #if GLIB_CHECK_VERSION(2,40,0) |
12063 /* Special case for handling notification signals, which aren't really signals */ | 12063 /* Special case for handling notification signals, which aren't really signals */ |
12064 if (G_IS_NOTIFICATION(thiswindow) && strcmp(signame, DW_SIGNAL_CLICKED) == 0) | 12064 if (G_IS_NOTIFICATION(thiswindow) && strcmp(signame, DW_SIGNAL_CLICKED) == 0) |
12065 { | 12065 { |
12066 char textbuf[101] = {0}; | 12066 char textbuf[101] = {0}; |
12067 snprintf(textbuf, 100, "dw-notification-%llu-func", (unsigned long long)thiswindow); | 12067 snprintf(textbuf, 100, "dw-notification-%llu-func", DW_POINTER_TO_ULONGLONG(thiswindow)); |
12068 g_object_set_data(G_OBJECT(_DWApp), textbuf, DW_POINTER(sigfunc)); | 12068 g_object_set_data(G_OBJECT(_DWApp), textbuf, DW_POINTER(sigfunc)); |
12069 snprintf(textbuf, 100, "dw-notification-%llu-data", (unsigned long long)thiswindow); | 12069 snprintf(textbuf, 100, "dw-notification-%llu-data", DW_POINTER_TO_ULONGLONG(thiswindow)); |
12070 g_object_set_data(G_OBJECT(_DWApp), textbuf, DW_POINTER(data)); | 12070 g_object_set_data(G_OBJECT(_DWApp), textbuf, DW_POINTER(data)); |
12071 DW_MUTEX_UNLOCK; | 12071 DW_MUTEX_UNLOCK; |
12072 return; | 12072 return; |
12073 } | 12073 } |
12074 #endif | 12074 #endif |