macos: allow text to be selected.

Summary: This gives us basic clipboard handling for MacOS after the refactor was done.

Test Plan:
Open an entry test. select text with mouse or keyboard.
Text can be cut. Text can be copied. Text can be pasted.

Reviewers: ajwillia.ms, zmike, jayji

Reviewed By: zmike

Subscribers: jayji, herdsman, cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6599
This commit is contained in:
Alastair Poole 2018-07-23 15:48:28 -04:00 committed by Mike Blumenkrantz
parent 7ebcb710d2
commit 4924fc73ee
3 changed files with 23 additions and 11 deletions

View File

@ -290,6 +290,11 @@ elm_cnp_selection_loss_callback_set(Evas_Object *obj, Elm_Sel_Type type,
Elm_Selection_Loss_Cb func, const void *data)
{
Sel_Lost_Data *ldata = calloc(1, sizeof(Sel_Lost_Data));
#if HAVE_ELEMENTARY_COCOA
// Currently, we have no way to track changes in Cocoa pasteboard.
// Therefore, don't track this...
return;
#endif
if (!ldata) return;
ldata->obj = obj;
ldata->type = type;

View File

@ -3823,23 +3823,17 @@ _cocoa_sel_manager_seat_selection_init(Efl_Selection_Manager_Data *pd, unsigned
static Ecore_Cocoa_Window *
_cocoa_window_get(const Evas_Object *obj)
{
Evas_Object *top, *par;
Ecore_Cocoa_Window *win = NULL;
Evas_Object *_win;
if (elm_widget_is(obj))
_win = elm_win_get(obj);
if (_win)
{
top = elm_widget_top_get(obj);
if (!top)
{
par = elm_widget_parent_widget_get(obj);
if (par) top = elm_widget_top_get(par);
}
if ((top) && (efl_isa(top, EFL_UI_WIN_CLASS)))
win = elm_win_cocoa_window_get(top);
win = elm_win_cocoa_window_get(_win);
}
if (!win)
{
// FIXME
CRI("WIN has not been retrieved!!!");
}
@ -3942,6 +3936,7 @@ _cocoa_efl_sel_manager_selection_set(Efl_Selection_Manager_Data *pd,
seat_sel = _cocoa_sel_manager_seat_selection_init(pd, seat);
seat_sel->active_type = type;
sel = seat_sel->sel;
if ((!data.mem) && (format != EFL_SELECTION_FORMAT_IMAGE))
{
efl_selection_manager_selection_clear(pd->sel_man, owner, type, seat);
@ -4853,6 +4848,10 @@ _efl_selection_manager_selection_has_owner(Eo *obj EINA_UNUSED, Efl_Selection_Ma
win = _wl_window_get(request);
if (win)
return !!ecore_wl2_dnd_selection_get(_wl_seat_get(win, request, seat));
#endif
#ifdef HAVE_ELEMENTARY_COCOA
// FIXME: need to check if there is clipboard data. Paste always enabled.
return EINA_TRUE;
#endif
return EINA_FALSE;
}

View File

@ -7629,8 +7629,16 @@ elm_win_cocoa_window_get(const Evas_Object *obj)
Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
if (!sd) return NULL;
#if HAVE_ELEMENTARY_COCOA
if (sd->cocoa.win) return sd->cocoa.win;
if (sd->ee) return _elm_ee_cocoa_win_get(sd->ee);
if (sd->parent) return elm_win_cocoa_window_get(sd->parent);
#endif
Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
return _elm_ee_cocoa_win_get(ee);
return NULL;
}
EAPI Ecore_Win32_Window *