This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository enlightenment.

View the commit online.

commit 5f0f671bbc21a48dcfdd4f577a087cdcdea9ffdd
Author: [email protected] <[email protected]>
AuthorDate: Sat Mar 7 16:41:46 2026 -0700

    fix: disable CRTCs for disconnected screens in RandR configuration
    
    When displays were disconnected, the CRTC configuration loop used numout
    (count of assigned outputs) as its iteration bound instead of crtcs_num
    (total CRTC count). This caused CRTCs connected to disabled/disconnected
    screens to never be iterated, leaving them in their previous mode and
    geometry state.
    
    A disconnected monitor's CRTC would retain its mode, inflating the X
    virtual screen size. For example, unplugging a 3440x1440 ultrawide would
    leave the X virtual size at 5360x1440 instead of shrinking to 1920x1080.
    
    The fix ensures all CRTCs are iterated and disabled if unassigned. The
    outconf/screenconf arrays are also sized to max(crtcs_num, outputs_num)
    to prevent buffer overflows when there are more CRTCs than outputs.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 src/bin/e_comp_x_randr.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/bin/e_comp_x_randr.c b/src/bin/e_comp_x_randr.c
index b6afe1de4..635878118 100644
--- a/src/bin/e_comp_x_randr.c
+++ b/src/bin/e_comp_x_randr.c
@@ -769,10 +769,11 @@ _e_comp_xrandr_ecore_x(void)
    printf("RRR: crtcs=%p outputs=%p\n", crtcs, outputs);
    if ((crtcs) && (outputs))
      {
-        outconf = alloca(outputs_num * sizeof(Ecore_X_Randr_Output));
-        screenconf = alloca(outputs_num * sizeof(E_Randr2_Screen *));
-        memset(outconf, 0, outputs_num * sizeof(Ecore_X_Randr_Output));
-        memset(screenconf, 0, outputs_num * sizeof(E_Randr2_Screen *));
+        int conf_num = (crtcs_num > outputs_num) ? crtcs_num : outputs_num;
+        outconf = alloca(conf_num * sizeof(Ecore_X_Randr_Output));
+        screenconf = alloca(conf_num * sizeof(E_Randr2_Screen *));
+        memset(outconf, 0, conf_num * sizeof(Ecore_X_Randr_Output));
+        memset(screenconf, 0, conf_num * sizeof(E_Randr2_Screen *));
 
         // decide which outputs get which crtcs
         EINA_LIST_FOREACH(e_randr2->screens, l, s)
@@ -788,7 +789,7 @@ _e_comp_xrandr_ecore_x(void)
                     {
                        if (s->config.priority > top_priority)
                          top_priority = s->config.priority;
-                       for (i = 0; i < outputs_num; i++)
+                       for (i = 0; i < crtcs_num; i++)
                          {
                             if (!outconf[i])
                               {
@@ -826,7 +827,8 @@ _e_comp_xrandr_ecore_x(void)
 
              scrs_num = 0;
              // set up a crtc to drive each output (or not)
-             for (i = 0; i < numout; i++)
+             // iterate all crtcs so unassigned ones get disabled
+             for (i = 0; i < crtcs_num; i++)
                {
                   // XXX: find clones and set them as outputs in an array
                   if (outconf[i])

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to