OLD | NEW |
1 // Copyright (c) 2010 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 APP_X11_UTIL_H_ | 5 #ifndef UI_BASE_X_X11_UTIL_H_ |
6 #define APP_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 struct _GdkDrawable GdkWindow; | 20 typedef struct _GdkDrawable GdkWindow; |
21 typedef struct _GtkWidget GtkWidget; | 21 typedef struct _GtkWidget GtkWidget; |
22 typedef struct _GtkWindow GtkWindow; | 22 typedef struct _GtkWindow GtkWindow; |
23 typedef unsigned long XID; | 23 typedef unsigned long XID; |
24 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. | 24 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. |
25 typedef struct _XDisplay Display; | 25 typedef struct _XDisplay Display; |
26 | 26 |
27 namespace gfx { | 27 namespace gfx { |
28 class Rect; | 28 class Rect; |
29 } | 29 } |
30 | 30 |
31 namespace x11_util { | 31 namespace ui { |
32 | 32 |
33 // These functions use the GDK default display and this /must/ be called from | 33 // These functions use the GDK default display and this /must/ be called from |
34 // the UI thread. Thus, they don't support multiple displays. | 34 // the UI thread. Thus, they don't support multiple displays. |
35 | 35 |
36 // These functions cache their results --------------------------------- | 36 // These functions cache their results --------------------------------- |
37 | 37 |
38 // Check if there's an open connection to an X server. | 38 // Check if there's an open connection to an X server. |
39 bool XDisplayExists(); | 39 bool XDisplayExists(); |
40 // Return an X11 connection for the current, primary display. | 40 // Return an X11 connection for the current, primary display. |
41 Display* GetXDisplay(); | 41 Display* GetXDisplay(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 std::vector<unsigned char>* png_representation); | 171 std::vector<unsigned char>* png_representation); |
172 | 172 |
173 // Change desktop for |window| to the desktop of |destination| window. | 173 // Change desktop for |window| to the desktop of |destination| window. |
174 bool ChangeWindowDesktop(XID window, XID destination); | 174 bool ChangeWindowDesktop(XID window, XID destination); |
175 | 175 |
176 // Enable the default X error handlers. These will log the error and abort | 176 // 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 | 177 // the process if called. Use SetX11ErrorHandlers() from x11_util_internal.h |
178 // to set your own error handlers. | 178 // to set your own error handlers. |
179 void SetDefaultX11ErrorHandlers(); | 179 void SetDefaultX11ErrorHandlers(); |
180 | 180 |
181 } // namespace x11_util | 181 } // namespace ui |
182 | 182 |
183 #endif // APP_X11_UTIL_H_ | 183 #endif // UI_BASE_X_X11_UTIL_H_ |
OLD | NEW |