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