Index: windows/window.c =================================================================== --- windows/window.c (revision 8136) +++ windows/window.c (working copy) @@ -75,6 +75,19 @@ #define WHEEL_DELTA 120 #endif +/* hacky, hacky hacky for transparency without windows sdk full install */ +#ifndef WS_EX_LAYERED +#define WS_EX_LAYERED 0x00080000 +#define LWA_COLORKEY 0x00000001 +#define LWA_ALPHA 0x00000002 +/* Preparation for the function we want to import from USER32.DLL */ +typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)(HWND hWnd, + COLORREF crKey, BYTE bAlpha, DWORD dwFlags); + +lpfnSetLayeredWindowAttributes m_pSetLayeredWindowAttributes; +#endif // ndef WS_EX_LAYERED +static BYTE bAlpha = 240; + static Mouse_Button translate_button(Mouse_Button button); static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, @@ -640,7 +653,9 @@ { int winmode = WS_OVERLAPPEDWINDOW | WS_VSCROLL; - int exwinmode = 0; + int exwinmode = WS_EX_LAYERED; + HMODULE huser32 = GetModuleHandle("USER32.DLL"); + if (!cfg.scrollbar) winmode &= ~(WS_VSCROLL); if (cfg.resize_action == RESIZE_DISABLED) @@ -653,6 +668,17 @@ winmode, CW_USEDEFAULT, CW_USEDEFAULT, guess_width, guess_height, NULL, NULL, inst, NULL); + + /* import SetLayeredWindowAttributes from USER32.DLL */ + m_pSetLayeredWindowAttributes = + (lpfnSetLayeredWindowAttributes) + GetProcAddress(huser32, "SetLayeredWindowAttributes"); + + if (m_pSetLayeredWindowAttributes != NULL) { + m_pSetLayeredWindowAttributes(hwnd, 0, + bAlpha, LWA_ALPHA); + } + } /* @@ -3048,10 +3074,22 @@ TO_CHR_Y(Y_POS(lParam)), shift_pressed, control_pressed, is_alt_pressed()); } else { + if (b == MBT_WHEEL_UP && bAlpha > 2) { + bAlpha -= 2; + } + if (b != MBT_WHEEL_UP && bAlpha < 253) { + bAlpha += 2; + } + + if (m_pSetLayeredWindowAttributes != NULL) { + m_pSetLayeredWindowAttributes(hwnd, 0, + bAlpha, LWA_ALPHA); + } else { /* trigger a scroll */ term_scroll(term, 0, b == MBT_WHEEL_UP ? -term->rows / 2 : term->rows / 2); + } } } return 0; Index: mkfiles.pl =================================================================== --- mkfiles.pl (revision 8136) +++ mkfiles.pl (working copy) @@ -475,7 +475,7 @@ "# C compilation flags\n". "CFLAGS = -D_WINDOWS -DWINVER=0x0500\n". "# Resource compilation flags\n". - "RCFLAGS = -DNO_WINRESRC_H -DWIN32 -D_WIN32 -DWINVER=0x0401\n". + "RCFLAGS = -DNO_WINRESRC_H -DWIN32 -D_WIN32 -DWINVER=0x0500\n". "\n". "# Get include directory for resource compiler\n". "!if !\$d(BCB)\n".