summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/add_window.c15
-rw-r--r--src/events.c2
-rw-r--r--src/list.c4
-rw-r--r--src/menus.c71
-rw-r--r--src/parse.c14
-rw-r--r--src/screen.h6
-rw-r--r--src/session.c4
-rw-r--r--src/system.twmrc3
-rw-r--r--src/twm.c66
-rw-r--r--src/twm.h4
10 files changed, 114 insertions, 75 deletions
diff --git a/src/add_window.c b/src/add_window.c
index 85dae57..9b6a6c7 100644
--- a/src/add_window.c
+++ b/src/add_window.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/twm/add_window.c,v 1.12 2002/12/10 22:28:07 tsi Exp $ */
+/* $XFree86: xc/programs/twm/add_window.c,v 1.13 2003/08/04 10:32:30 eich Exp $ */
/*****************************************************************************/
/*
@@ -209,6 +209,13 @@ IconMgr *iconp;
FetchWmProtocols (tmp_win);
FetchWmColormapWindows (tmp_win);
+ if (name == NULL)
+ tmp_win->name = strdup(NoName);
+ else {
+ tmp_win->name = strdup(name);
+ free(name);
+ }
+
if (GetWindowConfig (tmp_win,
&saved_x, &saved_y, &saved_width, &saved_height,
&restore_iconified, &restore_icon_info_present,
@@ -277,12 +284,6 @@ IconMgr *iconp;
tmp_win->transient = Transient(tmp_win->w, &tmp_win->transientfor);
tmp_win->nameChanged = 0;
- if (name == NULL)
- tmp_win->name = strdup(NoName);
- else {
- tmp_win->name = strdup(name);
- free(name);
- }
if (tmp_win->class.res_name == NULL)
tmp_win->class.res_name = NoName;
if (tmp_win->class.res_class == NULL)
diff --git a/src/events.c b/src/events.c
index 32378c9..d08dab1 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/twm/events.c,v 1.12 2001/12/14 20:01:06 dawes Exp $ */
+/* $XFree86: xc/programs/twm/events.c,v 1.13 2003/04/21 11:46:13 herrb Exp $ */
/*****************************************************************************/
/*
diff --git a/src/list.c b/src/list.c
index 4aabbad..b392a1b 100644
--- a/src/list.c
+++ b/src/list.c
@@ -48,7 +48,7 @@ in this Software without prior written authorization from The Open Group.
/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/
/** OR PERFORMANCE OF THIS SOFTWARE. **/
/*****************************************************************************/
-/* $XFree86: xc/programs/twm/list.c,v 1.8 2002/09/24 21:00:27 tsi Exp $ */
+/* $XFree86: xc/programs/twm/list.c,v 1.9 2003/04/21 11:46:13 herrb Exp $ */
/**********************************************************************
@@ -110,7 +110,7 @@ char *ptr;
twmrc_error_prefix();
fprintf (stderr, "unable to allocate %ld bytes for name_list\n",
(unsigned long)sizeof(name_list));
- Done(0);
+ Done(NULL, NULL);
}
nptr->next = *list_head;
diff --git a/src/menus.c b/src/menus.c
index 5284f25..0686226 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/twm/menus.c,v 1.16 2002/10/19 20:04:20 herrb Exp $ */
+/* $XFree86: xc/programs/twm/menus.c,v 1.20 2003/08/04 10:32:30 eich Exp $ */
/*****************************************************************************/
/*
@@ -863,7 +863,7 @@ MenuRoot *mr;
valuemask = (CWBackPixel | CWBorderPixel | CWEventMask);
attributes.background_pixel = Scr->MenuC.back;
- attributes.border_pixel = Scr->MenuC.fore;
+ attributes.border_pixel = Scr->MenuBorderColor;
attributes.event_mask = (ExposureMask | EnterWindowMask);
if (Scr->SaveUnder) {
valuemask |= CWSaveUnder;
@@ -874,7 +874,8 @@ MenuRoot *mr;
attributes.backing_store = Always;
}
mr->w = XCreateWindow (dpy, Scr->Root, 0, 0, (unsigned int) mr->width,
- (unsigned int) mr->height, (unsigned int) 1,
+ (unsigned int) mr->height,
+ (unsigned int) Scr->MenuBorderWidth,
CopyFromParent, (unsigned int) CopyFromParent,
(Visual *) CopyFromParent,
valuemask, &attributes);
@@ -1007,7 +1008,7 @@ PopUpMenu (menu, x, y, center)
int x, y;
Bool center;
{
- int WindowNameOffset, WindowNameCount;
+ int WindowNameCount;
TwmWindow **WindowNames;
TwmWindow *tmp_win2,*tmp_win3;
int i;
@@ -1033,37 +1034,38 @@ PopUpMenu (menu, x, y, center)
menu->mapped = NEVER_MAPPED;
AddToMenu(menu, "TWM Windows", NULLSTR, NULL, F_TITLE,NULLSTR,NULLSTR);
- WindowNameOffset=(char *)Scr->TwmRoot.next->name -
- (char *)Scr->TwmRoot.next;
for(tmp_win = Scr->TwmRoot.next , WindowNameCount=0;
tmp_win != NULL;
tmp_win = tmp_win->next)
WindowNameCount++;
- WindowNames =
- (TwmWindow **)malloc(sizeof(TwmWindow *)*WindowNameCount);
- WindowNames[0] = Scr->TwmRoot.next;
- for(tmp_win = Scr->TwmRoot.next->next , WindowNameCount=1;
- tmp_win != NULL;
- tmp_win = tmp_win->next,WindowNameCount++)
+ if (WindowNameCount != 0)
{
- tmp_win2 = tmp_win;
- for (i=0;i<WindowNameCount;i++)
+ WindowNames =
+ (TwmWindow **)malloc(sizeof(TwmWindow *)*WindowNameCount);
+ WindowNames[0] = Scr->TwmRoot.next;
+ for(tmp_win = Scr->TwmRoot.next->next , WindowNameCount=1;
+ tmp_win != NULL;
+ tmp_win = tmp_win->next,WindowNameCount++)
{
- if ((*compar)(tmp_win2->name,WindowNames[i]->name) < 0)
+ tmp_win2 = tmp_win;
+ for (i=0;i<WindowNameCount;i++)
{
- tmp_win3 = tmp_win2;
- tmp_win2 = WindowNames[i];
- WindowNames[i] = tmp_win3;
+ if ((*compar)(tmp_win2->name,WindowNames[i]->name) < 0)
+ {
+ tmp_win3 = tmp_win2;
+ tmp_win2 = WindowNames[i];
+ WindowNames[i] = tmp_win3;
+ }
}
+ WindowNames[WindowNameCount] = tmp_win2;
}
- WindowNames[WindowNameCount] = tmp_win2;
- }
- for (i=0; i<WindowNameCount; i++)
- {
- AddToMenu(menu, WindowNames[i]->name, (char *)WindowNames[i],
- NULL, F_POPUP,NULL,NULL);
+ for (i=0; i<WindowNameCount; i++)
+ {
+ AddToMenu(menu, WindowNames[i]->name, (char *)WindowNames[i],
+ NULL, F_POPUP,NULL,NULL);
+ }
+ free(WindowNames);
}
- free(WindowNames);
MakeMenu(menu);
}
@@ -1236,17 +1238,22 @@ resizeFromCenter(w, tmp_win)
Window w;
TwmWindow *tmp_win;
{
- int lastx, lasty, width, height, bw2;
- int namelen;
+ int lastx, lasty, bw2;
XEvent event;
+#if 0
+ int namelen;
+ int width, height;
namelen = strlen (tmp_win->name);
+#endif
bw2 = tmp_win->frame_bw * 2;
AddingW = tmp_win->attr.width + bw2;
AddingH = tmp_win->attr.height + tmp_win->title_height + bw2;
+#if 0
width = (SIZE_HINDENT + MyFont_TextWidth (&Scr->SizeFont,
tmp_win->name, namelen));
height = Scr->SizeFont.height + SIZE_VINDENT * 2;
+#endif
XGetGeometry(dpy, w, &JunkRoot, &origDragX, &origDragY,
(unsigned int *)&DragWidth, (unsigned int *)&DragHeight,
&JunkBW, &JunkDepth);
@@ -1255,7 +1262,7 @@ resizeFromCenter(w, tmp_win)
XQueryPointer (dpy, Scr->Root, &JunkRoot,
&JunkChild, &JunkX, &JunkY,
&AddingX, &AddingY, &JunkMask);
-/*****
+#if 0
Scr->SizeStringOffset = width +
MyFont_TextWidth(&Scr->SizeFont, ": ", 2);
XResizeWindow (dpy, Scr->SizeWindow, Scr->SizeStringOffset +
@@ -1263,16 +1270,16 @@ resizeFromCenter(w, tmp_win)
MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont, Scr->NormalGC,
width, SIZE_VINDENT + Scr->SizeFont.ascent,
": ", 2);
-*****/
+#endif
lastx = -10000;
lasty = -10000;
-/*****
+#if 0
MoveOutline(Scr->Root,
origDragX - JunkBW, origDragY - JunkBW,
DragWidth * JunkBW, DragHeight * JunkBW,
tmp_win->frame_bw,
tmp_win->title_height);
-*****/
+#endif
MenuStartResize(tmp_win, origDragX, origDragY, DragWidth, DragHeight);
while (TRUE)
{
@@ -2303,7 +2310,7 @@ ExecuteFunction(func, action, w, tmp_win, eventp, context, pulldown)
break;
case F_QUIT:
- Done(0);
+ Done(NULL, NULL);
break;
case F_PRIORITY:
diff --git a/src/parse.c b/src/parse.c
index c3ebc6e..500c38f 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/twm/parse.c,v 1.16 2002/12/10 22:29:55 tsi Exp $ */
+/* $XFree86: xc/programs/twm/parse.c,v 1.17 2003/08/04 10:32:30 eich Exp $ */
/*****************************************************************************/
/*
@@ -389,6 +389,7 @@ typedef struct _TwmKeyword {
#define kwn_IconBorderWidth 8
#define kwn_TitleButtonBorderWidth 9
#define kwn_Priority 10
+#define kwn_MenuBorderWidth 11
#define kwcl_BorderColor 1
#define kwcl_IconManagerHighlight 2
@@ -411,6 +412,7 @@ typedef struct _TwmKeyword {
#define kwc_MenuShadowColor 7
#define kwc_PointerForeground 8
#define kwc_PointerBackground 9
+#define kwc_MenuBorderColor 10
/*
@@ -547,6 +549,8 @@ static TwmKeyword keytable[] = {
{ "maxwindowsize", SKEYWORD, kws_MaxWindowSize },
{ "menu", MENU, 0 },
{ "menubackground", CKEYWORD, kwc_MenuBackground },
+ { "menubordercolor", CKEYWORD, kwc_MenuBorderColor },
+ { "menuborderwidth", NKEYWORD, kwn_MenuBorderWidth },
{ "menufont", SKEYWORD, kws_MenuFont },
{ "menuforeground", CKEYWORD, kwc_MenuForeground },
{ "menushadowcolor", CKEYWORD, kwc_MenuShadowColor },
@@ -865,6 +869,10 @@ int do_number_keyword (keyword, num)
if (Scr->FirstTime) Scr->IconBorderWidth = num;
return 1;
+ case kwn_MenuBorderWidth:
+ if (Scr->FirstTime) Scr->MenuBorderWidth = num;
+ return 1;
+
case kwn_TitleButtonBorderWidth:
if (Scr->FirstTime) Scr->TBInfo.border = num;
return 1;
@@ -952,6 +960,10 @@ int do_color_keyword (keyword, colormode, s)
GetColor (colormode, &Scr->MenuC.back, s);
return 1;
+ case kwc_MenuBorderColor:
+ GetColor (colormode, &Scr->MenuBorderColor, s);
+ return 1;
+
case kwc_MenuTitleForeground:
GetColor (colormode, &Scr->MenuTitleC.fore, s);
return 1;
diff --git a/src/screen.h b/src/screen.h
index b5f7eb7..8215bf1 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -32,7 +32,7 @@ in this Software without prior written authorization from The Open Group.
* 11-3-88 Dave Payne, Apple Computer File created
*
***********************************************************************/
-/* $XFree86: xc/programs/twm/screen.h,v 1.5 2001/12/14 20:01:10 dawes Exp $ */
+/* $XFree86: xc/programs/twm/screen.h,v 1.6 2003/08/04 10:32:30 eich Exp $ */
#ifndef _SCREEN_
#define _SCREEN_
@@ -137,6 +137,7 @@ typedef struct ScreenInfo
ColorPair DefaultC; /* default colors */
Pixel BorderColor; /* color of window borders */
Pixel MenuShadowColor; /* menu shadow color */
+ Pixel MenuBorderColor; /* menu border color */
Pixel IconBorderColor; /* icon border color */
Pixel IconManagerHighlight; /* icon manager highlight */
@@ -150,7 +151,7 @@ typedef struct ScreenInfo
Cursor WaitCursor; /* wait a while cursor */
Cursor MenuCursor; /* menu cursor */
Cursor SelectCursor; /* dot cursor for f.move, etc. from menus */
- Cursor DestroyCursor; /* skull and cross bones, f.destroy */
+ Cursor DestroyCursor; /* skull and cross bones, f.destroy */
name_list *BorderColorL;
name_list *IconBorderColorL;
@@ -202,6 +203,7 @@ typedef struct ScreenInfo
int SizeStringWidth; /* minimum width of size window */
int BorderWidth; /* border width of twm windows */
int IconBorderWidth; /* border width of icon windows */
+ int MenuBorderWidth; /* border width of twm menus */
int UnknownWidth; /* width of the unknown icon */
int UnknownHeight; /* height of the unknown icon */
int TitleHeight; /* height of the title bar window */
diff --git a/src/session.c b/src/session.c
index a4db1f6..df35afc 100644
--- a/src/session.c
+++ b/src/session.c
@@ -25,7 +25,7 @@ in this Software without prior written authorization from The Open Group.
Author: Ralph Mor, X Consortium
******************************************************************************/
-/* $XFree86: xc/programs/twm/session.c,v 3.8 2001/12/14 20:01:10 dawes Exp $ */
+/* $XFree86: xc/programs/twm/session.c,v 3.9 2003/04/21 11:46:13 herrb Exp $ */
#include <X11/Xos.h>
@@ -977,7 +977,7 @@ SmPointer clientData;
{
SmcCloseConnection (smcConn, 0, NULL);
XtRemoveInput (iceInputId);
- Done(0);
+ Done(NULL, NULL);
}
diff --git a/src/system.twmrc b/src/system.twmrc
index 437541d..4c6da60 100644
--- a/src/system.twmrc
+++ b/src/system.twmrc
@@ -9,7 +9,7 @@
# users were accustomed to uwm, the defaults could be set up not to decorate
# any windows and to use meta-keys.
#
-# $XFree86: xc/programs/twm/system.twmrc,v 1.4 2001/01/17 23:45:08 dawes Exp $
+# $XFree86: xc/programs/twm/system.twmrc,v 1.5 2003/08/04 10:32:30 eich Exp $
#
NoGrabServer
@@ -31,6 +31,7 @@ Color
TitleForeground "gray85"
MenuBackground "rgb:2/a/9"
MenuForeground "gray85"
+ MenuBorderColor "slategrey"
MenuTitleBackground "gray70"
MenuTitleForeground "rgb:2/a/9"
IconBackground "rgb:2/a/9"
diff --git a/src/twm.c b/src/twm.c
index aa65e19..7710f6a 100644
--- a/src/twm.c
+++ b/src/twm.c
@@ -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 */
@@ -104,6 +105,7 @@ 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 +237,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 +272,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 +681,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 +701,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 +832,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 +859,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
diff --git a/src/twm.h b/src/twm.h
index 516bb3b..56c7258 100644
--- a/src/twm.h
+++ b/src/twm.h
@@ -60,7 +60,7 @@ from The Open Group.
* 28-Oct-87 Thomas E. LaStrange File created
* 10-Oct-90 David M. Sternlicht Storeing saved colors on root
***********************************************************************/
-/* $XFree86: xc/programs/twm/twm.h,v 3.12 2001/12/14 20:01:10 dawes Exp $ */
+/* $XFree86: xc/programs/twm/twm.h,v 3.13 2003/04/21 11:46:14 herrb Exp $ */
#ifndef _TWM_
#define _TWM_
@@ -352,7 +352,7 @@ extern void InitVariables ( void );
extern void CreateFonts ( void );
extern void RestoreWithdrawnLocation ( TwmWindow *tmp );
extern void Reborder( Time time);
-extern SIGNAL_T Done( int sig );
+extern void Done( XtPointer, XtSignalId * );
extern void ComputeCommonTitleOffsets ( void );
extern void ComputeTitleLocation ( TwmWindow *tmp );
extern void ComputeWindowTitleOffsets ( TwmWindow *tmp_win, int width, Bool squeeze );