mirror of
https://github.com/reactos/reactos.git
synced 2025-01-06 06:20:13 +00:00
- Revert r37085. It fix work kbswitch, but I think, that somewhere (in kbswitch) there is a memory leak. Help somebody to find it
svn path=/trunk/; revision=38172
This commit is contained in:
parent
f74a13b345
commit
10ffe93130
1 changed files with 14 additions and 38 deletions
|
@ -24,8 +24,6 @@ HINSTANCE hInst;
|
||||||
HANDLE hProcessHeap;
|
HANDLE hProcessHeap;
|
||||||
HMODULE hDllLib;
|
HMODULE hDllLib;
|
||||||
ULONG ulCurrentLayoutNum = 1;
|
ULONG ulCurrentLayoutNum = 1;
|
||||||
UINT cxSmIcon, cySmIcon;
|
|
||||||
|
|
||||||
|
|
||||||
static HICON
|
static HICON
|
||||||
CreateTrayIcon(LPTSTR szLCID)
|
CreateTrayIcon(LPTSTR szLCID)
|
||||||
|
@ -51,18 +49,18 @@ CreateTrayIcon(LPTSTR szLCID)
|
||||||
|
|
||||||
hdcsrc = GetDC(NULL);
|
hdcsrc = GetDC(NULL);
|
||||||
hdc = CreateCompatibleDC(hdcsrc);
|
hdc = CreateCompatibleDC(hdcsrc);
|
||||||
hBitmap = CreateCompatibleBitmap(hdcsrc, cxSmIcon, cySmIcon);
|
hBitmap = CreateCompatibleBitmap(hdcsrc, 16, 16);
|
||||||
ReleaseDC(NULL, hdcsrc);
|
ReleaseDC(NULL, hdcsrc);
|
||||||
|
|
||||||
if (hdc && hBitmap)
|
if (hdc && hBitmap)
|
||||||
{
|
{
|
||||||
hBmpNew = CreateBitmap(cxSmIcon, cySmIcon, 1, 1, NULL);
|
hBmpNew = CreateBitmap(16, 16, 1, 1, NULL);
|
||||||
if (hBmpNew)
|
if (hBmpNew)
|
||||||
{
|
{
|
||||||
hBmpOld = SelectObject(hdc, hBitmap);
|
hBmpOld = SelectObject(hdc, hBitmap);
|
||||||
rect.right = cxSmIcon;
|
rect.right = 16;
|
||||||
rect.left = 0;
|
rect.left = 0;
|
||||||
rect.bottom = cySmIcon;
|
rect.bottom = 16;
|
||||||
rect.top = 0;
|
rect.top = 0;
|
||||||
|
|
||||||
bkColor = SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT));
|
bkColor = SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT));
|
||||||
|
@ -70,14 +68,14 @@ CreateTrayIcon(LPTSTR szLCID)
|
||||||
|
|
||||||
ExtTextOut(hdc, rect.left, rect.top, ETO_OPAQUE, &rect, _T(""), 0, NULL);
|
ExtTextOut(hdc, rect.left, rect.top, ETO_OPAQUE, &rect, _T(""), 0, NULL);
|
||||||
|
|
||||||
hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
|
hFont = CreateFont(-11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
||||||
if (!hFont)
|
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||||
goto End;
|
DEFAULT_QUALITY, FF_DONTCARE, _T("Tahoma"));
|
||||||
|
|
||||||
hFontOld = SelectObject(hdc, hFont);
|
hFontOld = SelectObject(hdc, hFont);
|
||||||
DrawText(hdc, _tcsupr(szBuf), 2, &rect, DT_SINGLELINE|DT_CENTER|DT_VCENTER);
|
DrawText(hdc, _tcsupr(szBuf), 2, &rect, DT_SINGLELINE|DT_CENTER|DT_VCENTER);
|
||||||
SelectObject(hdc, hBmpNew);
|
SelectObject(hdc, hBmpNew);
|
||||||
PatBlt(hdc, 0, 0, cxSmIcon, cySmIcon, BLACKNESS);
|
PatBlt(hdc, 0, 0, 16, 16, BLACKNESS);
|
||||||
SelectObject(hdc, hBmpOld);
|
SelectObject(hdc, hBmpOld);
|
||||||
SelectObject(hdc, hFontOld);
|
SelectObject(hdc, hFontOld);
|
||||||
|
|
||||||
|
@ -86,15 +84,15 @@ CreateTrayIcon(LPTSTR szLCID)
|
||||||
IconInfo.fIcon = TRUE;
|
IconInfo.fIcon = TRUE;
|
||||||
|
|
||||||
hIcon = CreateIconIndirect(&IconInfo);
|
hIcon = CreateIconIndirect(&IconInfo);
|
||||||
End:
|
|
||||||
if (hBmpNew) DeleteObject(hBmpNew);
|
DeleteObject(hBmpNew);
|
||||||
if (hBmpOld) DeleteObject(hBmpOld);
|
DeleteObject(hBmpOld);
|
||||||
if (hFont) DeleteObject(hFont);
|
DeleteObject(hFont);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdc) DeleteDC(hdc);
|
DeleteDC(hdc);
|
||||||
if (hBitmap) DeleteObject(hBitmap);
|
DeleteObject(hBitmap);
|
||||||
|
|
||||||
return hIcon;
|
return hIcon;
|
||||||
}
|
}
|
||||||
|
@ -386,23 +384,6 @@ GetNextLayout()
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
|
||||||
SettingsChanging(HWND hwnd)
|
|
||||||
{
|
|
||||||
UINT cxSmIconCur = 0, cySmIconCur = 0;
|
|
||||||
|
|
||||||
cxSmIconCur = GetSystemMetrics(SM_CXSMICON);
|
|
||||||
cySmIconCur = GetSystemMetrics(SM_CYSMICON);
|
|
||||||
|
|
||||||
if ((cxSmIcon != cxSmIconCur) || (cySmIcon != cySmIconCur))
|
|
||||||
{
|
|
||||||
cxSmIcon = cxSmIconCur;
|
|
||||||
cySmIcon = cySmIconCur;
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivateLayout(hwnd, ulCurrentLayoutNum);
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -413,9 +394,6 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
cxSmIcon = GetSystemMetrics(SM_CXSMICON);
|
|
||||||
cySmIcon = GetSystemMetrics(SM_CYSMICON);
|
|
||||||
|
|
||||||
SetHooks();
|
SetHooks();
|
||||||
AddTrayIcon(hwnd);
|
AddTrayIcon(hwnd);
|
||||||
hRightPopupMenu = GetSubMenu(LoadMenu(hInst, MAKEINTRESOURCE(IDR_POPUP)), 0);
|
hRightPopupMenu = GetSubMenu(LoadMenu(hInst, MAKEINTRESOURCE(IDR_POPUP)), 0);
|
||||||
|
@ -511,8 +489,6 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
case WM_SETTINGCHANGE:
|
case WM_SETTINGCHANGE:
|
||||||
{
|
{
|
||||||
SettingsChanging(hwnd);
|
|
||||||
|
|
||||||
if (wParam == SPI_SETDEFAULTINPUTLANG)
|
if (wParam == SPI_SETDEFAULTINPUTLANG)
|
||||||
{
|
{
|
||||||
//FIXME: Should detect default language changes by CPL applet or by other tools and update UI
|
//FIXME: Should detect default language changes by CPL applet or by other tools and update UI
|
||||||
|
|
Loading…
Reference in a new issue