[PATCH weston 1/2] xwm: Use cursor theme and size in weston.ini

Pekka Paalanen ppaalanen at gmail.com
Tue Aug 19 06:24:01 PDT 2014


On Sun,  6 Jul 2014 11:44:57 +0800
Boyan Ding <stu_dby at 126.com> wrote:

> to make it consistent with native wayland apps
> 
> Signed-off-by: Boyan Ding <stu_dby at 126.com>
> ---
>  xwayland/window-manager.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
> index 2fb65b1..f64ef94 100644
> --- a/xwayland/window-manager.c
> +++ b/xwayland/window-manager.c
> @@ -38,6 +38,7 @@
>  
>  #include "cairo-util.h"
>  #include "compositor.h"
> +#include "config-parser.h"
>  #include "hash.h"
>  
>  struct wm_size_hints {
> @@ -269,22 +270,24 @@ xcb_cursor_images_load_cursor(struct weston_wm *wm, const XcursorImages *images)
>  static xcb_cursor_t
>  xcb_cursor_library_load_cursor(struct weston_wm *wm, const char *file)
>  {
> +	struct weston_config *config;
> +	struct weston_config_section *s;
>  	xcb_cursor_t cursor;
>  	XcursorImages *images;
> -	char *v = NULL;
> +	char *theme = NULL;
>  	int size = 0;
>  
>  	if (!file)
>  		return 0;
>  
> -	v = getenv ("XCURSOR_SIZE");
> -	if (v)
> -		size = atoi(v);
> +	config = weston_config_parse("weston.ini");
> +	s = weston_config_get_section(config, "shell", NULL, NULL);
> +	weston_config_section_get_string(s, "cursor-theme", &theme, NULL);
> +	weston_config_section_get_int(s, "cursor-size", &size, 32);
> +	weston_config_destroy(config);
>  
> -	if (!size)
> -		size = 32;
> -
> -	images = XcursorLibraryLoadImages (file, NULL, size);
> +	images = XcursorLibraryLoadImages (file, theme, size);
> +	free(theme);
>  	if (!images)
>  		return -1;
>  

Hi,

looks ok, but could you re-spin this so that you do not call
weston_config_parse() but use the already parsed
weston_compositor::config?

For an example, see 673a889fd88a70a9308d29bd6574f7c8c67da68d.


Thanks,
pq


More information about the wayland-devel mailing list