[xorg-commit-diffs] xc/programs/Xserver/hw/xwin _usr_X11R6_lib_X11_system.XWinrc, 1.1.6.1, 1.1.6.2 win.h, 1.1.4.1.2.24, 1.1.4.1.2.25 windialogs.c, 1.1.6.8, 1.1.6.9 winprefs.h, 1.1.6.7, 1.1.6.8 winprefslex.l, 1.1.6.4, 1.1.6.5 winprefsyacc.y, 1.1.6.6, 1.1.6.7

Takuma Murakami xorg-commit at pdx.freedesktop.org
Mon Mar 29 01:59:38 PST 2004


Committed by: takuma


Index: _usr_X11R6_lib_X11_system.XWinrc
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc,v
retrieving revision 1.1.6.1
retrieving revision 1.1.6.2
diff -u -d -r1.1.6.1 -r1.1.6.2
--- a/_usr_X11R6_lib_X11_system.XWinrc	14 Mar 2004 02:36:11 -0000	1.1.6.1
+++ b/_usr_X11R6_lib_X11_system.XWinrc	29 Mar 2004 09:59:29 -0000	1.1.6.2
@@ -70,6 +70,8 @@
 # In the case where multiple matches occur, the first listed in the ICONS
 # section will be chosen.
 
+# To disable exit confirmation dialog add the line containing SilentExit
+
 # DEBUG <string> prints out the string to the XWin.log file
 
 // Below are just some silly menus to demonstrate writing your
@@ -117,5 +119,7 @@
 # 	"xterm"	"uninstall.ico"
 # }
 
+# SilentExit
+
 DEBUG "Done parsing the configuration file..."
 

Index: win.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/win.h,v
retrieving revision 1.1.4.1.2.24
retrieving revision 1.1.4.1.2.25
diff -u -d -r1.1.4.1.2.24 -r1.1.4.1.2.25
--- a/win.h	26 Mar 2004 03:21:41 -0000	1.1.4.1.2.24
+++ b/win.h	29 Mar 2004 09:59:29 -0000	1.1.4.1.2.25
@@ -434,6 +434,8 @@
 
   int			iDeltaZ;
 
+  int			iConnectedClients;
+
   CloseScreenProcPtr	CloseScreen;
 
   DWORD			dwRedMask;

Index: windialogs.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/windialogs.c,v
retrieving revision 1.1.6.8
retrieving revision 1.1.6.9
diff -u -d -r1.1.6.8 -r1.1.6.9
--- a/windialogs.c	28 Mar 2004 17:49:32 -0000	1.1.6.8
+++ b/windialogs.c	29 Mar 2004 09:59:29 -0000	1.1.6.9
@@ -32,6 +32,7 @@
 #include "win.h"
 #include <sys/cygwin.h>
 #include <shellapi.h>
+#include "winprefs.h"
 
 
 /*
@@ -42,6 +43,8 @@
 extern HWND			g_hDlgDepthChange;
 extern HWND			g_hDlgExit;
 extern HWND			g_hDlgAbout;
+extern WINPREFS			pref;
+extern Bool			g_fClipboardStarted;
 
 
 /*
@@ -203,6 +206,33 @@
 void
 winDisplayExitDialog (winPrivScreenPtr pScreenPriv)
 {
+  int i;
+  int liveClients = 0;
+
+  /* Count up running clinets (clients[0] is serverClient) */
+  for (i = 1; i < currentMaxClients; i++)
+    if (clients[i] != NullClient)	
+      liveClients++;
+  /* Count down server internal clients */
+  if (pScreenPriv->pScreenInfo->fMultiWindow)
+    liveClients -= 2; /* multiwindow window manager & XMsgProc  */
+  if (g_fClipboardStarted)
+    liveClients--; /* clipboard manager */
+
+  /* Don't show the exit confirmation dialog if SilentExit is enabled */
+  if (pref.fSilentExit && liveClients <= 0)
+    {
+      if (g_hDlgExit != NULL)
+	{
+	  DestroyWindow (g_hDlgExit);
+	  g_hDlgExit = NULL;
+	}
+      PostMessage (pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
+      return;
+    }
+
+  pScreenPriv->iConnectedClients = liveClients;
+  
   /* Check if dialog already exists */
   if (g_hDlgExit != NULL)
     {
@@ -254,8 +284,6 @@
 		WPARAM wParam, LPARAM lParam)
 {
   static winPrivScreenPtr	s_pScreenPriv = NULL;
-  static winScreenInfo		*s_pScreenInfo = NULL;
-  static ScreenPtr		s_pScreen = NULL;
 
   /* Branch on message type */
   switch (message)
@@ -264,12 +292,9 @@
       {
 	char			*pszConnectedClients;
 	int			iReturn;
-	int			iConnectedClients = 100;
 
 	/* Store pointers to private structures for future use */
 	s_pScreenPriv = (winPrivScreenPtr) lParam;
-	s_pScreenInfo = s_pScreenPriv->pScreenInfo;
-	s_pScreen = s_pScreenInfo->pScreen;
 	
 	winCenterDialog (hDialog);
 	
@@ -282,14 +307,14 @@
 
 	/* Format the connected clients string */
 	iReturn = sprintf (NULL, CONNECTED_CLIENTS_FORMAT,
-			   iConnectedClients);
+			   s_pScreenPriv->iConnectedClients);
 	if (iReturn <= 0)
 	  return TRUE;
 	pszConnectedClients = malloc (iReturn + 1);
 	if (!pszConnectedClients)
 	  return TRUE;
 	snprintf (pszConnectedClients, iReturn + 1, CONNECTED_CLIENTS_FORMAT,
-		  iConnectedClients);
+		  s_pScreenPriv->iConnectedClients);
 	
 	/* Set the number of connected clients */
 	SetWindowText (GetDlgItem (hDialog, IDC_CLIENTS_CONNECTED),

Index: winprefs.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winprefs.h,v
retrieving revision 1.1.6.7
retrieving revision 1.1.6.8
diff -u -d -r1.1.6.7 -r1.1.6.8
--- a/winprefs.h	17 Mar 2004 20:31:51 -0000	1.1.6.7
+++ b/winprefs.h	29 Mar 2004 09:59:29 -0000	1.1.6.8
@@ -33,6 +33,8 @@
 
 /* Need Bool */
 #include "Xdefs.h"
+/* Need TURE */
+#include "misc.h"
 
 /* Need to know how long paths can be... */
 #include <limits.h>
@@ -119,6 +121,9 @@
   ICONITEM *icon;
   int iconItems;
 
+  /* Silent exit flag */
+  Bool fSilentExit;
+
 } WINPREFS;
 
 

Index: winprefslex.l
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winprefslex.l,v
retrieving revision 1.1.6.4
retrieving revision 1.1.6.5
diff -u -d -r1.1.6.4 -r1.1.6.5
--- a/winprefslex.l	20 Mar 2004 07:25:47 -0000	1.1.6.4
+++ b/winprefslex.l	29 Mar 2004 09:59:29 -0000	1.1.6.5
@@ -81,6 +81,7 @@
 DEBUG                   { return DEBUG; }
 RELOAD                  { return RELOAD; }
 TRAYICON                { return TRAYICON; }
+SILENTEXIT		{ return SILENTEXIT; }
 "{"                     { return LB; }
 "}"                     { return RB; }
 "\""[^\"\r\n]+"\""      { yylval.sVal = makestr(yytext+1); \

Index: winprefsyacc.y
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winprefsyacc.y,v
retrieving revision 1.1.6.6
retrieving revision 1.1.6.7
diff -u -d -r1.1.6.6 -r1.1.6.7
--- a/winprefsyacc.y	19 Mar 2004 04:22:46 -0000	1.1.6.6
+++ b/winprefsyacc.y	29 Mar 2004 09:59:29 -0000	1.1.6.7
@@ -80,7 +80,7 @@
 
 %token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS DEFAULTSYSMENU
 %token SYSMENU ROOTMENU SEPARATOR ATSTART ATEND EXEC ALWAYSONTOP DEBUG
-%token RELOAD TRAYICON
+%token RELOAD TRAYICON SILENTEXIT
 
 %token <sVal> STRING
 %type <iVal>  atspot
@@ -109,6 +109,7 @@
 	| defaultsysmenu
 	| debug
 	| trayicon
+	| silentexit
 	;
 
 trayicon:	TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); }
@@ -165,6 +166,9 @@
 sysmenu:	SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();}
 	;
 
+silentexit:	SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; }
+	;
+
 debug: 	DEBUG STRING NEWLINE { ErrorF("LoadPreferences: %s\n", $2); free($2); }
 	;
 




More information about the xorg-commit-diffs mailing list