annotate src/EmacsFrame.c @ 772:d682c0f82a71

[xemacs-hg @ 2002-03-13 10:00:06 by ben] a few bytecomp warning fixes, run autoconf just in case
author ben
date Wed, 13 Mar 2002 10:00:09 +0000
parents 943eaba38521
children e38acbeb1cae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* The emacs frame widget.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1993-1995 Sun Microsystems, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 Copyright (C) 1995 Ben Wing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 /* #### Note to potential hackers: Don't mess with this unless you're
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 sure you know what you're doing! Xt is a lot more subtle than
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 you may think. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include "console-x.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include "glyphs-x.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "objects-x.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include <X11/Shell.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "EmacsFrameP.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include "EmacsManager.h" /* for EmacsManagerChangeSize */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #include "xmu.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "faces.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #include "frame.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 #include "toolbar.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #include "window.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 static void EmacsFrameClassInitialize (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 static void EmacsFrameInitialize (Widget, Widget, ArgList, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 static void EmacsFrameRealize (Widget, XtValueMask*, XSetWindowAttributes*);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 static void EmacsFrameResize (Widget widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 static Boolean EmacsFrameSetValues (Widget, Widget, Widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 ArgList, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 static XtGeometryResult EmacsFrameQueryGeometry (Widget, XtWidgetGeometry*,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 XtWidgetGeometry*);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 extern void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 emacs_Xt_mapping_action (Widget w, XEvent* event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 #undef XtOffset
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 #define XtOffset(p_type,field) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 ((Cardinal) (((char *) (&(((p_type)0)->field))) - ((char *)0)))
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
60 #define offset(field) XtOffset (EmacsFrame, emacs_frame.field)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 static XtResource resources[] = {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
63 { XtNgeometry, XtCGeometry,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
64 XtRString, sizeof (String),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
65 offset (geometry), XtRString, (XtPointer) 0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
66 { XtNiconic, XtCIconic,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
67 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
68 offset (iconic), XtRImmediate, (XtPointer) False },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
70 { XtNemacsFrame, XtCEmacsFrame,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
71 XtRPointer, sizeof (XtPointer),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
72 offset (frame), XtRImmediate, 0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
73 { XtNmenubar, XtCMenubar,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
74 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
75 offset (menubar_p), XtRImmediate, (XtPointer) True },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
76 { XtNinitiallyUnmapped, XtCInitiallyUnmapped,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
77 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
78 offset (initially_unmapped), XtRImmediate, (XtPointer) False },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
79 { XtNminibuffer, XtCMinibuffer,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
80 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
81 offset (minibuffer), XtRImmediate, (XtPointer) True },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
82 { XtNunsplittable, XtCUnsplittable,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
83 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
84 offset (unsplittable), XtRImmediate, (XtPointer) False },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
85 { XtNinternalBorderWidth, XtCInternalBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
86 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
87 offset (internal_border_width), XtRImmediate, (XtPointer)4 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 #ifdef HAVE_SCROLLBARS
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
89 { XtNscrollBarWidth, XtCScrollBarWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
90 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
91 offset (scrollbar_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
92 { XtNscrollBarHeight, XtCScrollBarHeight,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
93 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
94 offset (scrollbar_height), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
95 { XtNscrollBarPlacement, XtCScrollBarPlacement,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
96 XtRScrollBarPlacement, sizeof (unsigned char),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
97 offset (scrollbar_placement), XtRImmediate,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 defined (LWLIB_SCROLLBARS_ATHENA3D)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
100 (XtPointer) XtBOTTOM_RIGHT
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 #else
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
102 (XtPointer) XtBOTTOM_LEFT
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 #endif /* HAVE_SCROLLBARS */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
106
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 #ifdef HAVE_TOOLBARS
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
108 { XtNtopToolBarHeight, XtCTopToolBarHeight,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
109 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
110 offset (top_toolbar_height), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
111 { XtNbottomToolBarHeight, XtCBottomToolBarHeight,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
112 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
113 offset (bottom_toolbar_height), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
114 { XtNleftToolBarWidth, XtCLeftToolBarWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
115 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
116 offset (left_toolbar_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
117 { XtNrightToolBarWidth, XtCRightToolBarWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
118 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
119 offset (right_toolbar_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
120 { XtNtopToolBarBorderWidth, XtCTopToolBarBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
121 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
122 offset (top_toolbar_border_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
123 { XtNbottomToolBarBorderWidth, XtCBottomToolBarBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
124 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
125 offset (bottom_toolbar_border_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
126 { XtNleftToolBarBorderWidth, XtCLeftToolBarBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
127 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
128 offset (left_toolbar_border_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
129 { XtNrightToolBarBorderWidth, XtCRightToolBarBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
130 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
131 offset (right_toolbar_border_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
132 { XtNtopToolBarShadowColor, XtCTopToolBarShadowColor,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
133 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
134 offset(top_toolbar_shadow_pixel), XtRString, (XtPointer) "#000000" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
135 { XtNbottomToolBarShadowColor, XtCBottomToolBarShadowColor,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
136 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
137 offset (bottom_toolbar_shadow_pixel), XtRString, (XtPointer) "#000000" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
138 { XtNbackgroundToolBarColor, XtCBackgroundToolBarColor,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
139 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
140 offset (background_toolbar_pixel), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
141 { XtNforegroundToolBarColor, XtCForegroundToolBarColor,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
142 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
143 offset (foreground_toolbar_pixel), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
144 { XtNtopToolBarShadowPixmap, XtCTopToolBarShadowPixmap,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
145 XtRPixmap, sizeof (Pixmap),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
146 offset (top_toolbar_shadow_pixmap), XtRImmediate, (XtPointer)None },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
147 { XtNbottomToolBarShadowPixmap, XtCBottomToolBarShadowPixmap,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
148 XtRPixmap, sizeof (Pixmap),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
149 offset (bottom_toolbar_shadow_pixmap), XtRImmediate, (XtPointer)None },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
150 { XtNtoolBarShadowThickness, XtCToolBarShadowThickness,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
151 XtRDimension, sizeof (Dimension),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
152 offset (toolbar_shadow_thickness), XtRImmediate, (XtPointer)2 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 #endif /* HAVE_TOOLBARS */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
154
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
155 { XtNinterline, XtCInterline,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
156 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
157 offset (interline), XtRImmediate, (XtPointer)0 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
159 XtNfont, XtCFont,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
160 XtRFontStruct, sizeof (XFontStruct *),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 offset(font), XtRImmediate, (XtPointer)0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 },
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
163 { XtNforeground, XtCForeground,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
164 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
165 offset(foreground_pixel), XtRString, (XtPointer) "Black" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
166 { XtNbackground, XtCBackground,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
167 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
168 offset(background_pixel), XtRString, (XtPointer) "Gray80" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
169 { XtNcursorColor, XtCForeground,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
170 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
171 offset(cursor_color), XtRString, (XtPointer) "XtDefaultForeground" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
172 { XtNbarCursor, XtCBarCursor,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
173 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
174 offset (bar_cursor), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
175 { XtNvisualBell, XtCVisualBell,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
176 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
177 offset (visual_bell), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
178 { XtNbellVolume, XtCBellVolume,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
179 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
180 offset (bell_volume), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
181 { XtNuseBackingStore, XtCUseBackingStore,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
182 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
183 offset (use_backing_store), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
184 { XtNpreferredWidth, XtCPreferredWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
185 XtRDimension, sizeof (Dimension),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
186 offset (preferred_width), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
187 { XtNpreferredHeight, XtCPreferredHeight,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
188 XtRDimension, sizeof (Dimension),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
189 offset (preferred_height), XtRImmediate, (XtPointer)0 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 #undef offset
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 /* Xt is stupid and dumb.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 Xt is stupid and dumb.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 Xt is stupid and dumb. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 static XtActionsRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 emacsFrameActionsTable [] = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 {"mapping", (XtActionProc) emacs_Xt_mapping_action},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 static char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 emacsFrameTranslations [] = "\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 <Mapping>: mapping()\n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 ";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 /* If we're running under Motif, make this widget a subclass
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 of XmPrimitive. It's not clear this is necessary, but it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 may make focus behavior work better. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 EmacsFrameClassRec emacsFrameClassRec = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 { /* core fields */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 #ifdef LWLIB_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 /* superclass */ (WidgetClass) &xmPrimitiveClassRec,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 /* superclass */ &widgetClassRec,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 /* class_name */ "EmacsFrame",
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
220 /* widget_size */ sizeof (EmacsFrameRec),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 /* class_initialize */ EmacsFrameClassInitialize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 /* class_part_initialize */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 /* class_inited */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 /* initialize */ EmacsFrameInitialize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 /* initialize_hook */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 /* realize */ EmacsFrameRealize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 /* actions */ emacsFrameActionsTable,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 /* num_actions */ XtNumber (emacsFrameActionsTable),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 /* resources */ resources,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
230 /* resource_count */ XtNumber (resources),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 /* xrm_class */ NULLQUARK,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 /* compress_motion */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 /* compress_exposure */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 /* compress_enterleave */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 /* visible_interest */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 /* destroy */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 /* resize */ EmacsFrameResize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 /* expose */ XtInheritExpose,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 /* set_values */ EmacsFrameSetValues,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 /* set_values_hook */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 /* set_values_almost */ XtInheritSetValuesAlmost,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 /* get_values_hook */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 /* accept_focus */ XtInheritAcceptFocus,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 /* version */ XtVersion,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 /* callback_private */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 /* tm_table */ emacsFrameTranslations,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 /* query_geometry */ EmacsFrameQueryGeometry,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 /* display_accelerator */ XtInheritDisplayAccelerator,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 /* extension */ 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 #ifdef LWLIB_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 { /* XmPrimitiveClassPart
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 (XtWidgetProc) _XtInherit, /* border_highlight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 (XtWidgetProc) _XtInherit, /* border_unhighlight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 /* Setting the following to NULL causes PrimitiveInitialize()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 not to add traversal (TAB etc. to switch focus) and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 focus-in/out (border highlight/unhighlight) translations.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 If you want those translations, use the value XtInheritTranslations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 instead. Doing this, however, will interfere with Emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 focus handling (which highlights/unhighlights the text cursor),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 and will lead to strange display results around the border of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 widget. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 NULL, /* translations */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 NULL, /* arm_and_activate */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 NULL, /* get resources */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 0, /* num get_resources */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 NULL, /* extension */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 #endif /* LWLIB_USES_MOTIF */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 WidgetClass emacsFrameClass = (WidgetClass) &emacsFrameClassRec;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 update_various_frame_slots (EmacsFrame ew)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 ew->emacs_frame.frame->pixheight = ew->core.height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 ew->emacs_frame.frame->pixwidth = ew->core.width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 EmacsFrameInitialize (Widget request, Widget new,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 ArgList dum1, Cardinal *dum2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 EmacsFrame ew = (EmacsFrame)new;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 if (!f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 fatal ("can't create an emacs frame widget without a frame.");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 ew->emacs_frame.frame->internal_border_width =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 ew->emacs_frame.internal_border_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 void emacs_Xt_event_handler (Widget wid /* unused */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 XtPointer closure /* unused */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 XEvent *event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 Boolean *continue_to_dispatch /* unused */);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 EmacsFrameRealize (Widget widget, XtValueMask *mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 XSetWindowAttributes *attrs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 EmacsFrame ew = (EmacsFrame) widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 Widget shell_widget = FRAME_X_SHELL_WIDGET (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 attrs->event_mask =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 ExposureMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 VisibilityChangeMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 PropertyChangeMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 StructureNotifyMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 SubstructureNotifyMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 /*SubstructureRedirectMask |*/ /* Only for WMs! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 KeyPressMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 KeyReleaseMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 ButtonPressMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 ButtonReleaseMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 FocusChangeMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 PointerMotionHintMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 PointerMotionMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 LeaveWindowMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 EnterWindowMask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 *mask |= CWEventMask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 if (ew->emacs_frame.use_backing_store)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 attrs->backing_store = Always;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 *mask |= CWBackingStore;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 attrs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 /* snarf the events we want. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 XtInsertEventHandler (widget, attrs->event_mask, TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 emacs_Xt_event_handler, NULL, XtListHead);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 /* some events (e.g. map-notify and WM_DELETE_WINDOW) get sent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 directly to the shell, and the above event handler won't see
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 them. So add a handler to get them. These events don't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 propagate, so there's no danger of them being seen twice. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 XtInsertEventHandler (shell_widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 EnterWindowMask | LeaveWindowMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 VisibilityChangeMask | StructureNotifyMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 KeyPressMask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 TRUE, emacs_Xt_event_handler, NULL, XtListHead);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 #ifdef EXTERNAL_WIDGET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 /* #### Not sure if this special case is necessary */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 if (!FRAME_X_EXTERNAL_WINDOW_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 /* This is necessary under Motif in order to make it possible to click in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 a buffer and move focus out of a dialog box or control panel and back
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 into emacs-land; also necessary so that you can still type chars
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 if the cursor is over the menubar or scrollbar. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 lw_set_keyboard_focus (shell_widget, FRAME_X_TEXT_WIDGET (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 /* DO NOT CALL THIS FUNCTION! Only Xt is supposed to do this. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 EmacsFrameResize (Widget widget)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 EmacsFrame ew = (EmacsFrame)widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 int columns;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 int rows;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 XtWidgetGeometry req, repl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 update_various_frame_slots (ew);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 pixel_to_char_size (f, ew->core.width, ew->core.height, &columns, &rows);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 change_frame_size (f, rows, columns, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 /* Now we tell the EmacsShell that we've changed the size of the non-fixed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 portion of the frame. Note that, if we the resize occurred as a result
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 of EmacsFrameSetCharSize(), this information will be stored twice.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 This is not a big deal, as storing this information doesn't actually
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 do anything until the next resize. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 if (FRAME_X_TOP_LEVEL_FRAME_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 /* Kick the manager so that it knows we've changed size. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 req.request_mode = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), repl.width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 repl.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 static Boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 ArgList argv, Cardinal *argc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 EmacsFrame cur = (EmacsFrame) cur_widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 EmacsFrame new = (EmacsFrame) new_widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 struct frame *f = new->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 Lisp_Object frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 XSETFRAME (frame, f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 in_resource_setting++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 /* This function does not need to do much. Pretty much everything
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 interesting will get done in the resize method, which will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 (if necessary) get called by Xt when this function returns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 (see below).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 /* #### This function will not work if it is not called from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 update_EmacsFrame(), called from SET_FACE_PROPERTY().
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 The code located there should be moved inside of here instead,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 so that things work if either SET_FACE_PROPERTY() is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 called or XtSetValues() is called.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 if (cur->emacs_frame.iconic != new->emacs_frame.iconic &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 FRAME_X_TOP_LEVEL_FRAME_P (new->emacs_frame.frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 x_wm_set_shell_iconic_p (FRAME_X_SHELL_WIDGET (new->emacs_frame.frame),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 new->emacs_frame.iconic);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 /* If we got here, then we were likely called as a result of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 the EditRes protocol, so go ahead and change scrollbar-width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 and scrollbar-height. Otherwise, we're merely mirroring
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 a change made to scrollbar-width etc. so don't do anything
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 special. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 if (cur->emacs_frame.internal_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 new->emacs_frame.internal_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 f->internal_border_width = new->emacs_frame.internal_border_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 MARK_FRAME_SIZE_SLIPPED (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 if (cur->emacs_frame.scrollbar_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 new->emacs_frame.scrollbar_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 (Vscrollbar_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 make_int (new->emacs_frame.scrollbar_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 if (cur->emacs_frame.scrollbar_height !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 new->emacs_frame.scrollbar_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 (Vscrollbar_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 make_int (new->emacs_frame.scrollbar_height),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 #endif /* HAVE_SCROLLBARS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 #ifdef HAVE_TOOLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 if (cur->emacs_frame.top_toolbar_height !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 new->emacs_frame.top_toolbar_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 (Vtoolbar_size[TOP_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 make_int (new->emacs_frame.top_toolbar_height),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 if (cur->emacs_frame.bottom_toolbar_height !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 new->emacs_frame.bottom_toolbar_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 (Vtoolbar_size[BOTTOM_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 make_int (new->emacs_frame.bottom_toolbar_height),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 if (cur->emacs_frame.left_toolbar_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 new->emacs_frame.left_toolbar_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 (Vtoolbar_size[LEFT_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 make_int (new->emacs_frame.left_toolbar_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 if (cur->emacs_frame.right_toolbar_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 new->emacs_frame.right_toolbar_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 (Vtoolbar_size[RIGHT_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 make_int (new->emacs_frame.right_toolbar_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 if (cur->emacs_frame.top_toolbar_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 new->emacs_frame.top_toolbar_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 (Vtoolbar_border_width[TOP_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 make_int (new->emacs_frame.top_toolbar_border_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 if (cur->emacs_frame.bottom_toolbar_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 new->emacs_frame.bottom_toolbar_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 (Vtoolbar_border_width[BOTTOM_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 make_int (new->emacs_frame.bottom_toolbar_border_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 if (cur->emacs_frame.left_toolbar_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 new->emacs_frame.left_toolbar_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 (Vtoolbar_border_width[LEFT_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 make_int (new->emacs_frame.left_toolbar_border_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 if (cur->emacs_frame.right_toolbar_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 new->emacs_frame.right_toolbar_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 (Vtoolbar_border_width[RIGHT_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 make_int (new->emacs_frame.right_toolbar_border_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 #endif /* HAVE_TOOLBARS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 in_resource_setting--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 /* If the request was to resize us, but the size has not changed, Xt
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 will do nothing, and won't call our resize callback. Since such a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 request might be issued as a result of hiding/showing menubar or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 changing toolbar placement, where we rely on relayout made by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 callback, we go ahead and simulate such a call */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 if (cur->core.width == new->core.width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 && cur->core.height == new->core.height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 int i;
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 440
diff changeset
511 for (i = 0; i < (int) *argc; i++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 if (strcmp (argv[i].name, XtNwidth) == 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 || strcmp (argv[i].name, XtNheight) == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 EmacsFrameResize (new_widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 return False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 /* Note that if either (a) we return True, or (b) the width or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 height has changed, an Expose event will be generated. The Xt
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 manual says you should not return True if the width or height has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 changed, because then two Expose events will be generated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 In any case, there is no need to return True because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 SET_FACE_PROPERTY(), which does the resource
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 setting, automatically forces a redisplay as necessary. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 static XtGeometryResult
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 XtWidgetGeometry *result)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 EmacsFrame ew = (EmacsFrame) widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 int mask = request->request_mode;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 Dimension width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 int ok_width_int, ok_height_int;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 Dimension ok_width, ok_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 /* We have a definite preference for what size we would like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 to be.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 1) If a preferred size was specified for us, use it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 (This is not currently used)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 2) If a proposed size was given, round it to the nearest
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 multiple of the default char size and return it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 3) Otherwise, take our current size and round it to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 nearest multiple of the default char size. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 width = mask & CWWidth ? request->width : ew->core.width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 height = mask & CWHeight ? request->height : ew->core.height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 round_size_to_char (ew->emacs_frame.frame, width, height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 &ok_width_int, &ok_height_int);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 ok_width = (Dimension) ok_width_int;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 ok_height = (Dimension) ok_height_int;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 if (ew->emacs_frame.preferred_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 ok_width = ew->emacs_frame.preferred_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 if (ew->emacs_frame.preferred_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 ok_height = ew->emacs_frame.preferred_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 result->request_mode |= CWWidth | CWHeight;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 result->width = ok_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 result->height = ok_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 if (((mask & CWWidth) && ok_width != request->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 || ((mask & CWHeight) && ok_height != request->height))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 return XtGeometryAlmost;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 return XtGeometryYes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 /* Xt string-to-scrollbar-placement converter */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
573 /* #### Convert this to a `new-style' converter (See XtAddTypeConverter) */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 /* This variable cannot be a stack variable. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 static unsigned char cvt_string_scrollbar_placement;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 /* ARGSUSED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 Xt_StringToScrollBarPlacement (XrmValuePtr args, /* unused */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 Cardinal *num_args, /* unused */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 XrmValuePtr fromVal,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 XrmValuePtr toVal)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 XrmQuark q;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 char *lowerName = (char *) alloca (strlen ((char *) fromVal->addr) + 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 XmuCopyISOLatin1Lowered (lowerName, (char *) fromVal->addr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 q = XrmStringToQuark (lowerName);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 toVal->size = sizeof (cvt_string_scrollbar_placement);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 toVal->addr = (XPointer) &cvt_string_scrollbar_placement;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 if (q == XrmStringToQuark ("top-left")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 || q == XrmStringToQuark ("top_left"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 cvt_string_scrollbar_placement = XtTOP_LEFT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 else if (q == XrmStringToQuark ("bottom-left")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 || q == XrmStringToQuark ("bottom_left"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 cvt_string_scrollbar_placement = XtBOTTOM_LEFT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 else if (q == XrmStringToQuark ("top-right")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 || q == XrmStringToQuark ("top_right"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 cvt_string_scrollbar_placement = XtTOP_RIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 else if (q == XrmStringToQuark ("bottom-right")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 || q == XrmStringToQuark ("bottom_right"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 cvt_string_scrollbar_placement = XtBOTTOM_RIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 XtStringConversionWarning (fromVal->addr, "scrollBarPlacement");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 toVal->addr = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 toVal->size = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 EmacsFrameClassInitialize (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 XtAddConverter (XtRString, XtRScrollBarPlacement,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 Xt_StringToScrollBarPlacement, NULL, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 /********************* Special entrypoints *******************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 EmacsFrameRecomputeCellSize (Widget w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 EmacsFrame ew = (EmacsFrame) w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 int cw, ch;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 if (! XtIsSubclass (w, emacsFrameClass))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
633 default_face_height_and_width (wrap_frame (f), &ch, &cw);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 if (FRAME_X_TOP_LEVEL_FRAME_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 x_wm_set_cell_size (FRAME_X_SHELL_WIDGET (f), cw, ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 /* Set the size of the widget to have the number of rows and columns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639 specified. This both causes the X window to change and the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 internal frame structures to get modified to match. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 EmacsFrameSetCharSize (Widget widget, int columns, int rows)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 EmacsFrame ew = (EmacsFrame) widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 int pixel_width, pixel_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 if (columns < 3)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 columns = 3; /* no way buddy */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 if (rows < 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 rows = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 char_to_pixel_size (f, columns, rows, &pixel_width, &pixel_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 if (FRAME_X_TOP_LEVEL_FRAME_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 Arg al [2];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 XtSetArg (al [0], XtNwidth, pixel_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 XtSetArg (al [1], XtNheight, pixel_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 XtSetValues ((Widget) ew, al, countof (al));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 }