Skip to content

Code Quality: Removed Vanara from ShellPreviewViewModel#16945

Merged
yair100 merged 3 commits into
files-community:mainfrom
0x5bfa:5bfa/CQ-CsWin32ShellPreviewing
Mar 26, 2025
Merged

Code Quality: Removed Vanara from ShellPreviewViewModel#16945
yair100 merged 3 commits into
files-community:mainfrom
0x5bfa:5bfa/CQ-CsWin32ShellPreviewing

Conversation

@0x5bfa

@0x5bfa 0x5bfa commented Mar 16, 2025

Copy link
Copy Markdown
Member

Resolved / Related Issues

Steps used to test these changes

  1. Open Files.
  2. Select a DOCX, a PDF, etc.
  3. Select another one annd switch between them several times to see if the preview handler is disposed correctly.

@0x5bfa 0x5bfa force-pushed the 5bfa/CQ-CsWin32ShellPreviewing branch from b7f4136 to 449f1dc Compare March 16, 2025 17:30
@0x5bfa

0x5bfa commented Mar 16, 2025

Copy link
Copy Markdown
Member Author

CC @hez2010

Ready, confirmed to be working well.

Comment thread src/Files.App/ViewModels/UserControls/Previews/ShellPreviewViewModel.cs Outdated
@yair100 yair100 requested a review from hez2010 March 16, 2025 19:51
@yair100 yair100 added the ready for review Pull requests that are ready for review label Mar 16, 2025
@hez2010

hez2010 commented Mar 18, 2025

Copy link
Copy Markdown
Member

I'm OOF this week. Will take a look later.

@yair100 yair100 force-pushed the main branch 7 times, most recently from 30cea65 to decf3da Compare March 24, 2025 21:33

@hez2010 hez2010 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Left some comments.

Comment thread src/Files.App/ViewModels/UserControls/Previews/ShellPreviewViewModel.cs Outdated
Comment on lines +137 to +139
_windProc = new(WndProc);
var pWindProc = Marshal.GetFunctionPointerForDelegate(_windProc);
var pfnWndProc = (delegate* unmanaged[Stdcall]<HWND, uint, WPARAM, LPARAM, LRESULT>)pWindProc;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to avoid using GetFunctionPointerForDelegate. Instead, marking WndProc as static and UnmanagedCallersOnly and taking a function pointer from it directly.
While we don't need to do it immediately in this PR as it may require some refactor to WndProc.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Since making proc-s static has huge impact like you said, i was hesitant to do this (while I understand using GetFunctionPointerForDelegate has performance impact likewise)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im curious, if you were to, how would you refactor (roughly)?

@yair100 yair100 added ready to merge Pull requests that are approved and ready to merge and removed ready for review Pull requests that are ready for review labels Mar 25, 2025
@yair100

yair100 commented Mar 25, 2025

Copy link
Copy Markdown
Member

@0x5bfa can you please resolve the conflicts?

0x5bfa and others added 3 commits March 26, 2025 13:34
…wModel.cs

Co-authored-by: Steve <hez2010@outlook.com>
Signed-off-by: 0x5BFA <62196528+0x5bfa@users.noreply.github.com>
@0x5bfa 0x5bfa force-pushed the 5bfa/CQ-CsWin32ShellPreviewing branch from 0ca9b55 to 141bc82 Compare March 26, 2025 04:35
@yair100 yair100 merged commit 6cee330 into files-community:main Mar 26, 2025
@0x5bfa 0x5bfa deleted the 5bfa/CQ-CsWin32ShellPreviewing branch March 26, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge Pull requests that are approved and ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants