-
-
Notifications
You must be signed in to change notification settings - Fork 397
Fluent Window #3271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fluent Window #3271
Changes from all commits
Commits
Show all changes
119 commits
Select commit
Hold shift + click to select a range
3e9a0e2
Added basic structure for fluent window
onesounds 270f5b3
Base Structure for fluent window
onesounds 53cb94d
Fix first load issue
onesounds 278121b
Remove delay for hide
onesounds db5036a
Fix other delays when hide window
onesounds 41b05b3
Replace dll import with PInvoke for code quality
Jack251970 10bbccb
Add theme compatibility code
onesounds 77e0234
Merge branch '250223FluentTest2' of https://github.com/onesounds/Flow…
onesounds 4426bed
Merge Dev
onesounds 912c991
Fix theme.cs
onesounds bbdb589
Add BGcolor style for blur mode
onesounds 6a736a8
Add bgcolor for blur
onesounds 70543d2
Add WindowCornerRadius Property function
onesounds 5b81cf5
Adjust Shadow Effect
onesounds f00f98c
Add Proprerty for blur themes
onesounds 2cd5174
Adjust themes
onesounds ff18abc
Change Window type
onesounds f0b1422
Change AddShadow Logic
onesounds 90828d9
Fix Shadow Timing
onesounds f712f63
Adjust Animator
onesounds 4ab5ef0
Adjust Animation
onesounds 2da2012
Adjust Animation
onesounds 2a55cab
Fix Show Function
onesounds 40ca75a
Adjust Comment, Adjust Shadow Timing.
onesounds 7587178
Adjust Hide function for fix blink issue
onesounds 4042231
Fix blink issue when fast trigering show/hide
onesounds a65dc65
Change Show/Hide function to using DWM
onesounds 1bfec0a
Fix Animation
onesounds 624fa0e
Fix Hide
onesounds 1b22d9c
Fix Clock Animation
onesounds 2710de1
Fix Search Icon Opacity
onesounds 46cdb2a
Fix Blink issue when hidestartup mode (hide on)
onesounds 01d081d
Revert Startup Blinking
onesounds b8748d6
Fix Render Blink
onesounds c63bb21
Added Windows 10 check code
onesounds 1345470
- Revert blinking fix
onesounds 7e622b7
Add BackdropType in setting
onesounds 9510a07
Add Mica Background option
onesounds f5d9155
Add Mica control in blur function
onesounds 4fd5e15
- Adjust Setting order
onesounds 1c79d51
Fix Change Theme render timing
onesounds ba02a3c
Add Strings
onesounds f4b074c
Fix shadow effec tissue
onesounds ea5b3f1
Disable backdrop control when use non-blur theme
onesounds aabe967
Adjust Dropshadow control disable
onesounds ec5d52e
Fix Preview background
onesounds 72d2b7e
Change default pending color
onesounds 73c5f39
Merge Dev
onesounds dd1f439
Adjust strings and icon
onesounds 6c1730e
Merge Dev
onesounds 88f8274
Remove duplicated strings
onesounds 2cd769b
Fix UI thread issue and preview
onesounds c7a2dee
Fix Keeping shadow when change page issue
onesounds caa5a48
Use enum instead of constants & Use vm property
Jack251970 8484c2b
Fix color scheme change issue & Code cleanup
Jack251970 c17dcad
Revert "Use enum instead of constants"
Jack251970 57d206f
Fix SystemBG color select
onesounds 887be64
Merge branch '250223FluentTest2' of https://github.com/onesounds/Flow…
onesounds e527e6c
Fix Backdrop reset when change theme
onesounds fd344a3
Fix Preview border
onesounds 4e15cb0
Comment cleanup
onesounds d90b82a
Code Cleanup
onesounds 7c8d45d
- Fix Clock Right margin
onesounds aeb3f22
- rollback pin theme to legacy
onesounds 53d647f
Adjust Themes for fluent
onesounds 9ec6d5c
Fix clock visibilty when open context menu
onesounds fa5bfd3
Fix BlurWhite theme
onesounds ce55303
- Fix Logic for dwmBG
onesounds 0086a9e
Add a condition to disable blur on unsupported Windows versions.
onesounds c792544
Adjust UI
onesounds a98b7b7
Merge branch 'dev' into 250223FluentTest2
Jack251970 29c6f12
Code cleanup
Jack251970 07b0e72
Code cleanup
Jack251970 e4ade45
Use PInvoke.DwmSetWindowAttribute instead of DllImport
Jack251970 db37ab7
Use PInvoke.DwmSetWindowAttribute instead of DllImport
Jack251970 7a85439
Improve code quality
Jack251970 2dcbe7f
Remove old blur handling codes
Jack251970 200c32b
Code cleanup
Jack251970 cff400b
Revert main window xaml change
Jack251970 7c23aeb
Improve code quality
Jack251970 07c5fa4
Improve code quality
Jack251970 2ed5de3
Improve sys plugin theme selector
Jack251970 cd46c79
Fix build issue
Jack251970 9a6175e
Remove useless position initialization & Remove useless dispatcher in…
Jack251970 6f093cf
Merge branch 'dev' into 250223FluentTest2
Jack251970 3966290
Refresh frame after position is intialized
Jack251970 2ea303f
Code cleanup
Jack251970 70e7f82
Fix Blink
onesounds ecc9f0d
Fix acrylic backdrop flicker issue
Jack251970 09d66f5
Merge branch '250223FluentTest2' of https://github.com/onesounds/Flow…
onesounds 8b10973
Revert "Fix Blink"
Jack251970 1ca17aa
Code cleanup
Jack251970 2cd1683
Improve code quality
Jack251970 a98a033
Improve code quality
Jack251970 7d62ded
Improve code quality
Jack251970 49f1d79
Fix SetWindowLong issue
Jack251970 bf5591c
Fix position set issue
Jack251970 0bcc187
Keep user settings when changing theme
Jack251970 2b6e1bf
Improve code quality
Jack251970 da30e2e
Improve code quality
Jack251970 a2f70f4
Organize usings
Jack251970 1e6bbdd
Organize usings
Jack251970 698217f
Improve code quality
Jack251970 4d080a9
Fix build issue
Jack251970 841cc06
Fix blink clock/icon animation issue when show/hide repeatly
onesounds f3a5365
Merge remote-tracking branch 'origin/250223FluentTest2' into 250223Fl…
onesounds 0741231
Adjust Flickering code
onesounds 95f151b
Organize usings
Jack251970 711865d
Use local variable for storyboard
Jack251970 7876fa1
Fix possible cancel token issue
Jack251970 570d9ce
Remove useless logic
Jack251970 bfa7622
Improve performance
Jack251970 df8f2f0
Merge branch 'dev' into 250223FluentTest2
Jack251970 8493fa5
Merge branch 'dev' into 250223FluentTest2
Jack251970 a3322fc
Remove Corner Type
onesounds 4731d88
Removed window animation storyboard
onesounds aaca0c0
Change Comment to english
onesounds 9cb31c8
Improve code quality
Jack251970 944393c
Improve code quality
Jack251970 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
using System.Collections.Generic; | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Windows; | ||
using Windows.Win32; | ||
using Windows.Win32.Foundation; | ||
using Windows.Win32.Graphics.Gdi; | ||
using Windows.Win32.UI.WindowsAndMessaging; | ||
|
||
namespace Flow.Launcher.Infrastructure; | ||
|
||
/// <summary> | ||
/// Contains full information about a display monitor. | ||
/// Codes are edited from: <see href="https://github.com/Jack251970/DesktopWidgets3">. | ||
/// </summary> | ||
internal class MonitorInfo | ||
{ | ||
/// <summary> | ||
/// Gets the display monitors (including invisible pseudo-monitors associated with the mirroring drivers). | ||
/// </summary> | ||
/// <returns>A list of display monitors</returns> | ||
public static unsafe IList<MonitorInfo> GetDisplayMonitors() | ||
{ | ||
var monitorCount = PInvoke.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_CMONITORS); | ||
var list = new List<MonitorInfo>(monitorCount); | ||
var callback = new MONITORENUMPROC((HMONITOR monitor, HDC deviceContext, RECT* rect, LPARAM data) => | ||
{ | ||
list.Add(new MonitorInfo(monitor, rect)); | ||
return true; | ||
}); | ||
var dwData = new LPARAM(); | ||
var hdc = new HDC(); | ||
bool ok = PInvoke.EnumDisplayMonitors(hdc, (RECT?)null, callback, dwData); | ||
if (!ok) | ||
{ | ||
Marshal.ThrowExceptionForHR(Marshal.GetLastWin32Error()); | ||
} | ||
return list; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the display monitor that is nearest to a given window. | ||
/// </summary> | ||
/// <param name="hwnd">Window handle</param> | ||
/// <returns>The display monitor that is nearest to a given window, or null if no monitor is found.</returns> | ||
public static unsafe MonitorInfo GetNearestDisplayMonitor(HWND hwnd) | ||
{ | ||
var nearestMonitor = PInvoke.MonitorFromWindow(hwnd, MONITOR_FROM_FLAGS.MONITOR_DEFAULTTONEAREST); | ||
MonitorInfo nearestMonitorInfo = null; | ||
var callback = new MONITORENUMPROC((HMONITOR monitor, HDC deviceContext, RECT* rect, LPARAM data) => | ||
{ | ||
if (monitor == nearestMonitor) | ||
{ | ||
nearestMonitorInfo = new MonitorInfo(monitor, rect); | ||
return false; | ||
} | ||
return true; | ||
}); | ||
var dwData = new LPARAM(); | ||
var hdc = new HDC(); | ||
bool ok = PInvoke.EnumDisplayMonitors(hdc, (RECT?)null, callback, dwData); | ||
if (!ok) | ||
{ | ||
Marshal.ThrowExceptionForHR(Marshal.GetLastWin32Error()); | ||
} | ||
Jack251970 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return nearestMonitorInfo; | ||
} | ||
|
||
private readonly HMONITOR _monitor; | ||
|
||
internal unsafe MonitorInfo(HMONITOR monitor, RECT* rect) | ||
{ | ||
RectMonitor = | ||
new Rect(new Point(rect->left, rect->top), | ||
new Point(rect->right, rect->bottom)); | ||
_monitor = monitor; | ||
var info = new MONITORINFOEXW() { monitorInfo = new MONITORINFO() { cbSize = (uint)sizeof(MONITORINFOEXW) } }; | ||
GetMonitorInfo(monitor, ref info); | ||
RectWork = | ||
new Rect(new Point(info.monitorInfo.rcWork.left, info.monitorInfo.rcWork.top), | ||
new Point(info.monitorInfo.rcWork.right, info.monitorInfo.rcWork.bottom)); | ||
Name = new string(info.szDevice.AsSpan()).Replace("\0", "").Trim(); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the name of the display. | ||
/// </summary> | ||
public string Name { get; } | ||
|
||
/// <summary> | ||
/// Gets the display monitor rectangle, expressed in virtual-screen coordinates. | ||
/// </summary> | ||
/// <remarks> | ||
/// <note>If the monitor is not the primary display monitor, some of the rectangle's coordinates may be negative values.</note> | ||
/// </remarks> | ||
public Rect RectMonitor { get; } | ||
|
||
/// <summary> | ||
/// Gets the work area rectangle of the display monitor, expressed in virtual-screen coordinates. | ||
/// </summary> | ||
/// <remarks> | ||
/// <note>If the monitor is not the primary display monitor, some of the rectangle's coordinates may be negative values.</note> | ||
/// </remarks> | ||
public Rect RectWork { get; } | ||
|
||
/// <summary> | ||
/// Gets if the monitor is the the primary display monitor. | ||
/// </summary> | ||
public bool IsPrimary => _monitor == PInvoke.MonitorFromWindow(new(IntPtr.Zero), MONITOR_FROM_FLAGS.MONITOR_DEFAULTTOPRIMARY); | ||
|
||
/// <inheritdoc /> | ||
public override string ToString() => $"{Name} {RectMonitor.Width}x{RectMonitor.Height}"; | ||
|
||
private static unsafe bool GetMonitorInfo(HMONITOR hMonitor, ref MONITORINFOEXW lpmi) | ||
{ | ||
fixed (MONITORINFOEXW* lpmiLocal = &lpmi) | ||
{ | ||
var lpmiBase = (MONITORINFO*)lpmiLocal; | ||
var __result = PInvoke.GetMonitorInfo(hMonitor, lpmiBase); | ||
return __result; | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Runtime.InteropServices; | ||
using Windows.Win32.Foundation; | ||
using Windows.Win32.UI.WindowsAndMessaging; | ||
|
||
namespace Windows.Win32; | ||
|
||
// Edited from: https://github.com/files-community/Files | ||
internal static partial class PInvoke | ||
{ | ||
[DllImport("User32", EntryPoint = "SetWindowLongW", ExactSpelling = true)] | ||
static extern int _SetWindowLong(HWND hWnd, int nIndex, int dwNewLong); | ||
|
||
[DllImport("User32", EntryPoint = "SetWindowLongPtrW", ExactSpelling = true)] | ||
static extern nint _SetWindowLongPtr(HWND hWnd, int nIndex, nint dwNewLong); | ||
|
||
// NOTE: | ||
// CsWin32 doesn't generate SetWindowLong on other than x86 and vice versa. | ||
// For more info, visit https://github.com/microsoft/CsWin32/issues/882 | ||
public static unsafe nint SetWindowLongPtr(HWND hWnd, WINDOW_LONG_PTR_INDEX nIndex, nint dwNewLong) | ||
{ | ||
return sizeof(nint) is 4 | ||
? _SetWindowLong(hWnd, (int)nIndex, (int)dwNewLong) | ||
: _SetWindowLongPtr(hWnd, (int)nIndex, dwNewLong); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.