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 // This file defines utility functions for X11 (Linux only). This code has been | 5 // This file defines utility functions for X11 (Linux only). This code has been |
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support | 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support |
7 // remains woefully incomplete. | 7 // remains woefully incomplete. |
8 | 8 |
9 #include "ui/base/x/x11_util.h" | 9 #include "ui/base/x/x11_util.h" |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "base/stringprintf.h" | 24 #include "base/stringprintf.h" |
25 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
26 #include "ui/base/x/x11_util_internal.h" | 26 #include "ui/base/x/x11_util_internal.h" |
27 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
28 #include "ui/gfx/size.h" | 28 #include "ui/gfx/size.h" |
29 | 29 |
30 #if defined(TOOLKIT_USES_GTK) | 30 #if defined(TOOLKIT_USES_GTK) |
31 #include <gdk/gdk.h> | 31 #include <gdk/gdk.h> |
32 #include <gdk/gdkx.h> | 32 #include <gdk/gdkx.h> |
33 #include <gtk/gtk.h> | 33 #include <gtk/gtk.h> |
| 34 #include "ui/base/gtk/gtk_compat.h" |
34 #else | 35 #else |
35 // TODO(sad): Use the new way of handling X errors when | 36 // TODO(sad): Use the new way of handling X errors when |
36 // http://codereview.chromium.org/7889040/ lands. | 37 // http://codereview.chromium.org/7889040/ lands. |
37 #define gdk_error_trap_push() | 38 #define gdk_error_trap_push() |
38 #define gdk_error_trap_pop() false | 39 #define gdk_error_trap_pop() false |
39 #define gdk_flush() | 40 #define gdk_flush() |
40 #endif | 41 #endif |
41 | 42 |
42 namespace ui { | 43 namespace ui { |
43 | 44 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 XID GetX11WindowFromGtkWidget(GtkWidget* widget) { | 235 XID GetX11WindowFromGtkWidget(GtkWidget* widget) { |
235 return GDK_WINDOW_XID(widget->window); | 236 return GDK_WINDOW_XID(widget->window); |
236 } | 237 } |
237 | 238 |
238 XID GetX11WindowFromGdkWindow(GdkWindow* window) { | 239 XID GetX11WindowFromGdkWindow(GdkWindow* window) { |
239 return GDK_WINDOW_XID(window); | 240 return GDK_WINDOW_XID(window); |
240 } | 241 } |
241 | 242 |
242 GtkWindow* GetGtkWindowFromX11Window(XID xid) { | 243 GtkWindow* GetGtkWindowFromX11Window(XID xid) { |
243 GdkWindow* gdk_window = | 244 GdkWindow* gdk_window = |
244 gdk_window_lookup_for_display(gdk_display_get_default(), xid); | 245 gdk_x11_window_lookup_for_display(gdk_display_get_default(), xid); |
245 if (!gdk_window) | 246 if (!gdk_window) |
246 return NULL; | 247 return NULL; |
247 GtkWindow* gtk_window = NULL; | 248 GtkWindow* gtk_window = NULL; |
248 gdk_window_get_user_data(gdk_window, | 249 gdk_window_get_user_data(gdk_window, |
249 reinterpret_cast<gpointer*>(>k_window)); | 250 reinterpret_cast<gpointer*>(>k_window)); |
250 if (!gtk_window) | 251 if (!gtk_window) |
251 return NULL; | 252 return NULL; |
252 return gtk_window; | 253 return gtk_window; |
253 } | 254 } |
254 | 255 |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 933 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
933 << "minor_code " << static_cast<int>(error_event.minor_code) | 934 << "minor_code " << static_cast<int>(error_event.minor_code) |
934 << " (" << request_str << ")"; | 935 << " (" << request_str << ")"; |
935 } | 936 } |
936 | 937 |
937 // ---------------------------------------------------------------------------- | 938 // ---------------------------------------------------------------------------- |
938 // End of x11_util_internal.h | 939 // End of x11_util_internal.h |
939 | 940 |
940 | 941 |
941 } // namespace ui | 942 } // namespace ui |
OLD | NEW |