Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "components/exo/wayland/server.h" | 5 #include "components/exo/wayland/server.h" |
| 6 | 6 |
| 7 #include <grp.h> | 7 #include <grp.h> |
| 8 #include <linux/input.h> | 8 #include <linux/input.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1033 return WL_OUTPUT_TRANSFORM_180; | 1033 return WL_OUTPUT_TRANSFORM_180; |
| 1034 case display::Display::ROTATE_270: | 1034 case display::Display::ROTATE_270: |
| 1035 return WL_OUTPUT_TRANSFORM_270; | 1035 return WL_OUTPUT_TRANSFORM_270; |
| 1036 } | 1036 } |
| 1037 NOTREACHED(); | 1037 NOTREACHED(); |
| 1038 return WL_OUTPUT_TRANSFORM_NORMAL; | 1038 return WL_OUTPUT_TRANSFORM_NORMAL; |
| 1039 } | 1039 } |
| 1040 | 1040 |
| 1041 class WaylandDisplayObserver : public display::DisplayObserver { | 1041 class WaylandDisplayObserver : public display::DisplayObserver { |
| 1042 public: | 1042 public: |
| 1043 WaylandDisplayObserver(const display::Display& display, | 1043 WaylandDisplayObserver(wl_resource* output_resource) |
|
reveman
2016/07/29 16:03:51
this code was structured this way so that WaylandD
oshima
2016/07/29 19:27:03
It's simply wrong to keep the display id because p
reveman
2016/08/01 16:19:22
So this code currently reports events for what is
oshima
2016/08/01 16:36:36
Yes, and that is wrong. That display may not even
| |
| 1044 wl_resource* output_resource) | 1044 : output_resource_(output_resource) { |
| 1045 : display_id_(display.id()), output_resource_(output_resource) { | |
| 1046 display::Screen::GetScreen()->AddObserver(this); | 1045 display::Screen::GetScreen()->AddObserver(this); |
| 1047 SendDisplayMetrics(display); | 1046 SendPrimaryDisplayMetrics(); |
| 1048 } | 1047 } |
| 1049 ~WaylandDisplayObserver() override { | 1048 ~WaylandDisplayObserver() override { |
| 1050 display::Screen::GetScreen()->RemoveObserver(this); | 1049 display::Screen::GetScreen()->RemoveObserver(this); |
| 1051 } | 1050 } |
| 1052 | 1051 |
| 1053 // Overridden from display::DisplayObserver: | 1052 // Overridden from display::DisplayObserver: |
| 1054 void OnDisplayAdded(const display::Display& new_display) override {} | 1053 void OnDisplayAdded(const display::Display& new_display) override {} |
| 1055 void OnDisplayRemoved(const display::Display& new_display) override {} | 1054 void OnDisplayRemoved(const display::Display& new_display) override {} |
| 1056 void OnDisplayMetricsChanged(const display::Display& display, | 1055 void OnDisplayMetricsChanged(const display::Display& display, |
| 1057 uint32_t changed_metrics) override { | 1056 uint32_t changed_metrics) override { |
| 1058 if (display.id() != display_id_) | 1057 if (display::Screen::GetScreen()->GetPrimaryDisplay().id() != display.id()) |
| 1059 return; | 1058 return; |
| 1060 | 1059 |
| 1061 if (changed_metrics & | 1060 if (changed_metrics & |
| 1062 (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_DEVICE_SCALE_FACTOR | | 1061 (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_DEVICE_SCALE_FACTOR | |
| 1063 DISPLAY_METRIC_ROTATION)) { | 1062 DISPLAY_METRIC_ROTATION)) { |
| 1064 SendDisplayMetrics(display); | 1063 SendPrimaryDisplayMetrics(); |
| 1065 } | 1064 } |
| 1066 } | 1065 } |
| 1067 | 1066 |
| 1068 private: | 1067 private: |
| 1069 void SendDisplayMetrics(const display::Display& display) { | 1068 void SendPrimaryDisplayMetrics() { |
| 1069 // TODO(reveman): Multi-display support. | |
| 1070 display::Display display = | |
| 1071 display::Screen::GetScreen()->GetPrimaryDisplay(); | |
| 1072 | |
| 1070 const ash::DisplayInfo& info = | 1073 const ash::DisplayInfo& info = |
| 1071 ash::Shell::GetInstance()->display_manager()->GetDisplayInfo( | 1074 ash::Shell::GetInstance()->display_manager()->GetDisplayInfo( |
| 1072 display.id()); | 1075 display.id()); |
| 1073 | 1076 |
| 1074 const float kInchInMm = 25.4f; | 1077 const float kInchInMm = 25.4f; |
| 1075 const char* kUnknownMake = "unknown"; | 1078 const char* kUnknownMake = "unknown"; |
| 1076 const char* kUnknownModel = "unknown"; | 1079 const char* kUnknownModel = "unknown"; |
| 1077 | 1080 |
| 1078 gfx::Rect bounds = info.bounds_in_native(); | 1081 gfx::Rect bounds = info.bounds_in_native(); |
| 1079 wl_output_send_geometry( | 1082 wl_output_send_geometry( |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1092 wl_output_send_mode( | 1095 wl_output_send_mode( |
| 1093 output_resource_, WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED, | 1096 output_resource_, WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED, |
| 1094 bounds.width(), bounds.height(), static_cast<int>(60000)); | 1097 bounds.width(), bounds.height(), static_cast<int>(60000)); |
| 1095 | 1098 |
| 1096 if (wl_resource_get_version(output_resource_) >= | 1099 if (wl_resource_get_version(output_resource_) >= |
| 1097 WL_OUTPUT_DONE_SINCE_VERSION) { | 1100 WL_OUTPUT_DONE_SINCE_VERSION) { |
| 1098 wl_output_send_done(output_resource_); | 1101 wl_output_send_done(output_resource_); |
| 1099 } | 1102 } |
| 1100 } | 1103 } |
| 1101 | 1104 |
| 1102 // The identifier associated with the observed display. | |
| 1103 const int64_t display_id_; | |
| 1104 | |
| 1105 // The output resource associated with the display. | 1105 // The output resource associated with the display. |
| 1106 wl_resource* const output_resource_; | 1106 wl_resource* const output_resource_; |
| 1107 | 1107 |
| 1108 DISALLOW_COPY_AND_ASSIGN(WaylandDisplayObserver); | 1108 DISALLOW_COPY_AND_ASSIGN(WaylandDisplayObserver); |
| 1109 }; | 1109 }; |
| 1110 | 1110 |
| 1111 const uint32_t output_version = 2; | 1111 const uint32_t output_version = 2; |
| 1112 | 1112 |
| 1113 void bind_output(wl_client* client, void* data, uint32_t version, uint32_t id) { | 1113 void bind_output(wl_client* client, void* data, uint32_t version, uint32_t id) { |
| 1114 wl_resource* resource = wl_resource_create( | 1114 wl_resource* resource = wl_resource_create( |
| 1115 client, &wl_output_interface, std::min(version, output_version), id); | 1115 client, &wl_output_interface, std::min(version, output_version), id); |
| 1116 | 1116 |
| 1117 // TODO(reveman): Multi-display support. | 1117 SetImplementation(resource, nullptr, |
| 1118 const display::Display& display = ash::Shell::GetInstance() | 1118 base::WrapUnique(new WaylandDisplayObserver(resource))); |
| 1119 ->display_manager() | |
| 1120 ->GetPrimaryDisplayCandidate(); | |
| 1121 | |
| 1122 SetImplementation( | |
| 1123 resource, nullptr, | |
| 1124 base::WrapUnique(new WaylandDisplayObserver(display, resource))); | |
| 1125 } | 1119 } |
| 1126 | 1120 |
| 1127 //////////////////////////////////////////////////////////////////////////////// | 1121 //////////////////////////////////////////////////////////////////////////////// |
| 1128 // xdg_surface_interface: | 1122 // xdg_surface_interface: |
| 1129 | 1123 |
| 1130 int XdgResizeComponent(uint32_t edges) { | 1124 int XdgResizeComponent(uint32_t edges) { |
| 1131 switch (edges) { | 1125 switch (edges) { |
| 1132 case XDG_SURFACE_RESIZE_EDGE_TOP: | 1126 case XDG_SURFACE_RESIZE_EDGE_TOP: |
| 1133 return HTTOP; | 1127 return HTTOP; |
| 1134 case XDG_SURFACE_RESIZE_EDGE_BOTTOM: | 1128 case XDG_SURFACE_RESIZE_EDGE_BOTTOM: |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1514 | 1508 |
| 1515 void remote_surface_set_system_modal(wl_client* client, wl_resource* resource) { | 1509 void remote_surface_set_system_modal(wl_client* client, wl_resource* resource) { |
| 1516 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(true); | 1510 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(true); |
| 1517 } | 1511 } |
| 1518 | 1512 |
| 1519 void remote_surface_unset_system_modal(wl_client* client, | 1513 void remote_surface_unset_system_modal(wl_client* client, |
| 1520 wl_resource* resource) { | 1514 wl_resource* resource) { |
| 1521 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(false); | 1515 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(false); |
| 1522 } | 1516 } |
| 1523 | 1517 |
| 1518 void remote_surface_set_rectangular_shadow_background_opacity( | |
| 1519 wl_client* client, | |
| 1520 wl_resource* resource, | |
| 1521 wl_fixed_t opacity) { | |
| 1522 GetUserDataAs<ShellSurface>(resource)->SetRectangularShadowBackgroundOpacity( | |
| 1523 wl_fixed_to_double(opacity)); | |
| 1524 } | |
| 1525 | |
| 1524 const struct zwp_remote_surface_v1_interface remote_surface_implementation = { | 1526 const struct zwp_remote_surface_v1_interface remote_surface_implementation = { |
| 1525 remote_surface_destroy, | 1527 remote_surface_destroy, |
| 1526 remote_surface_set_app_id, | 1528 remote_surface_set_app_id, |
| 1527 remote_surface_set_window_geometry, | 1529 remote_surface_set_window_geometry, |
| 1528 remote_surface_set_scale, | 1530 remote_surface_set_scale, |
| 1529 remote_surface_fullscreen, | 1531 remote_surface_fullscreen, |
| 1530 remote_surface_maximize, | 1532 remote_surface_maximize, |
| 1531 remote_surface_minimize, | 1533 remote_surface_minimize, |
| 1532 remote_surface_restore, | 1534 remote_surface_restore, |
| 1533 remote_surface_pin, | 1535 remote_surface_pin, |
| 1534 remote_surface_unpin, | 1536 remote_surface_unpin, |
| 1535 remote_surface_unfullscreen, | 1537 remote_surface_unfullscreen, |
| 1536 remote_surface_set_rectangular_shadow, | 1538 remote_surface_set_rectangular_shadow, |
| 1537 remote_surface_set_title, | 1539 remote_surface_set_title, |
| 1538 remote_surface_set_top_inset, | 1540 remote_surface_set_top_inset, |
| 1539 remote_surface_set_system_modal, | 1541 remote_surface_set_system_modal, |
| 1540 remote_surface_unset_system_modal}; | 1542 remote_surface_unset_system_modal, |
| 1543 remote_surface_set_rectangular_shadow_background_opacity}; | |
| 1541 | 1544 |
| 1542 //////////////////////////////////////////////////////////////////////////////// | 1545 //////////////////////////////////////////////////////////////////////////////// |
| 1543 // notification_surface_interface: | 1546 // notification_surface_interface: |
| 1544 | 1547 |
| 1545 void notification_surface_destroy(wl_client* client, wl_resource* resource) { | 1548 void notification_surface_destroy(wl_client* client, wl_resource* resource) { |
| 1546 wl_resource_destroy(resource); | 1549 wl_resource_destroy(resource); |
| 1547 } | 1550 } |
| 1548 | 1551 |
| 1549 const struct zwp_notification_surface_v1_interface | 1552 const struct zwp_notification_surface_v1_interface |
| 1550 notification_surface_implementation = {notification_surface_destroy}; | 1553 notification_surface_implementation = {notification_surface_destroy}; |
| 1551 | 1554 |
| 1552 //////////////////////////////////////////////////////////////////////////////// | 1555 //////////////////////////////////////////////////////////////////////////////// |
| 1553 // remote_shell_interface: | 1556 // remote_shell_interface: |
| 1554 | 1557 |
| 1555 // Implements remote shell interface and monitors workspace state needed | 1558 // Implements remote shell interface and monitors workspace state needed |
| 1556 // for the remote shell interface. | 1559 // for the remote shell interface. |
| 1557 class WaylandRemoteShell : public ash::ShellObserver, | 1560 class WaylandRemoteShell : public ash::ShellObserver, |
| 1558 public aura::client::ActivationChangeObserver, | 1561 public aura::client::ActivationChangeObserver, |
| 1559 public display::DisplayObserver { | 1562 public display::DisplayObserver { |
| 1560 public: | 1563 public: |
| 1561 WaylandRemoteShell(Display* display, | 1564 WaylandRemoteShell(Display* display, |
| 1562 int64_t display_id, | |
| 1563 wl_resource* remote_shell_resource) | 1565 wl_resource* remote_shell_resource) |
| 1564 : display_(display), | 1566 : display_(display), |
| 1565 display_id_(display_id), | |
| 1566 remote_shell_resource_(remote_shell_resource), | 1567 remote_shell_resource_(remote_shell_resource), |
| 1567 weak_ptr_factory_(this) { | 1568 weak_ptr_factory_(this) { |
| 1568 ash::WmShell::Get()->AddShellObserver(this); | 1569 ash::WmShell::Get()->AddShellObserver(this); |
| 1569 ash::Shell* shell = ash::Shell::GetInstance(); | 1570 ash::Shell* shell = ash::Shell::GetInstance(); |
| 1570 shell->activation_client()->AddObserver(this); | 1571 shell->activation_client()->AddObserver(this); |
| 1571 display::Screen::GetScreen()->AddObserver(this); | 1572 display::Screen::GetScreen()->AddObserver(this); |
| 1572 SendConfigure(); | 1573 |
| 1574 SendPrimaryDisplayMetrics(); | |
| 1573 SendActivated(shell->activation_client()->GetActiveWindow(), nullptr); | 1575 SendActivated(shell->activation_client()->GetActiveWindow(), nullptr); |
| 1574 } | 1576 } |
| 1575 ~WaylandRemoteShell() override { | 1577 ~WaylandRemoteShell() override { |
| 1576 ash::WmShell::Get()->RemoveShellObserver(this); | 1578 ash::WmShell::Get()->RemoveShellObserver(this); |
| 1577 ash::Shell::GetInstance()->activation_client()->RemoveObserver(this); | 1579 ash::Shell::GetInstance()->activation_client()->RemoveObserver(this); |
| 1578 display::Screen::GetScreen()->RemoveObserver(this); | 1580 display::Screen::GetScreen()->RemoveObserver(this); |
| 1579 } | 1581 } |
| 1580 | 1582 |
| 1581 std::unique_ptr<ShellSurface> CreateShellSurface(Surface* surface, | 1583 std::unique_ptr<ShellSurface> CreateShellSurface(Surface* surface, |
| 1582 int container) { | 1584 int container) { |
| 1583 return display_->CreateRemoteShellSurface(surface, container); | 1585 return display_->CreateRemoteShellSurface(surface, container); |
| 1584 } | 1586 } |
| 1585 | 1587 |
| 1586 std::unique_ptr<NotificationSurface> CreateNotificationSurface( | 1588 std::unique_ptr<NotificationSurface> CreateNotificationSurface( |
| 1587 Surface* surface, | 1589 Surface* surface, |
| 1588 const std::string& notification_id) { | 1590 const std::string& notification_id) { |
| 1589 return display_->CreateNotificationSurface(surface, notification_id); | 1591 return display_->CreateNotificationSurface(surface, notification_id); |
| 1590 } | 1592 } |
| 1591 | 1593 |
| 1592 // Overridden from display::DisplayObserver: | 1594 // Overridden from display::DisplayObserver: |
| 1593 void OnDisplayAdded(const display::Display& new_display) override {} | 1595 void OnDisplayAdded(const display::Display& new_display) override {} |
| 1594 void OnDisplayRemoved(const display::Display& new_display) override {} | 1596 void OnDisplayRemoved(const display::Display& new_display) override {} |
| 1595 void OnDisplayMetricsChanged(const display::Display& display, | 1597 void OnDisplayMetricsChanged(const display::Display& display, |
| 1596 uint32_t metrics) override { | 1598 uint32_t changed_metrics) override { |
| 1597 if (display.id() == display_id_) | 1599 if (display::Screen::GetScreen()->GetPrimaryDisplay().id() != display.id()) |
| 1598 SendConfigure(); | 1600 return; |
| 1601 | |
| 1602 if (changed_metrics & | |
| 1603 (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_DEVICE_SCALE_FACTOR | | |
| 1604 DISPLAY_METRIC_ROTATION | DISPLAY_METRIC_WORK_AREA)) { | |
| 1605 SendDisplayMetrics(display); | |
| 1606 } | |
| 1607 SendConfigure_DEPRECATED(display); | |
| 1599 } | 1608 } |
| 1600 | 1609 |
| 1601 // Overridden from ash::ShellObserver: | 1610 // Overridden from ash::ShellObserver: |
| 1602 void OnMaximizeModeStarted() override { | 1611 void OnMaximizeModeStarted() override { |
| 1603 SendLayoutModeChange(ZWP_REMOTE_SHELL_V1_LAYOUT_MODE_TABLET); | 1612 layout_mode_ = ZWP_REMOTE_SHELL_V1_LAYOUT_MODE_TABLET; |
| 1613 SendLayoutModeChange_DEPRECATED(); | |
| 1614 | |
| 1604 send_configure_after_layout_change_ = true; | 1615 send_configure_after_layout_change_ = true; |
| 1605 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1616 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 1606 FROM_HERE, base::Bind(&WaylandRemoteShell::MaybeSendConfigure, | 1617 FROM_HERE, base::Bind(&WaylandRemoteShell::MaybeSendConfigure, |
| 1607 weak_ptr_factory_.GetWeakPtr()), | 1618 weak_ptr_factory_.GetWeakPtr()), |
| 1608 base::TimeDelta::FromMilliseconds(kConfigureDelayAfterLayoutSwitchMs)); | 1619 base::TimeDelta::FromMilliseconds(kConfigureDelayAfterLayoutSwitchMs)); |
| 1609 } | 1620 } |
| 1610 void OnMaximizeModeEnded() override { | 1621 void OnMaximizeModeEnded() override { |
| 1611 SendLayoutModeChange(ZWP_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED); | 1622 layout_mode_ = ZWP_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED; |
| 1623 SendLayoutModeChange_DEPRECATED(); | |
| 1612 send_configure_after_layout_change_ = true; | 1624 send_configure_after_layout_change_ = true; |
| 1613 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1625 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 1614 FROM_HERE, base::Bind(&WaylandRemoteShell::MaybeSendConfigure, | 1626 FROM_HERE, base::Bind(&WaylandRemoteShell::MaybeSendConfigure, |
| 1615 weak_ptr_factory_.GetWeakPtr()), | 1627 weak_ptr_factory_.GetWeakPtr()), |
| 1616 base::TimeDelta::FromMilliseconds(kConfigureDelayAfterLayoutSwitchMs)); | 1628 base::TimeDelta::FromMilliseconds(kConfigureDelayAfterLayoutSwitchMs)); |
| 1617 } | 1629 } |
| 1618 | 1630 |
| 1619 // Overridden from aura::client::ActivationChangeObserver: | 1631 // Overridden from aura::client::ActivationChangeObserver: |
| 1620 void OnWindowActivated( | 1632 void OnWindowActivated( |
| 1621 aura::client::ActivationChangeObserver::ActivationReason reason, | 1633 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 1622 aura::Window* gained_active, | 1634 aura::Window* gained_active, |
| 1623 aura::Window* lost_active) override { | 1635 aura::Window* lost_active) override { |
| 1624 SendActivated(gained_active, lost_active); | 1636 SendActivated(gained_active, lost_active); |
| 1625 } | 1637 } |
| 1626 | 1638 |
| 1627 private: | 1639 private: |
| 1640 void SendPrimaryDisplayMetrics() { | |
| 1641 const display::Display primary = | |
| 1642 display::Screen::GetScreen()->GetPrimaryDisplay(); | |
| 1643 | |
| 1644 SendConfigure_DEPRECATED(primary); | |
| 1645 SendDisplayMetrics(primary); | |
| 1646 } | |
| 1647 | |
| 1628 void MaybeSendConfigure() { | 1648 void MaybeSendConfigure() { |
| 1629 if (send_configure_after_layout_change_) | 1649 if (send_configure_after_layout_change_) |
| 1630 SendConfigure(); | 1650 SendPrimaryDisplayMetrics(); |
| 1631 } | 1651 } |
| 1632 | 1652 |
| 1633 void SendConfigure() { | 1653 void SendDisplayMetrics(const display::Display& display) { |
| 1654 if (wl_resource_get_version(remote_shell_resource_) < 9) | |
| 1655 return; | |
| 1656 | |
| 1634 send_configure_after_layout_change_ = false; | 1657 send_configure_after_layout_change_ = false; |
| 1635 const display::Display& display = | 1658 const ash::DisplayInfo& info = |
| 1636 ash::Shell::GetInstance()->display_manager()->GetDisplayForId( | 1659 ash::Shell::GetInstance()->display_manager()->GetDisplayInfo( |
| 1637 display_id_); | 1660 display.id()); |
| 1661 | |
| 1662 gfx::Insets work_area_insets = display.GetWorkAreaInsets(); | |
| 1663 gfx::Rect native_bounds = info.bounds_in_native(); | |
| 1664 | |
| 1665 int refresh_rate = 60000; | |
| 1666 zwp_remote_shell_v1_send_configuration_changed( | |
| 1667 remote_shell_resource_, | |
| 1668 native_bounds.width(), | |
| 1669 native_bounds.height(), | |
| 1670 wl_fixed_from_double(info.device_dpi()), | |
| 1671 OutputTransform(display.rotation()), | |
| 1672 refresh_rate, | |
| 1673 wl_fixed_from_double(display.device_scale_factor()), | |
| 1674 display.size().width(), display.size().height(), | |
| 1675 work_area_insets.left(), work_area_insets.top(), | |
| 1676 work_area_insets.right(), work_area_insets.bottom(), layout_mode_); | |
| 1677 | |
| 1678 wl_client_flush(wl_resource_get_client(remote_shell_resource_)); | |
| 1679 } | |
| 1680 | |
| 1681 void SendConfigure_DEPRECATED(const display::Display& display) { | |
| 1682 send_configure_after_layout_change_ = false; | |
| 1683 | |
| 1684 if (wl_resource_get_version(remote_shell_resource_) >= 9) | |
| 1685 return; | |
| 1686 | |
| 1638 gfx::Insets work_area_insets = display.GetWorkAreaInsets(); | 1687 gfx::Insets work_area_insets = display.GetWorkAreaInsets(); |
| 1639 zwp_remote_shell_v1_send_configure( | 1688 zwp_remote_shell_v1_send_configure( |
| 1640 remote_shell_resource_, display.size().width(), display.size().height(), | 1689 remote_shell_resource_, display.size().width(), display.size().height(), |
| 1641 work_area_insets.left(), work_area_insets.top(), | 1690 work_area_insets.left(), work_area_insets.top(), |
| 1642 work_area_insets.right(), work_area_insets.bottom()); | 1691 work_area_insets.right(), work_area_insets.bottom()); |
| 1643 wl_client_flush(wl_resource_get_client(remote_shell_resource_)); | 1692 wl_client_flush(wl_resource_get_client(remote_shell_resource_)); |
| 1644 } | 1693 } |
| 1645 | 1694 |
| 1646 void SendLayoutModeChange(uint32_t mode) { | 1695 void SendLayoutModeChange_DEPRECATED() { |
| 1647 if (wl_resource_get_version(remote_shell_resource_) < 8) | 1696 if (wl_resource_get_version(remote_shell_resource_) < 8) |
| 1648 return; | 1697 return; |
| 1649 zwp_remote_shell_v1_send_layout_mode_changed(remote_shell_resource_, mode); | 1698 zwp_remote_shell_v1_send_layout_mode_changed(remote_shell_resource_, |
| 1699 layout_mode_); | |
| 1650 wl_client_flush(wl_resource_get_client(remote_shell_resource_)); | 1700 wl_client_flush(wl_resource_get_client(remote_shell_resource_)); |
| 1651 } | 1701 } |
| 1652 | 1702 |
| 1653 void SendActivated(aura::Window* gained_active, aura::Window* lost_active) { | 1703 void SendActivated(aura::Window* gained_active, aura::Window* lost_active) { |
| 1654 Surface* gained_active_surface = | 1704 Surface* gained_active_surface = |
| 1655 gained_active ? ShellSurface::GetMainSurface(gained_active) : nullptr; | 1705 gained_active ? ShellSurface::GetMainSurface(gained_active) : nullptr; |
| 1656 Surface* lost_active_surface = | 1706 Surface* lost_active_surface = |
| 1657 lost_active ? ShellSurface::GetMainSurface(lost_active) : nullptr; | 1707 lost_active ? ShellSurface::GetMainSurface(lost_active) : nullptr; |
| 1658 wl_resource* gained_active_surface_resource = | 1708 wl_resource* gained_active_surface_resource = |
| 1659 gained_active_surface ? GetSurfaceResource(gained_active_surface) | 1709 gained_active_surface ? GetSurfaceResource(gained_active_surface) |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1679 | 1729 |
| 1680 zwp_remote_shell_v1_send_activated(remote_shell_resource_, | 1730 zwp_remote_shell_v1_send_activated(remote_shell_resource_, |
| 1681 gained_active_surface_resource, | 1731 gained_active_surface_resource, |
| 1682 lost_active_surface_resource); | 1732 lost_active_surface_resource); |
| 1683 wl_client_flush(client); | 1733 wl_client_flush(client); |
| 1684 } | 1734 } |
| 1685 | 1735 |
| 1686 // The exo display instance. Not owned. | 1736 // The exo display instance. Not owned. |
| 1687 Display* const display_; | 1737 Display* const display_; |
| 1688 | 1738 |
| 1689 // The identifier associated with the observed display. | |
| 1690 const int64_t display_id_; | |
| 1691 | |
| 1692 // The remote shell resource associated with observer. | 1739 // The remote shell resource associated with observer. |
| 1693 wl_resource* const remote_shell_resource_; | 1740 wl_resource* const remote_shell_resource_; |
| 1694 | 1741 |
| 1695 bool send_configure_after_layout_change_ = false; | 1742 bool send_configure_after_layout_change_ = false; |
| 1696 | 1743 |
| 1744 int layout_mode_ = ZWP_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED; | |
| 1745 | |
| 1697 base::WeakPtrFactory<WaylandRemoteShell> weak_ptr_factory_; | 1746 base::WeakPtrFactory<WaylandRemoteShell> weak_ptr_factory_; |
| 1698 | 1747 |
| 1699 DISALLOW_COPY_AND_ASSIGN(WaylandRemoteShell); | 1748 DISALLOW_COPY_AND_ASSIGN(WaylandRemoteShell); |
| 1700 }; | 1749 }; |
| 1701 | 1750 |
| 1702 void remote_shell_destroy(wl_client* client, wl_resource* resource) { | 1751 void remote_shell_destroy(wl_client* client, wl_resource* resource) { |
| 1703 // Nothing to do here. | 1752 // Nothing to do here. |
| 1704 } | 1753 } |
| 1705 | 1754 |
| 1706 int RemoteSurfaceContainer(uint32_t container) { | 1755 int RemoteSurfaceContainer(uint32_t container) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1832 wl_resource_get_version(resource), id); | 1881 wl_resource_get_version(resource), id); |
| 1833 SetImplementation(notification_surface_resource, | 1882 SetImplementation(notification_surface_resource, |
| 1834 ¬ification_surface_implementation, | 1883 ¬ification_surface_implementation, |
| 1835 std::move(notification_surface)); | 1884 std::move(notification_surface)); |
| 1836 } | 1885 } |
| 1837 | 1886 |
| 1838 const struct zwp_remote_shell_v1_interface remote_shell_implementation = { | 1887 const struct zwp_remote_shell_v1_interface remote_shell_implementation = { |
| 1839 remote_shell_destroy, remote_shell_get_remote_surface, | 1888 remote_shell_destroy, remote_shell_get_remote_surface, |
| 1840 remote_shell_get_notification_surface}; | 1889 remote_shell_get_notification_surface}; |
| 1841 | 1890 |
| 1842 const uint32_t remote_shell_version = 8; | 1891 const uint32_t remote_shell_version = 9; |
| 1843 | 1892 |
| 1844 void bind_remote_shell(wl_client* client, | 1893 void bind_remote_shell(wl_client* client, |
| 1845 void* data, | 1894 void* data, |
| 1846 uint32_t version, | 1895 uint32_t version, |
| 1847 uint32_t id) { | 1896 uint32_t id) { |
| 1848 wl_resource* resource = | 1897 wl_resource* resource = |
| 1849 wl_resource_create(client, &zwp_remote_shell_v1_interface, | 1898 wl_resource_create(client, &zwp_remote_shell_v1_interface, |
| 1850 std::min(version, remote_shell_version), id); | 1899 std::min(version, remote_shell_version), id); |
| 1851 | 1900 |
| 1852 // TODO(reveman): Multi-display support. | |
| 1853 const display::Display& display = ash::Shell::GetInstance() | |
| 1854 ->display_manager() | |
| 1855 ->GetPrimaryDisplayCandidate(); | |
| 1856 | |
| 1857 SetImplementation(resource, &remote_shell_implementation, | 1901 SetImplementation(resource, &remote_shell_implementation, |
| 1858 base::WrapUnique(new WaylandRemoteShell( | 1902 base::WrapUnique(new WaylandRemoteShell( |
| 1859 static_cast<Display*>(data), display.id(), resource))); | 1903 static_cast<Display*>(data), resource))); |
| 1860 } | 1904 } |
| 1861 | 1905 |
| 1862 //////////////////////////////////////////////////////////////////////////////// | 1906 //////////////////////////////////////////////////////////////////////////////// |
| 1863 // zwp_vsync_timing_v1_interface: | 1907 // zwp_vsync_timing_v1_interface: |
| 1864 | 1908 |
| 1865 // Implements VSync timing interface by monitoring a compositor for updates | 1909 // Implements VSync timing interface by monitoring a compositor for updates |
| 1866 // to VSync parameters. | 1910 // to VSync parameters. |
| 1867 class VSyncTiming : public ui::CompositorVSyncManager::Observer { | 1911 class VSyncTiming : public ui::CompositorVSyncManager::Observer { |
| 1868 public: | 1912 public: |
| 1869 ~VSyncTiming() { vsync_manager_->RemoveObserver(this); } | 1913 ~VSyncTiming() { vsync_manager_->RemoveObserver(this); } |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3074 DCHECK(event_loop); | 3118 DCHECK(event_loop); |
| 3075 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3119 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3076 } | 3120 } |
| 3077 | 3121 |
| 3078 void Server::Flush() { | 3122 void Server::Flush() { |
| 3079 wl_display_flush_clients(wl_display_.get()); | 3123 wl_display_flush_clients(wl_display_.get()); |
| 3080 } | 3124 } |
| 3081 | 3125 |
| 3082 } // namespace wayland | 3126 } // namespace wayland |
| 3083 } // namespace exo | 3127 } // namespace exo |
| OLD | NEW |