Page MenuHome GnuPG

gtk: Put the dialog on monitor with focused window.
Needs ReviewPublic

Authored by gouttegd on Aug 23 2017, 10:48 PM.
This revision needs review, but there are no reviewers specified.


  • gtk+-2/pinentry-gtk-2.c (move_window_to_active_monitor): New function.

(create_window): Insert call to previous function.

GnuPG-bug-id: 2245
Signed-off-by: Damien Goutte-Gattat <>

Test Plan

Buy a second monitor if you only have one. ;) Then run pinentry-gtk-2 from a terminal on one monitor, and with the mouse cursor on the other monitor, issue a GETPIN command. Without the patch, the dialog should appear on the monitor where the mouse cursor is. With the patch applied, the dialog should appear on the monitor containing the focused terminal, no matter where the mouse is.

Whether this works or not may depend on the window manager, which is free to ignore the gtk_window_move and put the window wherever it wants. It works with XFCE and Awesome, though.

Diff Detail

rP Pinentry
Lint Skipped
Unit Tests Skipped

Event Timeline

gouttegd added a project: pinentry.

Avoid moving the window ourselves if the cursor happens to be on the same monitor than the currently focused window, since in that case the window will already be on the right monitor.