raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=f8b262037f4f9b845eea6546f0239f37003d9be6

commit f8b262037f4f9b845eea6546f0239f37003d9be6
Author: Carsten Haitzler <[email protected]>
Date:   Fri Sep 3 09:08:26 2021 +0100

    ecore-x - add force refresh call to randr api
---
 src/lib/ecore_x/Ecore_X.h       |  1 +
 src/lib/ecore_x/ecore_x_randr.c | 35 ++++++++++++++++++++++++++++++++---
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h
index 8eb235b5fb..9dced7f381 100644
--- a/src/lib/ecore_x/Ecore_X.h
+++ b/src/lib/ecore_x/Ecore_X.h
@@ -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);
diff --git a/src/lib/ecore_x/ecore_x_randr.c b/src/lib/ecore_x/ecore_x_randr.c
index faab344eb5..bd1ef23427 100644
--- a/src/lib/ecore_x/ecore_x_randr.c
+++ b/src/lib/ecore_x/ecore_x_randr.c
@@ -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.

-- 


Reply via email to