Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.2:Update
xtexit
xtexit.dif
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xtexit.dif of Package xtexit
--- README.SuSE +++ README.SuSE 2000/05/31 00:02:21 @@ -0,0 +1,52 @@ +README.SuSE for xtexit +kfr@suse.de 7.5.96 + + +I changed the original program as follow: + +- Use the 3D Athena widgets (-lXaw3d instead of -lXaw in Makefile) +- The program steps are: + 1. Send all applications the WM_DELETE_WINDOW event + 2. Pop up a dialog to ask the user to quit X-Window. + 3. If pressed ok, kill all applications. +- The command line options are ignored :-( + +The idea of this quick&dirty hack is, that the applications have a chance +to ask you somthing befor exit really. If you are in an editor you can +choose to save your work. If there is nothing to ask, the programms +quit immediatly. + + +Copyright Notices: +This work is based on the work from Teemu Torma, Front End Oy. +The original copyright is: + + Copyright 1990 Front End Oy + + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, provided + that the above copyright notice appear in all copies and that both that + copyright notice and this permission notice appear in supporting + documentation, and that the name of Front End not be used in advertising + or publicity pertaining to distribution of the software without specific, + written prior permission. Front End makes no representations about the + suitability of this software for any purpose. It is provided "as is" + without express or implied warranty. + + FRONT END DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + FRONT END. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER + IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + Author: Teemu Torma, Front End Oy + tot@frend.fi + + Ported to Athena Widgets by: Paul Raines + raines@slac.stanford.edu + +This work is copyrighted by Klaus Franken, <kfr@suse.de>, +S.u.S.E. Gmbh, Fuerth, Germany + +Please feel free to send bug reports, ideas and better versions. --- XTexit.ad +++ XTexit.ad 2000/05/31 00:02:21 @@ -11,10 +11,11 @@ ! We need to have some geometry here since top level shell has no kids ! to set it to some non-zero size. -XTexit.Geometry: 180x70 +XTexit.Geometry: 280x170 ! Misc resources. -*fontList: *-helvetica-bold-r-normal-*-*-140-* +*fontList: *-helvetica-bold-r-normal-*-*-160-* *foreground: Black -*confirmDialogShell.title: Confirm Dialog +*background: Red +*confirmDialogShell.title: Exit X-Window ? --- xtexit.c +++ xtexit.c 2000/05/31 00:02:21 @@ -54,7 +54,7 @@ { Nlevels, CLevels, XtRInt, sizeof (int), XtOffset (XTexit, levels), XtRImmediate, (caddr_t) 0 }, { Ntext, CText, XtRString, sizeof (char *), - XtOffset (XTexit, text), XtRString, (XtPointer) "Exit X-Windows?" }, + XtOffset (XTexit, text), XtRString, (XtPointer) "Exit X-Window?" }, }; /* Options for us. */ @@ -319,7 +319,7 @@ if (! XQueryTree (display, root, &dummy, &dummy, &kids, &num_kids)) return; - + /* Add kids with WM_STATE property to window list. They are potential X clients. If not possible X client, recurse tree below it. */ @@ -344,9 +344,10 @@ /* Kill all the clients from the X server. */ +/* kill -15 */ static void -KillClients (xtexit) +KillClients15 (xtexit) XTexit xtexit; { Display *display = xtexit->display; @@ -386,6 +387,51 @@ for (count = 0; count < xtexit->last_window; count ++) KillApplication (xtexit, xtexit->window_list[count], False); +} + + +/* Kill all the clients from the X server. */ +/* kill -9 */ + +static void +KillClients9 (xtexit) + XTexit xtexit; +{ + Display *display = xtexit->display; + int screen, count; + + + for (screen = 0; screen < ScreenCount (display); screen ++) + + /* Intern atoms we need. */ + + WmState = XInternAtom (display, "WM_STATE", False); + WmProtocols = XInternAtom (display, "WM_PROTOCOLS", False); + WmDeleteWindow = XInternAtom (display, "WM_DELETE_WINDOW", False); + + /* Initialize window list variables in the xtexit structure. */ + + xtexit->window_list = (Window *) 0; + xtexit->window_list_size = 0; + xtexit->last_window = 0; + + /* Ignore hangup signals. + If we are invoked under xterm or emacs, they will kill us when we kill + them. I wonder whether we should ignore also SIGTERM's.. */ + + signal (SIGHUP, SIG_IGN); + + /* Set our own error handler that ignores BadWindow errors. */ + + XSetErrorHandler (ErrorHandler); + + /* Read in top level windows in all screens. */ + + for (screen = 0; screen < ScreenCount (display); screen ++) + { + ReadWindows (xtexit, RootWindow (display, screen), 1, False); + } + /* Remove our windows from the display. Just for the visual effect. */ @@ -398,26 +444,22 @@ /* If we've got delay, wait that many seconds before doing force kill. This time, we read all the windows and do XKillClient(3X11) to them. */ - if (xtexit->delay > 0) - { - sleep (xtexit->delay); - - /* Remove all windows from the window list. */ + /* Remove all windows from the window list. */ - xtexit->last_window = 0; + xtexit->last_window = 0; - /* Read all windows into the memory and kill them. */ + /* Read all windows into the memory and kill them. */ - for (screen = 0; screen < ScreenCount (display); screen ++) - { - ReadWindows (xtexit, RootWindow (display, screen), 1, True); - } - for (count = 0; count < xtexit->last_window; count ++) - KillApplication (xtexit, xtexit->window_list[count], True); - XSync (display, False); - } + for (screen = 0; screen < ScreenCount (display); screen ++) + { + ReadWindows (xtexit, RootWindow (display, screen), 1, True); + } + printf("Anzahl clients: %d\n", xtexit->last_window); + for (count = 0; count < xtexit->last_window; count ++) + KillApplication (xtexit, xtexit->window_list[count], True); + XSync (display, False); } - + /* Confirm callback which never returns. This is called when use confirms killing all applications. */ @@ -429,7 +471,7 @@ { XTexit xtexit = (XTexit) closure; - KillClients (xtexit); + KillClients9 (xtexit); exit (0); } @@ -441,7 +483,7 @@ String *params; Cardinal *num_params; { - KillClients (p_xtexit); + KillClients9 (p_xtexit); exit (0); } @@ -489,6 +531,7 @@ XtTranslations mytranslations; int screen = XScreenNumberOfScreen (XtScreen (parent)); + num = 0; XtSetArg (args[num], XtNallowShellResize, True); num ++; shell = XtCreatePopupShell ("confirmDialogShell", transientShellWidgetClass, @@ -553,6 +596,7 @@ Widget top; XTexitRec xtexit; XtAppContext appcontext; + int num_clients; /* Initialize X toolkit and make top level shell. Move this widget to somewhere where it's not visible. */ @@ -578,17 +622,17 @@ xtexit.top = XtWindow (top); xtexit.dialog = 0; - /* If we need to be confirmed, pop up confirm shell. - Otherwise just kill the clients. */ + /* 1. send a "signal 15" to all clients */ + KillClients15 (&xtexit); - if (xtexit.confirm) - { - XtAppAddActions(appcontext, window_actions, XtNumber(window_actions)); - PopupConfirmDialog (top, &xtexit); - XtAppMainLoop (appcontext); - } - else - KillClients (&xtexit); + num_clients = 3; + if (num_clients < 3) + KillClients9(&xtexit); + + /* 3. Dialog-Popup and send a "signal 9" to all clients */ + XtAppAddActions(appcontext, window_actions, XtNumber(window_actions)); + PopupConfirmDialog (top, &xtexit); + XtAppMainLoop (appcontext); exit (0); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor