diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-25 19:29:03 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-25 19:29:03 +0000 |
commit | e51f25fbe75b222b24f4628b2408e899fa4748d7 (patch) | |
tree | f99bc828d623da962d7857db2c5edbce6ced3de8 /src/twm.c | |
parent | 4b339f0a4311b4db171584bc6671292a9052665a (diff) |
XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_903_specialxf86-4_3_99_902xf86-4_3_99_901xf86-4_3_99_16xf86-012804-2330
Diffstat (limited to 'src/twm.c')
-rw-r--r-- | src/twm.c | 67 |
1 files changed, 41 insertions, 26 deletions
@@ -59,7 +59,7 @@ in this Software without prior written authorization from The Open Group. * 27-Oct-87 Thomas E. LaStrange File created * 10-Oct-90 David M. Sternlicht Storing saved colors on root ***********************************************************************/ -/* $XFree86: xc/programs/twm/twm.c,v 3.12 2001/12/14 20:01:10 dawes Exp $ */ +/* $XFree86: xc/programs/twm/twm.c,v 3.15 2003/08/04 10:32:30 eich Exp $ */ #include <stdio.h> #include <signal.h> @@ -85,6 +85,7 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xlocale.h> XtAppContext appContext; /* Xt application context */ +XtSignalId si; Display *dpy = NULL; /* which display are we talking to */ Window ResizeWindow; /* the window we are resizing */ @@ -99,11 +100,11 @@ ScreenInfo **ScreenList; /* structures for each screen */ ScreenInfo *Scr = NULL; /* the cur and prev screens */ int PreviousScreen; /* last screen that we were on */ int FirstScreen; /* TRUE ==> first screen of display */ -volatile Bool TimeToYield = FALSE; /* TRUE ==> exit requested */ Bool PrintErrorMessages = False; /* controls error messages */ static int RedirectError; /* TRUE ==> another window manager running */ static int TwmErrorHandler ( Display *dpy, XErrorEvent *event ); /* for settting RedirectError */ static int CatchRedirectError ( Display *dpy, XErrorEvent *event ); /* for everything else */ +static SIGNAL_T sigHandler(int); char Info[INFO_LINES][INFO_SIZE]; /* info strings to print */ int InfoLines; char *InitFile = NULL; @@ -235,8 +236,9 @@ main(int argc, char *argv[]) } #define newhandler(sig) \ - if (signal (sig, SIG_IGN) != SIG_IGN) (void) signal (sig, Done) + if (signal (sig, SIG_IGN) != SIG_IGN) (void) signal (sig, sigHandler) + newhandler (SIGINT); newhandler (SIGHUP); newhandler (SIGQUIT); @@ -269,6 +271,8 @@ main(int argc, char *argv[]) XtToolkitInitialize (); appContext = XtCreateApplicationContext (); + si = XtAppAddSignal(appContext, Done, NULL); + if (!(dpy = XtOpenDisplay (appContext, display_name, "twm", "twm", NULL, 0, &zero, NULL))) { fprintf (stderr, "%s: unable to open display \"%s\"\n", @@ -676,6 +680,7 @@ InitVariables() Scr->MenuTitleC.fore = black; Scr->MenuTitleC.back = white; Scr->MenuShadowColor = black; + Scr->MenuBorderColor = black; Scr->IconC.fore = black; Scr->IconC.back = white; Scr->IconBorderColor = black; @@ -695,6 +700,7 @@ InitVariables() Scr->SizeStringOffset = 0; Scr->BorderWidth = BW; Scr->IconBorderWidth = BW; + Scr->MenuBorderWidth = BW; Scr->UnknownWidth = 0; Scr->UnknownHeight = 0; Scr->NumAutoRaises = 0; @@ -825,26 +831,6 @@ RestoreWithdrawnLocation (tmp) } -/*********************************************************************** - * - * Procedure: - * Done - cleanup and exit twm - * - * Returned Value: - * none - * - * Inputs: - * none - * - * Outputs: - * none - * - * Special Considerations: - * none - * - *********************************************************************** - */ - void Reborder (time) Time time; @@ -872,13 +858,42 @@ Time time; SetFocus ((TwmWindow*)NULL, time); } -SIGNAL_T -Done(int sig) +static SIGNAL_T +sigHandler(int sig) { - TimeToYield = True; + XtNoticeSignal(si); SIGNAL_RETURN; } +/*********************************************************************** + * + * Procedure: + * Done - cleanup and exit twm + * + * Returned Value: + * none + * + * Inputs: + * none + * + * Outputs: + * none + * + * Special Considerations: + * none + * + *********************************************************************** + */ +void +Done(XtPointer client_data, XtSignalId *si) +{ + if (dpy) + { + Reborder(CurrentTime); + XCloseDisplay(dpy); + } + exit(0); +} /* * Error Handlers. If a client dies, we'll get a BadWindow error (except for |