sardemff7 / libgwater

A collection of GSources
16 stars 4 forks source link

Adding examples of usage (maybe even migrations from custom/Gdk code) #1

Open rilian-la-te opened 9 years ago

rilian-la-te commented 9 years ago

I want to port X Event driven program from Gdk to pure XCB and GLib

sardemff7 commented 9 years ago

The basic idea is that GWater XCB is just here to hook XCB events to the GLib main loop.

You create a GSource with g_water_xcb_source_new (basically a wrapper around xcb_connect) passing your own callback that will handle events.

Then you get the XCB connection using g_water_xcb_source_get_connection and start sending your requests with libxcb.

You /should/ have all the needed logic in sardemff7/eventd@8c5ae2a62f2cbb17608e8259f8e25b9d2636b447 (see the xcb.c file modified in this commit if the diff is not enough, even though the rest is not really GWater-related).

I modify this issue to a more generic thing so that I will not forget to add basic documentation and example to help people.

Glad to see someone interested in GWater, it is quite surprising!

rilian-la-te commented 9 years ago

But there is a problem (but not GWater - related). If app is a gtk app, no events will be captured. On Mar 11, 2015 5:53 AM, "Quentin Glidic" notifications@github.com wrote:

The basic idea is that GWater XCB is just here to hook XCB events to the GLib main loop.

You create a GSource with g_water_xcb_source_new (basically a wrapper around xcb_connect) passing your own callback that will handle events.

Then you get the XCB connection using g_water_xcb_source_get_connection and start sending your requests with libxcb.

You /should/ have all the needed logic in sardemff7/eventd@8c5ae2a https://github.com/sardemff7/eventd/commit/8c5ae2a62f2cbb17608e8259f8e25b9d2636b447 (see the xcb.c file modified in this commit if the diff is not enough, even though the rest is not really GWater-related).

I modify this issue to a more generic thing so that I will not forget to add basic documentation and example to help people.

Glad to see someone interested in GWater, it is quite surprising!

— Reply to this email directly or view it on GitHub https://github.com/sardemff7/libgwater/issues/1#issuecomment-78174165.

sardemff7 commented 9 years ago

Ok, then I will make sure people understand GWater is for GLib-only applications. :-)

rilian-la-te commented 9 years ago

This is not GLIb - only:) XCB connection source is GLib - only, but ALSA source works just fine in GTK app:)

On Wednesday, March 11, 2015, Quentin Glidic notifications@github.com wrote:

Ok, then I will make sure people understand GWater is for GLib-only applications. :-)

— Reply to this email directly or view it on GitHub https://github.com/sardemff7/libgwater/issues/1#issuecomment-78246683.

beroal commented 8 years ago

I wonder whether your library does what this feature request for XCB describes.

sardemff7 commented 8 years ago

Not exactly. The request is about adding to the XCB API the proper functions to implement prepare and check. My XCB source uses xcb_poll_for_event in check to fill a queue, then dispatch only operates on this queue.

GWater fills my needs and probably other people’s, but I cannot guarantee it is doing the right thing. :-)