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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 XChangeProperty(gfx::GetXDisplay(), | 488 XChangeProperty(gfx::GetXDisplay(), |
489 window, | 489 window, |
490 hint_atom, | 490 hint_atom, |
491 hint_atom, | 491 hint_atom, |
492 32, | 492 32, |
493 PropModeReplace, | 493 PropModeReplace, |
494 reinterpret_cast<unsigned char*>(&motif_hints), | 494 reinterpret_cast<unsigned char*>(&motif_hints), |
495 sizeof(MotifWmHints)/sizeof(long)); | 495 sizeof(MotifWmHints)/sizeof(long)); |
496 } | 496 } |
497 | 497 |
498 void MoveResizeManagedWindow(XID window, | |
499 gfx::Point root_location, | |
500 NetWmMoveResize mode) { | |
501 XDisplay* display = gfx::GetXDisplay(); | |
502 XAtom message_type = GetAtom("_NET_WM_MOVERESIZE"); | |
503 XEvent event; | |
504 memset(&event, 0, sizeof(event)); | |
505 event.xclient.type = ClientMessage; | |
506 event.xclient.display = display; | |
507 event.xclient.window = window; | |
508 event.xclient.message_type = message_type; | |
509 event.xclient.format = 32; | |
510 event.xclient.data.l[0] = root_location.x(); | |
511 event.xclient.data.l[1] = root_location.y(); | |
512 event.xclient.data.l[2] = static_cast<long>(mode); | |
513 event.xclient.data.l[3] = | |
514 Button1; // Currently all our managed dragging is done with LMB. | |
515 event.xclient.data.l[4] = 1; // Requested by normal application | |
516 | |
517 XSendEvent(display, DefaultRootWindow(display), False, | |
518 SubstructureRedirectMask | SubstructureNotifyMask, &event); | |
519 XFlush(display); | |
520 } | |
521 | |
522 bool IsShapeExtensionAvailable() { | 498 bool IsShapeExtensionAvailable() { |
523 int dummy; | 499 int dummy; |
524 static bool is_shape_available = | 500 static bool is_shape_available = |
525 XShapeQueryExtension(gfx::GetXDisplay(), &dummy, &dummy); | 501 XShapeQueryExtension(gfx::GetXDisplay(), &dummy, &dummy); |
526 return is_shape_available; | 502 return is_shape_available; |
527 } | 503 } |
528 | 504 |
529 XID GetX11RootWindow() { | 505 XID GetX11RootWindow() { |
530 return DefaultRootWindow(gfx::GetXDisplay()); | 506 return DefaultRootWindow(gfx::GetXDisplay()); |
531 } | 507 } |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 return colormap_; | 1517 return colormap_; |
1542 } | 1518 } |
1543 | 1519 |
1544 #endif | 1520 #endif |
1545 | 1521 |
1546 // ---------------------------------------------------------------------------- | 1522 // ---------------------------------------------------------------------------- |
1547 // End of x11_util_internal.h | 1523 // End of x11_util_internal.h |
1548 | 1524 |
1549 | 1525 |
1550 } // namespace ui | 1526 } // namespace ui |
OLD | NEW |