Fwd: Bug#445607: Make pinentry-gtk-2 transient for the root window

Peter Eisentraut <[email protected]> Sat, 2 Feb 2008 21:37:21 +0100
Newsgroups gmane.comp.encryption.gpg.gpa.devel
Message-ID <[email protected]>
--Boundary-00=_BSNpHv278XM3v2z
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Please consider the attached request from a Debian user.

--Boundary-00=_BSNpHv278XM3v2z
Content-Type: message/rfc822;
  name="forwarded message"
Content-Transfer-Encoding: 7bit
Content-Description: Joachim Breitner <[email protected]>: Bug#445607: Make
	pinentry-gtk-2 transient for the root window
Content-Disposition: inline

Return-Path: <[email protected]>
X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on 
	ramrod.pezone.net
X-Spam-Level: xx
X-Spam-Status: No, score=2.6 required=6.0 tests=BAYES_50,FORGED_RCVD_HELO,
	UNPARSEABLE_RELAY autolearn=no version=3.1.7-deb
X-Original-To: peter@localhost
Delivered-To: peter@localhost
Received: from ramrod.pezone.net (localhost [127.0.0.1])
	by ramrod.pezone.net (Postfix) with ESMTP id 125EC48019A
	for <peter@localhost>; Sun,  7 Oct 2007 11:25:32 +0200 (CEST)
X-Flags: 0000
Delivered-To: GMX delivery to [email protected]
Received: from pop.gmx.net [213.165.64.22]
	by ramrod.pezone.net with POP3 (fetchmail-6.3.6)
	for <peter@localhost> (single-drop);
	Sun, 07 Oct 2007 11:25:32 +0200 (CEST)
Received: (qmail invoked by alias); 07 Oct 2007 09:22:35 -0000
Received: from rietz.debian.org (EHLO rietz.debian.org) [140.211.166.43]
	by mx0.gmx.net (mx065) with SMTP; 07 Oct 2007 11:22:35 +0200
Received: from debbugs by rietz.debian.org with local (Exim 4.50)
	id 1IeSJr-0007p8-Pj; Sun, 07 Oct 2007 09:21:03 +0000
X-Loop: [email protected]
Subject: Bug#445607: Make pinentry-gtk-2 transient for the root window
Reply-To: Joachim Breitner <[email protected]>,
 [email protected]
Resent-From: Joachim Breitner <[email protected]>
Original-Sender: Joachim Breitner <[email protected]>
Resent-To: [email protected]
Resent-CC: Peter Eisentraut <[email protected]>
Resent-Date: Sun, 07 Oct 2007 09:21:01 +0000
Resent-Message-ID: <[email protected]>
X-Debian-PR-Message: report 445607
X-Debian-PR-Package: pinentry-gtk2
X-Debian-PR-Keywords: patch
X-Debian-PR-Source: pinentry
Received: via spool by [email protected] id=B.11917486129106
	(code B ref -1); Sun, 07 Oct 2007 09:21:01 +0000
Received: (at submit) by bugs.debian.org; 7 Oct 2007 09:16:52 +0000
Received: from nomeata.de
	([83.133.81.20] helo=quimby.ehbuehl.net ident=Debian-exim)
	by rietz.debian.org with esmtp (Exim 4.50) id 1IeSBI-00084c-Oi
	for [email protected]; Sun, 07 Oct 2007 09:12:13 +0000
Received: from [132.230.204.63] (helo=otto.ehbuehl.net)
	by quimby.ehbuehl.net with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.63) (envelope-from <[email protected]>)
	id 1IeSBB-00089T-OD; Sun, 07 Oct 2007 11:12:10 +0200
Received: from jojo by otto.ehbuehl.net with local (Exim 4.67)
	(envelope-from <[email protected]>)
	id 1IeSBB-0003Ow-B0; Sun, 07 Oct 2007 11:12:05 +0200
Content-Type: multipart/mixed;
  boundary="===============0766390043=="
MIME-Version: 1.0
From: Joachim Breitner <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Message-ID: <[email protected]>
X-Mailer: reportbug 3.39
Date: Sun, 07 Oct 2007 11:12:05 +0200
Sender: Joachim Breitner <[email protected]>
Delivered-To: [email protected]
Resent-Sender: Debian BTS <[email protected]>
Resent-Date: Sun, 07 Oct 2007 09:21:03 +0000
X-GMX-Antivirus: -1 (not scanned, may not use virus scanner)
X-GMX-Antispam: -2 (not scanned, spam filter disabled)
X-GMX-UID: ZJcxcmN2eWU6Nc3vdHVzhmU5U3U4N08a
X-Virus-Status: No
X-Virus-Checker-Version: clamassassin 1.2.3 with clamdscan / ClamAV
	0.91.2/4491/Sun Oct 7 04:29:59 2007
X-Length: 6725
X-UID: 7339

This is a multi-part MIME message sent by reportbug.


--===============0766390043==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: pinentry-gtk2
Version: 0.7.3-1
Severity: wishlist
Tags: patch

Hi,

the attached patch makes the pinentry-gtk-2 transient for the root
window. This will prevent confusion for the user when another window
seems to have the focus but pinentry-gtk-2 has the keyboard grab. It
also helps window managers such as xmonad to properly position the
window.

Thanks,
Joachim

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.21.otto
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages pinentry-gtk2 depends on:
ii  libc6                     2.6.1-5        GNU C Library: Shared libraries
ii  libglib2.0-0              2.14.1-4       The GLib library of C routines
ii  libgtk2.0-0               2.12.0-2       The GTK+ graphical user interface 
ii  libncurses5               5.6+20070908-1 Shared libraries for terminal hand
ii  libpango1.0-0             1.18.2-1       Layout and rendering of internatio

pinentry-gtk2 recommends no packages.

-- no debconf information

--===============0766390043==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="pinentry-transient-window.patch"

diff -u pinentry-0.7.3/debian/changelog pinentry-0.7.3/debian/changelog
--- pinentry-0.7.3/debian/changelog
+++ pinentry-0.7.3/debian/changelog
@@ -1,3 +1,9 @@
+pinentry (0.7.3-1.nomeata1) unstable; urgency=low
+
+  * Make window transient
+
+ -- Joachim Breitner <[email protected]>  Sun, 07 Oct 2007 10:37:32 +0200
+
 pinentry (0.7.3-1) unstable; urgency=low
 
   * New upstream release
only in patch2:
unchanged:
--- pinentry-0.7.3.orig/gtk+-2/pinentry-gtk-2.c
+++ pinentry-0.7.3/gtk+-2/pinentry-gtk-2.c
@@ -84,6 +84,22 @@
 				 GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
 }
 
+/* Realize the window as transient, if we will grab the keyboard */
+static void
+make_transient (GtkWidget *win, GdkEvent *event, gpointer data)
+{
+  GdkScreen *screen;
+  GdkWindow *root;
+
+  if (!pinentry->grab)
+    return;
+
+  /* Make window transient for the root window */
+  screen = gdk_screen_get_default();
+  root = gdk_screen_get_root_window(screen);
+  gdk_window_set_transient_for(win->window, root);
+
+}
 
 /* Grab the keyboard for maximum security */
 static void
@@ -101,6 +117,9 @@
 ungrab_keyboard (GtkWidget *win, GdkEvent *event, gpointer data)
 {
   gdk_keyboard_ungrab (gdk_event_get_time (event));
+  
+  /* Unmake window transient for the root window */
+  gdk_window_set_transient_for(win->window, NULL);
 }
 
 
@@ -206,6 +225,10 @@
 		    G_CALLBACK (constrain_size), NULL);
   if (!confirm_mode)
     {
+      if (pinentry->grab)
+	      g_signal_connect (G_OBJECT (win),
+	      		"realize",
+			G_CALLBACK (make_transient), NULL);
       g_signal_connect (G_OBJECT (win),
 			pinentry->grab ? "map-event" : "focus-in-event",
 			G_CALLBACK (grab_keyboard), NULL);

--===============0766390043==--


--Boundary-00=_BSNpHv278XM3v2z
Content-Type: message/rfc822;
  name="forwarded message"
Content-Transfer-Encoding: 7bit
Content-Description: Joachim Breitner <[email protected]>: Bug#445607:
	Updated patch
Content-Disposition: inline

Return-Path: <[email protected]>
X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on ramrod.pezone.net
X-Spam-Level: 
X-Spam-Status: No, score=-3.6 required=6.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW
	autolearn=ham version=3.2.3
X-Original-To: peter@localhost
Delivered-To: peter@localhost
Received: from ramrod.pezone.net (localhost [127.0.0.1])
	by ramrod.pezone.net (Postfix) with ESMTP id 9534148020F
	for <peter@localhost>; Thu, 24 Jan 2008 00:22:37 +0100 (CET)
X-Flags: 0000
Delivered-To: GMX delivery to [email protected]
Received: from pop.gmx.net [213.165.64.22]
	by ramrod.pezone.net with POP3 (fetchmail-6.3.6)
	for <peter@localhost> (single-drop);
	Thu, 24 Jan 2008 00:22:37 +0100 (CET)
Received: (qmail invoked by alias); 23 Jan 2008 23:17:06 -0000
Received: from rietz.debian.org (EHLO rietz.debian.org) [140.211.166.43]
	by mx0.gmx.net (mx022) with SMTP; 24 Jan 2008 00:17:06 +0100
Received: from debbugs by rietz.debian.org with local (Exim 4.63)
	(envelope-from <[email protected]>)
	id 1JHolH-00067a-Nm; Wed, 23 Jan 2008 23:12:03 +0000
X-Loop: [email protected]
Subject: Bug#445607: Updated patch
Reply-To: Joachim Breitner <[email protected]>,
 [email protected]
Resent-From: Joachim Breitner <[email protected]>
Original-Sender: Joachim Breitner <[email protected]>
Resent-To: [email protected]
Resent-CC: Peter Eisentraut <[email protected]>
Resent-Date: Wed, 23 Jan 2008 23:12:03 +0000
Resent-Message-ID: <[email protected]>
X-Debian-PR-Message: report 445607
X-Debian-PR-Package: pinentry-gtk2
X-Debian-PR-Keywords: patch
X-Debian-PR-Source: pinentry
Received: via spool by [email protected] id=B445607.120112982422299
	(code B ref 445607); Wed, 23 Jan 2008 23:12:03 +0000
Received: (at 445607) by bugs.debian.org; 23 Jan 2008 23:10:24 +0000
Received: from nomeata.de
	([83.133.81.20] helo=quimby.ehbuehl.net ident=Debian-exim)
	by rietz.debian.org with esmtp (Exim 4.63)
	(envelope-from <[email protected]>) id 1JHojg-0005nH-37
	for [email protected]; Wed, 23 Jan 2008 23:10:24 +0000
Received: from [10.254.1.11] (helo=otto.ehbuehl.net)
	by quimby.ehbuehl.net with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.63) (envelope-from <[email protected]>)
	id 1JHojd-0006Ea-NE
	for [email protected]; Thu, 24 Jan 2008 00:10:22 +0100
Received: from jojo by otto.ehbuehl.net with local (Exim 4.69)
	(envelope-from <[email protected]>) id 1JHoja-0004rh-D5
	for [email protected]; Thu, 24 Jan 2008 00:10:18 +0100
From: Joachim Breitner <[email protected]>
To: [email protected]
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="=-g8nfLsO4B4ZXmr9eXNFM"
Date: Thu, 24 Jan 2008 00:10:18 +0100
Message-Id: <[email protected]>
Mime-Version: 1.0
X-Mailer: Evolution 2.12.3 
Sender: Joachim Breitner <[email protected]>
Resent-Sender: Debian BTS <[email protected]>
Resent-Date: Wed, 23 Jan 2008 23:12:03 +0000
X-GMX-Antivirus: -1 (not scanned, may not use virus scanner)
X-GMX-Antispam: -2 (not scanned, spam filter disabled)
X-GMX-UID: xPKhdl1rYmYTGJO5Ync3fKlKWkZTQZRG
X-Virus-Status: No
X-Virus-Checker-Version: clamassassin 1.2.3 with clamdscan / ClamAV
	0.92/5532/Wed Jan 23 22:08:36 2008
X-Length: 7289
X-UID: 7831


--=-g8nfLsO4B4ZXmr9eXNFM
Content-Type: multipart/mixed; boundary="=-jAWb+Z5sQkbMS4KY2tyq"


--=-jAWb+Z5sQkbMS4KY2tyq
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hi,

I have updated the patch to apply cleanly against the newest version.

Greetings,
Joachim
--=20
Joachim "nomeata" Breitner
Debian Developer
  [email protected] | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: [email protected] | http://people.debian.org/~nomeata

--=-jAWb+Z5sQkbMS4KY2tyq
Content-Disposition: attachment; filename=pinentry-transient.patch
Content-Type: application/x-drivel; name=pinentry-transient.patch
Content-Transfer-Encoding: base64

ZGlmZiAtdXIgcGluZW50cnktMC43LjQvZGViaWFuL2NoYW5nZWxvZyBwaW5lbnRyeS0wLjcuNC1u
ZXcvZGViaWFuL2NoYW5nZWxvZwotLS0gcGluZW50cnktMC43LjQvZGViaWFuL2NoYW5nZWxvZwky
MDA4LTAxLTI0IDAwOjA5OjEwLjAwMDAwMDAwMCArMDEwMAorKysgcGluZW50cnktMC43LjQtbmV3
L2RlYmlhbi9jaGFuZ2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nQpLCBOVUxMKTsKICAgICAgIGdfc2lnbmFsX2Nvbm5lY3QgKEdfT0JKRUNUICh3aW4pLAog
CQkJcGluZW50cnktPmdyYWIgPyAibWFwLWV2ZW50IiA6ICJmb2N1cy1pbi1ldmVudCIsCiAJCQlH
X0NBTExCQUNLIChncmFiX2tleWJvYXJkKSwgTlVMTCk7Ck51ciBpbiBwaW5lbnRyeS0wLjcuNC1u
ZXcvZ3RrKy0yOiBwaW5lbnRyeS1ndGstMi5jLm9yaWcuCg==


--=-jAWb+Z5sQkbMS4KY2tyq--

--=-g8nfLsO4B4ZXmr9eXNFM
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: Dies ist ein digital signierter Nachrichtenteil

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBHl8la9ijrk0dDIGwRAq9lAKDCSyetIQVlH/TlEJ5Z5ccehQDjhwCfRP2n
TQy02jj2vMsn299GGp/NGzU=
=M3ql
-----END PGP SIGNATURE-----

--=-g8nfLsO4B4ZXmr9eXNFM--


--Boundary-00=_BSNpHv278XM3v2z
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Gpa-dev mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gpa-dev

--Boundary-00=_BSNpHv278XM3v2z--