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

Side by Side Diff: ui/base/x/active_window_watcher_x.h

Issue 8595003: Have panels respond to changes in work area on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review feedback. Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_BASE_X_ACTIVE_WINDOW_WATCHER_X_H_ 5 #ifndef UI_BASE_X_ACTIVE_WINDOW_WATCHER_X_H_
6 #define UI_BASE_X_ACTIVE_WINDOW_WATCHER_X_H_ 6 #define UI_BASE_X_ACTIVE_WINDOW_WATCHER_X_H_
7 #pragma once 7 #pragma once
8 8
9 #include <gdk/gdk.h> 9 #include <gdk/gdk.h>
10 10
11 #include "base/basictypes.h"
dcheng 2011/11/18 23:02:29 This should remain for DISALLOW_COPY_AND_ASSIGN. T
prasadt 2011/11/21 23:36:49 Done.
12 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
13 #include "base/observer_list.h" 12 #include "base/observer_list.h"
14 #include "ui/base/gtk/gtk_signal.h"
15 #include "ui/base/ui_export.h" 13 #include "ui/base/ui_export.h"
14 #include "ui/base/x/x11_util.h"
16 15
17 namespace ui { 16 namespace ui {
18 17
19 // This is a helper class that is used to keep track of which window the X 18 // This is a helper class that is used to keep track of which window the X
20 // window manager thinks is active. Add an Observer to listener for changes to 19 // window manager thinks is active. Add an Observer to listen for changes to
21 // the active window. 20 // the active window.
22 class UI_EXPORT ActiveWindowWatcherX { 21 class UI_EXPORT ActiveWindowWatcherX {
23 public: 22 public:
24 class Observer { 23 class Observer {
25 public: 24 public:
26 // |active_window| will be NULL if the active window isn't one of Chrome's. 25 // |active_window| will be NULL if the active window isn't one of Chrome's.
27 virtual void ActiveWindowChanged(GdkWindow* active_window) = 0; 26 virtual void ActiveWindowChanged(GdkWindow* active_window) = 0;
28 27
29 protected: 28 protected:
30 virtual ~Observer() {} 29 virtual ~Observer();
31 }; 30 };
32 31
33 static ActiveWindowWatcherX* GetInstance(); 32 static ActiveWindowWatcherX* GetInstance();
34
35 static void AddObserver(Observer* observer); 33 static void AddObserver(Observer* observer);
36 static void RemoveObserver(Observer* observer); 34 static void RemoveObserver(Observer* observer);
37 35
36 // Gets the atom for the default display for the propert this class is
dcheng 2011/11/18 23:02:29 property
prasadt 2011/11/21 23:36:49 Done.
37 // watching for.
38 static Atom GetPropertyAtom();
39
40 // Notify observers that the active window has changed.
41 static void Notify();
42
38 // Checks if the WM supports the active window property. Note that the return 43 // Checks if the WM supports the active window property. Note that the return
39 // value can change, especially during system startup. 44 // value can change, especially during system startup.
40 static bool WMSupportsActivation(); 45 static bool WMSupportsActivation();
41 46
42 private: 47 private:
43 friend struct DefaultSingletonTraits<ActiveWindowWatcherX>; 48 friend struct DefaultSingletonTraits<ActiveWindowWatcherX>;
44 49
45 ActiveWindowWatcherX(); 50 ActiveWindowWatcherX();
46 ~ActiveWindowWatcherX(); 51 ~ActiveWindowWatcherX();
47
48 void Init();
49
50 // Sends a notification out through the NotificationService that the active
51 // window has changed.
52 void NotifyActiveWindowChanged(); 52 void NotifyActiveWindowChanged();
53 53
54 // Callback for PropertyChange XEvents.
55 CHROMEG_CALLBACK_1(ActiveWindowWatcherX, GdkFilterReturn,
56 OnWindowXEvent, GdkXEvent*, GdkEvent*);
57
58 ObserverList<Observer> observers_; 54 ObserverList<Observer> observers_;
59 55
60 DISALLOW_COPY_AND_ASSIGN(ActiveWindowWatcherX); 56 DISALLOW_COPY_AND_ASSIGN(ActiveWindowWatcherX);
61 }; 57 };
62 58
63 } // namespace ui 59 } // namespace ui
64 60
65 #endif // UI_BASE_X_ACTIVE_WINDOW_WATCHER_X_H_ 61 #endif // UI_BASE_X_ACTIVE_WINDOW_WATCHER_X_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_window_gtk.cc ('k') | ui/base/x/active_window_watcher_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698