Skip to content

Commit 236f94f

Browse files
alive4everfooishbar
authored andcommitted
Allow building with weston < 1.12
The previous weston 1.12 fix breaks building with older weston. This commmit defines HAVE_NEW_WESTON if weston-1.12 is found and apply weston-1.12 fix as needed. If older weston is found, a warning message is displayed and HAVE_NEW_WESTON is undefined.
1 parent b23c2a8 commit 236f94f

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

configure.ac

+10
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ PKG_CHECK_MODULES([GTK], [
3434
alsa
3535
])
3636

37+
PKG_CHECK_MODULES([NEW_WESTON], [
38+
weston >= 1.12
39+
libweston-1
40+
],
41+
[AC_DEFINE([HAVE_NEW_WESTON],
42+
[1],
43+
[Using weston 1.12 or newer])],
44+
[AC_MSG_WARN([Not using weston 1.12 or newer])]
45+
)
46+
3747
GLIB_GSETTINGS
3848

3949
WAYLAND_SCANNER_RULES(['$(top_srcdir)/protocol'])

shell/shell-helper.c

+36
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222
#include <stdio.h>
2323
#include <assert.h>
2424

25+
#include "config.h"
26+
#ifdef HAVE_NEW_WESTON=1
2527
#include <libweston-1/compositor.h>
28+
#else
29+
#include <weston/compositor.h>
30+
#endif
2631

2732
#include "shell-helper-server-protocol.h"
2833

@@ -71,7 +76,11 @@ shell_helper_move_surface(struct wl_client *client,
7176
static void
7277
configure_surface(struct weston_surface *es, int32_t sx, int32_t sy)
7378
{
79+
#ifdef HAVE_NEW_WESTON
7480
struct weston_view *existing_view = es->committed_private;
81+
#else
82+
struct weston_view *existing_view = es->configure_private;
83+
#endif
7584
struct weston_view *new_view;
7685

7786
new_view = container_of(es->views.next, struct weston_view, surface_link);
@@ -97,12 +106,21 @@ shell_helper_add_surface_to_layer(struct wl_client *client,
97106
struct weston_view *new_view, *existing_view, *next;
98107
struct wl_layer *layer;
99108

109+
#ifdef HAVE_NEW_WESTON
100110
if (new_surface->committed) {
101111
wl_resource_post_error(new_surface_resource,
102112
WL_DISPLAY_ERROR_INVALID_OBJECT,
103113
"surface role already assigned");
104114
return;
105115
}
116+
#else
117+
if (new_surface->configure) {
118+
wl_resource_post_error(new_surface_resource,
119+
WL_DISPLAY_ERROR_INVALID_OBJECT,
120+
"surface role already assigned");
121+
return;
122+
}
123+
#endif
106124

107125
existing_view = container_of(existing_surface->views.next,
108126
struct weston_view,
@@ -112,15 +130,24 @@ shell_helper_add_surface_to_layer(struct wl_client *client,
112130
weston_view_destroy(new_view);
113131
new_view = weston_view_create(new_surface);
114132

133+
#ifdef HAVE_NEW_WESTON
115134
new_surface->committed = configure_surface;
116135
new_surface->committed_private = existing_view;
136+
#else
137+
new_surface->configure = configure_surface;
138+
new_surface->configure_private = existing_view;
139+
#endif
117140
new_surface->output = existing_view->output;
118141
}
119142

120143
static void
121144
configure_panel(struct weston_surface *es, int32_t sx, int32_t sy)
122145
{
146+
#ifdef HAVE_NEW_WESTON
123147
struct shell_helper *helper = es->committed_private;
148+
#else
149+
struct shell_helper *helper = es->configure_private;
150+
#endif
124151
struct weston_view *view;
125152

126153
view = container_of(es->views.next, struct weston_view, surface_link);
@@ -147,16 +174,25 @@ shell_helper_set_panel(struct wl_client *client,
147174
* it hasn't yet been defined because the original surface configure
148175
* function hasn't yet been called. if we call it here we will have
149176
* access to the layer. */
177+
#ifdef HAVE_NEW_WESTON
150178
surface->committed(surface, 0, 0);
179+
#else
180+
surface->configure(surface, 0, 0);
181+
#endif
151182

152183
helper->panel_layer = container_of(view->layer_link.link.next,
153184
struct weston_layer,
154185
view_list.link);
155186

156187
/* set new configure functions that only ensure the surface is in the
157188
* correct layer. */
189+
#ifdef HAVE_NEW_WESTON
158190
surface->committed = configure_panel;
159191
surface->committed_private = helper;
192+
#else
193+
surface->configure = configure_panel;
194+
surface->configure_private = helper;
195+
#endif
160196
}
161197

162198
enum SlideState {

0 commit comments

Comments
 (0)