devilhorns pushed a commit to branch master.

commit d6a392d1278b6ef3d893ab1d0812a9cd625bc4a9
Author: Chris Michael <[email protected]>
Date:   Fri May 24 11:28:34 2013 +0100

    Preliminary support for Primary Output of XRandR
    
    NB: If you have more than one output, XRandR has the option/support to
    set a specific monitor as the primary output. These changes allow some
    distinction in the dialog between which output is primary (a faint
    glow around the monitor). This is just the "display" portion of
    Primary Output support ... next is a method to Change that.
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/bin/e_randr.c                        | 29 +++++++++++++++++++++++++++++
 src/modules/conf_randr/e_smart_monitor.c | 10 ++++++++++
 2 files changed, 39 insertions(+)

diff --git a/src/bin/e_randr.c b/src/bin/e_randr.c
index 180ceec..eefe094 100644
--- a/src/bin/e_randr.c
+++ b/src/bin/e_randr.c
@@ -212,6 +212,7 @@ _e_randr_config_new(void)
 {
    Ecore_X_Window root = 0;
    Ecore_X_Randr_Crtc *crtcs = NULL;
+   Ecore_X_Randr_Output primary = 0;
    int ncrtcs = 0, i = 0;
 
    /* create new randr cfg */
@@ -230,6 +231,9 @@ _e_randr_config_new(void)
    /* grab the root window once */
    root = ecore_x_window_root_first_get();
 
+   /* get which output is primary */
+   primary = ecore_x_randr_primary_output_get(root);
+
    /* record the current screen size in our config */
    ecore_x_randr_screen_current_size_get(root, &e_randr_cfg->screen.width, 
                                          &e_randr_cfg->screen.height, 
@@ -273,6 +277,23 @@ _e_randr_config_new(void)
                        /* assign crtc for this output */
                        output_cfg->crtc = crtcs[i];
                        output_cfg->exists = EINA_TRUE;
+                       if (outputs[j] == primary)
+                         output_cfg->primary = EINA_TRUE;
+
+                       if (!primary)
+                         {
+                            /* X has no primary output set */
+                            if (j == 0)
+                              {
+                                 /* if no primary is set, then we should 
+                                  * use the first output listed by xrandr */
+                                 output_cfg->primary = EINA_TRUE;
+                                 primary = outputs[j];
+
+                                 ecore_x_randr_primary_output_set(root, 
+                                                                  primary);
+                              }
+                         }
 
                        /* add this output to the list for this crtc */
                        crtc_cfg->outputs = 
@@ -527,6 +548,14 @@ _e_randr_config_restore(void)
                                                        crtc_cfg->y, 
                                                        crtc_cfg->mode, 
                                                        crtc_cfg->orient);
+
+                       EINA_LIST_FOREACH(valid_outputs, o, out)
+                         if (out->primary)
+                           {
+                              ecore_x_randr_primary_output_set(root, out->xid);
+                              break;
+                           }
+
                        free(couts);
                     }
                }
diff --git a/src/modules/conf_randr/e_smart_monitor.c 
b/src/modules/conf_randr/e_smart_monitor.c
index fb737c2..ecd743b 100644
--- a/src/modules/conf_randr/e_smart_monitor.c
+++ b/src/modules/conf_randr/e_smart_monitor.c
@@ -330,6 +330,7 @@ e_smart_monitor_output_set(Evas_Object *obj, 
Ecore_X_Randr_Output output)
    E_Smart_Data *sd;
    Ecore_X_Randr_Mode_Info *mode;
    Ecore_X_Window root = 0;
+   Ecore_X_Randr_Output primary = 0;
    char *name = NULL;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -352,6 +353,9 @@ e_smart_monitor_output_set(Evas_Object *obj, 
Ecore_X_Randr_Output output)
    /* get the root window */
    root = ecore_x_window_root_first_get();
 
+   /* get the primary output */
+   primary = ecore_x_randr_primary_output_get(root);
+
    /* get output name */
    if (!(name = ecore_x_randr_output_name_get(root, sd->output, NULL)))
      {
@@ -370,6 +374,12 @@ e_smart_monitor_output_set(Evas_Object *obj, 
Ecore_X_Randr_Output output)
           }
      }
 
+   /* set if it's primary */
+   if (output == primary)
+     edje_object_signal_emit(sd->o_frame, "e,state,primary,on", "e"); 
+   else
+     edje_object_signal_emit(sd->o_frame, "e,state,primary,off", "e");
+
    /* set monitor name */
    edje_object_part_text_set(sd->o_frame, "e.text.name", name);
 

-- 

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may

Reply via email to