Introduce common functions to create, map, unmap, destroy views

This commit is contained in:
emersion 2018-03-31 17:49:40 -04:00
parent 122b96abed
commit b2c2ee693b
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
8 changed files with 212 additions and 150 deletions

View file

@ -24,6 +24,7 @@ struct sway_output {
struct wl_listener destroy;
struct wl_listener mode;
struct wl_listener transform;
struct wl_listener scale;
struct wl_listener damage_destroy;
struct wl_listener damage_frame;

View file

@ -70,9 +70,8 @@ struct sway_container {
enum sway_container_layout prev_layout;
enum sway_container_layout workspace_layout;
// TODO convert to layout coordinates
// in output-local coordinates
double x, y;
// does not include borders or gaps.
double width, height;

View file

@ -4,6 +4,8 @@
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
#include <wlr/xwayland.h>
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
struct sway_container;
struct sway_view;
@ -94,9 +96,13 @@ struct sway_view {
} iface;
// only used for unmanaged views (shell specific)
struct wl_list unmanaged_view_link; // sway_root::unmanaged views
struct wl_list unmanaged_view_link; // sway_root::unmanaged_views
};
struct sway_view *view_create(enum sway_view_type type);
void view_destroy(struct sway_view *view);
const char *view_get_title(struct sway_view *view);
const char *view_get_app_id(struct sway_view *view);
@ -113,7 +119,12 @@ void view_set_activated(struct sway_view *view, bool activated);
void view_close(struct sway_view *view);
void view_update_outputs(struct sway_view *view, const struct wlr_box *before);
void view_map(struct sway_view *view, struct wlr_surface *wlr_surface);
void view_map_unmanaged(struct sway_view *view,
struct wlr_surface *wlr_surface);
void view_unmap(struct sway_view *view);
void view_damage_whole(struct sway_view *view);