-
Notifications
You must be signed in to change notification settings - Fork 18
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
Model XGetDefault, XrmGetDatabase, XrmSetDatabase #35
Comments
@psychon Actually I don't think the two The only thing we can do, IMHO, is offer a convenience function like
|
I never mentioned the two The following code is ugly, taken (more or less) from awesome and is used to get the default database: database = XrmGetDatabase(display)
if (database == NULL) {
XGetDefault(display, "", ""); /* Initialize DB */
database = XrmGetDatabase(display);
} I'd like to have some non-ugly replacement for the above (or you can tell me that awesome is doing it wrong). |
@psychon Yes, you're right that you didn't mention them in the first place. :)
It is a somewhat weird function. It's both a convenience wrapper around some Xrm calls, but also includes the functionality to load the "correct" database if necessary (resource manager atom, Xdefaults, XENVIRONMENT, …).
However, in XCB we simply don't have the connection between I think what we need is:
So, to summarize, we'd have something like |
There's nothing wrong per se, but I think you could just as well do this:
without the |
👍 For Sorry for my initial confusion. I wanted to say "something like |
No, that's not my intention. It would use an existing database that you pass to it, it just simply wraps this:
into this:
And getting a string resource with a NULL fallback is by far the most common usage AFAICT, so I think it makes sense.
I'm open to other names. :) |
Frankly, right now I'm starting to wonder whether we should ditch |
True... And yeah, that wrapper seems useful, but perhaps adding Random slightly off-topic thing: psychon/awesome@6ed40af https://travis-ci.org/psychon/awesome/jobs/119765242 Edit: psychon/awesome@master...psychon:xcb-util-xrm |
If the name contained that, I'd expect to pass another argument that is used as the default value (rather than
Nice. :) Yeah, you'll probably just need to use the https link of the repository. I'll change it. (Edit: fixed) |
I'm going to summarize (mostly for myself) what needs to happen here now:
@psychon Does that sound good to you? |
Yup, sounds good to me. Thanks for clearing up the confusion that I caused. |
This patch removes xcb_xrm_resource_t and, in consequence, these: - xcb_xrm_resource_get - xcb_xrm_resource_value - xcb_xrm_resource_value_bool - xcb_xrm_resource_value_long In turn, the following new functions are introduced to the API: - xcb_xrm_resource_get_string - xcb_xrm_resource_get_bool - xcb_xrm_resource_get_long These do mostly the same but remove the need for handling a "resource" struct as the caller, thus reducing the overhead of using the API. relates to #35
Small corrections:
|
I've opened #37 for the database function. |
closed by #38 |
The functions
XGetDefault
,XrmGetDatabase
andXrmSetDatabase
should have an equivalent in xcb-util-xrm.The text was updated successfully, but these errors were encountered: