Enlightenment CVS committal

Author  : codewarrior
Project : e17
Module  : proto

Dir     : e17/proto/etk/src/lib


Modified Files:
        Etk.h Makefile.am etk_dnd.c etk_dnd.h etk_types.h etk_widget.c 
        etk_widget.h 
Added Files:
        etk_clipboard.c etk_clipboard.h 


Log Message:
- seperate selections and clipboard stuff. for now, we have an etk_clipboard_* 
API that handles text copy / paste. Next up is finished selection support for 
text, then image/* for clipboard and dnd.

===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/etk/src/lib/Etk.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- Etk.h       11 Feb 2006 00:28:32 -0000      1.19
+++ Etk.h       12 Feb 2006 13:13:44 -0000      1.20
@@ -63,5 +63,6 @@
 #include "etk_progress_bar.h"
 #include "etk_spin_button.h"
 #include "etk_dnd.h"
+#include "etk_clipboard.h"
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/etk/src/lib/Makefile.am,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- Makefile.am 11 Feb 2006 20:35:49 -0000      1.23
+++ Makefile.am 12 Feb 2006 13:13:45 -0000      1.24
@@ -43,7 +43,8 @@
 etk_notebook.h \
 etk_progress_bar.h \
 etk_spin_button.h \
-etk_dnd.h
+etk_dnd.h \
+etk_clipboard.h
 
 libetk_la_SOURCES = \
 etk_main.c etk_utils.c \
@@ -74,6 +75,7 @@
 etk_progress_bar.c \
 etk_spin_button.c \
 etk_dnd.c \
+etk_clipboard.c \
 $(ETKHEADERS)
 
 installed_headersdir = $(prefix)/include/etk
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/etk/src/lib/etk_dnd.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- etk_dnd.c   11 Feb 2006 10:27:14 -0000      1.3
+++ etk_dnd.c   12 Feb 2006 13:13:45 -0000      1.4
@@ -20,12 +20,22 @@
  * drag_motion: mouse is moving on widget
  * drag_drop: object dropped on widget
  * 
+ * selection_received: when our widget gets the selection it has asked for
+ *                     (ie, we want to get a selection)
+ * selection_get: when a request for a selection has been made to our widget
+ *                (ie, someone is getting our selection from us)
+ * selection_clear_event: the selection has been cleared
+ * 
+ * clipboard_received: when our widget gets the clipboard data it has asked for
+ *                     (ie, we want to get a clipboard's text / image)
+ * 
  */
 
 #define ETK_DND_INSIDE(x, y, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < 
((yy) + (hh))) && ((x) >= (xx)) && ((y) >= (yy)))
 
+Etk_Widget *_etk_selection_widget = NULL;
+
 static Etk_Widget *_etk_dnd_widget = NULL;
-static Etk_Widget *_etk_selection_widget = NULL;
 static Evas_List  *_etk_dnd_handlers = NULL;
 
 #if HAVE_ECORE_X
@@ -60,7 +70,7 @@
    _etk_dnd_handlers = evas_list_append(_etk_dnd_handlers, 
ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, 
_etk_xdnd_selection_handler, NULL));
 #endif
    
-   return 1;
+   return ETK_TRUE;
 }
 
 /**
@@ -74,35 +84,7 @@
       ecore_event_handler_del(_etk_dnd_handlers->data);
       _etk_dnd_handlers = evas_list_remove(_etk_dnd_handlers, 
_etk_dnd_handlers->data);
    }
-}
-
-/* TODO: doc */
-void etk_selection_text_request(Etk_Widget *widget)
-{
-#if HAVE_ECORE_X
-   Ecore_X_Window win;
-   
-   if (!widget || !ETK_IS_WINDOW(widget->toplevel_parent))
-     return;
-   
-   win = ETK_WINDOW(widget->toplevel_parent)->x_window;
-   _etk_selection_widget = widget;
-   ecore_x_selection_clipboard_request(win, 
ECORE_X_SELECTION_TARGET_UTF8_STRING);
-#endif
-}
-
-/* TODO: doc */
-void etk_selection_text_set(Etk_Widget *widget, const char *data)
-{
-#if HAVE_ECORE_X
-   Ecore_X_Window win;
-   
-   if (!widget || !ETK_IS_WINDOW(widget->toplevel_parent) || !data)
-      return;
-   
-   win = ETK_WINDOW(widget->toplevel_parent)->x_window;
-   ecore_x_selection_clipboard_set(win, (char *)data, strlen(data) + 1);
-#endif
+#endif   
 }
 
 /**************************
@@ -115,6 +97,7 @@
 /* Search the container recursively for the widget that accepts xdnd */
 static void _etk_xdnd_container_get_widgets_at(Etk_Toplevel_Widget *top, int 
x, int y, int offx, int offy, Evas_List **list)
 {
+
    Evas_List *l;
    int wx, wy, ww, wh;
    
@@ -316,6 +299,8 @@
       case ECORE_X_SELECTION_CLIPBOARD:
          if (!strcmp(ev->target, ECORE_X_SELECTION_TARGET_TARGETS)) 
         {
+           /* REDO THIS CODE!!!
+           
            Etk_Event_Selection_Get event;
            Etk_Selection_Data_Targets _targets;
            
@@ -329,16 +314,18 @@
            //printf("clipboard: %s\n", ev->target);
            //for (i = 0; i < targets->num_targets; i++)
            //  printf("target: %s\n", targets->targets[i]);
+           
+           */
          } 
          else 
         {
-           Etk_Event_Selection_Get event;
+           /* emit signal to widget that the clipboard text is sent to it */
+           Etk_Event_Selection_Request event;
            
            text = ev->data;
-           //printf("clipboard: %s %s\n", ev->target, text->text);
            event.data = text->text;
            event.content = ETK_SELECTION_CONTENT_TEXT;
-           etk_widget_selection_get(_etk_selection_widget, &event);
+           etk_widget_clipboard_received(_etk_selection_widget, &event);
         }
         break;
          
@@ -350,4 +337,3 @@
 }
 #endif
 
-#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/etk/src/lib/etk_dnd.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- etk_dnd.h   11 Feb 2006 10:27:14 -0000      1.3
+++ etk_dnd.h   12 Feb 2006 13:13:45 -0000      1.4
@@ -11,7 +11,7 @@
 #define ETK_SELECTION_TARGET_UTF8_STRING "UTF8_STRING"
 #define ETK_SELECTION_TARGET_FILENAME "FILENAME"
 
-struct _Etk_Event_Selection_Get
+struct _Etk_Event_Selection_Request
 {   
    void *data;
    enum
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/etk/src/lib/etk_types.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- etk_types.h 11 Feb 2006 00:28:35 -0000      1.25
+++ etk_types.h 12 Feb 2006 13:13:45 -0000      1.26
@@ -105,7 +105,7 @@
 typedef struct _Etk_Progress_Bar Etk_Progress_Bar;
 typedef enum _Etk_Progress_Bar_Orientation Etk_Progress_Bar_Orientation;
 typedef struct _Etk_Spin_Button Etk_Spin_Button;
-typedef struct _Etk_Event_Selection_Get Etk_Event_Selection_Get;
+typedef struct _Etk_Event_Selection_Request Etk_Event_Selection_Request;
 typedef struct _Etk_Selection_Data_Targets Etk_Selection_Data_Targets;
 
 /**
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/etk/src/lib/etk_widget.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- etk_widget.c        11 Feb 2006 16:33:38 -0000      1.28
+++ etk_widget.c        12 Feb 2006 13:13:45 -0000      1.29
@@ -58,7 +58,8 @@
    ETK_WIDGET_DRAG_DROP_SIGNAL,
    ETK_WIDGET_DRAG_MOTION_SIGNAL,
    ETK_WIDGET_DRAG_LEAVE_SIGNAL,
-   ETK_WIDGET_SELECTION_GET_SIGNAL,
+   ETK_WIDGET_SELECTION_RECEIVED_SIGNAL,
+   ETK_WIDGET_CLIPBOARD_RECEIVED_SIGNAL,
    ETK_WIDGET_NUM_SIGNALS
 };
 
@@ -177,7 +178,8 @@
       _etk_widget_signals[ETK_WIDGET_DRAG_DROP_SIGNAL] =     
etk_signal_new("drag_drop",      widget_type, ETK_MEMBER_OFFSET(Etk_Widget, 
drag_drop),   etk_marshaller_VOID__VOID,    NULL, NULL);
       _etk_widget_signals[ETK_WIDGET_DRAG_MOTION_SIGNAL] =   
etk_signal_new("drag_motion",    widget_type, ETK_MEMBER_OFFSET(Etk_Widget, 
drag_motion), etk_marshaller_VOID__VOID,    NULL, NULL);
       _etk_widget_signals[ETK_WIDGET_DRAG_LEAVE_SIGNAL] =    
etk_signal_new("drag_leave",     widget_type, ETK_MEMBER_OFFSET(Etk_Widget, 
drag_leave),  etk_marshaller_VOID__VOID,    NULL, NULL);
-      _etk_widget_signals[ETK_WIDGET_SELECTION_GET_SIGNAL] = 
etk_signal_new("selection_get",  widget_type, -1,                               
          etk_marshaller_VOID__POINTER, NULL, NULL);
+      _etk_widget_signals[ETK_WIDGET_SELECTION_RECEIVED_SIGNAL] = 
etk_signal_new("selection_received",  widget_type, -1,                          
               etk_marshaller_VOID__POINTER, NULL, NULL);
+      _etk_widget_signals[ETK_WIDGET_CLIPBOARD_RECEIVED_SIGNAL] = 
etk_signal_new("clipboard_received",  widget_type, -1,                          
               etk_marshaller_VOID__POINTER, NULL, NULL);
 
       etk_type_property_add(widget_type, "name",              
ETK_WIDGET_NAME_PROPERTY,              ETK_PROPERTY_STRING,  
ETK_PROPERTY_READABLE_WRITABLE, etk_property_value_string(NULL));
       etk_type_property_add(widget_type, "parent",            
ETK_WIDGET_PARENT_PROPERTY,            ETK_PROPERTY_POINTER, 
ETK_PROPERTY_READABLE,          etk_property_value_pointer(NULL));
@@ -1487,14 +1489,25 @@
 }
 
 /**
- * @brief Sends the "selection_get" signal
+ * @brief Sends the "selection_received" signal
  * @param widget a widget
  */
-void etk_widget_selection_get(Etk_Widget *widget, Etk_Event_Selection_Get 
*event)
+void etk_widget_selection_received(Etk_Widget *widget, 
Etk_Event_Selection_Request *event)
 {
    if (!widget)
      return;
-   etk_signal_emit(_etk_widget_signals[ETK_WIDGET_SELECTION_GET_SIGNAL], 
ETK_OBJECT(widget), NULL, event);
+   etk_signal_emit(_etk_widget_signals[ETK_WIDGET_SELECTION_RECEIVED_SIGNAL], 
ETK_OBJECT(widget), NULL, event);
+}
+
+/**
+ * @brief Sends the "clipboard_received" signal
+ * @param widget a widget
+ */
+void etk_widget_clipboard_received(Etk_Widget *widget, 
Etk_Event_Selection_Request *event)
+{
+   if (!widget)
+     return;
+   etk_signal_emit(_etk_widget_signals[ETK_WIDGET_CLIPBOARD_RECEIVED_SIGNAL], 
ETK_OBJECT(widget), NULL, event);
 }
 
 /**************************
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/etk/src/lib/etk_widget.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- etk_widget.h        11 Feb 2006 10:27:14 -0000      1.17
+++ etk_widget.h        12 Feb 2006 13:13:45 -0000      1.18
@@ -275,7 +275,9 @@
 void etk_widget_drag_motion(Etk_Widget *widget);
 void etk_widget_drag_leave(Etk_Widget *widget);
 
-void etk_widget_selection_get(Etk_Widget *widget, Etk_Event_Selection_Get 
*event);
+void etk_widget_selection_received(Etk_Widget *widget, 
Etk_Event_Selection_Request *event);
+
+void etk_widget_clipboard_received(Etk_Widget *widget, 
Etk_Event_Selection_Request *event);
 
 /** @} */
 




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to