Hi,

Here is a small patch, against current cvs (root e16/e dir, not in src)
that adds an option to have desktop wraparound, as well as config
dialogs and config saving.

Alan Schmitt

-- 
The hacker: someone who figured things out and made something cool happen.
Index: src/E.h
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.141
diff -u -p -r1.141 E.h
--- src/E.h     5 Nov 2003 17:24:41 -0000       1.141
+++ src/E.h     8 Nov 2003 18:36:29 -0000
@@ -1303,6 +1303,7 @@ typedef struct _emode
    int                 pager_menu_button;
    char                area_wraparound;
    char                dialog_headers;
+   char                desktop_wraparound;
 }
 EMode;
 
Index: src/actions.c
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/actions.c,v
retrieving revision 1.110
diff -u -p -r1.110 actions.c
--- src/actions.c       5 Nov 2003 17:24:41 -0000       1.110
+++ src/actions.c       8 Nov 2003 18:36:32 -0000
@@ -1620,12 +1620,18 @@ int
 doNextDesktop(void *params)
 {
    int                 pd;
+   int                 nd;
 
    EDBUG(6, "doNextDesktop");
    if (InZoom())
       EDBUG_RETURN(0);
    pd = desks.current;
-   GotoDesktop(desks.current + 1);
+   nd = desks.current + 1;
+   if (mode.desktop_wraparound && (nd >= mode.numdesktops))
+     {
+       nd = 0;
+     }
+   GotoDesktop(nd);
    if (desks.current != pd)
      {
        AUDIO_PLAY("SOUND_DESKTOP_SHUT");
@@ -1638,12 +1644,18 @@ int
 doPrevDesktop(void *params)
 {
    int                 pd;
+   int                 nd;
 
    EDBUG(6, "doPrevDesktop");
    if (InZoom())
       EDBUG_RETURN(0);
    pd = desks.current;
-   GotoDesktop(desks.current - 1);
+   nd = desks.current - 1;
+   if (mode.desktop_wraparound && (nd < 0)) 
+     {
+       nd = mode.numdesktops - 1;
+     }
+   GotoDesktop(nd);
    if (desks.current != pd)
      {
        AUDIO_PLAY("SOUND_DESKTOP_SHUT");
Index: src/conf.h
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/conf.h,v
retrieving revision 1.27
diff -u -p -r1.27 conf.h
--- src/conf.h  5 Nov 2003 17:24:42 -0000       1.27
+++ src/conf.h  8 Nov 2003 18:36:32 -0000
@@ -111,6 +111,7 @@
 #define CONTROL_MENUONSCREEN 351
 #define CONTROL_AREA_WRAPAROUND 352
 #define CONTROL_DIALOG_HEADERS 353
+#define CONTROL_DESKTOP_WRAPAROUND 354
 #define CONTROL_MANUAL_PLACEMENT_MOUSE_POINTER 3360
 #define CONTROL_WARPMENUS 666
 #define CONTROL_USER_BG 1350
Index: src/config.c
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v
retrieving revision 1.68
diff -u -p -r1.68 config.c
--- src/config.c        5 Nov 2003 17:24:42 -0000       1.68
+++ src/config.c        8 Nov 2003 18:36:35 -0000
@@ -769,6 +769,9 @@ Config_Control(FILE * ConfigFile)
          case CONTROL_DIALOG_HEADERS:
             mode.dialog_headers = i2;
             break;
+          case CONTROL_DESKTOP_WRAPAROUND:
+             mode.desktop_wraparound = i2;
+             break;
          case CONTROL_SLIDESPEEDMAP:
             mode.slidespeedmap = i2;
             break;
@@ -3874,6 +3877,7 @@ SaveUserControlConfig(FILE * autosavefil
        fprintf(autosavefile, "351 %i\n", (int)mode.menusonscreen);
        fprintf(autosavefile, "352 %i\n", (int)mode.area_wraparound);
        fprintf(autosavefile, "353 %i\n", (int)mode.dialog_headers);
+       fprintf(autosavefile, "354 %i\n", (int)mode.desktop_wraparound);
        fprintf(autosavefile, "666 %i\n", (int)mode.warpmenus);
        fprintf(autosavefile, "667 %i\n", (int)mode.warpsticky);
        fprintf(autosavefile, "668 %i\n", (int)mode.warpshaded);
Index: src/settings.c
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/settings.c,v
retrieving revision 1.75
diff -u -p -r1.75 settings.c
--- src/settings.c      5 Nov 2003 17:24:46 -0000       1.75
+++ src/settings.c      8 Nov 2003 18:36:39 -0000
@@ -1011,6 +1011,7 @@ SettingsMoveResize(void)
 static int          tmp_desktops;
 static DItem       *tmp_desk_text;
 static Dialog      *tmp_desk_dialog;
+static char         tmp_desktop_wraparound;
 
 static void         CB_ConfigureDesktops(int val, void *data);
 static void
@@ -1019,6 +1020,7 @@ CB_ConfigureDesktops(int val, void *data
    if (val < 2)
      {
        ChangeNumberOfDesktops(tmp_desktops);
+       mode.desktop_wraparound = tmp_desktop_wraparound;
      }
    autosave();
    data = NULL;
@@ -1113,6 +1115,7 @@ SettingsDesktops(void)
    AUDIO_PLAY("SOUND_SETTINGS_DESKTOPS");
 
    tmp_desktops = mode.numdesktops;
+   tmp_desktop_wraparound = mode.desktop_wraparound;
 
    d = tmp_desk_dialog = CreateDialog("CONFIGURE_DESKTOPS");
    DialogSetTitle(d, _("Multiple Desktop Settings"));
@@ -1172,6 +1175,20 @@ SettingsDesktops(void)
    DialogItemSetColSpan(di, 2);
    DialogItemSetPadding(di, 2, 2, 2, 2);
    DialogItemAreaSetSize(di, 128, 96);
+
+   di = DialogAddItem(table, DITEM_SEPARATOR);
+   DialogItemSetColSpan(di, 2);
+   DialogItemSetPadding(di, 2, 2, 2, 2);
+   DialogItemSetFill(di, 1, 0);
+   DialogItemSeparatorSetOrientation(di, 0);
+
+   di = DialogAddItem(table, DITEM_CHECKBUTTON);
+   DialogItemSetPadding(di, 2, 2, 2, 2);
+   DialogItemSetFill(di, 1, 0);
+   DialogItemSetColSpan(di, 2);
+   DialogItemCheckButtonSetText(di, _("Wrap desktops around"));
+   DialogItemCheckButtonSetState(di, tmp_desktop_wraparound);
+   DialogItemCheckButtonSetPtr(di, &tmp_desktop_wraparound);
 
    di = DialogAddItem(table, DITEM_SEPARATOR);
    DialogItemSetColSpan(di, 2);

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to