Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_text.c ewl_window.c ewl_window.h Log Message: - make this a bit nicer =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_text.c,v retrieving revision 1.91 retrieving revision 1.92 diff -u -3 -r1.91 -r1.92 --- ewl_text.c 14 Feb 2006 21:57:47 -0000 1.91 +++ ewl_text.c 15 Feb 2006 02:03:39 -0000 1.92 @@ -3503,6 +3503,7 @@ { unsigned int start_pos; unsigned int base; + char *txt; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("s", s); @@ -3530,24 +3531,19 @@ ewl_text_trigger_length_set(s, idx - base); } - /* XXX this needs to be SOFTWARE_X11 and GL_X11 */ -#ifdef ENABLE_EWL_SOFTWARE_X11 - if (ewl_config.evas.engine & EWL_ENGINE_X11) + /* set the clipboard text */ + txt = ewl_text_selection_text_get(EWL_TEXT(s->text_parent)); + if (txt) { Ewl_Embed *emb; Ewl_Window *win; - char *txt; emb = ewl_embed_widget_find(EWL_WIDGET(s->text_parent)); win = ewl_window_window_find(emb->evas_window); - /* set the clipboard text */ - txt = ewl_text_selection_text_get(EWL_TEXT(s->text_parent)); - if (txt) ecore_x_selection_primary_set( - (Ecore_X_Window)win->window, - txt, strlen(txt) + 1); + ewl_window_selection_text_set(win, txt); + FREE(txt); } -#endif DLEAVE_FUNCTION(DLEVEL_STABLE); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_window.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -3 -r1.30 -r1.31 --- ewl_window.c 1 Feb 2006 07:14:12 -0000 1.30 +++ ewl_window.c 15 Feb 2006 02:03:39 -0000 1.31 @@ -626,6 +626,37 @@ DLEAVE_FUNCTION(DLEVEL_STABLE); } +/** + * @param win: The window to set the selection on + * @param txt: The text to set into the selection + * @return Returns no value. + * + ' @brief This will set the given @a txt as the selection text on the window + * or clear the text if @a txt is NULL + */ +void +ewl_window_selection_text_set(Ewl_Window *win, const char *txt) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("win", win); + DCHECK_TYPE("win", win, EWL_WINDOW_TYPE); + + /* XXX this needs to be SOFTWARE_X11 and GL_X11 */ +#ifdef ENABLE_EWL_SOFTWARE_X11 + if (ewl_config.evas.engine & EWL_ENGINE_X11) + { + if (txt) + ecore_x_selection_primary_set( + (Ecore_X_Window)win->window, + (char *)txt, strlen(txt) + 1); + else + ecore_x_selection_primary_clear(); + } +#endif + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + void ewl_window_realize_cb(Ewl_Widget *w, void *ev_data __UNUSED__, void *user_data __UNUSED__) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_window.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- ewl_window.h 12 Jan 2006 18:21:19 -0000 1.9 +++ ewl_window.h 15 Feb 2006 02:03:39 -0000 1.10 @@ -78,6 +78,7 @@ void ewl_window_override_set(Ewl_Window *win, int override); int ewl_window_override_get(Ewl_Window *win); void ewl_window_dnd_aware_set(Ewl_Window *win); +void ewl_window_selection_text_set(Ewl_Window *win, const char *txt); /* * Internally used callbacks, override at your own risk. ------------------------------------------------------- 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