[PATCH] scanner: allow referencing foreign enums
It's already possible to reference foreign interfaces, so it should also be possible to reference foreign enums. Signed-off-by: Simon Ser--- src/scanner.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/scanner.c b/src/scanner.c index 1737911..205c28a 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -894,14 +894,9 @@ verify_arguments(struct parse_context *ctx, e = find_enumeration(ctx->protocol, interface, a->enumeration_name); - if (e == NULL) - fail(>loc, -"could not find enumeration %s", -a->enumeration_name); - switch (a->type) { case INT: - if (e->bitfield) + if (e && e->bitfield) fail(>loc, "bitfield-style enum must only be referenced by uint"); break; -- 2.17.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] log: improve handling of use-before-init
Any takers to accept this one? On Fri, May 4, 2018 at 9:26 AM, Matt Hoosierwrote: > Rather than segfaulting by attempting to traverse an initially > null log handler pointer, explicitly print a message and abort. > > Signed-off-by: Matt Hoosier > --- > libweston/log.c | 22 -- > 1 file changed, 20 insertions(+), 2 deletions(-) > > diff --git a/libweston/log.c b/libweston/log.c > index 7d99a95d..c21f25e9 100644 > --- a/libweston/log.c > +++ b/libweston/log.c > @@ -36,8 +36,26 @@ > > #include "compositor.h" > > -static log_func_t log_handler = 0; > -static log_func_t log_continue_handler = 0; > +static int default_log_handler(const char *fmt, va_list ap); > + > +static log_func_t log_handler = default_log_handler; > +static log_func_t log_continue_handler = default_log_handler; > + > +/** Sentinel log message handler > + * > + * This function is used as the default handler for log messages. It > + * exists only to issue a noisy reminder to the user that a real handler > + * must be installed prior to issuing logging calls. The process is > + * immediately aborted after the reminder is printed. > + * > + * \param fmt The format string. Ignored. > + * \param va The variadic argument list. Ignored. > + */ > +static int default_log_handler(const char *fmt, va_list ap) > +{ > +fprintf(stderr, "weston_log_set_handler() must be called before > using of weston_log().\n"); > +abort(); > +} > > /** Install the log handler > * > -- > 2.13.6 > > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] rdp-compositor: fix compilation against last FreeRDP 2.0
On Thu, 24 May 2018 14:55:20 +0200 David Fortwrote: > The SURFACE_BITS_COMMAND struct has changed and some members have been moved > in the > bmp field. > --- > configure.ac | 5 ++- > libweston/compositor-rdp.c | 69 -- > 2 files changed, 48 insertions(+), 26 deletions(-) > > diff --git a/configure.ac b/configure.ac > index da3f7342..f4450532 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -264,10 +264,13 @@ if test x$enable_rdp_compositor = xyes; then > [], > [PKG_CHECK_MODULES(RDP_COMPOSITOR, [freerdp >= 1.1.0],[])] >) > - >SAVED_CPPFLAGS="$CPPFLAGS" >CPPFLAGS="$CPPFLAGS $RDP_COMPOSITOR_CFLAGS" > + >AC_CHECK_HEADERS([freerdp/version.h]) > + > AC_CHECK_MEMBER([SURFACE_BITS_COMMAND.bmp],[have_bmp=1],[have_bmp=0],[[#include > ]]) > + AC_DEFINE([HAVE_SURFACE_BITS_BMP], $have_bmp, [SURFACE_BITS_CMD has bmp > field]) > + >CPPFLAGS="$SAVED_CPPFLAGS" > fi > Hi, with freerdp-2.0.0_rc1, this results in the following and tons more: /home/pq/git/weston/libweston/compositor-rdp.c: In function ‘rdp_peer_refresh_rfx’: /home/pq/git/weston/libweston/compositor-rdp.c:70:29: error: ‘SURFACE_BITS_COMMAND {aka struct _SURFACE_BITS_COMMAND}’ has no member named ‘bmp’; did you mean ‘bpp’? #define SURFACE_BPP(cmd) cmd->bmp.bpp ^ /home/pq/git/weston/libweston/compositor-rdp.c:219:2: note: in expansion of macro ‘SURFACE_BPP’ SURFACE_BPP(cmd) = 32; However, configure says: checking for SURFACE_BITS_COMMAND.bmp... no But config.h contains: /* SURFACE_BITS_CMD has bmp field */ #define HAVE_SURFACE_BITS_BMP $have_bmp So, something to fix. :-) > diff --git a/libweston/compositor-rdp.c b/libweston/compositor-rdp.c > index 693f136a..6e70b303 100644 > --- a/libweston/compositor-rdp.c > +++ b/libweston/compositor-rdp.c > @@ -66,6 +66,22 @@ > #define FREERDP_CB_RETURN(V) return TRUE > #endif > > +#ifdef HAVE_SURFACE_BITS_BMP > +#define SURFACE_BPP(cmd) cmd->bmp.bpp > +#define SURFACE_CODECID(cmd) cmd->bmp.codecID > +#define SURFACE_WIDTH(cmd) cmd->bmp.width > +#define SURFACE_HEIGHT(cmd) cmd->bmp.height > +#define SURFACE_BITMAP_DATA(cmd) cmd->bmp.bitmapData > +#define SURFACE_BITMAP_DATA_LEN(cmd) cmd->bmp.bitmapDataLength > +#else > +#define SURFACE_BPP(cmd) cmd->bpp > +#define SURFACE_CODECID(cmd) cmd->codecID > +#define SURFACE_WIDTH(cmd) cmd->width > +#define SURFACE_HEIGHT(cmd) cmd->height > +#define SURFACE_BITMAP_DATA(cmd) cmd->bitmapData > +#define SURFACE_BITMAP_DATA_LEN(cmd) cmd->bitmapDataLength > +#endif Phuyuck, but I guess it cannot be helped. Shouldn't 'cmd' in the expansion be in parentheses? Thanks, pq pgpQoM6C_bB8k.pgp Description: OpenPGP digital signature ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput] touchpad: replace the hardcoded thumb threshold with a udev prop
LIBINPUT_ATTR_THUMB_PRESSURE_THRESHOLD now determines whether we do thumb pressure detection or not. Much better than having a hardcoded default that may or may not be correct on any given device. This patch is likely to break thumb detection on some touchpads, the only property so far is to restore the default of 100 for all Lenovo Thinkpad touchpads. More rules are needed, we'll just wait until someone shouts. https://bugs.freedesktop.org/show_bug.cgi?id=106458 Signed-off-by: Peter Hutterer--- src/evdev-mt-touchpad.c| 37 +++-- src/libinput-util.c| 25 + src/libinput-util.h| 1 + udev/90-libinput-model-quirks.hwdb | 4 4 files changed, 53 insertions(+), 14 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 02b75531..33c52ba4 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -3041,6 +3041,25 @@ tp_init_sendevents(struct tp_dispatch *tp, tp_keyboard_timeout, tp); } +static int +tp_read_thumb_pressure_prop(struct tp_dispatch *tp, + const struct evdev_device *device) +{ + struct udev_device *udev_device = device->udev_device; + const char *prop; + int threshold; + const int default_thumb_threshold = 0; + + prop = udev_device_get_property_value(udev_device, + "LIBINPUT_ATTR_THUMB_PRESSURE_THRESHOLD"); + if (!prop) + return default_thumb_threshold; + + threshold = parse_thumb_pressure_property(prop); + + return threshold > 0 ? threshold : default_thumb_threshold; +} + static void tp_init_thumb(struct tp_dispatch *tp) { @@ -3049,8 +3068,7 @@ tp_init_thumb(struct tp_dispatch *tp) double w = 0.0, h = 0.0; struct device_coords edges; struct phys_coords mm = { 0.0, 0.0 }; - int xres, yres; - double threshold; + int threshold; if (!tp->buttons.is_clickpad) return; @@ -3079,20 +3097,11 @@ tp_init_thumb(struct tp_dispatch *tp) if (!abs) goto out; - if (abs->maximum - abs->minimum < 255) + threshold = tp_read_thumb_pressure_prop(tp, device); + if (threshold == 0) goto out; - /* Our reference touchpad is the T440s with 42x42 resolution. -* Higher-res touchpads exhibit higher pressure for the same -* interaction. On the T440s, the threshold value is 100, you don't -* reach that with a normal finger interaction. -* Note: "thumb" means massive touch that should not interact, not -* "using the tip of my thumb for a pinch gestures". -*/ - xres = tp->device->abs.absinfo_x->resolution; - yres = tp->device->abs.absinfo_y->resolution; - threshold = 100.0 * hypot(xres, yres)/hypot(42, 42); - tp->thumb.threshold = max(100, threshold); + tp->thumb.threshold = threshold; out: evdev_log_debug(device, diff --git a/src/libinput-util.c b/src/libinput-util.c index 80ed489a..eb6e3ecf 100644 --- a/src/libinput-util.c +++ b/src/libinput-util.c @@ -456,6 +456,31 @@ parse_palm_size_property(const char *prop) return thr; } +/** + * Helper function to parse the LIBINPUT_ATTR_THUMB_PRESSURE_THRESHOLD + * property from udev. Property is of the form: + * LIBINPUT_ATTR_THUMB_PRESSURE_THRESHOLD= + * Where the number indicates the minimum threshold to consider a touch to + * be a thumb. + * + * @param prop The value of the udev property (without the + * LIBINPUT_ATTR_THUMB_PRESSURE_THRESHOLD=) + * @return The pressure threshold or 0 on error + */ +int +parse_thumb_pressure_property(const char *prop) +{ + int threshold = 0; + + if (!prop) + return 0; + + if (!safe_atoi(prop, ) || threshold < 0) + return 0; + +return threshold; +} + /** * Return the next word in a string pointed to by state before the first * separator character. Call repeatedly to tokenize a whole string. diff --git a/src/libinput-util.h b/src/libinput-util.h index c6759718..92e7cf73 100644 --- a/src/libinput-util.h +++ b/src/libinput-util.h @@ -419,6 +419,7 @@ bool parse_calibration_property(const char *prop, float calibration[6]); bool parse_range_property(const char *prop, int *hi, int *lo); int parse_palm_pressure_property(const char *prop); int parse_palm_size_property(const char *prop); +int parse_thumb_pressure_property(const char *prop); enum tpkbcombo_layout { TPKBCOMBO_LAYOUT_UNKNOWN, diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb index e3ba8929..a066dbde 100644 --- a/udev/90-libinput-model-quirks.hwdb +++ b/udev/90-libinput-model-quirks.hwdb @@ -251,6 +251,10 @@ libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*:pvrThinkPadX1Carbon3rd LIBINPUT_MODEL_LENOVO_T450_TOUCHPAD=1
Re: [PATCH weston v2] ivi-shell: use install paths in example config
On Thu, 24 May 2018 17:08:47 +0200, Emre Ucan wrote: > The example weston.ini file uses source and build > directory paths. Therefore, it is only useful when > used on the same system that is used to build Weston. > > We can use install paths instead of build/source paths > to fix this problem. > > v2 changes: > - use $(westondatadir) instead of $(datadir) > > Reported-by: Michael Tretter> Signed-off-by: Emre Ucan Reviewed-by: Michael Tretter Thanks Michael > --- > Makefile.am | 4 +--- > ivi-shell/weston.ini.in | 60 > - > 2 files changed, 31 insertions(+), 33 deletions(-) > > diff --git a/Makefile.am b/Makefile.am > index 69ca6cb..819c9c9 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -24,10 +24,8 @@ weston.ini : $(srcdir)/weston.ini.in > ivi-shell/weston.ini : $(srcdir)/ivi-shell/weston.ini.in > $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ > -e 's|@bindir[@]|$(bindir)|g' \ > - -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \ > - -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \ > -e 's|@libexecdir[@]|$(libexecdir)|g' \ > - -e 's|@plugin_prefix[@]||g' \ > + -e 's|@westondatadir[@]|$(westondatadir)|g' \ > $< > $@ > > all-local : weston.ini ivi-shell/weston.ini > diff --git a/ivi-shell/weston.ini.in b/ivi-shell/weston.ini.in > index 3f11e1c..58cba54 100644 > --- a/ivi-shell/weston.ini.in > +++ b/ivi-shell/weston.ini.in > @@ -1,9 +1,9 @@ > [core] > -shell=@plugin_pre...@ivi-shell.so > -modules=@plugin_pre...@hmi-controller.so > +shell=ivi-shell.so > +modules=hmi-controller.so > > [ivi-shell] > -ivi-shell-user-interface=@abs_top_builddir@/weston-ivi-shell-user-interface > +ivi-shell-user-interface=@libexecdir@/weston-ivi-shell-user-interface > > #developermode=true > > @@ -19,20 +19,20 @@ application-layer-id=4000 > > transition-duration=300 > > -background-image=@abs_top_srcdir@/data/background.png > +background-image=@westondatadir@/background.png > background-id=1001 > -panel-image=@abs_top_srcdir@/data/panel.png > +panel-image=@westondatadir@/panel.png > panel-id=1002 > surface-id-offset=10 > -tiling-image=@abs_top_srcdir@/data/tiling.png > +tiling-image=@westondatadir@/tiling.png > tiling-id=1003 > -sidebyside-image=@abs_top_srcdir@/data/sidebyside.png > +sidebyside-image=@westondatadir@/sidebyside.png > sidebyside-id=1004 > -fullscreen-image=@abs_top_srcdir@/data/fullscreen.png > +fullscreen-image=@westondatadir@/fullscreen.png > fullscreen-id=1005 > -random-image=@abs_top_srcdir@/data/random.png > +random-image=@westondatadir@/random.png > random-id=1006 > -home-image=@abs_top_srcdir@/data/home.png > +home-image=@westondatadir@/home.png > home-id=1007 > workspace-background-color=0x9900 > workspace-background-id=2001 > @@ -43,59 +43,59 @@ path=@libexecdir@/weston-keyboard > [ivi-launcher] > workspace-id=0 > icon-id=4001 > -icon=@abs_top_srcdir@/data/icon_ivi_flower.png > -path=@abs_top_builddir@/weston-flower > +icon=@westondatadir@/icon_ivi_flower.png > +path=@bindir@/weston-flower > > [ivi-launcher] > workspace-id=0 > icon-id=4002 > -icon=@abs_top_srcdir@/data/icon_ivi_clickdot.png > -path=@abs_top_builddir@/weston-clickdot > +icon=@westondatadir@/icon_ivi_clickdot.png > +path=@bindir@/weston-clickdot > > [ivi-launcher] > workspace-id=1 > icon-id=4003 > -icon=@abs_top_srcdir@/data/icon_ivi_simple-egl.png > -path=@abs_top_builddir@/weston-simple-egl > +icon=@westondatadir@/icon_ivi_simple-egl.png > +path=@bindir@/weston-simple-egl > > [ivi-launcher] > workspace-id=1 > icon-id=4004 > -icon=@abs_top_srcdir@/data/icon_ivi_simple-shm.png > -path=@abs_top_builddir@/weston-simple-shm > +icon=@westondatadir@/icon_ivi_simple-shm.png > +path=@bindir@/weston-simple-shm > > [ivi-launcher] > workspace-id=2 > icon-id=4005 > -icon=@abs_top_srcdir@/data/icon_ivi_smoke.png > -path=@abs_top_builddir@/weston-smoke > +icon=@westondatadir@/icon_ivi_smoke.png > +path=@bindir@/weston-smoke > > [ivi-launcher] > workspace-id=3 > icon-id=4006 > -icon=@abs_top_srcdir@/data/icon_ivi_flower.png > -path=@abs_top_builddir@/weston-flower > +icon=@westondatadir@/icon_ivi_flower.png > +path=@bindir@/weston-flower > > [ivi-launcher] > workspace-id=3 > icon-id=4007 > -icon=@abs_top_srcdir@/data/icon_ivi_clickdot.png > -path=@abs_top_builddir@/weston-clickdot > +icon=@westondatadir@/icon_ivi_clickdot.png > +path=@bindir@/weston-clickdot > > [ivi-launcher] > workspace-id=3 > icon-id=4008 > -icon=@abs_top_srcdir@/data/icon_ivi_simple-egl.png > -path=@abs_top_builddir@/weston-simple-egl > +icon=@westondatadir@/icon_ivi_simple-egl.png > +path=@bindir@/weston-simple-egl > > [ivi-launcher] > workspace-id=3 > icon-id=4009 > -icon=@abs_top_srcdir@/data/icon_ivi_simple-shm.png > -path=@abs_top_builddir@/weston-simple-shm >