[Xcb] cursor example for the tutorial

Barton C Massey bart at cs.pdx.edu
Wed Jan 24 08:40:40 PST 2007


"goto beach"???

	Bart

In message <Pine.LNX.4.64.0701241355260.22011 at grozny.maths.univ-evry.fr> you wrote:
>   This message is in MIME format.  The first part should be readable text,
>   while the remaining parts are likely unreadable without MIME-aware tools.
> 
> --8323328-494156911-1169643593=:22011
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
> 
> 
> Hey,
> 
> here is a simple cursor example that I want to add to the tutorial
> 
> Anything wrong with it ? (use of errors, better code, etc...)
> 
> thank you
> 
> Vincent
> 
> PS: there are always some reads of uninitialized mem reported by valgrind
> --8323328-494156911-1169643593=:22011
> Content-Type: TEXT/PLAIN; charset=US-ASCII; name=xcb_cursor.c
> Content-Transfer-Encoding: BASE64
> Content-ID: <Pine.LNX.4.64.0701241359530.22011 at grozny.maths.univ-evry.fr>
> Content-Description: 
> Content-Disposition: attachment; filename=xcb_cursor.c
> 
> LyogZ2NjIC1nIC1XYWxsIC1vIHhjYl9jdXJzb3IgeGNiX2N1cnNvci5jIGBw
> a2ctY29uZmlnIC0tY2ZsYWdzIC0tbGlicyB4Y2JgICovDQoNCiNpbmNsdWRl
> IDxzdGRsaWIuaD4NCiNpbmNsdWRlIDxzdGRpby5oPg0KI2luY2x1ZGUgPHN0
> cmluZy5oPg0KDQojaW5jbHVkZSA8eGNiL3hjYi5oPg0KDQojZGVmaW5lIFdJ
> RFRIIDMwMA0KI2RlZmluZSBIRUlHSFQgMTUwDQoNCg0KDQpzdGF0aWMgeGNi
> X2djX3QgX2djX2ZvbnRfZ2V0ICh4Y2JfY29ubmVjdGlvbl90ICpjLA0KICAg
> ICAgICAgICAgICAgICAgICAgICAgICAgICAgeGNiX3NjcmVlbl90ICAgICAq
> c2NyZWVuLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeGNiX3dp
> bmRvd190ICAgICAgd2luZG93LA0KICAgICAgICAgICAgICAgICAgICAgICAg
> ICAgICAgY29uc3QgY2hhciAgICAgICAqZm9udF9uYW1lKTsNCg0Kc3RhdGlj
> IHZvaWQNCl9idXR0b25fZHJhdyAoeGNiX2Nvbm5lY3Rpb25fdCAqYywNCiAg
> ICAgICAgICAgICAgeGNiX3NjcmVlbl90ICAgICAqc2NyZWVuLA0KICAgICAg
> ICAgICAgICB4Y2Jfd2luZG93X3QgICAgICB3aW5kb3csDQogICAgICAgICAg
> ICAgIGludDE2X3QgICAgICAgICAgIHgxLA0KICAgICAgICAgICAgICBpbnQx
> Nl90ICAgICAgICAgICB5MSwNCiAgICAgICAgICAgICAgY29uc3QgY2hhciAg
> ICAgICAqbGFiZWwpDQp7DQogIHhjYl9wb2ludF90ICAgICAgICAgIHBvaW50
> c1s1XTsNCiAgeGNiX3ZvaWRfY29va2llX3QgICAgY29va2llX2djOw0KICB4
> Y2Jfdm9pZF9jb29raWVfdCAgICBjb29raWVfbGluZTsNCiAgeGNiX3ZvaWRf
> Y29va2llX3QgICAgY29va2llX3RleHQ7DQogIHhjYl9nZW5lcmljX2Vycm9y
> X3QgKmVycm9yOw0KICB4Y2JfZ2NvbnRleHRfdCAgICAgICBnYzsNCiAgaW50
> MTZfdCAgICAgICAgICAgICAgd2lkdGg7DQogIGludDE2X3QgICAgICAgICAg
> ICAgIGhlaWdodDsNCiAgdWludDhfdCAgICAgICAgICAgICAgbGVuZ3RoOw0K
> ICBpbnQxNl90ICAgICAgICAgICAgICBpbnNldDsNCg0KICBsZW5ndGggPSBz
> dHJsZW4gKGxhYmVsKTsNCiAgaW5zZXQgPSAyOw0KDQogIGdjID0gX2djX2Zv
> bnRfZ2V0KGMsIHNjcmVlbiwgd2luZG93LCAiN3gxMyIpOw0KDQogIHdpZHRo
> ID0gNyAqIGxlbmd0aCArIDIgKiAoaW5zZXQgKyAxKTsNCiAgaGVpZ2h0ID0g
> MTMgKyAyICogKGluc2V0ICsgMSk7DQogIHBvaW50c1swXS54ID0geDE7DQog
> IHBvaW50c1swXS55ID0geTE7DQogIHBvaW50c1sxXS54ID0geDEgKyB3aWR0
> aDsNCiAgcG9pbnRzWzFdLnkgPSB5MTsNCiAgcG9pbnRzWzJdLnggPSB4MSAr
> IHdpZHRoOw0KICBwb2ludHNbMl0ueSA9IHkxIC0gaGVpZ2h0Ow0KICBwb2lu
> dHNbM10ueCA9IHgxOw0KICBwb2ludHNbM10ueSA9IHkxIC0gaGVpZ2h0Ow0K
> ICBwb2ludHNbNF0ueCA9IHgxOw0KICBwb2ludHNbNF0ueSA9IHkxOw0KICBj
> b29raWVfbGluZSA9IHhjYl9wb2x5X2xpbmVfY2hlY2tlZCAoYywgWENCX0NP
> T1JEX01PREVfT1JJR0lOLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAg
> ICAgICAgICAgICAgd2luZG93LCBnYywgNSwgcG9pbnRzKTsNCg0KICBlcnJv
> ciA9IHhjYl9yZXF1ZXN0X2NoZWNrIChjLCBjb29raWVfbGluZSk7DQogIGlm
> IChlcnJvcikgew0KICAgIGZwcmludGYgKHN0ZGVyciwgIkVSUk9SOiBjYW4n
> dCBkcmF3IGxpbmVzIDogJWRcbiIsIGVycm9yLT5lcnJvcl9jb2RlKTsNCiAg
> ICB4Y2JfZGlzY29ubmVjdCAoYyk7DQogICAgZXhpdCAoLTEpOw0KICB9DQoN
> CiAgY29va2llX3RleHQgPSB4Y2JfaW1hZ2VfdGV4dF84X2NoZWNrZWQgKGMs
> IGxlbmd0aCwgd2luZG93LCBnYywNCiAgICAgICAgICAgICAgICAgICAgICAg
> ICAgICAgICAgICAgICAgICAgIHgxICsgaW5zZXQgKyAxLA0KICAgICAgICAg
> ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeTEgLSBpbnNldCAt
> IDEsIGxhYmVsKTsNCiAgZXJyb3IgPSB4Y2JfcmVxdWVzdF9jaGVjayAoYywg
> Y29va2llX3RleHQpOw0KICBpZiAoZXJyb3IpIHsNCiAgICBmcHJpbnRmIChz
> dGRlcnIsICJFUlJPUjogY2FuJ3QgcG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dCAgICAgICAg
> ICAgZm9udDsNCiAgeGNiX2N1cnNvcl90ICAgICAgICAgY3Vyc29yOw0KICB4
> Y2JfZ2NvbnRleHRfdCAgICAgICBnYzsNCiAgdWludDMyX3QgICAgICAgICAg
> ICAgbWFzazsNCiAgdWludDMyX3QgICAgICAgICAgICAgdmFsdWVfbGlzdDsN
> Cg0KICBmb250ID0geGNiX2dlbmVyYXRlX2lkIChjKTsNCiAgY29va2llX2Zv
> bnQgPSB4Y2Jfb3Blbl9mb250X2NoZWNrZWQgKGMsIGZvbnQsDQogICAgICAg
> ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJsZW4gKCJjdXJz
> b3IiKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
> ICJjdXJzb3IiKTsNCiAgZXJyb3IgPSB4Y2JfcmVxdWVzdF9jaGVjayAoYywg
> Y29va2llX2ZvbnQpOw0KICBpZiAoZXJyb3IpIHsNCiAgICBmcHJpbnRmIChz
> dGRlcnIsICJFUlJPUjogY2FuJ3Qgb3BlbiBmb250IDogJWRcbiIsIGVycm9y
> LT5lcnJvcl9jb2RlKTsNCiAgICB4Y2JfZGlzY29ubmVjdCAoYyk7DQogICAg
> ZXhpdCAoLTEpOw0KICB9DQoNCiAgY3Vyc29yID0geGNiX2dlbmVyYXRlX2lk
> IChjKTsNCiAgeGNiX2NyZWF0ZV9nbHlwaF9jdXJzb3IgKGMsIGN1cnNvciwg
> Zm9udCwgZm9udCwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnNv
> cl9pZCwgY3Vyc29yX2lkICsgMSwNCiAgICAgICAgICAgICAgICAgICAgICAg
> ICAgIDAsIDAsIDAsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAwLCAw
> LCAwKTsNCg0KDQoNCiAgZ2MgPSB4Y2JfZ2VuZXJhdGVfaWQgKGMpOw0KICBt
> YXNrID0gWENCX0dDX0ZPUkVHUk9VTkQgfCBYQ0JfR0NfQkF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m9yICg7IHNjcmVlbl9pdGVyLnJlbSAhPSAw
> OyAtLXNjcmVlbl9udW1iZXIsIHhjYl9zY3JlZW5fbmV4dCAoJnNjcmVlbl9p
> dGVyKSkNCiAgICBpZiAoc2NyZWVuX251bWJlciA9PSAwKQ0KICAgICAgew0K
> ICAgICAgICBzY3JlZW4gPSBzY3JlZW5faXRlci5kYXRhOw0KICAgICAgICBi
> cmVhazsNCiAgICAgIH0NCiAgaWYgKCFzY3JlZW4pIHsNCiAgICBmcHJpbnRm
> IChzdGRlcnIsICJFUlJPUjogY2FuJ3QgZ2V0IHRoZSBjdXJyZW50IHNjcmVl
> blxuIik7DQogICAgeGNiX2Rpc2Nvbm5lY3QgKGMpOw0KICAgIHJldHVybiAt
> MTsNCiAgfQ0KDQogIC8qIGNyZWF0aW5nIHRoZSB3aW5kb3cgKi8NCiAgd2lu
> ZG93ID0geGNiX2dlbmVyYXRlX2lkIChjKTsNCiAgbWFzayA9IFhDQl9DV19C
> QUNLX1BJWEVMIHwgWENCX0NXX0VWRU5UX01BU0s7DQogIHZhbHVlc1swXSA9
> IHNjcmVlbi0+d2hpdGVfcGl4ZWw7DQogIHZhbHVlc1sxXSA9DQogICAgWENC
> X0VWRU5UX01BU0tfS0VZX1JFTEVBU0UgfA0KICAgIFhDQl9FVkVOVF9NQVNL
> X0JVVFRPTl9QUkVTUyB8DQogICAgWENCX0VWRU5UX01BU0tfRVhQT1NVUkUg
> fA0KICAgIFhDQl9FVkVOVF9NQVNLX1BPSU5URVJfTU9USU9OOw0KICBjb29r
> aWVfd2luZG93ID0geGNiX2NyZWF0ZV93aW5kb3dfY2hlY2tlZCAoYywNCiAg
> ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNj
> cmVlbi0+cm9vdF9kZXB0aCwNCiAgICAgICAgICAgICAgICAgICAgICAgICAg
> ICAgICAgICAgICAgICAgICAgIHdpbmRvdywgc2NyZWVuLT5yb290LA0KICAg
> ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAs
> IDIwMCwgV0lEVEgsIEhFSUdIVCwNCiAgICAgICAgICAgICAgICAgICAgICAg
> ICAgICAgICAgICAgICAgICAgICAgIDAsIFhDQl9XSU5ET1dfQ0xBU1NfSU5Q
> VVRfT1VUUFVULA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
> ICAgICAgICAgICAgc2NyZWVuLT5yb290X3Zpc3VhbCwNCiAgICAgICAgICAg
> ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hc2ssIHZhbHVl
> cyk7DQogIGNvb2tpZV9tYXAgPSB4Y2JfbWFwX3dpbmRvd19jaGVja2VkIChj
> LCB3aW5kb3cpOw0KDQogIC8qIGVycm9yIG1hbmFnaW5nICovDQogIGVycm9y
> ID0geGNiX3JlcXVlc3RfY2hlY2sgKGMsIGNvb2tpZV93aW5kb3cpOw0KICBp
> ZiAoZXJyb3IpIHsNCiAgICBmcHJpbnRmIChzdGRlcnIsICJFUlJPUjogY2Fu
> J3QgY3JlYXRlIHdpbmRvdyA6ICVkXG4iLCBlcnJvci0+ZXJyb3JfY29kZSk7
> DQogICAgeGNiX2Rpc2Nvbm5lY3QgKGMpOw0KICAgIHJldHVybiAtMTsNCiAg
> fQ0KICBlcnJvciA9IHhjYl9yZXF1ZXN0X2NoZWNrIChjLCBjb29raWVfbWFw
> KTsNCiAgaWYgKGVycm9yKSB7DQogICAgZnByaW50ZiAoc3RkZXJyLCAiRVJS
> T1I6IGNhbid0IG1hcCB3aW5kb3cgOiAlZFxuIiwgZXJyb3ItPmVycm9yX2Nv
> ZGUpOw0KICAgIHhjYl9kaXNjb25uZWN0IChjKTsNCiAgICByZXR1cm4gLTE7
> DQogIH0NCg0KICBfY3Vyc29yX3NldCAoYywgc2NyZWVuLCB3aW5kb3csIDY4
> KTsNCg0KICB4Y2JfZmx1c2goYyk7DQoNCiAgd2hpbGUgKDEpIHsNCiAgICBl
> ID0geGNiX3BvbGxfZm9yX2V2ZW50KGMpOw0KICAgIGlmIChlKSB7DQogICAg
> ICBzd2l0Y2ggKGUtPnJlc3BvbnNlX3R5cGUpIHsNCiAgICAgIGNhc2UgWENC
> X0VYUE9TRTogew0KICAgICAgICBjaGFyICp0ZXh0Ow0KDQogICAgICAgIHRl
> eHQgPSAiY2xpY2sgaGVyZSB0byBjaGFuZ2UgY3Vyc29yIjsNCiAgICAgICAg
> X2J1dHRvbl9kcmF3IChjLCBzY3JlZW4sIHdpbmRvdywNCiAgICAgICAgICAg
> ICAgICAgICAgICAoV0lEVEggLSA3KnN0cmxlbih0ZXh0KSkgLyAyLA0KICAg
> ICAgICAgICAgICAgICAgICAgIChIRUlHSFQgLSAxNikgLyAyLCB0ZXh0KTsN
> Cg0KICAgICAgICB0ZXh0ID0gIlByZXNzIEVTQyBrZXkgdG8gZXhpdC4uLiI7
> DQogICAgICAgIF90ZXh0X2RyYXcgKGMsIHNjcmVlbiwgd2luZG93LCAxMCwg
> SEVJR0hUIC0gMTAsIHRleHQpOw0KICAgICAgICBicmVhazsNCiAgICAgIH0N
> CiAgICAgIGNhc2UgWENCX0JVVFRPTl9QUkVTUzogew0KICAgICAgICB4Y2Jf
> YnV0dG9uX3ByZXNzX2V2ZW50X3QgKmV2Ow0KICAgICAgICBpbnQgICAgICAg
> ICAgICAgICAgICAgICAgIGxlbmd0aDsNCg0KICAgICAgICBldiA9ICh4Y2Jf
> YnV0dG9uX3ByZXNzX2V2ZW50X3QgKillOw0KICAgICAgICBsZW5ndGggPSBz
> dHJsZW4gKCJjbGljayBoZXJlIHRvIGNoYW5nZSBjdXJzb3IiKTsNCg0KICAg
> ICAgICBpZiAoKGV2LT5ldmVudF94ID49IChXSURUSCAtIDcqbGVuZ3RoKSAv
> IDIpICYmDQogICAgICAgICAgICAoZXYtPmV2ZW50X3ggPD0gKChXSURUSCAt
> IDcqbGVuZ3RoKSAvIDIgKyA3ICogbGVuZ3RoICsgNikpICYmDQogICAgICAg
> ICAgICAoZXYtPmV2ZW50X3kgPj0gKEhFSUdIVCAtIDE2KSAvIDIgLSAxOSkg
> JiYNCiAgICAgICAgICAgIChldi0+ZXZlbnRfeSA8PSAoKEhFSUdIVCAtIDE2
> KSAvIDIpKSkNCiAgICAgICAgICBpc19oYW5kID0gMSAtIGlzX2hhbmQ7DQoN
> CiAgICAgICAgaXNfaGFuZCA/IF9jdXJzb3Jfc2V0IChjLCBzY3JlZW4sIHdp
> bmRvdywgNTgpIDogX2N1cnNvcl9zZXQgKGMsIHNjcmVlbiwgd2luZG93LCA2
> OCk7DQogICAgICB9DQogICAgICBjYXNlIFhDQl9LRVlfUkVMRUFTRTogew0K
> ICAgICAgICB4Y2Jfa2V5X3JlbGVhc2VfZXZlbnRfdCAqZXY7DQoNCiAgICAg
> ICAgZXYgPSAoeGNiX2tleV9yZWxlYXNlX2V2ZW50X3QgKillOw0KDQogICAg
> ICAgIHN3aXRjaCAoZXYtPmRldGFpbCkgew0KICAgICAgICAgIC8qIEVTQyAq
> Lw0KICAgICAgICBjYXNlIDk6DQogICAgICAgICAgZnJlZSAoZSk7DQogICAg
> ICAgICAgZ290byBiZWFjaDsNCiAgICAgICAgfQ0KICAgICAgfQ0KICAgICAg
> fQ0KICAgICAgZnJlZSAoZSk7DQogICAgfQ0KICB9DQoNCiBiZWFjaDoNCiAg
> eGNiX2Rpc2Nvbm5lY3QgKGMpOw0KDQogIHJldHVybiAwOw0KfQ0K
> 
> --8323328-494156911-1169643593=:22011
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
> 
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
> --8323328-494156911-1169643593=:22011--


More information about the Xcb mailing list