Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(947)

Unified Diff: chrome/browser/chromeos/system_key_event_listener.h

Issue 4098003: Handle volume keys within Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Backed out caching Singleton instance Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;
« no previous file with comments | « chrome/browser/chromeos/login/screen_locker.cc ('k') | chrome/browser/chromeos/system_key_event_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698