From f385e4692752fe2ea6fe0e5e7bbf2b80db3ef2c0 Mon Sep 17 00:00:00 2001 From: yuyoyuppe Date: Thu, 12 Dec 2019 12:25:19 +0300 Subject: [PATCH] Devdocs reorganisation (#913) * docs: split usage and dev docs * # This is a combination of 2 commits. # This is the 1st commit message: docs: split usage and dev docs # The commit message #2 will be skipped: # fixup add docs * docs: add runner documentation and move hooks documentation to devdocs * docs: add stubs for modules technical description * docs: add paragraph about event thread-safety * docs: add 'Current modules' section header --- doc/coding/organization.md | 23 --- doc/devdocs/common.md | 45 +++++ doc/devdocs/modules/example_powertoy.md | 5 + doc/devdocs/modules/fancyzones.md | 85 +++++++++ .../devdocs/modules/interface.md | 59 +++--- doc/devdocs/modules/powerrename.md | 26 +++ doc/devdocs/modules/shortcut_guide.md | 17 ++ doc/devdocs/readme.md | 79 ++++++++ doc/devdocs/runner.md | 36 ++++ .../README.md => doc/devdocs/settings-web.md | 39 ++-- doc/devdocs/settings.md | 8 + .../shared-hooks.md} | 170 +++++++++--------- doc/{coding => devdocs}/style.md | 0 src/common/README.md | 48 ----- src/modules/README.md | 21 --- src/modules/example_powertoy/README.md | 22 --- src/modules/fancyzones/README.md | 6 +- src/modules/shortcut_guide/README.md | 20 --- src/runner/README.md | 50 ------ src/settings/README.md | 21 --- 20 files changed, 432 insertions(+), 348 deletions(-) delete mode 100644 doc/coding/organization.md create mode 100644 doc/devdocs/common.md create mode 100644 doc/devdocs/modules/example_powertoy.md create mode 100644 doc/devdocs/modules/fancyzones.md rename src/modules/interface/README.md => doc/devdocs/modules/interface.md (92%) create mode 100644 doc/devdocs/modules/powerrename.md create mode 100644 doc/devdocs/modules/shortcut_guide.md create mode 100644 doc/devdocs/readme.md create mode 100644 doc/devdocs/runner.md rename src/settings-web/README.md => doc/devdocs/settings-web.md (80%) create mode 100644 doc/devdocs/settings.md rename doc/{specs/Shared-hooks.md => devdocs/shared-hooks.md} (97%) rename doc/{coding => devdocs}/style.md (100%) delete mode 100644 src/common/README.md delete mode 100644 src/modules/README.md delete mode 100644 src/modules/example_powertoy/README.md delete mode 100644 src/runner/README.md delete mode 100644 src/settings/README.md diff --git a/doc/coding/organization.md b/doc/coding/organization.md deleted file mode 100644 index 077a3535e..000000000 --- a/doc/coding/organization.md +++ /dev/null @@ -1,23 +0,0 @@ -# Code Organization - -## Rules - -- **Follow the pattern of what you already see in the code** -- Try to package new ideas/components into libraries that have nicely defined interfaces -- Package new ideas into classes or refactor existing ideas into a class as you extend - -## Code Overview - -General project organization: - -#### The [`doc`](/doc) folder -Documentation for the project, including a [coding guide](/doc/coding) and [design docs](/doc/specs). - -#### The [`installer`](/installer) folder -Contains the source code of the PowerToys installer. - -#### The [`src`](/src) folder -Contains the source code of the PowerToys runner and of all of the PowerToys modules. **This is where the most of the magic happens.** - -#### The [`tools`](/tools) folder -Various tools used by PowerToys. Includes the Visual Studio 2019 project template for new PowerToys. diff --git a/doc/devdocs/common.md b/doc/devdocs/common.md new file mode 100644 index 000000000..2c89bc751 --- /dev/null +++ b/doc/devdocs/common.md @@ -0,0 +1,45 @@ +# Classes and structures + +#### class Animation: [header](/src/common/animation.h) [source](/src/common/animation.cpp) +Animation helper class with two easing-in animations: linear and exponential. + +#### class AsyncMessageQueue: [header](/src/common/async_message_queue.h) +Header-only asynchronous message queue. Used by `TwoWayPipeMessageIPC`. + +#### class TwoWayPipeMessageIPC: [header](/src/common/two_way_pipe_message_ipc.h) +Header-only asynchronous IPC messaging class. Used by the runner to communicate with the settings window. + +#### class D2DSVG: [header](/src/common/d2d_svg.h) [source](/src/common/d2d_svg.cpp) +Class for loading, rendering and for some basic modifications of SVG graphics. + +#### class D2DText: [header](/src/common/d2d_text.h) [source](/src/common/d2d_text.cpp) +Class for rendering text using DirectX. + +#### class D2DWindow: [header](/src/common/d2d_window.h) [source](/src/common/d2d_window.cpp) +Base class for creating borderless windows, with DirectX enabled rendering pipeline. + +#### class DPIAware: [header](/src/common/dpi_aware.h) [source](/src/common/dpi_aware.cpp) +Helper class for creating DPI-aware applications. + +#### struct MonitorInfo: [header](/src/common/monitors.h) [source](/src/common/monitors.cpp) +Class for obtaining information about physical displays connected to the machine. + +#### class Settings, class PowerToyValues, class CustomActionObject: [header](/src/common/settings_objects.h) [source](/src/common/settings_objects.cpp) +Classes used to define settings screens for the PowerToys modules. + +#### class Tasklist: [header](/src/common/tasklist_positions.h) [source](/src/common/tasklist_positions.cpp) +Class that can detect the position of the windows buttons on the taskbar. It also detects which window will react to pressing `WinKey + number`. + +#### struct WindowsColors: [header](/src/common/windows_colors.h) [source](/src/common/windows_colors.cpp) +Class for detecting the current Windows color scheme. + +# Helpers + +#### Common helpers: [header](/src/common/common.h) [source](/src/common/common.cpp) +Various helper functions. + +#### Settings helpers: [header](/src/common/settings_helpers.h) +Helper methods for the settings. + +#### Start visible helper: [header](/src/common/start_visible.h) [source](/src/common/start_visible.cpp) +Contains function to test if the Start menu is visible. diff --git a/doc/devdocs/modules/example_powertoy.md b/doc/devdocs/modules/example_powertoy.md new file mode 100644 index 000000000..e07a07212 --- /dev/null +++ b/doc/devdocs/modules/example_powertoy.md @@ -0,0 +1,5 @@ +#### [`dllmain.cpp`](/src/modules/example_powertoy/dllmain.cpp) +Contains DLL boilerplate code and implementation of the [PowerToys interface](/src/modules/interface/). + +#### [`trace.cpp`](/src/modules/example_powertoy/trace.cpp) +Contains code for telemetry. diff --git a/doc/devdocs/modules/fancyzones.md b/doc/devdocs/modules/fancyzones.md new file mode 100644 index 000000000..cd5be1535 --- /dev/null +++ b/doc/devdocs/modules/fancyzones.md @@ -0,0 +1,85 @@ +## FancyZones Lib + +#### [`FancyZones.cpp`](/src/modules/fancyzones/lib/FancyZones.cpp) +TODO + +#### [`Settings.cpp`](/src/modules/fancyzones/lib/Settings.cpp) +TODO + +#### [`trace.cpp`](/src/modules/fancyzones/lib/trace.cpp) +TODO + +#### [`Zone.cpp`](/src/modules/fancyzones/lib/Zone.cpp) +TODO + +#### [`ZoneSet.cpp`](/src/modules/fancyzones/lib/ZoneSet.cpp) +TODO + +#### [`ZoneWindow.cpp`](/src/modules/fancyzones/lib/ZoneWindow.cpp) +TODO + +## FancyZones Editor + +#### [`App.xaml.cs`](/src/modules/fancyzones/editor/App.xaml.cs) +TODO + +#### [`Properties\AssemblyInfo.cs`](/src/modules/fancyzones/editor/Properties\AssemblyInfo.cs) +TODO + +#### [`CanvasEditor.xaml.cs`](/src/modules/fancyzones/editor/CanvasEditor.xaml.cs) +TODO + +#### [`CanvasEditorWindow.xaml.cs`](/src/modules/fancyzones/editor/CanvasEditorWindow.xaml.cs) +TODO + +#### [`Models\CanvasLayoutModel.cs`](/src/modules/fancyzones/editor/Models\CanvasLayoutModel.cs) +TODO + +#### [`CanvasZone.xaml.cs`](/src/modules/fancyzones/editor/CanvasZone.xaml.cs) +TODO + +#### [`EditorOverlay.xaml.cs`](/src/modules/fancyzones/editor/EditorOverlay.xaml.cs) +TODO + +#### [`EditorWindow.cs`](/src/modules/fancyzones/editor/EditorWindow.cs) +TODO + +#### [`GridEditor.xaml.cs`](/src/modules/fancyzones/editor/GridEditor.xaml.cs) +TODO + +#### [`GridEditorWindow.xaml.cs`](/src/modules/fancyzones/editor/GridEditorWindow.xaml.cs) +TODO + +#### [`Models\GridLayoutModel.cs`](/src/modules/fancyzones/editor/Models\GridLayoutModel.cs) +TODO + +#### [`GridResizer.xaml.cs`](/src/modules/fancyzones/editor/GridResizer.xaml.cs) +TODO + +#### [`GridZone.xaml.cs`](/src/modules/fancyzones/editor/GridZone.xaml.cs) +TODO + +#### [`Models\LayoutModel.cs`](/src/modules/fancyzones/editor/Models/LayoutModel.cs) +TODO + +#### [`LayoutPreview.xaml.cs`](/src/modules/fancyzones/editor/LayoutPreview.xaml.cs) +TODO + +#### [`MainWindow.xaml.cs`](/src/modules/fancyzones/editor/MainWindow.xaml.cs) +TODO + +#### [`Properties\Resources.Designer.cs`](/src/modules/fancyzones/editor/Properties/Resources.Designer.cs) +TODO + +#### [`RowColInfo.cs`](/src/modules/fancyzones/editor/RowColInfo.cs) +TODO + +#### [`Models\Settings.cs`](/src/modules/fancyzones/editor/Models/Settings.cs) +TODO + +#### [`Properties\Settings.Designer.cs`](/src/modules/fancyzones/editor/Properties/Settings.Designer.cs) +TODO + +#### [`WindowLayout.xaml.cs`](/src/modules/fancyzones/editor/WindowLayout.xaml.cs) +TODO + diff --git a/src/modules/interface/README.md b/doc/devdocs/modules/interface.md similarity index 92% rename from src/modules/interface/README.md rename to doc/devdocs/modules/interface.md index fd53e7e81..89ea7a88c 100644 --- a/src/modules/interface/README.md +++ b/doc/devdocs/modules/interface.md @@ -1,11 +1,4 @@ -# PowerToys Interface - -The PowerToys interface that each PowerToy must implement. -See [`the example PowerToy`](/src/modules/example_powertoy) for a PowerToys module example that uses this interface. - -## Interface definition - -This is the interface definition: +# Interface definition ```cpp class PowertoyModuleIface { @@ -27,7 +20,7 @@ public: typedef PowertoyModuleIface* (__cdecl *powertoy_create_func)(); ``` -### Runtime logic +# Runtime logic The PowerToys runner will, for each PowerToy DLL: - load the DLL, @@ -54,11 +47,11 @@ When terminating, the runner will: - unload the DLL. -### Method definition +## Method definition This section contains a more detailed description of each of the interface methods. -#### powertoy_create_func +### powertoy_create_func ```cpp typedef PowertoyModuleIface* (__cdecl *powertoy_create_func)() @@ -86,7 +79,7 @@ ExamplePowertoy::ExamplePowertoy() { } ``` -#### get_name +### get_name ```cpp virtual const wchar_t* get_name() @@ -101,7 +94,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain. } ``` -#### get_events +### get_events ```cpp virtual const wchar_t** get_events() @@ -124,7 +117,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain. } ``` -#### get_config +### get_config ``` virtual bool get_config(wchar_t* buffer, int *buffer_size) @@ -174,7 +167,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain. } ``` -#### set_config +### set_config ```cpp virtual void set_config(const wchar_t* config) @@ -207,7 +200,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain. } ``` -#### call_custom_action +### call_custom_action ```cpp virtual void call_custom_action(const wchar_t* action) @@ -241,7 +234,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain. } ``` -#### enable +### enable ```cpp virtual void enable() @@ -257,7 +250,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain. } ``` -#### disable +### disable ```cpp virtual void disable() @@ -273,7 +266,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain. } ``` -#### is_enabled +### is_enabled ```cpp virtual bool is_enabled() = 0; @@ -288,7 +281,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain. return m_enabled; } ``` -#### signal_event +### signal_event ```cpp virtual intptr_t signal_event(const wchar_t* name, intptr_t data) = 0; @@ -299,6 +292,8 @@ The data argument and return value meaning are event-specific: * ll_keyboard: see [`lowlevel_keyboard_event_data.h`](./lowlevel_keyboard_event_data.h). * win_hook_event: see [`win_hook_event_data.h`](./win_hook_event_data.h) +Please note that some of the events are currently being signalled from a separate thread. + Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.cpp): ```cpp @@ -317,7 +312,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain. } ``` -### register_system_menu_helper +## register_system_menu_helper ```cpp virtual void register_system_menu_helper(PowertoySystemMenuIface* helper) = 0; @@ -327,7 +322,7 @@ Register helper class to handle all system menu items related actions. Creation, and all other actions taken on system menu item will be handled by provided class. Module will be informed when action is taken on any item created on request of the module. -### signal_system_menu_action +## signal_system_menu_action ```cpp virtual void signal_system_menu_action(const wchar_t* name) = 0; @@ -336,7 +331,7 @@ Module will be informed when action is taken on any item created on request of t Runner invokes this API when action is taken on item created on request from the module. Item name is passed as an argument, so that module can distinguish between different menu items. -#### destroy +### destroy ```cpp virtual void destroy() @@ -351,7 +346,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain. } ``` -### Powertoys system menu helper interface +## Powertoys system menu helper interface Interface for helper class responsible for handling all system menu related actions. ```cpp @@ -367,7 +362,7 @@ public: }; ``` -### ItemInfo +## ItemInfo ```cpp struct ItemInfo { @@ -380,7 +375,7 @@ public: Structure containing all relevant information for system menu item: name (and hotkey if available), item status at creation (enabled/disabled) and whether check box will appear next to item name when action is taken. -### SetConfiguration +## SetConfiguration ```cpp virtual void SetConfiguration(PowertoyModuleIface* module, const std::vector& config) = 0; @@ -388,7 +383,7 @@ status at creation (enabled/disabled) and whether check box will appear next to Module should use this interface to inform system menu helper class which custom system menu items to create. -### ProcessSelectedItem +## ProcessSelectedItem ```cpp virtual void ProcessSelectedItem(PowertoyModuleIface* module, HWND window, const wchar_t* itemName) = 0; @@ -396,17 +391,17 @@ Module should use this interface to inform system menu helper class which custom Process action taken on specific system menu item. -## Code organization +# Code organization -#### [`powertoy_module_interface.h`](./powertoy_module_interface.h) +### [`powertoy_module_interface.h`](/src/modules/example_powertoy/powertoy_module_interface.h) Contains the PowerToys interface definition. -### [`powertoy_system_menu.h`](./powertoy_system_module.h) +### [`powertoy_system_menu.h`](/src/modules/example_powertoy/powertoy_system_module.h) Contains the PowerToys system menu helper interface definition. -#### [`lowlevel_keyboard_event_data.h`](./lowlevel_keyboard_event_data.h) +### [`lowlevel_keyboard_event_data.h`](/src/modules/example_powertoy/lowlevel_keyboard_event_data.h) Contains the `LowlevelKeyboardEvent` structure that's passed to `signal_event` for `ll_keyboard` events. -#### [`win_hook_event_data.h`](./win_hook_event_data.h) +### [`win_hook_event_data.h`](/src/modules/example_powertoy/win_hook_event_data.h) Contains the `WinHookEvent` structure that's passed to `signal_event` for `win_hook_event` events. diff --git a/doc/devdocs/modules/powerrename.md b/doc/devdocs/modules/powerrename.md new file mode 100644 index 000000000..b22984e6f --- /dev/null +++ b/doc/devdocs/modules/powerrename.md @@ -0,0 +1,26 @@ +#### [`dllmain.cpp`](/src/modules/powerrename/dll/dllmain.cpp) +TODO + +#### [`PowerRenameExt.cpp`](/src/modules/powerrename/dll/PowerRenameExt.cpp) +TODO + +#### [`Helpers.cpp`](/src/modules/powerrename/lib/Helpers.cpp) +TODO + +#### [`PowerRenameItem.cpp`](/src/modules/powerrename/lib/PowerRenameItem.cpp) +TODO + +#### [`PowerRenameManager.cpp`](/src/modules/powerrename/lib/PowerRenameManager.cpp) +TODO + +#### [`PowerRenameRegEx.cpp`](/src/modules/powerrename/lib/PowerRenameRegEx.cpp) +TODO + +#### [`Settings.cpp`](/src/modules/powerrename/lib/Settings.cpp) +TODO + +#### [`trace.cpp`](/src/modules/powerrename/lib/trace.cpp) +TODO + +#### [`PowerRenameUI.cpp`](/src/modules/powerrename/ui/PowerRenameUI.cpp) +TODO \ No newline at end of file diff --git a/doc/devdocs/modules/shortcut_guide.md b/doc/devdocs/modules/shortcut_guide.md new file mode 100644 index 000000000..84afc87a0 --- /dev/null +++ b/doc/devdocs/modules/shortcut_guide.md @@ -0,0 +1,17 @@ +#### [`dllmain.cpp`](/src/modules/shortcut_guide/dllmain.cpp) +Contains DLL boilerplate code. + +#### [`shortcut_guide.cpp`](/src/modules/shortcut_guide/shortcut_guide.cpp) +Contains the module interface code. It initializes the settings values and the keyboard event listener. + +#### [`overlay_window.cpp`](/src/modules/shortcut_guide/overlay_window.cpp) +Contains the code for loading the SVGs, creating and rendering of the overlay window. + +#### [`keyboard_state.cpp`](/src/modules/shortcut_guide/keyboard_state.cpp) +Contains helper methods for checking the current state of the keyboard. + +#### [`target_state.cpp`](/src/modules/shortcut_guide/target_state.cpp) +State machine that handles the keyboard events. It’s responsible for deciding when to show the overlay, when to suppress the Start menu (if the overlay is displayed long enough), etc. + +#### [`trace.cpp`](/src/modules/shortcut_guide/trace.cpp) +Contains code for telemetry. diff --git a/doc/devdocs/readme.md b/doc/devdocs/readme.md new file mode 100644 index 000000000..9f56147fa --- /dev/null +++ b/doc/devdocs/readme.md @@ -0,0 +1,79 @@ +# Code Organization + +## Rules + +- **Follow the pattern of what you already see in the code** +- Try to package new ideas/components into libraries that have nicely defined interfaces +- Package new ideas into classes or refactor existing ideas into a class as you extend + +## Code Overview + +General project organization: + +#### The [`doc`](/doc) folder +Documentation for the project, including a [coding guide](/doc/coding) and [design docs](/doc/specs). + +#### The [`installer`](/installer) folder +Contains the source code of the PowerToys installer. + +#### The [`src`](/src) folder +Contains the source code of the PowerToys runner and of all of the PowerToys modules. **This is where the most of the magic happens.** + +#### The [`tools`](/tools) folder +Various tools used by PowerToys. Includes the Visual Studio 2019 project template for new PowerToys. + +# Implementation details + +### [`Runner`](/doc/devdocs/runner.md) +The PowerToys Runner contains the project for the PowerToys.exe executable. +It's responsible for: +- Loading the individual PowerToys modules. +- Passing registered events to the PowerToys. +- Showing a system tray icon to manage the PowerToys. +- Bridging between the PowerToys modules and the Settings editor. + +![Image of the tray icon](/doc/images/runner/tray.png) + +### [`Interface`](/doc/devdocs/modules/interface.md) +Definition of the interface used by the [`runner`](/src/runner) to manage the PowerToys. All PowerToys must implement this interface. + +### [`Common`](/doc/devdocs/common.md) +The common lib, as the name suggests, contains code shared by multiple PowerToys components and modules, e.g. [json parsing](/src/common/json.h) and [IPC primitives](/src/common/two_way_pipe_message_ipc.h). + + +### [`Settings`](/doc/devdocs/settings.md) +WebView project for editing the PowerToys settings. + +The html portion of the project that is shown in the WebView is contained in [`settings-html`](/src/settings/settings-heml). +Instructions on how build a new version and update this project are in the [Web project for the Settings UI](./settings-web.md). + +While developing, it's possible to connect the WebView to the development server running in localhost by setting the `_DEBUG_WITH_LOCALHOST` flag to `1` and following the instructions near it in `./main.cpp`. + +### [`Settings-web`](/doc/devdocs/settings-web.md) +This project generates the web UI shown in the [PowerToys Settings](/src/editor). +It's a `ReactJS` project created using [UI Fabric](https://developer.microsoft.com/en-us/fabric#/). + +## Current modules +### [`FancyZones`](/doc/devdocs/modules/fancyzones.md) +The FancyZones PowerToy that allows users to create custom zones on the screen, to which the windows will snap when moved. + +### [`PowerRename`](/doc/devdocs/modules/powerrename.md) +PowerRename is a Windows Shell Context Menu Extension for advanced bulk renaming using simple search and replace or more powerful regular expression matching. + +### [`Shortcut Guide`](/doc/devdocs/modules/shortcut_guide.md) +The Windows Shortcut Guide, displayed when the WinKey is held for some time. + +### _obsolete_ [`example_powertoy`](/doc/devdocs/modules/example_powertoy.md) +An example PowerToy, that demonstrates how to create new ones. Please note, that this is going to become a Visual Studio project template soon. + +This PowerToy serves as a sample to show how to implement the [PowerToys interface](/src/modules/interface/) when creating a PowerToy. It also showcases the currently implemented settings. + +#### Options +This module has a setting to serve as an example for each of the currently implemented settings property: + - BoolToggle property + - IntSpinner property + - String property + - ColorPicker property + - CustomAction property + +![Image of the Options](/doc/images/example_powertoy/settings.png) diff --git a/doc/devdocs/runner.md b/doc/devdocs/runner.md new file mode 100644 index 000000000..9fff233c1 --- /dev/null +++ b/doc/devdocs/runner.md @@ -0,0 +1,36 @@ +#### [`main.cpp`](/src/runner/main.cpp) +Contains the executable starting point, initialization code and the list of known PowerToys. All singletones are also initialized here at the start. Loads all the powertoys by scanning the `./modules` folder and `enable()`s those makred as enabled in `%LOCALAPPDATA%\Microsoft\PowerToys\settings.json` config. Then it runs [a message loop](https://docs.microsoft.com/en-us/windows/win32/winmsg/using-messages-and-message-queues) for the tray UI. Note that this message loop also [handles lowlevel_keyboard_hook events](https://github.com/microsoft/PowerToys/blob/1760af50c8803588cb575167baae0439af38a9c1/src/runner/lowlevel_keyboard_event.cpp#L24). + +#### [`general_settings.cpp`](./general_settings.cpp) +#### [`powertoy_module.h`](/src/runner/powertoy_module.h) and [`powertoy_module.cpp`](/src/runner/powertoy_module.cpp) +Contains code for initializing and managing the PowerToy modules. `PowertoyModule` is a RAII-style holder for the `PowertoyModuleIface` pointer, which we got by [invoking module DLL's `powertoy_create` function](https://github.com/microsoft/PowerToys/blob/1760af50c8803588cb575167baae0439af38a9c1/src/runner/powertoy_module.cpp#L13-L24). + +#### [`powertoys_events.cpp`](/src/runner/powertoys_events.cpp) +Contains code that handles the various events listeners, and forwards those events to the PowerToys modules. You can learn more about the current event architecture [here](/doc/devdocs/shared-hooks.md). + +#### [`lowlevel_keyboard_event.cpp`](/src/runner/lowlevel_keyboard_event.cpp) +Contains code for registering the low level keyboard event hook that listens for keyboard events. Please note that `signal_event` is called from the main thread for this event. + +#### [`win_hook_event.cpp`](/src/runner/win_hook_event.cpp) +Contains code for registering a Windows event hook through `SetWinEventHook`, that listens for various events raised when a window is interacted with. Please note, that `signal_event` is called from a separate `dispatch_thread_proc` worker thread, so you must provide thread-safety for your `signal_event` if you intend to receive it. This is a subject to change. + +#### [`tray_icon.cpp`](/src/runner/tray_icon.cpp) +Contains code for managing the PowerToys tray icon and its menu commands. Note that `dispatch_run_on_main_ui_thread` is used to +transfer received json message from the [Settings window](/doc/devdocs/settings.md) to the main thread, since we're communicating with it from [a dedicated thread](https://github.com/microsoft/PowerToys/blob/7357e40d3f54de51176efe54fda6d57028837b8c/src/runner/settings_window.cpp#L267-L271). +#### [`settings_window.cpp`](/src/runner/settings_window.cpp) +Contains code for starting the PowerToys settings window and communicating with it. Settings window is a separate process, so we're using [Windows pipes](https://docs.microsoft.com/en-us/windows/win32/ipc/pipes) as a transport for json messages. + +#### [`general_settings.cpp`](/src/runner/general_settings.cpp) +Contains code for loading, saving and applying the general setings. + +#### [`auto_start_helper.cpp`](/src/runner/auto_start_helper.cpp) +Contains helper code for registering and unregistering PowerToys to run when the user logs in. + +#### [`unhandled_exception_handler.cpp`](/src/runner/unhandled_exception_handler.cpp) +Contains helper code to get stack traces in builds. Can be used by adding a call to `init_global_error_handlers` in [`WinMain`](./main.cpp). + +#### [`trace.cpp`](/src/runner/trace.cpp) +Contains code for telemetry. + +#### [`svgs`](/src/runner/svgs/) +Contains the SVG assets used by the PowerToys modules. diff --git a/src/settings-web/README.md b/doc/devdocs/settings-web.md similarity index 80% rename from src/settings-web/README.md rename to doc/devdocs/settings-web.md index 1cc0e828e..be5e51a97 100644 --- a/src/settings-web/README.md +++ b/doc/devdocs/settings-web.md @@ -1,10 +1,3 @@ -# Web project for the Settings UI - -## Introduction - -This project generates the web UI shown in the [PowerToys Settings](/src/editor). -It's a `ReactJS` project created using [UI Fabric](https://developer.microsoft.com/en-us/fabric#/). - ## Build Commands Here are the commands to build and test this project: @@ -24,7 +17,7 @@ npm run build ## Updating the icons -Icons inside [`src/icons/`](./src/icons/) were generated from the [Office UI Fabric Icons subset generation tool.](https://uifabricicons.azurewebsites.net/) +Icons inside [`src/icons/`](/src/settings-web/src/icons/) were generated from the [Office UI Fabric Icons subset generation tool.](https://uifabricicons.azurewebsites.net/) In case the subset needs to be changed, additional steps are needed to include the icon font in the built `dist/bundle.js`: - Copy the inline font data taken from [`src/icons/css/fabric-icons-inline.css`](src/icons/css/fabric-icons-inline.css) and place it in the `fontFace` `src` value in [`src/icons/src/fabric-icons.ts`](src/icons/src/fabric-icons.ts). @@ -37,44 +30,44 @@ SVG icons, including the icons for each PowerToy listed in the Settings, are con The project structure is based on the [`UI Fabric` scaffold](https://developer.microsoft.com/en-us/fabric#/get-started/web#option-1-quick-start) obtained by initializing it with `npm init uifabric`. -#### [index.html](./index.html) +#### [index.html](/src/settings-web/index.html) The HTML entry-point of the project. Loads the `ReactJS` distribution script. Defines JavaScript functions to receive and send messages to the [PowerToys Settings](/src/editor) window. -#### [src/index.tsx](./src/index.tsx) +#### [src/index.tsx](/src/settings-web/src/index.tsx) Main `ReactJS` entrypoint, initializing the `ReactDOM`. -#### [src/setup_icons.tsx](./src/setup_icons.tsx) +#### [src/setup_icons.tsx](/src/settings-web/src/setup_icons.tsx) Defines the `setup_powertoys_icons` function that registers the icons to be used in the components. -#### [src/components/](./src/components/) +#### [src/components/](/src/settings-web/src/components/) Contains the `ReactJS` components, including the Settings controls for each type of setting. -#### [src/components/App.tsx](./src/components/App.tsx) +#### [src/components/App.tsx](/src/settings-web/src/components/App.tsx) Defines the main App component, containing the UI layout, navigation menu, dialogs and main load/save logic. -#### [src/components/GeneralSettings.tsx](./src/components/GeneralSettings.tsx) +#### [src/components/GeneralSettings.tsx](/src/settings-web/src/components/GeneralSettings.tsx) Defines the PowerToys General Settings component, including logic to construct the object sent to PowerToys to change the General settings. -#### [src/components/ModuleSettings.tsx](./src/components/ModuleSettings.tsx) +#### [src/components/ModuleSettings.tsx](/src/settings-web/src/components/ModuleSettings.tsx) Defines the component that generates the settings screen for a PowerToy depending on its settings definition. -#### [src/components/BaseSettingsControl.tsx](./src/components/BaseSettingsControl.tsx) +#### [src/components/BaseSettingsControl.tsx](/src/settings-web/src/components/BaseSettingsControl.tsx) Defines the base class for a Settings control. -#### [src/css/layout.css](./src/css/layout.css) +#### [src/css/layout.css](/src/settings-web/src/css/layout.css) General layout styles. -#### [src/icons/](./src/icons/) +#### [src/icons/](/src/settings-web/src/icons/) Icons generated from the [Office UI Fabric Icons subset generation tool.](https://uifabricicons.azurewebsites.net/) -#### [src/svg/](./src/svg/) +#### [src/svg/](/src/settings-web/src/svg/) SVG icon assets. ## Creating a new settings control -The [`BaseSettingsControl` class](./src/components/BaseSettingsControl.tsx) can be extended to create a new Settings control type. +The [`BaseSettingsControl` class](/src/settings-web/src/components/BaseSettingsControl.tsx) can be extended to create a new Settings control type. ```tsx export class BaseSettingsControl extends React.Component { @@ -92,7 +85,7 @@ export class BaseSettingsControl extends React.Component { A settings control overrides the `get_value` function to return the value to be used for the Setting the control is representing. It will use the `parent_on_change` property to signal that the user made some changes to the settings. -Here's the [`StringTextSettingsControl`](./src/components/StringTextSettingsControl.tsx) component to serve as an example: +Here's the [`StringTextSettingsControl`](/src/settings-web/src/components/StringTextSettingsControl.tsx) component to serve as an example: ```tsx export class StringTextSettingsControl extends BaseSettingsControl { @@ -153,8 +146,8 @@ Each settings property has a `editor_type` field that's used to differentiate be } ``` -A new Settings control component can be added to [`src/components/`](./src/components/). -To render the new Settings control, its `editor_type` and component instance need to be added to the [`ModuleSettings` component render()](./src/components/ModuleSettings.tsx): +A new Settings control component can be added to [`src/components/`](/src/settings-web/src/components/). +To render the new Settings control, its `editor_type` and component instance need to be added to the [`ModuleSettings` component render()](/src/settings-web/src/components/ModuleSettings.tsx): ```tsx import React from 'react'; import {StringTextSettingsControl} from './StringTextSettingsControl'; diff --git a/doc/devdocs/settings.md b/doc/devdocs/settings.md new file mode 100644 index 000000000..6d1e79335 --- /dev/null +++ b/doc/devdocs/settings.md @@ -0,0 +1,8 @@ +#### [main.cpp](/src/settings/main.cpp) +Contains the main executable code, initializing and managing the Window containing the WebView and communication with the main PowerToys executable. + +#### [StreamURIResolverFromFile.cpp](/src/settings/StreamURIResolverFromFile.cpp) +Defines a class implementing `IUriToStreamResolver`. Allows the WebView to navigate to filesystem files in this Win32 project. + +#### [settings-html/](/src/settings/settings-html/) +Contains the assets file from building the [Web project for the Settings UI](/src/settings./settings-web). It will be loaded by the WebView. diff --git a/doc/specs/Shared-hooks.md b/doc/devdocs/shared-hooks.md similarity index 97% rename from doc/specs/Shared-hooks.md rename to doc/devdocs/shared-hooks.md index bc546f097..cdb103b37 100644 --- a/doc/specs/Shared-hooks.md +++ b/doc/devdocs/shared-hooks.md @@ -1,85 +1,85 @@ -# Shared hooks - -To minimize the performance impact on the machine only `runner` installs global hooks, passing the events to registered callbacks in each PowerToy module. - -When a PowerToy module is loaded, the `runner` calls the [`get_events()`](/src/modules/interface/powertoy_module_interface.h#L40) method to get a NULL-terminated array of NULL-terminated strings with the names of the events that the PowerToy wants to subscribe to. A `const wchar_t*` string is provided for each of the event names. - -Events are signalled by the `runner` calling the [`signal_event(name, data)`](/src/modules/interface/powertoy_module_interface.h#L53) method of the PowerToy module. The `name` parameter contains the NULL-terminated name of the event. The `data` parameter and the method return value are specific for each event. - -Currently supported hooks: - * `"ll_keyboard"` - [Low Level Keyboard Hook](#low-level-keyboard-hook) - * `"win_hook_event"` - [Windows Event Hook](#windows-event-hook) - -## Low Level Keyboard Hook - -This event is signaled whenever the user presses or releases a key on the keyboard. To subscribe to this event, add `"ll_keyboard"` to the table returned by the `get_events()` method. - -The PowerToys runner installs low-level keyboard hook using `SetWindowsHookEx(WH_KEYBOARD_LL, ...)`. See [this MSDN page](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644985(v%3Dvs.85)) for details. - -When a keyboard event is signaled and `ncCode` equals `HC_ACTION`, the `wParam` and `lParam` event parameters are passed to all subscribed clients in the [`LowlevelKeyboardEvent`](/src/modules/interface/lowlevel_keyboard_event_data.h#L38-L41) struct. - -The `intptr_t data` event argument is a pointer to the `LowlevelKeyboardEvent` struct. - -A non-zero return value from any of the subscribed PowerToys will cause the runner hook proc to return 1, thus swallowing the keyboard event. - -Example usage, that makes Windows ignore the L key: - -```c++ -virtual const wchar_t** get_events() override { - static const wchar_t* events[2] = { ll_keyboard, - nullptr }; - return events; -} - -virtual intptr_t signal_event(const wchar_t* name, intptr_t data) override { - if (wcscmp(name, ll_keyboard) == 0) { - auto& event = *(reinterpret_cast(data)); - // The L key has vkCode of 0x4C, see: - // https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes - if (event.wParam == WM_KEYDOWN && event.lParam->vkCode == 0x4C) { - return 1; - } else { - return 0; - } - } else { - return 0; - } -} -``` - -## Windows Event Hook - -This event is signaled for [a range of events](https://docs.microsoft.com/pl-pl/windows/win32/winauto/event-constants). To subscribe to this event, add `"win_hook_event"` to the table returned by the `get_events()` method. See [this MSDN doc](https://docs.microsoft.com/pl-pl/windows/win32/api/winuser/nf-winuser-setwineventhook) for details. - -The `intptr_t data` event argument is a pointer to the [`WinHookEvent`](/src/modules/interface/win_hook_event_data.h#L43-L50) struct. - -The return value of the event handler is ignored. - -Example usage, that detects a window being resized: - -```c++ -virtual const wchar_t** get_events() override { - static const wchar_t* events[2] = { win_hook_event, - nullptr }; - return events; -} - -virtual intptr_t signal_event(const wchar_t* name, intptr_t data) override { - if (wcscmp(name, win_hook_event) == 0) { - auto& event = *(reinterpret_cast(data)); - switch (event.event) { - case EVENT_SYSTEM_MOVESIZESTART: - size_start(event.hwnd); - break; - case EVENT_SYSTEM_MOVESIZEEND: - size_end(event.hwnd); - break; - default: - break; - } - } - return 0; -} -``` - -Taking too long to process the events has negative impact on the whole system performance. To address this, the events are signaled from a different thread, not from the event hook callback itself. +# Shared hooks + +To minimize the performance impact on the machine only `runner` installs global hooks, passing the events to registered callbacks in each PowerToy module. + +When a PowerToy module is loaded, the `runner` calls the [`get_events()`](/src/modules/interface/powertoy_module_interface.h#L40) method to get a NULL-terminated array of NULL-terminated strings with the names of the events that the PowerToy wants to subscribe to. A `const wchar_t*` string is provided for each of the event names. + +Events are signalled by the `runner` calling the [`signal_event(name, data)`](/src/modules/interface/powertoy_module_interface.h#L53) method of the PowerToy module. The `name` parameter contains the NULL-terminated name of the event. The `data` parameter and the method return value are specific for each event. + +Currently supported hooks: + * `"ll_keyboard"` - [Low Level Keyboard Hook](#low-level-keyboard-hook) + * `"win_hook_event"` - [Windows Event Hook](#windows-event-hook) + +## Low Level Keyboard Hook + +This event is signaled whenever the user presses or releases a key on the keyboard. To subscribe to this event, add `"ll_keyboard"` to the table returned by the `get_events()` method. + +The PowerToys runner installs low-level keyboard hook using `SetWindowsHookEx(WH_KEYBOARD_LL, ...)`. See [this MSDN page](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644985(v%3Dvs.85)) for details. + +When a keyboard event is signaled and `ncCode` equals `HC_ACTION`, the `wParam` and `lParam` event parameters are passed to all subscribed clients in the [`LowlevelKeyboardEvent`](/src/modules/interface/lowlevel_keyboard_event_data.h#L38-L41) struct. + +The `intptr_t data` event argument is a pointer to the `LowlevelKeyboardEvent` struct. + +A non-zero return value from any of the subscribed PowerToys will cause the runner hook proc to return 1, thus swallowing the keyboard event. + +Example usage, that makes Windows ignore the L key: + +```c++ +virtual const wchar_t** get_events() override { + static const wchar_t* events[2] = { ll_keyboard, + nullptr }; + return events; +} + +virtual intptr_t signal_event(const wchar_t* name, intptr_t data) override { + if (wcscmp(name, ll_keyboard) == 0) { + auto& event = *(reinterpret_cast(data)); + // The L key has vkCode of 0x4C, see: + // https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes + if (event.wParam == WM_KEYDOWN && event.lParam->vkCode == 0x4C) { + return 1; + } else { + return 0; + } + } else { + return 0; + } +} +``` + +## Windows Event Hook + +This event is signaled for [a range of events](https://docs.microsoft.com/pl-pl/windows/win32/winauto/event-constants). To subscribe to this event, add `"win_hook_event"` to the table returned by the `get_events()` method. See [this MSDN doc](https://docs.microsoft.com/pl-pl/windows/win32/api/winuser/nf-winuser-setwineventhook) for details. + +The `intptr_t data` event argument is a pointer to the [`WinHookEvent`](/src/modules/interface/win_hook_event_data.h#L43-L50) struct. + +The return value of the event handler is ignored. + +Example usage, that detects a window being resized: + +```c++ +virtual const wchar_t** get_events() override { + static const wchar_t* events[2] = { win_hook_event, + nullptr }; + return events; +} + +virtual intptr_t signal_event(const wchar_t* name, intptr_t data) override { + if (wcscmp(name, win_hook_event) == 0) { + auto& event = *(reinterpret_cast(data)); + switch (event.event) { + case EVENT_SYSTEM_MOVESIZESTART: + size_start(event.hwnd); + break; + case EVENT_SYSTEM_MOVESIZEEND: + size_end(event.hwnd); + break; + default: + break; + } + } + return 0; +} +``` + +Taking too long to process the events has negative impact on the whole system performance. To address this, the events are signaled from a different thread, not from the event hook callback itself. diff --git a/doc/coding/style.md b/doc/devdocs/style.md similarity index 100% rename from doc/coding/style.md rename to doc/devdocs/style.md diff --git a/src/common/README.md b/src/common/README.md deleted file mode 100644 index 9fbc0a2f3..000000000 --- a/src/common/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Introduction -The common lib, as the name suggests, contains code shared by multiple PowerToys components and modules. - -# Classes and structures - -#### class Animation: [header](./animation.h) [source](./animation.cpp) -Animation helper class with two easing-in animations: linear and exponential. - -#### class AsyncMessageQueue: [header](./async_message_queue.h) -Header-only asynchronous message queue. Used by `TwoWayPipeMessageIPC`. - -#### class TwoWayPipeMessageIPC: [header](./two_way_pipe_message_ipc.h) -Header-only asynchronous IPC messaging class. Used by the runner to communicate with the settings window. - -#### class D2DSVG: [header](./d2d_svg.h) [source](./d2d_svg.cpp) -Class for loading, rendering and for some basic modifications of SVG graphics. - -#### class D2DText: [header](./d2d_text.h) [source](./d2d_text.cpp) -Class for rendering text using DirectX. - -#### class D2DWindow: [header](./d2d_window.h) [source](./d2d_window.cpp) -Base class for creating borderless windows, with DirectX enabled rendering pipeline. - -#### class DPIAware: [header](./dpi_aware.h) [source](./dpi_aware.cpp) -Helper class for creating DPI-aware applications. - -#### struct MonitorInfo: [header](./monitors.h) [source](./monitors.cpp) -Class for obtaining information about physical displays connected to the machine. - -#### class Settings, class PowerToyValues, class CustomActionObject: [header](./settings_objects.h) [source](./settings_objects.cpp) -Classes used to define settings screens for the PowerToys modules. - -#### class Tasklist: [header](./tasklist_positions.h) [source](./tasklist_positions.cpp) -Class that can detect the position of the windows buttons on the taskbar. It also detects which window will react to pressing `WinKey + number`. - -#### struct WindowsColors: [header](./windows_colors.h) [source](./windows_colors.cpp) -Class for detecting the current Windows color scheme. - -# Helpers - -#### Common helpers: [header](./common.h) [source](./common.cpp) -Various helper functions. - -#### Settings helpers: [header](./settings_helpers.h) -Helper methods for the settings. - -#### Start visible helper: [header](./start_visible.h) [source](./start_visible.cpp) -Contains function to test if the Start menu is visible. diff --git a/src/modules/README.md b/src/modules/README.md deleted file mode 100644 index c46893c2f..000000000 --- a/src/modules/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# PowerToys Modules - -The source code of the PowerToys modules: - -#### [`example_powertoy`](./example_powertoy) -An example PowerToy, that demonstrates how to create new ones. - -#### [`fancyzones`](./fancyzones) -The FancyZones PowerToy that allows users to create custom zones on the screen, to which the windows will snap when moved. - -#### [`FancyZonesEditor`](./fancyzones/editor/FancyZonesEditor) -Editor for the snap-zones of the FancyZones PowerToy. - -#### [`interface`](./interface) -Definition of the interface used by the [`runner`](/src/runner) to manage the PowerToys. All PowerToys must implement this interface. - -#### [`powerrename`](./powerrename) -PowerRename is a Windows Shell Context Menu Extension for advanced bulk renaming using simple search and replace or more powerful regular expression matching. - -#### [`shortcut_guide`](./shortcut_guide) -The Windows Shortcut Guide, displayed when the WinKey is held for some time. diff --git a/src/modules/example_powertoy/README.md b/src/modules/example_powertoy/README.md deleted file mode 100644 index 52f49c0d3..000000000 --- a/src/modules/example_powertoy/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Example PowerToy - -# Introduction -This PowerToy serves as a sample to show how to implement the [PowerToys interface](/src/modules/interface/) when creating a PowerToy. It also showcases the currently implemented settings. - -# Options -This module has a setting to serve as an example for each of the currently implemented settings property: - - BoolToggle property - - IntSpinner property - - String property - - ColorPicker property - - CustomAction property - -![Image of the Options](/doc/images/example_powertoy/settings.png) - -# Code organization - -#### [`dllmain.cpp`](./dllmain.cpp) -Contains DLL boilerplate code and implementation of the [PowerToys interface](/src/modules/interface/). - -#### [`trace.cpp`](./trace.cpp) -Contains code for telemetry. diff --git a/src/modules/fancyzones/README.md b/src/modules/fancyzones/README.md index 1e21b0c8c..8eacbd392 100644 --- a/src/modules/fancyzones/README.md +++ b/src/modules/fancyzones/README.md @@ -1,4 +1,4 @@ -# Fancy Zones +# Overview Fancy Zones is a window manager that is designed to make it easy to arrange and snap windows into efficient layouts for your workflow and also to restore these layouts quickly. Fancy Zones allows the user to define a set of window locations for a desktop that are drag targets for windows. When the user drags a window into a zone, the windows is resized and repositioned to fill that zone. ![Fancy Zones](FancyZones.png) @@ -17,14 +17,14 @@ The subtractive table layout model starts with a table layout and allows zones t The backlog for the utility can be found [here](https://github.com/Microsoft/PowerToys/tree/master/doc/planning/FancyZonesBacklog.md) and the source code is [here](https://github.com/Microsoft/PowerToys/tree/master/src/modules/fancyzones). -## Shortcut Keys +# Shortcut Keys | Shortcut | Action | | ----------- | ----------- | | Win + ` | Launches editor (this shortcut is editable in the settings dialog) | | Win+Ctrl+\ | Cycles through saved layouts with the corresponding number of zones | | Win+Left/Right Arrow | Move focused window between zones (only if Override snap hotkeys setting is enabled, in that case only the `Win+Left Arrow` and `Win+Right Arrow` are overriden, while the `Win+Up Arrow` and `Win+Down Arrow` keep working as usual) | -## Settings +# Settings | Setting | Description | | --------- | ------------- | | Configure the zone editor hotkey | To change the default hotkey, click on the textbox (it's not necessary to select or delete the text) and then press on the keyboard the desired key combination | diff --git a/src/modules/shortcut_guide/README.md b/src/modules/shortcut_guide/README.md index 5df119079..207fe4884 100644 --- a/src/modules/shortcut_guide/README.md +++ b/src/modules/shortcut_guide/README.md @@ -24,23 +24,3 @@ These configurations can be edited from the PowerToys Settings screen: # Backlog The backlog for the utility can be found [here](https://github.com/Microsoft/PowerToys/tree/master/doc/planning/ShortcutGuideBacklog.md) and the source code is [here](https://github.com/Microsoft/PowerToys/tree/master/src/modules/shortcut_guide). - -# Code organization - -#### [`dllmain.cpp`](./dllmain.cpp) -Contains DLL boilerplate code. - -#### [`shortcut_guide.cpp`](./shortcut_guide.cpp) -Contains the module interface code. It initializes the settings values and the keyboard event listener. - -#### [`overlay_window.cpp`](./overlay_window.cpp) -Contains the code for loading the SVGs, creating and rendering of the overlay window. - -#### [`keyboard_state.cpp`](./keyboard_state.cpp) -Contains helper methods for checking the current state of the keyboard. - -#### [`target_state.cpp`](./target_state.cpp) -State machine that handles the keyboard events. It’s responsible for deciding when to show the overlay, when to suppress the Start menu (if the overlay is displayed long enough), etc. - -#### [`trace.cpp`](./trace.cpp) -Contains code for telemetry. diff --git a/src/runner/README.md b/src/runner/README.md deleted file mode 100644 index 16b0f4b55..000000000 --- a/src/runner/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# PowerToys Runner - -# Introduction - -The PowerToys Runner contains the project for the PowerToys.exe executable. -It's responsible for: -- Loading the individual PowerToys modules. -- Passing registered events to the PowerToys. -- Showing a system tray icon to manage the PowerToys. -- Bridging between the PowerToys modules and the Settings editor. - -![Image of the tray icon](/doc/images/runner/tray.png) - -# Code organization - -#### [`main.cpp`](./main.cpp) -Contains the executable starting point, initialization code and the list of known PowerToys. - -#### [`powertoy_module.h`](./powertoy_module.h) and [`powertoy_module.cpp`](./powertoy_module.cpp) -Contains code for initializing and managing the PowerToy modules. - -#### [`powertoys_events.cpp`](./powertoys_events.cpp) -Contains code that handles the various events listeners, and forwards those events to the PowerToys modules. - -#### [`lowlevel_keyboard_event.cpp`](./lowlevel_keyboard_event.cpp) -Contains code for registering the low level keyboard event hook that listens for keyboard events. - -#### [`win_hook_event.cpp`](./win_hook_event.cpp) -Contains code for registering a Windows event hook through `SetWinEventHook`, that listens for various events raised when a window is interacted with. - -#### [`tray_icon.cpp`](./tray_icon.cpp) -Contains code for managing the PowerToys tray icon and its menu commands. - -#### [`settings_window.cpp`](./settings_window.cpp) -Contains code for starting the PowerToys settings window and communicating with it. - -#### [`general_settings.cpp`](./general_settings.cpp) -Contains code for loading, saving and applying the general setings. - -#### [`auto_start_helper.cpp`](./auto_start_helper.cpp) -Contains helper code for registering and unregistering PowerToys to run when the user logs in. - -#### [`unhandled_exception_handler.cpp`](./unhandled_exception_handler.cpp) -Contains helper code to get stack traces in builds. Can be used by adding a call to `init_global_error_handlers` in [`WinMain`](./main.cpp). - -#### [`trace.cpp`](./trace.cpp) -Contains code for telemetry. - -#### [`svgs`](./svgs/) -Contains the SVG assets used by the PowerToys modules. diff --git a/src/settings/README.md b/src/settings/README.md deleted file mode 100644 index e183c720d..000000000 --- a/src/settings/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# PowerToys Settings project - -## Introduction - -This path contains the WebView project for editing the PowerToys settings. - -The html portion of the project that is shown in the WebView is contained in `settings-html`. -Instructions on how build a new version and update this project are in the [Web project for the Settings UI](../settings-web). - -While developing, it's possible to connect the WebView to the development server running in localhost by setting the `_DEBUG_WITH_LOCALHOST` flag to `1` and following the instructions near it in `./main.cpp`. - -## Code Organization - -#### [main.cpp](./main.cpp) -Contains the main executable code, initializing and managing the Window containing the WebView and communication with the main PowerToys executable. - -#### [StreamURIResolverFromFile.cpp](./StreamURIResolverFromFile.cpp) -Defines a class implementing `IUriToStreamResolver`. Allows the WebView to navigate to filesystem files in this Win32 project. - -#### [settings-html/](./settings-html/) -Contains the assets file from building the [Web project for the Settings UI](../settings-web). It will be loaded by the WebView.