PowerToys interface: remove powertoys events and system_menu_helper functionality (#5323)

This commit is contained in:
Andrey Nekrasov
2020-07-31 14:06:13 +03:00
committed by GitHub
parent cff654ae69
commit 49b56d9b52
42 changed files with 116 additions and 1163 deletions

View File

@@ -2,9 +2,8 @@
#include <common/settings_objects.h>
#include <common/common.h>
#include <common/debug_control.h>
#include <common/LowlevelKeyboardEvent.h>
#include <interface/powertoy_module_interface.h>
#include <interface/lowlevel_keyboard_event_data.h>
#include <interface/win_hook_event_data.h>
#include <lib/ZoneSet.h>
#include <lib/resource.h>
@@ -44,13 +43,6 @@ public:
return app_name.c_str();
}
// Return array of the names of all events that this powertoy listens for, with
// nullptr as the last element of the array. Nullptr can also be returned for empty list.
virtual PCWSTR* get_events() override
{
return nullptr;
}
// Return JSON with the configuration options.
// These are the settings shown on the settings page along with their current values.
virtual bool get_config(_Out_ PWSTR buffer, _Out_ int* buffer_size) override
@@ -134,15 +126,6 @@ public:
return (m_app != nullptr);
}
// PowertoyModuleIface method, unused
virtual intptr_t signal_event(const wchar_t* name, intptr_t data) override
{
return 0;
}
virtual void register_system_menu_helper(PowertoySystemMenuIface* helper) override {}
virtual void signal_system_menu_action(const wchar_t* name) override {}
// Destroy the powertoy and free memory
virtual void destroy() override
{

View File

@@ -16,7 +16,6 @@
#include "VirtualDesktopUtils.h"
#include "MonitorWorkAreaHandler.h"
#include <interface/win_hook_event_data.h>
#include <lib/SecondaryMouseButtonsHook.h>
#include <lib/GenericKeyHook.h>
@@ -365,7 +364,8 @@ bool FancyZones::ShouldProcessNewWindow(HWND window) noexcept
}
std::vector<int> FancyZones::GetZoneIndexSetFromWorkAreaHistory(
HWND window, winrt::com_ptr<IZoneWindow> workArea) noexcept
HWND window,
winrt::com_ptr<IZoneWindow> workArea) noexcept
{
const auto activeZoneSet = workArea->ActiveZoneSet();
if (activeZoneSet)
@@ -458,9 +458,9 @@ RECT FitOnScreen(const RECT& windowRect, const RECT& originMonitorRect, const RE
H = min(H, RectHeight(destMonitorRect) - CUSTOM_POSITIONING_LEFT_TOP_PADDING);
}
return { .left = left,
.top = top,
.right = left + W,
return { .left = left,
.top = top,
.right = left + W,
.bottom = top + H };
}
@@ -506,7 +506,7 @@ FancyZones::WindowCreated(HWND window) noexcept
// creation of new window. We need to check if window being processed is on currently active desktop.
return;
}
const bool moveToAppLastZone = m_settings->GetSettings()->appLastZone_moveWindows;
const bool moveToAppLastZone = m_settings->GetSettings()->appLastZone_moveWindows;
const bool openOnActiveMonitor = m_settings->GetSettings()->openWindowOnActiveMonitor;
if ((moveToAppLastZone || openOnActiveMonitor) && ShouldProcessNewWindow(window))
{

View File

@@ -1,5 +1,7 @@
#pragma once
#include <common/WinHookEvent.h>
interface IZoneWindow;
interface IFancyZonesSettings;
interface IZoneSet;
@@ -11,11 +13,13 @@ interface __declspec(uuid("{50D3F0F5-736E-4186-BDF4-3D6BEE150C3A}")) IFancyZones
/**
* Start and initialize FancyZones.
*/
IFACEMETHOD_(void, Run)() = 0;
IFACEMETHOD_(void, Run)
() = 0;
/**
* Stop FancyZones and do the clean up.
*/
IFACEMETHOD_(void, Destroy)() = 0;
IFACEMETHOD_(void, Destroy)
() = 0;
};
/**
@@ -26,13 +30,15 @@ interface __declspec(uuid("{2CB37E8F-87E6-4AEC-B4B2-E0FDC873343F}")) IFancyZones
/**
* Inform FancyZones that user has switched between virtual desktops.
*/
IFACEMETHOD_(void, VirtualDesktopChanged)() = 0;
IFACEMETHOD_(void, VirtualDesktopChanged)
() = 0;
/**
* Callback from WinEventHook to FancyZones
*
* @param data Handle of window being moved or resized.
*/
IFACEMETHOD_(void, HandleWinHookEvent)(const WinHookEvent* data) = 0;
IFACEMETHOD_(void, HandleWinHookEvent)
(const WinHookEvent* data) = 0;
/**
* Process keyboard event.
*
@@ -40,15 +46,18 @@ interface __declspec(uuid("{2CB37E8F-87E6-4AEC-B4B2-E0FDC873343F}")) IFancyZones
* @returns Boolean indicating if this event should be passed on further to other applications
* in event chain, or should it be suppressed.
*/
IFACEMETHOD_(bool, OnKeyDown)(PKBDLLHOOKSTRUCT info) = 0;
IFACEMETHOD_(bool, OnKeyDown)
(PKBDLLHOOKSTRUCT info) = 0;
/**
* Toggle FancyZones editor application.
*/
IFACEMETHOD_(void, ToggleEditor)() = 0;
IFACEMETHOD_(void, ToggleEditor)
() = 0;
/**
* Callback triggered when user changes FancyZones settings.
*/
IFACEMETHOD_(void, SettingsChanged)() = 0;
IFACEMETHOD_(void, SettingsChanged)
() = 0;
};
/**
@@ -59,31 +68,38 @@ interface __declspec(uuid("{5C8D99D6-34B2-4F4A-A8E5-7483F6869775}")) IZoneWindow
/**
* Assign window to appropriate zone inside new zone layout.
*/
IFACEMETHOD_(void, MoveWindowsOnActiveZoneSetChange)() = 0;
/**
IFACEMETHOD_(void, MoveWindowsOnActiveZoneSetChange)
() = 0;
/**
* @returns Basic zone color.
*/
IFACEMETHOD_(COLORREF, GetZoneColor)() = 0;
/**
IFACEMETHOD_(COLORREF, GetZoneColor)
() = 0;
/**
* @returns Zone border color.
*/
IFACEMETHOD_(COLORREF, GetZoneBorderColor)() = 0;
IFACEMETHOD_(COLORREF, GetZoneBorderColor)
() = 0;
/**
* @returns Color used to highlight zone while giving zone layout hints.
*/
IFACEMETHOD_(COLORREF, GetZoneHighlightColor)() = 0;
IFACEMETHOD_(COLORREF, GetZoneHighlightColor)
() = 0;
/**
* @returns Integer in range [0, 100] indicating opacity of highlighted zone (while giving zone layout hints).
*/
IFACEMETHOD_(int, GetZoneHighlightOpacity)() = 0;
IFACEMETHOD_(int, GetZoneHighlightOpacity)
() = 0;
/**
* @returns Boolean indicating if dragged window should be transparent.
*/
IFACEMETHOD_(bool, isMakeDraggedWindowTransparentActive) () = 0;
IFACEMETHOD_(bool, isMakeDraggedWindowTransparentActive)
() = 0;
/**
* @returns Boolean indicating if move/size operation is currently active.
*/
IFACEMETHOD_(bool, InMoveSize) () = 0;
IFACEMETHOD_(bool, InMoveSize)
() = 0;
};
winrt::com_ptr<IFancyZones> MakeFancyZones(HINSTANCE hinstance, const winrt::com_ptr<IFancyZonesSettings>& settings) noexcept;