Skip to content

Commit

Permalink
Spelling: ... shortcut guide (#3790)
Browse files Browse the repository at this point in the history
* spelling: dimension

* spelling: hidden

* spelling: miniature

* spelling: parent

* spelling: popin

* spelling: signal

* spelling: suppress
  • Loading branch information
jsoref committed May 27, 2020
1 parent df93f4b commit ac6b971
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
34 changes: 17 additions & 17 deletions src/modules/shortcut_guide/overlay_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void D2DOverlayWindow::animate(int vk_code, int offset)
AnimateKeys animation;
std::wstring id;
animation.vk_code = vk_code;
winrt::com_ptr<ID2D1SvgElement> button_letter, parrent;
winrt::com_ptr<ID2D1SvgElement> button_letter, parent;
if (vk_code >= 0x41 && vk_code <= 0x5A)
{
id.push_back('A' + (vk_code - 0x41));
Expand Down Expand Up @@ -373,16 +373,16 @@ void D2DOverlayWindow::animate(int vk_code, int offset)
{
return;
}
button_letter->GetParent(parrent.put());
if (!parrent)
button_letter->GetParent(parent.put());
if (!parent)
{
return;
}
parrent->GetPreviousChild(button_letter.get(), animation.button.put());
parent->GetPreviousChild(button_letter.get(), animation.button.put());
if (!animation.button || !animation.button->IsAttributeSpecified(L"fill"))
{
animation.button = nullptr;
parrent->GetNextChild(button_letter.get(), animation.button.put());
parent->GetNextChild(button_letter.get(), animation.button.put());
}
if (!animation.button || !animation.button->IsAttributeSpecified(L"fill"))
{
Expand Down Expand Up @@ -626,7 +626,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc)
return;
}
d2d_dc->Clear();
int x_offset = 0, y_offset = 0, dimention = 0;
int x_offset = 0, y_offset = 0, dimension = 0;
auto current_anim_value = (float)animation.value(Animation::AnimFunctions::LINEAR);
SetLayeredWindowAttributes(hwnd, 0, (int)(255 * current_anim_value), LWA_ALPHA);
double pos_anim_value = 1 - animation.value(Animation::AnimFunctions::EASE_OUT_EXPO);
Expand Down Expand Up @@ -668,7 +668,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc)
// Thumbnail logic:
auto window_state = get_window_state(active_window);
auto thumb_window = get_window_pos(active_window);
bool minature_shown = active_window != nullptr && thumbnail != nullptr && thumb_window && window_state != MINIMIZED;
bool miniature_shown = active_window != nullptr && thumbnail != nullptr && thumb_window && window_state != MINIMIZED;
RECT client_rect;
if (thumb_window && GetClientRect(active_window, &client_rect))
{
Expand All @@ -679,9 +679,9 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc)
thumb_window->top += dy;
thumb_window->bottom -= dy;
}
if (minature_shown && thumb_window->right - thumb_window->left <= 0 || thumb_window->bottom - thumb_window->top <= 0)
if (miniature_shown && thumb_window->right - thumb_window->left <= 0 || thumb_window->bottom - thumb_window->top <= 0)
{
minature_shown = false;
miniature_shown = false;
}
bool render_monitors = true;
auto total_monitor_with_screen = total_screen;
Expand All @@ -703,7 +703,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc)
total_monitor_with_screen = total_screen;
}
auto rect_and_scale = use_overlay->get_thumbnail_rect_and_scale(0, 0, total_monitor_with_screen.width(), total_monitor_with_screen.height(), 1);
if (minature_shown)
if (miniature_shown)
{
RECT thumbnail_pos;
if (render_monitors)
Expand All @@ -719,7 +719,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc)
}
// If the animation is done show the thumbnail
// we cannot animate the thumbnail, the animation lags behind
minature_shown = show_thumbnail(thumbnail_pos, current_anim_value);
miniature_shown = show_thumbnail(thumbnail_pos, current_anim_value);
}
else
{
Expand All @@ -732,7 +732,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc)
// render the monitors
if (render_monitors)
{
brushColor = D2D1::ColorF(colors.desktop_fill_color, minature_shown ? current_anim_value : current_anim_value * 0.3f);
brushColor = D2D1::ColorF(colors.desktop_fill_color, miniature_shown ? current_anim_value : current_anim_value * 0.3f);
brush = nullptr;
winrt::check_hresult(d2d_dc->CreateSolidColorBrush(brushColor, brush.put()));
for (auto& monitor : monitors)
Expand All @@ -747,16 +747,16 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc)
}
}
// Finalize the overlay - dimm the buttons if no thumbnail is present and show "No active window"
use_overlay->toggle_window_group(minature_shown || window_state == MINIMIZED);
if (!minature_shown && window_state != MINIMIZED)
use_overlay->toggle_window_group(miniature_shown || window_state == MINIMIZED);
if (!miniature_shown && window_state != MINIMIZED)
{
no_active.render(d2d_dc);
window_state = UNKNOWN;
}

// Set the animation - move the draw window according to animation step
auto popin = D2D1::Matrix3x2F::Translation((float)x_offset, (float)y_offset);
d2d_dc->SetTransform(popin);
auto popIn = D2D1::Matrix3x2F::Translation((float)x_offset, (float)y_offset);
d2d_dc->SetTransform(popIn);

// Animate keys
for (unsigned id = 0; id < key_animations.size();)
Expand Down Expand Up @@ -862,7 +862,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc)
down = GET_RESOURCE_STRING(IDS_NO_ACTION);
down_disabled = true;
}
auto text_color = D2D1::ColorF(light_mode ? 0x222222 : 0xDDDDDD, active_window_snappable && (minature_shown || window_state == MINIMIZED) ? 1.0f : 0.3f);
auto text_color = D2D1::ColorF(light_mode ? 0x222222 : 0xDDDDDD, active_window_snappable && (miniature_shown || window_state == MINIMIZED) ? 1.0f : 0.3f);
use_overlay->find_element(L"KeyUpGroup")->SetAttributeValue(L"fill-opacity", up_disabled ? 0.3f : 1.0f);
text.set_alignment_center().write(d2d_dc, text_color, use_overlay->get_maximize_label(), up);
use_overlay->find_element(L"KeyDownGroup")->SetAttributeValue(L"fill-opacity", down_disabled ? 0.3f : 1.0f);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/shortcut_guide/shortcut_guide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void OverlayWindow::quick_hide()

void OverlayWindow::was_hidden()
{
target_state->was_hiden();
target_state->was_hidden();
}

void OverlayWindow::destroy()
Expand Down
14 changes: 7 additions & 7 deletions src/modules/shortcut_guide/target_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ bool TargetState::signal_event(unsigned vk_code, bool key_down)
// It can be safely done when the user releases the WinKey.
instance->quick_hide();
}
bool supress = false;
bool suppress = false;
if (!key_down && (vk_code == VK_LWIN || vk_code == VK_RWIN) &&
state == Shown &&
std::chrono::system_clock::now() - singnal_timestamp > std::chrono::milliseconds(300) &&
std::chrono::system_clock::now() - signal_timestamp > std::chrono::milliseconds(300) &&
!key_was_pressed)
{
supress = true;
suppress = true;
}
events.push_back({ key_down, vk_code });
lock.unlock();
cv.notify_one();
if (supress)
if (suppress)
{
// Send a fake key-stroke to prevent the start menu from appearing.
// We use 0xCF VK code, which is reserved. It still prevents the
Expand All @@ -54,10 +54,10 @@ bool TargetState::signal_event(unsigned vk_code, bool key_down)
input[2].ki.dwExtraInfo = CommonSharedConstants::KEYBOARDMANAGER_INJECTED_FLAG;
SendInput(3, input, sizeof(INPUT));
}
return supress;
return suppress;
}

void TargetState::was_hiden()
void TargetState::was_hidden()
{
std::unique_lock<std::mutex> lock(mutex);
state = Hidden;
Expand Down Expand Up @@ -173,7 +173,7 @@ void TargetState::handle_timeout()
}
if (std::chrono::system_clock::now() - winkey_timestamp < delay)
return;
singnal_timestamp = std::chrono::system_clock::now();
signal_timestamp = std::chrono::system_clock::now();
key_was_pressed = false;
state = Shown;
lock.unlock();
Expand Down
4 changes: 2 additions & 2 deletions src/modules/shortcut_guide/target_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TargetState
public:
TargetState(int ms_delay);
bool signal_event(unsigned vk_code, bool key_down);
void was_hiden();
void was_hidden();
void exit();
void set_delay(int ms_delay);

Expand All @@ -29,7 +29,7 @@ class TargetState
void thread_proc();
std::mutex mutex;
std::condition_variable cv;
std::chrono::system_clock::time_point winkey_timestamp, singnal_timestamp;
std::chrono::system_clock::time_point winkey_timestamp, signal_timestamp;
std::chrono::milliseconds delay;
std::deque<KeyEvent> events;
enum
Expand Down

0 comments on commit ac6b971

Please sign in to comment.