Skip to content

Commit

Permalink
Prevent QuickLook from being triggered when switching input methods
Browse files Browse the repository at this point in the history
  • Loading branch information
hbl917070 committed Nov 6, 2024
1 parent 6a51f75 commit 783c952
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 9 additions & 1 deletion Tiefsee/StartWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@ private void InitQuickLook() {
Adapter.LoopRun(50, () => {

bool isKeyboardSpace = Keyboard.IsKeyDown(Key.Space); // 按著空白鍵
bool isMouseMiddle = System.Windows.Forms.Control.MouseButtons == System.Windows.Forms.MouseButtons.Middle; //按著滑鼠滾輪

// 避免與切換輸入法的快速鍵衝突
if (isDown == false && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl) ||
Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift) ||
Keyboard.IsKeyDown(Key.LeftAlt) || Keyboard.IsKeyDown(Key.RightAlt))) {
isKeyboardSpace = false;
}

bool isMouseMiddle = Control.MouseButtons == MouseButtons.Middle; // 按著滑鼠滾輪

int quickLookRunType = 0;
if (isKeyboardSpace) { quickLookRunType = 1; }
Expand Down
8 changes: 2 additions & 6 deletions Tiefsee/VW/WV_System.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,10 @@ public async Task<string> SetTiefseTask(bool val) {
/// 取得當前是否按著空白鍵跟滑鼠滾輪
/// </summary>
public string GetDownKey() {
bool isKeyboardSpace = Keyboard.IsKeyDown(Key.Space); // 按著空白鍵
bool isMouseMiddle = System.Windows.Forms.Control.MouseButtons == System.Windows.Forms.MouseButtons.Middle; // 按著滑鼠滾輪

var obj = new {
isKeyboardSpace = isKeyboardSpace,
isMouseMiddle = isMouseMiddle
isKeyboardSpace = Keyboard.IsKeyDown(Key.Space), // 按著空白鍵
isMouseMiddle = Control.MouseButtons == MouseButtons.Middle, // 按著滑鼠滾輪
};

return JsonSerializer.Serialize(obj);
}

Expand Down

0 comments on commit 783c952

Please sign in to comment.