Skip to content

Commit

Permalink
Wayland: use CROSSHAIR not MOUSE cursor.
Browse files Browse the repository at this point in the history
Attempting to use Gdk.CursorType.MOUSE raises an exception on Wayland,
and it's horribly ugly with X11 scaled cursors.

Catch and log any exceptions when this happens, for some robustness.

Update copyright statement.

Fixes #809.
  • Loading branch information
achadwick committed Jun 10, 2017
1 parent 48e30b3 commit cf14342
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions gui/buttonmap.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is part of MyPaint.
# Copyright (C) 2012 by Andrew Chadwick <a.t.chadwick@gmail.com>
# Copyright (C) 2012-2017 by Andrew Chadwick <a.t.chadwick@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -12,6 +12,7 @@
from __future__ import division, print_function

from gettext import gettext as _
import logging

from gi.repository import Gtk
from gi.repository import Gdk
Expand All @@ -21,6 +22,8 @@
import lib.xml
import widgets

logger = logging.getLogger(__name__)


def button_press_name(button, mods):
"""Converts button number & modifier mask to a prefs-storable string.
Expand Down Expand Up @@ -540,9 +543,12 @@ def _bp_edit_dialog_set_standard_hint(self, dialog):

def _bp_edit_box_enter_cb(self, evbox, event):
window = evbox.get_window()
cursor = Gdk.Cursor.new_for_display(
window.get_display(), Gdk.CursorType.MOUSE)
window.set_cursor(cursor)
disp = window.get_display()
try: # Wayland themes are a bit incomplete
cursor = Gdk.Cursor.new_for_display(disp, Gdk.CursorType.CROSSHAIR)
window.set_cursor(cursor)
except:
logger.exception("Cursor setting failed") # and otherwise ignore

def _bp_edit_dialog_response_cb(self, dialog, response_id, editable):
if response_id == Gtk.ResponseType.OK:
Expand Down

0 comments on commit cf14342

Please sign in to comment.