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

Side by Side Diff: app/active_window_watcher_x.cc

Issue 3452030: FBTF: Moves code to the headers. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « app/active_window_watcher_x.h ('k') | app/resource_bundle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include <X11/Xlib.h> 5 #include <X11/Xlib.h>
6 #include <gdk/gdk.h> 6 #include <gdk/gdk.h>
7 #include <gdk/gdkx.h> 7 #include <gdk/gdkx.h>
8 8
9 #include "app/active_window_watcher_x.h" 9 #include "app/active_window_watcher_x.h"
10 10
11 static Atom kNetActiveWindowAtom = None; 11 static Atom kNetActiveWindowAtom = None;
12 12
13 // static 13 // static
14 void ActiveWindowWatcherX::AddObserver(Observer* observer) { 14 void ActiveWindowWatcherX::AddObserver(Observer* observer) {
15 Singleton<ActiveWindowWatcherX>::get()->observers_.AddObserver(observer); 15 Singleton<ActiveWindowWatcherX>::get()->observers_.AddObserver(observer);
16 } 16 }
17 17
18 // static 18 // static
19 void ActiveWindowWatcherX::RemoveObserver(Observer* observer) { 19 void ActiveWindowWatcherX::RemoveObserver(Observer* observer) {
20 Singleton<ActiveWindowWatcherX>::get()->observers_.RemoveObserver(observer); 20 Singleton<ActiveWindowWatcherX>::get()->observers_.RemoveObserver(observer);
21 } 21 }
22 22
23 ActiveWindowWatcherX::ActiveWindowWatcherX() { 23 ActiveWindowWatcherX::ActiveWindowWatcherX() {
24 Init(); 24 Init();
25 } 25 }
26 26
27 ActiveWindowWatcherX::~ActiveWindowWatcherX() {
28 }
29
27 void ActiveWindowWatcherX::Init() { 30 void ActiveWindowWatcherX::Init() {
28 GdkAtom kNetActiveWindow = gdk_atom_intern("_NET_ACTIVE_WINDOW", FALSE); 31 GdkAtom kNetActiveWindow = gdk_atom_intern("_NET_ACTIVE_WINDOW", FALSE);
29 kNetActiveWindowAtom = gdk_x11_atom_to_xatom_for_display( 32 kNetActiveWindowAtom = gdk_x11_atom_to_xatom_for_display(
30 gdk_screen_get_display(gdk_screen_get_default()), kNetActiveWindow); 33 gdk_screen_get_display(gdk_screen_get_default()), kNetActiveWindow);
31 34
32 GdkWindow* root = gdk_get_default_root_window(); 35 GdkWindow* root = gdk_get_default_root_window();
33 36
34 // Set up X Event filter to listen for PropertyChange X events. These events 37 // Set up X Event filter to listen for PropertyChange X events. These events
35 // tell us when the active window changes. 38 // tell us when the active window changes.
36 // Don't use XSelectInput directly here, as gdk internally seems to cache the 39 // Don't use XSelectInput directly here, as gdk internally seems to cache the
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 window_watcher); 88 window_watcher);
86 XEvent* xev = static_cast<XEvent*>(xevent); 89 XEvent* xev = static_cast<XEvent*>(xevent);
87 90
88 if (xev->xany.type == PropertyNotify && 91 if (xev->xany.type == PropertyNotify &&
89 xev->xproperty.atom == kNetActiveWindowAtom) { 92 xev->xproperty.atom == kNetActiveWindowAtom) {
90 watcher->NotifyActiveWindowChanged(); 93 watcher->NotifyActiveWindowChanged();
91 } 94 }
92 95
93 return GDK_FILTER_CONTINUE; 96 return GDK_FILTER_CONTINUE;
94 } 97 }
OLDNEW
« no previous file with comments | « app/active_window_watcher_x.h ('k') | app/resource_bundle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698