mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 18:27:35 +00:00
Replace duplicate functions fe_GravityCorrectForms() and fe_ScrollForms() with
XfeMoveChildrenByOffset().
This commit is contained in:
parent
75a39fdeb5
commit
6e8b7f1529
@ -221,7 +221,7 @@ XfeBiggestWidget(Boolean horizontal,WidgetList widgets,Cardinal n)
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ Dimension
|
||||
XfeVaGetWidestWidget(Widget widget, ...)
|
||||
XfeVaGetWidestWidget(Widget w, ...)
|
||||
{
|
||||
va_list vargs;
|
||||
Widget current;
|
||||
@ -233,12 +233,12 @@ XfeVaGetWidestWidget(Widget widget, ...)
|
||||
* (because of the way var args works
|
||||
* we have to start the loop at the second widget)
|
||||
*/
|
||||
widest_width = _XfeWidth(widget);
|
||||
widest_width = _XfeWidth(w);
|
||||
|
||||
/*
|
||||
* Get the widest width
|
||||
*/
|
||||
va_start (vargs, widget);
|
||||
va_start (vargs, w);
|
||||
|
||||
while ((current = va_arg (vargs, Widget)))
|
||||
{
|
||||
@ -256,7 +256,7 @@ XfeVaGetWidestWidget(Widget widget, ...)
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ Dimension
|
||||
XfeVaGetTallestWidget(Widget widget, ...)
|
||||
XfeVaGetTallestWidget(Widget w, ...)
|
||||
{
|
||||
va_list vargs;
|
||||
Widget current;
|
||||
@ -268,12 +268,12 @@ XfeVaGetTallestWidget(Widget widget, ...)
|
||||
* (because of the way var args works
|
||||
* we have to start the loop at the second widget)
|
||||
*/
|
||||
widest_height = _XfeHeight(widget);
|
||||
widest_height = _XfeHeight(w);
|
||||
|
||||
/*
|
||||
* Get the widest height
|
||||
*/
|
||||
va_start (vargs, widget);
|
||||
va_start (vargs, w);
|
||||
|
||||
while ((current = va_arg (vargs, Widget)))
|
||||
{
|
||||
@ -689,3 +689,46 @@ _XfeLiberalGeometryManager(Widget child,
|
||||
return XtGeometryYes;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeMoveChildrenByOffset Move all children of a manager by an */
|
||||
/* (x,y) offset. */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ void
|
||||
XfeMoveChildrenByOffset(Widget w,int x_offset,int y_offset)
|
||||
{
|
||||
Cardinal i;
|
||||
|
||||
assert( XmIsManager(w) );
|
||||
|
||||
/* Make sure the widget is alive */
|
||||
if (!_XfeIsAlive(w))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Makre sure the offset is something */
|
||||
if ((x_offset == 0) && (y_offset == 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
i = _XfemNumChildren(w);
|
||||
|
||||
/* for (i = _XfemNumChildren(w) - 1; i >= 0; i--) */
|
||||
while (i--)
|
||||
{
|
||||
Widget child = _XfeChildrenIndex(w,i);
|
||||
|
||||
if (_XfeIsAlive(child))
|
||||
{
|
||||
_XfeMoveWidget(child,
|
||||
_XfeX(child) + x_offset,
|
||||
_XfeY(child) + y_offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
@ -57,14 +57,27 @@ XfeBiggestWidget (Boolean horizontal,
|
||||
Cardinal n);
|
||||
/*----------------------------------------------------------------------*/
|
||||
extern Dimension
|
||||
XfeVaGetWidestWidget (Widget widget,
|
||||
XfeVaGetWidestWidget (Widget w,
|
||||
...);
|
||||
/*----------------------------------------------------------------------*/
|
||||
extern Dimension
|
||||
XfeVaGetTallestWidget (Widget widget,
|
||||
XfeVaGetTallestWidget (Widget w,
|
||||
...);
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeMoveChildrenByOffset Move all children of a manager by an */
|
||||
/* (x,y) offset. */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
extern void
|
||||
XfeMoveChildrenByOffset (Widget w,
|
||||
int x_offset,
|
||||
int y_offset);
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
XFE_END_CPLUSPLUS_PROTECTION
|
||||
|
||||
#endif /* end Geometry.h */
|
||||
|
@ -3917,47 +3917,3 @@ fe_SetFormsGravity (MWContext *context, int gravity)
|
||||
valuemask, &attr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fe_ScrollForms (MWContext *context, int x_off, int y_off)
|
||||
{
|
||||
Widget *kids;
|
||||
Cardinal nkids = 0;
|
||||
|
||||
if (x_off == 0 && y_off == 0)
|
||||
return;
|
||||
|
||||
XtVaGetValues (CONTEXT_DATA (context)->drawing_area,
|
||||
XmNchildren, &kids, XmNnumChildren, &nkids,
|
||||
0);
|
||||
while (nkids--)
|
||||
XtMoveWidget (kids [nkids],
|
||||
_XfeX(kids [nkids]) + x_off,
|
||||
_XfeY(kids [nkids]) + y_off);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
fe_GravityCorrectForms (MWContext *context, int x_off, int y_off)
|
||||
{
|
||||
Widget *kids;
|
||||
Cardinal nkids = 0;
|
||||
|
||||
if (x_off == 0 && y_off == 0)
|
||||
return;
|
||||
|
||||
XtVaGetValues (CONTEXT_DATA (context)->drawing_area,
|
||||
XmNchildren, &kids, XmNnumChildren, &nkids,
|
||||
0);
|
||||
|
||||
while (nkids--)
|
||||
{
|
||||
if (XtIsManaged (kids[nkids]))
|
||||
{
|
||||
XtMoveWidget(kids[nkids],
|
||||
_XfeX(kids[nkids]) + x_off,
|
||||
_XfeY(kids[nkids]) + y_off);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ fe_scroll_cb (Widget widget, XtPointer closure, XtPointer call_data)
|
||||
(w + shift + scroll_slop_hack), h);
|
||||
XMoveWindow(XtDisplay(da), XtWindow(da), (x - shift), y);
|
||||
XMoveResizeWindow(XtDisplay(da), XtWindow(da), x, y, w, h);
|
||||
fe_GravityCorrectForms (context, -shift, 0);
|
||||
XfeMoveChildrenByOffset(CONTEXT_DATA(context)->drawing_area,-shift, 0);
|
||||
}
|
||||
else if (fe_globalData.fe_guffaw_scroll == 2)
|
||||
{
|
||||
@ -337,7 +337,7 @@ fe_scroll_cb (Widget widget, XtPointer closure, XtPointer call_data)
|
||||
fe_SetFormsGravity(context, EastGravity);
|
||||
XMoveResizeWindow(XtDisplay(da), XtWindow(da), x, y, w, h);
|
||||
fe_SetFormsGravity(context, NorthWestGravity);
|
||||
fe_GravityCorrectForms (context, -shift, 0);
|
||||
XfeMoveChildrenByOffset(CONTEXT_DATA(context)->drawing_area,-shift, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -345,7 +345,11 @@ fe_scroll_cb (Widget widget, XtPointer closure, XtPointer call_data)
|
||||
shift, 0,
|
||||
w - shift, h,
|
||||
0, 0);
|
||||
fe_ScrollForms (context, old_x - new_x, old_y - new_y);
|
||||
|
||||
XfeMoveChildrenByOffset(CONTEXT_DATA(context)->drawing_area,
|
||||
old_x - new_x,
|
||||
old_y - new_y);
|
||||
|
||||
fe_RefreshArea (context,
|
||||
new_x + w - (shift+lh+lh),
|
||||
new_y, shift+lh, h);
|
||||
@ -382,7 +386,7 @@ fe_scroll_cb (Widget widget, XtPointer closure, XtPointer call_data)
|
||||
(x - shift), y, (w + shift), h);
|
||||
XResizeWindow(XtDisplay(da), XtWindow(da), w, h);
|
||||
XMoveWindow(XtDisplay(da), XtWindow(da), x, y);
|
||||
fe_GravityCorrectForms (context, shift, 0);
|
||||
XfeMoveChildrenByOffset(CONTEXT_DATA(context)->drawing_area,shift, 0);
|
||||
}
|
||||
else if (fe_globalData.fe_guffaw_scroll == 2)
|
||||
{
|
||||
@ -399,7 +403,7 @@ fe_scroll_cb (Widget widget, XtPointer closure, XtPointer call_data)
|
||||
XResizeWindow(XtDisplay(da), XtWindow(da), w, h);
|
||||
XMoveWindow(XtDisplay(da), XtWindow(da), x, y);
|
||||
fe_SetFormsGravity(context, NorthWestGravity);
|
||||
fe_GravityCorrectForms (context, shift, 0);
|
||||
XfeMoveChildrenByOffset(CONTEXT_DATA(context)->drawing_area,shift, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -407,7 +411,10 @@ fe_scroll_cb (Widget widget, XtPointer closure, XtPointer call_data)
|
||||
0, 0,
|
||||
w - (old_x - new_x), h,
|
||||
(old_x - new_x), 0);
|
||||
fe_ScrollForms (context, old_x - new_x, old_y - new_y);
|
||||
|
||||
XfeMoveChildrenByOffset(CONTEXT_DATA(context)->drawing_area,
|
||||
old_x - new_x,
|
||||
old_y - new_y);
|
||||
}
|
||||
if (shift > w)
|
||||
{
|
||||
@ -438,7 +445,7 @@ fe_scroll_cb (Widget widget, XtPointer closure, XtPointer call_data)
|
||||
(h + shift + scroll_slop_hack));
|
||||
XMoveWindow(XtDisplay(da), XtWindow(da), x, (y - shift));
|
||||
XMoveResizeWindow(XtDisplay(da), XtWindow(da), x, y, w, h);
|
||||
fe_GravityCorrectForms (context, 0, -shift);
|
||||
XfeMoveChildrenByOffset(CONTEXT_DATA(context)->drawing_area,0,-shift);
|
||||
}
|
||||
else if (fe_globalData.fe_guffaw_scroll == 2)
|
||||
{
|
||||
@ -455,7 +462,7 @@ fe_scroll_cb (Widget widget, XtPointer closure, XtPointer call_data)
|
||||
fe_SetFormsGravity(context, SouthGravity);
|
||||
XMoveResizeWindow(XtDisplay(da), XtWindow(da), x, y, w, h);
|
||||
fe_SetFormsGravity(context, NorthWestGravity);
|
||||
fe_GravityCorrectForms (context, 0, -shift);
|
||||
XfeMoveChildrenByOffset(CONTEXT_DATA(context)->drawing_area,0,-shift);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -463,7 +470,9 @@ fe_scroll_cb (Widget widget, XtPointer closure, XtPointer call_data)
|
||||
0, shift,
|
||||
w, h - shift,
|
||||
0, 0);
|
||||
fe_ScrollForms (context, old_x - new_x, old_y - new_y);
|
||||
XfeMoveChildrenByOffset(CONTEXT_DATA(context)->drawing_area,
|
||||
old_x - new_x,
|
||||
old_y - new_y);
|
||||
}
|
||||
if (shift > h)
|
||||
{
|
||||
@ -491,7 +500,7 @@ fe_scroll_cb (Widget widget, XtPointer closure, XtPointer call_data)
|
||||
x, (y - shift), w, (h + shift));
|
||||
XResizeWindow(XtDisplay(da), XtWindow(da), w, h);
|
||||
XMoveWindow(XtDisplay(da), XtWindow(da), x, y);
|
||||
fe_GravityCorrectForms (context, 0, shift);
|
||||
XfeMoveChildrenByOffset(CONTEXT_DATA(context)->drawing_area,0,shift);
|
||||
}
|
||||
else if (fe_globalData.fe_guffaw_scroll == 2)
|
||||
{
|
||||
@ -508,7 +517,7 @@ fe_scroll_cb (Widget widget, XtPointer closure, XtPointer call_data)
|
||||
XResizeWindow(XtDisplay(da), XtWindow(da), w, h);
|
||||
XMoveWindow(XtDisplay(da), XtWindow(da), x, y);
|
||||
fe_SetFormsGravity(context, NorthWestGravity);
|
||||
fe_GravityCorrectForms (context, 0, shift);
|
||||
XfeMoveChildrenByOffset(CONTEXT_DATA(context)->drawing_area,0,shift);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -516,7 +525,9 @@ fe_scroll_cb (Widget widget, XtPointer closure, XtPointer call_data)
|
||||
0, 0,
|
||||
w, h - (old_y - new_y),
|
||||
0, (old_y - new_y));
|
||||
fe_ScrollForms (context, old_x - new_x, old_y - new_y);
|
||||
XfeMoveChildrenByOffset(CONTEXT_DATA(context)->drawing_area,
|
||||
old_x - new_x,
|
||||
old_y - new_y);
|
||||
}
|
||||
if (shift > h)
|
||||
{
|
||||
|
@ -288,9 +288,6 @@ extern void fe_EventLOCoords (MWContext *context, XEvent *event,
|
||||
unsigned long *x, unsigned long *y);
|
||||
extern void fe_SyncExposures(MWContext* context);
|
||||
extern void fe_RefreshArea(MWContext*, int32 x, int32 y, uint32 w, uint32 h);
|
||||
|
||||
extern void fe_ScrollForms (MWContext *context, int x_off, int y_off);
|
||||
extern void fe_GravityCorrectForms (MWContext *context, int x_off, int y_off);
|
||||
extern void fe_SetFormsGravity (MWContext *context, int gravity);
|
||||
extern void fe_NukeBackingStore (Widget widget);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user