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 
Added Files:
        ecore_win32_cursor.c 


Log Message:

 * add cursor support
 * add mouse wheel, window create, window configure and window resize events
 * fix fullscreen function
 * fix button release even
 * add _geometry_get function 
 * minor cleanups


===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_win32/Ecore_Win32.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Ecore_Win32.h       26 Aug 2007 11:17:21 -0000      1.1
+++ Ecore_Win32.h       23 Sep 2007 11:08:52 -0000      1.2
@@ -29,6 +29,7 @@
 
 
 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;
@@ -36,22 +37,46 @@
 typedef void Ecore_Win32_Direct3D_Sprite;
 typedef void Ecore_Win32_Direct3D_Texture;
 
+/*cursor shapes */
+
+typedef enum
+{
+   ECORE_WIN32_CURSO_SHAPE_APP_STARTING, /* Standard arrow and small hourglass 
*/
+   ECORE_WIN32_CURSO_SHAPE_ARROW,        /* Standard arrow */
+   ECORE_WIN32_CURSO_SHAPE_CROSS,        /* Crosshair */
+   ECORE_WIN32_CURSO_SHAPE_HAND,         /* Hand */
+   ECORE_WIN32_CURSO_SHAPE_HELP,         /* Arrow and question mark */
+   ECORE_WIN32_CURSO_SHAPE_I_BEAM,       /* I-beam */
+   ECORE_WIN32_CURSO_SHAPE_NO,           /* Slashed circle */
+   ECORE_WIN32_CURSO_SHAPE_SIZE_ALL,     /* Four-pointed arrow pointing north, 
south, east, and west */
+   ECORE_WIN32_CURSO_SHAPE_SIZE_NESW,    /* Double-pointed arrow pointing 
northeast and southwest */
+   ECORE_WIN32_CURSO_SHAPE_SIZE_NS,      /* Double-pointed arrow pointing 
north and south */
+   ECORE_WIN32_CURSO_SHAPE_SIZE_NWSE,    /* Double-pointed arrow pointing 
northwest and southeast */
+   ECORE_WIN32_CURSO_SHAPE_SIZE_WE,      /* Double-pointed arrow pointing west 
and east */
+   ECORE_WIN32_CURSO_SHAPE_UP_ARROW,     /* Vertical arrow */
+   ECORE_WIN32_CURSO_SHAPE_WAIT          /* Hourglass */
+} Ecore_Win32_Cursor_Shape;
+
 /* Events */
 
-typedef struct _Ecore_Win32_Event_Key_Down          Ecore_Win32_Event_Key_Down;
-typedef struct _Ecore_Win32_Event_Key_Up            Ecore_Win32_Event_Key_Up;
-typedef struct _Ecore_Win32_Event_Mouse_Button_Down 
Ecore_Win32_Event_Mouse_Button_Down;
-typedef struct _Ecore_Win32_Event_Mouse_Button_Up   
Ecore_Win32_Event_Mouse_Button_Up;
-typedef struct _Ecore_Win32_Event_Mouse_Move        
Ecore_Win32_Event_Mouse_Move;
-typedef struct _Ecore_Win32_Event_Mouse_In          Ecore_Win32_Event_Mouse_In;
-typedef struct _Ecore_Win32_Event_Mouse_Out         
Ecore_Win32_Event_Mouse_Out;
-typedef struct _Ecore_Win32_Event_Window_Focus_In   
Ecore_Win32_Event_Window_Focus_In;
-typedef struct _Ecore_Win32_Event_Window_Focus_Out  
Ecore_Win32_Event_Window_Focus_Out;
-typedef struct _Ecore_Win32_Event_Window_Damage     
Ecore_Win32_Event_Window_Damage;
-typedef struct _Ecore_Win32_Event_Window_Destroy    
Ecore_Win32_Event_Window_Destroy;
-typedef struct _Ecore_Win32_Event_Window_Hide       
Ecore_Win32_Event_Window_Hide;
-typedef struct _Ecore_Win32_Event_Window_Show       
Ecore_Win32_Event_Window_Show;
-typedef struct _Ecore_Win32_Event_Window_Delete     
Ecore_Win32_Event_Window_Delete;
+typedef struct _Ecore_Win32_Event_Key_Down              
Ecore_Win32_Event_Key_Down;
+typedef struct _Ecore_Win32_Event_Key_Up                
Ecore_Win32_Event_Key_Up;
+typedef struct _Ecore_Win32_Event_Mouse_Button_Down     
Ecore_Win32_Event_Mouse_Button_Down;
+typedef struct _Ecore_Win32_Event_Mouse_Button_Up       
Ecore_Win32_Event_Mouse_Button_Up;
+typedef struct _Ecore_Win32_Event_Mouse_Move            
Ecore_Win32_Event_Mouse_Move;
+typedef struct _Ecore_Win32_Event_Mouse_In              
Ecore_Win32_Event_Mouse_In;
+typedef struct _Ecore_Win32_Event_Mouse_Out             
Ecore_Win32_Event_Mouse_Out;
+typedef struct _Ecore_Win32_Event_Mouse_Wheel           
Ecore_Win32_Event_Mouse_Wheel;
+typedef struct _Ecore_Win32_Event_Window_Focus_In       
Ecore_Win32_Event_Window_Focus_In;
+typedef struct _Ecore_Win32_Event_Window_Focus_Out      
Ecore_Win32_Event_Window_Focus_Out;
+typedef struct _Ecore_Win32_Event_Window_Damage         
Ecore_Win32_Event_Window_Damage;
+typedef struct _Ecore_Win32_Event_Window_Create         
Ecore_Win32_Event_Window_Create;
+typedef struct _Ecore_Win32_Event_Window_Destroy        
Ecore_Win32_Event_Window_Destroy;
+typedef struct _Ecore_Win32_Event_Window_Hide           
Ecore_Win32_Event_Window_Hide;
+typedef struct _Ecore_Win32_Event_Window_Show           
Ecore_Win32_Event_Window_Show;
+typedef struct _Ecore_Win32_Event_Window_Configure      
Ecore_Win32_Event_Window_Configure;
+typedef struct _Ecore_Win32_Event_Window_Resize         
Ecore_Win32_Event_Window_Resize;
+typedef struct _Ecore_Win32_Event_Window_Delete_Request 
Ecore_Win32_Event_Window_Delete_Request;
 
 struct _Ecore_Win32_Event_Key_Down
 {
@@ -117,6 +142,17 @@
    double              time;
 };
 
+struct _Ecore_Win32_Event_Mouse_Wheel
+{
+   Ecore_Win32_Window *window;
+   int                 direction; /* 0 = default up/down wheel FIXME: more 
wheel types */
+   int                 z; /* ...,-2,-1 = down, 1,2,... = up */
+   int                 modifiers;
+   int                 x;
+   int                 y;
+   double              time;
+};
+
 struct _Ecore_Win32_Event_Window_Focus_In
 {
    Ecore_Win32_Window *window;
@@ -139,6 +175,12 @@
    double              time;
 };
 
+struct _Ecore_Win32_Event_Window_Create
+{
+   Ecore_Win32_Window *window;
+   double              time;
+};
+
 struct _Ecore_Win32_Event_Window_Destroy
 {
    Ecore_Win32_Window *window;
@@ -157,7 +199,26 @@
    double              time;
 };
 
-struct _Ecore_Win32_Event_Window_Delete
+struct _Ecore_Win32_Event_Window_Configure
+{
+   Ecore_Win32_Window *window;
+   Ecore_Win32_Window *abovewin;
+   int                 x;
+   int                 y;
+   int                 width;
+   int                 height;
+   double              time;
+};
+
+struct _Ecore_Win32_Event_Window_Resize
+{
+   Ecore_Win32_Window *window;
+   int                 width;
+   int                 height;
+   double              time;
+};
+
+struct _Ecore_Win32_Event_Window_Delete_Request
 {
    Ecore_Win32_Window *window;
    double              time;
@@ -170,13 +231,17 @@
 EAPI extern int ECORE_WIN32_EVENT_MOUSE_MOVE;
 EAPI extern int ECORE_WIN32_EVENT_MOUSE_IN;
 EAPI extern int ECORE_WIN32_EVENT_MOUSE_OUT;
+EAPI extern int ECORE_WIN32_EVENT_MOUSE_WHEEL;
 EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN;
 EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT;
 EAPI extern int ECORE_WIN32_EVENT_WINDOW_DAMAGE;
+EAPI extern int ECORE_WIN32_EVENT_WINDOW_CREATE;
 EAPI extern int ECORE_WIN32_EVENT_WINDOW_DESTROY;
 EAPI extern int ECORE_WIN32_EVENT_WINDOW_HIDE;
 EAPI extern int ECORE_WIN32_EVENT_WINDOW_SHOW;
-EAPI extern int ECORE_WIN32_EVENT_WINDOW_DELETE;
+EAPI extern int ECORE_WIN32_EVENT_WINDOW_CONFIGURE;
+EAPI extern int ECORE_WIN32_EVENT_WINDOW_RESIZE;
+EAPI extern int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST;
 
 
 /* Core */
@@ -209,6 +274,12 @@
                                          int                 width,
                                          int                 height);
 
+EAPI void ecore_win32_window_geometry_get(Ecore_Win32_Window *window,
+                                          int                *x,
+                                          int                *y,
+                                          int                *width,
+                                          int                *height);
+
 EAPI void ecore_win32_window_size_get(Ecore_Win32_Window *window,
                                       int                *width,
                                       int                *height);
@@ -251,19 +322,37 @@
 EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
                                             int                 on);
 
+EAPI void ecore_win32_window_cursor_set(Ecore_Win32_Window *window,
+                                        Ecore_Win32_Cursor *cursor);
+
+/* Cursor */
+
+EAPI Ecore_Win32_Cursor *ecore_win32_cursor_new(const void *pixels_and,
+                                                const void *pixels_xor,
+                                                int         width,
+                                                int         height,
+                                                int         hot_x,
+                                                int         hot_y);
+
+EAPI void                ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor);
+
+EAPI Ecore_Win32_Cursor *ecore_win32_cursor_shape_get(Ecore_Win32_Cursor_Shape 
shape);
+
+EAPI int                 ecore_win32_cursor_size_get(void);
+
 /* DirectDraw */
 
-EAPI int   ecore_win32_ddraw_init(Ecore_Win32_Window *window);
+EAPI int                        ecore_win32_ddraw_init(Ecore_Win32_Window 
*window);
 
-EAPI void  ecore_win32_ddraw_shutdown(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_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 int ecore_win32_ddraw_depth_get(Ecore_Win32_Window *window);
+EAPI int                        ecore_win32_ddraw_depth_get(Ecore_Win32_Window 
*window);
 
 /* Direct3D */
 
@@ -271,19 +360,19 @@
 extern "C" {
 #endif
 
-EAPI int   ecore_win32_direct3d_init(Ecore_Win32_Window *window);
+EAPI int                           
ecore_win32_direct3d_init(Ecore_Win32_Window *window);
 
-EAPI void  ecore_win32_direct3d_shutdown(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_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_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_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);
+EAPI int                           
ecore_win32_direct3d_depth_get(Ecore_Win32_Window *window);
 
 #ifdef __cplusplus
 }
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_win32/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Makefile.am 26 Aug 2007 11:17:21 -0000      1.1
+++ Makefile.am 23 Sep 2007 11:08:52 -0000      1.2
@@ -6,6 +6,7 @@
 
 libecore_win32_la_LDFLAGS = \
 -version-info 1:0:0 \
[EMAIL PROTECTED]@  \
 -L$(top_builddir)/src/lib/ecore/.libs
 
 
@@ -17,6 +18,7 @@
 
 libecore_win32_la_SOURCES = \
 ecore_win32.c \
+ecore_win32_cursor.c \
 ecore_win32_direct3d.cpp \
 ecore_win32_ddraw.c \
 ecore_win32_event.c \
@@ -25,7 +27,7 @@
 
 libecore_win32_la_LIBADD = \
 @ddraw_libs@ @direct3d_libs@ \
[EMAIL PROTECTED]@ -lwsock32 \
+-lwsock32 \
 $(top_builddir)/src/lib/ecore/libecore.la
 
 endif
@@ -33,6 +35,7 @@
 EXTRA_DIST = \
 Ecore_Win32.h \
 ecore_win32.c \
+ecore_win32_cursor.c \
 ecore_win32_direct3d.cpp \
 ecore_win32_ddraw.c \
 ecore_win32_event.c \
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_win32/ecore_win32.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_win32.c       26 Aug 2007 11:17:21 -0000      1.1
+++ ecore_win32.c       23 Sep 2007 11:08:52 -0000      1.2
@@ -53,6 +53,7 @@
 
    switch (data->message)
      {
+       /* Keyboard input notifications */
      case WM_KEYDOWN:
        printf (" * ecore message : keystroke down\n");
        _ecore_win32_event_handle_key_press(data, 1);
@@ -64,6 +65,15 @@
        printf (" * ecore message : keystroke up\n");
        _ecore_win32_event_handle_key_release(data, 1);
        return 0;
+     case WM_SETFOCUS:
+       printf (" * ecore message : focus in\n");
+       _ecore_win32_event_handle_focus_in(data);
+       return 0;
+     case WM_KILLFOCUS:
+       printf (" * ecore message : focus out\n");
+       _ecore_win32_event_handle_focus_out(data);
+       return 0;
+       /* Mouse input notifications */
      case WM_LBUTTONDOWN:
        printf (" * ecore message : lbuttondown\n");
        _ecore_win32_event_handle_button_press(data, 1);
@@ -131,6 +141,15 @@
 
           return 0;
        }
+     case WM_MOUSEWHEEL:
+       printf (" * ecore message : mouse wheel\n");
+       _ecore_win32_event_handle_button_press(data, 4);
+       return 0;
+       /* Window notifications */
+     case WM_CREATE:
+       printf (" * ecore message : create\n");
+       _ecore_win32_event_handle_create_notify(data);
+       return 0;
      case WM_DESTROY:
        printf (" * ecore message : destroy\n");
        _ecore_win32_event_handle_destroy_notify(data);
@@ -147,6 +166,37 @@
          _ecore_win32_event_handle_unmap_notify(data);
 
        return 0;
+     case WM_CLOSE:
+       printf (" * ecore message : close\n");
+       _ecore_win32_event_handle_delete_request(data);
+       return 0;
+     case WM_MOVING:
+       printf (" * ecore message : moving\n");
+       return TRUE;
+     case WM_MOVE:
+       printf (" * ecore message : moved\n");
+       return 0;
+     case WM_SIZING:
+       printf (" * ecore message : sizing\n");
+       _ecore_win32_event_handle_resize(data);
+       return TRUE;
+     case WM_SIZE:
+       printf (" * ecore message : sized\n");
+       return 0;
+     case WM_WINDOWPOSCHANGING:
+       printf (" * ecore message : WM_WINDOWPOSCHANGING\n");
+       return 0;
+     case WM_WINDOWPOSCHANGED:
+       printf (" * ecore message : WM_WINDOWPOSCHANGED\n");
+       _ecore_win32_event_handle_configure_notify(data);
+       return 0;
+     case WM_ENTERSIZEMOVE :
+       printf (" * ecore message : WM_ENTERSIZEMOVE \n");
+       return 0;
+     case WM_EXITSIZEMOVE:
+       printf (" * ecore message : WM_EXITSIZEMOVE\n");
+       return 0;
+       /* GDI notifications */
      case WM_PAINT:
        {
          RECT rect;
@@ -158,34 +208,29 @@
               HDC         hdc;
 
               hdc = BeginPaint(window, &ps);
+              data->update = rect;
+              _ecore_win32_event_handle_expose(data);
               EndPaint(window, &ps);
-              printf ("%ld %ld %ld %ld\n",
+              printf (" *    %ld %ld %ld %ld\n",
                       rect.left,
                       rect.top,
                       rect.right - rect.left,
                       rect.bottom - rect.top);
-              data->update = rect;
-              _ecore_win32_event_handle_expose(data);
            }
          return 0;
        }
-     case WM_CLOSE:
-       printf (" * ecore message : close\n");
-       _ecore_win32_event_handle_delete(data);
-       return 0;
-     case WM_SETFOCUS:
-       printf (" * ecore message : focus in\n");
-       _ecore_win32_event_handle_focus_in(data);
+     case WM_SETREDRAW:
+       printf (" * ecore message : WM_SETREDRAW\n");
        return 0;
-     case WM_KILLFOCUS:
-       printf (" * ecore message : focus out\n");
-       _ecore_win32_event_handle_focus_out(data);
+     case WM_SYNCPAINT:
+       printf (" * ecore message : WM_SYNCPAINT\n");
        return 0;
      default:
        return DefWindowProc(window, message, window_param, data_param);
      }
 
 }
+
 /*
   Events:
 
@@ -199,31 +244,37 @@
 x * mouse button up left
 x * mouse button up middle
 x * mouse button up right
-  * mouse move (contains enter)
-  * mouse leave
-  * focus in
-  * focus out
-  * expose
-  * create
-  * destroy
-  * resize
+x * mouse move (contains enter)
+x * mouse leave
+x * focus in
+x * focus out
+x * expose
+x * create
+x * destroy
+x * configure
+x * resize
+x * delete
 
 */
 
-EAPI int ECORE_WIN32_EVENT_KEY_DOWN          = 0;
-EAPI int ECORE_WIN32_EVENT_KEY_UP            = 0;
-EAPI int ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN = 0;
-EAPI int ECORE_WIN32_EVENT_MOUSE_BUTTON_UP   = 0;
-EAPI int ECORE_WIN32_EVENT_MOUSE_MOVE        = 0;
-EAPI int ECORE_WIN32_EVENT_MOUSE_IN          = 0;
-EAPI int ECORE_WIN32_EVENT_MOUSE_OUT         = 0;
-EAPI int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN   = 0;
-EAPI int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT  = 0;
-EAPI int ECORE_WIN32_EVENT_WINDOW_DAMAGE     = 0;
-EAPI int ECORE_WIN32_EVENT_WINDOW_DESTROY    = 0;
-EAPI int ECORE_WIN32_EVENT_WINDOW_SHOW       = 0;
-EAPI int ECORE_WIN32_EVENT_WINDOW_HIDE       = 0;
-EAPI int ECORE_WIN32_EVENT_WINDOW_DELETE     = 0;
+EAPI int ECORE_WIN32_EVENT_KEY_DOWN              = 0;
+EAPI int ECORE_WIN32_EVENT_KEY_UP                = 0;
+EAPI int ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN     = 0;
+EAPI int ECORE_WIN32_EVENT_MOUSE_BUTTON_UP       = 0;
+EAPI int ECORE_WIN32_EVENT_MOUSE_MOVE            = 0;
+EAPI int ECORE_WIN32_EVENT_MOUSE_IN              = 0;
+EAPI int ECORE_WIN32_EVENT_MOUSE_OUT             = 0;
+EAPI int ECORE_WIN32_EVENT_MOUSE_WHEEL           = 0;
+EAPI int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN       = 0;
+EAPI int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT      = 0;
+EAPI int ECORE_WIN32_EVENT_WINDOW_DAMAGE         = 0;
+EAPI int ECORE_WIN32_EVENT_WINDOW_CREATE         = 0;
+EAPI int ECORE_WIN32_EVENT_WINDOW_DESTROY        = 0;
+EAPI int ECORE_WIN32_EVENT_WINDOW_SHOW           = 0;
+EAPI int ECORE_WIN32_EVENT_WINDOW_HIDE           = 0;
+EAPI int ECORE_WIN32_EVENT_WINDOW_CONFIGURE      = 0;
+EAPI int ECORE_WIN32_EVENT_WINDOW_RESIZE         = 0;
+EAPI int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = 0;
 
 
 EAPI int
@@ -270,20 +321,24 @@
 
    if (!ECORE_WIN32_EVENT_KEY_DOWN)
      {
-        ECORE_WIN32_EVENT_KEY_DOWN          = ecore_event_type_new();
-        ECORE_WIN32_EVENT_KEY_UP            = ecore_event_type_new();
-        ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
-        ECORE_WIN32_EVENT_MOUSE_BUTTON_UP   = ecore_event_type_new();
-        ECORE_WIN32_EVENT_MOUSE_MOVE        = ecore_event_type_new();
-        ECORE_WIN32_EVENT_MOUSE_IN          = ecore_event_type_new();
-        ECORE_WIN32_EVENT_MOUSE_OUT         = ecore_event_type_new();
-       ECORE_WIN32_EVENT_WINDOW_FOCUS_IN   = ecore_event_type_new();
-       ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT  = ecore_event_type_new();
-        ECORE_WIN32_EVENT_WINDOW_DAMAGE     = ecore_event_type_new();
-        ECORE_WIN32_EVENT_WINDOW_DESTROY    = ecore_event_type_new();
-        ECORE_WIN32_EVENT_WINDOW_SHOW       = ecore_event_type_new();
-        ECORE_WIN32_EVENT_WINDOW_HIDE       = ecore_event_type_new();
-        ECORE_WIN32_EVENT_WINDOW_DELETE     = ecore_event_type_new();
+        ECORE_WIN32_EVENT_KEY_DOWN              = ecore_event_type_new();
+        ECORE_WIN32_EVENT_KEY_UP                = ecore_event_type_new();
+        ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN     = ecore_event_type_new();
+        ECORE_WIN32_EVENT_MOUSE_BUTTON_UP       = ecore_event_type_new();
+        ECORE_WIN32_EVENT_MOUSE_MOVE            = ecore_event_type_new();
+        ECORE_WIN32_EVENT_MOUSE_IN              = ecore_event_type_new();
+        ECORE_WIN32_EVENT_MOUSE_OUT             = ecore_event_type_new();
+        ECORE_WIN32_EVENT_MOUSE_WHEEL           = ecore_event_type_new();
+        ECORE_WIN32_EVENT_WINDOW_FOCUS_IN       = ecore_event_type_new();
+        ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT      = ecore_event_type_new();
+        ECORE_WIN32_EVENT_WINDOW_DAMAGE         = ecore_event_type_new();
+        ECORE_WIN32_EVENT_WINDOW_CREATE         = ecore_event_type_new();
+        ECORE_WIN32_EVENT_WINDOW_DESTROY        = ecore_event_type_new();
+        ECORE_WIN32_EVENT_WINDOW_SHOW           = ecore_event_type_new();
+        ECORE_WIN32_EVENT_WINDOW_HIDE           = ecore_event_type_new();
+        ECORE_WIN32_EVENT_WINDOW_CONFIGURE      = ecore_event_type_new();
+        ECORE_WIN32_EVENT_WINDOW_RESIZE         = ecore_event_type_new();
+        ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
      }
 
    _ecore_win32_init_count++;
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_win32/ecore_win32_event.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_win32_event.c 26 Aug 2007 11:17:21 -0000      1.1
+++ ecore_win32_event.c 23 Sep 2007 11:08:52 -0000      1.2
@@ -345,7 +345,8 @@
 }
 
 void
-_ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, int 
is_keystroke)
+_ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg,
+                                    int                        is_keystroke)
 {
    Ecore_Win32_Event_Key_Down *e;
 
@@ -386,7 +387,8 @@
 }
 
 void
-_ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg, int 
is_keystroke)
+_ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg,
+                                      int                        is_keystroke)
 {
    Ecore_Win32_Event_Key_Up *e;
 
@@ -428,85 +430,107 @@
 
 void
 _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
-                                       int  button)
+                                       int                        button)
 {
    Ecore_Win32_Window *window;
 
    window = _ecore_win32_event_window_get(msg->window);
 
-   {
-      Ecore_Win32_Event_Mouse_Move *e;
-
-      e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, 
sizeof(Ecore_Win32_Event_Mouse_Move));
-      if (!e) return;
-
-      e->window = window;
-      e->x = GET_X_LPARAM(msg->data_param);
-      e->y = GET_Y_LPARAM(msg->data_param);
-      e->time = (double)msg->time / 1000.0;
-
-      _ecore_win32_event_last_time = e->time;
-      _ecore_win32_event_last_window = e->window;
-
-      ecore_event_add(ECORE_WIN32_EVENT_MOUSE_MOVE, e, NULL, NULL);
-   }
-
-   {
-      Ecore_Win32_Event_Mouse_Button_Down *e;
-
-      if (_ecore_win32_mouse_down_did_triple)
-        {
-           _ecore_win32_mouse_down_last_window = NULL;
-           _ecore_win32_mouse_down_last_last_window = NULL;
-           _ecore_win32_mouse_down_last_time = 0.0;
-           _ecore_win32_mouse_down_last_last_time = 0.0;
-        }
-
-      e = (Ecore_Win32_Event_Mouse_Button_Down *)calloc(1, 
sizeof(Ecore_Win32_Event_Mouse_Button_Down));
-      if (!e) return;
+   if (button > 3)
+     {
+        Ecore_Win32_Event_Mouse_Wheel *e;
 
-      e->window = window;
-      e->button = button;
-      e->x = GET_X_LPARAM(msg->data_param);
-      e->y = GET_Y_LPARAM(msg->data_param);
-      e->time = (double)msg->time / 1000.0;
+        e = (Ecore_Win32_Event_Mouse_Wheel *)calloc(1, 
sizeof(Ecore_Win32_Event_Mouse_Wheel));
+        if (!e) return;
 
-      if (((e->time - _ecore_win32_mouse_down_last_time) <= 
_ecore_win32_double_click_time) &&
-          (e->window == _ecore_win32_mouse_down_last_window))
-        e->double_click = 1;
+       e->direction = 0;
+        /* wheel delta is positive or negative, never 0 */
+       e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? 1 : -1;
+       e->x = GET_X_LPARAM(msg->data_param);
+       e->y = GET_Y_LPARAM(msg->data_param);
+        e->time = (double)msg->time / 1000.0;
 
-      if (((e->time - _ecore_win32_mouse_down_last_last_time) <= (2.0 * 
_ecore_win32_double_click_time)) &&
-          (e->window == _ecore_win32_mouse_down_last_window) &&
-          (e->window == _ecore_win32_mouse_down_last_last_window))
-        {
-           e->triple_click = 1;
-           _ecore_win32_mouse_down_did_triple = 1;
-        }
-      else
-        _ecore_win32_mouse_down_did_triple = 0;
+        _ecore_win32_event_last_time = e->time;
+        _ecore_win32_event_last_window = e->window;
 
-      if (!e->double_click && !e->triple_click)
-        _ecore_win32_mouse_up_count = 0;
+        ecore_event_add(ECORE_WIN32_EVENT_MOUSE_WHEEL, e, NULL, NULL);
+     }
+   else
+     {
+       {
+          Ecore_Win32_Event_Mouse_Move *e;
 
-      _ecore_win32_event_last_time = e->time;
-      _ecore_win32_event_last_window = e->window;
+          e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, 
sizeof(Ecore_Win32_Event_Mouse_Move));
+          if (!e) return;
 
-      if (!_ecore_win32_mouse_down_did_triple)
-        {
-           _ecore_win32_mouse_down_last_last_window = 
_ecore_win32_mouse_down_last_window;
-           _ecore_win32_mouse_down_last_window = e->window;
-           _ecore_win32_mouse_down_last_last_time = 
_ecore_win32_mouse_down_last_time;
-           _ecore_win32_mouse_down_last_time = e->time;
-        }
+          e->window = window;
+          e->x = GET_X_LPARAM(msg->data_param);
+          e->y = GET_Y_LPARAM(msg->data_param);
+          e->time = (double)msg->time / 1000.0;
+
+          _ecore_win32_event_last_time = e->time;
+          _ecore_win32_event_last_window = e->window;
+
+          ecore_event_add(ECORE_WIN32_EVENT_MOUSE_MOVE, e, NULL, NULL);
+       }
+
+       {
+          Ecore_Win32_Event_Mouse_Button_Down *e;
+
+          if (_ecore_win32_mouse_down_did_triple)
+            {
+               _ecore_win32_mouse_down_last_window = NULL;
+               _ecore_win32_mouse_down_last_last_window = NULL;
+               _ecore_win32_mouse_down_last_time = 0.0;
+               _ecore_win32_mouse_down_last_last_time = 0.0;
+            }
+
+          e = (Ecore_Win32_Event_Mouse_Button_Down *)calloc(1, 
sizeof(Ecore_Win32_Event_Mouse_Button_Down));
+          if (!e) return;
+
+          e->window = window;
+          e->button = button;
+          e->x = GET_X_LPARAM(msg->data_param);
+          e->y = GET_Y_LPARAM(msg->data_param);
+          e->time = (double)msg->time / 1000.0;
+
+          if (((e->time - _ecore_win32_mouse_down_last_time) <= 
_ecore_win32_double_click_time) &&
+              (e->window == _ecore_win32_mouse_down_last_window))
+            e->double_click = 1;
+
+          if (((e->time - _ecore_win32_mouse_down_last_last_time) <= (2.0 * 
_ecore_win32_double_click_time)) &&
+              (e->window == _ecore_win32_mouse_down_last_window) &&
+              (e->window == _ecore_win32_mouse_down_last_last_window))
+            {
+               e->triple_click = 1;
+               _ecore_win32_mouse_down_did_triple = 1;
+            }
+          else
+            _ecore_win32_mouse_down_did_triple = 0;
+
+          if (!e->double_click && !e->triple_click)
+            _ecore_win32_mouse_up_count = 0;
+
+          _ecore_win32_event_last_time = e->time;
+          _ecore_win32_event_last_window = e->window;
+
+          if (!_ecore_win32_mouse_down_did_triple)
+            {
+               _ecore_win32_mouse_down_last_last_window = 
_ecore_win32_mouse_down_last_window;
+               _ecore_win32_mouse_down_last_window = e->window;
+               _ecore_win32_mouse_down_last_last_time = 
_ecore_win32_mouse_down_last_time;
+               _ecore_win32_mouse_down_last_time = e->time;
+            }
 
-      ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
-   }
+          ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
+       }
+     }
    printf (" * ecore event button press\n");
 }
 
 void
 _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg,
-                                       int  button)
+                                       int                          button)
 {
    Ecore_Win32_Window *window;
 
@@ -557,7 +581,7 @@
       _ecore_win32_event_last_time = e->time;
       _ecore_win32_event_last_window = e->window;
 
-      ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
+      ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
    }
 
    Ecore_Win32_Event_Mouse_Button_Up *e;
@@ -719,6 +743,20 @@
 }
 
 void
+_ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg)
+{
+   Ecore_Win32_Event_Window_Create *e;
+
+   e = calloc(1, sizeof(Ecore_Win32_Event_Window_Create));
+   if (!e) return;
+
+   e->window = _ecore_win32_event_window_get(msg->window);
+   e->time = _ecore_win32_event_last_time;
+
+   ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CREATE, e, NULL, NULL);
+}
+
+void
 _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg)
 {
    Ecore_Win32_Event_Window_Destroy *e;
@@ -762,15 +800,64 @@
 }
 
 void
-_ecore_win32_event_handle_delete(Ecore_Win32_Callback_Data *msg)
+_ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg)
+{
+   RECT                                rect;
+   Ecore_Win32_Event_Window_Configure *e;
+   WINDOWPOS                          *window_pos;
+
+   e = calloc(1, sizeof(Ecore_Win32_Event_Window_Configure));
+   if (!e) return;
+
+   window_pos = (WINDOWPOS *)msg->data_param;
+   if (!GetClientRect(window_pos->hwnd, &rect))
+     {
+        free(e);
+        return;
+     }
+
+   e->window = _ecore_win32_event_window_get(window_pos->hwnd);
+   e->abovewin = _ecore_win32_event_window_get(window_pos->hwndInsertAfter);
+   e->x = rect.left;
+   e->y = rect.top;
+   e->width = rect.right - rect.left;
+   e->height = rect.bottom - rect.top;
+   e->time = _ecore_win32_event_last_time;
+
+   ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
+}
+
+void
+_ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg)
+{
+   RECT                             rect;
+   Ecore_Win32_Event_Window_Resize *e;
+
+   if (!GetClientRect(msg->window, &rect))
+     return;
+
+   e = calloc(1, sizeof(Ecore_Win32_Event_Window_Resize));
+   if (!e) return;
+
+   e->window = _ecore_win32_event_window_get(msg->window);
+   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);
+
+   ecore_event_add(ECORE_WIN32_EVENT_WINDOW_RESIZE, e, NULL, NULL);
+}
+
+void
+_ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg)
 {
-   Ecore_Win32_Event_Window_Delete *e;
+   Ecore_Win32_Event_Window_Delete_Request *e;
 
-   e = calloc(1, sizeof(Ecore_Win32_Event_Window_Delete));
+   e = calloc(1, sizeof(Ecore_Win32_Event_Window_Delete_Request));
    if (!e) return;
 
    e->window = _ecore_win32_event_window_get(msg->window);
    e->time = _ecore_win32_event_last_time;
 
-   ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE, e, NULL, NULL);
+   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.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_win32_private.h       26 Aug 2007 11:17:21 -0000      1.1
+++ ecore_win32_private.h       23 Sep 2007 11:08:52 -0000      1.2
@@ -7,9 +7,13 @@
 
 
 #include <windows.h>
-#include <ddraw.h>
-#include <d3d9.h>
-#include <d3dx9.h>
+#ifdef HAVE_DIRECTDRAW
+# include <ddraw.h>
+#endif /* HAVE_DIRECTDRAW */
+#ifdef HAVE_DIRECT3D
+# include <d3d9.h>
+# include <d3dx9.h>
+#endif /* HAVE_DIRECT3D */
 
 #include <Ecore_Data.h>
 
@@ -95,10 +99,13 @@
 void  _ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg);
 void  _ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg);
 void  _ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg);
+void  _ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg);
 void  _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg);
 void  _ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg);
 void  _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg);
-void  _ecore_win32_event_handle_delete(Ecore_Win32_Callback_Data *msg);
+void  _ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data 
*msg);
+void  _ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg);
+void  _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg);
 
 
 #endif /* __ECORE_WIN32_PRIVATE_H__ */
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_win32/ecore_win32_window.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_win32_window.c        26 Aug 2007 11:17:21 -0000      1.1
+++ ecore_win32_window.c        23 Sep 2007 11:08:52 -0000      1.2
@@ -79,14 +79,14 @@
         return NULL;
      }
 
-   w->min_width = width;
-   w->min_height = height;
-   w->max_width = width;
-   w->max_height = height;
-   w->base_width = 0;
-   w->base_height = 0;
-   w->step_width = 1;
-   w->step_height = 1;
+   w->min_width = 0;
+   w->min_height = 0;
+   w->max_width = 32767;
+   w->max_height = 32767;
+   w->base_width = -1;
+   w->base_height = -1;
+   w->step_width = -1;
+   w->step_height = -1;
 
    w->pointer_is_in = 0;
    w->borderless = 0;
@@ -240,13 +240,71 @@
 }
 
 EAPI void
+ecore_win32_window_geometry_get(Ecore_Win32_Window *window,
+                                int                *x,
+                                int                *y,
+                                int                *width,
+                                int                *height)
+{
+   RECT rect;
+   int  w;
+   int  h;
+
+   if (!window)
+     {
+        if (x) *x = 0;
+        if (y) *y = 0;
+        if (width) *width = GetSystemMetrics(SM_CXSCREEN);
+        if (height) *height = GetSystemMetrics(SM_CYSCREEN);
+
+        return;
+     }
+
+   if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
+                      &rect))
+     {
+        if (x) *x = 0;
+        if (y) *y = 0;
+        if (width) *width = 0;
+        if (height) *height = 0;
+
+        return;
+     }
+
+   w = rect.right - rect.left;
+   h = rect.bottom - rect.top;
+
+   if (!GetWindowRect(((struct _Ecore_Win32_Window *)window)->window,
+                      &rect))
+     {
+        if (x) *x = 0;
+        if (y) *y = 0;
+        if (width) *width = 0;
+        if (height) *height = 0;
+
+        return;
+     }
+
+   if (x) *x = rect.left;
+   if (y) *y = rect.top;
+   if (width) *width = w;
+   if (height) *height = h;
+}
+
+EAPI void
 ecore_win32_window_size_get(Ecore_Win32_Window *window,
                             int                *width,
                             int                *height)
 {
    RECT rect;
 
-   if (!window) return;
+   if (!window)
+     {
+        if (width) *width = GetSystemMetrics(SM_CXSCREEN);
+        if (height) *height = GetSystemMetrics(SM_CYSCREEN);
+
+        return;
+     }
 
    if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
                       &rect))
@@ -454,27 +512,38 @@
        ((!ew->fullscreen) && (!on)))
      return;
 
+   ew->fullscreen = on;
    w = ew->window;
 
    if (on)
      {
-       if (!GetWindowRect(w, &ew->rect)) return;
+        if (!GetWindowRect(w, &ew->rect)) return;
+        ew->style = GetWindowLong(w, GWL_STYLE);
         width = GetSystemMetrics (SM_CXSCREEN);
         height = GetSystemMetrics (SM_CYSCREEN);
-        ew->style = GetWindowLong(w, GWL_STYLE);
-        SetWindowLong(w, GWL_STYLE, (ew->style & ~WS_OVERLAPPEDWINDOW) | 
WS_POPUP);
+        if (!SetWindowLong(w, GWL_STYLE,
+                           (ew->style & ~WS_OVERLAPPEDWINDOW) | WS_POPUP))
+          return;
         SetWindowPos(w, HWND_TOP, 0, 0, width, height,
                      SWP_NOCOPYBITS | SWP_SHOWWINDOW);
      }
    else
      {
-        SetWindowLong(w, GWL_STYLE, ew->style);
+        if (!SetWindowLong(w, GWL_STYLE, ew->style))
+          return;
         SetWindowPos(w, HWND_NOTOPMOST,
                      ew->rect.left,
                      ew->rect.top,
                      ew->rect.right - ew->rect.left,
-                     ew->rect.bottom - ew->rect.right,
+                     ew->rect.bottom - ew->rect.top,
                      SWP_NOCOPYBITS | SWP_SHOWWINDOW);
      }
-   ew->fullscreen = on;
+}
+
+EAPI void
+ecore_win32_window_cursor_set(Ecore_Win32_Window *window,
+                              Ecore_Win32_Cursor *cursor)
+{
+   SetClassLong(((struct _Ecore_Win32_Window *)window)->window,
+                GCL_HCURSOR, (LONG)cursor);
 }



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to