Enlightenment CVS committal

Author  : doursse
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_win32


Modified Files:
        Ecore_Win32.h Makefile.am ecore_win32.c ecore_win32_event.c 
        ecore_win32_private.h ecore_win32_window.c 


Log Message:
Associate an Ecore_Win32_Window to its HWND window, hence drop of the window 
list management. That should fix a bug when 2 windows are used in the same 
program. Add ecore_win32_screen_depth_get() to know the depth of the screen. 
Remove the management of the backend for direct3d and directdraw as they are 
done by the engines, now. More (ddraw 16 bits and gl) will follow later

===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_win32/Ecore_Win32.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- Ecore_Win32.h       31 May 2008 05:06:38 -0000      1.6
+++ Ecore_Win32.h       26 Jun 2008 04:30:28 -0000      1.7
@@ -35,12 +35,6 @@
 
 typedef void Ecore_Win32_Window;
 typedef void Ecore_Win32_Cursor;
-typedef void Ecore_Win32_DDraw_Object;
-typedef void Ecore_Win32_DDraw_Surface;
-typedef void Ecore_Win32_Direct3D_Object;
-typedef void Ecore_Win32_Direct3D_Device;
-typedef void Ecore_Win32_Direct3D_Sprite;
-typedef void Ecore_Win32_Direct3D_Texture;
 typedef void Ecore_Win32_Glew_DC;
 
 /* Window state */
@@ -312,6 +306,7 @@
 
 EAPI int    ecore_win32_init();
 EAPI int    ecore_win32_shutdown();
+EAPI int    ecore_win32_screen_depth_get();
 EAPI double ecore_win32_current_time_get(void);
 EAPI void   ecore_win32_message_loop_begin (void);
 
@@ -436,48 +431,6 @@
 EAPI Ecore_Win32_Cursor *ecore_win32_cursor_shape_get(Ecore_Win32_Cursor_Shape 
shape);
 
 EAPI int                 ecore_win32_cursor_size_get(void);
-
-/* DirectDraw */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EAPI int                        ecore_win32_ddraw_init(Ecore_Win32_Window 
*window);
-
-EAPI int                        ecore_win32_ddraw_16_init(Ecore_Win32_Window 
*window);
-
-EAPI void                       ecore_win32_ddraw_shutdown(Ecore_Win32_Window 
*window);
-
-EAPI Ecore_Win32_DDraw_Object  
*ecore_win32_ddraw_object_get(Ecore_Win32_Window *window);
-
-EAPI Ecore_Win32_DDraw_Surface 
*ecore_win32_ddraw_surface_primary_get(Ecore_Win32_Window *window);
-
-EAPI Ecore_Win32_DDraw_Surface 
*ecore_win32_ddraw_surface_back_get(Ecore_Win32_Window *window);
-
-EAPI Ecore_Win32_DDraw_Surface 
*ecore_win32_ddraw_surface_source_get(Ecore_Win32_Window *window);
-
-EAPI int                        ecore_win32_ddraw_depth_get(Ecore_Win32_Window 
*window);
-
-/* Direct3D */
-
-EAPI int                           
ecore_win32_direct3d_init(Ecore_Win32_Window *window);
-
-EAPI void                          
ecore_win32_direct3d_shutdown(Ecore_Win32_Window *window);
-
-EAPI Ecore_Win32_Direct3D_Object  
*ecore_win32_direct3d_object_get(Ecore_Win32_Window *window);
-
-EAPI Ecore_Win32_Direct3D_Device  
*ecore_win32_direct3d_device_get(Ecore_Win32_Window *window);
-
-EAPI Ecore_Win32_Direct3D_Sprite  
*ecore_win32_direct3d_sprite_get(Ecore_Win32_Window *window);
-
-EAPI Ecore_Win32_Direct3D_Texture 
*ecore_win32_direct3d_texture_get(Ecore_Win32_Window *window);
-
-EAPI int                           
ecore_win32_direct3d_depth_get(Ecore_Win32_Window *window);
-
-#ifdef __cplusplus
-}
-#endif
 
 /* OpenGL Glew */
 
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_win32/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- Makefile.am 26 May 2008 05:16:34 -0000      1.5
+++ Makefile.am 26 Jun 2008 04:30:29 -0000      1.6
@@ -15,8 +15,6 @@
 libecore_win32_la_SOURCES = \
 ecore_win32.c \
 ecore_win32_cursor.c \
-ecore_win32_ddraw.cpp \
-ecore_win32_direct3d.cpp \
 ecore_win32_event.c \
 ecore_win32_glew.c \
 ecore_win32_window.c
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_win32/ecore_win32.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ecore_win32.c       31 May 2008 05:06:38 -0000      1.5
+++ ecore_win32.c       26 Jun 2008 04:30:29 -0000      1.6
@@ -7,7 +7,6 @@
 #include "ecore_win32_private.h"
 
 
-Ecore_List         *_ecore_win32_windows_list = NULL;
 HINSTANCE           _ecore_win32_instance = NULL;
 double              _ecore_win32_double_click_time = 0.25;
 double              _ecore_win32_event_last_time = 0.0;
@@ -91,15 +90,7 @@
           RECT                        rect;
           struct _Ecore_Win32_Window *w = NULL;
 
-          ecore_list_first_goto(_ecore_win32_windows_list);
-          while ((w = ecore_list_next(_ecore_win32_windows_list)))
-            {
-               if (w->window == window)
-                 {
-                    ecore_list_remove(_ecore_win32_windows_list);
-                    break;
-                 }
-            }
+          w = (struct _Ecore_Win32_Window *)GetWindowLong(window, 
GWL_USERDATA);
 
           if (GetClientRect(window, &rect))
           {
@@ -321,14 +312,6 @@
         return 0;
      }
 
-   _ecore_win32_windows_list = ecore_list_new();
-   if (!_ecore_win32_windows_list)
-     {
-        UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance);
-        FreeLibrary(_ecore_win32_instance);
-        return 0;
-     }
-
    if (!ECORE_WIN32_EVENT_KEY_DOWN)
      {
         ECORE_WIN32_EVENT_KEY_DOWN              = ecore_event_type_new();
@@ -374,8 +357,6 @@
    if (_ecore_win32_init_count > 0) return _ecore_win32_init_count;
    if (!_ecore_win32_instance) return _ecore_win32_init_count;
 
-   ecore_list_destroy(_ecore_win32_windows_list);
-
    UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance);
    FreeLibrary(_ecore_win32_instance);
    _ecore_win32_instance = NULL;
@@ -383,6 +364,22 @@
    if (_ecore_win32_init_count < 0) _ecore_win32_init_count = 0;
 
    return _ecore_win32_init_count;
+}
+
+EAPI int
+ecore_win32_screen_depth_get()
+{
+   HDC dc;
+   int depth;
+
+   dc = GetDC(NULL);
+   if (!dc)
+     return 0;
+
+   depth = GetDeviceCaps(dc, BITSPIXEL);
+   ReleaseDC(NULL, dc);
+
+   return depth;
 }
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_win32/ecore_win32_event.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ecore_win32_event.c 16 Nov 2007 19:31:32 -0000      1.3
+++ ecore_win32_event.c 26 Jun 2008 04:30:29 -0000      1.4
@@ -329,21 +329,6 @@
    return 1;
 }
 
-Ecore_Win32_Window *
-_ecore_win32_event_window_get(HWND window)
-{
-   Ecore_Win32_Window *w = NULL;
-
-   ecore_list_first_goto(_ecore_win32_windows_list);
-   while ((w = ecore_list_next(_ecore_win32_windows_list)))
-     {
-       if (((struct _Ecore_Win32_Window *)w)->window == window)
-         return w;
-     }
-
-   return w;
-}
-
 void
 _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg,
                                     int                        is_keystroke)
@@ -378,7 +363,12 @@
      }
 
  store_key:
-   e->window = _ecore_win32_event_window_get(msg->window);
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
+   if (!e->window)
+     {
+        free(e);
+        return;
+     }
    e->time = (double)msg->time / 1000.0;
 
    _ecore_win32_event_last_time = e->time;
@@ -420,7 +410,12 @@
      }
 
  store_key:
-   e->window = _ecore_win32_event_window_get(msg->window);
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
+   if (!e->window)
+     {
+        free(e);
+        return;
+     }
    e->time = (double)msg->time / 1000.0;
 
    _ecore_win32_event_last_time = e->time;
@@ -434,7 +429,7 @@
 {
    Ecore_Win32_Window *window;
 
-   window = _ecore_win32_event_window_get(msg->window);
+   window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
 
    if (button > 3)
      {
@@ -526,7 +521,7 @@
           ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
        }
      }
-   printf (" * ecore event button press\n");
+/*    printf (" * ecore event button press\n"); */
 }
 
 void
@@ -535,7 +530,7 @@
 {
    Ecore_Win32_Window *window;
 
-   window = _ecore_win32_event_window_get(msg->window);
+   window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
 
    {
       Ecore_Win32_Event_Mouse_Move *e;
@@ -585,7 +580,7 @@
       ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
    }
 
-   printf (" * ecore event button release\n");
+/*    printf (" * ecore event button release\n"); */
 }
 
 void
@@ -596,7 +591,7 @@
    e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, 
sizeof(Ecore_Win32_Event_Mouse_Move));
    if (!e) return;
 
-   e->window = _ecore_win32_event_window_get(msg->window);
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
    e->x = GET_X_LPARAM(msg->data_param);
    e->y = GET_Y_LPARAM(msg->data_param);
    e->time = (double)msg->time / 1000.0;
@@ -613,7 +608,7 @@
      e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, 
sizeof(Ecore_Win32_Event_Mouse_Move));
      if (!e) return;
 
-     e->window = _ecore_win32_event_window_get(msg->window);
+     e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
      e->x = msg->x;
      e->y = msg->y;
      e->time = (double)msg->time / 1000.0;
@@ -630,7 +625,7 @@
      e = (Ecore_Win32_Event_Mouse_In *)calloc(1, 
sizeof(Ecore_Win32_Event_Mouse_In));
      if (!e) return;
 
-     e->window = _ecore_win32_event_window_get(msg->window);
+     e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
      e->x = msg->x;
      e->y = msg->y;
      e->time = (double)msg->time / 1000.0;
@@ -650,7 +645,7 @@
      e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, 
sizeof(Ecore_Win32_Event_Mouse_Move));
      if (!e) return;
 
-     e->window = _ecore_win32_event_window_get(msg->window);
+     e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
      e->x = msg->x;
      e->y = msg->y;
      e->time = (double)msg->time / 1000.0;
@@ -667,7 +662,7 @@
      e = (Ecore_Win32_Event_Mouse_Out *)calloc(1, 
sizeof(Ecore_Win32_Event_Mouse_Out));
      if (!e) return;
 
-     e->window = _ecore_win32_event_window_get(msg->window);
+     e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
      e->x = msg->x;
      e->y = msg->y;
      e->time = (double)msg->time / 1000.0;
@@ -686,7 +681,7 @@
    e = (Ecore_Win32_Event_Window_Focus_In *)calloc(1, 
sizeof(Ecore_Win32_Event_Window_Focus_In));
    if (!e) return;
 
-   e->window = _ecore_win32_event_window_get(msg->window);
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
 
    e->time = _ecore_win32_event_last_time;
    _ecore_win32_event_last_time = e->time;
@@ -702,7 +697,7 @@
    e = (Ecore_Win32_Event_Window_Focus_Out *)calloc(1, 
sizeof(Ecore_Win32_Event_Window_Focus_Out));
    if (!e) return;
 
-   e->window = _ecore_win32_event_window_get(msg->window);
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
 
    e->time = _ecore_win32_event_last_time;
    _ecore_win32_event_last_time = e->time;
@@ -718,13 +713,13 @@
    e = (Ecore_Win32_Event_Window_Damage *)calloc(1, 
sizeof(Ecore_Win32_Event_Window_Damage));
    if (!e) return;
 
-   e->window = _ecore_win32_event_window_get(msg->window);
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
 
    e->x = msg->update.left;
    e->y = msg->update.top;
    e->width = msg->update.right - msg->update.left;
    e->height = msg->update.bottom - msg->update.top;
-   printf (" * ecore : event expose %d %d\n", e->width, e->height);
+/*    printf (" * ecore : event expose %d %d\n", e->width, e->height); */
 
    e->time = _ecore_win32_event_last_time;
 
@@ -739,7 +734,7 @@
    e = calloc(1, sizeof(Ecore_Win32_Event_Window_Create));
    if (!e) return;
 
-   e->window = _ecore_win32_event_window_get(msg->window);
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
 
    e->time = _ecore_win32_event_last_time;
 
@@ -754,7 +749,7 @@
    e = calloc(1, sizeof(Ecore_Win32_Event_Window_Destroy));
    if (!e) return;
 
-   e->window = _ecore_win32_event_window_get(msg->window);
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
 
    e->time = _ecore_win32_event_last_time;
    if (e->window == _ecore_win32_event_last_window) 
_ecore_win32_event_last_window = NULL;
@@ -770,7 +765,7 @@
    e = calloc(1, sizeof(Ecore_Win32_Event_Window_Show));
    if (!e) return;
 
-   e->window = _ecore_win32_event_window_get(msg->window);
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
 
    e->time = _ecore_win32_event_last_time;
 
@@ -785,7 +780,7 @@
    e = calloc(1, sizeof(Ecore_Win32_Event_Window_Hide));
    if (!e) return;
 
-   e->window = _ecore_win32_event_window_get(msg->window);
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
 
    e->time = _ecore_win32_event_last_time;
 
@@ -810,9 +805,9 @@
         return;
      }
 
-   printf ("_ecore_win32_event_handle_configure_notify\n");
-   e->window = _ecore_win32_event_window_get(window_pos->hwnd);
-   e->abovewin = _ecore_win32_event_window_get(window_pos->hwndInsertAfter);
+/*    printf ("_ecore_win32_event_handle_configure_notify\n"); */
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
+   e->abovewin = (void *)GetWindowLong(window_pos->hwndInsertAfter, 
GWL_USERDATA);
    e->x = wi.rcClient.left;
    e->y = wi.rcClient.top;
    e->width = wi.rcClient.right - wi.rcClient.left;
@@ -834,11 +829,11 @@
    e = calloc(1, sizeof(Ecore_Win32_Event_Window_Resize));
    if (!e) return;
 
-   e->window = _ecore_win32_event_window_get(msg->window);
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
    e->width = rect.right - rect.left;
    e->height = rect.bottom - rect.top;
    e->time = _ecore_win32_event_last_time;
-   printf (" * _ecore_win32_event_handle_resize %d %d\n", e->width, e->height);
+/*    printf (" * _ecore_win32_event_handle_resize %d %d\n", e->width, 
e->height); */
 
    ecore_event_add(ECORE_WIN32_EVENT_WINDOW_RESIZE, e, NULL, NULL);
 }
@@ -851,7 +846,7 @@
    e = calloc(1, sizeof(Ecore_Win32_Event_Window_Delete_Request));
    if (!e) return;
 
-   e->window = _ecore_win32_event_window_get(msg->window);
+   e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
    e->time = _ecore_win32_event_last_time;
 
    ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_win32/ecore_win32_private.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ecore_win32_private.h       26 May 2008 05:16:34 -0000      1.4
+++ ecore_win32_private.h       26 Jun 2008 04:30:29 -0000      1.5
@@ -13,13 +13,6 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #undef WIN32_LEAN_AND_MEAN
-#ifdef HAVE_DIRECTDRAW
-# include <ddraw.h>
-#endif /* HAVE_DIRECTDRAW */
-#ifdef HAVE_DIRECT3D
-# include <d3d9.h>
-# include <d3dx9.h>
-#endif /* HAVE_DIRECT3D */
 #ifdef HAVE_OPENGL_GLEW
 # include <GL/glew.h>
 #endif /* HAVE_OPENGL_GLEW */
@@ -35,9 +28,7 @@
 
 typedef enum
 {
-   ECORE_WIN32_BACKEND_DIRECTDRAW,
    ECORE_WIN32_BACKEND_DIRECTDRAW_16,
-   ECORE_WIN32_BACKEND_DIRECT3D,
    ECORE_WIN32_BACKEND_GLEW,
    ECORE_WIN32_BACKEND_NONE
 }Ecore_Win32_Backend;
@@ -61,27 +52,6 @@
    HWND                   window;
 
   Ecore_Win32_Backend     backend;
-
-#ifdef HAVE_DIRECTDRAW
-   struct {
-      LPDIRECTDRAW        object;
-      LPDIRECTDRAWSURFACE surface_primary;
-      LPDIRECTDRAWSURFACE surface_back;
-      LPDIRECTDRAWSURFACE surface_source;
-      LPDIRECTDRAWCLIPPER clipper;
-      int                 depth;
-   } ddraw;
-#endif /* HAVE_DIRECTDRAW */
-
-#ifdef HAVE_DIRECT3D
-   struct {
-      LPDIRECT3D9         object;
-      LPDIRECT3DDEVICE9   device;
-      LPD3DXSPRITE        sprite;
-      LPDIRECT3DTEXTURE9  texture;
-      int                 depth;
-   } d3d;
-#endif /* HAVE_DIRECT3D */
 
 #ifdef HAVE_OPENGL_GLEW
    struct {
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_win32/ecore_win32_window.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ecore_win32_window.c        10 Jun 2008 22:12:12 -0000      1.5
+++ ecore_win32_window.c        26 Jun 2008 04:30:29 -0000      1.6
@@ -79,9 +79,9 @@
         return NULL;
      }
 
-   if (ecore_list_append(_ecore_win32_windows_list, w) == FALSE)
+   SetLastError(0);
+   if (!SetWindowLong(w->window, GWL_USERDATA, (LONG)w) && (GetLastError() != 
0))
      {
-        ecore_win32_ddraw_shutdown(w);
         DestroyWindow(w->window);
         free(w);
         return NULL;
@@ -167,35 +167,12 @@
 
    if (!window) return;
 
-   ecore_list_first_goto(_ecore_win32_windows_list);
-   while ((w = ecore_list_next(_ecore_win32_windows_list)))
-     {
-       if (w == window)
-         {
-            ecore_list_remove(_ecore_win32_windows_list);
-            break;
-         }
-     }
-/*    ecore_list_remove(_ecore_win32_windows_list); */
-
    switch (((struct _Ecore_Win32_Window *)window)->backend)
      {
-     case ECORE_WIN32_BACKEND_DIRECTDRAW:
-#ifdef HAVE_DIRECTDRAW
-       ecore_win32_ddraw_shutdown(window);
-#endif /* HAVE_DIRECTDRAW */
-       break;
      case ECORE_WIN32_BACKEND_DIRECTDRAW_16:
 #ifdef HAVE_DIRECTDRAW
 /*        ecore_win32_ddraw_shutdown(window); */
 #endif /* HAVE_DIRECTDRAW */
-       break;
-     case ECORE_WIN32_BACKEND_DIRECT3D:
-#ifdef HAVE_DIRECT3D
-       printf ("d3d shut 0 \n");
-       ecore_win32_direct3d_shutdown(window);
-       printf ("d3d shut 1 \n");
-#endif /* HAVE_DIRECT3D */
        break;
      case ECORE_WIN32_BACKEND_GLEW:
 #ifdef HAVE_OPENGL_GLEW



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to