forked from enlightenment/efl
ecore-wl2: Add API function to find an output for given window
Small patch which adds an API function that can be used to find the output where a given window resides. @feature Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
a9e0148c62
commit
70a345005b
|
@ -946,6 +946,18 @@ EAPI void ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool ico
|
|||
*/
|
||||
EAPI void ecore_wl2_window_type_set(Ecore_Wl2_Window *window, Ecore_Wl2_Window_Type type);
|
||||
|
||||
/**
|
||||
* Find the output that a given window is on
|
||||
*
|
||||
* @param window The window to find the output for
|
||||
*
|
||||
* @return An Ecore_Wl2_Output if found, or NULL otherwise
|
||||
*
|
||||
* @ingroup Ecore_Wl2_Window_Group
|
||||
* @since 1.20
|
||||
*/
|
||||
EAPI Ecore_Wl2_Output *ecore_wl2_window_output_find(Ecore_Wl2_Window *window);
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_Wl2_Input_Group Wayland Library Input Functions
|
||||
* @ingroup Ecore_Wl2_Group
|
||||
|
|
|
@ -1164,3 +1164,44 @@ ecore_wl2_window_activated_get(const Ecore_Wl2_Window *window)
|
|||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
||||
return window->focused;
|
||||
}
|
||||
|
||||
EAPI Ecore_Wl2_Output *
|
||||
ecore_wl2_window_output_find(Ecore_Wl2_Window *window)
|
||||
{
|
||||
Ecore_Wl2_Output *out;
|
||||
Eina_Inlist *tmp;
|
||||
int x = 0, y = 0;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
||||
|
||||
x = window->geometry.x;
|
||||
y = window->geometry.y;
|
||||
|
||||
EINA_INLIST_FOREACH_SAFE(window->display->outputs, tmp, out)
|
||||
{
|
||||
int ox, oy, ow, oh;
|
||||
|
||||
ox = out->geometry.x;
|
||||
oy = out->geometry.y;
|
||||
|
||||
switch (out->transform)
|
||||
{
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
ow = out->geometry.h;
|
||||
oh = out->geometry.w;
|
||||
break;
|
||||
default:
|
||||
ow = out->geometry.w;
|
||||
oh = out->geometry.h;
|
||||
break;
|
||||
}
|
||||
|
||||
if (((x >= ox) && (x < ow)) && ((y >= oy) && (y < oh)))
|
||||
return out;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue