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

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: 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 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 GetUserDataAs<ShellSurface>(resource)->SetTitle( 1490 GetUserDataAs<ShellSurface>(resource)->SetTitle(
1491 base::string16(base::UTF8ToUTF16(title))); 1491 base::string16(base::UTF8ToUTF16(title)));
1492 } 1492 }
1493 1493
1494 void remote_surface_set_top_inset(wl_client* client, 1494 void remote_surface_set_top_inset(wl_client* client,
1495 wl_resource* resource, 1495 wl_resource* resource,
1496 int32_t height) { 1496 int32_t height) {
1497 GetUserDataAs<ShellSurface>(resource)->SetTopInset(height); 1497 GetUserDataAs<ShellSurface>(resource)->SetTopInset(height);
1498 } 1498 }
1499 1499
1500 void remote_surface_set_system_modal(wl_client* client, wl_resource* resource) {
1501 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(true);
1502 }
1503
1504 void remote_surface_unset_system_modal(wl_client* client,
1505 wl_resource* resource) {
1506 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(false);
1507 }
1508
1500 const struct zwp_remote_surface_v1_interface remote_surface_implementation = { 1509 const struct zwp_remote_surface_v1_interface remote_surface_implementation = {
1501 remote_surface_destroy, 1510 remote_surface_destroy,
1502 remote_surface_set_app_id, 1511 remote_surface_set_app_id,
1503 remote_surface_set_window_geometry, 1512 remote_surface_set_window_geometry,
1504 remote_surface_set_scale, 1513 remote_surface_set_scale,
1505 remote_surface_fullscreen, 1514 remote_surface_fullscreen,
1506 remote_surface_maximize, 1515 remote_surface_maximize,
1507 remote_surface_minimize, 1516 remote_surface_minimize,
1508 remote_surface_restore, 1517 remote_surface_restore,
1509 remote_surface_pin, 1518 remote_surface_pin,
1510 remote_surface_unpin, 1519 remote_surface_unpin,
1511 remote_surface_unfullscreen, 1520 remote_surface_unfullscreen,
1512 remote_surface_set_rectangular_shadow, 1521 remote_surface_set_rectangular_shadow,
1513 remote_surface_set_title, 1522 remote_surface_set_title,
1514 remote_surface_set_top_inset}; 1523 remote_surface_set_top_inset,
1524 remote_surface_set_system_modal,
1525 remote_surface_unset_system_modal};
1515 1526
1516 //////////////////////////////////////////////////////////////////////////////// 1527 ////////////////////////////////////////////////////////////////////////////////
1517 // notification_surface_interface: 1528 // notification_surface_interface:
1518 1529
1519 void notification_surface_destroy(wl_client* client, wl_resource* resource) { 1530 void notification_surface_destroy(wl_client* client, wl_resource* resource) {
1520 wl_resource_destroy(resource); 1531 wl_resource_destroy(resource);
1521 } 1532 }
1522 1533
1523 const struct zwp_notification_surface_v1_interface 1534 const struct zwp_notification_surface_v1_interface
1524 notification_surface_implementation = {notification_surface_destroy}; 1535 notification_surface_implementation = {notification_surface_destroy};
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 void OnDisplayAdded(const display::Display& new_display) override {} 1577 void OnDisplayAdded(const display::Display& new_display) override {}
1567 void OnDisplayRemoved(const display::Display& new_display) override {} 1578 void OnDisplayRemoved(const display::Display& new_display) override {}
1568 void OnDisplayMetricsChanged(const display::Display& display, 1579 void OnDisplayMetricsChanged(const display::Display& display,
1569 uint32_t metrics) override { 1580 uint32_t metrics) override {
1570 if (display.id() == display_id_) 1581 if (display.id() == display_id_)
1571 SendConfigure(); 1582 SendConfigure();
1572 } 1583 }
1573 1584
1574 // Overridden from ash::ShellObserver: 1585 // Overridden from ash::ShellObserver:
1575 void OnDisplayWorkAreaInsetsChanged() override { SendConfigure(); } 1586 void OnDisplayWorkAreaInsetsChanged() override { SendConfigure(); }
1587 void OnMaximizeModeStarted() override {
1588 SendShellModeChange(ZWP_REMOTE_SHELL_V1_SHELL_MODE_TABLET);
1589 }
1590 void OnMaximizeModeEnded() override {
1591 SendShellModeChange(ZWP_REMOTE_SHELL_V1_SHELL_MODE_WINDOWED);
1592 }
1576 1593
1577 // Overridden from aura::client::ActivationChangeObserver: 1594 // Overridden from aura::client::ActivationChangeObserver:
1578 void OnWindowActivated( 1595 void OnWindowActivated(
1579 aura::client::ActivationChangeObserver::ActivationReason reason, 1596 aura::client::ActivationChangeObserver::ActivationReason reason,
1580 aura::Window* gained_active, 1597 aura::Window* gained_active,
1581 aura::Window* lost_active) override { 1598 aura::Window* lost_active) override {
1582 SendActivated(gained_active, lost_active); 1599 SendActivated(gained_active, lost_active);
1583 } 1600 }
1584 1601
1585 private: 1602 private:
1586 void SendConfigure() { 1603 void SendConfigure() {
1587 const display::Display& display = 1604 const display::Display& display =
1588 ash::Shell::GetInstance()->display_manager()->GetDisplayForId( 1605 ash::Shell::GetInstance()->display_manager()->GetDisplayForId(
1589 display_id_); 1606 display_id_);
1590 gfx::Insets work_area_insets = display.GetWorkAreaInsets(); 1607 gfx::Insets work_area_insets = display.GetWorkAreaInsets();
1591 zwp_remote_shell_v1_send_configure( 1608 zwp_remote_shell_v1_send_configure(
1592 remote_shell_resource_, display.size().width(), display.size().height(), 1609 remote_shell_resource_, display.size().width(), display.size().height(),
1593 work_area_insets.left(), work_area_insets.top(), 1610 work_area_insets.left(), work_area_insets.top(),
1594 work_area_insets.right(), work_area_insets.bottom()); 1611 work_area_insets.right(), work_area_insets.bottom());
1595 wl_client_flush(wl_resource_get_client(remote_shell_resource_)); 1612 wl_client_flush(wl_resource_get_client(remote_shell_resource_));
1596 } 1613 }
1597 1614
1615 void SendShellModeChange(int mode) {
1616 zwp_remote_shell_v1_send_shell_mode_changed(remote_shell_resource_, mode);
1617 wl_client_flush(wl_resource_get_client(remote_shell_resource_));
1618 }
1619
1598 void SendActivated(aura::Window* gained_active, aura::Window* lost_active) { 1620 void SendActivated(aura::Window* gained_active, aura::Window* lost_active) {
1599 Surface* gained_active_surface = 1621 Surface* gained_active_surface =
1600 gained_active ? ShellSurface::GetMainSurface(gained_active) : nullptr; 1622 gained_active ? ShellSurface::GetMainSurface(gained_active) : nullptr;
1601 Surface* lost_active_surface = 1623 Surface* lost_active_surface =
1602 lost_active ? ShellSurface::GetMainSurface(lost_active) : nullptr; 1624 lost_active ? ShellSurface::GetMainSurface(lost_active) : nullptr;
1603 wl_resource* gained_active_surface_resource = 1625 wl_resource* gained_active_surface_resource =
1604 gained_active_surface ? GetSurfaceResource(gained_active_surface) 1626 gained_active_surface ? GetSurfaceResource(gained_active_surface)
1605 : nullptr; 1627 : nullptr;
1606 wl_resource* lost_active_surface_resource = 1628 wl_resource* lost_active_surface_resource =
1607 lost_active_surface ? GetSurfaceResource(lost_active_surface) : nullptr; 1629 lost_active_surface ? GetSurfaceResource(lost_active_surface) : nullptr;
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 DCHECK(event_loop); 2858 DCHECK(event_loop);
2837 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); 2859 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds());
2838 } 2860 }
2839 2861
2840 void Server::Flush() { 2862 void Server::Flush() {
2841 wl_display_flush_clients(wl_display_.get()); 2863 wl_display_flush_clients(wl_display_.get());
2842 } 2864 }
2843 2865
2844 } // namespace wayland 2866 } // namespace wayland
2845 } // namespace exo 2867 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698