Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions RimeWithWeasel/RimeWithWeasel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,6 @@ DWORD RimeWithWeaselHandler::RemoveSession(WeaselSessionId ipc_id) {
return 0;
}

namespace ibus {
enum Keycode {
Escape = 0xFF1B,
XK_bracketleft = 0x005b, /* U+005B LEFT SQUARE BRACKET */
XK_c = 0x0063, /* U+0063 LATIN SMALL LETTER C */
XK_C = 0x0043, /* U+0043 LATIN CAPITAL LETTER C */
};
}

void RimeWithWeaselHandler::UpdateColorTheme(BOOL darkMode) {
RimeConfig config = {NULL};
if (rime_api->config_open("weasel", &config)) {
Expand Down Expand Up @@ -322,7 +313,8 @@ BOOL RimeWithWeaselHandler::ProcessKeyEvent(KeyEvent keyEvent,
RimeSessionId session_id = to_session_id(ipc_id);
Bool handled = rime_api->process_key(session_id, keyEvent.keycode,
expand_ibus_modifier(keyEvent.mask));
if (!handled) {
// vim_mode when keydown only
if (!handled && !(keyEvent.mask & ibus::Modifier::RELEASE_MASK)) {
bool isVimBackInCommandMode =
(keyEvent.keycode == ibus::Keycode::Escape) ||
((keyEvent.mask & (1 << 2)) &&
Expand Down
2 changes: 1 addition & 1 deletion WeaselIME/KeyEvent.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "stdafx.h"
#include "KeyEvent.h"
#include <KeyEvent.h>

bool ConvertKeyEvent(UINT vkey,
KeyInfo kinfo,
Expand Down
2 changes: 1 addition & 1 deletion WeaselIME/WeaselIME.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include <WeaselIPC.h>
#include "KeyEvent.h"
#include <KeyEvent.h>

#define MAX_COMPOSITION_SIZE 256

Expand Down
1 change: 0 additions & 1 deletion WeaselIME/WeaselIME.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="immdev.h" />
<ClInclude Include="KeyEvent.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
Expand Down
5 changes: 1 addition & 4 deletions WeaselIME/WeaselIME.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
<ClInclude Include="immdev.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="KeyEvent.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand All @@ -71,4 +68,4 @@
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion WeaselTSF/CandidateList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "WeaselTSF.h"
#include "CandidateList.h"
#include "KeyEvent.h"
#include <KeyEvent.h>
#include <math.h>

using namespace std;
Expand Down
2 changes: 1 addition & 1 deletion WeaselTSF/KeyEvent.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "stdafx.h"
#include "KeyEvent.h"
#include <KeyEvent.h>

bool ConvertKeyEvent(UINT vkey,
KeyInfo kinfo,
Expand Down
232 changes: 0 additions & 232 deletions WeaselTSF/KeyEvent.h

This file was deleted.

2 changes: 1 addition & 1 deletion WeaselTSF/KeyEventSink.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "stdafx.h"
#include "WeaselIPC.h"
#include "WeaselTSF.h"
#include "KeyEvent.h"
#include <KeyEvent.h>
#include "CandidateList.h"

static weasel::KeyEvent prevKeyEvent;
Expand Down
1 change: 0 additions & 1 deletion WeaselTSF/WeaselTSF.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@
<ClInclude Include="EditSession.h" />
<ClInclude Include="EnumDisplayAttributeInfo.h" />
<ClInclude Include="Globals.h" />
<ClInclude Include="KeyEvent.h" />
<ClInclude Include="LanguageBar.h" />
<ClInclude Include="Register.h" />
<ClInclude Include="resource.h" />
Expand Down
5 changes: 1 addition & 4 deletions WeaselTSF/WeaselTSF.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@
<ClInclude Include="WeaselTSF.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="KeyEvent.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="EditSession.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -140,4 +137,4 @@
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
</Project>
17 changes: 16 additions & 1 deletion WeaselIME/KeyEvent.h → include/KeyEvent.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#include <WeaselIPC.h>

struct KeyInfo {
UINT repeatCount : 16;
Expand All @@ -15,6 +14,19 @@ struct KeyInfo {
operator UINT32() { return *reinterpret_cast<UINT32*>(this); }
};

namespace weasel {
struct KeyEvent {
UINT keycode : 16;
UINT mask : 16;
KeyEvent() : keycode(0), mask(0) {}
KeyEvent(UINT _keycode, UINT _mask) : keycode(_keycode), mask(_mask) {}
KeyEvent(UINT x) { *reinterpret_cast<UINT*>(this) = x; }
operator UINT32 const() const {
return *reinterpret_cast<UINT32 const*>(this);
}
};
} // namespace weasel

bool ConvertKeyEvent(UINT vkey,
KeyInfo kinfo,
const LPBYTE keyState,
Expand Down Expand Up @@ -198,6 +210,9 @@ enum Keycode {
Super_R = 0xFFEC,
Hyper_L = 0xFFED,
Hyper_R = 0xFFEE,
XK_bracketleft = 0x005b, /* U+005B LEFT SQUARE BRACKET */
XK_c = 0x0063, /* U+0063 LATIN SMALL LETTER C */
XK_C = 0x0043, /* U+0043 LATIN CAPITAL LETTER C */
Null = 0
};

Expand Down
Loading