| 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" |
| 35 #include "ui/base/gtk/gdk_x_compat.h" |
| 34 #else | 36 #else |
| 35 // TODO(sad): Use the new way of handling X errors when | 37 // TODO(sad): Use the new way of handling X errors when |
| 36 // http://codereview.chromium.org/7889040/ lands. | 38 // http://codereview.chromium.org/7889040/ lands. |
| 37 #define gdk_error_trap_push() | 39 #define gdk_error_trap_push() |
| 38 #define gdk_error_trap_pop() false | 40 #define gdk_error_trap_pop() false |
| 39 #define gdk_flush() | 41 #define gdk_flush() |
| 40 #endif | 42 #endif |
| 41 | 43 |
| 42 namespace ui { | 44 namespace ui { |
| 43 | 45 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 XID GetX11WindowFromGtkWidget(GtkWidget* widget) { | 236 XID GetX11WindowFromGtkWidget(GtkWidget* widget) { |
| 235 return GDK_WINDOW_XID(widget->window); | 237 return GDK_WINDOW_XID(widget->window); |
| 236 } | 238 } |
| 237 | 239 |
| 238 XID GetX11WindowFromGdkWindow(GdkWindow* window) { | 240 XID GetX11WindowFromGdkWindow(GdkWindow* window) { |
| 239 return GDK_WINDOW_XID(window); | 241 return GDK_WINDOW_XID(window); |
| 240 } | 242 } |
| 241 | 243 |
| 242 GtkWindow* GetGtkWindowFromX11Window(XID xid) { | 244 GtkWindow* GetGtkWindowFromX11Window(XID xid) { |
| 243 GdkWindow* gdk_window = | 245 GdkWindow* gdk_window = |
| 244 gdk_window_lookup_for_display(gdk_display_get_default(), xid); | 246 gdk_x11_window_lookup_for_display(gdk_display_get_default(), xid); |
| 245 if (!gdk_window) | 247 if (!gdk_window) |
| 246 return NULL; | 248 return NULL; |
| 247 GtkWindow* gtk_window = NULL; | 249 GtkWindow* gtk_window = NULL; |
| 248 gdk_window_get_user_data(gdk_window, | 250 gdk_window_get_user_data(gdk_window, |
| 249 reinterpret_cast<gpointer*>(>k_window)); | 251 reinterpret_cast<gpointer*>(>k_window)); |
| 250 if (!gtk_window) | 252 if (!gtk_window) |
| 251 return NULL; | 253 return NULL; |
| 252 return gtk_window; | 254 return gtk_window; |
| 253 } | 255 } |
| 254 | 256 |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 934 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
| 933 << "minor_code " << static_cast<int>(error_event.minor_code) | 935 << "minor_code " << static_cast<int>(error_event.minor_code) |
| 934 << " (" << request_str << ")"; | 936 << " (" << request_str << ")"; |
| 935 } | 937 } |
| 936 | 938 |
| 937 // ---------------------------------------------------------------------------- | 939 // ---------------------------------------------------------------------------- |
| 938 // End of x11_util_internal.h | 940 // End of x11_util_internal.h |
| 939 | 941 |
| 940 | 942 |
| 941 } // namespace ui | 943 } // namespace ui |
| OLD | NEW |