| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/common/x11_util.h" | 9 #include "chrome/common/x11_util.h" |
| 10 | 10 |
| 11 #include <string.h> | 11 #include <string.h> |
| 12 | 12 |
| 13 #include <gdk/gdk.h> | 13 #include <gdk/gdk.h> |
| 14 #include <gdk/gdkx.h> | 14 #include <gdk/gdkx.h> |
| 15 #include <gtk/gtk.h> | 15 #include <gtk/gtk.h> |
| 16 | 16 |
| 17 #include <sys/ipc.h> | 17 #include <sys/ipc.h> |
| 18 #include <sys/shm.h> | 18 #include <sys/shm.h> |
| 19 | 19 |
| 20 #include <set> | 20 #include <set> |
| 21 | 21 |
| 22 #include "base/logging.h" | 22 #include "base/logging.h" |
| 23 #include "base/gfx/size.h" | 23 #include "base/gfx/size.h" |
| 24 #include "base/thread.h" | 24 #include "base/thread.h" |
| 25 #include "chrome/common/x11_util_internal.h" | 25 #include "chrome/common/x11_util_internal.h" |
| 26 | 26 |
| 27 namespace x11_util { | 27 namespace x11_util { |
| 28 | 28 |
| 29 bool XDisplayExists() { |
| 30 return (gdk_display_get_default() != NULL); |
| 31 } |
| 32 |
| 29 Display* GetXDisplay() { | 33 Display* GetXDisplay() { |
| 30 static Display* display = NULL; | 34 static Display* display = NULL; |
| 31 | 35 |
| 32 if (!display) | 36 if (!display) |
| 33 display = gdk_x11_get_default_xdisplay(); | 37 display = gdk_x11_get_default_xdisplay(); |
| 34 | 38 |
| 35 return display; | 39 return display; |
| 36 } | 40 } |
| 37 | 41 |
| 38 static bool DoQuerySharedMemorySupport(Display* dpy) { | 42 static bool DoQuerySharedMemorySupport(Display* dpy) { |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 return false; | 421 return false; |
| 418 | 422 |
| 419 if (children) | 423 if (children) |
| 420 XFree(children); | 424 XFree(children); |
| 421 | 425 |
| 422 *parent_is_root = root_window == *parent_window; | 426 *parent_is_root = root_window == *parent_window; |
| 423 return true; | 427 return true; |
| 424 } | 428 } |
| 425 | 429 |
| 426 } // namespace x11_util | 430 } // namespace x11_util |
| OLD | NEW |