Re: [Vala] X11 and pointers help



On 13/01/12 17:20, 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 :/

Should also say this is what I get when I compile (C file at the end of
this message) - sorry :)

/tmp/window.vala.c: In function ‘_vala_main’:
/tmp/window.vala.c:71:10: error: variable or field ‘_tmp19_’ declared void
/tmp/window.vala.c:91:22: warning: dereferencing ‘void *’ pointer
[enabled by default]
/tmp/window.vala.c:91:13: error: void value not ignored as it ought to be
error: cc exited with status 256

--
Andrew


/* window.c generated by valac 0.14.0, the Vala compiler
 * generated from window.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/Xregion.h>
#include <stdio.h>

#define _g_free0(var) (var = (g_free (var), NULL))
#define _XCloseDisplay0(var) ((var == NULL) ? NULL : (var =
(XCloseDisplay (var), NULL)))



gint _vala_main (gchar** args, int args_length1);


gint _vala_main (gchar** args, int args_length1) {
        gint result = 0;
        Display* _tmp0_;
        Display* xdisplay;
        Atom type = {0};
        gint format = 0;
        gulong nitems = 0UL;
        gulong bytes_after = 0UL;
        void* list = NULL;
        Display* _tmp1_;
        Display* _tmp2_;
        Window _tmp3_ = 0;
        Display* _tmp4_;
        Atom _tmp5_ = {0};
        glong _tmp6_;
        Atom _tmp7_ = {0};
        gint _tmp8_ = 0;
        gulong _tmp9_ = 0UL;
        gulong _tmp10_ = 0UL;
        void* _tmp11_ = NULL;
        void* _tmp24_;
        XInitThreads ();
        _tmp0_ = XOpenDisplay (NULL);
        xdisplay = _tmp0_;
        _tmp1_ = xdisplay;
        _tmp2_ = xdisplay;
        _tmp3_ = DefaultRootWindow (_tmp2_);
        _tmp4_ = xdisplay;
        _tmp5_ = XInternAtom (_tmp4_, "_NET_CLIENT_LIST_STACKING", TRUE);
        _tmp6_ = G_MAXLONG;
        XGetWindowProperty (_tmp1_, _tmp3_, _tmp5_, (glong) 0, _tmp6_, FALSE,
XA_CARDINAL, &_tmp7_, &_tmp8_, &_tmp9_, &_tmp10_, (unsigned char **)
(&_tmp11_));
        type = _tmp7_;
        format = _tmp8_;
        nitems = _tmp9_;
        bytes_after = _tmp10_;
        list = _tmp11_;
        {
                gint i;
                i = 0;
                {
                        gboolean _tmp12_;
                        _tmp12_ = TRUE;
                        while (TRUE) {
                                gboolean _tmp13_;
                                gint _tmp15_;
                                gulong _tmp16_;
                                void* _tmp17_;
                                gint _tmp18_;
                                void _tmp19_;
                                gulong xid;
                                FILE* _tmp20_;
                                gulong _tmp21_;
                                gchar* _tmp22_ = NULL;
                                gchar* _tmp23_;
                                _tmp13_ = _tmp12_;
                                if (!_tmp13_) {
                                        gint _tmp14_;
                                        _tmp14_ = i;
                                        i = _tmp14_ + 1;
                                }
                                _tmp12_ = FALSE;
                                _tmp15_ = i;
                                _tmp16_ = nitems;
                                if (!(((gulong) _tmp15_) < _tmp16_)) {
                                        break;
                                }
                                _tmp17_ = list;
                                _tmp18_ = i;
                                _tmp19_ = _tmp17_[_tmp18_];
                                xid = (gulong) _tmp19_;
                                _tmp20_ = stdout;
                                _tmp21_ = xid;
                                _tmp22_ = g_strdup_printf ("%lu", _tmp21_);
                                _tmp23_ = _tmp22_;
                                fprintf (_tmp20_, "%s", _tmp23_);
                                _g_free0 (_tmp23_);
                        }
                }
        }
        _tmp24_ = list;
        XFree (_tmp24_);
        result = 0;
        _XCloseDisplay0 (xdisplay);
        return result;
}


int main (int argc, char ** argv) {
        g_type_init ();
        return _vala_main (argv, argc);
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]