Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h actions.c borders.c handlers.c icccm.c iconify.c main.c 
        session.c setup.c snaps.c 


Log Message:
Clear blocked signals at startup and exit.
Set EDBUG_COREDUMP to get core dump in stead of GSOD.

===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.261
retrieving revision 1.262
diff -u -3 -r1.261 -r1.262
--- E.h 5 May 2004 00:17:12 -0000       1.261
+++ E.h 7 May 2004 15:18:04 -0000       1.262
@@ -1261,13 +1261,16 @@
       char                single;      /* No slaves */
       pid_t               master_pid;
       int                 master_screen;
+      char                startup;
+      char                xselect;
+      char                exiting;
+      char                save_ok;
+      char                coredump;
    } wm;
    int                 debug;
    int                 mode;
    char                place;
    char                flipp;
-   char                startup;
-   char                xselect;
    int                 next_move_x_plus, next_move_y_plus;
    Button             *button;
    int                 resize_detail;
@@ -1307,7 +1310,6 @@
    int                 last_button;
    Time                last_time;
    char                queue_up;
-   char                save_ok;
 }
 EMode;
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/actions.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -3 -r1.157 -r1.158
--- actions.c   4 May 2004 19:04:20 -0000       1.157
+++ actions.c   7 May 2004 15:18:05 -0000       1.158
@@ -689,7 +689,7 @@
             exit(0);
          }
 
-       if (!Mode.startup)
+       if (!Mode.wm.startup)
          {
             path = pathtofile(exe);
             if (!path)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -3 -r1.174 -r1.175
--- borders.c   4 May 2004 19:04:22 -0000       1.174
+++ borders.c   7 May 2004 15:18:06 -0000       1.175
@@ -441,7 +441,7 @@
      }
 
    if ((!ewin->client.transient) && (Conf.manual_placement)
-       && (!ewin->client.already_placed) && (!Mode.startup) && (!Mode.place))
+       && (!ewin->client.already_placed) && (!Mode.wm.startup) && (!Mode.place))
      {
        cangrab = GrabThePointer(VRoot.win);
        if ((cangrab == GrabNotViewable) || (cangrab == AlreadyGrabbed)
@@ -1132,7 +1132,8 @@
    SessionGetInfo(ewin, 0);
    MatchEwinToSM(ewin);
    MatchEwinToSnapInfo(ewin);
-   ICCCM_GetEInfo(ewin);
+   if (Mode.wm.startup)
+      ICCCM_GetEInfo(ewin);
 
    if (!ewin->border)
       EwinSetBorderInit(ewin);
@@ -1226,7 +1227,7 @@
    ewin = Emalloc(sizeof(EWin));
    memset(ewin, 0, sizeof(EWin));
 
-   ewin->state = (Mode.startup) ? EWIN_STATE_STARTUP : EWIN_STATE_NEW;
+   ewin->state = (Mode.wm.startup) ? EWIN_STATE_STARTUP : EWIN_STATE_NEW;
    ewin->x = -1;
    ewin->y = -1;
    ewin->w = -1;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/handlers.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- handlers.c  25 Apr 2004 18:48:30 -0000      1.38
+++ handlers.c  7 May 2004 15:18:06 -0000       1.39
@@ -121,27 +121,53 @@
    EDBUG_RETURN_;
 }
 
-void
-SignalsSetup(void)
+static void
+doSignalsSetup(int setup)
 {
-   /* This function will set up all the signal handlers for E */
-
    static const int    signals[] = {
       SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGPIPE,
       SIGALRM, SIGTERM, SIGUSR1, SIGUSR2, SIGCHLD, SIGBUS
    };
-   unsigned int        i;
+   unsigned int        i, sig;
    struct sigaction    sa;
 
-   EDBUG(6, "SignalsSetup");
+   /*
+    * We may be here after a fork/exec within in a signal handler.
+    * Therefore, lets just clear the blocked signals.
+    */
+   sigemptyset(&sa.sa_mask);
+   sigprocmask(SIG_SETMASK, &sa.sa_mask, (sigset_t *) NULL);
 
    for (i = 0; i < sizeof(signals) / sizeof(int); i++)
      {
-       sa.sa_handler = SignalHandler;
-       sa.sa_flags = (signals[i] == SIGCHLD) ? SA_RESTART : 0;
+       sig = signals[i];
+       if (Mode.wm.coredump &&
+           (sig == SIGILL || sig == SIGFPE || sig == SIGSEGV || sig == SIGBUS))
+          continue;
+
+       if (setup)
+         {
+            sa.sa_handler = SignalHandler;
+            sa.sa_flags = (sig == SIGCHLD) ? SA_RESTART : 0;
+         }
+       else
+         {
+            sa.sa_handler = SIG_DFL;
+            sa.sa_flags = 0;
+         }
        sigemptyset(&sa.sa_mask);
-       sigaction(signals[i], &sa, (struct sigaction *)0);
+       sigaction(sig, &sa, (struct sigaction *)0);
      }
+}
+
+void
+SignalsSetup(void)
+{
+   /* This function will set up all the signal handlers for E */
+
+   EDBUG(6, "SignalsSetup");
+
+   doSignalsSetup(1);
 
    EDBUG_RETURN_;
 }
@@ -153,6 +179,7 @@
 
    EDBUG(6, "SignalsRestore");
 
+#if 0
    signal(SIGHUP, SIG_DFL);
    signal(SIGINT, SIG_DFL);
    signal(SIGQUIT, SIG_DFL);
@@ -170,6 +197,9 @@
    signal(SIGTSTP, SIG_DFL);
 #endif
    signal(SIGBUS, SIG_IGN);
+#else
+   doSignalsSetup(0);
+#endif
 
    EDBUG_RETURN_;
 }
@@ -183,7 +213,7 @@
    if ((ev->request_code == X_ChangeWindowAttributes)
        && (ev->error_code == BadAccess))
      {
-       if ((!no_overwrite) && (Mode.xselect))
+       if ((!no_overwrite) && (Mode.wm.xselect))
          {
             AlertX(_("Another Window Manager is already running"),
                    _("OK (edit file)"), "", _("Cancel (do NOT edit)"),
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -3 -r1.61 -r1.62
--- icccm.c     4 May 2004 19:04:29 -0000       1.61
+++ icccm.c     7 May 2004 15:18:06 -0000       1.62
@@ -1173,39 +1173,35 @@
    num = (int)lnum;
    if ((num >= 8) && (c))
      {
-       if (Mode.startup)
+       ewin->desktop = c[0];
+       ewin->sticky = c[1];
+       ewin->client.x = c[2];
+       ewin->client.y = c[3];
+       ewin->iconified = c[4];
+       ewin->shaded = c[5];
+       if (ewin->sticky)
+          ewin->desktop = -1;
+       if (ewin->iconified)
          {
-            ewin->desktop = c[0];
-            ewin->sticky = c[1];
-            ewin->client.x = c[2];
-            ewin->client.y = c[3];
-            ewin->iconified = c[4];
-            ewin->shaded = c[5];
-            if (ewin->sticky)
-               ewin->desktop = -1;
-            if (ewin->iconified)
-              {
-                 ewin->client.start_iconified = 1;
-                 ewin->iconified = 0;
-              }
-            ewin->client.already_placed = 1;
-            if (num >= 9)
-              {
-                 ewin->client.w = c[6];
-                 ewin->client.h = c[7];
-              }
-            XFree(c);
-
-            puc = NULL;
-            XGetWindowProperty(disp, ewin->client.win, aa, 0, 0xffff, True,
-                               XA_STRING, &a2, &dummy, &lnum, &ldummy, &puc);
-            str = (char *)puc;
-            num = (int)lnum;
-            if ((num > 0) && (str))
-               EwinSetBorderByName(ewin, str, 0);
-            XFree(str);
+            ewin->client.start_iconified = 1;
+            ewin->iconified = 0;
+         }
+       ewin->client.already_placed = 1;
+       if (num >= 9)
+         {
+            ewin->client.w = c[6];
+            ewin->client.h = c[7];
          }
-       EDBUG_RETURN(1);
+       XFree(c);
+
+       puc = NULL;
+       XGetWindowProperty(disp, ewin->client.win, aa, 0, 0xffff, True,
+                          XA_STRING, &a2, &dummy, &lnum, &ldummy, &puc);
+       str = (char *)puc;
+       num = (int)lnum;
+       if ((num > 0) && (str))
+          EwinSetBorderByName(ewin, str, 0);
+       XFree(str);
      }
    EDBUG_RETURN(0);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -3 -r1.106 -r1.107
--- iconify.c   4 May 2004 19:04:30 -0000       1.106
+++ iconify.c   7 May 2004 15:18:06 -0000       1.107
@@ -40,8 +40,9 @@
    GC                  gc;
    XGCValues           gcv;
 
-   if (Mode.startup)
+   if (Mode.wm.startup)
       return;
+
    GrabX();
    spd = 0.00001;
    gcv.subwindow_mode = IncludeInferiors;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/main.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -3 -r1.90 -r1.91
--- main.c      4 May 2004 19:04:32 -0000       1.90
+++ main.c      7 May 2004 15:18:07 -0000       1.91
@@ -64,7 +64,7 @@
    /* Init state variable struct */
    memset(&Mode, 0, sizeof(EMode));
    Mode.mode = MODE_NONE;
-   Mode.startup = 1;
+   Mode.wm.startup = 1;
 
 /*  unsetenv("LD_PRELOAD"); */
 
@@ -77,6 +77,9 @@
    str = getenv("EDBUG_FLAGS");
    if (str)
       EventDebugInit(str);
+   str = getenv("EDBUG_COREDUMP");
+   if (str)
+      Mode.wm.coredump = 1;
 
    EDBUG(1, "main");
 
@@ -313,8 +316,8 @@
        ec->inroot = 1;
      }
 
-   Mode.startup = 0;
-   Mode.save_ok = Mode.wm.master;
+   Mode.wm.startup = 0;
+   Mode.wm.save_ok = Mode.wm.master;
    /* ok - paranoia - save current settings to disk */
    if (VRoot.scr == 0)
       autosave();
@@ -368,9 +371,9 @@
    if (Mode.firsttime)
       runDocBrowser();
 
-   Mode.startup = 1;
+   Mode.wm.startup = 1;
    SpawnSnappedCmds();
-   Mode.startup = 0;
+   Mode.wm.startup = 0;
 
    ThemeBadDialog();
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/session.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -3 -r1.67 -r1.68
--- session.c   4 May 2004 19:04:34 -0000       1.67
+++ session.c   7 May 2004 15:18:07 -0000       1.68
@@ -212,7 +212,7 @@
    FILE               *f;
    char                s[4096], ss[4096];
 
-   if (!Mode.save_ok)
+   if (!Mode.wm.save_ok)
       return;
 
    Etmp(s);
@@ -426,7 +426,7 @@
 void
 autosave(void)
 {
-   if (!Mode.save_ok)
+   if (!Mode.wm.save_ok)
       return;
 
    if (Conf.autosave)
@@ -919,9 +919,8 @@
 #endif /* HAVE_X11_SM_SMLIB_H */
 }
 
-static void         doSMExit(const void *params);
 static void
-LogoutCB(int val, void *data)
+LogoutCB(int val __UNUSED__, void *data __UNUSED__)
 {
 #ifdef HAVE_X11_SM_SMLIB_H
    if (sm_conn)
@@ -932,11 +931,8 @@
    else
 #endif /* HAVE_X11_SM_SMLIB_H */
      {
-       doSMExit(NULL);
+       SessionExit(NULL);
      }
-   return;
-   val = 0;
-   data = NULL;
 }
 
 void
@@ -988,6 +984,10 @@
       SaveSession(1);
    if ((disp) && ((!params) || ((params) && strcmp((char *)params, "logout"))))
       SetEInfoOnAll();
+
+   if (disp)
+      XSelectInput(disp, VRoot.win, 0);
+
    if ((!params) || (!strcmp((char *)s, "exit")))
      {
        callback_die(sm_conn, NULL);
@@ -1231,6 +1231,13 @@
 int
 SessionExit(const void *param)
 {
+   if (Mode.wm.exiting++)
+     {
+       /* This may be possible during nested signal handling */
+       Eprintf("SessionExit already in progress ... now exiting\n");
+       exit(1);
+     }
+
    doSMExit(param);
    return 0;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -3 -r1.125 -r1.126
--- setup.c     4 May 2004 19:04:40 -0000       1.125
+++ setup.c     7 May 2004 15:18:07 -0000       1.126
@@ -278,7 +278,7 @@
    XSetIOErrorHandler((XIOErrorHandler) HandleXIOError);
 
    /* select all the root window events to start managing */
-   Mode.xselect = 1;
+   Mode.wm.xselect = 1;
    XSelectInput(disp, VRoot.win,
                ButtonPressMask | ButtonReleaseMask | EnterWindowMask |
                LeaveWindowMask | ButtonMotionMask | PropertyChangeMask |
@@ -286,7 +286,7 @@
                PointerMotionMask | ResizeRedirectMask |
                SubstructureNotifyMask);
    XSync(disp, False);
-   Mode.xselect = 0;
+   Mode.wm.xselect = 0;
 
    /* warn, if necessary about X version problems */
    if (ProtocolVersion(disp) != 11)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/snaps.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -3 -r1.67 -r1.68
--- snaps.c     4 May 2004 19:04:41 -0000       1.67
+++ snaps.c     7 May 2004 15:18:07 -0000       1.68
@@ -871,7 +871,7 @@
    char                buf[4096], s[4096];
    FILE               *f;
 
-   if (!Mode.save_ok)
+   if (!Mode.wm.save_ok)
       return;
 
    Etmp(s);




-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to