Mercurial > hg > xemacs-beta
comparison src/EmacsFrame.c @ 4522:fc7067b7f407
Backout last patch; forgot to specify file.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Wed, 29 Oct 2008 03:37:16 +0900 |
parents | 383ab474a241 |
children | 726060ee587c |
comparison
equal
deleted
inserted
replaced
4521:383ab474a241 | 4522:fc7067b7f407 |
---|---|
41 | 41 |
42 #include <X11/Shell.h> | 42 #include <X11/Shell.h> |
43 #include "EmacsFrameP.h" | 43 #include "EmacsFrameP.h" |
44 #include "EmacsManager.h" /* for EmacsManagerChangeSize */ | 44 #include "EmacsManager.h" /* for EmacsManagerChangeSize */ |
45 #include "xmu.h" | 45 #include "xmu.h" |
46 #include "../lwlib/xt-wrappers.h" | |
47 | 46 |
48 static void EmacsFrameClassInitialize (void); | 47 static void EmacsFrameClassInitialize (void); |
49 static void EmacsFrameInitialize (Widget, Widget, ArgList, Cardinal *); | 48 static void EmacsFrameInitialize (Widget, Widget, ArgList, Cardinal *); |
50 static void EmacsFrameRealize (Widget, XtValueMask*, XSetWindowAttributes*); | 49 static void EmacsFrameRealize (Widget, XtValueMask*, XSetWindowAttributes*); |
51 static void EmacsFrameResize (Widget widget); | 50 static void EmacsFrameResize (Widget widget); |
59 | 58 |
60 #undef XtOffset | 59 #undef XtOffset |
61 #define XtOffset(p_type,field) \ | 60 #define XtOffset(p_type,field) \ |
62 ((Cardinal) (((char *) (&(((p_type)0)->field))) - ((char *)0))) | 61 ((Cardinal) (((char *) (&(((p_type)0)->field))) - ((char *)0))) |
63 #define offset(field) XtOffset (EmacsFrame, emacs_frame.field) | 62 #define offset(field) XtOffset (EmacsFrame, emacs_frame.field) |
64 #define res(name,_class,intrepr,type,member,extrepr,value) \ | 63 |
65 Xt_RESOURCE (name, _class, intrepr, type, offset(member), extrepr, value) | |
66 static XtResource resources[] = { | 64 static XtResource resources[] = { |
67 res (XtNgeometry, XtCGeometry, XtRString, String, geometry, XtRString, 0), | 65 { XtNgeometry, XtCGeometry, |
68 res (XtNiconic, XtCIconic, XtRBoolean, Boolean, iconic, XtRImmediate, False), | 66 XtRString, sizeof (String), |
69 | 67 offset (geometry), XtRString, (XtPointer) 0 }, |
70 res (XtNemacsFrame, XtCEmacsFrame, XtRPointer, XtPointer, | 68 { XtNiconic, XtCIconic, |
71 frame, XtRImmediate, 0), | 69 XtRBoolean, sizeof (Boolean), |
72 res (XtNmenubar, XtCMenubar, XtRBoolean, Boolean, | 70 offset (iconic), XtRImmediate, (XtPointer) False }, |
73 menubar_p, XtRImmediate, True), | 71 |
74 res (XtNinitiallyUnmapped, XtCInitiallyUnmapped, XtRBoolean, Boolean, | 72 { XtNemacsFrame, XtCEmacsFrame, |
75 initially_unmapped, XtRImmediate, False), | 73 XtRPointer, sizeof (XtPointer), |
76 res (XtNminibuffer, XtCMinibuffer, XtRBoolean, Boolean, | 74 offset (frame), XtRImmediate, 0 }, |
77 minibuffer, XtRImmediate, True), | 75 { XtNmenubar, XtCMenubar, |
78 res (XtNunsplittable, XtCUnsplittable, XtRBoolean, Boolean, | 76 XtRBoolean, sizeof (Boolean), |
79 unsplittable, XtRImmediate, False), | 77 offset (menubar_p), XtRImmediate, (XtPointer) True }, |
80 res (XtNinternalBorderWidth, XtCInternalBorderWidth, XtRInt, int, | 78 { XtNinitiallyUnmapped, XtCInitiallyUnmapped, |
81 internal_border_width, XtRImmediate, 4), | 79 XtRBoolean, sizeof (Boolean), |
80 offset (initially_unmapped), XtRImmediate, (XtPointer) False }, | |
81 { XtNminibuffer, XtCMinibuffer, | |
82 XtRBoolean, sizeof (Boolean), | |
83 offset (minibuffer), XtRImmediate, (XtPointer) True }, | |
84 { XtNunsplittable, XtCUnsplittable, | |
85 XtRBoolean, sizeof (Boolean), | |
86 offset (unsplittable), XtRImmediate, (XtPointer) False }, | |
87 { XtNinternalBorderWidth, XtCInternalBorderWidth, | |
88 XtRInt, sizeof (int), | |
89 offset (internal_border_width), XtRImmediate, (XtPointer)4 }, | |
82 #ifdef HAVE_SCROLLBARS | 90 #ifdef HAVE_SCROLLBARS |
83 res (XtNscrollBarWidth, XtCScrollBarWidth, XtRInt, int, | 91 { XtNscrollBarWidth, XtCScrollBarWidth, |
84 scrollbar_width, XtRImmediate, -1), | 92 XtRInt, sizeof (int), |
85 res (XtNscrollBarHeight, XtCScrollBarHeight, XtRInt, int, | 93 offset (scrollbar_width), XtRImmediate, (XtPointer)-1 }, |
86 scrollbar_height, XtRImmediate, -1), | 94 { XtNscrollBarHeight, XtCScrollBarHeight, |
87 res (XtNscrollBarPlacement, XtCScrollBarPlacement, XtRScrollBarPlacement, | 95 XtRInt, sizeof (int), |
88 unsigned char, scrollbar_placement, XtRImmediate, | 96 offset (scrollbar_height), XtRImmediate, (XtPointer)-1 }, |
97 { XtNscrollBarPlacement, XtCScrollBarPlacement, | |
98 XtRScrollBarPlacement, sizeof (unsigned char), | |
99 offset (scrollbar_placement), XtRImmediate, | |
89 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \ | 100 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \ |
90 defined (LWLIB_SCROLLBARS_ATHENA3D) | 101 defined (LWLIB_SCROLLBARS_ATHENA3D) |
91 XtBOTTOM_RIGHT | 102 (XtPointer) XtBOTTOM_RIGHT |
92 #else | 103 #else |
93 XtBOTTOM_LEFT | 104 (XtPointer) XtBOTTOM_LEFT |
94 #endif | 105 #endif |
95 ), | 106 }, |
96 #endif /* HAVE_SCROLLBARS */ | 107 #endif /* HAVE_SCROLLBARS */ |
97 | 108 |
98 #ifdef HAVE_TOOLBARS | 109 #ifdef HAVE_TOOLBARS |
99 res (XtNtopToolBarHeight, XtCTopToolBarHeight, XtRInt, int, | 110 { XtNtopToolBarHeight, XtCTopToolBarHeight, |
100 top_toolbar_height, XtRImmediate, -1), | 111 XtRInt, sizeof (int), |
101 res (XtNbottomToolBarHeight, XtCBottomToolBarHeight, XtRInt, int, | 112 offset (top_toolbar_height), XtRImmediate, (XtPointer)-1 }, |
102 bottom_toolbar_height, XtRImmediate, -1), | 113 { XtNbottomToolBarHeight, XtCBottomToolBarHeight, |
103 res (XtNleftToolBarWidth, XtCLeftToolBarWidth, XtRInt, int, | 114 XtRInt, sizeof (int), |
104 left_toolbar_width, XtRImmediate, -1), | 115 offset (bottom_toolbar_height), XtRImmediate, (XtPointer)-1 }, |
105 res (XtNrightToolBarWidth, XtCRightToolBarWidth, XtRInt, int, | 116 { XtNleftToolBarWidth, XtCLeftToolBarWidth, |
106 right_toolbar_width, XtRImmediate, -1), | 117 XtRInt, sizeof (int), |
107 res (XtNtopToolBarBorderWidth, XtCTopToolBarBorderWidth, XtRInt, int, | 118 offset (left_toolbar_width), XtRImmediate, (XtPointer)-1 }, |
108 top_toolbar_border_width, XtRImmediate, -1), | 119 { XtNrightToolBarWidth, XtCRightToolBarWidth, |
109 res (XtNbottomToolBarBorderWidth, XtCBottomToolBarBorderWidth, XtRInt, int, | 120 XtRInt, sizeof (int), |
110 bottom_toolbar_border_width, XtRImmediate, -1), | 121 offset (right_toolbar_width), XtRImmediate, (XtPointer)-1 }, |
111 res (XtNleftToolBarBorderWidth, XtCLeftToolBarBorderWidth, XtRInt, | 122 { XtNtopToolBarBorderWidth, XtCTopToolBarBorderWidth, |
112 int, left_toolbar_border_width, XtRImmediate, -1), | 123 XtRInt, sizeof (int), |
113 res (XtNrightToolBarBorderWidth, XtCRightToolBarBorderWidth, XtRInt, | 124 offset (top_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, |
114 int, right_toolbar_border_width, XtRImmediate, -1), | 125 { XtNbottomToolBarBorderWidth, XtCBottomToolBarBorderWidth, |
115 res (XtNtoolBarShadowThickness, XtCToolBarShadowThickness, XtRDimension, | 126 XtRInt, sizeof (int), |
116 Dimension, toolbar_shadow_thickness, XtRImmediate, 2), | 127 offset (bottom_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, |
128 { XtNleftToolBarBorderWidth, XtCLeftToolBarBorderWidth, | |
129 XtRInt, sizeof (int), | |
130 offset (left_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, | |
131 { XtNrightToolBarBorderWidth, XtCRightToolBarBorderWidth, | |
132 XtRInt, sizeof (int), | |
133 offset (right_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, | |
134 { XtNtoolBarShadowThickness, XtCToolBarShadowThickness, | |
135 XtRDimension, sizeof (Dimension), | |
136 offset (toolbar_shadow_thickness), XtRImmediate, (XtPointer)2 }, | |
117 #endif /* HAVE_TOOLBARS */ | 137 #endif /* HAVE_TOOLBARS */ |
118 | 138 |
119 res (XtNinterline, XtCInterline, XtRInt, int, | 139 { XtNinterline, XtCInterline, |
120 interline, XtRImmediate, 0), | 140 XtRInt, sizeof (int), |
121 res (XtNfont, XtCFont, XtRFontStruct, XFontStruct *, | 141 offset (interline), XtRImmediate, (XtPointer)0 }, |
122 font, XtRImmediate, 0), | 142 { |
123 res (XtNforeground, XtCForeground, XtRPixel, Pixel, | 143 XtNfont, XtCFont, |
124 foreground_pixel, XtRString, "Black"), | 144 XtRFontStruct, sizeof (XFontStruct *), |
125 res (XtNbackground, XtCBackground, XtRPixel, Pixel, | 145 offset(font), XtRImmediate, (XtPointer)0 |
126 background_pixel, XtRString, "Gray80"), | 146 }, |
127 res (XtNcursorColor, XtCForeground, XtRPixel, Pixel, | 147 { XtNforeground, XtCForeground, |
128 cursor_color, XtRString, "XtDefaultForeground"), | 148 XtRPixel, sizeof (Pixel), |
129 res (XtNbarCursor, XtCBarCursor, XtRBoolean, Boolean, | 149 offset(foreground_pixel), XtRString, (XtPointer) "Black" }, |
130 bar_cursor, XtRImmediate, 0), | 150 { XtNbackground, XtCBackground, |
131 res (XtNvisualBell, XtCVisualBell, XtRBoolean, Boolean, | 151 XtRPixel, sizeof (Pixel), |
132 visual_bell, XtRImmediate, 0), | 152 offset(background_pixel), XtRString, (XtPointer) "Gray80" }, |
133 res (XtNbellVolume, XtCBellVolume, XtRInt, int, | 153 { XtNcursorColor, XtCForeground, |
134 bell_volume, XtRImmediate, 0), | 154 XtRPixel, sizeof (Pixel), |
135 res (XtNuseBackingStore, XtCUseBackingStore, XtRBoolean, Boolean, | 155 offset(cursor_color), XtRString, (XtPointer) "XtDefaultForeground" }, |
136 use_backing_store, XtRImmediate, 0), | 156 { XtNbarCursor, XtCBarCursor, |
137 res (XtNpreferredWidth, XtCPreferredWidth, XtRDimension, Dimension, | 157 XtRBoolean, sizeof (Boolean), |
138 preferred_width, XtRImmediate, 0), | 158 offset (bar_cursor), XtRImmediate, (XtPointer)0 }, |
139 res (XtNpreferredHeight, XtCPreferredHeight, XtRDimension, Dimension, | 159 { XtNvisualBell, XtCVisualBell, |
140 preferred_height, XtRImmediate, 0), | 160 XtRBoolean, sizeof (Boolean), |
161 offset (visual_bell), XtRImmediate, (XtPointer)0 }, | |
162 { XtNbellVolume, XtCBellVolume, | |
163 XtRInt, sizeof (int), | |
164 offset (bell_volume), XtRImmediate, (XtPointer)0 }, | |
165 { XtNuseBackingStore, XtCUseBackingStore, | |
166 XtRBoolean, sizeof (Boolean), | |
167 offset (use_backing_store), XtRImmediate, (XtPointer)0 }, | |
168 { XtNpreferredWidth, XtCPreferredWidth, | |
169 XtRDimension, sizeof (Dimension), | |
170 offset (preferred_width), XtRImmediate, (XtPointer)0 }, | |
171 { XtNpreferredHeight, XtCPreferredHeight, | |
172 XtRDimension, sizeof (Dimension), | |
173 offset (preferred_height), XtRImmediate, (XtPointer)0 }, | |
141 }; | 174 }; |
142 | 175 |
143 #undef offset | 176 #undef offset |
144 | 177 |
145 /* Xt is stupid and dumb. | 178 /* Xt is stupid and dumb. |
146 Xt is stupid and dumb. | 179 Xt is stupid and dumb. |
147 Xt is stupid and dumb. */ | 180 Xt is stupid and dumb. */ |
148 | 181 |
149 static XtActionsRec | 182 static XtActionsRec |
150 emacsFrameActionsTable [] = { | 183 emacsFrameActionsTable [] = { |
151 { (String) "mapping", (XtActionProc) emacs_Xt_mapping_action}, | 184 {"mapping", (XtActionProc) emacs_Xt_mapping_action}, |
152 }; | 185 }; |
153 | 186 |
154 static char | 187 static char |
155 emacsFrameTranslations [] = "\ | 188 emacsFrameTranslations [] = "\ |
156 <Mapping>: mapping()\n\ | 189 <Mapping>: mapping()\n\ |
165 #ifdef LWLIB_USES_MOTIF | 198 #ifdef LWLIB_USES_MOTIF |
166 /* superclass */ (WidgetClass) &xmPrimitiveClassRec, | 199 /* superclass */ (WidgetClass) &xmPrimitiveClassRec, |
167 #else | 200 #else |
168 /* superclass */ &widgetClassRec, | 201 /* superclass */ &widgetClassRec, |
169 #endif | 202 #endif |
170 /* class_name */ (String) "EmacsFrame", | 203 /* class_name */ "EmacsFrame", |
171 /* widget_size */ sizeof (EmacsFrameRec), | 204 /* widget_size */ sizeof (EmacsFrameRec), |
172 /* class_initialize */ EmacsFrameClassInitialize, | 205 /* class_initialize */ EmacsFrameClassInitialize, |
173 /* class_part_initialize */ 0, | 206 /* class_part_initialize */ 0, |
174 /* class_inited */ FALSE, | 207 /* class_inited */ FALSE, |
175 /* initialize */ EmacsFrameInitialize, | 208 /* initialize */ EmacsFrameInitialize, |
618 if (FRAME_X_TOP_LEVEL_FRAME_P (f)) | 651 if (FRAME_X_TOP_LEVEL_FRAME_P (f)) |
619 x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows); | 652 x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows); |
620 | 653 |
621 { | 654 { |
622 Arg al [2]; | 655 Arg al [2]; |
623 Xt_SET_ARG (al [0], XtNwidth, pixel_width); | 656 XtSetArg (al [0], XtNwidth, pixel_width); |
624 Xt_SET_ARG (al [1], XtNheight, pixel_height); | 657 XtSetArg (al [1], XtNheight, pixel_height); |
625 XtSetValues ((Widget) ew, al, countof (al)); | 658 XtSetValues ((Widget) ew, al, countof (al)); |
626 } | 659 } |
627 } | 660 } |