annotate src/EmacsFrame.c @ 394:7d59cb494b73 r21-2-12

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