Remove unused SWAY_VIEW_TYPES

This commit is contained in:
emersion 2018-04-04 15:53:46 -04:00 committed by Drew DeVault
parent 679c51e421
commit 8eff00f723
7 changed files with 34 additions and 40 deletions

View file

@ -59,11 +59,9 @@ struct sway_wl_shell_surface {
}; };
enum sway_view_type { enum sway_view_type {
SWAY_WL_SHELL_VIEW, SWAY_VIEW_WL_SHELL,
SWAY_XDG_SHELL_V6_VIEW, SWAY_VIEW_XDG_SHELL_V6,
SWAY_XWAYLAND_VIEW, SWAY_VIEW_XWAYLAND,
// Keep last
SWAY_VIEW_TYPES,
}; };
enum sway_view_prop { enum sway_view_prop {

View file

@ -188,7 +188,7 @@ static void render_view(struct sway_container *view, void *data) {
} }
switch (sway_view->type) { switch (sway_view->type) {
case SWAY_XDG_SHELL_V6_VIEW: { case SWAY_VIEW_XDG_SHELL_V6: {
int window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry.x; int window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry.x;
int window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry.y; int window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry.y;
render_surface(surface, wlr_output, when, render_surface(surface, wlr_output, when,
@ -197,13 +197,12 @@ static void render_view(struct sway_container *view, void *data) {
when, view->x - window_offset_x, view->y - window_offset_y, 0, alpha); when, view->x - window_offset_x, view->y - window_offset_y, 0, alpha);
break; break;
} }
case SWAY_WL_SHELL_VIEW: case SWAY_VIEW_WL_SHELL:
render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output, render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output,
when, view->x, view->y, 0, alpha, false); when, view->x, view->y, 0, alpha, false);
break; break;
case SWAY_XWAYLAND_VIEW: case SWAY_VIEW_XWAYLAND:
render_surface(surface, wlr_output, when, view->x, view->y, render_surface(surface, wlr_output, when, view->x, view->y, 0, alpha);
0, alpha);
break; break;
default: default:
break; break;

View file

@ -12,7 +12,7 @@
#include "log.h" #include "log.h"
static bool assert_wl_shell(struct sway_view *view) { static bool assert_wl_shell(struct sway_view *view) {
return sway_assert(view->type == SWAY_WL_SHELL_VIEW, return sway_assert(view->type == SWAY_VIEW_WL_SHELL,
"Expecting wl_shell view!"); "Expecting wl_shell view!");
} }
@ -97,7 +97,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
return; return;
} }
struct sway_view *view = view_create(SWAY_WL_SHELL_VIEW, &view_impl); struct sway_view *view = view_create(SWAY_VIEW_WL_SHELL, &view_impl);
if (!sway_assert(view, "Failed to allocate view")) { if (!sway_assert(view, "Failed to allocate view")) {
return; return;
} }

View file

@ -12,7 +12,7 @@
#include "log.h" #include "log.h"
static bool assert_xdg(struct sway_view *view) { static bool assert_xdg(struct sway_view *view) {
return sway_assert(view->type == SWAY_XDG_SHELL_V6_VIEW, return sway_assert(view->type == SWAY_VIEW_XDG_SHELL_V6,
"Expected xdg shell v6 view!"); "Expected xdg shell v6 view!");
} }
@ -126,7 +126,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
return; return;
} }
struct sway_view *view = view_create(SWAY_XDG_SHELL_V6_VIEW, &view_impl); struct sway_view *view = view_create(SWAY_VIEW_XDG_SHELL_V6, &view_impl);
if (!sway_assert(view, "Failed to allocate view")) { if (!sway_assert(view, "Failed to allocate view")) {
return; return;
} }

View file

@ -42,7 +42,7 @@ static void create_unmanaged(struct wlr_xwayland_surface *xsurface) {
static bool assert_xwayland(struct sway_view *view) { static bool assert_xwayland(struct sway_view *view) {
return sway_assert(view->type == SWAY_XWAYLAND_VIEW, return sway_assert(view->type == SWAY_VIEW_XWAYLAND,
"Expected xwayland view!"); "Expected xwayland view!");
} }
@ -185,7 +185,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
return; return;
} }
struct sway_view *view = view_create(SWAY_XWAYLAND_VIEW, &view_impl); struct sway_view *view = view_create(SWAY_VIEW_XWAYLAND, &view_impl);
if (!sway_assert(view, "Failed to allocate view")) { if (!sway_assert(view, "Failed to allocate view")) {
return; return;
} }

View file

@ -66,7 +66,7 @@ static void seat_send_focus(struct sway_seat *seat,
return; return;
} }
struct sway_view *view = con->sway_view; struct sway_view *view = con->sway_view;
if (view->type == SWAY_XWAYLAND_VIEW) { if (view->type == SWAY_VIEW_XWAYLAND) {
struct wlr_xwayland *xwayland = struct wlr_xwayland *xwayland =
seat->input->server->xwayland; seat->input->server->xwayland;
wlr_xwayland_set_seat(xwayland, seat->wlr_seat); wlr_xwayland_set_seat(xwayland, seat->wlr_seat);

View file

@ -413,31 +413,28 @@ struct sway_container *container_at(struct sway_container *parent,
double view_sy = oy - swayc->y; double view_sy = oy - swayc->y;
switch (sview->type) { switch (sview->type) {
case SWAY_WL_SHELL_VIEW: case SWAY_VIEW_XWAYLAND:
break; case SWAY_VIEW_WL_SHELL:
case SWAY_XDG_SHELL_V6_VIEW: break;
// the top left corner of the sway container is the case SWAY_VIEW_XDG_SHELL_V6:
// coordinate of the top left corner of the window geometry // the top left corner of the sway container is the
view_sx += sview->wlr_xdg_surface_v6->geometry.x; // coordinate of the top left corner of the window geometry
view_sy += sview->wlr_xdg_surface_v6->geometry.y; view_sx += sview->wlr_xdg_surface_v6->geometry.x;
view_sy += sview->wlr_xdg_surface_v6->geometry.y;
// check for popups // check for popups
double popup_sx, popup_sy; double popup_sx, popup_sy;
struct wlr_xdg_surface_v6 *popup = struct wlr_xdg_surface_v6 *popup =
wlr_xdg_surface_v6_popup_at(sview->wlr_xdg_surface_v6, wlr_xdg_surface_v6_popup_at(sview->wlr_xdg_surface_v6,
view_sx, view_sy, &popup_sx, &popup_sy); view_sx, view_sy, &popup_sx, &popup_sy);
if (popup) { if (popup) {
*sx = view_sx - popup_sx; *sx = view_sx - popup_sx;
*sy = view_sy - popup_sy; *sy = view_sy - popup_sy;
*surface = popup->surface; *surface = popup->surface;
return swayc; return swayc;
} }
break; break;
case SWAY_XWAYLAND_VIEW:
break;
default:
break;
} }
// check for subsurfaces // check for subsurfaces