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 {
SWAY_WL_SHELL_VIEW,
SWAY_XDG_SHELL_V6_VIEW,
SWAY_XWAYLAND_VIEW,
// Keep last
SWAY_VIEW_TYPES,
SWAY_VIEW_WL_SHELL,
SWAY_VIEW_XDG_SHELL_V6,
SWAY_VIEW_XWAYLAND,
};
enum sway_view_prop {

View File

@ -188,7 +188,7 @@ static void render_view(struct sway_container *view, void *data) {
}
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_y = view->sway_view->wlr_xdg_surface_v6->geometry.y;
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);
break;
}
case SWAY_WL_SHELL_VIEW:
case SWAY_VIEW_WL_SHELL:
render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output,
when, view->x, view->y, 0, alpha, false);
break;
case SWAY_XWAYLAND_VIEW:
render_surface(surface, wlr_output, when, view->x, view->y,
0, alpha);
case SWAY_VIEW_XWAYLAND:
render_surface(surface, wlr_output, when, view->x, view->y, 0, alpha);
break;
default:
break;

View File

@ -12,7 +12,7 @@
#include "log.h"
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!");
}
@ -97,7 +97,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
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")) {
return;
}

View File

@ -12,7 +12,7 @@
#include "log.h"
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!");
}
@ -126,7 +126,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
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")) {
return;
}

View File

@ -42,7 +42,7 @@ static void create_unmanaged(struct wlr_xwayland_surface *xsurface) {
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!");
}
@ -185,7 +185,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
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")) {
return;
}

View File

@ -66,7 +66,7 @@ static void seat_send_focus(struct sway_seat *seat,
return;
}
struct sway_view *view = con->sway_view;
if (view->type == SWAY_XWAYLAND_VIEW) {
if (view->type == SWAY_VIEW_XWAYLAND) {
struct wlr_xwayland *xwayland =
seat->input->server->xwayland;
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;
switch (sview->type) {
case SWAY_WL_SHELL_VIEW:
break;
case SWAY_XDG_SHELL_V6_VIEW:
// the top left corner of the sway container is the
// coordinate of the top left corner of the window geometry
view_sx += sview->wlr_xdg_surface_v6->geometry.x;
view_sy += sview->wlr_xdg_surface_v6->geometry.y;
case SWAY_VIEW_XWAYLAND:
case SWAY_VIEW_WL_SHELL:
break;
case SWAY_VIEW_XDG_SHELL_V6:
// the top left corner of the sway container is the
// coordinate of the top left corner of the window geometry
view_sx += sview->wlr_xdg_surface_v6->geometry.x;
view_sy += sview->wlr_xdg_surface_v6->geometry.y;
// check for popups
double popup_sx, popup_sy;
struct wlr_xdg_surface_v6 *popup =
wlr_xdg_surface_v6_popup_at(sview->wlr_xdg_surface_v6,
view_sx, view_sy, &popup_sx, &popup_sy);
// check for popups
double popup_sx, popup_sy;
struct wlr_xdg_surface_v6 *popup =
wlr_xdg_surface_v6_popup_at(sview->wlr_xdg_surface_v6,
view_sx, view_sy, &popup_sx, &popup_sy);
if (popup) {
*sx = view_sx - popup_sx;
*sy = view_sy - popup_sy;
*surface = popup->surface;
return swayc;
}
break;
case SWAY_XWAYLAND_VIEW:
break;
default:
break;
if (popup) {
*sx = view_sx - popup_sx;
*sy = view_sy - popup_sy;
*surface = popup->surface;
return swayc;
}
break;
}
// check for subsurfaces