| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 XID GetX11WindowFromGtkWidget(GtkWidget* widget) { | 244 XID GetX11WindowFromGtkWidget(GtkWidget* widget) { |
| 244 return GDK_WINDOW_XID(widget->window); | 245 return GDK_WINDOW_XID(widget->window); |
| 245 } | 246 } |
| 246 | 247 |
| 247 XID GetX11WindowFromGdkWindow(GdkWindow* window) { | 248 XID GetX11WindowFromGdkWindow(GdkWindow* window) { |
| 248 return GDK_WINDOW_XID(window); | 249 return GDK_WINDOW_XID(window); |
| 249 } | 250 } |
| 250 | 251 |
| 251 GtkWindow* GetGtkWindowFromX11Window(XID xid) { | 252 GtkWindow* GetGtkWindowFromX11Window(XID xid) { |
| 252 GdkWindow* gdk_window = | 253 GdkWindow* gdk_window = |
| 253 gdk_window_lookup_for_display(gdk_display_get_default(), xid); | 254 gdk_x11_window_lookup_for_display(gdk_display_get_default(), xid); |
| 254 if (!gdk_window) | 255 if (!gdk_window) |
| 255 return NULL; | 256 return NULL; |
| 256 GtkWindow* gtk_window = NULL; | 257 GtkWindow* gtk_window = NULL; |
| 257 gdk_window_get_user_data(gdk_window, | 258 gdk_window_get_user_data(gdk_window, |
| 258 reinterpret_cast<gpointer*>(>k_window)); | 259 reinterpret_cast<gpointer*>(>k_window)); |
| 259 if (!gtk_window) | 260 if (!gtk_window) |
| 260 return NULL; | 261 return NULL; |
| 261 return gtk_window; | 262 return gtk_window; |
| 262 } | 263 } |
| 263 | 264 |
| (...skipping 668 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 |