Pointer changes on context. Please comment! Will work more on it soon.
SVN revision: 17344
This commit is contained in:
parent
a711f4ccc2
commit
f1b815305e
|
@ -3,8 +3,6 @@
|
|||
*/
|
||||
#include "e.h"
|
||||
|
||||
static E_Dialog *exit_dialog = NULL;
|
||||
|
||||
#define INITS
|
||||
#define ACT_GO(name) \
|
||||
{ \
|
||||
|
@ -67,6 +65,8 @@ static E_Dialog *exit_dialog = NULL;
|
|||
static void _e_action_free(E_Action *act);
|
||||
static Evas_Bool _e_actions_cb_free(Evas_Hash *hash, const char *key, void *data, void *fdata);
|
||||
|
||||
static E_Dialog *exit_dialog = NULL;
|
||||
|
||||
/* to save writing this in N places - the sctions are defined here */
|
||||
/***************************************************************************/
|
||||
ACT_FN_GO(window_move)
|
||||
|
@ -1213,6 +1213,29 @@ ACT_FN_GO(restart)
|
|||
ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
ACT_FN_GO(pointer)
|
||||
{
|
||||
/* TODO: Check for valid pointer types? */
|
||||
E_Manager *man = NULL;
|
||||
|
||||
if (!obj) obj = E_OBJECT(e_manager_current_get());
|
||||
if (!obj) return;
|
||||
if (obj->type == E_BORDER_TYPE)
|
||||
{
|
||||
E_Border *bd;
|
||||
bd = (E_Border *)obj;
|
||||
if (bd->zone)
|
||||
obj = bd->zone->container->manager;
|
||||
}
|
||||
if (obj->type != E_MANAGER_TYPE)
|
||||
{
|
||||
obj = E_OBJECT(e_manager_current_get());
|
||||
if (!obj) return;
|
||||
}
|
||||
man = (E_Manager *)obj;
|
||||
e_pointer_type_set(man->pointer, params);
|
||||
}
|
||||
|
||||
/* local subsystem globals */
|
||||
static Evas_Hash *actions = NULL;
|
||||
static Evas_List *action_names = NULL;
|
||||
|
@ -1302,6 +1325,8 @@ e_actions_init(void)
|
|||
|
||||
ACT_GO(restart);
|
||||
ACT_GO(exit);
|
||||
|
||||
ACT_GO(pointer);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -24,11 +24,11 @@ int
|
|||
e_bindings_init(void)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
|
||||
for (l = e_config->mouse_bindings; l; l = l->next)
|
||||
{
|
||||
E_Config_Binding_Mouse *eb;
|
||||
|
||||
|
||||
eb = l->data;
|
||||
e_bindings_mouse_add(eb->context, eb->button, eb->modifiers,
|
||||
eb->any_mod, eb->action, eb->params);
|
||||
|
@ -37,30 +37,35 @@ e_bindings_init(void)
|
|||
for (l = e_config->key_bindings; l; l = l->next)
|
||||
{
|
||||
E_Config_Binding_Key *eb;
|
||||
|
||||
|
||||
eb = l->data;
|
||||
e_bindings_key_add(eb->context, eb->key, eb->modifiers,
|
||||
eb->any_mod, eb->action, eb->params);
|
||||
}
|
||||
|
||||
for (l = e_config->signal_bindings; l; l = l->next)
|
||||
for (l = e_config->signal_bindings; l; l = l->next)
|
||||
{
|
||||
E_Config_Binding_Signal *eb;
|
||||
|
||||
|
||||
eb = l->data;
|
||||
e_bindings_signal_add(eb->context, eb->signal, eb->source, eb->modifiers,
|
||||
eb->any_mod, eb->action, eb->params);
|
||||
}
|
||||
|
||||
for (l = e_config->wheel_bindings; l; l = l->next)
|
||||
for (l = e_config->wheel_bindings; l; l = l->next)
|
||||
{
|
||||
E_Config_Binding_Wheel *eb;
|
||||
|
||||
|
||||
eb = l->data;
|
||||
e_bindings_wheel_add(eb->context, eb->direction, eb->z, eb->modifiers,
|
||||
eb->any_mod, eb->action, eb->params);
|
||||
}
|
||||
|
||||
|
||||
e_bindings_signal_add(E_BINDING_CONTEXT_BORDER, "mouse,in", "resize_br",
|
||||
E_BINDING_MODIFIER_NONE, 1, "pointer", "resize_br");
|
||||
e_bindings_signal_add(E_BINDING_CONTEXT_BORDER, "mouse,out", "resize_br",
|
||||
E_BINDING_MODIFIER_NONE, 1, "pointer", "default");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
*/
|
||||
#include "e.h"
|
||||
|
||||
/*
|
||||
* TODO
|
||||
* - Make fallback user controlable.
|
||||
*/
|
||||
|
||||
static Evas_List *_e_pointers = NULL;
|
||||
|
||||
static void _e_pointer_cb_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info);
|
||||
|
@ -25,6 +30,7 @@ e_pointer_window_new(Ecore_X_Window win)
|
|||
|
||||
p = E_OBJECT_ALLOC(E_Pointer, E_POINTER_TYPE, _e_pointer_free);
|
||||
if (!p) return NULL;
|
||||
p->e_cursor = 1;
|
||||
|
||||
p->type = strdup("default");
|
||||
if (!p->type)
|
||||
|
@ -84,18 +90,38 @@ e_pointer_window_new(Ecore_X_Window win)
|
|||
if (!e_theme_edje_object_set(o,
|
||||
"base/theme/pointer",
|
||||
"pointer/enlightenment/default/color"))
|
||||
e_theme_edje_object_set(o,
|
||||
"base/theme/pointer",
|
||||
"pointer/enlightenment/default/mono");
|
||||
{
|
||||
/* fallback on x cursor */
|
||||
p->e_cursor = 0;
|
||||
free(p->type);
|
||||
p->type = strdup("");
|
||||
free(p->evas);
|
||||
p->evas = NULL;
|
||||
free(p->pixels);
|
||||
p->evas = NULL;
|
||||
e_pointer_type_set(p, "default");
|
||||
return p;
|
||||
}
|
||||
p->color = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!e_theme_edje_object_set(o,
|
||||
"base/theme/pointer",
|
||||
"pointer/enlightenment/default/mono"))
|
||||
e_theme_edje_object_set(o,
|
||||
"base/theme/pointer",
|
||||
"pointer/enlightenment/default/color");
|
||||
{
|
||||
/* fallback on x cursor */
|
||||
p->e_cursor = 0;
|
||||
free(p->type);
|
||||
p->type = strdup("");
|
||||
free(p->evas);
|
||||
p->evas = NULL;
|
||||
free(p->pixels);
|
||||
p->evas = NULL;
|
||||
e_pointer_type_set(p, "default");
|
||||
return p;
|
||||
}
|
||||
p->color = 0;
|
||||
}
|
||||
|
||||
/* Create the hotspot object */
|
||||
|
@ -122,6 +148,7 @@ e_pointer_window_new(Ecore_X_Window win)
|
|||
{
|
||||
p = E_OBJECT_ALLOC(E_Pointer, E_POINTER_TYPE, _e_pointer_free);
|
||||
if (!p) return NULL;
|
||||
p->e_cursor = 0;
|
||||
|
||||
p->type = strdup("default");
|
||||
if (!p->type)
|
||||
|
@ -130,6 +157,8 @@ e_pointer_window_new(Ecore_X_Window win)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
p->win = win;
|
||||
|
||||
ecore_x_window_cursor_set(win,
|
||||
ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_PTR));
|
||||
|
||||
|
@ -149,7 +178,7 @@ e_pointers_size_set(int size)
|
|||
Evas_Engine_Info_Buffer *einfo;
|
||||
|
||||
p = l->data;
|
||||
if (!p->evas) continue;
|
||||
if (!p->e_cursor) continue;
|
||||
|
||||
p->w = p->h = size;
|
||||
evas_output_size_set(p->evas, p->w, p->h);
|
||||
|
@ -170,6 +199,106 @@ e_pointers_size_set(int size)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
e_pointer_type_set(E_Pointer *p, const char *type)
|
||||
{
|
||||
if (!strcmp(p->type, type)) return;
|
||||
|
||||
if (p->e_cursor)
|
||||
{
|
||||
Evas_Object *o;
|
||||
char cursor[1024];
|
||||
|
||||
o = p->pointer_object;
|
||||
if (p->color)
|
||||
{
|
||||
snprintf(cursor, sizeof(cursor), "pointer/enlightenment/%s/color", type);
|
||||
if (!e_theme_edje_object_set(o,
|
||||
"base/theme/pointer",
|
||||
cursor))
|
||||
{
|
||||
/* fallback on x cursor */
|
||||
p->e_cursor = 0;
|
||||
e_pointer_type_set(p, type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(cursor, sizeof(cursor), "pointer/enlightenment/%s/mono", type);
|
||||
if (!e_theme_edje_object_set(o,
|
||||
"base/theme/pointer",
|
||||
cursor))
|
||||
{
|
||||
/* fallback on x cursor */
|
||||
p->e_cursor = 0;
|
||||
e_pointer_type_set(p, type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
edje_object_part_swallow(p->pointer_object, "hotspot", p->hot_object);
|
||||
p->hot.update = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!strcmp(type, "move"))
|
||||
{
|
||||
ecore_x_window_cursor_set(p->win,
|
||||
ecore_x_cursor_shape_get(ECORE_X_CURSOR_FLEUR));
|
||||
}
|
||||
else if (!strcmp(type, "resize_tl"))
|
||||
{
|
||||
ecore_x_window_cursor_set(p->win,
|
||||
ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_LEFT_CORNER));
|
||||
}
|
||||
else if (!strcmp(type, "resize_t"))
|
||||
{
|
||||
ecore_x_window_cursor_set(p->win,
|
||||
ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_SIDE));
|
||||
}
|
||||
else if (!strcmp(type, "resize_tr"))
|
||||
{
|
||||
ecore_x_window_cursor_set(p->win,
|
||||
ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_RIGHT_CORNER));
|
||||
}
|
||||
else if (!strcmp(type, "resize_r"))
|
||||
{
|
||||
ecore_x_window_cursor_set(p->win,
|
||||
ecore_x_cursor_shape_get(ECORE_X_CURSOR_RIGHT_SIDE));
|
||||
}
|
||||
else if (!strcmp(type, "resize_br"))
|
||||
{
|
||||
ecore_x_window_cursor_set(p->win,
|
||||
ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER));
|
||||
}
|
||||
else if (!strcmp(type, "resize_b"))
|
||||
{
|
||||
ecore_x_window_cursor_set(p->win,
|
||||
ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_SIDE));
|
||||
}
|
||||
else if (!strcmp(type, "resize_bl"))
|
||||
{
|
||||
ecore_x_window_cursor_set(p->win,
|
||||
ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_LEFT_CORNER));
|
||||
}
|
||||
else if (!strcmp(type, "resize_l"))
|
||||
{
|
||||
ecore_x_window_cursor_set(p->win,
|
||||
ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_SIDE));
|
||||
}
|
||||
else
|
||||
{
|
||||
ecore_x_window_cursor_set(p->win,
|
||||
ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_PTR));
|
||||
}
|
||||
}
|
||||
/* try the default cursor next time */
|
||||
p->e_cursor = e_config->use_e_cursor;
|
||||
|
||||
if (p->type) free(p->type);
|
||||
p->type = strdup(type);
|
||||
}
|
||||
|
||||
void
|
||||
e_pointer_idler_before(void)
|
||||
{
|
||||
|
@ -181,7 +310,7 @@ e_pointer_idler_before(void)
|
|||
Evas_List *updates;
|
||||
|
||||
p = l->data;
|
||||
if (!p->evas) continue;
|
||||
if (!p->e_cursor) continue;
|
||||
|
||||
updates = evas_render_updates(p->evas);
|
||||
if ((updates) || (p->hot.update))
|
||||
|
@ -205,7 +334,7 @@ _e_pointer_cb_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event
|
|||
Evas_Coord x, y;
|
||||
|
||||
p = data;
|
||||
if (!p->evas) return;
|
||||
if (!p->e_cursor) return;
|
||||
evas_object_geometry_get(p->hot_object, &x, &y, NULL, NULL);
|
||||
if ((p->hot.x != x) || (p->hot.y != y))
|
||||
{
|
||||
|
|
|
@ -15,6 +15,9 @@ struct _E_Pointer
|
|||
{
|
||||
E_Object e_obj_inherit;
|
||||
|
||||
unsigned char e_cursor : 1;
|
||||
unsigned char color : 1;
|
||||
|
||||
Evas *evas;
|
||||
Evas_Object *pointer_object;
|
||||
Evas_Object *hot_object;
|
||||
|
@ -32,6 +35,7 @@ struct _E_Pointer
|
|||
};
|
||||
|
||||
EAPI E_Pointer *e_pointer_window_new(Ecore_X_Window win);
|
||||
EAPI void e_pointer_type_set(E_Pointer *p, const char *type);
|
||||
EAPI void e_pointers_size_set(int size);
|
||||
EAPI void e_pointer_idler_before(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue