Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h comms.c config.c globals.c ipc.c main.c misc.c session.c
setup.c
Log Message:
Shuffle around/clean up some master/slave state vars.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.238
retrieving revision 1.239
diff -u -3 -r1.238 -r1.239
--- E.h 4 Apr 2004 21:44:45 -0000 1.238
+++ E.h 7 Apr 2004 14:32:31 -0000 1.239
@@ -1244,6 +1244,17 @@
/* State parameters */
typedef struct
{
+ struct
+ {
+ int screens;
+ } display;
+ struct
+ {
+ char master; /* We are the master E */
+ char single; /* No slaves */
+ pid_t master_pid;
+ int master_screen;
+ } wm;
int debug;
int mode;
char place;
@@ -2749,10 +2760,6 @@
*/
extern const char e_wm_name[];
extern const char e_wm_version[];
-extern pid_t master_pid;
-extern int master_screen;
-extern int display_screens;
-extern int single_screen_mode;
extern Display *disp;
#if !USE_IMLIB2
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/comms.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- comms.c 1 Apr 2004 22:41:20 -0000 1.57
+++ comms.c 7 Apr 2004 14:32:33 -0000 1.58
@@ -156,10 +156,10 @@
{
EDBUG(5, "CommsSendToMasterWM");
- if (root.scr == master_screen || master_pid == getpid())
+ if (Mode.wm.master)
EDBUG_RETURN_;
- CommsDoSend(RootWindow(disp, master_screen), s);
+ CommsDoSend(RootWindow(disp, Mode.wm.master_screen), s);
EDBUG_RETURN_;
}
@@ -175,13 +175,12 @@
EDBUG(5, "CommsBroadcastToSlaveWMs");
- if (root.scr != master_screen || master_pid != getpid()
- || display_screens < 2 || single_screen_mode != 0)
+ if (!Mode.wm.master || Mode.wm.single)
EDBUG_RETURN_;
- for (screen = 0; screen < display_screens; screen++)
+ for (screen = 0; screen < Mode.display.screens; screen++)
{
- if (screen != master_screen)
+ if (screen != Mode.wm.master_screen)
CommsDoSend(RootWindow(disp, screen), s);
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -3 -r1.98 -r1.99
--- config.c 6 Apr 2004 23:20:44 -0000 1.98
+++ config.c 7 Apr 2004 14:32:33 -0000 1.99
@@ -4230,7 +4230,7 @@
"configuration and try again?\n"));
Conf.autosave = 0;
MapUnmap(1);
- if (getpid() == master_pid && init_win_ext)
+ if (Mode.wm.master && init_win_ext)
{
XKillClient(disp, init_win_ext);
init_win_ext = 0;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/globals.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- globals.c 21 Mar 2004 01:39:40 -0000 1.34
+++ globals.c 7 Apr 2004 14:32:34 -0000 1.35
@@ -29,10 +29,6 @@
#else
"enlightenment-" ENLIGHTENMENT_VERSION;
#endif
-pid_t master_pid;
-int master_screen;
-int display_screens;
-int single_screen_mode;
Display *disp;
#if !USE_IMLIB2
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -3 -r1.148 -r1.149
--- ipc.c 1 Apr 2004 22:41:21 -0000 1.148
+++ ipc.c 7 Apr 2004 14:32:34 -0000 1.149
@@ -4214,7 +4214,7 @@
c = NULL;
params = NULL;
- if (!(master_pid == getpid()))
+ if (Mode.wm.master)
return;
if (Conf.autosave)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/main.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -3 -r1.83 -r1.84
--- main.c 1 Apr 2004 22:48:32 -0000 1.83
+++ main.c 7 Apr 2004 14:32:35 -0000 1.84
@@ -67,7 +67,6 @@
Mode.mode = MODE_NONE;
Mode.startup = 1;
- single_screen_mode = 0;
/* unsetenv("LD_PRELOAD"); */
/* Initialise internationalisation */
@@ -126,7 +125,7 @@
}
else if (!strcmp("-single", argv[j]))
{
- single_screen_mode = 1;
+ Mode.wm.single = 1;
}
else if ((!strcmp("-smid", argv[j])) && (argc - j > 1))
{
@@ -223,7 +222,7 @@
/* run most of the setup */
AlertInit(); /* Set up all the text bits that belong on the
GSOD */
SignalsSetup();
- SetupX();
+ SetupX(); /* This is where the we fork per screen */
BlumFlimFrub();
ZoomInit();
SetupDirs();
@@ -280,12 +279,13 @@
EnableAllPagers();
queue_up = DRAW_QUEUE_ENABLE;
}
- if (getpid() == master_pid && init_win_ext)
+
+ /* Kill the E process owning the "init window" */
+ if (Mode.wm.master && init_win_ext)
{
XKillClient(disp, init_win_ext);
init_win_ext = 0;
}
- HintsSetClientList();
/* sync just to make sure */
XSync(disp, False);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/misc.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- misc.c 31 Mar 2004 19:06:57 -0000 1.51
+++ misc.c 7 Apr 2004 14:32:35 -0000 1.52
@@ -163,7 +163,7 @@
SignalsRestore();
- if (master_pid == getpid())
+ if (Mode.wm.master)
{
int i;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/session.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -3 -r1.63 -r1.64
--- session.c 1 Apr 2004 22:41:22 -0000 1.63
+++ session.c 7 Apr 2004 14:32:36 -0000 1.64
@@ -600,7 +600,7 @@
n = 0;
restartVal[n].length = strlen(command);
restartVal[n++].value = command;
- if (single_screen_mode)
+ if (Mode.wm.single)
{
restartVal[n].length = strlen(single);
restartVal[n++].value = (char *)single;
@@ -660,11 +660,9 @@
static void
callback_save_yourself2(SmcConn smc_conn, SmPointer client_data)
{
- char master_flag = (master_pid == getpid());
-
/* dont need anymore */
/* autosave(); */
- if (!master_flag)
+ if (!Mode.wm.master)
{
struct timeval tv1, tv2;
@@ -683,7 +681,7 @@
}
}
stale_sm_file = 1;
- set_save_props(smc_conn, master_flag);
+ set_save_props(smc_conn, Mode.wm.master);
SmcSaveYourselfDone(smc_conn, True);
if (restarting)
EExit(0);
@@ -694,7 +692,7 @@
callback_save_yourself(SmcConn smc_conn, SmPointer client_data, int save_style,
Bool shutdown, int interact_style, Bool fast)
{
- if (master_pid == getpid())
+ if (Mode.wm.master)
{
char s[4096];
@@ -732,7 +730,7 @@
static void
callback_die(SmcConn smc_conn, SmPointer client_data)
{
- if (master_pid == getpid())
+ if (Mode.wm.master)
SoundPlay("SOUND_EXIT");
EExit(0);
smc_conn = 0;
@@ -973,9 +971,8 @@
doSMExit(const void *params)
{
char s[1024];
- char master_flag, do_master_kill;
+ char do_master_kill;
- master_flag = (master_pid == getpid())? 1 : 0;
do_master_kill = 1;
restarting = True;
@@ -1127,9 +1124,7 @@
char *real_exec;
char sss[FILEPATH_LEN_MAX];
Window w;
- char master_flag, do_master_kill;
-
- master_flag = (master_pid == getpid())? 1 : 0;
+ char do_master_kill;
do_master_kill = 1;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -3 -r1.121 -r1.122
--- setup.c 1 Apr 2004 22:48:32 -0000 1.121
+++ setup.c 7 Apr 2004 14:32:36 -0000 1.122
@@ -107,14 +107,15 @@
}
void
-SetupX()
+SetupX(void)
{
/* This function sets up all of our connections to X */
EDBUG(6, "SetupX");
/* In case we are going to fork, set up the master pid */
- master_pid = getpid();
+ Mode.wm.master = 1;
+ Mode.wm.master_pid = getpid();
/* Open a connection to the diplay nominated by the DISPLAY variable */
if (!dstr)
@@ -137,11 +138,14 @@
"startx manual pages before proceeding.\n"));
EExit((void *)1);
}
+
root.scr = DefaultScreen(disp);
- display_screens = ScreenCount(disp);
- master_screen = root.scr;
+ Mode.display.screens = ScreenCount(disp);
+
+ Mode.wm.master_screen = root.scr;
+
/* Start up on multiple heads, if appropriate */
- if ((display_screens > 1) && (!single_screen_mode))
+ if ((Mode.display.screens > 1) && (!Mode.wm.single))
{
int i;
char subdisplay[255];
@@ -151,41 +155,43 @@
strcpy(subdisplay, DisplayString(disp));
- for (i = 0; i < display_screens; i++)
+ for (i = 0; i < Mode.display.screens; i++)
{
pid_t pid;
- if (i != root.scr)
+ if (i == root.scr)
+ continue;
+
+ pid = fork();
+ if (pid)
{
- pid = fork();
- if (pid)
- {
- child_count++;
- e_children =
- Erealloc(e_children, sizeof(pid_t) * child_count);
- e_children[child_count - 1] = pid;
- }
- else
- {
+ /* We are the master */
+ child_count++;
+ e_children =
+ Erealloc(e_children, sizeof(pid_t) * child_count);
+ e_children[child_count - 1] = pid;
+ }
+ else
+ {
+ /* We are a slave */
+ Mode.wm.master = 0;
+ root.scr = i;
#ifdef SIGSTOP
- kill(getpid(), SIGSTOP);
+ kill(getpid(), SIGSTOP);
#endif
- /* Find the point to concatenate the screen onto */
- dispstr = strchr(subdisplay, ':');
+ /* Find the point to concatenate the screen onto */
+ dispstr = strchr(subdisplay, ':');
+ if (NULL != dispstr)
+ {
+ dispstr = strchr(dispstr, '.');
if (NULL != dispstr)
- {
- dispstr = strchr(dispstr, '.');
- if (NULL != dispstr)
- *dispstr = '\0';
- }
- Esnprintf(subdisplay + strlen(subdisplay), 10, ".%d", i);
- dstr = Estrdup(subdisplay);
- disp = XOpenDisplay(dstr);
-
- root.scr = i;
- /* Terminate the loop as I am the child process... */
- break;
+ *dispstr = '\0';
}
+ Esnprintf(subdisplay + strlen(subdisplay), 10, ".%d", i);
+ dstr = Estrdup(subdisplay);
+ disp = XOpenDisplay(dstr);
+ /* Terminate the loop as I am the child process... */
+ break;
}
}
}
@@ -197,13 +203,17 @@
/* set up a handler for when the X Connection goes down */
XSetIOErrorHandler((XIOErrorHandler) HandleXIOError);
- /* initialise imlib */
-#if USE_IMLIB2
+ /* Root defaults */
+ root.scr = DefaultScreen(disp);
root.win = DefaultRootWindow(disp);
root.vis = DefaultVisual(disp, root.scr);
root.depth = DefaultDepth(disp, root.scr);
root.cmap = DefaultColormap(disp, root.scr);
+ root.w = DisplayWidth(disp, root.scr);
+ root.h = DisplayHeight(disp, root.scr);
+ /* initialise imlib */
+#if USE_IMLIB2
imlib_set_cache_size(2048 * 1024);
imlib_set_font_cache_size(512 * 1024);
imlib_set_color_usage(128);
@@ -256,8 +266,6 @@
prImlib_Context = NULL;
}
#endif
- root.w = DisplayWidth(disp, root.scr);
- root.h = DisplayHeight(disp, root.scr);
/* Initialise event handling */
EventsInit();
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs