Re: gnome cd on Laptops (w/ patch) v2



On Tue, 2004-04-20 at 14:45, Bastien Nocera wrote:

> Please use "diff -u" to generate the patch.

-Nigel
--- gnome-cd.c	2004-04-20 12:31:29.000000000 +0100
+++ ../Ognome-cd/gnome-cd.c	2004-04-19 11:11:48.000000000 +0100
@@ -4,8 +4,6 @@
  *
  * Copyright (C) 2001 Iain Holmes
  * Authors: Iain Holmes  <iain ximian com>
- *
- * Modified njh bandsman co uk to respond directly to MM keys
  */
 
 #ifdef HAVE_CONFIG_H
@@ -25,8 +23,6 @@
 #include "preferences.h"
 #include "access/factory.h"
 
-#include <X11/XF86keysym.h>
-
 #define DEFAULT_THEME "lcd"
 
 /* Debugging? */
@@ -36,10 +32,6 @@
 static gboolean cd_option_unique = FALSE;
 static gboolean cd_option_play = FALSE;
 
-static	GdkFilterReturn	filter_keys(GdkXEvent *xevent, GdkEvent *event, gpointer data);
-static	void	grab_key(int key_code, GdkWindow *root);
-static	void	start_listener(GnomeCD *gcd);
-
 void
 gcd_warning (const char *message,
 	     GError *error)
@@ -734,91 +726,6 @@
 	g_object_unref (G_OBJECT (factory));
 }
 
-/*
- * Start of code by Nigel Horne <njh bandsman co uk> to handle MM key input
- */
-static GdkFilterReturn
-filter_keys(GdkXEvent *xevent, GdkEvent *event, gpointer data)
-{
-	XEvent *xev;
-	XKeyEvent *key;
-	GnomeCD *gcd;
-	guint keycode;
-
-	xev = (XEvent *) xevent;
-	if (xev->type != KeyPress)
-		return GDK_FILTER_CONTINUE;
-
-	key = (XKeyEvent *) xevent;
-
-	keycode = key->keycode;
-
-	gcd = (GnomeCD *)data;
-
-	if(XKeysymToKeycode(GDK_DISPLAY(), XF86XK_AudioNext) == keycode) {
-		next_cb(NULL, gcd);
-		return GDK_FILTER_REMOVE;
-	}
-	if(XKeysymToKeycode(GDK_DISPLAY(), XF86XK_AudioPrev) == keycode) {
-		back_cb(NULL, gcd);
-		return GDK_FILTER_REMOVE;
-	}
-	if(XKeysymToKeycode(GDK_DISPLAY(), XF86XK_AudioStop) == keycode) {
-		play_cb(NULL, gcd);
-		return GDK_FILTER_REMOVE;
-	}
-	if(XKeysymToKeycode(GDK_DISPLAY(), XF86XK_AudioPlay) == keycode) {
-		stop_cb(NULL, gcd);
-		return GDK_FILTER_REMOVE;
-	}
-	return GDK_FILTER_CONTINUE;
-}
-
-static void
-grab_key(int key_code, GdkWindow *root)
-{
-	Window window = GDK_WINDOW_XID(root);
-	static const unsigned int modifiers[] = {
-		0, Mod2Mask, Mod5Mask, LockMask,
-		Mod2Mask|Mod5Mask, Mod2Mask|LockMask,
-		Mod5Mask|LockMask, Mod2Mask|Mod5Mask|LockMask
-	};
-	int i;
-
-	for(i = 0; i < sizeof(modifiers) / sizeof(unsigned int); i++)
-		XGrabKey (GDK_DISPLAY (), key_code, modifiers[i], window, True,
-			  GrabModeAsync, GrabModeAsync);
-
-	gdk_flush();
-}
-
-static void
-start_listener(GnomeCD *gcd)
-{
-	int i;
-	GdkDisplay *display;
-	gint keycodes[] = {0, 0, 0, 0};
-
-	keycodes[0] = XKeysymToKeycode(GDK_DISPLAY(), XF86XK_AudioPrev);
-	keycodes[1] = XKeysymToKeycode(GDK_DISPLAY(), XF86XK_AudioNext);
-	keycodes[2] = XKeysymToKeycode(GDK_DISPLAY(), XF86XK_AudioPlay);
-	keycodes[3] = XKeysymToKeycode(GDK_DISPLAY(), XF86XK_AudioStop);
-
-	display = gdk_display_get_default();
-	for (i = 0; i < gdk_display_get_n_screens(display); i++) {
-		GdkScreen *screen = gdk_display_get_screen(display, i);
-
-		if (screen != NULL) {
-			GdkWindow *root = gdk_screen_get_root_window(screen);
-			int j;
-
-			for(j = 0; j < 4; j++)
-				grab_key(keycodes[j], root);
-			gdk_window_add_filter(root, filter_keys, gcd);
-		}
-	}
-}
-
 int 
 main (int argc, char *argv[])
 {
@@ -833,7 +740,7 @@
 	};
 
 	GnomeCD *gcd;
-	/*CDSelection *cd_selection;*/
+	CDSelection *cd_selection;
 	GnomeClient *client;
 
 	free (malloc (8)); /* -lefence */
@@ -895,9 +802,7 @@
 		break;
 	}
 	}
-
-	start_listener(gcd);
-
+	
 	if (cd_option_unique &&
 	    !cd_selection_is_master (gcd->cd_selection))
 		return 0;


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