summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-05-21 14:27:33 -0400
committerKristian Høgsberg <krh@bitplanet.net>2012-05-21 17:03:16 -0400
commit45ba869ff3bbfd96ccdf1fb1f26fbf5d37943381 (patch)
tree7061fc888c6f9d8a96b9451b1cf5067bcd72042b
parente829a87a88070a7f9f8fc3cd0f9fb675de448e16 (diff)
shell: Make create_shell_surface() just return the shsurf
-rw-r--r--src/compositor.h6
-rw-r--r--src/shell.c13
-rw-r--r--src/xserver-launcher.c5
3 files changed, 12 insertions, 12 deletions
diff --git a/src/compositor.h b/src/compositor.h
index 32bccd2..7af423d 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -58,9 +58,9 @@ struct weston_mode {
struct weston_shell_interface {
void *shell; /* either desktop or tablet */
- void (*create_shell_surface)(void *shell,
- struct weston_surface *surface,
- struct shell_surface **ret);
+ struct shell_surface *(*create_shell_surface)(void *shell,
+ struct weston_surface *surface);
+
void (*set_toplevel)(struct shell_surface *shsurf);
void (*set_transient)(struct shell_surface *shsurf,
diff --git a/src/shell.c b/src/shell.c
index e23600d..d026fda 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1246,21 +1246,20 @@ get_shell_surface(struct weston_surface *surface)
static void
shell_surface_configure(struct weston_surface *, int32_t, int32_t);
-static void
-create_shell_surface(void *shell, struct weston_surface *surface,
- struct shell_surface **ret)
+static struct shell_surface *
+create_shell_surface(void *shell, struct weston_surface *surface)
{
struct shell_surface *shsurf;
if (surface->configure) {
fprintf(stderr, "surface->configure already set\n");
- return;
+ return NULL;
}
shsurf = calloc(1, sizeof *shsurf);
if (!shsurf) {
fprintf(stderr, "no memory to allocate shell surface\n");
- return;
+ return NULL;
}
surface->configure = shell_surface_configure;
@@ -1295,7 +1294,7 @@ create_shell_surface(void *shell, struct weston_surface *surface,
shsurf->type = SHELL_SURFACE_NONE;
shsurf->next_type = SHELL_SURFACE_NONE;
- *ret = shsurf;
+ return shsurf;
}
static void
@@ -1315,7 +1314,7 @@ shell_get_shell_surface(struct wl_client *client,
return;
}
- create_shell_surface(shell, surface, &shsurf);
+ shsurf = create_shell_surface(shell, surface);
if (!shsurf) {
wl_resource_post_error(surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
diff --git a/src/xserver-launcher.c b/src/xserver-launcher.c
index c57112b..bd162b6 100644
--- a/src/xserver-launcher.c
+++ b/src/xserver-launcher.c
@@ -1957,8 +1957,9 @@ xserver_map_shell_surface(struct weston_wm *wm,
if (!shell_interface->create_shell_surface)
return;
- shell_interface->create_shell_surface(shell_interface->shell,
- window->surface, &window->shsurf);
+ window->shsurf =
+ shell_interface->create_shell_surface(shell_interface->shell,
+ window->surface);
if (!window->transient_for) {
shell_interface->set_toplevel(window->shsurf);