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

Gtk4 Support #19

Open
alex-eri opened this issue Jan 24, 2024 · 1 comment
Open

Gtk4 Support #19

alex-eri opened this issue Jan 24, 2024 · 1 comment

Comments

@alex-eri
Copy link

Test code

import gi
gi.require_version('Gtk', '4.0')
gi.require_version('Keybinder', '3.0')

from gi.repository import Gtk
from gi.repository import Keybinder

def callback(keystr, user_data):
	print( "Handling", keystr, user_data)
	print( "Event time:", Keybinder.get_current_event_time())
	Gtk.main_quit()

if __name__ == '__main__':
	keystr = "<Ctrl>A"
	Keybinder.init()
	Keybinder.bind(keystr, callback, "Keystring %s (user data)" % keystr)
	print( "Press", keystr, "to handle keybinding and quit")
	Gtk.main()

Exception

/mnt/home/eri/Projects/2024/AIS/kiosk-starter/~/Kiosk/test.py:15: Warning: cannot register existing type 'GdkDisplayManager'
  Keybinder.init()
/mnt/home/eri/Projects/2024/AIS/kiosk-starter/~/Kiosk/test.py:15: Warning: g_once_init_leave: assertion 'result != 0' failed
  Keybinder.init()
/mnt/home/eri/Projects/2024/AIS/kiosk-starter/~/Kiosk/test.py:15: Warning: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
  Keybinder.init()

Python 3.10
Ubuntu 22.04
libgtk-4-1 ver 4.6.9
libgtk-3-0 ver 3.24.33

@TingPing
Copy link

You can't load both Gtk3 and Gtk4 in the same process, so of course this will fail.

You have to modify keybinder to build against gtk4 if you want to test it: https://github.com/kupferlauncher/keybinder/blob/master/configure.ac#L61-L62

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

No branches or pull requests

2 participants