Skip to content

Commit

Permalink
#734: make sure we honour the fixed size cursors required by the plat…
Browse files Browse the repository at this point in the history
…form, if any.

git-svn-id: https://xpra.org/svn/Xpra/trunk@8090 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Nov 9, 2014
1 parent a585167 commit b6aa8a5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/xpra/client/gtk_base/gtk_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from xpra.client.gtk_base.gtk_keyboard_helper import GTKKeyboardHelper
from xpra.client.gtk_base.session_info import SessionInfo
from xpra.platform.paths import get_icon_filename
from xpra.platform.gui import system_bell, get_workarea
from xpra.platform.gui import system_bell, get_workarea, get_fixed_cursor_size

missing_cursor_names = set()

Expand Down Expand Up @@ -312,7 +312,14 @@ def make_cursor(self, cursor_data):
smax = cursor_data[10]
cursorlog("server cursor sizes: default=%s, max=%s", ssize, smax)
cursorlog("new cursor at %s,%s with serial=%s, dimensions: %sx%s, len(pixels)=%s, default cursor size is %s, maximum=%s", xhot,yhot, serial, w,h, len(pixels), csize, (cmaxw, cmaxh))
if w>cmaxw or h>cmaxh or (csize>0 and (csize<w or csize<h)):
fw, fh = get_fixed_cursor_size()
if fw>0 and fh>0 and (w!=fw or h!=fh):
#OS wants a fixed cursor size! (win32 does, and GTK doesn't do this for us)
cursorlog("scaling cursor from %ix%i to fixed OS size %ix%i", w, h, fw, fh)
pixbuf = pixbuf.scale_simple(fw, fh, INTERP_BILINEAR)
xratio, yratio = float(w)/fw, float(h)/fh
x, y = int(x/xratio), int(y/yratio)
elif w>cmaxw or h>cmaxh or (csize>0 and (csize<w or csize<h)):
ratio = max(float(w)/cmaxw, float(h)/cmaxh, float(max(w,h))/csize)
x, y, w, h = int(x/ratio), int(y/ratio), int(w/ratio), int(h/ratio)
cursorlog("downscaling cursor %s by %.2f: %sx%s", pixbuf, ratio, w, h)
Expand Down

0 comments on commit b6aa8a5

Please sign in to comment.