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

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

Issue 6359008: Do not show notifications when in fullscreen or screensaver mode.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | ui/base/x/x11_util.cc » ('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) 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_X11_UTIL_H_ 5 #ifndef UI_BASE_X_X11_UTIL_H_
6 #define UI_BASE_X_X11_UTIL_H_ 6 #define UI_BASE_X_X11_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 // This file declares utility functions for X11 (Linux only). 9 // This file declares utility functions for X11 (Linux only).
10 // 10 //
11 // These functions do not require the Xlib headers to be included (which is why 11 // These functions do not require the Xlib headers to be included (which is why
12 // we use a void* for Visual*). The Xlib headers are highly polluting so we try 12 // we use a void* for Visual*). The Xlib headers are highly polluting so we try
13 // hard to limit their spread into the rest of the code. 13 // hard to limit their spread into the rest of the code.
14 14
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "base/basictypes.h" 18 #include "base/basictypes.h"
19 19
20 typedef unsigned long Atom;
20 typedef struct _GdkDrawable GdkWindow; 21 typedef struct _GdkDrawable GdkWindow;
21 typedef struct _GtkWidget GtkWidget; 22 typedef struct _GtkWidget GtkWidget;
22 typedef struct _GtkWindow GtkWindow; 23 typedef struct _GtkWindow GtkWindow;
23 typedef unsigned long XID; 24 typedef unsigned long XID;
24 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. 25 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers.
25 typedef struct _XDisplay Display; 26 typedef struct _XDisplay Display;
26 27
27 namespace gfx { 28 namespace gfx {
28 class Rect; 29 class Rect;
29 } 30 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 XID GetX11WindowFromGdkWindow(GdkWindow* window); 70 XID GetX11WindowFromGdkWindow(GdkWindow* window);
70 // Get a Visual from the given widget. Since we don't include the Xlib 71 // Get a Visual from the given widget. Since we don't include the Xlib
71 // headers, this is returned as a void*. 72 // headers, this is returned as a void*.
72 void* GetVisualFromGtkWidget(GtkWidget* widget); 73 void* GetVisualFromGtkWidget(GtkWidget* widget);
73 // Return the number of bits-per-pixel for a pixmap of the given depth 74 // Return the number of bits-per-pixel for a pixmap of the given depth
74 int BitsPerPixelForPixmapDepth(Display* display, int depth); 75 int BitsPerPixelForPixmapDepth(Display* display, int depth);
75 // Returns true if |window| is visible. 76 // Returns true if |window| is visible.
76 bool IsWindowVisible(XID window); 77 bool IsWindowVisible(XID window);
77 // Returns the bounds of |window|. 78 // Returns the bounds of |window|.
78 bool GetWindowRect(XID window, gfx::Rect* rect); 79 bool GetWindowRect(XID window, gfx::Rect* rect);
79 // Get the value of an int, int array, or string property. On 80 // Return true if |window| has any property with |property_name|.
81 bool PropertyExists(XID window, const std::string& property_name);
82 // Get the value of an int, int array, atom array or string property. On
80 // success, true is returned and the value is stored in |value|. 83 // success, true is returned and the value is stored in |value|.
81 bool GetIntProperty(XID window, const std::string& property_name, int* value); 84 bool GetIntProperty(XID window, const std::string& property_name, int* value);
82 bool GetIntArrayProperty(XID window, const std::string& property_name, 85 bool GetIntArrayProperty(XID window, const std::string& property_name,
83 std::vector<int>* value); 86 std::vector<int>* value);
87 bool GetAtomArrayProperty(XID window, const std::string& property_name,
88 std::vector<Atom>* value);
84 bool GetStringProperty( 89 bool GetStringProperty(
85 XID window, const std::string& property_name, std::string* value); 90 XID window, const std::string& property_name, std::string* value);
86 91
87 // Get |window|'s parent window, or None if |window| is the root window. 92 // Get |window|'s parent window, or None if |window| is the root window.
88 XID GetParentWindow(XID window); 93 XID GetParentWindow(XID window);
89 94
90 // Walk up |window|'s hierarchy until we find a direct child of |root|. 95 // Walk up |window|'s hierarchy until we find a direct child of |root|.
91 XID GetHighestAncestorWindow(XID window, XID root); 96 XID GetHighestAncestorWindow(XID window, XID root);
92 97
93 static const int kAllDesktops = -1; 98 static const int kAllDesktops = -1;
(...skipping 10 matching lines...) Expand all
104 virtual bool ShouldStopIterating(XID xid) = 0; 109 virtual bool ShouldStopIterating(XID xid) = 0;
105 110
106 protected: 111 protected:
107 virtual ~EnumerateWindowsDelegate() {} 112 virtual ~EnumerateWindowsDelegate() {}
108 }; 113 };
109 114
110 // Enumerates all windows in the current display. Will recurse into child 115 // Enumerates all windows in the current display. Will recurse into child
111 // windows up to a depth of |max_depth|. 116 // windows up to a depth of |max_depth|.
112 bool EnumerateAllWindows(EnumerateWindowsDelegate* delegate, int max_depth); 117 bool EnumerateAllWindows(EnumerateWindowsDelegate* delegate, int max_depth);
113 118
114 // Returns a list of top-level windows in top-to-bottom stacking order. 119 // Returns all children windows of a given window in top-to-bottom stacking
115 bool GetXWindowStack(std::vector<XID>* windows); 120 // order.
121 bool GetXWindowStack(XID window, std::vector<XID>* windows);
116 122
117 // Restack a window in relation to one of its siblings. If |above| is true, 123 // Restack a window in relation to one of its siblings. If |above| is true,
118 // |window| will be stacked directly above |sibling|; otherwise it will stacked 124 // |window| will be stacked directly above |sibling|; otherwise it will stacked
119 // directly below it. Both windows must be immediate children of the same 125 // directly below it. Both windows must be immediate children of the same
120 // window. 126 // window.
121 void RestackWindow(XID window, XID sibling, bool above); 127 void RestackWindow(XID window, XID sibling, bool above);
122 128
123 // Return a handle to a X ShmSeg. |shared_memory_key| is a SysV 129 // Return a handle to a X ShmSeg. |shared_memory_key| is a SysV
124 // IPC key. The shared memory region must contain 32-bit pixels. 130 // IPC key. The shared memory region must contain 32-bit pixels.
125 XSharedMemoryId AttachSharedMemory(Display* display, int shared_memory_support); 131 XSharedMemoryId AttachSharedMemory(Display* display, int shared_memory_support);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 std::vector<unsigned char>* png_representation); 177 std::vector<unsigned char>* png_representation);
172 178
173 // Change desktop for |window| to the desktop of |destination| window. 179 // Change desktop for |window| to the desktop of |destination| window.
174 bool ChangeWindowDesktop(XID window, XID destination); 180 bool ChangeWindowDesktop(XID window, XID destination);
175 181
176 // Enable the default X error handlers. These will log the error and abort 182 // Enable the default X error handlers. These will log the error and abort
177 // the process if called. Use SetX11ErrorHandlers() from x11_util_internal.h 183 // the process if called. Use SetX11ErrorHandlers() from x11_util_internal.h
178 // to set your own error handlers. 184 // to set your own error handlers.
179 void SetDefaultX11ErrorHandlers(); 185 void SetDefaultX11ErrorHandlers();
180 186
187 // Return true if a given window is in full-screen mode.
188 bool IsX11WindowFullScreen(XID window);
189
181 } // namespace ui 190 } // namespace ui
182 191
183 #endif // UI_BASE_X_X11_UTIL_H_ 192 #endif // UI_BASE_X_X11_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | ui/base/x/x11_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698