ecomorph hookes from <hannes.janetzek@googlemail.com>

SVN revision: 42203
devs/princeamd/enlightenment-0.17-elive
Carsten Haitzler 14 years ago
parent 33e754e63e
commit fb4208b4a3
  1. 131
      src/bin/e_border.c
  2. 12
      src/bin/e_border.h
  3. 5
      src/bin/e_main.c
  4. 235
      src/bin/e_moveresize.c
  5. 11
      src/bin/e_moveresize.h

@ -245,8 +245,10 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal)
if (bd->client.argb)
bd->win = ecore_x_window_manager_argb_new(con->win, 0, 0, bd->w, bd->h);
else
bd->win = ecore_x_window_override_new(con->win, 0, 0, bd->w, bd->h);
ecore_x_window_shape_events_select(bd->win, 1);
{
bd->win = ecore_x_window_override_new(con->win, 0, 0, bd->w, bd->h);
ecore_x_window_shape_events_select(bd->win, 1);
}
e_bindings_mouse_grab(E_BINDING_CONTEXT_BORDER, bd->win);
e_bindings_wheel_grab(E_BINDING_CONTEXT_BORDER, bd->win);
e_focus_setup(bd);
@ -281,6 +283,28 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal)
return NULL;
}
/* printf("##- ON MAP CLIENT 0x%x SIZE %ix%i %i:%i\n",
* bd->client.win, bd->client.w, bd->client.h, att->x, att->y); */
/* FIXME: if first_map is 1 then we should ignore the first hide event
* or ensure the window is alreayd hidden and events flushed before we
* create a border for it */
if (first_map)
{
// printf("##- FIRST MAP\n");
bd->x = att->x;
bd->y = att->y;
bd->changes.pos = 1;
bd->re_manage = 1;
// needed to be 1 for internal windw and on restart.
// bd->ignore_first_unmap = 2;
}
bd->client.win = win;
bd->zone = e_zone_current_get(con);
_e_border_hook_call(E_BORDER_HOOK_NEW_BORDER, bd);
bd->handlers = eina_list_append(bd->handlers, ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN, _e_border_cb_mouse_in, bd));
bd->handlers = eina_list_append(bd->handlers, ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT, _e_border_cb_mouse_out, bd));
bd->handlers = eina_list_append(bd->handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_border_cb_mouse_down, bd));
@ -288,8 +312,6 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal)
bd->handlers = eina_list_append(bd->handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _e_border_cb_mouse_move, bd));
bd->handlers = eina_list_append(bd->handlers, ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, _e_border_cb_mouse_wheel, bd));
bd->client.win = win;
bd->client.icccm.title = NULL;
bd->client.icccm.name = NULL;
bd->client.icccm.class = NULL;
@ -455,23 +477,6 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal)
bd->changes.size = 1;
bd->changes.shape = 1;
// printf("##- ON MAP CLIENT 0x%x SIZE %ix%i\n",
// bd->client.win, bd->client.w, bd->client.h);
/* FIXME: if first_map is 1 then we should ignore the first hide event
* or ensure the window is alreayd hidden and events flushed before we
* create a border for it */
if (first_map)
{
// printf("##- FIRST MAP\n");
bd->x = att->x;
bd->y = att->y;
bd->changes.pos = 1;
bd->re_manage = 1;
// needed to be 1 for internal windw and on restart.
// bd->ignore_first_unmap = 2;
}
/* just to friggin make java happy - we're DELAYING the reparent until
* eval time...
*/
@ -683,6 +688,7 @@ e_border_desk_set(E_Border *bd, E_Desk *desk)
bd->desk = desk;
e_border_zone_set(bd, desk->zone);
_e_border_hook_call(E_BORDER_HOOK_SET_DESK, bd);
e_hints_window_desktop_set(bd);
ev = calloc(1, sizeof(E_Event_Border_Desk_Set));
@ -7920,8 +7926,6 @@ _e_border_zone_update(E_Border *bd)
static int
_e_border_resize_begin(E_Border *bd)
{
int w, h;
if (!bd->lock_user_stacking)
{
if (e_config->border_raise_on_mouse_action)
@ -7932,29 +7936,6 @@ _e_border_resize_begin(E_Border *bd)
(bd->fullscreen) || (bd->lock_user_size))
return 0;
if ((bd->client.icccm.base_w >= 0) &&
(bd->client.icccm.base_h >= 0))
{
if (bd->client.icccm.step_w > 0)
w = (bd->client.w - bd->client.icccm.base_w) / bd->client.icccm.step_w;
else
w = bd->client.w;
if (bd->client.icccm.step_h > 0)
h = (bd->client.h - bd->client.icccm.base_h) / bd->client.icccm.step_h;
else
h = bd->client.h;
}
else
{
if (bd->client.icccm.step_w > 0)
w = (bd->client.w - bd->client.icccm.min_w) / bd->client.icccm.step_w;
else
w = bd->client.w;
if (bd->client.icccm.step_h > 0)
h = (bd->client.h - bd->client.icccm.min_h) / bd->client.icccm.step_h;
else
h = bd->client.h;
}
if (grabbed)
e_grabinput_get(bd->win, 0, bd->win);
if (bd->client.netwm.sync.request)
@ -7964,11 +7945,9 @@ _e_border_resize_begin(E_Border *bd)
bd->client.netwm.sync.wait = 0;
bd->client.netwm.sync.send_time = ecore_loop_time_get();
}
if (e_config->resize_info_follows)
e_move_resize_object_coords_set(bd->x + bd->fx.x, bd->y + bd->fx.y, bd->w, bd->h);
else
e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
e_resize_begin(bd->zone, w, h);
_e_border_hook_call(E_BORDER_HOOK_RESIZE_BEGIN, bd);
resize = bd;
return 1;
}
@ -7984,7 +7963,8 @@ _e_border_resize_end(E_Border *bd)
ecore_x_sync_alarm_free(bd->client.netwm.sync.alarm);
bd->client.netwm.sync.alarm = 0;
}
e_resize_end();
_e_border_hook_call(E_BORDER_HOOK_RESIZE_END, bd);
resize = NULL;
/* If this border was maximized, we need to unset Maximized state or
@ -7998,36 +7978,7 @@ _e_border_resize_end(E_Border *bd)
static void
_e_border_resize_update(E_Border *bd)
{
int w, h;
if ((bd->client.icccm.base_w >= 0) &&
(bd->client.icccm.base_h >= 0))
{
if (bd->client.icccm.step_w > 0)
w = (bd->client.w - bd->client.icccm.base_w) / bd->client.icccm.step_w;
else
w = bd->client.w;
if (bd->client.icccm.step_h > 0)
h = (bd->client.h - bd->client.icccm.base_h) / bd->client.icccm.step_h;
else
h = bd->client.h;
}
else
{
if (bd->client.icccm.step_w > 0)
w = (bd->client.w - bd->client.icccm.min_w) / bd->client.icccm.step_w;
else
w = bd->client.w;
if (bd->client.icccm.step_h > 0)
h = (bd->client.h - bd->client.icccm.min_h) / bd->client.icccm.step_h;
else
h = bd->client.h;
}
if (e_config->resize_info_follows)
e_move_resize_object_coords_set(bd->x + bd->fx.x, bd->y + bd->fx.y, bd->w, bd->h);
else
e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
e_resize_update(w, h);
_e_border_hook_call(E_BORDER_HOOK_RESIZE_UPDATE, bd);
}
static int
@ -8053,11 +8004,8 @@ _e_border_move_begin(E_Border *bd)
bd->client.netwm.sync.time = ecore_loop_time_get();
}
#endif
if (e_config->move_info_follows)
e_move_resize_object_coords_set(bd->x + bd->fx.x, bd->y + bd->fx.y, bd->w, bd->h);
else
e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
e_move_begin(bd->zone, bd->x, bd->y);
_e_border_hook_call(E_BORDER_HOOK_MOVE_BEGIN, bd);
move = bd;
return 1;
}
@ -8075,7 +8023,8 @@ _e_border_move_end(E_Border *bd)
bd->client.netwm.sync.alarm = 0;
}
#endif
e_move_end();
_e_border_hook_call(E_BORDER_HOOK_MOVE_END, bd);
move = NULL;
return 1;
}
@ -8083,11 +8032,7 @@ _e_border_move_end(E_Border *bd)
static void
_e_border_move_update(E_Border *bd)
{
if (e_config->move_info_follows)
e_move_resize_object_coords_set(bd->x + bd->fx.x, bd->y + bd->fx.y, bd->w, bd->h);
else
e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
e_move_update(bd->x, bd->y);
_e_border_hook_call(E_BORDER_HOOK_MOVE_UPDATE, bd);
}
static int

@ -88,7 +88,15 @@ typedef enum _E_Border_Hook_Point
E_BORDER_HOOK_EVAL_PRE_NEW_BORDER,
E_BORDER_HOOK_EVAL_POST_NEW_BORDER,
E_BORDER_HOOK_EVAL_END,
E_BORDER_HOOK_CONTAINER_LAYOUT
E_BORDER_HOOK_CONTAINER_LAYOUT,
E_BORDER_HOOK_NEW_BORDER,
E_BORDER_HOOK_SET_DESK,
E_BORDER_HOOK_MOVE_BEGIN,
E_BORDER_HOOK_MOVE_UPDATE,
E_BORDER_HOOK_MOVE_END,
E_BORDER_HOOK_RESIZE_BEGIN,
E_BORDER_HOOK_RESIZE_UPDATE,
E_BORDER_HOOK_RESIZE_END
} E_Border_Hook_Point;
typedef struct _E_Border E_Border;
@ -666,5 +674,7 @@ extern EAPI int E_EVENT_BORDER_FOCUS_IN;
extern EAPI int E_EVENT_BORDER_FOCUS_OUT;
extern EAPI int E_EVENT_BORDER_PROPERTY;
extern EAPI Ecore_X_Atom ECOMORPH_ATOM_MANAGED;
#endif
#endif

@ -650,6 +650,11 @@ main(int argc, char **argv)
}
_e_main_shutdown_push(e_intl_post_shutdown);
TS("move/resize info");
/* init move resize popup */
e_moveresize_init();
_e_main_shutdown_push(e_moveresize_shutdown);
TS("splash");
if (!((!e_config->show_splash) || (after_restart)))
{

@ -3,60 +3,113 @@
*/
#include "e.h"
static void _e_resize_begin(void *data, E_Border *bd);
static void _e_resize_update(void *data, E_Border *bd);
static void _e_resize_end(void *data, E_Border *bd);
static void _e_resize_border_extents(E_Border *bd, int *w, int *h);
static void _e_move_begin(void *data, E_Border *bd);
static void _e_move_update(void *data, E_Border *bd);
static void _e_move_end(void *data, E_Border *bd);
static void _e_move_resize_object_coords_set(int x, int y, int w, int h);
static E_Popup *_disp_pop = NULL;
static Evas_Object *_obj = NULL;
static Eina_List *hooks = NULL;
static int visible = 0;
static int obj_x = 0;
static int obj_y = 0;
static int obj_w = 0;
static int obj_h = 0;
EAPI void
e_resize_begin(E_Zone *zone, int w, int h)
EAPI int
e_moveresize_init(void)
{
E_Border_Hook *h;
h = e_border_hook_add(E_BORDER_HOOK_RESIZE_BEGIN, _e_resize_begin, NULL);
if (h) hooks = eina_list_append(hooks, h);
h = e_border_hook_add(E_BORDER_HOOK_RESIZE_UPDATE, _e_resize_update, NULL);
if (h) hooks = eina_list_append(hooks, h);
h = e_border_hook_add(E_BORDER_HOOK_RESIZE_END, _e_resize_end, NULL);
if (h) hooks = eina_list_append(hooks, h);
h = e_border_hook_add(E_BORDER_HOOK_MOVE_BEGIN, _e_move_begin, NULL);
if (h) hooks = eina_list_append(hooks, h);
h = e_border_hook_add(E_BORDER_HOOK_MOVE_UPDATE, _e_move_update, NULL);
if (h) hooks = eina_list_append(hooks, h);
h = e_border_hook_add(E_BORDER_HOOK_MOVE_END, _e_move_end, NULL);
if (h) hooks = eina_list_append(hooks, h);
return 1;
}
EAPI int
e_moveresize_shutdown(void)
{
E_Border_Hook *h;
EINA_LIST_FREE(hooks, h)
e_border_hook_del(h);
}
static void
_e_resize_begin(void *data, E_Border *bd)
{
Evas_Coord ew, eh;
char buf[40];
int w, h;
_obj = NULL;
if (_disp_pop) e_object_del(E_OBJECT(_disp_pop));
_disp_pop = NULL;
_obj = NULL;
if (e_config->resize_info_visible)
{
_disp_pop = e_popup_new(zone, 0, 0, 1, 1);
if (!_disp_pop) return;
e_popup_layer_set(_disp_pop, 255);
_obj = edje_object_add(_disp_pop->evas);
e_theme_edje_object_set(_obj, "base/theme/borders",
"e/widgets/border/default/resize");
snprintf(buf, sizeof(buf), "9999x9999");
edje_object_part_text_set(_obj, "e.text.label", buf);
edje_object_size_min_calc(_obj, &ew, &eh);
evas_object_move(_obj, 0, 0);
evas_object_resize(_obj, ew, eh);
evas_object_show(_obj);
e_popup_edje_bg_object_set(_disp_pop, _obj);
}
e_resize_update(w, h);
if (!e_config->resize_info_visible)
return;
if (e_config->resize_info_visible)
if (e_config->resize_info_follows)
_e_move_resize_object_coords_set(bd->x + bd->fx.x, bd->y + bd->fx.y, bd->w, bd->h);
else
_e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
_e_resize_border_extents(bd, &w, &h);
_disp_pop = e_popup_new(bd->zone, 0, 0, 1, 1);
if (!_disp_pop) return;
e_popup_layer_set(_disp_pop, 255);
_obj = edje_object_add(_disp_pop->evas);
e_theme_edje_object_set(_obj, "base/theme/borders",
"e/widgets/border/default/resize");
snprintf(buf, sizeof(buf), "9999x9999");
edje_object_part_text_set(_obj, "e.text.label", buf);
edje_object_size_min_calc(_obj, &ew, &eh);
evas_object_move(_obj, 0, 0);
evas_object_resize(_obj, ew, eh);
evas_object_show(_obj);
e_popup_edje_bg_object_set(_disp_pop, _obj);
if (!visible)
{
e_popup_move_resize(_disp_pop,
(obj_x - _disp_pop->zone->x) +
((obj_w - ew) / 2),
(obj_y - _disp_pop->zone->y) +
((obj_h - eh) / 2),
ew, eh);
evas_object_show(_obj);
e_popup_show(_disp_pop);
visible = 1;
}
snprintf(buf, sizeof(buf), "%ix%i", w, h);
edje_object_part_text_set(_obj, "e.text.label", buf);
e_popup_move_resize(_disp_pop,
(obj_x - _disp_pop->zone->x) +
((obj_w - ew) / 2),
(obj_y - _disp_pop->zone->y) +
((obj_h - eh) / 2),
ew, eh);
e_popup_show(_disp_pop);
visible = 1;
}
EAPI void
e_resize_end(void)
static void
_e_resize_end(void *data, E_Border *bd)
{
if (e_config->resize_info_visible)
{
@ -75,12 +128,21 @@ e_resize_end(void)
visible = 0;
}
EAPI void
e_resize_update(int w, int h)
static void
_e_resize_update(void *data, E_Border *bd)
{
char buf[40];
int w, h;
if (!_disp_pop) return;
if (e_config->resize_info_follows)
_e_move_resize_object_coords_set(bd->x + bd->fx.x, bd->y + bd->fx.y, bd->w, bd->h);
else
_e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
_e_resize_border_extents(bd, &w, &h);
if (!visible)
{
evas_object_show(_obj);
@ -91,44 +153,75 @@ e_resize_update(int w, int h)
edje_object_part_text_set(_obj, "e.text.label", buf);
}
EAPI void
e_move_begin(E_Zone *zone, int x, int y)
static void
_e_resize_border_extents(E_Border *bd, int *w, int *h)
{
if ((bd->client.icccm.base_w >= 0) &&
(bd->client.icccm.base_h >= 0))
{
if (bd->client.icccm.step_w > 0)
*w = (bd->client.w - bd->client.icccm.base_w) / bd->client.icccm.step_w;
else
*w = bd->client.w;
if (bd->client.icccm.step_h > 0)
*h = (bd->client.h - bd->client.icccm.base_h) / bd->client.icccm.step_h;
else
*h = bd->client.h;
}
else
{
if (bd->client.icccm.step_w > 0)
*w = (bd->client.w - bd->client.icccm.min_w) / bd->client.icccm.step_w;
else
*w = bd->client.w;
if (bd->client.icccm.step_h > 0)
*h = (bd->client.h - bd->client.icccm.min_h) / bd->client.icccm.step_h;
else
*h = bd->client.h;
}
}
static void
_e_move_begin(void *data, E_Border *bd)
{
Evas_Coord ew, eh;
char buf[40];
_obj = NULL;
if (_disp_pop) e_object_del(E_OBJECT(_disp_pop));
_disp_pop = NULL;
_obj = NULL;
if (e_config->move_info_visible)
{
_disp_pop = e_popup_new(zone, 0, 0, 1, 1);
_obj = edje_object_add(_disp_pop->evas);
e_theme_edje_object_set(_obj, "base/theme/borders",
"e/widgets/border/default/move");
snprintf(buf, sizeof(buf), "9999 9999");
edje_object_part_text_set(_obj, "e.text.label", buf);
edje_object_size_min_calc(_obj, &ew, &eh);
evas_object_move(_obj, 0, 0);
evas_object_resize(_obj, ew, eh);
evas_object_show(_obj);
e_popup_edje_bg_object_set(_disp_pop, _obj);
}
if (!e_config->move_info_visible)
return;
if (e_config->move_info_visible)
{
e_popup_move_resize(_disp_pop,
(obj_x - _disp_pop->zone->x) +
((obj_w - ew) / 2),
(obj_y - _disp_pop->zone->y) +
((obj_h - eh) / 2),
ew, eh);
}
if (e_config->move_info_follows)
_e_move_resize_object_coords_set(bd->x + bd->fx.x, bd->y + bd->fx.y, bd->w, bd->h);
else
_e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
_disp_pop = e_popup_new(bd->zone, 0, 0, 1, 1);
_obj = edje_object_add(_disp_pop->evas);
e_theme_edje_object_set(_obj, "base/theme/borders",
"e/widgets/border/default/move");
snprintf(buf, sizeof(buf), "9999 9999");
edje_object_part_text_set(_obj, "e.text.label", buf);
edje_object_size_min_calc(_obj, &ew, &eh);
evas_object_move(_obj, 0, 0);
evas_object_resize(_obj, ew, eh);
evas_object_show(_obj);
e_popup_edje_bg_object_set(_disp_pop, _obj);
e_popup_move_resize(_disp_pop,
(obj_x - _disp_pop->zone->x) +
((obj_w - ew) / 2),
(obj_y - _disp_pop->zone->y) +
((obj_h - eh) / 2),
ew, eh);
}
EAPI void
e_move_end(void)
static void
_e_move_end(void *data, E_Border *bd)
{
if (e_config->move_info_visible)
{
@ -147,24 +240,30 @@ e_move_end(void)
visible = 0;
}
EAPI void
e_move_update(int x, int y)
static void
_e_move_update(void *data, E_Border *bd)
{
char buf[40];
if (!_disp_pop) return;
if (e_config->move_info_follows)
_e_move_resize_object_coords_set(bd->x + bd->fx.x, bd->y + bd->fx.y, bd->w, bd->h);
else
_e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
if (!visible)
{
evas_object_show(_obj);
e_popup_show(_disp_pop);
visible = 1;
}
snprintf(buf, sizeof(buf), "%i %i", x, y);
snprintf(buf, sizeof(buf), "%i %i", bd->x, bd->y);
edje_object_part_text_set(_obj, "e.text.label", buf);
}
EAPI void
e_move_resize_object_coords_set(int x, int y, int w, int h)
static void
_e_move_resize_object_coords_set(int x, int y, int w, int h)
{
obj_x = x;
obj_y = y;

@ -7,15 +7,8 @@
#ifndef E_MOVERESIZE_H
#define E_MOVERESIZE_H
EAPI void e_resize_begin(E_Zone *zone, int w, int h);
EAPI void e_resize_end(void);
EAPI void e_resize_update(int w, int h);
EAPI void e_move_begin(E_Zone *zone, int x, int y);
EAPI void e_move_end(void);
EAPI void e_move_update(int x, int y);
EAPI void e_move_resize_object_coords_set(int x, int y, int w, int h);
EAPI int e_moveresize_init(void);
EAPI int e_moveresize_shutdown(void);
#endif
#endif

Loading…
Cancel
Save