-
Notifications
You must be signed in to change notification settings - Fork 7
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 support for the simpler functions in Xresources.h #5
base: master
Are you sure you want to change the base?
Conversation
Hi, thanks for the contribution!
|
Thanks for the quick reply. To your points:
I'm not sure I follow you here; it is required, (and is implemented). |
Let me elaborate a bit on So, I came up with a cache of objects in the Display, so that any time the typemap is trying to wrap a pointer, it checks the Display object's cache to see if that pointer was already wrapped. To make things a little more flexible I decided that I would represent the objects with a blessed hashref and then attach the C pointer with Magic. That gives me the option to store my own attributes in the object, like a flag whether the perl object should be in charge of freeing it. I managed to wrap up most of that in a reusable function. For the x resource managers, it is almost the same, but the pool of objects would need to be global instead of associated per-display. Most of the code can probably be re-used, and just need to add some kind of flag to tell it to look in the global pool. If you use a hashref for the objects, you could then add a flag that tracks whether it needs freed or not. Then you could set or unset that flag depending on which API calls the user makes. |
For the other points:
|
I think we're on the same page with this; I've implemented this.
I haven't had time to look through this yet.
That was exactly the problem. Thanks for the suggestion.
The initialization it performs is really minor. It creates a couple of entries in a hash table for fast string lookup, so the first time it is called there are some minor allocations, but after that calling it again is essentially a no-op. One approach may be to have it run from |
I completely reworked the way Xlib objects get their Magic assigned. Now they all get a struct of fields attached and we can add fields as needed. The objects no longer need to be associated with a Display, and there is a more generic "dependency" concept where if a parent C-level object becomes invalid, all the dependent C-level pointers get set to NULL and their host objects can reliably handle what to do about that. (such as if a Resource manager was attached to the life of a Display* connection) |
This PR adds support for the more straightforward X resource manager functions in Xresources.h.
It doesn't expose the Quark versions of the functions, or the enumeration capability.
It adds new test dependencies on Test::TempDir::Tiny as well as a version of Test:::More which supports
subtest
(which has been around for a while!).I've tested it on Perl 5.10.1 and 5.30.0.