diff --git a/legacy/ecore/src/Ecore.h b/legacy/ecore/src/Ecore.h index 0026d2c98d..b13043bddf 100644 --- a/legacy/ecore/src/Ecore.h +++ b/legacy/ecore/src/Ecore.h @@ -219,6 +219,7 @@ void e_dnd_set_mode_ask(void); void e_dnd_own_selection(Window win); void e_dnd_send_drop(Window win, Window source_win); void e_window_gravity_reset(Window win); +void e_window_gravity_set(Window win, int gravity); void e_pointer_warp_by(int dx, int dy); void e_pointer_warp_to(int x, int y); void e_gc_set_include_inferiors(GC gc); @@ -229,6 +230,7 @@ void e_window_get_virtual_area(Window win, int *area_x, int *area_y); void e_get_virtual_area(int *area_x, int *area_y); +void e_window_get_root_relative_location(Window win, int *x, int *y); typedef struct _eev Eevent; typedef struct _ev_fd_handler Ev_Fd_Handler; diff --git a/legacy/ecore/src/e_x.c b/legacy/ecore/src/e_x.c index 7ee70000da..1f95039d7f 100644 --- a/legacy/ecore/src/e_x.c +++ b/legacy/ecore/src/e_x.c @@ -2218,6 +2218,15 @@ e_window_gravity_reset(Window win) XChangeWindowAttributes(disp, win, CWWinGravity, &att); } +void +e_window_gravity_set(Window win, int gravity) +{ + XSetWindowAttributes att; + + att.win_gravity = gravity; + XChangeWindowAttributes(disp, win, CWWinGravity, &att); +} + void e_pointer_warp_by(int dx, int dy) { @@ -2297,3 +2306,48 @@ e_get_virtual_area(int *area_x, int *area_y) FREE(data); } } + +void +e_window_get_root_relative_location(Window win, int *x, int *y) +{ + int dx, dy; + Window parent; + E_XID *xid = NULL; + + if (win == 0) + win = default_root; + if (win == default_root) + { + if (x) *x = 0; + if (y) *y = 0; + return; + } + xid = e_validate_xid(win); + if (!xid) + { + if (x) *x = 0; + if (y) *y = 0; + return; + } + dx = 0; + dy = 0; + do + { + parent = xid->parent; + dx += xid->x; + dy += xid->y; + if (parent != default_root) + { + xid = e_validate_xid(parent); + if (!xid) + { + if (x) *x = dx; + if (y) *y = dy; + return; + } + } + } + while (parent != default_root); + if (x) *x = dx; + if (y) *y = dy; +}