Elm: Patches from Rob Bradford <rob@linux.intel.com> to:

* Move X related window items into their own substruct of
_Elm_Win_Smart_Data to allow grouping based on engine.

* Move X related cursor items into their own substruct of Elm_Cursor
to make supporting cursors on other platforms cleaner.

* Add support for setting the cursor under Wayland:
* Introduce a configure option and #define to as per other engines
* Add always-built API function to allow identification of running
under Wayland (like for X11)
* Call into Ecore to set the cursor when the mouse enters the desired
widget.



SVN revision: 71754
This commit is contained in:
Christopher Michael 2012-06-06 13:55:15 +00:00
parent 166018c8fc
commit 8ae0fe2422
6 changed files with 119 additions and 17 deletions

View File

@ -126,6 +126,18 @@
* Move X related window items into their own substruct of
_Elm_Win_Smart_Data to allow grouping based on engine.
2012-05-29 Rob Bradford
* Move X related cursor items into their own substruct of Elm_Cursor
to make supporting cursors on other platforms cleaner.
2012-05-30 Rob Bradford
* Add support for setting the cursor under Wayland:
* Introduce a configure option and #define to as per other engines
* Add always-built API function to allow identification of running
under Wayland (like for X11)
* Call into Ecore to set the cursor when the mouse enters the desired
widget.
2012-05-30 Mike Blumenkrantz
* Fix even/odd signals for genlist items

View File

@ -444,6 +444,29 @@ if test "x$want_elementary_wince" = "xyes" -a "x$have_elementary_wince" = "xno";
AC_MSG_ERROR([ecore-wince support requested, but not found by pkg-config.])
fi
have_elementary_wayland="no"
want_elementary_wayland="auto"
AC_ARG_ENABLE([ecore-x],
[AC_HELP_STRING([--disable-ecore-wayland], [disable ecore-wayland support. @<:@default=detect@:>@])],
[want_elementary_wayland=$enableval], [])
if test "x$want_elementary_wayland" != "xno"; then
PKG_CHECK_MODULES([ELEMENTARY_WAYLAND],
[ecore-wayland],
[
AC_DEFINE(HAVE_ELEMENTARY_WAYLAND, 1, [Wayland support for Elementary])
have_elementary_wayland="yes"
requirement_elm="ecore-wayland ${requirement_elm}"
],
[have_elementary_wayland="no"]
)
else
have_elementary_wayland="no"
fi
if test "x$want_elementary_wayland" = "xyes" -a "x$have_elementary_wayland" = "xno"; then
AC_MSG_ERROR([ecore-x support requested, but not found by pkg-config.])
fi
ELM_EDBUS_DEF="#undef"
have_elementary_edbus="no"
want_elementary_edbus="auto"
@ -752,6 +775,7 @@ echo " SDL....................: ${have_elementary_sdl}"
echo " Cocoa..................: ${have_elementary_cocoa}"
echo " Windows XP.............: ${have_elementary_win32}"
echo " Windows CE.............: ${have_elementary_wince}"
echo " Wayland...............:. ${have_elementary_wayland}"
echo
echo " Features:"
echo " Ecore_IMF..............: ${have_ecore_imf}"

View File

@ -12,6 +12,9 @@
#ifdef HAVE_ELEMENTARY_WINCE
#include <Ecore_WinCE.h>
#endif
#ifdef HAVE_ELEMENTARY_WAYLAND
#include <Ecore_Wayland.h>
#endif
#include "elm_widget.h"

View File

@ -50,6 +50,13 @@ struct _Elm_Win_Smart_Data
Ecore_Event_Handler *client_message_handler;
} x;
#endif
#ifdef HAVE_ELEMENTARY_WAYLAND
struct
{
Ecore_Wl_Window *win;
} wl;
#endif
Ecore_Job *deferred_resize_job;
Ecore_Job *deferred_child_eval_job;
@ -2146,6 +2153,10 @@ elm_win_add(Evas_Object *parent,
_elm_win_xwindow_get(sd);
#endif
#ifdef HAVE_ELEMENTARY_WAYLAND
sd->wl.win = ecore_evas_wayland_window_get(sd->ee);
#endif
if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
ecore_evas_avoid_damage_set(sd->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
// bg pixmap done by x - has other issues like can be redrawn by x before it
@ -3384,3 +3395,24 @@ elm_win_xwindow_get(const Evas_Object *obj)
#endif
return 0;
}
EAPI Ecore_Wl_Window *
elm_win_wl_window_get(const Evas_Object *obj)
{
if (!obj) return NULL;
if (!evas_object_smart_type_check_ptr(obj, WIN_SMART_NAME))
{
Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
return ecore_evas_wayland_window_get(ee);
}
ELM_WIN_CHECK(obj) NULL;
ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
#if HAVE_ELEMENTARY_WAYLAND
if (sd->wl.win) return sd->wl.win;
if (sd->parent) return elm_win_wl_window_get(sd->parent);
#endif
return NULL;
}

View File

@ -1246,6 +1246,18 @@ EAPI Eina_Bool elm_win_socket_listen(Evas_Object *obj, const char *s
*/
EAPI Ecore_X_Window elm_win_xwindow_get(const Evas_Object *obj);
/* Wayland specific call - returns NULL on non-Wayland engines */
/**
* Get the Ecore_Wl_Window of and Evas_Object
*
* @param obj the object
*
* @return The Ecore_Wl_Window of @p obj
*
* @ingroup Win
*/
EAPI Ecore_Wl_Window *elm_win_wl_window_get(const Evas_Object *obj);
/**
* @}
*/

View File

@ -135,9 +135,17 @@ struct _Elm_Cursor
Ecore_Evas *ee;
Evas *evas;
#ifdef HAVE_ELEMENTARY_X
Ecore_X_Cursor cursor;
Ecore_X_Window win;
struct {
Ecore_X_Cursor cursor;
Ecore_X_Window win;
} x;
#endif
#ifdef HAVE_ELEMENTARY_WAYLAND
struct {
Ecore_Wl_Window *win;
} wl;
#endif
Eina_Bool visible:1;
Eina_Bool use_engine:1;
Eina_Bool engine_only:1;
@ -215,8 +223,12 @@ _elm_cursor_mouse_in(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSE
else
{
#ifdef HAVE_ELEMENTARY_X
if (cur->win)
ecore_x_window_cursor_set(cur->win, cur->cursor);
if (cur->x.win)
ecore_x_window_cursor_set(cur->x.win, cur->x.cursor);
#endif
#ifdef HAVE_ELEMENTARY_WAYLAND
if (cur->wl.win)
ecore_wl_window_cursor_from_name_set(cur->wl.win, cur->cursor_name);
#endif
}
evas_event_thaw(cur->evas);
@ -255,8 +267,12 @@ _elm_cursor_mouse_out(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUS
else
{
#ifdef HAVE_ELEMENTARY_X
if (cur->win)
ecore_x_window_cursor_set(cur->win, ECORE_X_CURSOR_X);
if (cur->x.win)
ecore_x_window_cursor_set(cur->x.win, ECORE_X_CURSOR_X);
#endif
#ifdef HAVE_ELEMENTARY_WAYLAND
if (cur->wl.win)
ecore_wl_window_cursor_default_restore(cur->wl.win);
#endif
}
evas_event_thaw(cur->evas);
@ -301,23 +317,26 @@ _elm_cursor_cur_set(Elm_Cursor *cur)
if (cur->use_engine)
{
#ifdef HAVE_ELEMENTARY_X
struct _Cursor_Id *cur_id;
cur_id = bsearch(&(cur->cursor_name), _cursors, _cursors_count,
sizeof(struct _Cursor_Id), _elm_cursor_strcmp);
cur->win = elm_win_xwindow_get(cur->eventarea);
if (cur->win)
cur->x.win = elm_win_xwindow_get(cur->eventarea);
if (cur->x.win)
{
struct _Cursor_Id *cur_id;
cur_id = bsearch(&(cur->cursor_name), _cursors, _cursors_count,
sizeof(struct _Cursor_Id), _elm_cursor_strcmp);
if (!cur_id)
{
INF("X cursor couldn't be found: %s. Using default.",
cur->cursor_name);
cur->cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_X);
cur->x.cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_X);
}
else
cur->cursor = ecore_x_cursor_shape_get(cur_id->id);
cur->x.cursor = ecore_x_cursor_shape_get(cur_id->id);
}
#endif
#ifdef HAVE_ELEMENTARY_WAYLAND
cur->wl.win = elm_win_wl_window_get(cur->eventarea);
#endif
}
}
@ -425,8 +444,8 @@ elm_object_cursor_unset(Evas_Object *obj)
ecore_evas_object_cursor_set(cur->ee, NULL, ELM_OBJECT_LAYER_CURSOR,
cur->hot_x, cur->hot_y);
#ifdef HAVE_ELEMENTARY_X
else if (cur->win)
ecore_x_window_cursor_set(cur->win, ECORE_X_CURSOR_X);
else if (cur->x.win)
ecore_x_window_cursor_set(cur->x.win, ECORE_X_CURSOR_X);
#endif
}