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

2014-08-20 Thread Boyan Ding
On Wed, 2014-08-20 at 14:47 +0300, Pekka Paalanen wrote:
> Hi,
> 
> yeah, that's better, but I do wonder if that is actually what we want.
> I see that this changes the cursors only for the decorations, but not
> for the X11 apps themselves.
> 
> So before, I think the cursors on X11 apps and decors were the same,
> but did not match Wayland apps.
> 
> Now cursors on X11 app decors match the Wayland apps, but not the X11
> apps.
> 
> Is this wanted?
> 
> Or should this rather need more fixes, so that weston.ini settings
> would be reflected in the environment of the X11 apps? But then would
> that not overwrite the settings made in e.g. Gtk themes or such?
> 
> Should weston.ini settings be reflected in Xwayland at all, and if yes,
> what is the right way to accomplish that?
> 
> 
> Thanks,
> pq

Yeah, you are quite right. I didn't think carefully about that before.

The theme here only controls decoration and now I believe that it should
be consistent with X applications. But I don't know much about how
theming is done in X. I wrote this patch just because I found the
default cursor size (32) looks ridiculously large, the cursor size on my
machine is 24 elsewhere. I don't think it is right behavior but I wonder
how to correct it.

Thanks,
Boyan Ding


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


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

2014-08-20 Thread Pekka Paalanen
On Wed, 20 Aug 2014 17:46:58 +0800
Boyan Ding  wrote:

> to make it consistent with native wayland apps
> 
> v2: use the config in weston_compositor instead of reparsing weston.ini
> Signed-off-by: Boyan Ding 
> ---
>  xwayland/window-manager.c | 17 +
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
> index 6cac278..997153b 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,22 @@ 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 = wm->server->compositor->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);
> + 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);
>  
> - if (!size)
> - size = 32;
> -
> - images = XcursorLibraryLoadImages (file, NULL, size);
> + images = XcursorLibraryLoadImages (file, theme, size);
> + free(theme);
>   if (!images)
>   return -1;
>  

Hi,

yeah, that's better, but I do wonder if that is actually what we want.
I see that this changes the cursors only for the decorations, but not
for the X11 apps themselves.

So before, I think the cursors on X11 apps and decors were the same,
but did not match Wayland apps.

Now cursors on X11 app decors match the Wayland apps, but not the X11
apps.

Is this wanted?

Or should this rather need more fixes, so that weston.ini settings
would be reflected in the environment of the X11 apps? But then would
that not overwrite the settings made in e.g. Gtk themes or such?

Should weston.ini settings be reflected in Xwayland at all, and if yes,
what is the right way to accomplish that?


Thanks,
pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


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

2014-08-20 Thread Boyan Ding
to make it consistent with native wayland apps

v2: use the config in weston_compositor instead of reparsing weston.ini
Signed-off-by: Boyan Ding 
---
 xwayland/window-manager.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index 6cac278..997153b 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,22 @@ 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 = wm->server->compositor->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);
+   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);
 
-   if (!size)
-   size = 32;
-
-   images = XcursorLibraryLoadImages (file, NULL, size);
+   images = XcursorLibraryLoadImages (file, theme, size);
+   free(theme);
if (!images)
return -1;
 
-- 
2.0.4


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel