| OLD | NEW |
| 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 unsigned long Atom; |
| 21 typedef struct _GdkDrawable GdkWindow; | 21 typedef struct _GdkDrawable GdkWindow; |
| 22 typedef struct _GtkWidget GtkWidget; | 22 typedef struct _GtkWidget GtkWidget; |
| 23 typedef struct _GtkWindow GtkWindow; | |
| 24 typedef unsigned long XID; | 23 typedef unsigned long XID; |
| 25 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. | 24 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. |
| 26 typedef struct _XDisplay Display; | 25 typedef struct _XDisplay Display; |
| 27 | 26 |
| 28 namespace gfx { | 27 namespace gfx { |
| 29 class Rect; | 28 class Rect; |
| 30 } | 29 } |
| 31 | 30 |
| 32 namespace ui { | 31 namespace ui { |
| 33 | 32 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 163 |
| 165 // Find the immediate parent of an X window. | 164 // Find the immediate parent of an X window. |
| 166 // | 165 // |
| 167 // parent_window: (output) the parent window of |window|, or 0. | 166 // parent_window: (output) the parent window of |window|, or 0. |
| 168 // parent_is_root: (output) true iff the parent of |window| is the root window. | 167 // parent_is_root: (output) true iff the parent of |window| is the root window. |
| 169 bool GetWindowParent(XID* parent_window, bool* parent_is_root, XID window); | 168 bool GetWindowParent(XID* parent_window, bool* parent_is_root, XID window); |
| 170 | 169 |
| 171 // Get the window manager name. | 170 // Get the window manager name. |
| 172 bool GetWindowManagerName(std::string* name); | 171 bool GetWindowManagerName(std::string* name); |
| 173 | 172 |
| 174 // Grabs a snapshot of the designated window and stores a PNG representation | |
| 175 // into a byte vector. | |
| 176 void GrabWindowSnapshot(GtkWindow* gdk_window, | |
| 177 std::vector<unsigned char>* png_representation); | |
| 178 | |
| 179 // Change desktop for |window| to the desktop of |destination| window. | 173 // Change desktop for |window| to the desktop of |destination| window. |
| 180 bool ChangeWindowDesktop(XID window, XID destination); | 174 bool ChangeWindowDesktop(XID window, XID destination); |
| 181 | 175 |
| 182 // 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 |
| 183 // the process if called. Use SetX11ErrorHandlers() from x11_util_internal.h | 177 // the process if called. Use SetX11ErrorHandlers() from x11_util_internal.h |
| 184 // to set your own error handlers. | 178 // to set your own error handlers. |
| 185 void SetDefaultX11ErrorHandlers(); | 179 void SetDefaultX11ErrorHandlers(); |
| 186 | 180 |
| 187 // Return true if a given window is in full-screen mode. | 181 // Return true if a given window is in full-screen mode. |
| 188 bool IsX11WindowFullScreen(XID window); | 182 bool IsX11WindowFullScreen(XID window); |
| 189 | 183 |
| 190 } // namespace ui | 184 } // namespace ui |
| 191 | 185 |
| 192 #endif // UI_BASE_X_X11_UTIL_H_ | 186 #endif // UI_BASE_X_X11_UTIL_H_ |
| OLD | NEW |