OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 // This file declares utility functions for X11 (Linux only). | 8 // This file declares utility functions for X11 (Linux only). |
9 // | 9 // |
10 // These functions do not require the Xlib headers to be included (which is why | 10 // These functions do not require the Xlib headers to be included (which is why |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "ui/events/keycodes/keyboard_codes.h" | 22 #include "ui/events/keycodes/keyboard_codes.h" |
23 #include "ui/gfx/point.h" | 23 #include "ui/gfx/point.h" |
24 #include "ui/gfx/x/x11_types.h" | 24 #include "ui/gfx/x/x11_types.h" |
25 | 25 |
26 typedef unsigned long Atom; | 26 typedef unsigned long Atom; |
27 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. | 27 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. |
28 typedef unsigned long Cursor; | 28 typedef unsigned long Cursor; |
29 typedef struct _XcursorImage XcursorImage; | 29 typedef struct _XcursorImage XcursorImage; |
30 typedef union _XEvent XEvent; | 30 typedef union _XEvent XEvent; |
31 | 31 |
32 #if defined(TOOLKIT_GTK) | |
33 typedef struct _GdkDrawable GdkWindow; | |
34 typedef struct _GtkWidget GtkWidget; | |
35 typedef struct _GtkWindow GtkWindow; | |
36 #endif | |
37 | |
38 namespace gfx { | 32 namespace gfx { |
39 class Canvas; | 33 class Canvas; |
40 class Point; | 34 class Point; |
41 class Rect; | 35 class Rect; |
42 } | 36 } |
43 class SkBitmap; | 37 class SkBitmap; |
44 | 38 |
45 namespace ui { | 39 namespace ui { |
46 | 40 |
47 // These functions use the default display and this /must/ be called from | 41 // These functions use the default display and this /must/ be called from |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 UI_BASE_EXPORT ::Cursor CreateInvisibleCursor(); | 106 UI_BASE_EXPORT ::Cursor CreateInvisibleCursor(); |
113 | 107 |
114 // These functions do not cache their results -------------------------- | 108 // These functions do not cache their results -------------------------- |
115 | 109 |
116 // Get the X window id for the default root window | 110 // Get the X window id for the default root window |
117 UI_BASE_EXPORT XID GetX11RootWindow(); | 111 UI_BASE_EXPORT XID GetX11RootWindow(); |
118 | 112 |
119 // Returns the user's current desktop. | 113 // Returns the user's current desktop. |
120 bool GetCurrentDesktop(int* desktop); | 114 bool GetCurrentDesktop(int* desktop); |
121 | 115 |
122 #if defined(TOOLKIT_GTK) | |
123 // Get the X window id for the given GTK widget. | |
124 UI_BASE_EXPORT XID GetX11WindowFromGtkWidget(GtkWidget* widget); | |
125 XID GetX11WindowFromGdkWindow(GdkWindow* window); | |
126 | |
127 // Get the GtkWindow* wrapping a given XID, if any. | |
128 // Returns NULL if there isn't already a GtkWindow* wrapping this XID; | |
129 // see gdk_window_foreign_new() etc. to wrap arbitrary XIDs. | |
130 UI_BASE_EXPORT GtkWindow* GetGtkWindowFromX11Window(XID xid); | |
131 | |
132 // Get a Visual from the given widget. Since we don't include the Xlib | |
133 // headers, this is returned as a void*. | |
134 UI_BASE_EXPORT void* GetVisualFromGtkWidget(GtkWidget* widget); | |
135 #endif // defined(TOOLKIT_GTK) | |
136 | |
137 enum HideTitlebarWhenMaximized { | 116 enum HideTitlebarWhenMaximized { |
138 SHOW_TITLEBAR_WHEN_MAXIMIZED = 0, | 117 SHOW_TITLEBAR_WHEN_MAXIMIZED = 0, |
139 HIDE_TITLEBAR_WHEN_MAXIMIZED = 1, | 118 HIDE_TITLEBAR_WHEN_MAXIMIZED = 1, |
140 }; | 119 }; |
141 // Sets _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED on |window|. | 120 // Sets _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED on |window|. |
142 UI_BASE_EXPORT void SetHideTitlebarWhenMaximizedProperty( | 121 UI_BASE_EXPORT void SetHideTitlebarWhenMaximizedProperty( |
143 XID window, | 122 XID window, |
144 HideTitlebarWhenMaximized property); | 123 HideTitlebarWhenMaximized property); |
145 | 124 |
146 // Clears all regions of X11's default root window by filling black pixels. | 125 // Clears all regions of X11's default root window by filling black pixels. |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 private: | 372 private: |
394 ::Cursor cursor_; | 373 ::Cursor cursor_; |
395 XDisplay* display_; | 374 XDisplay* display_; |
396 | 375 |
397 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); | 376 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); |
398 }; | 377 }; |
399 | 378 |
400 } // namespace ui | 379 } // namespace ui |
401 | 380 |
402 #endif // UI_BASE_X_X11_UTIL_H_ | 381 #endif // UI_BASE_X_X11_UTIL_H_ |
OLD | NEW |