Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h desktops.c edge.c 


Log Message:
Add option to do edge flipping only when moving window (based on patch by
Peter Poulsen).

===================================================================
RCS file: /cvs/e/e16/e/src/E.h,v
retrieving revision 1.579
retrieving revision 1.580
diff -u -3 -r1.579 -r1.580
--- E.h 6 Mar 2007 03:33:31 -0000       1.579
+++ E.h 23 Mar 2007 22:04:38 -0000      1.580
@@ -148,6 +148,10 @@
 #define MODE_FOCUS_SLOPPY       1
 #define MODE_FOCUS_CLICK        2
 
+#define EDGE_FLIP_OFF           0
+#define EDGE_FLIP_ON            1
+#define EDGE_FLIP_MOVE          2
+
 #define DOCK_LEFT               0
 #define DOCK_RIGHT              1
 #define DOCK_UP                 2
@@ -283,6 +287,7 @@
       int                 areas_nx;
       int                 areas_ny;
       char                areas_wraparound;
+      int                 edge_flip_mode;
       int                 edge_flip_resistance;
    } desks;
    struct
===================================================================
RCS file: /cvs/e/e16/e/src/desktops.c,v
retrieving revision 1.257
retrieving revision 1.258
diff -u -3 -r1.257 -r1.258
--- desktops.c  14 Mar 2007 01:02:48 -0000      1.257
+++ desktops.c  23 Mar 2007 22:04:38 -0000      1.258
@@ -2176,6 +2176,10 @@
 
    memset(&desks, 0, sizeof(desks));
 
+   /* Backward compatibility hack */
+   if (Conf.desks.edge_flip_resistance <= 0)
+      Conf.desks.edge_flip_mode = EDGE_FLIP_OFF;
+
    desks.previous = NULL;
 
    for (i = 0; i < Conf.desks.num; i++)
@@ -2481,8 +2485,8 @@
 
 static int          tmp_area_x;
 static int          tmp_area_y;
+static int          tmp_edge_flip;
 static int          tmp_edge_resist;
-static char         tmp_edge_flip;
 static DItem       *tmp_area_text;
 static char         tmp_area_wraparound;
 
@@ -2493,14 +2497,10 @@
      {
        SetNewAreaSize(tmp_area_x, 9 - tmp_area_y);
        Conf.desks.areas_wraparound = tmp_area_wraparound;
-       if (tmp_edge_flip)
-         {
-            if (tmp_edge_resist < 1)
-               tmp_edge_resist = 1;
-            Conf.desks.edge_flip_resistance = tmp_edge_resist;
-         }
-       else
-          Conf.desks.edge_flip_resistance = 0;
+       Conf.desks.edge_flip_mode = tmp_edge_flip;
+       if (tmp_edge_resist < 1)
+          tmp_edge_resist = 1;
+       Conf.desks.edge_flip_resistance = tmp_edge_resist;
        EdgeWindowsShow();
      }
    autosave();
@@ -2574,15 +2574,14 @@
 static void
 _DlgFillAreas(Dialog * d __UNUSED__, DItem * table, void *data __UNUSED__)
 {
-   DItem              *di, *slider, *slider2, *table2;
+   DItem              *di, *slider, *slider2, *table2, *radio;
    char                s[64];
 
    tmp_area_wraparound = Conf.desks.areas_wraparound;
+
+   tmp_edge_flip = Conf.desks.edge_flip_mode;
    tmp_edge_resist = Conf.desks.edge_flip_resistance;
-   if (tmp_edge_resist == 0)
-      tmp_edge_flip = 0;
-   else
-      tmp_edge_flip = 1;
+
    DesksGetAreaSize(&tmp_area_x, &tmp_area_y);
    tmp_area_y = 9 - tmp_area_y;
 
@@ -2633,9 +2632,27 @@
    DialogItemSetText(di, _("Wrap virtual desktops around"));
    DialogItemCheckButtonSetPtr(di, &tmp_area_wraparound);
 
-   di = DialogAddItem(table, DITEM_CHECKBUTTON);
-   DialogItemSetText(di, _("Enable edge flip"));
-   DialogItemCheckButtonSetPtr(di, &tmp_edge_flip);
+   di = DialogAddItem(table, DITEM_SEPARATOR);
+
+   di = DialogAddItem(table, DITEM_TEXT);
+   DialogItemSetAlign(di, 0, 512);
+   DialogItemSetText(di, _("Edge Flip Mode:"));
+
+   radio = di = DialogAddItem(table, DITEM_RADIOBUTTON);
+   DialogItemSetText(di, _("Off"));
+   DialogItemRadioButtonSetFirst(di, radio);
+   DialogItemRadioButtonGroupSetVal(di, EDGE_FLIP_OFF);
+
+   di = DialogAddItem(table, DITEM_RADIOBUTTON);
+   DialogItemSetText(di, _("On"));
+   DialogItemRadioButtonSetFirst(di, radio);
+   DialogItemRadioButtonGroupSetVal(di, EDGE_FLIP_ON);
+
+   di = DialogAddItem(table, DITEM_RADIOBUTTON);
+   DialogItemSetText(di, _("Only when moving window"));
+   DialogItemRadioButtonSetFirst(di, radio);
+   DialogItemRadioButtonGroupSetVal(di, EDGE_FLIP_MOVE);
+   DialogItemRadioButtonGroupSetValPtr(radio, &tmp_edge_flip);
 
    di = DialogAddItem(table, DITEM_TEXT);
    DialogItemSetText(di, _("Resistance at edge of screen:\n"));
@@ -2937,6 +2954,8 @@
    CFG_FUNC_INT(Conf.desks, areas_nx, 2, AreasCfgFuncSizeX),
    CFG_FUNC_INT(Conf.desks, areas_ny, 1, AreasCfgFuncSizeY),
    CFG_ITEM_BOOL(Conf.desks, areas_wraparound, 0),
+
+   CFG_ITEM_INT(Conf.desks, edge_flip_mode, EDGE_FLIP_ON),
    CFG_ITEM_INT(Conf.desks, edge_flip_resistance, 25),
 };
 #define N_CFG_ITEMS (sizeof(DesksCfgItems)/sizeof(CfgItem))
===================================================================
RCS file: /cvs/e/e16/e/src/edge.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- edge.c      13 Jan 2007 19:14:27 -0000      1.33
+++ edge.c      23 Mar 2007 22:04:38 -0000      1.34
@@ -41,7 +41,7 @@
 
    if (MenusActive())
       return;
-   if (!Conf.desks.edge_flip_resistance)
+   if (Conf.desks.edge_flip_mode == EDGE_FLIP_OFF)
       return;
 
    /* Quit if pointer has left screen */
@@ -110,12 +110,17 @@
 #if 0
    Eprintf("EdgeEvent %d -> %d\n", lastdir, dir);
 #endif
-   if (lastdir == dir || !Conf.desks.edge_flip_resistance)
+   if (lastdir == dir || Conf.desks.edge_flip_mode == EDGE_FLIP_OFF)
+      return;
+
+   if (Conf.desks.edge_flip_mode == EDGE_FLIP_MOVE && Mode.mode != MODE_MOVE)
       return;
 
    RemoveTimerEvent("EDGE_TIMEOUT");
    if (dir >= 0)
      {
+       if (Conf.desks.edge_flip_resistance <= 0)
+          Conf.desks.edge_flip_resistance = 1;
        DoIn("EDGE_TIMEOUT",
             ((double)Conf.desks.edge_flip_resistance) / 100.0, EdgeTimeout,
             dir, NULL);
@@ -181,7 +186,7 @@
 {
    int                 ax, ay, cx, cy;
 
-   if (Conf.desks.edge_flip_resistance <= 0)
+   if (Conf.desks.edge_flip_mode == EDGE_FLIP_OFF)
      {
        EdgeWindowsHide();
        return;



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to