X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2FEmacsManager.c;h=42398c7cbda8aebbed8e28876c07f42120acc03a;hb=f94fbd3020e40c3685853c905014f2ae310b02c7;hp=2d02f8d518267d1ce6b5879486d90407178429f7;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910;p=chise%2Fxemacs-chise.git.1 diff --git a/src/EmacsManager.c b/src/EmacsManager.c index 2d02f8d..42398c7 100644 --- a/src/EmacsManager.c +++ b/src/EmacsManager.c @@ -37,12 +37,15 @@ Boston, MA 02111-1307, USA. */ static XtResource resources[] = { #define offset(field) XtOffset(EmacsManagerWidget, emacs_manager.field) - { XtNresizeCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList), - offset(resize_callback), XtRImmediate, (XtPointer) 0 }, - { XtNqueryGeometryCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList), - offset(query_geometry_callback), XtRImmediate, (XtPointer) 0 }, - { XtNuserData, XtCUserData, XtRPointer, sizeof(XtPointer), - offset(user_data), XtRImmediate, (XtPointer) 0 }, + { XtNresizeCallback, XtCCallback, + XtRCallback, sizeof (XtCallbackList), + offset(resize_callback), XtRImmediate, (XtPointer) 0 }, + { XtNqueryGeometryCallback, XtCCallback, + XtRCallback, sizeof (XtCallbackList), + offset(query_geometry_callback), XtRImmediate, (XtPointer) 0 }, + { XtNuserData, XtCUserData, + XtRPointer, sizeof (XtPointer), + offset(user_data), XtRImmediate, (XtPointer) 0 }, }; /**************************************************************** @@ -71,7 +74,7 @@ EmacsManagerClassRec emacsManagerClassRec = { /* superclass */ (WidgetClass) &compositeClassRec, #endif /* class_name */ "EmacsManager", - /* widget_size */ sizeof(EmacsManagerRec), + /* widget_size */ sizeof (EmacsManagerRec), /* class_initialize */ ClassInitialize, /* class_part_init */ NULL, /* class_inited */ FALSE, @@ -84,7 +87,7 @@ EmacsManagerClassRec emacsManagerClassRec = { /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, - /* compress_exposure */ TRUE, + /* compress_exposure */ XtExposeCompressMaximal | XtExposeNoRegion, /* compress_enterleave*/ TRUE, /* visible_interest */ FALSE, /* destroy */ NULL, @@ -147,17 +150,17 @@ QueryGeometry (Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply) { EmacsManagerWidget emw = (EmacsManagerWidget) w; EmacsManagerQueryGeometryStruct struc; - int mask = request->request_mode & (CWWidth | CWHeight); + int request_mode = request->request_mode; - struc.request_mode = mask; - if (mask & CWWidth) struc.proposed_width = request->width; - if (mask & CWHeight) struc.proposed_height = request->height; + struc.request_mode = request_mode; + struc.proposed_width = (request_mode & CWWidth) ? request->width : 0; + struc.proposed_height = (request_mode & CWHeight) ? request->height : 0; XtCallCallbackList (w, emw->emacs_manager.query_geometry_callback, &struc); reply->request_mode = CWWidth | CWHeight; reply->width = struc.proposed_width; reply->height = struc.proposed_height; - if (((mask & CWWidth) && (request->width != reply->width)) || - ((mask & CWHeight) && (request->height != reply->height))) + if (((request_mode & CWWidth) && (request->width != reply->width)) || + ((request_mode & CWHeight) && (request->height != reply->height))) return XtGeometryAlmost; return XtGeometryYes; } @@ -177,23 +180,21 @@ static XtGeometryResult GeometryManager (Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply) { /* Sure, any changes are fine. */ -#define COPY(field, mask) \ - if (request->request_mode & mask) w->core.field = request->field +#ifdef LWLIB_MENUBARS_MOTIF /* The Motif menubar will merrily request a new size every time a child is added or deleted. Blow it off because it doesn't know what it's talking about. */ -#ifdef LWLIB_MENUBARS_MOTIF - if (!(XtClass (w) == xmRowColumnWidgetClass)) + if (XtClass (w) != xmRowColumnWidgetClass) #endif /* LWLIB_MENUBARS_MOTIF */ { - COPY (width, CWWidth); - COPY (height, CWHeight); + if (request->request_mode & CWWidth) w->core.width = request->width; + if (request->request_mode & CWHeight) w->core.height = request->height; } - COPY (border_width, CWBorderWidth); - COPY (x, CWX); - COPY (y, CWY); -#undef COPY + if (request->request_mode & CWBorderWidth) + w->core.border_width = request->border_width; + if (request->request_mode & CWX) w->core.x = request->x; + if (request->request_mode & CWY) w->core.y = request->y; return XtGeometryYes; } @@ -203,13 +204,13 @@ ChangeManaged (Widget w) { if (!XtIsRealized (w)) { - XtWidgetGeometry req, repl; + XtWidgetGeometry request, reply; /* find out how big we'd like to be ... */ - req.request_mode = 0; - XtQueryGeometry (w, &req, &repl); - EmacsManagerChangeSize (w, repl.width, repl.height); + request.request_mode = 0; + XtQueryGeometry (w, &request, &reply); + EmacsManagerChangeSize (w, reply.width, reply.height); } } @@ -239,11 +240,15 @@ EmacsManagerChangeSize (Widget w, Dimension width, Dimension height) /* do nothing if we're already that size */ if (w->core.width != width || w->core.height != height) - if (XtMakeResizeRequest (w, width, height, &w->core.width, &w->core.height) - == XtGeometryAlmost) - XtMakeResizeRequest (w, w->core.width, w->core.height, NULL, NULL); - - Resize (w); + { + XtGeometryResult result = + XtMakeResizeRequest (w, width, height, &w->core.width, &w->core.height); + if (result == XtGeometryNo) + return; + if (result == XtGeometryAlmost) + XtMakeResizeRequest (w, w->core.width, w->core.height, NULL, NULL); + Resize (w); + } }