Index: chrome/browser/chromeos/system_key_event_listener.h |
diff --git a/chrome/browser/chromeos/system_key_event_listener.h b/chrome/browser/chromeos/system_key_event_listener.h |
index b731b94064b7def40567e175fa26875d09cb9b92..fac16657df3e32577d132f3a0b519858c3543acd 100644 |
--- a/chrome/browser/chromeos/system_key_event_listener.h |
+++ b/chrome/browser/chromeos/system_key_event_listener.h |
@@ -6,25 +6,22 @@ |
#define CHROME_BROWSER_CHROMEOS_SYSTEM_KEY_EVENT_LISTENER_H_ |
#pragma once |
+#include <gdk/gdk.h> |
+ |
#include "base/singleton.h" |
-#include "chrome/browser/chromeos/wm_message_listener.h" |
namespace chromeos { |
class AudioHandler; |
-// SystemKeyEventListener listens for volume related key presses from the |
-// window manager, then tells the AudioHandler to adjust volume accordingly. |
-// Start by just calling instance() to get it going. |
+// SystemKeyEventListener listens for volume related key presses from GDK, then |
+// tells the AudioHandler to adjust volume accordingly. Start by just calling |
+// instance() to get it going. |
-class SystemKeyEventListener : public WmMessageListener::Observer { |
+class SystemKeyEventListener { |
public: |
static SystemKeyEventListener* instance(); |
- // WmMessageListener::Observer: |
- virtual void ProcessWmMessage(const WmIpc::Message& message, |
- GdkWindow* window); |
- |
private: |
// Defines the delete on exit Singleton traits we like. Best to have this |
// and const/dest private as recommended for Singletons. |
@@ -33,6 +30,28 @@ class SystemKeyEventListener : public WmMessageListener::Observer { |
SystemKeyEventListener(); |
virtual ~SystemKeyEventListener(); |
+ // This event filter intercepts events before they reach GDK, allowing us to |
+ // check for system level keyboard events regardless of which window has |
+ // focus. |
+ static GdkFilterReturn GdkEventFilter(GdkXEvent* gxevent, |
+ GdkEvent* gevent, |
+ gpointer data); |
+ |
+ // Tell X we are interested in the specified key/mask combination. |
+ // Capslock and Numlock are always ignored. |
+ void GrabKey(int32 key, uint32 mask); |
+ |
+ void OnVolumeMute(); |
+ void OnVolumeDown(); |
+ void OnVolumeUp(); |
+ |
+ int32 key_volume_mute_; |
+ int32 key_volume_down_; |
+ int32 key_volume_up_; |
+ int32 key_f8_; |
+ int32 key_f9_; |
+ int32 key_f10_; |
+ |
// AudioHandler is a Singleton class we are just caching a pointer to here, |
// and we do not own the pointer. |
AudioHandler* const audio_handler_; |