$OpenBSD: patch-src_gnomeglobalshortcutbackend_cpp,v 1.1 2016/12/05 11:24:50 dcoppa Exp $

commit a649c7114be2612bce72e9c292fab4eb964373a8
Author: Felix Kaiser <felix.kaiser@fxkr.net>
Date:   Wed Oct 12 20:08:30 2016 +0200

Fix global shortcuts on GNOME

--- src/gnomeglobalshortcutbackend.cpp.orig	Thu Sep 17 16:14:00 2015
+++ src/gnomeglobalshortcutbackend.cpp	Mon Dec  5 12:15:26 2016
@@ -49,6 +49,12 @@ bool GnomeGlobalShortcutBackend::DoRegister() {
                 kGsdService, kGsdPath, kGsdInterface, QDBusConnection::sessionBus(), this);
     }
 
+    QDBusMessage reply = interface_->call("GrabMediaPlayerKeys", "Minitube", (unsigned int) 0);
+
+    if (reply.type() == QDBusMessage::ErrorMessage) {
+      qWarning() << "Failed to grab media player keys. Error:" << reply.errorMessage();
+    }
+
     connect(interface_, SIGNAL(MediaPlayerKeyPressed(QString,QString)),
             this, SLOT(GnomeMediaKeyPressed(QString,QString)));
 
@@ -64,6 +70,8 @@ void GnomeGlobalShortcutBackend::DoUnregister() {
 
     disconnect(interface_, SIGNAL(MediaPlayerKeyPressed(QString,QString)),
                this, SLOT(GnomeMediaKeyPressed(QString,QString)));
+
+    interface_->call("ReleaseMediaPlayerKeys", "Minitube");
 }
 
 void GnomeGlobalShortcutBackend::GnomeMediaKeyPressed(const QString&, const QString& key) {
