Enlightenment CVS committal

Author  : ningerso
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_embed.c ewl_embed.h ewl_events.h ewl_colorpicker.c 


Log Message:
Use the data format now available from ecore_x.
Use the appropriate embed function name for DND data.
Update colorpicker to handle various data formats, should handle more apps and
prevent segvs for 8 bit colors.

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_embed.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -3 -r1.82 -r1.83
--- ewl_embed.c 26 Sep 2006 18:04:44 -0000      1.82
+++ ewl_embed.c 29 Sep 2006 05:51:41 -0000      1.83
@@ -955,7 +955,7 @@
  * @brief Sends the event for selection data received into an embed.
  */
 void
-ewl_embed_selection_data_feed(Ewl_Embed *embed, char *type, void *data, 
unsigned int len)
+ewl_embed_dnd_data_feed(Ewl_Embed *embed, char *type, void *data, unsigned int 
len, unsigned int format)
 {
        Ewl_Event_Dnd_Data ev;
 
@@ -975,6 +975,7 @@
                        ev.type = type;
                        ev.data = data;
                        ev.len = len;
+                       ev.format= format;
                        
ewl_callback_call_with_event_data(embed->last.drop_widget,
                                                          EWL_CALLBACK_DND_DATA,
                                                          &ev);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_embed.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- ewl_embed.h 21 Sep 2006 19:27:06 -0000      1.27
+++ ewl_embed.h 29 Sep 2006 05:51:41 -0000      1.28
@@ -106,8 +106,8 @@
 
 const char     *ewl_embed_dnd_position_feed(Ewl_Embed *embed, int x, int 
y,int*,int*,int*,int*);
 const char     *ewl_embed_dnd_drop_feed(Ewl_Embed* embed, int x, int y, int 
internal);
-void           ewl_embed_dnd_data_feed(Ewl_Embed* embed, void *data, unsigned 
int len);
-void            ewl_embed_selection_data_feed(Ewl_Embed *embed, char *type, 
void *data, unsigned int len);
+void           ewl_embed_dnd_data_feed(Ewl_Embed* embed, char *type, void 
*data, unsigned int len, unsigned int format);
+void            ewl_embed_selection_data_feed(Ewl_Embed *embed, char *type, 
void *data, unsigned int len, unsigned int format);
 
 void            ewl_embed_mouse_out_feed(Ewl_Embed *embed, int x, int y,
                                         unsigned int modifiers);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_events.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ewl_events.h        7 Sep 2006 18:53:34 -0000       1.17
+++ ewl_events.h        29 Sep 2006 05:51:41 -0000      1.18
@@ -228,6 +228,7 @@
        char *type; /**< Type of data from drop source */
        void *data; /**< Data from drop source */
         unsigned int len; /**< Length of received data */
+        unsigned int format; /**< Bit format of received data */
 };
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_colorpicker.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- ewl_colorpicker.c   29 Sep 2006 04:33:12 -0000      1.29
+++ ewl_colorpicker.c   29 Sep 2006 05:51:41 -0000      1.30
@@ -745,7 +745,6 @@
 {
        int i;
        int curcolors[4];
-       unsigned short *colors;
        Ewl_Colorpicker *cp = EWL_COLORPICKER(w);
        Ewl_Event_Dnd_Data *event = ev;
 
@@ -754,15 +753,29 @@
        DCHECK_PARAM_PTR("ev", ev);
        DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
 
-       printf("Data %d bytes\n", event->len);
-       colors = event->data;
-       printf("Color: %d %d %d %d\n", colors[0], colors[1], colors[2], 
colors[3]);
+       printf("Data %d bytes %d bits\n", event->len, event->format);
        ewl_colorpicker_current_rgb_get(cp, &curcolors[0], &curcolors[1],
                        &curcolors[2]);
        curcolors[3] = ewl_colorpicker_alpha_get(cp);
 
-       for (i = 0; i < event->len && i < 4; i++)
-               curcolors[i] = colors[i] >> 8;
+       if (event->format == 32) {
+               unsigned long *colors;
+               colors = event->data;
+               for (i = 0; i < event->len && i < 4; i++)
+                       curcolors[i] = colors[i] >> ((sizeof(long) * 8) - 8);
+       }
+       else if (event->format == 16) {
+               unsigned short *colors;
+               colors = event->data;
+               for (i = 0; i < event->len && i < 4; i++)
+                       curcolors[i] = colors[i] >> 8;
+       }
+       else {
+               unsigned char *colors;
+               colors = event->data;
+               for (i = 0; i < event->len && i < 4; i++)
+                       curcolors[i] = colors[i];
+       }
 
        ewl_colorpicker_current_rgb_set(cp, curcolors[0], curcolors[1],
                        curcolors[2]);



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to