summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2018-02-06 15:18:38 -0600
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2018-02-07 11:39:36 +0200
commite277276b850bad39ed6995be5a82f24aa6b17bf1 (patch)
treed6e6b382f23ddb924eb745c75e44d4170b766ceb
parentb7e3db6a76ca74c878a79717300d0a1f9b3be06e (diff)
shared: Update all users of DATADIR
Replace every use of DATADIR to create a filename with a call to the new function that allows overriding DATADIR with an env var at runtime. No attention is paid to asprintf failure. This restores make distcheck to a passing state after commit 6b58ea began checking cairo surfaces for validity and exchanged undefined behaviour we shouldn't have been dependent on for consistent test failure. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Acked-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> [Pekka: split if-branches into two lines] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r--clients/desktop-shell.c14
-rw-r--r--clients/ivi-shell-user-interface.c30
-rw-r--r--libweston/compositor-x11.c6
-rw-r--r--shared/frame.c33
4 files changed, 68 insertions, 15 deletions
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 599295ee..12bc971e 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -49,6 +49,7 @@
#include "shared/helpers.h"
#include "shared/xalloc.h"
#include "shared/zalloc.h"
+#include "shared/file-util.h"
#include "weston-desktop-shell-client-protocol.h"
@@ -760,8 +761,12 @@ background_draw(struct widget *widget, void *data)
image = NULL;
if (background->image)
image = load_cairo_surface(background->image);
- else if (background->color == 0)
- image = load_cairo_surface(DATADIR "/weston/pattern.png");
+ else if (background->color == 0) {
+ char *name = file_name_with_datadir("pattern.png");
+
+ image = load_cairo_surface(name);
+ free(name);
+ }
if (image && background->type != -1) {
im_w = cairo_image_surface_get_width(image);
@@ -1351,10 +1356,13 @@ panel_add_launchers(struct panel *panel, struct desktop *desktop)
}
if (count == 0) {
+ char *name = file_name_with_datadir("terminal.png");
+
/* add default launcher */
panel_add_launcher(panel,
- DATADIR "/weston/terminal.png",
+ name,
BINDIR "/weston-terminal");
+ free(name);
}
}
diff --git a/clients/ivi-shell-user-interface.c b/clients/ivi-shell-user-interface.c
index f4e061d0..a38d6af8 100644
--- a/clients/ivi-shell-user-interface.c
+++ b/clients/ivi-shell-user-interface.c
@@ -43,6 +43,7 @@
#include "shared/os-compatibility.h"
#include "shared/xalloc.h"
#include "shared/zalloc.h"
+#include "shared/file-util.h"
#include "ivi-application-client-protocol.h"
#include "ivi-hmi-controller-client-protocol.h"
@@ -1076,6 +1077,7 @@ hmi_homescreen_setting_create(void)
const char *name = NULL;
uint32_t workspace_layer_id;
uint32_t icon_surface_id = 0;
+ char *filename;
wl_list_init(&setting->workspace_list);
wl_list_init(&setting->launcher_list);
@@ -1095,51 +1097,65 @@ hmi_homescreen_setting_create(void)
weston_config_section_get_uint(
shellSection, "workspace-layer-id", &workspace_layer_id, 3000);
+ filename = file_name_with_datadir("background.png");
weston_config_section_get_string(
shellSection, "background-image", &setting->background.filePath,
- DATADIR "/weston/background.png");
+ filename);
+ free(filename);
weston_config_section_get_uint(
shellSection, "background-id", &setting->background.id, 1001);
+ filename = file_name_with_datadir("panel.png");
weston_config_section_get_string(
shellSection, "panel-image", &setting->panel.filePath,
- DATADIR "/weston/panel.png");
+ filename);
+ free(filename);
weston_config_section_get_uint(
shellSection, "panel-id", &setting->panel.id, 1002);
+ filename = file_name_with_datadir("tiling.png");
weston_config_section_get_string(
shellSection, "tiling-image", &setting->tiling.filePath,
- DATADIR "/weston/tiling.png");
+ filename);
+ free(filename);
weston_config_section_get_uint(
shellSection, "tiling-id", &setting->tiling.id, 1003);
+ filename = file_name_with_datadir("sidebyside.png");
weston_config_section_get_string(
shellSection, "sidebyside-image", &setting->sidebyside.filePath,
- DATADIR "/weston/sidebyside.png");
+ filename);
+ free(filename);
weston_config_section_get_uint(
shellSection, "sidebyside-id", &setting->sidebyside.id, 1004);
+ filename = file_name_with_datadir("fullscreen.png");
weston_config_section_get_string(
shellSection, "fullscreen-image", &setting->fullscreen.filePath,
- DATADIR "/weston/fullscreen.png");
+ filename);
+ free(filename);
weston_config_section_get_uint(
shellSection, "fullscreen-id", &setting->fullscreen.id, 1005);
+ filename = file_name_with_datadir("random.png");
weston_config_section_get_string(
shellSection, "random-image", &setting->random.filePath,
- DATADIR "/weston/random.png");
+ filename);
+ free(filename);
weston_config_section_get_uint(
shellSection, "random-id", &setting->random.id, 1006);
+ filename = file_name_with_datadir("home.png");
weston_config_section_get_string(
shellSection, "home-image", &setting->home.filePath,
- DATADIR "/weston/home.png");
+ filename);
+ free(filename);
weston_config_section_get_uint(
shellSection, "home-id", &setting->home.id, 1007);
diff --git a/libweston/compositor-x11.c b/libweston/compositor-x11.c
index fd948540..a1d21270 100644
--- a/libweston/compositor-x11.c
+++ b/libweston/compositor-x11.c
@@ -56,6 +56,7 @@
#include "shared/helpers.h"
#include "shared/image-loader.h"
#include "shared/timespec-util.h"
+#include "shared/file-util.h"
#include "gl-renderer.h"
#include "weston-egl-ext.h"
#include "pixman-renderer.h"
@@ -911,6 +912,7 @@ x11_output_enable(struct weston_output *base)
xcb_screen_t *screen;
struct wm_normal_hints normal_hints;
struct wl_event_loop *loop;
+ char *icon_filename;
int ret;
uint32_t mask = XCB_CW_EVENT_MASK | XCB_CW_CURSOR;
@@ -991,7 +993,9 @@ x11_output_enable(struct weston_output *base)
b->atom.wm_class, b->atom.string, 8,
sizeof class, class);
- x11_output_set_icon(b, output, DATADIR "/weston/wayland.png");
+ icon_filename = file_name_with_datadir("wayland.png");
+ x11_output_set_icon(b, output, icon_filename);
+ free(icon_filename);
x11_output_set_wm_protocols(b, output);
diff --git a/shared/frame.c b/shared/frame.c
index dc7ff85c..acac2ca8 100644
--- a/shared/frame.c
+++ b/shared/frame.c
@@ -34,6 +34,7 @@
#include <linux/input.h>
#include "cairo-util.h"
+#include "shared/file-util.h"
enum frame_button_flags {
FRAME_BUTTON_ALIGN_RIGHT = 0x1,
@@ -357,41 +358,65 @@ frame_create(struct theme *t, int32_t width, int32_t height, uint32_t buttons,
FRAME_STATUS_MENU,
FRAME_BUTTON_CLICK_DOWN);
} else {
+ char *name = file_name_with_datadir("icon_window.png");
+
+ if (!name)
+ goto free_frame;
+
button = frame_button_create(frame,
- DATADIR "/weston/icon_window.png",
+ name,
FRAME_STATUS_MENU,
FRAME_BUTTON_CLICK_DOWN);
+ free(name);
}
if (!button)
goto free_frame;
}
if (buttons & FRAME_BUTTON_CLOSE) {
+ char *name = file_name_with_datadir("sign_close.png");
+
+ if (!name)
+ goto free_frame;
+
button = frame_button_create(frame,
- DATADIR "/weston/sign_close.png",
+ name,
FRAME_STATUS_CLOSE,
FRAME_BUTTON_ALIGN_RIGHT |
FRAME_BUTTON_DECORATED);
+ free(name);
if (!button)
goto free_frame;
}
if (buttons & FRAME_BUTTON_MAXIMIZE) {
+ char *name = file_name_with_datadir("sign_maximize.png");
+
+ if (!name)
+ goto free_frame;
+
button = frame_button_create(frame,
- DATADIR "/weston/sign_maximize.png",
+ name,
FRAME_STATUS_MAXIMIZE,
FRAME_BUTTON_ALIGN_RIGHT |
FRAME_BUTTON_DECORATED);
+ free(name);
if (!button)
goto free_frame;
}
if (buttons & FRAME_BUTTON_MINIMIZE) {
+ char *name = file_name_with_datadir("sign_minimize.png");
+
+ if (!name)
+ goto free_frame;
+
button = frame_button_create(frame,
- DATADIR "/weston/sign_minimize.png",
+ name,
FRAME_STATUS_MINIMIZE,
FRAME_BUTTON_ALIGN_RIGHT |
FRAME_BUTTON_DECORATED);
+ free(name);
if (!button)
goto free_frame;
}