[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#181871: marked as done (ITP: xmms-xf86audio -- XMMS plugin to support the XF86Audio keys)



Your message dated Thu, 4 Mar 2004 00:04:45 +0100
with message-id <20040303230445.GA26747@melina.ds14.agh.edu.pl>
and subject line Uploaded
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 21 Feb 2003 09:35:52 +0000
>From devin@debian.org Fri Feb 21 03:35:51 2003
Return-path: <devin@debian.org>
Received: from atlantic.devin.com [66.92.186.143] (qmailr)
	by master.debian.org with smtp (Exim 3.12 1 (Debian))
	id 18m9ax-0003Zo-00; Fri, 21 Feb 2003 03:35:51 -0600
Received: (qmail 5401 invoked by uid 5022); 21 Feb 2003 09:35:49 -0000
Received: from [192.168.0.2] (HELO kesha.devin.com) (192.168.0.2) by atlantic.devin.com (qpsmtpd/0.20) with SMTP; 2003-02-21 09:35:49Z
Received: from aqua by kesha.devin.com with local (Exim 3.36 #1 (Debian))	id 18m9au-0002mw-00; Fri, 21 Feb 2003 01:35:48 -0800
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Devin Carraway <devin@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: xmms: Please support the XF86Audio keys
X-Mailer: reportbug 2.10
Date: Fri, 21 Feb 2003 01:35:48 -0800
Message-Id: <E18m9au-0002mw-00@kesha.devin.com>
Sender: Devin Carraway <aqua@kesha>
X-SMTPD: qpsmtpd/0.20, http://develooper.com/code/qpsmtpd/
X-Spam-Check-By: atlantic.devin.com
X-BadReturnPath: aqua@kesha rewritten as devin@debian.org
  using "From" header
Delivered-To: submit@bugs.debian.org
X-Spam-Status: No, hits=-1.1 required=4.0
	tests=HAS_PACKAGE,PATCH_UNIFIED_DIFF,SPAM_PHRASE_00_01
	version=2.44
X-Spam-Level: 

Package: xmms
Version: 1.2.7-1.1
Severity: wishlist
Tags: patch


I'm the maintainer of acme; I was recently investigating Bug#181578, and
found that acme's upstream (one of the GNOME developers) is encouraging
audio apps to start snagging the XF86Audio* keysyms to support global
use of the media-control keys on many recent keyboards.

Here's a patch that does so for XMMS in a simpleminded way.


--- xmms-1.2.7/xmms/main.c	2002-02-27 06:30:28.000000000 -0800
+++ xmms-1.2.7.xf86audio/xmms/main.c	2003-02-21 01:24:01.000000000 -0800
@@ -2869,6 +2869,93 @@
 	draw_main_window(TRUE);
 }
 									    
+static GdkFilterReturn xf86audio_filter(GdkXEvent *xevent, GdkEvent *event, gpointer data)
+{
+	XEvent *xev = (XEvent *)xevent;
+	XKeyEvent *keyevent = (XKeyEvent *)xevent;
+	KeyCode *k = (KeyCode *)data;
+	gint i;
+	
+	if (xev->type != KeyRelease)
+		return GDK_FILTER_CONTINUE;
+
+	for (i=0; i<XF86AUDIO_MAX; i++) {
+		if (k[i] == keyevent->keycode)
+			break;
+	}
+	if (i == XF86AUDIO_MAX) {
+		g_warning("Received KeyRelease event for unrequested keycode %d", keyevent->keycode);
+		return GDK_FILTER_CONTINUE;
+	}
+
+	switch (i) {
+		case XF86AUDIO_PLAY:
+			if (get_input_paused())
+				input_pause();
+			else if (get_playlist_length())
+				playlist_play();
+			else
+				mainwin_eject_pushed();
+			break;
+		case XF86AUDIO_STOP:
+			input_stop();
+			mainwin_clear_song_info();
+			break;
+		case XF86AUDIO_PREV:
+			playlist_prev();
+			break;
+		case XF86AUDIO_NEXT:
+			playlist_next();
+			break;
+		case XF86AUDIO_PAUSE:
+			/* actually, a play/pause toggle (as with
+			 * CMD_PLAY_PAUSE in the control socket impl)
+			 * might be better
+			 */
+			input_pause();
+			break;
+		default: return GDK_FILTER_CONTINUE;
+	}
+	return GDK_FILTER_REMOVE;
+}
+
+static KeyCode grab_key(char *keystring)
+{
+	KeySym sym;
+	KeyCode code;
+
+	sym = XStringToKeysym(keystring);
+	if (sym == NoSymbol)
+		return 0;
+	if ((code = XKeysymToKeycode(GDK_DISPLAY(), sym)) == 0)
+		return 0;
+	/* might want to refine the modifier set */
+	XGrabKey(GDK_DISPLAY(), code,
+			AnyModifier, GDK_ROOT_WINDOW(),
+			1, GrabModeAsync, GrabModeAsync);
+	return code;
+}
+
+static void grab_xf86audio_keys()
+{
+	static KeyCode map[XF86AUDIO_MAX];
+	KeyCode code;
+	
+	if ((code = grab_key("XF86AudioNext")) != 0)
+		map[XF86AUDIO_NEXT] = code;
+	if ((code = grab_key("XF86AudioPrev")) != 0)
+		map[XF86AUDIO_PREV] = code;
+	if ((code = grab_key("XF86AudioPlay")) != 0)
+		map[XF86AUDIO_PLAY] = code;
+	if ((code = grab_key("XF86AudioStop")) != 0)
+		map[XF86AUDIO_STOP] = code;
+	if ((code = grab_key("XF86AudioPause")) != 0)
+		map[XF86AUDIO_PAUSE] = code;
+
+	gdk_window_add_filter(GDK_ROOT_PARENT(),
+			xf86audio_filter,
+			map);
+}
 
 void set_timer_mode(TimerMode mode)
 {
@@ -3449,6 +3536,7 @@
 	mainwin_accel = gtk_accel_group_new();
 
 	mainwin_create();
+	grab_xf86audio_keys();
 
 	filename = g_strconcat(g_get_home_dir(), "/.xmms/gtkrc", NULL);
 	gtk_rc_init();

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux kesha 2.4.20 #1 Tue Jan 28 01:30:58 PST 2003 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages xmms depends on:
ii  libc6                         2.3.1-13   GNU C Library: Shared libraries an
ii  libglib1.2                    1.2.10-6   The GLib library of C routines
ii  libgtk1.2                     1.2.10-14  The GIMP Toolkit set of widgets fo
ii  xlibs                         4.2.1-5    X Window System client libraries

-- no debconf information


---------------------------------------
Received: (at 181871-done) by bugs.debian.org; 3 Mar 2004 23:04:56 +0000
>From marcin@owsiany.pl Wed Mar 03 15:04:56 2004
Return-path: <marcin@owsiany.pl>
Received: from starnet.skynet.com.pl (skynet.skynet.com.pl) [213.25.173.230] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1AyfQ8-0007vd-00; Wed, 03 Mar 2004 15:04:56 -0800
Received: from plus.ds14.agh.edu.pl
	([149.156.124.14] helo=melina.ds14.agh.edu.pl ident=melina)
	by skynet.skynet.com.pl with esmtp (Exim 3.35 #1 (Debian))
	id 1AyfPx-0005G6-00
	for <181871-done@bugs.debian.org>; Thu, 04 Mar 2004 00:04:46 +0100
Received: from porridge by melina.ds14.agh.edu.pl with local (Exim 4.30)
	id 1AyfPx-0006xj-B6
	for 181871-done@bugs.debian.org; Thu, 04 Mar 2004 00:04:45 +0100
Date: Thu, 4 Mar 2004 00:04:45 +0100
From: Marcin Owsiany <porridge@debian.org>
To: 181871-done@bugs.debian.org
Subject: Uploaded
Message-ID: <20040303230445.GA26747@melina.ds14.agh.edu.pl>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.5.1+cvs20040105i
Sender: Marcin Owsiany <marcin@owsiany.pl>
X-Scanner: exiscan *1AyfPx-0005G6-00*wOuhu4l5KEc*
Delivered-To: 181871-done@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_01 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=0.0 required=4.0 tests=none autolearn=no 
	version=2.60-bugs.debian.org_2004_03_01
X-Spam-Level: 


-- 
Marcin Owsiany <porridge@debian.org>             http://marcin.owsiany.pl/
GnuPG: 1024D/60F41216  FE67 DA2D 0ACA FC5E 3F75  D6F6 3A0D 8AA0 60F4 1216



Reply to: