# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1353354756 0 # Node ID 22225eb286e582e0736448da60bc83465d9d28f8 # Parent ca304f28de3b4f2a5fe7b55918836fa4f594f710 Fixes for building with MINGW64 (specifically http://tdm-gcc.tdragon.net/). Currently a few things are missing, themes and HTML rendering but it builds in both 32bit and 64bit mode. There are also warnings generated by gcc every time the source calls a Windows API macro. (unused result warning). diff -r ca304f28de3b -r 22225eb286e5 dw.h --- a/dw.h Fri Nov 16 21:18:20 2012 +0000 +++ b/dw.h Mon Nov 19 19:52:36 2012 +0000 @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: dw.h 1811 2012-09-27 05:09:10Z mhessling $ */ #ifndef _H_DW #define _H_DW @@ -1391,12 +1391,22 @@ #include /* Macros for converting from INT/UINT to and from POINTER without compiler warnings */ -#if LONG_MAX > INT_MAX +#if _MSC_VER > 1200 || (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 30100 || defined(__has_extension) +/* There has got to be a better way to check for the intptr_t type.... + * for now just include valid versions of Visual C and GCC plus clang. + */ +#define DW_INT_TO_POINTER(a) ((void *)(intptr_t)a) +#define DW_POINTER_TO_INT(a) ((int)(intptr_t)a) +#define DW_UINT_TO_POINTER(a) ((void *)(uintptr_t)a) +#define DW_POINTER_TO_UINT(a) ((unsigned int)(uintptr_t)a) +#elif ULONG_MAX > UINT_MAX +/* If no intptr_t... ULONG is often bigger than UINT */ #define DW_INT_TO_POINTER(a) ((void *)(long)a) #define DW_POINTER_TO_INT(a) ((int)(long)a) #define DW_UINT_TO_POINTER(a) ((void *)(unsigned long)a) #define DW_POINTER_TO_UINT(a) ((unsigned int)(unsigned long)a) #else +/* Otherwise just fall back to standard casts */ #define DW_INT_TO_POINTER(a) ((void *)a) #define DW_POINTER_TO_INT(a) ((int)a) #define DW_UINT_TO_POINTER(a) ((void *)a) diff -r ca304f28de3b -r 22225eb286e5 dwcompat.c --- a/dwcompat.c Fri Nov 16 21:18:20 2012 +0000 +++ b/dwcompat.c Mon Nov 19 19:52:36 2012 +0000 @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: dwcompat.c 1717 2012-05-05 22:44:27Z bsmith $ */ #undef UNICODE #undef _UNICODE @@ -8,6 +8,7 @@ #if defined(__OS2__) || defined(__WIN32__) #include #endif +#define _DW_INTERNAL #include "dwcompat.h" #include "dw.h" @@ -53,8 +54,8 @@ int API makedir(char *path) { -#if defined(__IBMC__) || defined(__WATCOMC__) || (defined(__WIN32__) && !defined(__CYGWIN32__)) - return mkdir(path, 0); +#if defined(__IBMC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__) + return mkdir(path); #else return mkdir(path,S_IRWXU); #endif diff -r ca304f28de3b -r 22225eb286e5 dwcompat.h --- a/dwcompat.h Fri Nov 16 21:18:20 2012 +0000 +++ b/dwcompat.h Mon Nov 19 19:52:36 2012 +0000 @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: dwcompat.h 1722 2012-05-08 17:14:40Z bsmith $ */ #ifndef _DWCOMPAT_H #define _DWCOMPAT_H @@ -209,9 +209,11 @@ # define snprintf _snprintf # define unlink(a) _unlink(a) # define close(a) _close(a) -# define mkdir(a,b) _mkdir(a) # define fdopen(a, b) _fdopen(a, b) # define chdir(a) _chdir(a) +#ifndef _DW_INTERNAL +# define mkdir(a,b) _mkdir(a) +#endif # else # define strcasecmp(a, b) stricmp(a, b) # define strncasecmp(a, b, c) strnicmp(a, b, c) @@ -389,9 +391,11 @@ #define O_BINARY 0 #endif -#if defined(__IBMC__) || defined(__WATCOMC__) || (defined(__WIN32__) && !defined(__CYGWIN32__) && _MSC_VER < 1400) -#undef mkdir -#define mkdir(a,b) mkdir(a) +#if defined(__IBMC__) || defined(__WATCOMC__) || (defined(_MSC_VER) && _MSC_VER < 1400) || defined(__MINGW32__) || defined(__MINGW64__) +#ifndef _DW_INTERNAL +# undef mkdir +# define mkdir(a,b) mkdir(a) +#endif #endif #define socksprint(a, b) sockwrite(a, b, strlen(b), 0) diff -r ca304f28de3b -r 22225eb286e5 makefile.mingw --- a/makefile.mingw Fri Nov 16 21:18:20 2012 +0000 +++ b/makefile.mingw Mon Nov 19 19:52:36 2012 +0000 @@ -5,6 +5,7 @@ # make -C MingW32-gcc-3.4.0-RELEASE -f ../makefile.mingw > MingW32-gcc-3.4.0-RELEASE/make-out.log 2>&1 CC = gcc +RM = del /f DEFS = LIBS = @@ -30,6 +31,9 @@ dwtest.exe: dwtest.o dw.a dwcompat.a $(CC) $(CFLAGS) -o dwtest.exe dwtest.o dw.a dwcompat.a +clean: + $(RM) *.obj *.o *.lib *.res *~ dwtest.exe dw.dll dwcompat.dll SVN.REV + dw.o: win/dw.c $(CC) $(CFLAGS) -DBUILD_DLL -c $< diff -r ca304f28de3b -r 22225eb286e5 readme.txt --- a/readme.txt Fri Nov 16 21:18:20 2012 +0000 +++ b/readme.txt Mon Nov 19 19:52:36 2012 +0000 @@ -33,12 +33,16 @@ Added keyboard support for non-entryfield controls on Mac. Added tab support for notebook controls on Windows and OS/2 and in the process rewrote and optimized the existing tab code. +Added bitmap button support for dw_window_set_bitmap(). +Added full alpha channel support for bitmaps from file on GTK2. +Improved transparency support for pixmaps/bitmaps from file on OS/2. Fixed tab support for bitmap buttons which broke in 2.4 on Windows. Fixed a notebook crash early in creation on Mac. Fixed unusable scrollbars on Ubuntu Linux when overlay scrollbars are enabled. We now disable overlay scrollbars when creating. Fixed dw_window_function() not working on non-toplevel windows on Windows and OS/2. +Fixed building 64bit with Visual C 2012 and MINGW gcc on Windows. Dynamic Windows Documentation is available at: diff -r ca304f28de3b -r 22225eb286e5 win/dirent.c --- a/win/dirent.c Fri Nov 16 21:18:20 2012 +0000 +++ b/win/dirent.c Mon Nov 19 19:52:36 2012 +0000 @@ -8,6 +8,7 @@ #include +#define _DW_INTERNAL #include "dwcompat.h" #include #include diff -r ca304f28de3b -r 22225eb286e5 win/dw.c --- a/win/dw.c Fri Nov 16 21:18:20 2012 +0000 +++ b/win/dw.c Mon Nov 19 19:52:36 2012 +0000 @@ -1487,7 +1487,7 @@ { /* Then try the bottom or right box */ float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); - int type = (int)dw_window_get_data(handle, "_dw_type"); + int type = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_type")); MoveWindow(handle, currentx + pad, currenty + pad, width, height, FALSE); @@ -1681,12 +1681,12 @@ char buffer[40]; int checkable; sprintf( buffer, "_dw_checkable%d", id ); - checkable = (int)dw_window_get_data(DW_HWND_OBJECT, buffer); + checkable = DW_POINTER_TO_INT(dw_window_get_data(DW_HWND_OBJECT, buffer)); if ( checkable ) { int is_checked; sprintf( buffer, "_dw_ischecked%d", id ); - is_checked = (int)dw_window_get_data(DW_HWND_OBJECT, buffer); + is_checked = DW_POINTER_TO_INT(dw_window_get_data(DW_HWND_OBJECT, buffer)); is_checked = (is_checked) ? DW_MIS_UNCHECKED : DW_MIS_CHECKED; dw_menu_item_set_state( window, id, is_checked ); } @@ -2062,9 +2062,9 @@ int (*clickfunc)(HWND, void *) = tmp->signalfunction; HWND command; ULONG passthru = (ULONG)LOWORD(mp1); - ULONG message = HIWORD(mp1); - - command = (HWND)passthru; + ULONG message = (ULONG)HIWORD(mp1); + + command = (HWND)(uintptr_t)passthru; if (message == LBN_SELCHANGE || message == CBN_SELCHANGE) { @@ -2101,13 +2101,13 @@ /* * Call the user supplied callback */ - result = clickfunc((HWND)tmp->id, tmp->data); + result = clickfunc((HWND)(uintptr_t)tmp->id, tmp->data); tmp = NULL; } } /* this fires for checkable menu items */ else if ( tmp->window < (HWND)65536 && command == tmp->window && tmp->message != WM_TIMER ) { - _dw_toggle_checkable_menu_item( popup ? popup : tmp->window, (int)tmp->data ); + _dw_toggle_checkable_menu_item( popup ? popup : tmp->window, DW_POINTER_TO_INT(tmp->data) ); result = clickfunc(popup ? popup : tmp->window, tmp->data); tmp = NULL; } @@ -2815,7 +2815,7 @@ SetBkColor((HDC)mp1, GetSysColor(COLOR_3DFACE)); SelectObject((HDC)mp1, hbr); - return (LONG)hbr; + return (LONG)(intptr_t)hbr; } else if(thisback != -1 && thisback != DW_RGB_TRANSPARENT) { @@ -2830,7 +2830,7 @@ DW_GREEN_VALUE(back), DW_BLUE_VALUE(back))); SelectObject((HDC)mp1, thiscinfo->hbrush); - return (LONG)thiscinfo->hbrush; + return (LONG)(intptr_t)thiscinfo->hbrush; } } #ifdef AEROGLASS @@ -3113,7 +3113,7 @@ MoveWindow(handle2, x - newx, 0, newx, y, FALSE); _do_resize(tmp, newx - 1, y - 1); - dw_window_set_data(hwnd, "_dw_start", (void *)newx); + dw_window_set_data(hwnd, "_dw_start", DW_INT_TO_POINTER(newx)); } else { @@ -3133,7 +3133,7 @@ MoveWindow(handle1, 0, 0, x, newy, FALSE); _do_resize(tmp, x - 1, newy - 1); - dw_window_set_data(hwnd, "_dw_start", (void *)newy); + dw_window_set_data(hwnd, "_dw_start", DW_INT_TO_POINTER(newy)); } ShowWindow(handle1, SW_SHOW); @@ -3221,8 +3221,8 @@ { PAINTSTRUCT ps; HDC hdcPaint; - int type = (int)dw_window_get_data(hwnd, "_dw_type"); - int start = (int)dw_window_get_data(hwnd, "_dw_start"); + int type = DW_POINTER_TO_INT(dw_window_get_data(hwnd, "_dw_type")); + int start = DW_POINTER_TO_INT(dw_window_get_data(hwnd, "_dw_start")); BeginPaint(hwnd, &ps); @@ -3260,7 +3260,7 @@ case WM_MOUSEMOVE: { float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent"); - int type = (int)dw_window_get_data(hwnd, "_dw_type"); + int type = DW_POINTER_TO_INT(dw_window_get_data(hwnd, "_dw_type")); int start; if(type == DW_HORZ) @@ -3746,10 +3746,10 @@ GdipCreatePen1(gpfore, 1.0, UnitPixel, &pen); TlsSetValue(_gpPen, (LPVOID)pen); GdipCreateSolidFill(gpfore, &brush); - TlsSetValue(_gpBrush, (LPVOID)brush); + TlsSetValue(_gpBrush, brush); #endif - TlsSetValue(_foreground, (LPVOID)foreground); - TlsSetValue(_background, (LPVOID)background); + TlsSetValue(_foreground, DW_UINT_TO_POINTER(foreground)); + TlsSetValue(_background, DW_UINT_TO_POINTER(background)); TlsSetValue(_hPen, CreatePen(PS_SOLID, 1, foreground)); TlsSetValue(_hBrush, CreateSolidBrush(foreground)); } @@ -4266,7 +4266,7 @@ if(handle < (HWND)65536) { char buffer[31] = {0}; - ULONG id = (ULONG)handle; + ULONG id = (ULONG)(uintptr_t)handle; _snprintf(buffer, 30, "_dw_id%ld", id); menu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer); @@ -5000,13 +5000,13 @@ */ void API dw_window_set_pointer(HWND handle, int pointertype) { - HCURSOR cursor = pointertype < 65536 ? LoadCursor(NULL, MAKEINTRESOURCE(pointertype)) : (HCURSOR)pointertype; + HCURSOR cursor = pointertype < 65536 ? LoadCursor(NULL, MAKEINTRESOURCE(pointertype)) : (HCURSOR)(intptr_t)pointertype; if(!pointertype) dw_window_set_data(handle, "_dw_cursor", 0); else { - dw_window_set_data(handle, "_dw_cursor", (void *)cursor); + dw_window_set_data(handle, "_dw_cursor", DW_POINTER(cursor)); SetCursor(cursor); } } @@ -5243,7 +5243,7 @@ WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, &ccs); return hwndframe; @@ -5262,7 +5262,7 @@ WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); #else @@ -5339,7 +5339,7 @@ WS_CHILD | WS_CLIPCHILDREN, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); } @@ -5365,7 +5365,7 @@ WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | flags, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); cinfo->fore = cinfo->back = -1; @@ -5547,13 +5547,13 @@ InsertMenuItem(mymenu, 65535, TRUE, &mii); _snprintf(buffer, 30, "_dw_id%ld", id); - dw_window_set_data( DW_HWND_OBJECT, buffer, (void *)mymenu ); + dw_window_set_data( DW_HWND_OBJECT, buffer, DW_POINTER(mymenu) ); _snprintf(buffer, 30, "_dw_checkable%ld", id); - dw_window_set_data( DW_HWND_OBJECT, buffer, (void *)check ); + dw_window_set_data( DW_HWND_OBJECT, buffer, DW_INT_TO_POINTER(check) ); _snprintf(buffer, 30, "_dw_ischecked%ld", id); - dw_window_set_data( DW_HWND_OBJECT, buffer, (void *)is_checked ); + dw_window_set_data( DW_HWND_OBJECT, buffer, DW_INT_TO_POINTER(is_checked) ); _snprintf(buffer, 30, "_dw_isdisabled%ld", id); - dw_window_set_data( DW_HWND_OBJECT, buffer, (void *)is_disabled ); + dw_window_set_data( DW_HWND_OBJECT, buffer, DW_INT_TO_POINTER(is_disabled) ); if (submenu) { @@ -5568,7 +5568,7 @@ if (IsWindow(menux) && !IsMenu((HMENU)menux)) DrawMenuBar(menux); - return (HWND)id; + return (HWND)(uintptr_t)id; } /* @@ -5605,7 +5605,7 @@ * Keep our internal state consistent */ _snprintf( buffer, 30, "_dw_ischecked%ld", id ); - dw_window_set_data( DW_HWND_OBJECT, buffer, (void *)check ); + dw_window_set_data( DW_HWND_OBJECT, buffer, DW_INT_TO_POINTER(check) ); } /* @@ -5628,9 +5628,9 @@ mymenu = (HMENU)dw_window_get_data(menux, "_dw_menu"); _snprintf( buffer1, 30, "_dw_ischecked%ld", id ); - check = (int)dw_window_get_data( DW_HWND_OBJECT, buffer1 ); + check = DW_POINTER_TO_INT(dw_window_get_data( DW_HWND_OBJECT, buffer1 )); _snprintf( buffer2, 30, "_dw_isdisabled%ld", id ); - disabled = (int)dw_window_get_data( DW_HWND_OBJECT, buffer2 ); + disabled = DW_POINTER_TO_INT(dw_window_get_data( DW_HWND_OBJECT, buffer2 )); memset( &mii, 0, sizeof(mii) ); @@ -5697,8 +5697,8 @@ /* * Keep our internal checked state consistent */ - dw_window_set_data( DW_HWND_OBJECT, buffer1, (void *)check ); - dw_window_set_data( DW_HWND_OBJECT, buffer2, (void *)disabled ); + dw_window_set_data( DW_HWND_OBJECT, buffer1, DW_INT_TO_POINTER(check) ); + dw_window_set_data( DW_HWND_OBJECT, buffer2, DW_INT_TO_POINTER(disabled) ); } /* @@ -5721,7 +5721,7 @@ /* If the ID was autogenerated it is safe to remove it */ if(id >= 30000) - dw_signal_disconnect_by_window((HWND)id); + dw_signal_disconnect_by_window((HWND)(uintptr_t)id); /* Make sure the menu is redrawn if needed */ if( (HMENU)menux != mymenu ) @@ -5770,7 +5770,7 @@ WS_CLIPCHILDREN, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo)); @@ -5812,7 +5812,7 @@ WS_BORDER | WS_CLIPCHILDREN, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo)); @@ -5876,7 +5876,7 @@ WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); #ifdef AEROGLASS @@ -5905,7 +5905,7 @@ WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); dw_window_set_font(tmp, DefaultFont); @@ -5929,7 +5929,7 @@ WS_CLIPCHILDREN, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo)); @@ -5965,7 +5965,7 @@ WS_VISIBLE | WS_CLIPCHILDREN, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); @@ -5994,7 +5994,7 @@ ES_AUTOHSCROLL | WS_CLIPCHILDREN, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); @@ -6034,7 +6034,7 @@ WS_CLIPCHILDREN | CBS_AUTOHSCROLL | WS_VISIBLE, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); ColorInfo *cinfo = (ColorInfo *)calloc(1, sizeof(ColorInfo)); @@ -6078,7 +6078,7 @@ WS_VISIBLE | WS_CLIPCHILDREN, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); cinfo->fore = cinfo->back = -1; @@ -6156,7 +6156,7 @@ /* Create the toolbar */ tmp = CreateWindowEx(0L, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_AUTOSIZE | CCS_NORESIZE | - CCS_NOPARENTALIGN | CCS_NODIVIDER, 0, 0, 100, 30, DW_HWND_OBJECT, (HMENU)id, DWInstance, NULL); + CCS_NOPARENTALIGN | CCS_NODIVIDER, 0, 0, 100, 30, DW_HWND_OBJECT, (HMENU)(uintptr_t)id, DWInstance, NULL); /* Disable visual styles by default */ if(_SetWindowTheme) @@ -6204,7 +6204,7 @@ (icon ? BS_ICON : BS_BITMAP), 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); @@ -6272,7 +6272,7 @@ windowtype | WS_CHILD | BS_PUSHBUTTON | WS_CLIPCHILDREN | WS_VISIBLE, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); @@ -6365,7 +6365,7 @@ WS_VISIBLE, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL ); @@ -6413,7 +6413,7 @@ UDS_WRAP | UDS_NOTHOUSANDS | WS_VISIBLE, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); @@ -6456,7 +6456,7 @@ WS_CLIPCHILDREN | WS_VISIBLE, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); @@ -6484,7 +6484,7 @@ (vertical ? TBS_VERT : TBS_HORZ), 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); @@ -6512,7 +6512,7 @@ (vertical ? SBS_VERT : SBS_HORZ), 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); @@ -6537,7 +6537,7 @@ WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); } @@ -6557,7 +6557,7 @@ BS_TEXT | WS_CLIPCHILDREN | WS_VISIBLE, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); cinfo->pOldProc = SubclassWindow(tmp, _BtProc); @@ -6585,7 +6585,7 @@ WS_VSCROLL | (multi ? LBS_MULTIPLESEL : 0) , 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); ContainerInfo *cinfo = (ContainerInfo *)calloc(1, sizeof(ContainerInfo)); @@ -6613,7 +6613,7 @@ */ void API dw_window_set_icon(HWND handle, HICN icon) { - int iicon = (int)icon; + int iicon = DW_POINTER_TO_INT(icon); HICON hicon = iicon < 65536 ? LoadIcon(DWInstance, MAKEINTRESOURCE(iicon)) : (HICON)icon; SendMessage(handle, WM_SETICON, @@ -6915,7 +6915,7 @@ { char buffer[31] = {0}; HMENU mymenu; - ULONG id = (ULONG)handle; + ULONG id = (ULONG)(uintptr_t)handle; _snprintf(buffer, 30, "_dw_id%ld", id); mymenu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer); @@ -6938,7 +6938,7 @@ { char buffer[31] = {0}; HMENU mymenu; - ULONG id = (ULONG)handle; + ULONG id = (ULONG)(uintptr_t)handle; _snprintf(buffer, 30, "_dw_id%ld", id); mymenu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer); @@ -7569,7 +7569,7 @@ { char buffer[31] = {0}; HMENU mymenu; - ULONG id = (ULONG)handle; + ULONG id = (ULONG)(uintptr_t)handle; _snprintf(buffer, 30, "_dw_id%ld", id); mymenu = (HMENU)dw_window_get_data(DW_HWND_OBJECT, buffer); @@ -7640,7 +7640,6 @@ } else if(_tcsnicmp(tmpbuf, STATICCLASSNAME, _tcslen(STATICCLASSNAME)+1)==0) { - static ULONG halign = (SS_LEFTNOWORDWRAP | SS_RIGHT | SS_CENTER); ULONG thismask = mask & ~(DW_DT_VCENTER | DW_DT_WORDBREAK); ULONG thisstyle = style & ~(DW_DT_VCENTER | DW_DT_WORDBREAK); ULONG type = style & mask & 0xFL; @@ -8555,7 +8554,7 @@ */ void API dw_scrollbar_set_pos(HWND handle, unsigned int position) { - dw_window_set_data(handle, "_dw_scrollbar_value", (void *)position); + dw_window_set_data(handle, "_dw_scrollbar_value", DW_UINT_TO_POINTER(position)); SendMessage(handle, SBM_SETPOS, (WPARAM)position, (LPARAM)TRUE); } @@ -9164,7 +9163,7 @@ item = ListView_InsertItem(handle, &lvi); for(z=1;zflags) @@ -9508,7 +9507,7 @@ if(pointer) { - item = (int)dw_window_get_data(handle, "_dw_insertitem"); + item = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_insertitem")); } lvi.iItem = row + item; @@ -9576,7 +9575,7 @@ */ void API dw_container_delete(HWND handle, int rowcount) { - int z, _index = (int)dw_window_get_data(handle, "_dw_index"); + int z, _index = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_index")); for(z=0;z _index) dw_window_set_data(handle, "_dw_index", 0); else - dw_window_set_data(handle, "_dw_index", (void *)(_index - rowcount)); + dw_window_set_data(handle, "_dw_index", DW_INT_TO_POINTER((_index - rowcount))); } /* @@ -9632,7 +9631,7 @@ ListView_GetItem(handle, &lvi); - dw_window_set_data(handle, "_dw_index", (void *)_index); + dw_window_set_data(handle, "_dw_index", DW_INT_TO_POINTER(_index)); return (char *)lvi.lParam; } @@ -9647,7 +9646,7 @@ char * API dw_container_query_next(HWND handle, unsigned long flags) { LV_ITEM lvi; - int _index = (int)dw_window_get_data(handle, "_dw_index"); + int _index = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_index")); _index = ListView_GetNextItem(handle, _index, flags); @@ -9661,7 +9660,7 @@ ListView_GetItem(handle, &lvi); - dw_window_set_data(handle, "_dw_index", (void *)_index); + dw_window_set_data(handle, "_dw_index", DW_INT_TO_POINTER(_index)); return (char *)lvi.lParam; } @@ -9727,10 +9726,10 @@ if ( (textcomp && lvi.lParam && strcmp( (char *)lvi.lParam, text ) == 0) || (!textcomp && (char *)lvi.lParam == text) ) { - int _index = (int)dw_window_get_data(handle, "_dw_index"); + int _index = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_index")); if(index < _index) - dw_window_set_data(handle, "_dw_index", (void *)(_index - 1)); + dw_window_set_data(handle, "_dw_index", DW_INT_TO_POINTER((_index - 1))); ListView_DeleteItem(handle, index); return; @@ -9828,7 +9827,7 @@ tnid.cbSize = sizeof(NOTIFYICONDATA); tnid.hWnd = handle; - tnid.uID = (UINT)icon; + tnid.uID = (UINT)(uintptr_t)icon; tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; tnid.uCallbackMessage = WM_USER+2; tnid.hIcon = (HICON)icon; @@ -9852,7 +9851,7 @@ tnid.cbSize = sizeof(NOTIFYICONDATA); tnid.hWnd = handle; - tnid.uID = (UINT)icon; + tnid.uID = (UINT)(uintptr_t)icon; Shell_NotifyIcon(NIM_DELETE, &tnid); } @@ -9872,7 +9871,7 @@ WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); newbox->pad = 0; @@ -9915,7 +9914,7 @@ DeleteObject(hPen); DeleteObject(hBrush); - TlsSetValue(_foreground, (LPVOID)foreground); + TlsSetValue(_foreground, (LPVOID)(uintptr_t)foreground); TlsSetValue(_hPen, CreatePen(PS_SOLID, 1, foreground)); TlsSetValue(_hBrush, CreateSolidBrush(foreground)); } @@ -9936,7 +9935,7 @@ if(value == DW_RGB_TRANSPARENT) TlsSetValue(_background, (LPVOID)DW_RGB_TRANSPARENT); else - TlsSetValue(_background, (LPVOID)background); + TlsSetValue(_background, (LPVOID)(uintptr_t)background); } /* Allows the user to choose a color using the system's color chooser dialog. @@ -10378,10 +10377,10 @@ mustdelete = 1; } - background = (COLORREF)TlsGetValue(_background); + background = (COLORREF)(uintptr_t)TlsGetValue(_background); if(hFont) oldFont = SelectObject(hdc, hFont); - SetTextColor(hdc, (COLORREF)TlsGetValue(_foreground)); + SetTextColor(hdc, (COLORREF)(uintptr_t)TlsGetValue(_foreground)); if(background == DW_RGB_TRANSPARENT) SetBkMode(hdc, TRANSPARENT); else @@ -11360,26 +11359,26 @@ WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); if(tmp) { HWND tmpbox = dw_box_new(DW_VERT, 0); - float *percent = (float *)malloc(sizeof(float)); + float *percent = (float *)malloc(sizeof(float)); dw_box_pack_start(tmpbox, topleft, 1, 1, TRUE, TRUE, 0); SetParent(tmpbox, tmp); - dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox); + dw_window_set_data(tmp, "_dw_topleft", DW_POINTER(tmpbox)); tmpbox = dw_box_new(DW_VERT, 0); dw_box_pack_start(tmpbox, bottomright, 1, 1, TRUE, TRUE, 0); SetParent(tmpbox, tmp); - dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox); + dw_window_set_data(tmp, "_dw_bottomright", DW_POINTER(tmpbox)); *percent = 50.0; - dw_window_set_data(tmp, "_dw_percent", (void *)percent); - dw_window_set_data(tmp, "_dw_type", (void *)type); + dw_window_set_data(tmp, "_dw_percent", DW_POINTER(percent)); + dw_window_set_data(tmp, "_dw_type", DW_INT_TO_POINTER(type)); } return tmp; } @@ -11392,8 +11391,8 @@ void API dw_splitbar_set(HWND handle, float percent) { float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent"); - int type = (int)dw_window_get_data(handle, "_dw_type"); - unsigned long width, height; + int type = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_type")); + unsigned long width, height; if(mypercent) *mypercent = percent; @@ -11438,7 +11437,7 @@ WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | MCS_DAYSTATE, 0,0,0,0, DW_HWND_OBJECT, - (HMENU)id, + (HMENU)(uintptr_t)id, DWInstance, NULL); if ( tmp ) @@ -11902,7 +11901,7 @@ } } - retcode = (int)ShellExecute(NULL, TEXT("open"), UTF8toWide(browseurl), NULL, NULL, SW_SHOWNORMAL); + retcode = DW_POINTER_TO_INT(ShellExecute(NULL, TEXT("open"), UTF8toWide(browseurl), NULL, NULL, SW_SHOWNORMAL)); if(retcode<33 && retcode != 2) return DW_ERROR_UNKNOWN; return DW_ERROR_NONE; @@ -12322,7 +12321,7 @@ char buffer[16]; HWND owner; - _snprintf(buffer, 15, "_dw_id%d", (int)window); + _snprintf(buffer, 15, "_dw_id%d", (int)(intptr_t)window); owner = (HWND)dw_window_get_data(DW_HWND_OBJECT, buffer); /* Make sure there are no dupes from popups */ @@ -12330,7 +12329,7 @@ if (owner) { - id = (ULONG)window; + id = (ULONG)(uintptr_t)window; window = owner; } } @@ -12354,7 +12353,7 @@ while(tmp) { - if(((window < (HWND)65536 && (int)window == tmp->id) || tmp->window == window) && tmp->message == message) + if(((window < (HWND)65536 && (int)(intptr_t)window == tmp->id) || tmp->window == window) && tmp->message == message) { if(prev) { @@ -12388,7 +12387,7 @@ while(tmp) { - if((window < (HWND)65536 && (int)window == tmp->id) || tmp->window == window) + if((window < (HWND)65536 && (int)(intptr_t)window == tmp->id) || tmp->window == window) { if(prev) { @@ -12423,7 +12422,7 @@ while(tmp) { - if(((window < (HWND)65536 && (int)window == tmp->id) || tmp->window == window) && tmp->data == data) + if(((window < (HWND)65536 && (int)(intptr_t)window == tmp->id) || tmp->window == window) && tmp->data == data) { if(prev) {