[Spice-devel] [PATCH spice-gtk v4 2/6] gtk: Use gdk_window_get_device_position

Pavel Grunt pgrunt at redhat.com
Fri Feb 17 08:04:15 UTC 2017


On Thu, 2017-02-16 at 17:13 +0100, Christophe Fergeau wrote:
> On Thu, Feb 16, 2017 at 05:05:49PM +0100, Christophe Fergeau wrote:
> > On Tue, Feb 14, 2017 at 07:05:14PM +0100, Pavel Grunt wrote:
> > > gdk_window_get_pointer has been deprecated since Gtk 3.0
> > > 
> > > Introduce helper functions for getting the display's pointing
> > > device and modifiers to keep the update_mouse_mode simple
> > > ---
> > >  src/spice-widget.c | 42 ++++++++++++++++++++++++++++++++-------
> > > ---
> > >  1 file changed, 32 insertions(+), 10 deletions(-)
> > > 
> > > diff --git a/src/spice-widget.c b/src/spice-widget.c
> > > index 7678c12..c39373c 100644
> > > --- a/src/spice-widget.c
> > > +++ b/src/spice-widget.c
> > > @@ -2361,11 +2361,40 @@ static void
> > > spice_display_class_init(SpiceDisplayClass *klass)
> > >  #define SPICE_GDK_BUTTONS_MASK \
> > >      (GDK_BUTTON1_MASK|GDK_BUTTON2_MASK|GDK_BUTTON3_MASK|GDK_BUT
> > > TON4_MASK|GDK_BUTTON5_MASK)
> > >  
> > > +static GdkDevice *gdk_window_get_pointing_device(GdkWindow
> > > *window)
> > 
> > Probably best if we use our own namespace here
> > (spice_gdk_window_xxx)
ok

> > 
> > > +{
> > > +    GdkDisplay *gdk_display = gdk_window_get_display(window);
> > > +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> > > +#if GTK_CHECK_VERSION(3, 20, 0)
> > > +    return
> > > gdk_seat_get_pointer(gdk_display_get_default_seat(gdk_display));
> > > +#else
> > > +    return
> > > gdk_device_manager_get_client_pointer(gdk_display_get_device_man
> > > ager(gdk_display));
> > > +#endif
> > > +    G_GNUC_END_IGNORE_DEPRECATIONS
> > 
> > Do we still need the G_GNUC_{BEGIN,END}_IGNORE_DEPRECATIONS
> > guards?
> 
> I think I got it, on gtk+ >= 3.20, we are going to get a warning
> because
> we are using a too new gtk API, and these warnings are emitted as
> deprecation  warnings, which is confusing :(

Yes

Thanks,
Pavel

> 
> Christophe


More information about the Spice-devel mailing list