X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2FEmacsFrame.c;h=fbb6800ab4d7c8fcfdd7fff52b7466f60e3f7e3a;hp=40de60272cf899b020cbc92d40ddf5f80f208be4;hb=7b241b273a632ab80d7c620b5add28d5f11b0fd3;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910 diff --git a/src/EmacsFrame.c b/src/EmacsFrame.c index 40de602..fbb6800 100644 --- a/src/EmacsFrame.c +++ b/src/EmacsFrame.c @@ -40,7 +40,6 @@ Boston, MA 02111-1307, USA. */ #include "faces.h" #include "frame.h" #include "toolbar.h" -#include "redisplay.h" #include "window.h" static void EmacsFrameClassInitialize (void); @@ -58,110 +57,141 @@ emacs_Xt_mapping_action (Widget w, XEvent* event); #undef XtOffset #define XtOffset(p_type,field) \ ((Cardinal) (((char *) (&(((p_type)0)->field))) - ((char *)0))) -#define offset(field) XtOffset(EmacsFrame, emacs_frame.field) +#define offset(field) XtOffset (EmacsFrame, emacs_frame.field) static XtResource resources[] = { - {XtNgeometry, XtCGeometry, XtRString, sizeof(String), - offset (geometry), XtRString, (XtPointer) 0}, - {XtNiconic, XtCIconic, XtRBoolean, sizeof(Boolean), - offset (iconic), XtRImmediate, (XtPointer) False}, - - {XtNemacsFrame, XtCEmacsFrame, XtRPointer, sizeof (XtPointer), - offset (frame), XtRImmediate, 0}, - {XtNmenubar, XtCMenubar, XtRBoolean, sizeof (Boolean), - offset (menubar_p), XtRImmediate, (XtPointer) True}, - {XtNinitiallyUnmapped, XtCInitiallyUnmapped, XtRBoolean, sizeof (Boolean), - offset (initially_unmapped), XtRImmediate, (XtPointer) False}, - {XtNminibuffer, XtCMinibuffer, XtRBoolean, sizeof (Boolean), - offset (minibuffer), XtRImmediate, (XtPointer) True}, - {XtNunsplittable, XtCUnsplittable, XtRBoolean, sizeof (Boolean), - offset (unsplittable), XtRImmediate, (XtPointer) False}, - {XtNinternalBorderWidth, XtCInternalBorderWidth, XtRInt, sizeof (int), - offset (internal_border_width), XtRImmediate, (XtPointer)4}, + { XtNgeometry, XtCGeometry, + XtRString, sizeof (String), + offset (geometry), XtRString, (XtPointer) 0 }, + { XtNiconic, XtCIconic, + XtRBoolean, sizeof (Boolean), + offset (iconic), XtRImmediate, (XtPointer) False }, + + { XtNemacsFrame, XtCEmacsFrame, + XtRPointer, sizeof (XtPointer), + offset (frame), XtRImmediate, 0 }, + { XtNmenubar, XtCMenubar, + XtRBoolean, sizeof (Boolean), + offset (menubar_p), XtRImmediate, (XtPointer) True }, + { XtNinitiallyUnmapped, XtCInitiallyUnmapped, + XtRBoolean, sizeof (Boolean), + offset (initially_unmapped), XtRImmediate, (XtPointer) False }, + { XtNminibuffer, XtCMinibuffer, + XtRBoolean, sizeof (Boolean), + offset (minibuffer), XtRImmediate, (XtPointer) True }, + { XtNunsplittable, XtCUnsplittable, + XtRBoolean, sizeof (Boolean), + offset (unsplittable), XtRImmediate, (XtPointer) False }, + { XtNinternalBorderWidth, XtCInternalBorderWidth, + XtRInt, sizeof (int), + offset (internal_border_width), XtRImmediate, (XtPointer)4 }, #ifdef HAVE_SCROLLBARS - {XtNscrollBarWidth, XtCScrollBarWidth, XtRInt, sizeof (int), - offset (scrollbar_width), XtRImmediate, (XtPointer)-1}, - {XtNscrollBarHeight, XtCScrollBarHeight, XtRInt, sizeof (int), - offset (scrollbar_height), XtRImmediate, (XtPointer)-1}, - {XtNscrollBarPlacement, XtCScrollBarPlacement, XtRScrollBarPlacement, - sizeof(unsigned char), offset(scrollbar_placement), XtRImmediate, + { XtNscrollBarWidth, XtCScrollBarWidth, + XtRInt, sizeof (int), + offset (scrollbar_width), XtRImmediate, (XtPointer)-1 }, + { XtNscrollBarHeight, XtCScrollBarHeight, + XtRInt, sizeof (int), + offset (scrollbar_height), XtRImmediate, (XtPointer)-1 }, + { XtNscrollBarPlacement, XtCScrollBarPlacement, + XtRScrollBarPlacement, sizeof (unsigned char), + offset (scrollbar_placement), XtRImmediate, #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \ defined (LWLIB_SCROLLBARS_ATHENA3D) - (XtPointer) XtBOTTOM_RIGHT + (XtPointer) XtBOTTOM_RIGHT #else - (XtPointer) XtBOTTOM_LEFT + (XtPointer) XtBOTTOM_LEFT #endif }, #endif /* HAVE_SCROLLBARS */ + #ifdef HAVE_TOOLBARS - {XtNtopToolBarHeight, XtCTopToolBarHeight, XtRInt, sizeof (int), - offset (top_toolbar_height), XtRImmediate, (XtPointer)-1}, - {XtNbottomToolBarHeight, XtCBottomToolBarHeight, XtRInt, sizeof (int), - offset (bottom_toolbar_height), XtRImmediate, (XtPointer)-1}, - {XtNleftToolBarWidth, XtCLeftToolBarWidth, XtRInt, sizeof (int), - offset (left_toolbar_width), XtRImmediate, (XtPointer)-1}, - {XtNrightToolBarWidth, XtCRightToolBarWidth, XtRInt, sizeof (int), - offset (right_toolbar_width), XtRImmediate, (XtPointer)-1}, - {XtNtopToolBarBorderWidth, XtCTopToolBarBorderWidth, XtRInt, - sizeof (int), - offset (top_toolbar_border_width), XtRImmediate, (XtPointer)-1}, - {XtNbottomToolBarBorderWidth, XtCBottomToolBarBorderWidth, XtRInt, - sizeof (int), - offset (bottom_toolbar_border_width), XtRImmediate, (XtPointer)-1}, - {XtNleftToolBarBorderWidth, XtCLeftToolBarBorderWidth, XtRInt, - sizeof (int), - offset (left_toolbar_border_width), XtRImmediate, (XtPointer)-1}, - {XtNrightToolBarBorderWidth, XtCRightToolBarBorderWidth, XtRInt, - sizeof (int), - offset (right_toolbar_border_width), XtRImmediate, (XtPointer)-1}, - {XtNtopToolBarShadowColor, XtCTopToolBarShadowColor, XtRPixel, sizeof(Pixel), - offset(top_toolbar_shadow_pixel), XtRString, "#000000"}, - {XtNbottomToolBarShadowColor, XtCBottomToolBarShadowColor, XtRPixel, - sizeof(Pixel), offset(bottom_toolbar_shadow_pixel), XtRString, "#000000"}, - {XtNbackgroundToolBarColor, XtCBackgroundToolBarColor, XtRPixel, - sizeof(Pixel), offset(background_toolbar_pixel), XtRImmediate, - (XtPointer)-1}, - {XtNforegroundToolBarColor, XtCForegroundToolBarColor, XtRPixel, - sizeof(Pixel), offset(foreground_toolbar_pixel), XtRImmediate, - (XtPointer)-1}, - {XtNtopToolBarShadowPixmap, XtCTopToolBarShadowPixmap, XtRPixmap, - sizeof (Pixmap), offset(top_toolbar_shadow_pixmap), XtRImmediate, - (XtPointer)None}, - {XtNbottomToolBarShadowPixmap, XtCBottomToolBarShadowPixmap, XtRPixmap, - sizeof (Pixmap), offset(bottom_toolbar_shadow_pixmap), XtRImmediate, - (XtPointer)None}, - {XtNtoolBarShadowThickness, XtCToolBarShadowThickness, XtRDimension, - sizeof (Dimension), offset (toolbar_shadow_thickness), XtRImmediate, - (XtPointer)2}, + { XtNtopToolBarHeight, XtCTopToolBarHeight, + XtRInt, sizeof (int), + offset (top_toolbar_height), XtRImmediate, (XtPointer)-1 }, + { XtNbottomToolBarHeight, XtCBottomToolBarHeight, + XtRInt, sizeof (int), + offset (bottom_toolbar_height), XtRImmediate, (XtPointer)-1 }, + { XtNleftToolBarWidth, XtCLeftToolBarWidth, + XtRInt, sizeof (int), + offset (left_toolbar_width), XtRImmediate, (XtPointer)-1 }, + { XtNrightToolBarWidth, XtCRightToolBarWidth, + XtRInt, sizeof (int), + offset (right_toolbar_width), XtRImmediate, (XtPointer)-1 }, + { XtNtopToolBarBorderWidth, XtCTopToolBarBorderWidth, + XtRInt, sizeof (int), + offset (top_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, + { XtNbottomToolBarBorderWidth, XtCBottomToolBarBorderWidth, + XtRInt, sizeof (int), + offset (bottom_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, + { XtNleftToolBarBorderWidth, XtCLeftToolBarBorderWidth, + XtRInt, sizeof (int), + offset (left_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, + { XtNrightToolBarBorderWidth, XtCRightToolBarBorderWidth, + XtRInt, sizeof (int), + offset (right_toolbar_border_width), XtRImmediate, (XtPointer)-1 }, + { XtNtopToolBarShadowColor, XtCTopToolBarShadowColor, + XtRPixel, sizeof (Pixel), + offset(top_toolbar_shadow_pixel), XtRString, (XtPointer) "#000000" }, + { XtNbottomToolBarShadowColor, XtCBottomToolBarShadowColor, + XtRPixel, sizeof (Pixel), + offset (bottom_toolbar_shadow_pixel), XtRString, (XtPointer) "#000000" }, + { XtNbackgroundToolBarColor, XtCBackgroundToolBarColor, + XtRPixel, sizeof (Pixel), + offset (background_toolbar_pixel), XtRImmediate, (XtPointer)-1 }, + { XtNforegroundToolBarColor, XtCForegroundToolBarColor, + XtRPixel, sizeof (Pixel), + offset (foreground_toolbar_pixel), XtRImmediate, (XtPointer)-1 }, + { XtNtopToolBarShadowPixmap, XtCTopToolBarShadowPixmap, + XtRPixmap, sizeof (Pixmap), + offset (top_toolbar_shadow_pixmap), XtRImmediate, (XtPointer)None }, + { XtNbottomToolBarShadowPixmap, XtCBottomToolBarShadowPixmap, + XtRPixmap, sizeof (Pixmap), + offset (bottom_toolbar_shadow_pixmap), XtRImmediate, (XtPointer)None }, + { XtNtoolBarShadowThickness, XtCToolBarShadowThickness, + XtRDimension, sizeof (Dimension), + offset (toolbar_shadow_thickness), XtRImmediate, (XtPointer)2 }, #endif /* HAVE_TOOLBARS */ - {XtNinterline, XtCInterline, XtRInt, sizeof (int), - offset (interline), XtRImmediate, (XtPointer)0}, + + { XtNinterline, XtCInterline, + XtRInt, sizeof (int), + offset (interline), XtRImmediate, (XtPointer)0 }, { #ifdef I18N4 - XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet), + XtNfontSet, XtCFontSet, + XtRFontSet, sizeof (XFontSet), #else - XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtNfont, XtCFont, + XtRFontStruct, sizeof (XFontStruct *), #endif offset(font), XtRImmediate, (XtPointer)0 }, - {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), - offset(foreground_pixel), XtRString, "Black"}, - {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel), - offset(background_pixel), XtRString, "Gray80"}, - {XtNcursorColor, XtCForeground, XtRPixel, sizeof(Pixel), - offset(cursor_color), XtRString, "XtDefaultForeground"}, - {XtNbarCursor, XtCBarCursor, XtRBoolean, sizeof (Boolean), - offset (bar_cursor), XtRImmediate, (XtPointer)0}, - {XtNvisualBell, XtCVisualBell, XtRBoolean, sizeof (Boolean), - offset (visual_bell), XtRImmediate, (XtPointer)0}, - {XtNbellVolume, XtCBellVolume, XtRInt, sizeof (int), - offset (bell_volume), XtRImmediate, (XtPointer)0}, - {XtNuseBackingStore, XtCUseBackingStore, XtRBoolean, sizeof (Boolean), - offset (use_backing_store), XtRImmediate, (XtPointer)0}, - {XtNpreferredWidth, XtCPreferredWidth, XtRDimension, sizeof (Dimension), - offset (preferred_width), XtRImmediate, (XtPointer)0}, - {XtNpreferredHeight, XtCPreferredHeight, XtRDimension, sizeof (Dimension), - offset (preferred_height), XtRImmediate, (XtPointer)0}, + { XtNforeground, XtCForeground, + XtRPixel, sizeof (Pixel), + offset(foreground_pixel), XtRString, (XtPointer) "Black" }, + { XtNbackground, XtCBackground, + XtRPixel, sizeof (Pixel), + offset(background_pixel), XtRString, (XtPointer) "Gray80" }, + { XtNcursorColor, XtCForeground, + XtRPixel, sizeof (Pixel), + offset(cursor_color), XtRString, (XtPointer) "XtDefaultForeground" }, + { XtNbarCursor, XtCBarCursor, + XtRBoolean, sizeof (Boolean), + offset (bar_cursor), XtRImmediate, (XtPointer)0 }, + { XtNvisualBell, XtCVisualBell, + XtRBoolean, sizeof (Boolean), + offset (visual_bell), XtRImmediate, (XtPointer)0 }, + { XtNbellVolume, XtCBellVolume, + XtRInt, sizeof (int), + offset (bell_volume), XtRImmediate, (XtPointer)0 }, + { XtNuseBackingStore, XtCUseBackingStore, + XtRBoolean, sizeof (Boolean), + offset (use_backing_store), XtRImmediate, (XtPointer) NotUseful }, + { XtNpreferredWidth, XtCPreferredWidth, + XtRDimension, sizeof (Dimension), + offset (preferred_width), XtRImmediate, (XtPointer)0 }, + { XtNpreferredHeight, XtCPreferredHeight, + XtRDimension, sizeof (Dimension), + offset (preferred_height), XtRImmediate, (XtPointer)0 }, }; #undef offset @@ -192,7 +222,7 @@ EmacsFrameClassRec emacsFrameClassRec = { /* superclass */ &widgetClassRec, #endif /* class_name */ "EmacsFrame", - /* widget_size */ sizeof(EmacsFrameRec), + /* widget_size */ sizeof (EmacsFrameRec), /* class_initialize */ EmacsFrameClassInitialize, /* class_part_initialize */ 0, /* class_inited */ FALSE, @@ -202,10 +232,14 @@ EmacsFrameClassRec emacsFrameClassRec = { /* actions */ emacsFrameActionsTable, /* num_actions */ XtNumber (emacsFrameActionsTable), /* resources */ resources, - /* resource_count */ XtNumber(resources), + /* resource_count */ XtNumber (resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, +#ifdef LWLIB_USES_MOTIF /* compress_exposure */ TRUE, +#else + /* compress_exposure */ XtExposeCompressMaximal | XtExposeNoRegion, +#endif /* compress_enterleave */ TRUE, /* visible_interest */ FALSE, /* destroy */ NULL, @@ -411,7 +445,7 @@ EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, f->internal_border_width = new->emacs_frame.internal_border_width; MARK_FRAME_SIZE_SLIPPED (f); } - + #ifdef HAVE_SCROLLBARS if (cur->emacs_frame.scrollbar_width != new->emacs_frame.scrollbar_width) @@ -487,7 +521,7 @@ EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, if (cur->core.width == new->core.width && cur->core.height == new->core.height) { - int i; + Cardinal i; for (i=0; i<*argc; i++) if (strcmp (argv[i].name, XtNwidth) == 0 || strcmp (argv[i].name, XtNheight) == 0) @@ -550,7 +584,7 @@ EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, } /* Xt string-to-scrollbar-placement converter */ -/* ### Convert this to a `new-style' converter (See XtAddTypeConverter) */ +/* #### Convert this to a `new-style' converter (See XtAddTypeConverter) */ /* This variable cannot be a stack variable. */ static unsigned char cvt_string_scrollbar_placement; @@ -608,7 +642,7 @@ EmacsFrameRecomputeCellSize (Widget w) struct frame *f = ew->emacs_frame.frame; if (! XtIsSubclass (w, emacsFrameClass)) - abort (); + ABORT (); default_face_height_and_width (make_frame (f), &ch, &cw); if (FRAME_X_TOP_LEVEL_FRAME_P (f)) @@ -625,7 +659,6 @@ EmacsFrameSetCharSize (Widget widget, int columns, int rows) EmacsFrame ew = (EmacsFrame) widget; int pixel_width, pixel_height; struct frame *f = ew->emacs_frame.frame; - Arg al [2]; if (columns < 3) columns = 3; /* no way buddy */ @@ -637,7 +670,10 @@ EmacsFrameSetCharSize (Widget widget, int columns, int rows) if (FRAME_X_TOP_LEVEL_FRAME_P (f)) x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows); - XtSetArg (al [0], XtNwidth, (Dimension) pixel_width); - XtSetArg (al [1], XtNheight, (Dimension) pixel_height); - XtSetValues ((Widget) ew, al, 2); + { + Arg al [2]; + XtSetArg (al [0], XtNwidth, pixel_width); + XtSetArg (al [1], XtNheight, pixel_height); + XtSetValues ((Widget) ew, al, countof (al)); + } }