[virt-tools-list] [PATCH virt-manager] Do not use deprecated gdk_cursor_new
Cole Robinson
crobinso at redhat.com
Wed May 3 14:31:12 UTC 2017
On 05/03/2017 05:09 AM, Pavel Grunt wrote:
> It relies on the presence of X cursor fonts in the system. Use
> recommended gdk_cursor_new_from_name and use cursor names that works
> on different backends.
>
> Deprecated since Gdk 3.16
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1442612
> ---
> virtManager/asyncjob.py | 5 +++--
> virtManager/baseclass.py | 12 +++++++-----
> 2 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/virtManager/asyncjob.py b/virtManager/asyncjob.py
> index 0fd3beed..cbc872c4 100644
> --- a/virtManager/asyncjob.py
> +++ b/virtManager/asyncjob.py
> @@ -286,8 +286,9 @@ class vmmAsyncJob(vmmGObjectUI):
> self.topwin.present()
>
> if not self.cancel_cb and self.show_progress:
> - self.topwin.get_window().set_cursor(
> - Gdk.Cursor.new(Gdk.CursorType.WATCH))
> + gdk_window = self.topwin.get_window()
> + gdk_window.set_cursor(
> + Gdk.Cursor.new_from_name(gdk_window.get_display(), "progress"))
> self._bg_thread.start()
>
>
> diff --git a/virtManager/baseclass.py b/virtManager/baseclass.py
> index 7f3b7592..73b87fa7 100644
> --- a/virtManager/baseclass.py
> +++ b/virtManager/baseclass.py
> @@ -241,15 +241,17 @@ class vmmGObjectUI(vmmGObject):
>
> def set_finish_cursor(self):
> self.topwin.set_sensitive(False)
> - cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH)
> - self.topwin.get_window().set_cursor(cursor> + gdk_window = self.topwin.get_window()
> + cursor = Gdk.Cursor.new_from_name(gdk_window.get_display(), "progress")
> + gdk_window.set_cursor(cursor)
>
> def reset_finish_cursor(self, topwin=None):
> if not topwin:
> topwin = self.topwin
>
> topwin.set_sensitive(True)
> - if not topwin.get_window():
> + gdk_window = topwin.get_window()
> + if not gdk_window:
> return
> - cursor = Gdk.Cursor.new(Gdk.CursorType.TOP_LEFT_ARROW)
> - topwin.get_window().set_cursor(cursor)
> + cursor = Gdk.Cursor.new_from_name(gdk_window.get_display(), "default")
> + gdk_window.set_cursor(cursor)
>
Does using Gdk.Cursor.new_from_display() fix the issue as well? That way we
can still use the CursorType value, rather than hardcoded strings
Also is there an easy way to reproduce that bug? I couldn't hit it with stock
config
Thanks,
Cole
More information about the virt-tools-list
mailing list