[seahorse/wip/nielsdg/fix-warnings: 3/4] ssh: Askpass: Use Gdk.Seat.grab()
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse/wip/nielsdg/fix-warnings: 3/4] ssh: Askpass: Use Gdk.Seat.grab()
- Date: Mon, 13 Jan 2020 07:49:33 +0000 (UTC)
commit bf25815cb2ed9670cfa5fe3abb23fe81093483c7
Author: Niels De Graef <nielsdegraef gmail com>
Date: Mon Jan 13 08:44:04 2020 +0100
ssh: Askpass: Use Gdk.Seat.grab()
Gdk.keyboard_grab has ben deprecated for quite some time now, so stop
using it to get rid of some deprecation warnings.
common/passphrase-prompt.vala | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/common/passphrase-prompt.vala b/common/passphrase-prompt.vala
index b3ec2f71..373a9b8f 100644
--- a/common/passphrase-prompt.vala
+++ b/common/passphrase-prompt.vala
@@ -184,11 +184,22 @@ public class Seahorse.PassphrasePrompt : Gtk.Dialog {
return false;
}
- private bool grab_keyboard (Gtk.Widget win, Gdk.Event event) {
+ private bool grab_keyboard(Gtk.Widget win, Gdk.Event event) {
#if ! _DEBUG
- if (!this.keyboard_grabbed)
- if (Gdk.keyboard_grab(win.get_window(), false, event.get_time()) != 0)
- message("could not grab keyboard");
+ if (!this.keyboard_grabbed) {
+ Gdk.Display display = Gdk.Display.get_default();
+ Gdk.Seat seat = display.get_default_seat();
+
+ var grab_status = seat.grab(win.get_window(),
+ Gdk.SeatCapabilities.KEYBOARD,
+ false,
+ null,
+ event,
+ null);
+
+ if (grab_status != Gdk.GrabStatus.SUCCESS)
+ message("could not grab keyboard: %u", grab_status);
+ }
this.keyboard_grabbed = true;
#endif
return false;
@@ -197,8 +208,12 @@ public class Seahorse.PassphrasePrompt : Gtk.Dialog {
/* ungrab_keyboard - remove grab */
private bool ungrab_keyboard (Gtk.Widget win, Gdk.Event event) {
#if ! _DEBUG
- if (this.keyboard_grabbed)
- Gdk.keyboard_ungrab(event.get_time());
+ if (this.keyboard_grabbed) {
+ Gdk.Display display = Gdk.Display.get_default();
+ Gdk.Seat seat = display.get_default_seat();
+
+ seat.ungrab();
+ }
this.keyboard_grabbed = false;
#endif
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]