rootston: add view_create

so we can do basic view setup. Will be used to initialize alpha.
This commit is contained in:
Guido Günther 2018-02-23 11:50:09 +01:00
parent 69409ea3cb
commit e6ca78b0e4
6 changed files with 11 additions and 4 deletions

View File

@ -180,6 +180,7 @@ struct roots_xdg_popup {
struct wl_listener new_popup; struct wl_listener new_popup;
}; };
struct roots_view *view_create();
void view_get_box(const struct roots_view *view, struct wlr_box *box); void view_get_box(const struct roots_view *view, struct wlr_box *box);
void view_activate(struct roots_view *view, bool active); void view_activate(struct roots_view *view, bool active);
void view_move(struct roots_view *view, double x, double y); void view_move(struct roots_view *view, double x, double y);

View File

@ -22,6 +22,12 @@
#include "rootston/view.h" #include "rootston/view.h"
#include "rootston/xcursor.h" #include "rootston/xcursor.h"
struct roots_view *view_create() {
struct roots_view *view = calloc(1, sizeof(struct roots_view));
return view;
}
void view_get_box(const struct roots_view *view, struct wlr_box *box) { void view_get_box(const struct roots_view *view, struct wlr_box *box) {
box->x = view->x; box->x = view->x;
box->y = view->y; box->y = view->y;

View File

@ -227,7 +227,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
roots_surface->surface_commit.notify = handle_surface_commit; roots_surface->surface_commit.notify = handle_surface_commit;
wl_signal_add(&surface->surface->events.commit, &roots_surface->surface_commit); wl_signal_add(&surface->surface->events.commit, &roots_surface->surface_commit);
struct roots_view *view = calloc(1, sizeof(struct roots_view)); struct roots_view *view = view_create();
if (!view) { if (!view) {
free(roots_surface); free(roots_surface);
return; return;

View File

@ -333,7 +333,7 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
roots_surface->new_popup.notify = handle_new_popup; roots_surface->new_popup.notify = handle_new_popup;
wl_signal_add(&surface->events.new_popup, &roots_surface->new_popup); wl_signal_add(&surface->events.new_popup, &roots_surface->new_popup);
struct roots_view *view = calloc(1, sizeof(struct roots_view)); struct roots_view *view = view_create();
if (!view) { if (!view) {
free(roots_surface); free(roots_surface);
return; return;

View File

@ -333,7 +333,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
roots_surface->new_popup.notify = handle_new_popup; roots_surface->new_popup.notify = handle_new_popup;
wl_signal_add(&surface->events.new_popup, &roots_surface->new_popup); wl_signal_add(&surface->events.new_popup, &roots_surface->new_popup);
struct roots_view *view = calloc(1, sizeof(struct roots_view)); struct roots_view *view = view_create();
if (!view) { if (!view) {
free(roots_surface); free(roots_surface);
return; return;

View File

@ -317,7 +317,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
wl_signal_add(&surface->surface->events.commit, wl_signal_add(&surface->surface->events.commit,
&roots_surface->surface_commit); &roots_surface->surface_commit);
struct roots_view *view = calloc(1, sizeof(struct roots_view)); struct roots_view *view = view_create();
if (view == NULL) { if (view == NULL) {
free(roots_surface); free(roots_surface);
return; return;