示例#1
0
文件: recaps.cpp 项目: ki0ki0/recaps
///////////////////////////////////////////////////////////////////////////////
// Selects the entire current line and converts it to the current keyboard layout
void SwitchAndConvert(void*)
{
	SendKeyCombo(VK_CONTROL, 'A', TRUE);
	HKL sourceLayout = GetCurrentLayout();
	HKL targetLayout = SwitchLayout();
	ConvertSelectedTextInActiveWindow(sourceLayout, targetLayout);
}
示例#2
0
文件: recaps.cpp 项目: ki0ki0/recaps
///////////////////////////////////////////////////////////////////////////////
// A LowLevelHookProc implementation that captures the CapsLock key
LRESULT CALLBACK LowLevelHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	if(nCode < 0) return CallNextHookEx(g_hHook, nCode, wParam, lParam);

	KBDLLHOOKSTRUCT* data = (KBDLLHOOKSTRUCT*)lParam;
	BOOL caps = data->vkCode == VK_CAPITAL && wParam == WM_KEYDOWN;

	// ignore injected keystrokes
	if(caps && (data->flags & LLKHF_INJECTED) == 0)
	{
		BOOL ctrl = GetKeyState(VK_CONTROL) < 0;

		// Handle CapsLock - only switch current layout
		if(!ctrl)
		{
			SwitchLayout();
			return 1;
		}
		// Handle Ctrl-CapsLock - switch current layout and convert text in current field
		else
		{
			// We start SwitchLayoutAndConvertSelected in another thread since it simulates 
			// keystrokes to copy and paste the text which call back into this hook.
			// That isn't good..
			_beginthread(SwitchAndConvert, 0, NULL);
			return 1; // prevent windows from handling the keystroke
		}
	}

	return CallNextHookEx(g_hHook, nCode, wParam, lParam);
}
示例#3
0
VirtualKeyboardQt::VirtualKeyboardQt(MythMainWindow *parent,
                    QWidget *parentEdit,
                    const char *name,
                    bool setsize)
            : MythThemedDialog(parent, name, setsize)
{
    setFrameStyle(QFrame::Panel | QFrame::Raised);
    setLineWidth(1);
    m_parentEdit = parentEdit;

    SwitchLayout(gCoreContext->GetLanguage());
}
INT_PTR ServiceSwitch(WPARAM wParam, LPARAM lParam)
{
	SwitchLayout(lParam);
	return 0;
}