Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(650)

Side by Side Diff: components/exo/wayland/server.cc

Issue 2104473002: third_party: Update to version 8 of remote_shell_protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [WIP]: third_party: Update to version 6 of remote_shell_protocol Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 GetUserDataAs<ShellSurface>(resource)->SetTitle( 1489 GetUserDataAs<ShellSurface>(resource)->SetTitle(
1490 base::string16(base::UTF8ToUTF16(title))); 1490 base::string16(base::UTF8ToUTF16(title)));
1491 } 1491 }
1492 1492
1493 void remote_surface_set_top_inset(wl_client* client, 1493 void remote_surface_set_top_inset(wl_client* client,
1494 wl_resource* resource, 1494 wl_resource* resource,
1495 int32_t height) { 1495 int32_t height) {
1496 GetUserDataAs<ShellSurface>(resource)->SetTopInset(height); 1496 GetUserDataAs<ShellSurface>(resource)->SetTopInset(height);
1497 } 1497 }
1498 1498
1499 void remote_surface_set_system_modal(wl_client* client, wl_resource* resource) {
1500 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(true);
1501 }
1502
1503 void remote_surface_unset_system_modal(wl_client* client,
1504 wl_resource* resource) {
1505 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(false);
1506 }
1507
1499 const struct zwp_remote_surface_v1_interface remote_surface_implementation = { 1508 const struct zwp_remote_surface_v1_interface remote_surface_implementation = {
1500 remote_surface_destroy, 1509 remote_surface_destroy,
1501 remote_surface_set_app_id, 1510 remote_surface_set_app_id,
1502 remote_surface_set_window_geometry, 1511 remote_surface_set_window_geometry,
1503 remote_surface_set_scale, 1512 remote_surface_set_scale,
1504 remote_surface_fullscreen, 1513 remote_surface_fullscreen,
1505 remote_surface_maximize, 1514 remote_surface_maximize,
1506 remote_surface_minimize, 1515 remote_surface_minimize,
1507 remote_surface_restore, 1516 remote_surface_restore,
1508 remote_surface_pin, 1517 remote_surface_pin,
1509 remote_surface_unpin, 1518 remote_surface_unpin,
1510 remote_surface_unfullscreen, 1519 remote_surface_unfullscreen,
1511 remote_surface_set_rectangular_shadow, 1520 remote_surface_set_rectangular_shadow,
1512 remote_surface_set_title, 1521 remote_surface_set_title,
1513 remote_surface_set_top_inset}; 1522 remote_surface_set_top_inset,
1523 remote_surface_set_system_modal,
1524 remote_surface_unset_system_modal};
1514 1525
1515 //////////////////////////////////////////////////////////////////////////////// 1526 ////////////////////////////////////////////////////////////////////////////////
1516 // notification_surface_interface: 1527 // notification_surface_interface:
1517 1528
1518 void notification_surface_destroy(wl_client* client, wl_resource* resource) { 1529 void notification_surface_destroy(wl_client* client, wl_resource* resource) {
1519 wl_resource_destroy(resource); 1530 wl_resource_destroy(resource);
1520 } 1531 }
1521 1532
1522 const struct zwp_notification_surface_v1_interface 1533 const struct zwp_notification_surface_v1_interface
1523 notification_surface_implementation = {notification_surface_destroy}; 1534 notification_surface_implementation = {notification_surface_destroy};
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 void OnDisplayAdded(const display::Display& new_display) override {} 1576 void OnDisplayAdded(const display::Display& new_display) override {}
1566 void OnDisplayRemoved(const display::Display& new_display) override {} 1577 void OnDisplayRemoved(const display::Display& new_display) override {}
1567 void OnDisplayMetricsChanged(const display::Display& display, 1578 void OnDisplayMetricsChanged(const display::Display& display,
1568 uint32_t metrics) override { 1579 uint32_t metrics) override {
1569 if (display.id() == display_id_) 1580 if (display.id() == display_id_)
1570 SendConfigure(); 1581 SendConfigure();
1571 } 1582 }
1572 1583
1573 // Overridden from ash::ShellObserver: 1584 // Overridden from ash::ShellObserver:
1574 void OnDisplayWorkAreaInsetsChanged() override { SendConfigure(); } 1585 void OnDisplayWorkAreaInsetsChanged() override { SendConfigure(); }
1586 void OnMaximizeModeStarted() override {
1587 SendLayoutModeChange(ZWP_REMOTE_SHELL_V1_LAYOUT_MODE_TABLET);
1588 }
1589 void OnMaximizeModeEnded() override {
1590 SendLayoutModeChange(ZWP_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED);
1591 }
1575 1592
1576 // Overridden from aura::client::ActivationChangeObserver: 1593 // Overridden from aura::client::ActivationChangeObserver:
1577 void OnWindowActivated( 1594 void OnWindowActivated(
1578 aura::client::ActivationChangeObserver::ActivationReason reason, 1595 aura::client::ActivationChangeObserver::ActivationReason reason,
1579 aura::Window* gained_active, 1596 aura::Window* gained_active,
1580 aura::Window* lost_active) override { 1597 aura::Window* lost_active) override {
1581 SendActivated(gained_active, lost_active); 1598 SendActivated(gained_active, lost_active);
1582 } 1599 }
1583 1600
1584 private: 1601 private:
1585 void SendConfigure() { 1602 void SendConfigure() {
1586 const display::Display& display = 1603 const display::Display& display =
1587 ash::Shell::GetInstance()->display_manager()->GetDisplayForId( 1604 ash::Shell::GetInstance()->display_manager()->GetDisplayForId(
1588 display_id_); 1605 display_id_);
1589 gfx::Insets work_area_insets = display.GetWorkAreaInsets(); 1606 gfx::Insets work_area_insets = display.GetWorkAreaInsets();
1590 zwp_remote_shell_v1_send_configure( 1607 zwp_remote_shell_v1_send_configure(
1591 remote_shell_resource_, display.size().width(), display.size().height(), 1608 remote_shell_resource_, display.size().width(), display.size().height(),
1592 work_area_insets.left(), work_area_insets.top(), 1609 work_area_insets.left(), work_area_insets.top(),
1593 work_area_insets.right(), work_area_insets.bottom()); 1610 work_area_insets.right(), work_area_insets.bottom());
1594 wl_client_flush(wl_resource_get_client(remote_shell_resource_)); 1611 wl_client_flush(wl_resource_get_client(remote_shell_resource_));
1595 } 1612 }
1596 1613
1614 void SendLayoutModeChange(int mode) {
1615 if (wl_resource_get_version(remote_shell_resource_) < 8)
1616 return;
1617 zwp_remote_shell_v1_send_layout_mode_changed(remote_shell_resource_, mode);
1618 wl_client_flush(wl_resource_get_client(remote_shell_resource_));
1619 }
1620
1597 void SendActivated(aura::Window* gained_active, aura::Window* lost_active) { 1621 void SendActivated(aura::Window* gained_active, aura::Window* lost_active) {
1598 Surface* gained_active_surface = 1622 Surface* gained_active_surface =
1599 gained_active ? ShellSurface::GetMainSurface(gained_active) : nullptr; 1623 gained_active ? ShellSurface::GetMainSurface(gained_active) : nullptr;
1600 Surface* lost_active_surface = 1624 Surface* lost_active_surface =
1601 lost_active ? ShellSurface::GetMainSurface(lost_active) : nullptr; 1625 lost_active ? ShellSurface::GetMainSurface(lost_active) : nullptr;
1602 wl_resource* gained_active_surface_resource = 1626 wl_resource* gained_active_surface_resource =
1603 gained_active_surface ? GetSurfaceResource(gained_active_surface) 1627 gained_active_surface ? GetSurfaceResource(gained_active_surface)
1604 : nullptr; 1628 : nullptr;
1605 wl_resource* lost_active_surface_resource = 1629 wl_resource* lost_active_surface_resource =
1606 lost_active_surface ? GetSurfaceResource(lost_active_surface) : nullptr; 1630 lost_active_surface ? GetSurfaceResource(lost_active_surface) : nullptr;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 wl_resource_get_version(resource), id); 1796 wl_resource_get_version(resource), id);
1773 SetImplementation(notification_surface_resource, 1797 SetImplementation(notification_surface_resource,
1774 &notification_surface_implementation, 1798 &notification_surface_implementation,
1775 std::move(notification_surface)); 1799 std::move(notification_surface));
1776 } 1800 }
1777 1801
1778 const struct zwp_remote_shell_v1_interface remote_shell_implementation = { 1802 const struct zwp_remote_shell_v1_interface remote_shell_implementation = {
1779 remote_shell_destroy, remote_shell_get_remote_surface, 1803 remote_shell_destroy, remote_shell_get_remote_surface,
1780 remote_shell_get_notification_surface}; 1804 remote_shell_get_notification_surface};
1781 1805
1782 const uint32_t remote_shell_version = 6; 1806 const uint32_t remote_shell_version = 8;
1783 1807
1784 void bind_remote_shell(wl_client* client, 1808 void bind_remote_shell(wl_client* client,
1785 void* data, 1809 void* data,
1786 uint32_t version, 1810 uint32_t version,
1787 uint32_t id) { 1811 uint32_t id) {
1788 wl_resource* resource = 1812 wl_resource* resource =
1789 wl_resource_create(client, &zwp_remote_shell_v1_interface, 1813 wl_resource_create(client, &zwp_remote_shell_v1_interface,
1790 std::min(version, remote_shell_version), id); 1814 std::min(version, remote_shell_version), id);
1791 1815
1792 // TODO(reveman): Multi-display support. 1816 // TODO(reveman): Multi-display support.
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
2845 DCHECK(event_loop); 2869 DCHECK(event_loop);
2846 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); 2870 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds());
2847 } 2871 }
2848 2872
2849 void Server::Flush() { 2873 void Server::Flush() {
2850 wl_display_flush_clients(wl_display_.get()); 2874 wl_display_flush_clients(wl_display_.get());
2851 } 2875 }
2852 2876
2853 } // namespace wayland 2877 } // namespace wayland
2854 } // namespace exo 2878 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698