GNOME Bugzilla – Bug 647467
x11: Use the aliases previously added in x11.vapi
Last modified: 2018-05-22 14:00:38 UTC
Created attachment 185725 [details] [review] use-aliases.patch After adding the symbolic names for X's data types (#647464), the attached patch changes x11.vapi to use them. Please note that this changes the signature of several functions, so merging this patch *will probably break* existing programs. But since most of these functions have only been available for a short while, I thought it may be worth it. A compromise could be to only change the new functions and leave out these which have already been in a stable release. What do you think?
Created attachment 206777 [details] [review] Patch I've attached an updated and ready to apply version of the original patch.
Created attachment 206779 [details] ConvertTest.vala This is a simple test case for converting strings, KeySyms and KeyCodes.
Review of attachment 206777 [details] [review]: This would be an API break. We could get around the problem for return and out variables if those symbolic names used inheritance (make KeySym inherit from ulong, Cursor from uint, etc.), but it would still break in arguments... I don't see a straightforward way to keep something like this working: ulong k_lower, k_upper; ulong ksym = string_to_keysym ("A"); convert_case (ksym, out k_lower, out k_upper); That said, I would be willing to accept a patch which deprecates the old methods and replaces them with something else. With some [CCode (instance_pos = ...)] annotations, you could do something like this: Display.get_keyboard_mapping -> KeyCode.get_keyboard_mapping Display.grab_button -> Window.grab_button Display.grab_pointer -> Window.grab_pointer Display.keysym_to_keycode -> Keysym.to_keycode string_to_keysym -> KeySym.parse keysym_to_string -> KeySym.to_string I think it would be really nice to clean out Display in general, but if we do that we should definitely take advantage of the opportunity to change the API.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/192.