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

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

Issue 7981030: aura: Have aura and aura_demo build and run without gtk on linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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
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 #include "ui/base/ui_export.h" 19 #include "ui/base/ui_export.h"
20 20
21 typedef unsigned long Atom; 21 typedef unsigned long Atom;
22 typedef struct _GdkDrawable GdkWindow;
23 typedef struct _GtkWidget GtkWidget;
24 typedef struct _GtkWindow GtkWindow;
25 typedef unsigned long XID; 22 typedef unsigned long XID;
26 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. 23 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers.
27 typedef struct _XDisplay Display; 24 typedef struct _XDisplay Display;
28 25
26 #if defined(TOOLKIT_USES_GTK)
27 typedef struct _GdkDrawable GdkWindow;
28 typedef struct _GtkWidget GtkWidget;
29 typedef struct _GtkWindow GtkWindow;
30 #endif
31
29 namespace gfx { 32 namespace gfx {
30 class Rect; 33 class Rect;
31 } 34 }
32 35
33 namespace ui { 36 namespace ui {
34 37
35 // These functions use the GDK default display and this /must/ be called from 38 // These functions use the GDK default display and this /must/ be called from
36 // the UI thread. Thus, they don't support multiple displays. 39 // the UI thread. Thus, they don't support multiple displays.
37 40
38 // These functions cache their results --------------------------------- 41 // These functions cache their results ---------------------------------
(...skipping 26 matching lines...) Expand all
65 int GetDefaultScreen(Display* display); 68 int GetDefaultScreen(Display* display);
66 69
67 // These functions do not cache their results -------------------------- 70 // These functions do not cache their results --------------------------
68 71
69 // Get the X window id for the default root window 72 // Get the X window id for the default root window
70 UI_EXPORT XID GetX11RootWindow(); 73 UI_EXPORT XID GetX11RootWindow();
71 74
72 // Returns the user's current desktop. 75 // Returns the user's current desktop.
73 bool GetCurrentDesktop(int* desktop); 76 bool GetCurrentDesktop(int* desktop);
74 77
78 #if defined(TOOLKIT_USES_GTK)
75 // Get the X window id for the given GTK widget. 79 // Get the X window id for the given GTK widget.
76 UI_EXPORT XID GetX11WindowFromGtkWidget(GtkWidget* widget); 80 UI_EXPORT XID GetX11WindowFromGtkWidget(GtkWidget* widget);
77 XID GetX11WindowFromGdkWindow(GdkWindow* window); 81 XID GetX11WindowFromGdkWindow(GdkWindow* window);
78 82
79 // Get the GtkWindow* wrapping a given XID, if any. 83 // Get the GtkWindow* wrapping a given XID, if any.
80 // Returns NULL if there isn't already a GtkWindow* wrapping this XID; 84 // Returns NULL if there isn't already a GtkWindow* wrapping this XID;
81 // see gdk_window_foreign_new() etc. to wrap arbitrary XIDs. 85 // see gdk_window_foreign_new() etc. to wrap arbitrary XIDs.
82 UI_EXPORT GtkWindow* GetGtkWindowFromX11Window(XID xid); 86 UI_EXPORT GtkWindow* GetGtkWindowFromX11Window(XID xid);
83 87
84 // Get a Visual from the given widget. Since we don't include the Xlib 88 // Get a Visual from the given widget. Since we don't include the Xlib
85 // headers, this is returned as a void*. 89 // headers, this is returned as a void*.
86 UI_EXPORT void* GetVisualFromGtkWidget(GtkWidget* widget); 90 UI_EXPORT void* GetVisualFromGtkWidget(GtkWidget* widget);
91 #endif // defined(TOOLKIT_USES_GTK)
87 92
88 // Return the number of bits-per-pixel for a pixmap of the given depth 93 // Return the number of bits-per-pixel for a pixmap of the given depth
89 UI_EXPORT int BitsPerPixelForPixmapDepth(Display* display, int depth); 94 UI_EXPORT int BitsPerPixelForPixmapDepth(Display* display, int depth);
90 95
91 // Returns true if |window| is visible. 96 // Returns true if |window| is visible.
92 UI_EXPORT bool IsWindowVisible(XID window); 97 UI_EXPORT bool IsWindowVisible(XID window);
93 98
94 // Returns the bounds of |window|. 99 // Returns the bounds of |window|.
95 UI_EXPORT bool GetWindowRect(XID window, gfx::Rect* rect); 100 UI_EXPORT bool GetWindowRect(XID window, gfx::Rect* rect);
96 101
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // the process if called. Use SetX11ErrorHandlers() from x11_util_internal.h 183 // the process if called. Use SetX11ErrorHandlers() from x11_util_internal.h
179 // to set your own error handlers. 184 // to set your own error handlers.
180 UI_EXPORT void SetDefaultX11ErrorHandlers(); 185 UI_EXPORT void SetDefaultX11ErrorHandlers();
181 186
182 // Return true if a given window is in full-screen mode. 187 // Return true if a given window is in full-screen mode.
183 UI_EXPORT bool IsX11WindowFullScreen(XID window); 188 UI_EXPORT bool IsX11WindowFullScreen(XID window);
184 189
185 } // namespace ui 190 } // namespace ui
186 191
187 #endif // UI_BASE_X_X11_UTIL_H_ 192 #endif // UI_BASE_X_X11_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698