# Set Input Region Input region is the area of the window where it can absorb the input event such as click. [PlatformWindow::SetInputRegion](https://source.chromium.org/chromium/chromium/src/+/main:ui/platform_window/platform_window.h;l=199;drc=8e78783dc1f7007bad46d657c9f332614e240fd8) is a virtual method that sets the clickable region per window. As a region, you can only specify the rectangle using gfx::Rect. For each platform window, the input region seems to be expected to have a rectangle input region. The example usage is to trim the area from a large area to resonable area when window is resizing by omitting the shadow width. ## Wayland input region [WaylandToplevelWindow::SetInputRegion](https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/wayland/host/wayland_toplevel_window.cc;l=382;drc=8e78783dc1f7007bad46d657c9f332614e240fd8) is wayland impl. It simply passes the rect to its root surface. Its root surface is [WaylandSurface](https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/wayland/host/wayland_surface.h;l=45;drc=671b2ad5ed3181ca2fccd72fe09b714ed4037c7c). WaylandSurface is a wrapper of wl_surface. Its input region can be set via [WaylandSurface::set_input_region](https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/wayland/host/wayland_surface.cc;l=351;drc=8e78783dc1f7007bad46d657c9f332614e240fd8). `set_input_region` sets the rect to `pending_state_.input_region_px`, then this pending state ojne is passe via `wl_surface_set_input_region`. ## Subsurface [WaylandSubsurface](https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/wayland/host/wayland_subsurface.h;l=27;drc=671b2ad5ed3181ca2fccd72fe09b714ed4037c7c) is another wrapper of wl_surface, but it's also assigned wl_subsurface role. It owns one corresponding [WaylandSurface](https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/wayland/host/wayland_subsurface.h;l=76;drc=671b2ad5ed3181ca2fccd72fe09b714ed4037c7c) per WaylandSubsurface. Here, the input region is set in [CreateSubsurface](https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/wayland/host/wayland_subsurface.cc;l=118;drc=671b2ad5ed3181ca2fccd72fe09b714ed4037c7c). However, the set [`region_px`](https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/wayland/host/wayland_subsurface.cc;l=117;drc=671b2ad5ed3181ca2fccd72fe09b714ed4037c7c) is empty. WaylandSubsurface seems to be expected to be fully contained in its parent (WaylandWindow [`parent_`](https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/wayland/host/wayland_subsurface.h;l=87;drc=671b2ad5ed3181ca2fccd72fe09b714ed4037c7c)), so subsurface does not need to set its region specifically according to the [comment](https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/wayland/host/wayland_subsurface.cc;l=114-116;drc=671b2ad5ed3181ca2fccd72fe09b714ed4037c7c). ### How to support subsruface outside of the window Bubble view is allowed to stay outside of the boundary. In such scenario, we need to support the input region. We can have an option to pass specific input region to subsurface and set it from `wl_surface_set_input_region` similarly. TODO(elkurin): verify