ecore-x - add force refresh call to randr api

This commit is contained in:
Carsten Haitzler 2021-09-03 09:08:26 +01:00
parent 5f419d5b5f
commit f8b262037f
2 changed files with 33 additions and 3 deletions

View File

@ -2166,6 +2166,7 @@ EAPI void ecore_x_randr_events_select(Ecore
EAPI void ecore_x_randr_screen_current_size_get(Ecore_X_Window root, int *w, int *h, int *w_mm, int *h_mm);
EAPI void ecore_x_randr_screen_size_range_get(Ecore_X_Window root, int *wmin, int *hmin, int *wmax, int *hmax);
EAPI void ecore_x_randr_screen_reset(Ecore_X_Window root);
EAPI void ecore_x_randr_screen_refresh(Ecore_X_Window root); /**< @since 1.26 */
EAPI Eina_Bool ecore_x_randr_screen_current_size_set(Ecore_X_Window root, int w, int h, int w_mm, int h_mm);
EAPI Ecore_X_Randr_Mode_Info **ecore_x_randr_modes_info_get(Ecore_X_Window root, int *num);
EAPI Ecore_X_Randr_Mode ecore_x_randr_mode_info_add(Ecore_X_Window root, Ecore_X_Randr_Mode_Info *mode_info);

View File

@ -44,7 +44,14 @@ typedef enum _Ecore_X_Randr_Edid_Aspect_Ratio_Preferred
static int _randr_major, _randr_minor, _randr_version;
XRRScreenResources *(*_ecore_x_randr_screen_resources_get)(Display *disp, Window win);
static XRRScreenResources *
_ecore_x_randr_screen_resources_get_dummy(Display *disp EINA_UNUSED, Window win EINA_UNUSED)
{
return NULL;
}
XRRScreenResources *(*_ecore_x_randr_screen_resources_get)(Display *disp, Window win) = _ecore_x_randr_screen_resources_get_dummy;
XRRScreenResources *(*_ecore_x_randr_screen_resources_get_slow)(Display *disp, Window win) = _ecore_x_randr_screen_resources_get_dummy;
#endif
@ -63,9 +70,15 @@ _ecore_x_randr_init(void)
_randr_version = (_randr_major << 16) | _randr_minor;
if (_randr_version >= RANDR_VERSION_1_3)
_ecore_x_randr_screen_resources_get = XRRGetScreenResourcesCurrent;
{
_ecore_x_randr_screen_resources_get = XRRGetScreenResourcesCurrent;
_ecore_x_randr_screen_resources_get_slow = XRRGetScreenResources;
}
else if (_randr_version == RANDR_VERSION_1_2)
_ecore_x_randr_screen_resources_get = XRRGetScreenResources;
{
_ecore_x_randr_screen_resources_get = XRRGetScreenResources;
_ecore_x_randr_screen_resources_get_slow = XRRGetScreenResources;
}
_randr_avail = EINA_TRUE;
@ -538,6 +551,22 @@ ecore_x_randr_screen_size_range_get(Ecore_X_Window root, int *wmin, int *hmin, i
#endif
}
/**
* @brief forces a hardware monitor info etc. refresh on the server side
* @param root the window's screen which will be reset.
*/
EAPI void
ecore_x_randr_screen_refresh(Ecore_X_Window root)
{
XRRScreenResources *res = NULL;
if (_randr_version < RANDR_VERSION_1_2) return;
if ((res = _ecore_x_randr_screen_resources_get_slow(_ecore_x_disp, root)))
{
XRRFreeScreenResources(res);
}
}
/**
* @brief removes unused screen space. The most upper left CRTC is set to 0x0
* and all other CRTCs dx,dy respectively.