Philipp Hörist pushed to branch master at gajim / gajim
Commits: 2745d3ce by Philipp Hörist at 2019-09-04T16:50:26Z Use cross-platform compatible cursors
see: https://lazka.github.io/pgi-docs/Gdk-3.0/classes/Cursor.html#Gdk.Cursor.new_...
Fixes #9800
- - - - - 0927655c by Philipp Hörist at 2019-09-04T16:51:13Z Remove unused import
- - - - -
5 changed files:
- gajim/chat_control.py - gajim/conversation_textview.py - gajim/gtk/htmltextview.py - gajim/gtk/util.py - gajim/privatechat_control.py
Changes:
===================================== gajim/chat_control.py ===================================== @@ -667,11 +667,11 @@ class ChatControl(ChatControlBase): """ Just moved the mouse so show the cursor """ - cursor = get_cursor('LEFT_PTR') + cursor = get_cursor('default') self.parent_win.window.get_window().set_cursor(cursor)
def on_location_eventbox_enter_notify_event(self, widget, event): - cursor = get_cursor('HAND2') + cursor = get_cursor('pointer') self.parent_win.window.get_window().set_cursor(cursor)
def update_ui(self):
===================================== gajim/conversation_textview.py ===================================== @@ -332,11 +332,11 @@ class ConversationTextview(GObject.GObject): if len(text) > 50: text = text[:47] + '…' tooltip.set_text(text) - window.set_cursor(get_cursor('HAND2')) + window.set_cursor(get_cursor('pointer')) self._cursor_changed = True return True if tag_name in ('url', 'mail', 'xmpp', 'sth_at_sth'): - window.set_cursor(get_cursor('HAND2')) + window.set_cursor(get_cursor('pointer')) self._cursor_changed = True return False try: @@ -346,7 +346,7 @@ class ConversationTextview(GObject.GObject): except KeyError: pass if self._cursor_changed: - window.set_cursor(get_cursor('XTERM')) + window.set_cursor(get_cursor('text')) self._cursor_changed = False return False
===================================== gajim/gtk/htmltextview.py ===================================== @@ -881,18 +881,18 @@ class HtmlTextView(Gtk.TextView): if len(text) > 50: text = text[:47] + '…' tooltip.set_text(text) - window.set_cursor(get_cursor('HAND2')) + window.set_cursor(get_cursor('pointer')) self._cursor_changed = True return True
tag_name = tag.get_property('name') if tag_name in ('url', 'mail', 'xmpp', 'sth_at_sth'): - window.set_cursor(get_cursor('HAND2')) + window.set_cursor(get_cursor('pointer')) self._cursor_changed = True return False
if self._cursor_changed: - window.set_cursor(get_cursor('XTERM')) + window.set_cursor(get_cursor('text')) self._cursor_changed = False return False
===================================== gajim/gtk/util.py ===================================== @@ -356,10 +356,12 @@ def get_completion_liststore(entry: Gtk.Entry) -> Gtk.ListStore: return liststore
-def get_cursor(attr: str) -> Gdk.Cursor: +def get_cursor(name: str) -> Gdk.Cursor: display = Gdk.Display.get_default() - cursor = getattr(Gdk.CursorType, attr) - return Gdk.Cursor.new_for_display(display, cursor) + cursor = Gdk.Cursor.new_from_name(display, name) + if cursor is not None: + return cursor + return Gdk.Cursor.new_from_name(display, 'default')
def scroll_to_end(widget: Gtk.ScrolledWindow) -> bool:
===================================== gajim/privatechat_control.py ===================================== @@ -24,8 +24,6 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see http://www.gnu.org/licenses/.
-from gi.repository import Gtk - from gajim import message_control
from gajim.common import app
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/c51e8498563fb99cfef68bf4ca8820bc3e...