Re: [Vala] X11 and pointers help
- From: Andrea Del Signore <sejerpz tin it>
- To: Andrew Higginson <at higginson gmail com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] X11 and pointers help
- Date: Fri, 13 Jan 2012 19:32:30 +0100
Hi,
On Fri, 2012-01-13 at 17:20 +0000, Andrew Higginson wrote:
Hi,
I am trying to get a list of the open windows using
_NET_CLIENT_LIST_STACKING (it is important I use this as I need it in
the order of stacking) as seen here
http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#id2449346
To do this I am using the Xlib bindings for vala with the following
code, however I cannot get the code at the end of this message to compile
Any help? If I am honest, I am not really sure what the void* stuff is
about :/
A void pointer is a pointer to an unknown type and you should cast to a
specific type before using it. For this reason this line is invalid and
vala should complain at compile time like the C compiler is doing:
ulong xid = (ulong) list[i];
You are accessing the list variable with "list[i]".
I think that you can workaround this situation with a temporary variable
and honestly I don't know a cleaner solution:
unowned ulong[] items = (ulong[])list;
for (int i = 0; i < nitems; i++) {
ulong xid = items[i];
stdout.printf(xid.to_string());
}
Regards,
Andrea
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]