Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
gh-2: Transparent icon on x64 through not enough Get*LongPtr
Browse files Browse the repository at this point in the history
  • Loading branch information
FauxFaux committed Apr 15, 2012
1 parent 0b4e94e commit d3fc847
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions windows/window.c
Expand Up @@ -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];
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit d3fc847

Please sign in to comment.