Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sdl2 system cursors #5308

Merged
merged 2 commits into from Aug 13, 2017
Merged

Add sdl2 system cursors #5308

merged 2 commits into from Aug 13, 2017

Conversation

Bakterija
Copy link
Contributor

@Bakterija Bakterija commented Jul 29, 2017

Hello.
I have tested kivy with sdl2 system cursors on windows, ubuntu, android 4.4 and everything works very nicely. I would like to share it with other people.

This commit adds necessary structs from SDL2 and a set_system_cursor method for kivy window where you can replace your app cursor.

@KeyWeeUsr
Copy link
Contributor

Seems nice! If no one shows for testing, I'll look into it soon-ish.

@KeyWeeUsr
Copy link
Contributor

Everything except wait_arrow works just fine. Does it work for you? Share a screenshot, please.

@@ -732,6 +732,19 @@ def _get_focus(self):
def _set_cursor_state(self, value):
pass

def set_system_cursor(self, cursor_name):
'''Set cursor to a SDL_SystemCursor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run the docstring e.g. through http://rst.ninjs.org and fix the formatting, please :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what you want to fix, it looks like other kivy docstrings.

@Bakterija
Copy link
Contributor Author

Wait arrow is a crosshair for me. It depends on platform.

@KeyWeeUsr
Copy link
Contributor

Yes, it depends on a platform, but neither of those should return a crosshair. See windows, wayland, cocoa/mac, x11, docs :)

I think you ran an example like this:

from kivy.app import runTouchApp
from kivy.lang import Builder
runTouchApp(Builder.load_string('''
#:import win kivy.core.window.Window

GridLayout:
    cols: 4
    Button:
        text:  'arrow'
        on_release: win.set_system_cursor('arrow')
    Button:
        text:  'ibeam'
        on_release: win.set_system_cursor('ibeam')
    Button:
        text: 'wait'
        on_release: win.set_system_cursor('wait')
    Button:
        text: 'crosshair'
        on_release: win.set_system_cursor('crosshair')
    Button:
        text: 'wait_arrow'
        on_release: win.set_system_cursor('wait_arrow')
    Button:
        text: 'size_nwse'
        on_release: win.set_system_cursor('size_nwse')
    Button:
        text: 'size_nesw'
        on_release: win.set_system_cursor('size_nesw')
    Button:
        text: 'size_we'
        on_release: win.set_system_cursor('size_we')
    Button:
        text: 'size_ns'
        on_release: win.set_system_cursor('size_ns')
    Button:
        text: 'size_all'
        on_release: win.set_system_cursor('size_all')
    Button:
        text: 'hand'
        on_release: win.set_system_cursor('hand')
    Button:
        text: 'no'
        on_release: win.set_system_cursor('no')
'''))

and changed the icons one after another. Try to press only the wait_arrow button and nothing else and see if it even changes the icon. It doesn't for me on windows and that one uses the latest stable SDL2, which probably means it's an upstream bug, I guess.

If you have the same result, it might be a good idea to include a note about that.

@KeyWeeUsr KeyWeeUsr merged commit 4deb360 into master Aug 13, 2017
@KeyWeeUsr KeyWeeUsr deleted the sdl2_cursors branch August 13, 2017 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants