[prev in list] [next in list] [prev in thread] [next in thread] 

List:       enlightenment-devel
Subject:    [E-devel] randr dialog issues
From:       Michael Blumenkrantz <michael.blumenkrantz () gmail ! com>
Date:       2012-11-29 7:10:16
Message-ID: CAHwmOzd2DDJZQK8eH30jy2uOwQKQ-pfMzGo-Eka93jhfK1u9mg () mail ! gmail ! com
[Download RAW message or body]

I've spent some time working on the randr dialog rotation as per
http://trac.enlightenment.org/e/ticket/1880. The attached patch fixes the
snapping and map application but also exposes some weirdness where, when
_e_smart_monitor_rotate_snap() is called during _e_smart_cb_rotate_stop(),
the monitor snaps into the wrong rotation and starts flipping out. I spent
some time debugging it without any luck, so I'm posting this patch for
someone else to try out.

Additionally, rotating after a resize causes the monitor aspect ratio to
break. Furthermore, it's possible to grab the rotate corner and drag in
such a way that the monitor stand starts dancing around in the
layout--possibly an easter egg?

["randr2.diff" (application/octet-stream)]

Index: e/src/modules/conf_randr/e_smart_monitor.c
===================================================================
--- e/src/modules/conf_randr/e_smart_monitor.c	(revision 79800)
+++ e/src/modules/conf_randr/e_smart_monitor.c	(working copy)
@@ -70,9 +70,6 @@
    /* crtc information */
    E_Randr_Crtc_Info *crtc;
 
-   /* rotation that existed when user started rotating */
-   int start_rotation;
-
    /* used to record the amount of rotation the user has changed */
    int rotation;
 
@@ -893,10 +890,7 @@
    if (!(sd = evas_object_smart_data_get(mon))) return;
 
    sd->rotating = EINA_TRUE;
-   sd->rotation = 0;
-   sd->start_rotation = 
-     _e_smart_monitor_rotation_get(sd->current.orientation);
-
+   sd->rotation = sd->current.rotation;
    e_layout_child_raise(mon);
 }
 
@@ -905,6 +899,8 @@
 {
    Evas_Object *mon;
    E_Smart_Data *sd;
+   int x, y, w, h;
+   Evas_Map *map;
 
    if (!(mon = data)) return;
    if (!(sd = evas_object_smart_data_get(mon))) return;
@@ -912,38 +908,31 @@
    sd->rotating = EINA_FALSE;
    e_layout_child_lower(mon);
 
-   /* accumulate rotation values from start */
-   sd->rotation += sd->start_rotation;
-
    /* get closest orientation to this one */
    sd->current.orientation = _e_smart_monitor_orientation_get(sd->rotation);
 
    /* set rotation to be the angle of this orientation */
-   sd->current.rotation = 
+   sd->current.rotation =
      _e_smart_monitor_rotation_get(sd->current.orientation);
 
-   if (sd->current.orientation >= ECORE_X_RANDR_ORIENTATION_ROT_0)
-     {
-        Evas_Coord x, y, w, h;
-        Evas_Map *map;
+   if (sd->current.rotation == sd->rotation) return;
+   sd->rotation = sd->current.rotation;
 
-        evas_object_geometry_get(sd->o_frame, &x, &y, &w, &h);
+   evas_object_geometry_get(sd->o_frame, &x, &y, &w, &h);
 
-        /* create frame 'map' for rotation */
-        map = evas_map_new(4);
-        evas_map_smooth_set(map, EINA_TRUE);
-        evas_map_alpha_set(map, EINA_TRUE);
-        evas_map_util_points_populate_from_object_full(map, sd->o_frame, 
-                                                      sd->rotation);
-        evas_map_util_rotate(map, sd->rotation,
-                             x + (w / 2), y + (h / 2));
-        evas_object_map_set(sd->o_frame, map);
-        evas_object_map_enable_set(sd->o_frame, EINA_TRUE);
-        evas_map_free(map);
+   /* create frame 'map' for rotation */
+   map = evas_map_new(4);
+   evas_map_smooth_set(map, EINA_TRUE);
+   evas_map_alpha_set(map, EINA_TRUE);
+   evas_map_util_points_populate_from_object(map, sd->o_frame);
+   evas_map_util_rotate(map, sd->rotation, x + (w / 2), y + (h / 2));
+   evas_object_map_set(sd->o_frame, map);
+   evas_object_map_enable_set(sd->o_frame, EINA_TRUE);
+   evas_map_free(map);
 
-        /* actually snap the object */
-        _e_smart_monitor_rotate_snap(mon);
-     }
+   /* actually snap the object */
+   _e_smart_monitor_rotate_snap(mon);
+   INF("cur=%d", sd->rotation);
 }
 
 static void 
@@ -1201,14 +1190,14 @@
    map = evas_map_new(4);
    evas_map_smooth_set(map, EINA_TRUE);
    evas_map_alpha_set(map, EINA_TRUE);
-   evas_map_util_points_populate_from_object_full(map, sd->o_frame, 
-                                                 sd->rotation);
+   evas_map_util_points_populate_from_object(map, sd->o_frame);
    evas_map_util_rotate(map, sd->rotation + mx, x + (w / 2), y + (h / 2));
    evas_object_map_set(sd->o_frame, map);
    evas_object_map_enable_set(sd->o_frame, EINA_TRUE);
    evas_map_free(map);
 
    sd->rotation += mx;
+   INF("ROT: %d", sd->rotation);
 }
 
 static void 


------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
VERIFY Test and improve your parallel project with help from experts 
and peers. http://goparallel.sourceforge.net

_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic