Hey guys,

there is a problem with using the conf_display dialog.
This patches fixes it.

The rest of the patch workarounds a problem with 'reset'-events sent,
when the client supports RandR >=1.2, but uses RandR 1.1 API (e.g.
command line tool xrandr -s ...).

BR,

Leif
diff --git a/e/src/bin/e_randr.c b/e/src/bin/e_randr.c
index 7aa8422..1350d62 100644
--- a/e/src/bin/e_randr.c
+++ b/e/src/bin/e_randr.c
@@ -269,7 +269,7 @@ _e_randr_screen_info_12_new(void)
         .crtcs = NULL,
         .outputs = NULL,
         .primary_output = NULL,
-        .output_policy = ECORE_X_RANDR_OUTPUT_POLICY_RIGHT,
+        .output_policy = ECORE_X_RANDR_OUTPUT_POLICY_NONE,
         .alignment = ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE
      };
 
@@ -786,7 +786,7 @@ _e_randr_event_cb(void *data, int type, void *ev)
              if (event->crtc)
                output_info->crtc = _e_randr_crtc_info_get(event->crtc);
 
-             if (!event->crtc && !event->mode)
+             if (output_info && !output_info->crtc && !event->crtc && !event->mode)
                {
                   //Monitor was attached!
                   _e_randr_output_info_hw_info_set(output_info);
@@ -1175,6 +1175,8 @@ _e_randr_try_enable_output(E_Randr_Output_Info *output_info, Eina_Bool force)
    //get the CRTC we will refer to, dependend on policy
    switch (e_randr_screen_info->rrvd_info.randr_info_12->output_policy)
      {
+      case ECORE_X_RANDR_OUTPUT_POLICY_NONE:
+         return EINA_TRUE;
       case ECORE_X_RANDR_OUTPUT_POLICY_CLONE:
          /*
           * Order of approaches to enable a clone (of the primary output):
@@ -1268,7 +1270,7 @@ _e_randr_try_enable_output(E_Randr_Output_Info *output_info, Eina_Bool force)
         break;
 
       default:
-        if ((!usable_crtc->current_mode) || force)
+        if ((usable_crtc && (!usable_crtc->current_mode)) || force)
           {
              //enable and position according to used policies
              mode_info = ((Ecore_X_Randr_Mode_Info*)eina_list_nth(output_info->preferred_modes, 0));
diff --git a/e/src/modules/conf_display/e_int_config_display.c b/e/src/modules/conf_display/e_int_config_display.c
index a56db83..27b6284 100644
--- a/e/src/modules/conf_display/e_int_config_display.c
+++ b/e/src/modules/conf_display/e_int_config_display.c
@@ -58,7 +58,7 @@ struct _E_Config_Dialog_Data
    int flip;
    int flip_x;
    int flip_y;
-   int has_rates;
+   Eina_Bool has_rates;
 
    Evas_Object *rate_list;
    Evas_Object *res_list;
@@ -252,11 +252,32 @@ _fill_data(E_Config_Dialog_Data *cfdata)
 
    EINA_LIST_FOREACH(e_config->screen_info, iter, restore_info)
      {
-	if (restore_info->randr_version == RANDR_11)
-	  {
-	     e_screen_config_11 = restore_info->rrvd_restore_info.restore_info_11;
-	     break;
-	  }
+        if (restore_info->randr_version == RANDR_11)
+          {
+             e_screen_config_11 = restore_info->rrvd_restore_info.restore_info_11;
+             break;
+          }
+     }
+
+   if(!e_screen_config_11)
+     {
+        if ((restore_info = E_NEW(E_Randr_Screen_Restore_Info, 1)))
+          {
+             restore_info->randr_version = RANDR_11;
+             if ((e_screen_config_11 = E_NEW(E_Randr_Screen_Restore_Info_11, 1)))
+               {
+                  restore_info->rrvd_restore_info.restore_info_11 = e_screen_config_11;
+                  if (!(e_config->screen_info = eina_list_append(e_config->screen_info, restore_info)))
+                    {
+                       free(e_screen_config_11);
+                       free(restore_info);
+                    }
+               }
+             else
+               {
+                  free (restore_info);
+               }
+          }
      }
 
    rots = ecore_x_randr_screen_primary_output_orientations_get(man->root);
@@ -436,7 +457,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
 
    man = e_manager_current_get();
    sizes = ecore_x_randr_screen_primary_output_sizes_get(man->root, &s);
-   cfdata->has_rates = 0;
+   cfdata->has_rates = EINA_FALSE;
 
    if ((!sizes) || (s == 0))
      ecore_timer_add(0.5, _deferred_noxrandr_error, NULL);
@@ -462,7 +483,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
 	       {
 		  Ecore_X_Randr_Refresh_Rate * rt;
 
-		  cfdata->has_rates = 1;
+		  cfdata->has_rates = EINA_TRUE;
 		  rt = E_NEW(Ecore_X_Randr_Refresh_Rate, 1);
 		  if (!rt) continue;
 		  *rt = rates[j];
diff --git a/ecore/src/lib/ecore_x/Ecore_X.h b/ecore/src/lib/ecore_x/Ecore_X.h
index a0e431d..19929c0 100644
--- a/ecore/src/lib/ecore_x/Ecore_X.h
+++ b/ecore/src/lib/ecore_x/Ecore_X.h
@@ -188,7 +188,8 @@ typedef enum _Ecore_X_Randr_Output_Policy {
    ECORE_X_RANDR_OUTPUT_POLICY_RIGHT = 2,
    ECORE_X_RANDR_OUTPUT_POLICY_BELOW = 3,
    ECORE_X_RANDR_OUTPUT_POLICY_LEFT = 4,
-   ECORE_X_RANDR_OUTPUT_POLICY_CLONE = 5
+   ECORE_X_RANDR_OUTPUT_POLICY_CLONE = 5,
+   ECORE_X_RANDR_OUTPUT_POLICY_NONE = 6
 } Ecore_X_Randr_Output_Policy;
 
 typedef enum _Ecore_X_Randr_Relative_Alignment {
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to