From 7c2fb098b206c0fb97c18cce8f88387cd0c0e82a Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Mon, 19 Jan 2009 17:22:59 +0000 Subject: [PATCH] Cygwin/X: Fix several prototypes to return HICON Fix prototypes of winOverrideIcon(), winTaskbarIcon() and winOverrideDefaultIcon() to return HICON Also use HICON type in WINPREFS stucture Remove various casts these changes make unnecessary Signed-off-by: Jon TURNEY --- hw/xwin/winmultiwindowicons.c | 6 +++--- hw/xwin/winprefs.c | 14 +++++++------- hw/xwin/winprefs.h | 8 ++++---- hw/xwin/wintrayicon.c | 2 +- hw/xwin/winwin32rootlesswindow.c | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hw/xwin/winmultiwindowicons.c b/hw/xwin/winmultiwindowicons.c index 9645718c2..88416bb70 100644 --- a/hw/xwin/winmultiwindowicons.c +++ b/hw/xwin/winmultiwindowicons.c @@ -368,7 +368,7 @@ winUpdateIcon (Window id) pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); if (!pWin) return; - hIcon = (HICON)winOverrideIcon ((unsigned long)pWin); + hIcon = winOverrideIcon ((unsigned long)pWin); if (!hIcon) hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON)); @@ -410,8 +410,8 @@ void winInitGlobalIcons (void) /* Load default X icon in case it's not ready yet */ if (!g_hIconX) { - g_hIconX = (HICON)winOverrideDefaultIcon(sm_cx); - g_hSmallIconX = (HICON)winOverrideDefaultIcon(sm_cxsm); + g_hIconX = winOverrideDefaultIcon(sm_cx); + g_hSmallIconX = winOverrideDefaultIcon(sm_cxsm); } if (!g_hIconX) diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c index 0c48bfebb..8152064cb 100644 --- a/hw/xwin/winprefs.c +++ b/hw/xwin/winprefs.c @@ -529,7 +529,7 @@ SetupRootMenu (unsigned long hmenuRoot) /* * Check for and return an overridden default ICON specified in the prefs */ -unsigned long +HICON winOverrideDefaultIcon(int size) { HICON hicon; @@ -541,7 +541,7 @@ winOverrideDefaultIcon(int size) ErrorF ("winOverrideDefaultIcon: LoadImageComma(%s) failed\n", pref.defaultIconName); - return (unsigned long)hicon; + return hicon; } return 0; @@ -551,7 +551,7 @@ winOverrideDefaultIcon(int size) /* * Return the HICON to use in the taskbar notification area */ -unsigned long +HICON winTaskbarIcon(void) { HICON hicon; @@ -575,7 +575,7 @@ winTaskbarIcon(void) GetSystemMetrics (SM_CYSMICON), 0); - return (unsigned long)hicon; + return hicon; } @@ -650,7 +650,7 @@ LoadImageComma (char *fname, int sx, int sy, int flags) * Check for a match of the window class to one specified in the * ICONS{} section in the prefs file, and load the icon from a file */ -unsigned long +HICON winOverrideIcon (unsigned long longWin) { WindowPtr pWin = (WindowPtr) longWin; @@ -686,8 +686,8 @@ winOverrideIcon (unsigned long longWin) ErrorF ("winOverrideIcon: LoadImageComma(%s) failed\n", pref.icon[i].iconFile); - pref.icon[i].hicon = (unsigned long)hicon; - return (unsigned long)hicon; + pref.icon[i].hicon = hicon; + return hicon; } } diff --git a/hw/xwin/winprefs.h b/hw/xwin/winprefs.h index 996b02ade..6d641da6a 100644 --- a/hw/xwin/winprefs.h +++ b/hw/xwin/winprefs.h @@ -105,7 +105,7 @@ typedef struct ICONITEM { char match[MENU_MAX+1]; /* What string to search for? */ char iconFile[PATH_MAX+NAME_MAX+2]; /* Icon location, WIN32 path */ - unsigned long hicon; /* LoadImage() result */ + HICON hicon; /* LoadImage() result */ } ICONITEM; /* To redefine styles for certain window types */ @@ -172,15 +172,15 @@ HandleCustomWM_COMMAND (unsigned long hwndIn, int winIconIsOverride (unsigned hiconIn); -unsigned long +HICON winOverrideIcon (unsigned long longpWin); unsigned long winOverrideStyle (unsigned long longpWin); -unsigned long +HICON winTaskbarIcon(void); -unsigned long +HICON winOverrideDefaultIcon(int size); #endif diff --git a/hw/xwin/wintrayicon.c b/hw/xwin/wintrayicon.c index d1a7b4d82..895b47caf 100755 --- a/hw/xwin/wintrayicon.c +++ b/hw/xwin/wintrayicon.c @@ -51,7 +51,7 @@ winInitNotifyIcon (winPrivScreenPtr pScreenPriv) nid.uID = pScreenInfo->dwScreen; nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; nid.uCallbackMessage = WM_TRAYICON; - nid.hIcon = (HICON)winTaskbarIcon (); + nid.hIcon = winTaskbarIcon (); /* Save handle to the icon so it can be freed later */ pScreenPriv->hiconNotifyIcon = nid.hIcon; diff --git a/hw/xwin/winwin32rootlesswindow.c b/hw/xwin/winwin32rootlesswindow.c index dedcd7a76..3f521d600 100755 --- a/hw/xwin/winwin32rootlesswindow.c +++ b/hw/xwin/winwin32rootlesswindow.c @@ -165,7 +165,7 @@ winMWExtWMUpdateIcon (Window id) HICON hIcon, hiconOld; pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); - hIcon = (HICON)winOverrideIcon ((unsigned long)pWin); + hIcon = winOverrideIcon ((unsigned long)pWin); if (!hIcon) hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON));