enabled the compiler to support a class name as a namespace.
started adding code for event-driven IO handling
This commit is contained in:
@ -34,7 +34,7 @@ LDFLAGS_COMMON = -L$(abs_builddir)/../lib -L$(libdir) -version-info 1:0:0 -no-un
|
||||
LIBADD_COMMON = -lmoo
|
||||
|
||||
pkgmodexecdir = $(libdir)
|
||||
pkgmodexec_LTLIBRARIES = libmoo-console.la libmoo-ffi.la libmoo-stdio.la
|
||||
pkgmodexec_LTLIBRARIES = libmoo-console.la libmoo-ffi.la libmoo-stdio.la libmoo-x11.la
|
||||
|
||||
endif
|
||||
|
||||
@ -53,3 +53,7 @@ libmoo_stdio_la_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
libmoo_stdio_la_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
libmoo_stdio_la_LIBADD = $(LIBADD_COMMON)
|
||||
|
||||
libmoo_x11_la_SOURCES = x11.c _x11.h
|
||||
libmoo_x11_la_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
libmoo_x11_la_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
libmoo_x11_la_LIBADD = $(LIBADD_COMMON) -lxcb
|
||||
|
@ -172,6 +172,14 @@ libmoo_stdio_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
|
||||
@ENABLE_STATIC_MODULE_FALSE@am_libmoo_stdio_la_rpath = -rpath \
|
||||
@ENABLE_STATIC_MODULE_FALSE@ $(pkgmodexecdir)
|
||||
@ENABLE_STATIC_MODULE_TRUE@am_libmoo_stdio_la_rpath =
|
||||
libmoo_x11_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
|
||||
am_libmoo_x11_la_OBJECTS = libmoo_x11_la-x11.lo
|
||||
libmoo_x11_la_OBJECTS = $(am_libmoo_x11_la_OBJECTS)
|
||||
libmoo_x11_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libmoo_x11_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
@ENABLE_STATIC_MODULE_FALSE@am_libmoo_x11_la_rpath = -rpath \
|
||||
@ENABLE_STATIC_MODULE_FALSE@ $(pkgmodexecdir)
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
@ -207,9 +215,9 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libmoo_console_la_SOURCES) $(libmoo_ffi_la_SOURCES) \
|
||||
$(libmoo_stdio_la_SOURCES)
|
||||
$(libmoo_stdio_la_SOURCES) $(libmoo_x11_la_SOURCES)
|
||||
DIST_SOURCES = $(libmoo_console_la_SOURCES) $(libmoo_ffi_la_SOURCES) \
|
||||
$(libmoo_stdio_la_SOURCES)
|
||||
$(libmoo_stdio_la_SOURCES) $(libmoo_x11_la_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
@ -415,7 +423,7 @@ CPPFLAGS_COMMON = -I$(abs_builddir) -I$(abs_builddir)/../lib \
|
||||
@ENABLE_STATIC_MODULE_TRUE@LIBADD_COMMON =
|
||||
@ENABLE_STATIC_MODULE_TRUE@noinst_LTLIBRARIES = libmoo-console.la libmoo-ffi.la libmoo-stdio.la
|
||||
@ENABLE_STATIC_MODULE_FALSE@pkgmodexecdir = $(libdir)
|
||||
@ENABLE_STATIC_MODULE_FALSE@pkgmodexec_LTLIBRARIES = libmoo-console.la libmoo-ffi.la libmoo-stdio.la
|
||||
@ENABLE_STATIC_MODULE_FALSE@pkgmodexec_LTLIBRARIES = libmoo-console.la libmoo-ffi.la libmoo-stdio.la libmoo-x11.la
|
||||
libmoo_console_la_SOURCES = console.c console.h
|
||||
libmoo_console_la_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
libmoo_console_la_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
@ -428,6 +436,10 @@ libmoo_stdio_la_SOURCES = stdio.c _stdio.h
|
||||
libmoo_stdio_la_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
libmoo_stdio_la_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
libmoo_stdio_la_LIBADD = $(LIBADD_COMMON)
|
||||
libmoo_x11_la_SOURCES = x11.c _x11.h
|
||||
libmoo_x11_la_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
libmoo_x11_la_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
libmoo_x11_la_LIBADD = $(LIBADD_COMMON) -lxcb
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
@ -517,6 +529,9 @@ libmoo-ffi.la: $(libmoo_ffi_la_OBJECTS) $(libmoo_ffi_la_DEPENDENCIES) $(EXTRA_li
|
||||
libmoo-stdio.la: $(libmoo_stdio_la_OBJECTS) $(libmoo_stdio_la_DEPENDENCIES) $(EXTRA_libmoo_stdio_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libmoo_stdio_la_LINK) $(am_libmoo_stdio_la_rpath) $(libmoo_stdio_la_OBJECTS) $(libmoo_stdio_la_LIBADD) $(LIBS)
|
||||
|
||||
libmoo-x11.la: $(libmoo_x11_la_OBJECTS) $(libmoo_x11_la_DEPENDENCIES) $(EXTRA_libmoo_x11_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libmoo_x11_la_LINK) $(am_libmoo_x11_la_rpath) $(libmoo_x11_la_OBJECTS) $(libmoo_x11_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
@ -526,6 +541,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_console_la-console.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_ffi_la-ffi.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_stdio_la-stdio.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_x11_la-x11.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
|
||||
@ -572,6 +588,13 @@ libmoo_stdio_la-stdio.lo: stdio.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmoo_stdio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmoo_stdio_la-stdio.lo `test -f 'stdio.c' || echo '$(srcdir)/'`stdio.c
|
||||
|
||||
libmoo_x11_la-x11.lo: x11.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmoo_x11_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmoo_x11_la-x11.lo -MD -MP -MF $(DEPDIR)/libmoo_x11_la-x11.Tpo -c -o libmoo_x11_la-x11.lo `test -f 'x11.c' || echo '$(srcdir)/'`x11.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmoo_x11_la-x11.Tpo $(DEPDIR)/libmoo_x11_la-x11.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='x11.c' object='libmoo_x11_la-x11.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmoo_x11_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmoo_x11_la-x11.lo `test -f 'x11.c' || echo '$(srcdir)/'`x11.c
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
|
@ -24,8 +24,8 @@
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _MOO_LIB_MOD_FFI_H_
|
||||
#define _MOO_LIB_MOD_FFI_H_
|
||||
#ifndef _MOO_MOD_FFI_H_
|
||||
#define _MOO_MOD_FFI_H_
|
||||
|
||||
#include <moo.h>
|
||||
|
||||
|
@ -24,8 +24,8 @@
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _MOO_LIB_MOD_STDIO_H_
|
||||
#define _MOO_LIB_MOD_STDIO_H_
|
||||
#ifndef _MOO_MOD_STDIO_H_
|
||||
#define _MOO_MOD_STDIO_H_
|
||||
|
||||
#include <moo.h>
|
||||
|
||||
|
43
moo/mod/_x11.h
Normal file
43
moo/mod/_x11.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
Copyright (c) 2014-2017 Chung, Hyung-Hwan. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _MOO_MOD_X11_H_
|
||||
#define _MOO_MOD_X11_H_
|
||||
|
||||
#include <moo.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
MOO_EXPORT int moo_mod_x11 (moo_t* moo, moo_mod_t* mod);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -24,8 +24,8 @@
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _MOO_LIB_MOD_CONSOLE_H_
|
||||
#define _MOO_LIB_MOD_CONSOLE_H_
|
||||
#ifndef _MOO_MOD_CONSOLE_H_
|
||||
#define _MOO_MOD_CONSOLE_H_
|
||||
|
||||
#include <moo.h>
|
||||
|
||||
|
261
moo/mod/x11.c
Normal file
261
moo/mod/x11.c
Normal file
@ -0,0 +1,261 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
Copyright (c) 2014-2017 Chung, Hyung-Hwan. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "_x11.h"
|
||||
#include <moo-utl.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
typedef struct x11_t x11_t;
|
||||
struct x11_t
|
||||
{
|
||||
MOO_OBJ_HEADER;
|
||||
xcb_connection_t* c;
|
||||
};
|
||||
|
||||
static moo_pfrc_t pf_newinstsize (moo_t* moo, moo_ooi_t nargs)
|
||||
{
|
||||
moo_ooi_t newinstsize = MOO_SIZEOF(x11_t) - MOO_SIZEOF(moo_obj_t);
|
||||
MOO_STACK_SETRET (moo, nargs, MOO_SMOOI_TO_OOP(newinstsize));
|
||||
return MOO_PF_SUCCESS;
|
||||
}
|
||||
|
||||
static moo_pfrc_t pf_connect (moo_t* moo, moo_ooi_t nargs)
|
||||
{
|
||||
x11_t* x11;
|
||||
xcb_connection_t* c;
|
||||
|
||||
/* TODO: accept display target as a parameter */
|
||||
if (nargs != 0)
|
||||
{
|
||||
moo_seterrnum (moo, MOO_EINVAL);
|
||||
goto softfail;
|
||||
}
|
||||
|
||||
x11 = (x11_t*)MOO_STACK_GETRCV(moo, nargs);
|
||||
/*
|
||||
name = MOO_STACK_GETARG(moo, nargs, 0);
|
||||
|
||||
if (!MOO_ISTYPEOF(moo, name, MOO_OBJ_TYPE_CHAR))
|
||||
{
|
||||
moo_seterrnum (moo, MOO_EINVAL);
|
||||
goto softfail;
|
||||
}
|
||||
|
||||
MOO_DEBUG3 (moo, "<x11.connect> %.*js => %p\n", MOO_OBJ_GET_SIZE(name), ((moo_oop_char_t)name)->slot, rcv->handle);
|
||||
*/
|
||||
c = xcb_connect (MOO_NULL, MOO_NULL);
|
||||
if (!c)
|
||||
{
|
||||
MOO_DEBUG0 (moo, "<x11.connect> Cannot connect to X11 server\n");
|
||||
goto softfail;
|
||||
}
|
||||
|
||||
x11->c = c;
|
||||
MOO_STACK_SETRETTORCV (moo, nargs);
|
||||
return MOO_PF_SUCCESS;
|
||||
|
||||
softfail:
|
||||
MOO_STACK_SETRETTOERROR (moo, nargs);
|
||||
return MOO_PF_SUCCESS;
|
||||
}
|
||||
|
||||
static moo_pfrc_t pf_disconnect (moo_t* moo, moo_ooi_t nargs)
|
||||
{
|
||||
x11_t* x11;
|
||||
|
||||
if (nargs != 0)
|
||||
{
|
||||
moo_seterrnum (moo, MOO_EINVAL);
|
||||
goto softfail;
|
||||
}
|
||||
|
||||
x11 = (x11_t*)MOO_STACK_GETRCV(moo, nargs);
|
||||
|
||||
MOO_DEBUG1 (moo, "<x11.disconnect> %p\n", x11->c);
|
||||
|
||||
xcb_disconnect (x11->c);
|
||||
x11->c = MOO_NULL;
|
||||
|
||||
MOO_STACK_SETRETTORCV (moo, nargs);
|
||||
return MOO_PF_SUCCESS;
|
||||
|
||||
softfail:
|
||||
MOO_STACK_SETRETTOERROR (moo, nargs);
|
||||
return MOO_PF_SUCCESS;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
typedef struct fnctab_t fnctab_t;
|
||||
struct fnctab_t
|
||||
{
|
||||
moo_method_type_t type;
|
||||
moo_ooch_t mthname[15];
|
||||
int variadic;
|
||||
moo_pfimpl_t handler;
|
||||
};
|
||||
|
||||
|
||||
static moo_pfimpl_t search_fnctab (moo_t* moo, const fnctab_t* fnctab, moo_oow_t fnclen, const moo_ooch_t* name)
|
||||
{
|
||||
int left, right, mid, n;
|
||||
|
||||
left = 0; right = fnclen - 1;
|
||||
|
||||
while (left <= right)
|
||||
{
|
||||
mid = (left + right) / 2;
|
||||
|
||||
n = moo_compoocstr (name, fnctab[mid].mthname);
|
||||
if (n < 0) right = mid - 1;
|
||||
else if (n > 0) left = mid + 1;
|
||||
else
|
||||
{
|
||||
return fnctab[mid].handler;
|
||||
}
|
||||
}
|
||||
|
||||
moo->errnum = MOO_ENOENT;
|
||||
return MOO_NULL;
|
||||
}
|
||||
|
||||
static int import_fnctab (moo_t* moo, moo_mod_t* mod, moo_oop_t _class, const fnctab_t* fnctab, moo_oow_t fnclen)
|
||||
{
|
||||
int ret = 0;
|
||||
moo_oow_t i;
|
||||
|
||||
moo_pushtmp (moo, &_class);
|
||||
for (i = 0; i < fnclen; i++)
|
||||
{
|
||||
if (moo_genpfmethod (moo, mod, _class, fnctab[i].type, fnctab[i].mthname, fnctab[i].variadic, MOO_NULL) <= -1)
|
||||
{
|
||||
/* TODO: delete pfmethod generated??? */
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
moo_poptmp (moo);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#define C MOO_METHOD_CLASS
|
||||
#define I MOO_METHOD_INSTANCE
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
static fnctab_t x11_fnctab[] =
|
||||
{
|
||||
{ C, { '_','n','e','w','I','n','s','t','S','i','z','e','\0' }, 0, pf_newinstsize },
|
||||
{ I, { 'c','o','n','n','e','c','t','\0' }, 0, pf_connect },
|
||||
{ I, { 'd','i','s','c','o','n','n','e','c','t','\0' }, 0, pf_disconnect }
|
||||
};
|
||||
|
||||
|
||||
static int x11_import (moo_t* moo, moo_mod_t* mod, moo_oop_t _class)
|
||||
{
|
||||
return import_fnctab (moo, mod, _class, x11_fnctab, MOO_COUNTOF(x11_fnctab));
|
||||
}
|
||||
|
||||
static moo_pfimpl_t x11_query (moo_t* moo, moo_mod_t* mod, const moo_ooch_t* name)
|
||||
{
|
||||
return search_fnctab (moo, x11_fnctab, MOO_COUNTOF(x11_fnctab), name);
|
||||
}
|
||||
|
||||
static void x11_unload (moo_t* moo, moo_mod_t* mod)
|
||||
{
|
||||
/* TODO: anything? close open open dll handles? For that, pf_open must store the value it returns to mod->ctx or somewhere..*/
|
||||
}
|
||||
|
||||
int moo_mod_x11 (moo_t* moo, moo_mod_t* mod)
|
||||
{
|
||||
mod->import = x11_import;
|
||||
mod->query = x11_query;
|
||||
mod->unload = x11_unload;
|
||||
mod->ctx = MOO_NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
screen = xcb_setup_roots_iterator(xcb_get_setup(x11->c)).data;
|
||||
x11->mw = xcb_generate_id (xtn->c);
|
||||
|
||||
xcb_create_window (x11->c,
|
||||
XCB_COPY_FROM_PARENT,
|
||||
xtn->mw,
|
||||
screen->root,
|
||||
0, 0, 300, 300, 10,
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||
screen->root_visual,
|
||||
0, MOO_NULL);
|
||||
|
||||
xcb_map_window (xtn->xcb, xtn->mw);
|
||||
xcb_flush (xtn->xcb);
|
||||
|
||||
xcb_generic_event_t* evt;
|
||||
while ((evt = xcb_poll_for_event(xtn->xcb, 0))
|
||||
{
|
||||
/* TODO: dispatch event read */
|
||||
}
|
||||
|
||||
static fnctab_t x11_window_fnctab[] =
|
||||
{
|
||||
{ C, { '_','n','e','w','I','n','s','t','S','i','z','e','\0' }, 0, pf_newinstsize },
|
||||
{ I, { 'c','o','n','n','e','c','t','\0' }, 0, pf_connect },
|
||||
{ I, { 'd','i','s','c','o','n','n','e','c','t','\0' }, 0, pf_disconnect }
|
||||
};
|
||||
|
||||
static int x11_window_import (moo_t* moo, moo_mod_t* mod, moo_oop_t _class)
|
||||
{
|
||||
return import_fnctab (moo, mod, _class, x11_window_fnctab, MOO_COUNTOF(x11_window_fnctab));
|
||||
}
|
||||
|
||||
static moo_pfimpl_t x11_window_query (moo_t* moo, moo_mod_t* mod, const moo_ooch_t* name)
|
||||
{
|
||||
return search_fnctab (moo, x11_window_fnctab, MOO_COUNTOF(x11_window_fnctab), name);
|
||||
}
|
||||
|
||||
static void windowunload (moo_t* moo, moo_mod_t* mod)
|
||||
{
|
||||
/* TODO: anything? */
|
||||
}
|
||||
|
||||
int moo_mod_x11_window (moo_t* moo, moo_mod_t* mod)
|
||||
{
|
||||
mod->import = x11_window_import;
|
||||
mod->query = x11_window_query;
|
||||
mod->unload = x11_window_unload;
|
||||
mod->ctx = MOO_NULL;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user