summaryrefslogtreecommitdiff
blob: 624c01ac0f292a2363e17f08854010656d655ab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From ee709d2722a75f11b5f6c9d7cd9b4a925107e54f Mon Sep 17 00:00:00 2001
From: Neui <neuisen@googlemail.com>
Date: Wed, 21 Apr 2021 01:58:40 +0200
Subject: [PATCH] Remove Gdk.Cursor.new depredation warnings

Gdk.Cursor.new has been replaced by Gdk.Cursor.new_for_display, which
needs an additional display.
It was only used to set the cursor on windows, which has an display
associated with it, so now it is created when needed rather than being
cached.
---
 GTG/gtk/editor/taskview.py                | 12 ++++++------
 GTG/plugins/unmaintained/tomboy/tomboy.py |  4 +++-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/GTG/gtk/editor/taskview.py b/GTG/gtk/editor/taskview.py
index 7f73fbb3..4b510499 100644
--- a/GTG/gtk/editor/taskview.py
+++ b/GTG/gtk/editor/taskview.py
@@ -74,10 +74,6 @@ class TaskView(Gtk.TextView):
     # Timeout in milliseconds
     PROCESSING_DELAY = 250
 
-    # Mouse cursors
-    CURSOR_HAND = Gdk.Cursor.new(Gdk.CursorType.HAND2)
-    CURSOR_NORMAL = Gdk.Cursor.new(Gdk.CursorType.XTERM)
-
 
     def __init__(self, req: Requester, clipboard) -> None:
         super().__init__()
@@ -601,7 +597,9 @@ class TaskView(Gtk.TextView):
         tags = view.get_iter_at_location(x, y)[1].get_tags()
 
         # Reset cursor and hover states
-        window.set_cursor(self.CURSOR_NORMAL)
+        cursor = Gdk.Cursor.new_for_display(window.get_display(),
+                                            Gdk.CursorType.XTERM)
+        window.set_cursor(cursor)
 
         if self.hovered_tag:
             try:
@@ -615,7 +613,9 @@ class TaskView(Gtk.TextView):
         try:
             tag = tags[0]
             tag.set_hover()
-            window.set_cursor(self.CURSOR_HAND)
+            cursor = Gdk.Cursor.new_for_display(window.get_display(),
+                                                Gdk.CursorType.HAND2)
+            window.set_cursor(cursor)
             self.hovered_tag = tag
 
         except (AttributeError, IndexError):
diff --git a/GTG/plugins/unmaintained/tomboy/tomboy.py b/GTG/plugins/unmaintained/tomboy/tomboy.py
index 33ec9264..28c4226a 100644
--- a/GTG/plugins/unmaintained/tomboy/tomboy.py
+++ b/GTG/plugins/unmaintained/tomboy/tomboy.py
@@ -337,6 +337,8 @@ class TomboyPlugin():
         # cursor changes to a hand
 
         def realize_callback(widget):
-            eventbox.window.set_cursor(Gdk.Cursor.new(Gdk.HAND2))
+            cursor = Gdk.Cursor.new_for_display(eventbox.window.get_display(),
+                                                Gdk.CursorType.HAND2)
+            eventbox.window.set_cursor(cursor)
         eventbox.connect("realize", realize_callback)
         return eventbox
-- 
2.30.0