diff options
author | Chris Michael <cp.michael@samsung.com> | 2016-10-28 13:59:31 -0400 |
---|---|---|
committer | Chris Michael <cp.michael@samsung.com> | 2016-10-28 14:04:05 -0400 |
commit | e179115f41f1e3056072e0aeefb74c97d5ca952c (patch) | |
tree | ed3ccc0fb4c4ae8224ec1c7c489db812eb67ef46 | |
parent | 4bffa7bfa79c2a1b5f1f5eb2d80e8667d1b49b67 (diff) | |
download | efl-e179115f41f1e3056072e0aeefb74c97d5ca952c.tar.gz |
elementary: Add internal function to set wayland cursor
Add an internal elm function we can call from withint els_cursor.c so
that we can set window cursor/pointer images based on what is supplied
by els_cursor.
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r-- | src/lib/elementary/efl_ui_win.c | 51 | ||||
-rw-r--r-- | src/lib/elementary/elm_priv.h | 4 |
2 files changed, 54 insertions, 1 deletions
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 627c82cac7..46af76d1e7 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -2960,6 +2960,55 @@ _elm_win_wlwindow_get(Efl_Ui_Win_Data *sd) { sd->wl.win = _elm_ee_wlwin_get(sd->ee); } + +void +_elm_win_wl_cursor_set(Evas_Object *obj, const char *cursor) +{ + ELM_WIN_DATA_GET(obj, sd); + + if (!sd) return; + + if (sd->pointer.obj) + { + Evas_Coord mw = 1, mh = 1, hx = 0, hy = 0; + + fprintf(stderr, "Elm Win Cursor Set: %s\n", cursor); + + if (cursor) + { + if (!_elm_theme_object_set(sd->obj, sd->pointer.obj, + "cursor", cursor, "default")) + { + fprintf(stderr, "\tCursor %s not found in theme\n", cursor); + _elm_theme_object_set(sd->obj, sd->pointer.obj, + "pointer", "base", "default"); + } + } + else + _elm_theme_object_set(sd->obj, sd->pointer.obj, + "pointer", "base", "default"); + + edje_object_size_min_get(sd->pointer.obj, &mw, &mh); + edje_object_size_min_restricted_calc(sd->pointer.obj, &mw, &mh, mw, mh); + if ((mw < 32) || (mh < 32)) + { + mw = 32; + mh = 32; + } + fprintf(stderr, "\tMin Size: %d %d\n", mw, mh); + evas_object_move(sd->pointer.obj, 0, 0); + evas_object_resize(sd->pointer.obj, mw, mh); + edje_object_part_geometry_get(sd->pointer.obj, + "elm.swallow.hotspot", + &hx, &hy, NULL, NULL); + sd->pointer.hot_x = hx; + sd->pointer.hot_y = hy; + } + + if ((sd->wl.win) && (sd->pointer.surf)) + ecore_wl2_window_pointer_set(sd->wl.win, sd->pointer.surf, + sd->pointer.hot_x, sd->pointer.hot_y); +} #endif Ecore_Cocoa_Window * @@ -3523,7 +3572,7 @@ static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, - const char *source) + const char *source EINA_UNUSED) { int ox, oy; diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index d357780664..633973d4b2 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -532,6 +532,10 @@ void _elm_dbus_menu_item_select_cb(Elm_Object_Item *obj_item); void _elm_menu_menu_bar_set(Eo *obj, Eina_Bool menu_bar); void _elm_menu_menu_bar_hide(Eo *obj); +#ifdef HAVE_ELEMENTARY_WL2 +void _elm_win_wl_cursor_set(Evas_Object *obj, const char *cursor); +#endif + /* DEPRECATED, will be removed on next release */ void _elm_icon_signal_emit(Evas_Object *obj, const char *emission, |