diff --git a/Cpp.Build.props b/Cpp.Build.props index 215128467c..fe251a9f45 100644 --- a/Cpp.Build.props +++ b/Cpp.Build.props @@ -42,7 +42,7 @@ pch.h Level4 - 26800;28251;6387;4458;4505;4702;6031;6248;26451;28182;%(DisableSpecificWarnings) + 26800;28251;6387;4505;4702;6031;6248;26451;28182;%(DisableSpecificWarnings) true TurnOffAllWarnings false diff --git a/src/common/logger/logger.cpp b/src/common/logger/logger.cpp index 444c0e787b..ed6a8f8550 100644 --- a/src/common/logger/logger.cpp +++ b/src/common/logger/logger.cpp @@ -98,11 +98,11 @@ void Logger::init(std::string loggerName, std::wstring logFilePath, std::wstring void Logger::init(std::vector sinks) { - auto logger = std::make_shared("", begin(sinks), end(sinks)); - if (!logger) + auto init_logger = std::make_shared("", begin(sinks), end(sinks)); + if (!init_logger) { return; } - Logger::logger = logger; + Logger::logger = init_logger; } diff --git a/src/modules/ShortcutGuide/ShortcutGuide/animation.cpp b/src/modules/ShortcutGuide/ShortcutGuide/animation.cpp index a0e390d50a..4bc039a3e2 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide/animation.cpp +++ b/src/modules/ShortcutGuide/ShortcutGuide/animation.cpp @@ -8,16 +8,16 @@ void Animation::reset() { start = std::chrono::high_resolution_clock::now(); } -void Animation::reset(double duration) +void Animation::reset(double animation_duration) { - this->duration = duration; + duration = animation_duration; reset(); } -void Animation::reset(double duration, double start, double stop) +void Animation::reset(double animation_duration, double animation_start, double animation_stop) { - start_value = start; - end_value = stop; - reset(duration); + start_value = animation_start; + end_value = animation_stop; + reset(animation_duration); } static double ease_out_expo(double t) diff --git a/src/modules/ShortcutGuide/ShortcutGuide/animation.h b/src/modules/ShortcutGuide/ShortcutGuide/animation.h index 0d75c56895..61ae59b661 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide/animation.h +++ b/src/modules/ShortcutGuide/ShortcutGuide/animation.h @@ -22,8 +22,8 @@ public: Animation(double duration = 1, double start = 0, double stop = 1); void reset(); - void reset(double duration); - void reset(double duration, double start, double stop); + void reset(double animation_duration); + void reset(double animation_duration, double animation_start, double animation_stop); double value(AnimFunctions apply_function) const; bool done() const; diff --git a/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.cpp b/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.cpp index 0acc615960..ddf5e30680 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.cpp +++ b/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.cpp @@ -297,13 +297,13 @@ D2DOverlayWindow::D2DOverlayWindow() : }); } -void D2DOverlayWindow::show(HWND active_window, bool snappable) +void D2DOverlayWindow::show(HWND window, bool snappable) { std::unique_lock lock(mutex); hidden = false; tasklist_buttons.clear(); - this->active_window = active_window; - this->active_window_snappable = snappable; + active_window = window; + active_window_snappable = snappable; auto old_bck = colors.start_color_menu; auto colors_updated = colors.update(); auto new_light_mode = (theme_setting == Light) || (theme_setting == System && colors.light_mode); @@ -355,10 +355,10 @@ void D2DOverlayWindow::show(HWND active_window, bool snappable) total_screen.rect.top += monitor_dy; total_screen.rect.bottom += monitor_dy; tasklist.update(); - if (active_window) + if (window) { // Ignore errors, if this fails we will just not show the thumbnail - DwmRegisterThumbnail(hwnd, active_window, &thumbnail); + DwmRegisterThumbnail(hwnd, window, &thumbnail); } background_animation.reset(); @@ -644,7 +644,7 @@ void D2DOverlayWindow::hide_thumbnail() DwmUpdateThumbnailProperties(thumbnail, &thumb_properties); } -void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc) +void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_device_context) { if (!hidden && !overlay_window_instance->overlay_visible()) { @@ -652,7 +652,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc) return; } - d2d_dc->Clear(); + d2d_device_context->Clear(); int taskbar_icon_shortcuts_x_offset = 0, taskbar_icon_shortcuts_y_offset = 0; float current_background_anim_value = (float)background_animation.value(Animation::AnimFunctions::LINEAR); @@ -665,12 +665,12 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc) winrt::com_ptr brush; float brush_opacity = get_overlay_opacity(); D2D1_COLOR_F brushColor = light_mode ? D2D1::ColorF(1.0f, 1.0f, 1.0f, brush_opacity) : D2D1::ColorF(0, 0, 0, brush_opacity); - winrt::check_hresult(d2d_dc->CreateSolidColorBrush(brushColor, brush.put())); + winrt::check_hresult(d2d_device_context->CreateSolidColorBrush(brushColor, brush.put())); D2D1_RECT_F background_rect = {}; background_rect.bottom = (float)window_height; background_rect.right = (float)window_width; - d2d_dc->SetTransform(D2D1::Matrix3x2F::Identity()); - d2d_dc->FillRectangle(background_rect, brush.get()); + d2d_device_context->SetTransform(D2D1::Matrix3x2F::Identity()); + d2d_device_context->FillRectangle(background_rect, brush.get()); // Draw the taskbar shortcuts (the arrows with numbers) if (taskbar_icon_shortcuts_shown) @@ -703,7 +703,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc) { continue; } - render_arrow(arrows[(size_t)(button.keynum) - 1], button, window_rect, use_overlay->get_scale(), d2d_dc, taskbar_icon_shortcuts_x_offset, taskbar_icon_shortcuts_y_offset); + render_arrow(arrows[(size_t)(button.keynum) - 1], button, window_rect, use_overlay->get_scale(), d2d_device_context, taskbar_icon_shortcuts_x_offset, taskbar_icon_shortcuts_y_offset); } } } @@ -793,7 +793,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc) { brushColor = D2D1::ColorF(colors.start_color_menu, miniature_shown ? current_global_windows_shortcuts_anim_value * 0.9f : current_global_windows_shortcuts_anim_value * 0.3f); brush = nullptr; - winrt::check_hresult(d2d_dc->CreateSolidColorBrush(brushColor, brush.put())); + winrt::check_hresult(d2d_device_context->CreateSolidColorBrush(brushColor, brush.put())); for (auto& monitor : monitors) { D2D1_RECT_F monitor_rect; @@ -802,22 +802,22 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc) monitor_rect.top = (float)((monitor_size.top() + monitor_dy) * rect_and_scale.scale + rect_and_scale.rect.top); monitor_rect.right = (float)((monitor_size.right() + monitor_dx) * rect_and_scale.scale + rect_and_scale.rect.left); monitor_rect.bottom = (float)((monitor_size.bottom() + monitor_dy) * rect_and_scale.scale + rect_and_scale.rect.top); - d2d_dc->SetTransform(D2D1::Matrix3x2F::Identity()); - d2d_dc->FillRectangle(monitor_rect, brush.get()); + d2d_device_context->SetTransform(D2D1::Matrix3x2F::Identity()); + d2d_device_context->FillRectangle(monitor_rect, brush.get()); } } // Finalize the overlay - dimm the buttons if no thumbnail is present and show "No active window" use_overlay->toggle_window_group(miniature_shown || window_state == MINIMIZED); if (!miniature_shown && window_state != MINIMIZED) { - no_active.render(d2d_dc); + no_active.render(d2d_device_context); window_state = UNKNOWN; } // Set the animation - move the draw window according to animation step int global_windows_shortcuts_y_offset = (int)(pos_global_windows_shortcuts_anim_value * use_overlay->height() * use_overlay->get_scale()); auto popIn = D2D1::Matrix3x2F::Translation(0, (float)global_windows_shortcuts_y_offset); - d2d_dc->SetTransform(popIn); + d2d_device_context->SetTransform(popIn); // Animate keys for (unsigned id = 0; id < key_animations.size();) @@ -846,7 +846,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc) ++id; } // Finally: render the overlay... - use_overlay->render(d2d_dc); + use_overlay->render(d2d_device_context); // ... window arrows texts ... std::wstring left, right, up, down; bool left_disabled = false; @@ -925,13 +925,13 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc) } 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); + text.set_alignment_center().write(d2d_device_context, text_color, use_overlay->get_maximize_label(), up); use_overlay->find_element(L"KeyDownGroup")->SetAttributeValue(L"fill-opacity", down_disabled ? 0.3f : 1.0f); - text.write(d2d_dc, text_color, use_overlay->get_minimize_label(), down); + text.write(d2d_device_context, text_color, use_overlay->get_minimize_label(), down); use_overlay->find_element(L"KeyLeftGroup")->SetAttributeValue(L"fill-opacity", left_disabled ? 0.3f : 1.0f); - text.set_alignment_right().write(d2d_dc, text_color, use_overlay->get_snap_left(), left); + text.set_alignment_right().write(d2d_device_context, text_color, use_overlay->get_snap_left(), left); use_overlay->find_element(L"KeyRightGroup")->SetAttributeValue(L"fill-opacity", right_disabled ? 0.3f : 1.0f); - text.set_alignment_left().write(d2d_dc, text_color, use_overlay->get_snap_right(), right); + text.set_alignment_left().write(d2d_device_context, text_color, use_overlay->get_snap_right(), right); } else { diff --git a/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.h b/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.h index 8d7b216a54..440bae0021 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.h +++ b/src/modules/ShortcutGuide/ShortcutGuide/overlay_window.h @@ -48,7 +48,7 @@ class D2DOverlayWindow : public D2DWindow { public: D2DOverlayWindow(); - void show(HWND active_window, bool snappable); + void show(HWND window, bool snappable); ~D2DOverlayWindow(); void apply_overlay_opacity(float opacity); void apply_press_time_for_global_windows_shortcuts(int press_time); @@ -57,9 +57,9 @@ public: void quick_hide(); HWND get_window_handle(); - void SetWindowCloseType(std::wstring windowCloseType) + void SetWindowCloseType(std::wstring wCloseType) { - this->windowCloseType = windowCloseType; + windowCloseType = wCloseType; } private: @@ -68,7 +68,7 @@ private: void hide_thumbnail(); virtual void init() override; virtual void resize() override; - virtual void render(ID2D1DeviceContext5* d2d_dc) override; + virtual void render(ID2D1DeviceContext5* d2dd2d_device_context_dc) override; virtual void on_show() override; virtual void on_hide() override; float get_overlay_opacity(); diff --git a/src/modules/fancyzones/FancyZonesLib/FancyZones.cpp b/src/modules/fancyzones/FancyZonesLib/FancyZones.cpp index 26be38f4a8..0539abc16e 100644 --- a/src/modules/fancyzones/FancyZonesLib/FancyZones.cpp +++ b/src/modules/fancyzones/FancyZonesLib/FancyZones.cpp @@ -56,14 +56,14 @@ namespace NonLocalizable struct FancyZones : public winrt::implements, public SettingsObserver { public: - FancyZones(HINSTANCE hinstance, std::function disableModuleCallback) noexcept : + FancyZones(HINSTANCE hinstance, std::function disableModuleCallbackFunction) noexcept : SettingsObserver({ SettingId::EditorHotkey, SettingId::PrevTabHotkey, SettingId::NextTabHotkey, SettingId::SpanZonesAcrossMonitors }), m_hinstance(hinstance), m_windowMoveHandler([this]() { PostMessageW(m_window, WM_PRIV_LOCATIONCHANGE, NULL, NULL); }) { - this->disableModuleCallback = std::move(disableModuleCallback); + this->disableModuleCallback = std::move(disableModuleCallbackFunction); FancyZonesSettings::instance().LoadSettings(); diff --git a/src/modules/fancyzones/FancyZonesLib/GuidUtils.h b/src/modules/fancyzones/FancyZonesLib/GuidUtils.h index 213ffdcbb3..7b3e1a97cf 100644 --- a/src/modules/fancyzones/FancyZonesLib/GuidUtils.h +++ b/src/modules/fancyzones/FancyZonesLib/GuidUtils.h @@ -1,6 +1,12 @@ #pragma once +// disabling warning 4458 - declaration of 'identifier' hides class member +// to avoid warnings from GDI files - can't add winRT directory to external code +// in the Cpp.Build.props +#pragma warning(push) +#pragma warning(disable : 4458) #include "gdiplus.h" +#pragma warning(pop) namespace std { diff --git a/src/modules/fancyzones/FancyZonesLib/WindowUtils.h b/src/modules/fancyzones/FancyZonesLib/WindowUtils.h index 9ffa3ac202..a46ce4aa20 100644 --- a/src/modules/fancyzones/FancyZonesLib/WindowUtils.h +++ b/src/modules/fancyzones/FancyZonesLib/WindowUtils.h @@ -2,7 +2,13 @@ #include +// disabling warning 4458 - declaration of 'identifier' hides class member +// to avoid warnings from GDI files - can't add winRT directory to external code +// in the Cpp.Build.props +#pragma warning(push) +#pragma warning(disable : 4458) #include "gdiplus.h" +#pragma warning(pop) #include #include diff --git a/src/modules/fancyzones/FancyZonesLib/WorkArea.cpp b/src/modules/fancyzones/FancyZonesLib/WorkArea.cpp index 72e21fdaf3..58608f5401 100644 --- a/src/modules/fancyzones/FancyZonesLib/WorkArea.cpp +++ b/src/modules/fancyzones/FancyZonesLib/WorkArea.cpp @@ -21,7 +21,13 @@ #include #include +// disabling warning 4458 - declaration of 'identifier' hides class member +// to avoid warnings from GDI files - can't add winRT directory to external code +// in the Cpp.Build.props +#pragma warning(push) +#pragma warning(disable : 4458) #include +#pragma warning(pop) // Non-Localizable strings namespace NonLocalizable @@ -58,7 +64,6 @@ namespace } public: - HWND NewZonesOverlayWindow(Rect position, HINSTANCE hinstance, WorkArea* owner) { HWND windowFromPool = ExtractWindow(); @@ -216,7 +221,7 @@ void WorkArea::MoveWindowIntoZoneByIndexSet(HWND window, const ZoneIndexSet& ind auto adjustedRect = FancyZonesWindowUtils::AdjustRectForSizeWindowToRect(window, rect, m_window); FancyZonesWindowUtils::SizeWindowToRect(window, adjustedRect); } - + m_layoutWindows->Assign(window, indexSet); FancyZonesWindowProperties::StampZoneIndexProperty(window, indexSet); @@ -270,7 +275,7 @@ bool WorkArea::MoveWindowIntoZoneByDirectionAndIndex(HWND window, DWORD vkCode, { SaveWindowProcessToZoneIndex(window); } - + return true; } @@ -284,7 +289,7 @@ bool WorkArea::MoveWindowIntoZoneByDirectionAndPosition(HWND window, DWORD vkCod const auto& zones = m_layout->Zones(); std::vector usedZoneIndices(zones.size(), false); auto windowZones = m_layoutWindows->GetZoneIndexSetFromWindow(window); - + for (ZoneIndex id : windowZones) { usedZoneIndices[id] = true; @@ -561,7 +566,7 @@ bool WorkArea::InitWindow(HINSTANCE hinstance) noexcept void WorkArea::InitLayout(const FancyZonesDataTypes::WorkAreaId& parentUniqueId) noexcept { Logger::info(L"Initialize layout on {}", m_uniqueId.toString()); - + bool isLayoutAlreadyApplied = AppliedLayouts::instance().IsLayoutApplied(m_uniqueId); if (!isLayoutAlreadyApplied) { @@ -574,7 +579,7 @@ void WorkArea::InitLayout(const FancyZonesDataTypes::WorkAreaId& parentUniqueId) AppliedLayouts::instance().ApplyDefaultLayout(m_uniqueId); } } - + CalculateZoneSet(); } @@ -666,4 +671,3 @@ LRESULT CALLBACK WorkArea::s_WndProc(HWND window, UINT message, WPARAM wparam, L return (thisRef != nullptr) ? thisRef->WndProc(message, wparam, lparam) : DefWindowProc(window, message, wparam, lparam); } - diff --git a/src/modules/fancyzones/FancyZonesTests/UnitTests/JsonHelpers.Tests.cpp b/src/modules/fancyzones/FancyZonesTests/UnitTests/JsonHelpers.Tests.cpp index 68a6ee19ea..f644e04d1b 100644 --- a/src/modules/fancyzones/FancyZonesTests/UnitTests/JsonHelpers.Tests.cpp +++ b/src/modules/fancyzones/FancyZonesTests/UnitTests/JsonHelpers.Tests.cpp @@ -239,8 +239,8 @@ namespace FancyZonesUnitTests TEST_METHOD (FromJsonInvalidTypes) { - json::JsonObject m_json = json::JsonObject::Parse(L"{\"ref-width\": true, \"ref-height\": \"string\", \"zones\": [{\"X\": \"11\", \"Y\": \"22\", \"width\": \".\", \"height\": \"*\"}, {\"X\": null, \"Y\": {}, \"width\": [], \"height\": \"абвгд\"}]}"); - Assert::IsFalse(CanvasLayoutInfoJSON::FromJson(m_json).has_value()); + json::JsonObject local_json = json::JsonObject::Parse(L"{\"ref-width\": true, \"ref-height\": \"string\", \"zones\": [{\"X\": \"11\", \"Y\": \"22\", \"width\": \".\", \"height\": \"*\"}, {\"X\": null, \"Y\": {}, \"width\": [], \"height\": \"абвгд\"}]}"); + Assert::IsFalse(CanvasLayoutInfoJSON::FromJson(local_json).has_value()); } }; diff --git a/src/runner/main.cpp b/src/runner/main.cpp index 9921eaa153..5c880b59df 100644 --- a/src/runner/main.cpp +++ b/src/runner/main.cpp @@ -46,7 +46,14 @@ #include #include #include + +// disabling warning 4458 - declaration of 'identifier' hides class member +// to avoid warnings from GDI files - can't add winRT directory to external code +// in the Cpp.Build.props +#pragma warning(push) +#pragma warning(disable : 4458) #include +#pragma warning(pop) namespace { diff --git a/tools/BugReportTool/BugReportTool/EventViewer.cpp b/tools/BugReportTool/BugReportTool/EventViewer.cpp index bc4e99dbb1..81024e2088 100644 --- a/tools/BugReportTool/BugReportTool/EventViewer.cpp +++ b/tools/BugReportTool/BugReportTool/EventViewer.cpp @@ -95,7 +95,7 @@ namespace } // Enumerate all the events in the result set. - void PrintResults(EVT_HANDLE hResults) + void PrintResults(EVT_HANDLE results) { DWORD status = ERROR_SUCCESS; EVT_HANDLE hEvents[BATCH_SIZE]; @@ -104,7 +104,7 @@ namespace while (true) { // Get a block of events from the result set. - if (!EvtNext(hResults, BATCH_SIZE, hEvents, INFINITE, 0, &dwReturned)) + if (!EvtNext(results, BATCH_SIZE, hEvents, INFINITE, 0, &dwReturned)) { if (ERROR_NO_MORE_ITEMS != (status = GetLastError())) { diff --git a/tools/BugReportTool/BugReportTool/InstallationFolder.cpp b/tools/BugReportTool/BugReportTool/InstallationFolder.cpp index 792aaee9c0..01fcc06d9d 100644 --- a/tools/BugReportTool/BugReportTool/InstallationFolder.cpp +++ b/tools/BugReportTool/BugReportTool/InstallationFolder.cpp @@ -162,8 +162,8 @@ private: { auto path = tmpDir; path += "installationFolderStructure.txt"; - std::wofstream os = std::wofstream(path); - return os; + std::wofstream out_s = std::wofstream(path); + return out_s; } public: Reporter(const path& tmpDir)