Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame^] | 1 | From e746f3bf7c8bb2f5dcf9e93edffc23b56eff12d0 Mon Sep 17 00:00:00 2001 |
| 2 | From: Joshua Watt <JPEWhacker@gmail.com> |
| 3 | Date: Tue, 5 Nov 2019 09:09:50 -0600 |
| 4 | Subject: [PATCH] Move wl_priv_signal to wayland-server-private.h |
| 5 | |
| 6 | Including wayland-server-core.h in wayland-private.h is problematic |
| 7 | because wayland-private.h is included by wayland-scanner which should be |
| 8 | able to build against non-POSIX platforms (e.g. MinGW). The only reason |
| 9 | that wayland-server-core.h was included in wayland-private.h was for the |
| 10 | wl_private_signal definitions, so move those to a |
| 11 | wayland-server-private.h file that can be included by both |
| 12 | wayland-server.c and the tests. |
| 13 | |
| 14 | Upstream-Status: Accepted [e7d88f35eb89cf0cc77cbddd834cacc63683a9cc] |
| 15 | Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> |
| 16 | --- |
| 17 | Makefile.am | 3 +- |
| 18 | src/wayland-private.h | 22 +-------------- |
| 19 | src/wayland-server-private.h | 53 ++++++++++++++++++++++++++++++++++++ |
| 20 | src/wayland-server.c | 1 + |
| 21 | tests/newsignal-test.c | 2 +- |
| 22 | 5 files changed, 58 insertions(+), 23 deletions(-) |
| 23 | create mode 100644 src/wayland-server-private.h |
| 24 | |
| 25 | diff --git a/Makefile.am b/Makefile.am |
| 26 | index f47d055..026d981 100644 |
| 27 | --- a/Makefile.am |
| 28 | +++ b/Makefile.am |
| 29 | @@ -56,7 +56,8 @@ libwayland_private_la_SOURCES = \ |
| 30 | src/connection.c \ |
| 31 | src/wayland-os.c \ |
| 32 | src/wayland-os.h \ |
| 33 | - src/wayland-private.h |
| 34 | + src/wayland-private.h \ |
| 35 | + src/wayland-server-private.h |
| 36 | |
| 37 | include_HEADERS = \ |
| 38 | src/wayland-util.h \ |
| 39 | diff --git a/src/wayland-private.h b/src/wayland-private.h |
| 40 | index 29516ec..dc7d12f 100644 |
| 41 | --- a/src/wayland-private.h |
| 42 | +++ b/src/wayland-private.h |
| 43 | @@ -31,11 +31,11 @@ |
| 44 | #include <stdarg.h> |
| 45 | #include <stdlib.h> |
| 46 | #include <stdint.h> |
| 47 | +#include <stdbool.h> |
| 48 | |
| 49 | #define WL_HIDE_DEPRECATED 1 |
| 50 | |
| 51 | #include "wayland-util.h" |
| 52 | -#include "wayland-server-core.h" |
| 53 | |
| 54 | /* Invalid memory address */ |
| 55 | #define WL_ARRAY_POISON_PTR (void *) 4 |
| 56 | @@ -236,26 +236,6 @@ zalloc(size_t s) |
| 57 | return calloc(1, s); |
| 58 | } |
| 59 | |
| 60 | -struct wl_priv_signal { |
| 61 | - struct wl_list listener_list; |
| 62 | - struct wl_list emit_list; |
| 63 | -}; |
| 64 | - |
| 65 | -void |
| 66 | -wl_priv_signal_init(struct wl_priv_signal *signal); |
| 67 | - |
| 68 | -void |
| 69 | -wl_priv_signal_add(struct wl_priv_signal *signal, struct wl_listener *listener); |
| 70 | - |
| 71 | -struct wl_listener * |
| 72 | -wl_priv_signal_get(struct wl_priv_signal *signal, wl_notify_func_t notify); |
| 73 | - |
| 74 | -void |
| 75 | -wl_priv_signal_emit(struct wl_priv_signal *signal, void *data); |
| 76 | - |
| 77 | -void |
| 78 | -wl_priv_signal_final_emit(struct wl_priv_signal *signal, void *data); |
| 79 | - |
| 80 | void |
| 81 | wl_connection_close_fds_in(struct wl_connection *connection, int max); |
| 82 | |
| 83 | diff --git a/src/wayland-server-private.h b/src/wayland-server-private.h |
| 84 | new file mode 100644 |
| 85 | index 0000000..23fa458 |
| 86 | --- /dev/null |
| 87 | +++ b/src/wayland-server-private.h |
| 88 | @@ -0,0 +1,53 @@ |
| 89 | +/* |
| 90 | + * Copyright © 2008-2011 Kristian Høgsberg |
| 91 | + * Copyright © 2011 Intel Corporation |
| 92 | + * Copyright © 2013 Jason Ekstrand |
| 93 | + * |
| 94 | + * Permission is hereby granted, free of charge, to any person obtaining |
| 95 | + * a copy of this software and associated documentation files (the |
| 96 | + * "Software"), to deal in the Software without restriction, including |
| 97 | + * without limitation the rights to use, copy, modify, merge, publish, |
| 98 | + * distribute, sublicense, and/or sell copies of the Software, and to |
| 99 | + * permit persons to whom the Software is furnished to do so, subject to |
| 100 | + * the following conditions: |
| 101 | + * |
| 102 | + * The above copyright notice and this permission notice (including the |
| 103 | + * next paragraph) shall be included in all copies or substantial |
| 104 | + * portions of the Software. |
| 105 | + * |
| 106 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 107 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 108 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 109 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 110 | + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 111 | + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 112 | + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 113 | + * SOFTWARE. |
| 114 | + */ |
| 115 | + |
| 116 | +#ifndef WAYLAND_SERVER_PRIVATE_H |
| 117 | +#define WAYLAND_SERVER_PRIVATE_H |
| 118 | + |
| 119 | +#include "wayland-server-core.h" |
| 120 | + |
| 121 | +struct wl_priv_signal { |
| 122 | + struct wl_list listener_list; |
| 123 | + struct wl_list emit_list; |
| 124 | +}; |
| 125 | + |
| 126 | +void |
| 127 | +wl_priv_signal_init(struct wl_priv_signal *signal); |
| 128 | + |
| 129 | +void |
| 130 | +wl_priv_signal_add(struct wl_priv_signal *signal, struct wl_listener *listener); |
| 131 | + |
| 132 | +struct wl_listener * |
| 133 | +wl_priv_signal_get(struct wl_priv_signal *signal, wl_notify_func_t notify); |
| 134 | + |
| 135 | +void |
| 136 | +wl_priv_signal_emit(struct wl_priv_signal *signal, void *data); |
| 137 | + |
| 138 | +void |
| 139 | +wl_priv_signal_final_emit(struct wl_priv_signal *signal, void *data); |
| 140 | + |
| 141 | +#endif |
| 142 | diff --git a/src/wayland-server.c b/src/wayland-server.c |
| 143 | index 19f6a76..d6f0206 100644 |
| 144 | --- a/src/wayland-server.c |
| 145 | +++ b/src/wayland-server.c |
| 146 | @@ -45,6 +45,7 @@ |
| 147 | |
| 148 | #include "wayland-util.h" |
| 149 | #include "wayland-private.h" |
| 150 | +#include "wayland-server-private.h" |
| 151 | #include "wayland-server.h" |
| 152 | #include "wayland-os.h" |
| 153 | |
| 154 | diff --git a/tests/newsignal-test.c b/tests/newsignal-test.c |
| 155 | index 47c429b..f3a7bd9 100644 |
| 156 | --- a/tests/newsignal-test.c |
| 157 | +++ b/tests/newsignal-test.c |
| 158 | @@ -26,7 +26,7 @@ |
| 159 | #include <assert.h> |
| 160 | |
| 161 | #include "test-runner.h" |
| 162 | -#include "wayland-private.h" |
| 163 | +#include "wayland-server-private.h" |
| 164 | |
| 165 | static void |
| 166 | signal_notify(struct wl_listener *listener, void *data) |