aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2018-02-23 11:50:09 +0100
committerGuido Günther <agx@sigxcpu.org>2018-02-25 13:47:43 +0100
commite6ca78b0e4b81e02958628c4b3b4db911b51714b (patch)
treeef90e62f36cc84dc5d04bc38119454c9bd495544
parent69409ea3cb3bfba52df9ff35a9b58f6f1b3dc25e (diff)
rootston: add view_create
so we can do basic view setup. Will be used to initialize alpha.
-rw-r--r--include/rootston/view.h1
-rw-r--r--rootston/desktop.c6
-rw-r--r--rootston/wl_shell.c2
-rw-r--r--rootston/xdg_shell.c2
-rw-r--r--rootston/xdg_shell_v6.c2
-rw-r--r--rootston/xwayland.c2
6 files changed, 11 insertions, 4 deletions
diff --git a/include/rootston/view.h b/include/rootston/view.h
index 198086c1..c92cbcb1 100644
--- a/include/rootston/view.h
+++ b/include/rootston/view.h
@@ -180,6 +180,7 @@ struct roots_xdg_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_activate(struct roots_view *view, bool active);
void view_move(struct roots_view *view, double x, double y);
diff --git a/rootston/desktop.c b/rootston/desktop.c
index 6b28a41c..57e2d54b 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -22,6 +22,12 @@
#include "rootston/view.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) {
box->x = view->x;
box->y = view->y;
diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c
index 44a65cf5..899df1c6 100644
--- a/rootston/wl_shell.c
+++ b/rootston/wl_shell.c
@@ -227,7 +227,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
roots_surface->surface_commit.notify = handle_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) {
free(roots_surface);
return;
diff --git a/rootston/xdg_shell.c b/rootston/xdg_shell.c
index 8340de46..9368ce0b 100644
--- a/rootston/xdg_shell.c
+++ b/rootston/xdg_shell.c
@@ -333,7 +333,7 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
roots_surface->new_popup.notify = handle_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) {
free(roots_surface);
return;
diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c
index 8e6674ab..eda349cb 100644
--- a/rootston/xdg_shell_v6.c
+++ b/rootston/xdg_shell_v6.c
@@ -333,7 +333,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
roots_surface->new_popup.notify = handle_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) {
free(roots_surface);
return;
diff --git a/rootston/xwayland.c b/rootston/xwayland.c
index e9e0d5e0..f917fe5d 100644
--- a/rootston/xwayland.c
+++ b/rootston/xwayland.c
@@ -317,7 +317,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
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 == NULL) {
free(roots_surface);
return;