Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src
Modified Files:
Tag: SPLIT
Makefile.am ecore_test.c
Log Message:
it works! well dont' knwo about mem leaks.. but the core select abstractor
works... now i can listen on any fd (in theiry) and have timers tick off,
idle handlers claled continuously during "idle" time and "idle enterer"
handlers that get called when going into an idle state, have an abstracted
event queue... i hope to have a nice api for programs to post events on the
queue too so a program cna internally synthesize events, create its own
events for its own consumption later etc.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/Makefile.am,v
retrieving revision 1.7.2.5
retrieving revision 1.7.2.6
diff -u -3 -r1.7.2.5 -r1.7.2.6
--- Makefile.am 16 Jan 2003 01:44:30 -0000 1.7.2.5
+++ Makefile.am 16 Jan 2003 02:11:36 -0000 1.7.2.6
@@ -30,8 +30,9 @@
ecore_test.c
ecore_test_LDADD = \
+@x_ldflags@ @x_libs@ -lm \
libecore.la \
--all-static
+-static
ecore_test_LDFLAGS = \
$(LDFLAGS)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/Attic/ecore_test.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- ecore_test.c 16 Jan 2003 01:44:30 -0000 1.1.2.1
+++ ecore_test.c 16 Jan 2003 02:11:36 -0000 1.1.2.2
@@ -1,33 +1,14 @@
#include "Ecore.h"
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
#include <unistd.h>
#include <fcntl.h>
double start_time = 0;
int
-stdin_handler(Ecore_Fd_Handler *fd_handler, void *data)
-{
- int fd;
- char buf[4096];
- int count;
-
- printf("Begin stdin_handler\n");
- fd = ecore_main_fd_handler_fd_get(fd_handler);
- count = read(fd, buf, 4096);
- if (count >= 0)
- {
- buf[count] = 0;
- printf("Read %i, \"%s\"\n", count, buf);
- }
- else
- printf("Read %i\n", count);
- printf("End stdin_handler\n");
- if (count < 0) return 0;
- return 1;
-}
-
-int
idle_enterer(void *data)
{
printf("Entering idle %3.3f\n", ecore_time_get() - start_time);
@@ -49,20 +30,94 @@
}
int
+x_handler(Ecore_Fd_Handler *fd_handler, void *data)
+{
+ Display *display;
+
+ printf("Begin x_handler\n");
+ display = data;
+ while (XPending(display))
+ {
+ XEvent event;
+
+ XNextEvent(display, &event);
+ printf("X11 event %i\n", event.type);
+ /* here we should be putting an event on the event list */
+ }
+ printf("End x_handler\n");
+ return 1;
+}
+
+int
+x_handler_buf(Ecore_Fd_Handler *fd_handler, void *data)
+{
+ Display *display;
+
+ display = data;
+ return XPending(display);
+}
+
+void
+x_init(void)
+{
+ Display *display;
+ XClassHint *xch;
+
+ display = XOpenDisplay(NULL);
+ if (!display) return;
+ ecore_main_fd_handler_add(ConnectionNumber(display),
+ ECORE_FD_READ,
+ x_handler, display,
+ x_handler_buf, display);
+ {
+ XSetWindowAttributes att;
+ Window win;
+
+ att.background_pixmap = None;
+ att.colormap = DefaultColormap(display, DefaultScreen(display));
+ att.border_pixel = 0;
+ att.event_mask =
+ ButtonPressMask |
+ ButtonReleaseMask |
+ EnterWindowMask |
+ LeaveWindowMask |
+ PointerMotionMask |
+ ExposureMask |
+ StructureNotifyMask |
+ KeyPressMask |
+ KeyReleaseMask;
+ win = XCreateWindow(display,
+ RootWindow(display, DefaultScreen(display)),
+ 0, 0, 160, 160, 0,
+ DefaultDepth(display, DefaultScreen(display)),
+ InputOutput,
+ DefaultVisual(display, DefaultScreen(display)),
+ CWColormap | CWBorderPixel | CWEventMask | CWBackPixmap,
+ &att);
+ XStoreName(display, win, "Ecore Test Program");
+ xch = XAllocClassHint();
+ xch->res_name = "Main";
+ xch->res_class = "Ecore_Demo";
+ XSetClassHint(display, win, xch);
+ XFree(xch);
+ XMapWindow(display, win);
+ XSync(display, False);
+ }
+}
+
+int
main(int argc, const char **argv)
{
start_time = ecore_time_get();
ecore_init();
ecore_app_args_set(argc, argv);
+ x_init();
+
ecore_idle_enterer_add(idle_enterer, NULL);
- ecore_idler_add(idler, NULL);
+// ecore_idler_add(idler, NULL);
ecore_timer_add(1.0, timer, NULL);
- fcntl(1, F_SETFL, O_NONBLOCK);
- ecore_main_fd_handler_add(1, ECORE_FD_READ,
- stdin_handler, NULL,
- NULL, NULL);
ecore_main_loop_begin();
ecore_shutdown();
return 0;
-------------------------------------------------------
This SF.NET email is sponsored by: A Thawte Code Signing Certificate
is essential in establishing user confidence by providing assurance of
authenticity and code integrity. Download our Free Code Signing guide:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0028en
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs