From d3fc847f81c6bb58fa6575c8192ef23d46af06d9 Mon Sep 17 00:00:00 2001 From: "Chris West (Faux)" Date: Wed, 11 Jan 2012 21:59:13 +0000 Subject: [PATCH] gh-2: Transparent icon on x64 through not enough Get*LongPtr --- windows/window.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/windows/window.c b/windows/window.c index 57a923ba0..574867fa6 100644 --- a/windows/window.c +++ b/windows/window.c @@ -166,6 +166,8 @@ static size_t clipboard_length; #define TIMING_TIMER_ID 1234 static long timing_next_time; +HICON extract_icon(char *iconpath, int smallicon); + static struct { HMENU menu; } popup_menus[2]; @@ -2465,14 +2467,14 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, hIcon = extract_icon(cfg.win_icon, TRUE); DestroyIcon(puttyTray.hIcon); puttyTray.hIcon = hIcon; - SetClassLong(hwnd, GCL_HICON, extract_icon(cfg.win_icon, FALSE)); - SetClassLong(hwnd, GCL_HICONSM, (LONG)hIcon); + SetClassLongPtr(hwnd, GCLP_HICON, (LONG_PTR)extract_icon(cfg.win_icon, FALSE)); + SetClassLongPtr(hwnd, GCLP_HICONSM, (LONG_PTR)hIcon); } else { - inst = (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE); + inst = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE); DestroyIcon(puttyTray.hIcon); puttyTray.hIcon = LoadImage(inst, MAKEINTRESOURCE(IDI_MAINICON), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR|LR_SHARED); - SetClassLong(hwnd, GCL_HICON, (LONG)LoadImage(inst, MAKEINTRESOURCE(IDI_MAINICON), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR|LR_SHARED)); - SetClassLong(hwnd, GCL_HICONSM, (LONG)LoadImage(inst, MAKEINTRESOURCE(IDI_MAINICON), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR|LR_SHARED)); + SetClassLongPtr(hwnd, GCLP_HICON, (LONG_PTR)LoadImage(inst, MAKEINTRESOURCE(IDI_MAINICON), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR|LR_SHARED)); + SetClassLongPtr(hwnd, GCLP_HICONSM, (LONG_PTR)LoadImage(inst, MAKEINTRESOURCE(IDI_MAINICON), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR|LR_SHARED)); } if (puttyTrayVisible) { taskbar_addicon(cfg.win_name_always ? window_name : icon_name, TRUE); @@ -2657,7 +2659,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, } break; case IDM_TRAYCLOSE: - SendMessage(hwnd, WM_CLOSE, NULL, NULL); + SendMessage(hwnd, WM_CLOSE, (WPARAM)NULL, (LPARAM)NULL); break; case SC_MOUSEMENU: @@ -2855,13 +2857,13 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, if ((!term->cfg.url_ctrl_click || urlhack_is_ctrl_pressed()) && urlhack_is_in_link_region(urlhack_mouse_old_x, urlhack_mouse_old_y)) { if (urlhack_cursor_is_hand == 0) { - SetClassLongPtr(hwnd, GCLP_HCURSOR, LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND))); + SetClassLongPtr(hwnd, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND))); urlhack_cursor_is_hand = 1; term_update(term); // Force the terminal to update, otherwise the underline will not show (bug somewhere, this is an ugly fix) } } else if (urlhack_cursor_is_hand == 1) { - SetClassLongPtr(hwnd, GCLP_HCURSOR, LoadCursor(NULL, MAKEINTRESOURCE(IDC_IBEAM))); + SetClassLongPtr(hwnd, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, MAKEINTRESOURCE(IDC_IBEAM))); urlhack_cursor_is_hand = 0; term_update(term); // Force the terminal to update, see above }