Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/bin


Modified Files:
      Tag: SPLIT
        ecore_test.c 


Log Message:


x ubsystem now has event handlers to translate x events to ecore events...
empty right now.. but it works. this system later will need to be able to
generate synthetic events form client messages and property notify's

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/bin/Attic/ecore_test.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -3 -r1.1.2.3 -r1.1.2.4
--- ecore_test.c        16 Jan 2003 12:04:35 -0000      1.1.2.3
+++ ecore_test.c        21 Jan 2003 01:22:45 -0000      1.1.2.4
@@ -1,8 +1,6 @@
 #include "Ecore.h"
 #include "Ecore_Job.h"
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
+#include "Ecore_X.h"
 
 #include <unistd.h>
 #include <fcntl.h>
@@ -52,80 +50,44 @@
    return 1;
 }
 
-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;
+   XSetWindowAttributes att;
+   Window win;
    
-   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);
-     }
+   display = ecore_x_display_get();
+   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
@@ -136,6 +98,8 @@
    ecore_init();
    ecore_app_args_set(argc, argv);
 
+   if (!ecore_x_init(NULL)) return -1;
+   
    x_init();
    
    ecore_idle_enterer_add(idle_enterer, NULL);




-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to