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

Side by Side Diff: ui/base/x/root_window_property_watcher_x.cc

Issue 8595003: Have panels respond to changes in work area on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile linux_view and chromeos. 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
« no previous file with comments | « ui/base/x/root_window_property_watcher_x.h ('k') | ui/base/x/work_area_watcher_x.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/base/x/root_window_property_watcher_x.h"
6
7 #include <gdk/gdk.h>
8 #include <gdk/gdkx.h>
9
10 #include "ui/base/x/active_window_watcher_x.h"
11 #include "ui/base/x/work_area_watcher_x.h"
12
13 namespace ui {
14
15 namespace internal {
16
17 // static
18 RootWindowPropertyWatcherX* RootWindowPropertyWatcherX::GetInstance() {
19 return Singleton<RootWindowPropertyWatcherX>::get();
20 }
21
22 RootWindowPropertyWatcherX::RootWindowPropertyWatcherX() {
23 GdkWindow* root = gdk_get_default_root_window();
24
25 // Set up X Event filter to listen for PropertyChange X events.
26 // Don't use XSelectInput directly here, as gdk internally seems to cache the
27 // mask and reapply XSelectInput after this, resetting any mask we set here.
28 gdk_window_set_events(root,
29 static_cast<GdkEventMask>(gdk_window_get_events(root) |
30 GDK_PROPERTY_CHANGE_MASK));
31 gdk_window_add_filter(root,
32 &RootWindowPropertyWatcherX::OnWindowXEventThunk,
33 this);
34 }
35
36 RootWindowPropertyWatcherX::~RootWindowPropertyWatcherX() {
37 gdk_window_remove_filter(NULL,
38 &RootWindowPropertyWatcherX::OnWindowXEventThunk,
39 this);
40 }
41
42 GdkFilterReturn RootWindowPropertyWatcherX::OnWindowXEvent(
43 GdkXEvent* xevent, GdkEvent* event) {
44 XEvent* xev = static_cast<XEvent*>(xevent);
45
46 if (xev->xany.type == PropertyNotify) {
47 if (xev->xproperty.atom == ActiveWindowWatcherX::GetPropertyAtom())
48 ActiveWindowWatcherX::Notify();
49 else if (xev->xproperty.atom == WorkAreaWatcherX::GetPropertyAtom())
50 WorkAreaWatcherX::Notify();
51 }
52
53 return GDK_FILTER_CONTINUE;
54 }
55
56 } // namespace internal
57
58 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/x/root_window_property_watcher_x.h ('k') | ui/base/x/work_area_watcher_x.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698