Page MenuHome GnuPG

w32: Fixed not focused window
AcceptedPublic

Authored by Sabrosa on Feb 5 2022, 11:20 PM.

Details

Reviewers
werner
Summary

The code that was supposed to set the pinentry window to the foreground did actually the opposite and unfocused it, so I always had to first click on the window in order to enter my password. At least on Windows 10/11 that's the case. When I removed that code, it worked fine.

  • fixed a few warnings that could actually lead to bugs if char is signed
  • fixed build error on MSYS2 with gcc 11: was using #define's of <unistd.h>, but not including it
  • adjusted window and control sizes a bit, in some cases the text was cut off (based on MSYS2 package's .patch)
Test Plan
  • Set the new executable as the pinentry-program and sign something
  • Notice that the window is now correctly focused

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

Sabrosa created this revision.
werner added a subscriber: werner.

I am not sure what all the other ode changes are about. There is no explanation.

In any case the pinentry-w32 is a simple pinentry not intended for regular use. Thus no need t=for such fixes because it would mean to maintain this example pinentry.

You better use pinentry-qt.

pinentry/argparse.c
1171

The whole point of isascii is to avoid a cast.

This revision now requires changes to proceed.Feb 6 2022, 7:17 PM
In D548#5450, @werner wrote:

I am not sure what all the other ode changes are about. There is no explanation.

The removed code in w32/main.c isn't necessary anymore because I removed the call to move_mouse_and_click() (that actually caused the window not being focused). The other code with lock_set_foreground_window() was uncommented, so I thought of removing the code that initializes the function pointer. But I can re-add it and leave a comment if you want.

In D548#5450, @werner wrote:

In any case the pinentry-w32 is a simple pinentry not intended for regular use. Thus no need t=for such fixes because it would mean to maintain this example pinentry.

You better use pinentry-qt.

Okay, didn't know that it's not intended for regular use. I was using pinentry-w32 on Windows for quite some time and it got its job done, so there was no need to switch to another version with much more dependencies. Plus it's the only included pinentry in Git for Windows which is my main field of use for GnuPG.

pinentry/argparse.c
1171

You're right, but gcc emitted a warning anyway. I think it's better to have no warnings during build, because it can confuse new programmers just trying to build the project.

Commented out the problematic code and added notes.

I pushed your chnages and removed a lot more code.
See: rPabbecc67

This revision is now accepted and ready to land.Mar 29 2023, 11:36 AM