OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 black.red = black.green = black.blue = 0; | 456 black.red = black.green = black.blue = 0; |
457 Pixmap blank = XCreateBitmapFromData(xdisplay, | 457 Pixmap blank = XCreateBitmapFromData(xdisplay, |
458 DefaultRootWindow(xdisplay), | 458 DefaultRootWindow(xdisplay), |
459 nodata, 8, 8); | 459 nodata, 8, 8); |
460 invisible_cursor = XCreatePixmapCursor(xdisplay, blank, blank, | 460 invisible_cursor = XCreatePixmapCursor(xdisplay, blank, blank, |
461 &black, &black, 0, 0); | 461 &black, &black, 0, 0); |
462 XFreePixmap(xdisplay, blank); | 462 XFreePixmap(xdisplay, blank); |
463 return invisible_cursor; | 463 return invisible_cursor; |
464 } | 464 } |
465 | 465 |
| 466 void SetUseOSWindowFrame(XID window, bool use_os_window_frame) { |
| 467 // This data structure represents additional hints that we send to the window |
| 468 // manager and has a direct lineage back to Motif, which defined this de facto |
| 469 // standard. This struct doesn't seem 64-bit safe though, but it's what GDK |
| 470 // does. |
| 471 typedef struct { |
| 472 unsigned long flags; |
| 473 unsigned long functions; |
| 474 unsigned long decorations; |
| 475 long input_mode; |
| 476 unsigned long status; |
| 477 } MotifWmHints; |
| 478 |
| 479 MotifWmHints motif_hints; |
| 480 memset(&motif_hints, 0, sizeof(motif_hints)); |
| 481 // Signals that the reader of the _MOTIF_WM_HINTS property should pay |
| 482 // attention to the value of |decorations|. |
| 483 motif_hints.flags = (1L << 1); |
| 484 motif_hints.decorations = use_os_window_frame ? 1 : 0; |
| 485 |
| 486 ::Atom hint_atom = GetAtom("_MOTIF_WM_HINTS"); |
| 487 XChangeProperty(gfx::GetXDisplay(), |
| 488 window, |
| 489 hint_atom, |
| 490 hint_atom, |
| 491 32, |
| 492 PropModeReplace, |
| 493 reinterpret_cast<unsigned char*>(&motif_hints), |
| 494 sizeof(MotifWmHints)/sizeof(long)); |
| 495 } |
| 496 |
466 bool IsShapeExtensionAvailable() { | 497 bool IsShapeExtensionAvailable() { |
467 int dummy; | 498 int dummy; |
468 static bool is_shape_available = | 499 static bool is_shape_available = |
469 XShapeQueryExtension(gfx::GetXDisplay(), &dummy, &dummy); | 500 XShapeQueryExtension(gfx::GetXDisplay(), &dummy, &dummy); |
470 return is_shape_available; | 501 return is_shape_available; |
471 } | 502 } |
472 | 503 |
473 XID GetX11RootWindow() { | 504 XID GetX11RootWindow() { |
474 return DefaultRootWindow(gfx::GetXDisplay()); | 505 return DefaultRootWindow(gfx::GetXDisplay()); |
475 } | 506 } |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1409 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
1379 << "minor_code " << static_cast<int>(error_event.minor_code) | 1410 << "minor_code " << static_cast<int>(error_event.minor_code) |
1380 << " (" << request_str << ")"; | 1411 << " (" << request_str << ")"; |
1381 } | 1412 } |
1382 | 1413 |
1383 // ---------------------------------------------------------------------------- | 1414 // ---------------------------------------------------------------------------- |
1384 // End of x11_util_internal.h | 1415 // End of x11_util_internal.h |
1385 | 1416 |
1386 | 1417 |
1387 } // namespace ui | 1418 } // namespace ui |
OLD | NEW |