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 MoveResizeWindowManaged(XID window, | |
499 gfx::Point origin, | |
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] = origin.x(); | |
511 event.xclient.data.l[1] = origin.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; | |
Daniel Erat
2016/10/12 16:13:10
nit: add something like "// Requested by normal ap
Tom (Use chromium acct)
2016/10/12 18:08:27
Done.
| |
516 | |
517 XSendEvent(display, DefaultRootWindow(display), False, | |
518 SubstructureRedirectMask | SubstructureNotifyMask, &event); | |
519 XFlush(display); | |
520 } | |
521 | |
498 bool IsShapeExtensionAvailable() { | 522 bool IsShapeExtensionAvailable() { |
499 int dummy; | 523 int dummy; |
500 static bool is_shape_available = | 524 static bool is_shape_available = |
501 XShapeQueryExtension(gfx::GetXDisplay(), &dummy, &dummy); | 525 XShapeQueryExtension(gfx::GetXDisplay(), &dummy, &dummy); |
502 return is_shape_available; | 526 return is_shape_available; |
503 } | 527 } |
504 | 528 |
505 XID GetX11RootWindow() { | 529 XID GetX11RootWindow() { |
506 return DefaultRootWindow(gfx::GetXDisplay()); | 530 return DefaultRootWindow(gfx::GetXDisplay()); |
507 } | 531 } |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1517 return colormap_; | 1541 return colormap_; |
1518 } | 1542 } |
1519 | 1543 |
1520 #endif | 1544 #endif |
1521 | 1545 |
1522 // ---------------------------------------------------------------------------- | 1546 // ---------------------------------------------------------------------------- |
1523 // End of x11_util_internal.h | 1547 // End of x11_util_internal.h |
1524 | 1548 |
1525 | 1549 |
1526 } // namespace ui | 1550 } // namespace ui |
OLD | NEW |