[Spice-devel] [PATCH spice-gtk v5 4/5] Remove warning about unused variable when building on macOS
Frediano Ziglio
fziglio at redhat.com
Wed May 31 08:15:27 UTC 2017
>
> On Tue, May 30, 2017 at 09:36:07AM -0400, Frediano Ziglio wrote:
> > >
> > > From: Christophe de Dinechin <dinechin at redhat.com>
> > >
> > > On macOS, neither of the two cases implemented in set_mouse_accel
> > > applies.
> > > We get the following eror message:
> > >
> > > CC spice-widget.lo
> > > spice-widget.c:944:26: error: unused variable 'd'
> > > [-Werror,-Wunused-variable]
> > > SpiceDisplayPrivate *d = display->priv;
> > >
> > > Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
> > > ---
> > > src/spice-widget.c | 7 ++++---
> > > 1 file changed, 4 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/src/spice-widget.c b/src/spice-widget.c
> > > index 1a1d5a6..a2f3e30 100644
> > > --- a/src/spice-widget.c
> > > +++ b/src/spice-widget.c
> > > @@ -941,9 +941,8 @@ static void update_keyboard_grab(SpiceDisplay
> > > *display)
> > >
> > > static void set_mouse_accel(SpiceDisplay *display, gboolean enabled)
> > > {
> > > - SpiceDisplayPrivate *d = display->priv;
> > > -
> > > #if defined GDK_WINDOWING_X11
> > > + SpiceDisplayPrivate *d = display->priv;
> > > GdkWindow *w =
> > > GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display)));
> > >
> > > if (!GDK_IS_X11_DISPLAY(gdk_window_get_display(w))) {
> > > @@ -965,6 +964,7 @@ static void set_mouse_accel(SpiceDisplay *display,
> > > gboolean enabled)
> > > d->x11_accel_numerator, d->x11_accel_denominator,
> > > d->x11_threshold);
> > > }
> > > #elif defined GDK_WINDOWING_WIN32
> > > + SpiceDisplayPrivate *d = display->priv;
> > > if (enabled) {
> > > g_return_if_fail(SystemParametersInfo(SPI_SETMOUSE, 0,
> > > &d->win_mouse, 0));
> > > g_return_if_fail(SystemParametersInfo(SPI_SETMOUSESPEED, 0,
> > > (PVOID)(INT_PTR)d->win_mouse_speed, 0));
> > > @@ -976,6 +976,7 @@ static void set_mouse_accel(SpiceDisplay *display,
> > > gboolean enabled)
> > > g_return_if_fail(SystemParametersInfo(SPI_SETMOUSESPEED, 0,
> > > (PVOID)10, SPIF_SENDCHANGE)); // default
> > > }
> > > #else
> > > + /* TODO: Add mouse accelaration for macOS */
> > > g_warning("Mouse acceleration code missing for your platform");
>
> I still don't think that replacing a compile-time warning about some
> place needing attention with a TODO + runtime warning is very useful as
> you are just making it less visible.
>
It's true, on the other way all this patch is supposed to fix
a warning considered error for -Werror.
The other way is remove -Werror and keep the warning (don't know
if possible to do for just a set of lines).
> > > #endif
> > > }
> > > @@ -1616,7 +1617,7 @@ static gboolean key_event(GtkWidget *widget,
> > > GdkEventKey *key)
> > >
> > > if (key->keyval == GDK_KEY_Pause
> > > #ifdef G_OS_WIN32
> > > - /* for some reason GDK does not fill keyval for VK_PAUSE
> > > + /* for some reason GDK does not fill keyval for VK_PAUSE
> > > * See https://bugzilla.gnome.org/show_bug.cgi?id=769214
> > > */
> > > || key->hardware_keycode == VK_PAUSE
> >
> > Spurious space change.
> >
> > Otherwise,
> >
> > Acked-by: Frediano Ziglio <fziglio at redhat.com>
>
>
> Ok.
>
> Christophe
>
Frediano
More information about the Spice-devel
mailing list