summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-07-11 20:00:49 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-07-11 20:00:49 -0700
commit975b6bcad6de9f57d46efc7bddb691a40703ae1e (patch)
tree8af99fc9a41665b1c20e8e50a3626ef855878398
parentec3e612fadfbdf60dc30bc8f155d5fb6a5fd501f (diff)
Delete trailing whitespace from *.[ch] files
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--CutPaste.c16
-rw-r--r--RootWin.c2
-rw-r--r--Scale.c352
-rw-r--r--Scale.h14
-rw-r--r--xmag.c174
5 files changed, 279 insertions, 279 deletions
diff --git a/CutPaste.c b/CutPaste.c
index afdebf1..36a4a13 100644
--- a/CutPaste.c
+++ b/CutPaste.c
@@ -41,7 +41,7 @@ from The Open Group.
/*ARGSUSED*/
static Boolean
-ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
+ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
XtPointer *value, unsigned long *length, int *format)
{
Boolean success;
@@ -50,8 +50,8 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
ScaleWidget sw = (ScaleWidget) w;
Pixmap *pixmap = (Pixmap *) XtMalloc(sizeof(Pixmap));
*pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w),
- sw->scale.image->width,
- sw->scale.image->height,
+ sw->scale.image->width,
+ sw->scale.image->height,
sw->scale.image->depth);
XPutImage(XtDisplay(w), *pixmap, sw->scale.gc, sw->scale.image,
0, 0, 0, 0, sw->scale.image->width, sw->scale.image->height);
@@ -81,7 +81,7 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
return success;
}
-void
+void
SWGrabSelection(Widget w, Time time)
{
(void) XtOwnSelection(w, XA_PRIMARY, time, ConvertSelection, NULL, NULL);
@@ -90,8 +90,8 @@ SWGrabSelection(Widget w, Time time)
/*ARGSUSED*/
static void
-SelectionCallback(Widget w, XtPointer client_data, Atom *selection,
- Atom *type, XtPointer value, unsigned long *length,
+SelectionCallback(Widget w, XtPointer client_data, Atom *selection,
+ Atom *type, XtPointer value, unsigned long *length,
int *format)
{
@@ -105,7 +105,7 @@ SelectionCallback(Widget w, XtPointer client_data, Atom *selection,
pixmap = (Pixmap *) value;
XGetGeometry(XtDisplay(w), *pixmap, &root, &x, &y,
&width, &height, &border_width, &depth);
- image = XGetImage(XtDisplay(w), *pixmap, 0, 0, width, height,
+ image = XGetImage(XtDisplay(w), *pixmap, 0, 0, width, height,
AllPlanes, ZPixmap);
SWAutoscale(w, NULL, NULL, NULL);
SWSetImage(w, image);
@@ -114,7 +114,7 @@ SelectionCallback(Widget w, XtPointer client_data, Atom *selection,
}
}
-void
+void
SWRequestSelection(Widget w, Time time)
{
XtGetSelectionValue(w, XA_PRIMARY, XA_PIXMAP, SelectionCallback, NULL,
diff --git a/RootWin.c b/RootWin.c
index 31bdf6e..1b4d4dd 100644
--- a/RootWin.c
+++ b/RootWin.c
@@ -76,7 +76,7 @@ RootWindowClassRec rootWindowClassRec = {
WidgetClass rootWindowWidgetClass = (WidgetClass)&rootWindowClassRec;
/*ARGSUSED*/
-static void
+static void
Realize(Widget w, XtValueMask *value_mask, XSetWindowAttributes *attributes)
{
w->core.window = RootWindowOfScreen(w->core.screen);
diff --git a/Scale.c b/Scale.c
index 22d8649..f32aeec 100644
--- a/Scale.c
+++ b/Scale.c
@@ -105,18 +105,18 @@ static void ClassInitialize ( void );
static void GetGC ( ScaleWidget sw );
static void GetInitialScaleValues ( ScaleWidget sw );
static void GetRectangleBuffer ( ScaleWidget sw, Cardinal buffer_size );
-static void Initialize ( Widget request, Widget new, ArgList args,
+static void Initialize ( Widget request, Widget new, ArgList args,
Cardinal *num_args );
static void BuildTable ( ScaleWidget sw );
static void FlushRectangles ( ScaleWidget sw, Drawable drawable, GC gc );
-static void FillRectangle ( ScaleWidget sw, Drawable drawable, GC gc,
- Position x, Position y,
+static void FillRectangle ( ScaleWidget sw, Drawable drawable, GC gc,
+ Position x, Position y,
Dimension width, Dimension height );
-static void ScaleImage ( ScaleWidget sw, Drawable drawable,
- Position img_x, Position img_y,
- Position dst_x, Position dst_y,
+static void ScaleImage ( ScaleWidget sw, Drawable drawable,
+ Position img_x, Position img_y,
+ Position dst_x, Position dst_y,
Dimension img_width, Dimension img_height );
-static int FindPixel ( ScaleWidget sw, Position x, Position y,
+static int FindPixel ( ScaleWidget sw, Position x, Position y,
Position *img_x, Position *img_y, Pixel *img_pixel );
static void Redisplay ( Widget w, XEvent *event, Region region );
static void TryResize ( ScaleWidget sw );
@@ -130,11 +130,11 @@ static void PositionImage ( ScaleWidget sw );
static void Resize ( Widget w );
static void Realize ( Widget wid, Mask *vmask, XSetWindowAttributes *attr );
static void Destroy ( Widget w );
-static Boolean SetValues ( Widget current, Widget request, Widget new,
+static Boolean SetValues ( Widget current, Widget request, Widget new,
ArgList args, Cardinal *num_args );
-
+
static XtActionsRec actions[] =
{
{"unscale", SWUnscale},
@@ -187,13 +187,13 @@ ScaleClassRec scaleClassRec = {
/* display_accelerator */ XtInheritDisplayAccelerator,
/* extension */ NULL
},
- {
+ {
/* change_sensitive */ XtInheritChangeSensitive,
}
};
-
+
WidgetClass scaleWidgetClass = (WidgetClass) &scaleClassRec;
-
+
/*
@@ -201,25 +201,25 @@ WidgetClass scaleWidgetClass = (WidgetClass) &scaleClassRec;
*/
-static void
+static void
ClassInitialize(void)
{
-}
+}
-static void
+static void
GetGC(ScaleWidget sw)
{
XGCValues values;
-
+
values.foreground = sw->scale.foreground_pixel;
values.background = sw->core.background_pixel;
values.function = GXcopy;
-
+
sw->scale.gc = XtGetGC((Widget) sw,
- GCForeground |
- GCBackground |
+ GCForeground |
+ GCBackground |
GCFunction,
&values);
}
@@ -227,7 +227,7 @@ GetGC(ScaleWidget sw)
-static void
+static void
GetInitialScaleValues(ScaleWidget sw)
{
if (sw->scale.proportional) {
@@ -244,7 +244,7 @@ GetInitialScaleValues(ScaleWidget sw)
-static void
+static void
GetRectangleBuffer(ScaleWidget sw, Cardinal buffer_size)
/*
* This procedure will realloc a new rectangles buffer.
@@ -257,7 +257,7 @@ GetRectangleBuffer(ScaleWidget sw, Cardinal buffer_size)
XtWarning("buffer size has to be a positive number greater than zero");
}
sw->scale.rectangles = (XRectangle *)
- XtRealloc((char *) sw->scale.rectangles,
+ XtRealloc((char *) sw->scale.rectangles,
buffer_size * sizeof(XRectangle));
sw->scale.buffer_size = buffer_size;
}
@@ -265,29 +265,29 @@ GetRectangleBuffer(ScaleWidget sw, Cardinal buffer_size)
/* ARGSUSED */
-static void
+static void
Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args)
{
ScaleWidget new_sw = (ScaleWidget) new;
-
+
new_sw->scale.table.x = (Position *) NULL;
new_sw->scale.table.y = (Position *) NULL;
new_sw->scale.table.width = (Dimension *) NULL;
new_sw->scale.table.height = (Dimension *) NULL;
-
+
new_sw->scale.nrectangles = 0;
new_sw->scale.rectangles = (XRectangle *) NULL;
-
+
GetRectangleBuffer(new_sw, new_sw->scale.buffer_size);
-
+
GetGC(new_sw);
-
+
if (new_sw->scale.image != NULL) {
if (new_sw->core.width == 0)
- new_sw->core.width =
+ new_sw->core.width =
new_sw->scale.image->width + 2 * new_sw->scale.internal_width;
if (new_sw->core.height == 0)
- new_sw->core.height =
+ new_sw->core.height =
new_sw->scale.image->height + 2 *new_sw->scale.internal_height;
}
else {
@@ -296,14 +296,14 @@ Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args)
if (new_sw->core.height == 0)
new_sw->core.height = 1 + 2 * new_sw->scale.internal_height;
new_sw->scale.image = XCreateImage(XtDisplay(new),
- DefaultVisual(XtDisplay(new),
+ DefaultVisual(XtDisplay(new),
DefaultScreen(XtDisplay(new))),
- 1, XYBitmap, 0,
+ 1, XYBitmap, 0,
XtCalloc(1, sizeof(char)),
1, 1, 8, 0);
}
- if ((new_sw->scale.aspect_ratio =
+ if ((new_sw->scale.aspect_ratio =
atof(new_sw->scale.aspect_ratio_str)) < 0.0) {
new_sw->scale.aspect_ratio = 1.0;
XtWarning("AspectRatio has to be a positive number. (forced to 1.0)");
@@ -314,18 +314,18 @@ Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args)
new_sw->scale.precision = 0.001;
XtWarning("Precision has to be a positive number. (forced to 0.001)");
}
-
+
if (new_sw->scale.scale_x_str == DefaultScaleFactor
- ||
+ ||
new_sw->scale.scale_y_str == DefaultScaleFactor)
GetInitialScaleValues(new_sw);
else {
- if ((new_sw->scale.scale_x =
+ if ((new_sw->scale.scale_x =
atof(new_sw->scale.scale_x_str)) < 0.0) {
new_sw->scale.scale_x = 1.0;
XtWarning("ScaleValue has to be a positive number. (forced to 1.0)");
}
- if ((new_sw->scale.scale_y =
+ if ((new_sw->scale.scale_y =
atof(new_sw->scale.scale_y_str)) < 0.0) {
new_sw->scale.scale_y = 1.0;
XtWarning("ScaleValue has to be a positive number. (forced to 1.0)");
@@ -335,29 +335,29 @@ Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args)
-static void
+static void
BuildTable(ScaleWidget sw)
- /*
+ /*
* This procedure builds scaling table for image in the scale struct
* Requires image, scale_x and scale_y to be set properly
*/
{
Position x, y;
-
+
XtFree((char *) sw->scale.table.x);
XtFree((char *) sw->scale.table.y);
XtFree((char *) sw->scale.table.width);
XtFree((char *) sw->scale.table.height);
- sw->scale.table.x =
+ sw->scale.table.x =
(Position *) XtMalloc(sizeof(Position) * sw->scale.image->width);
- sw->scale.table.y =
+ sw->scale.table.y =
(Position *) XtMalloc(sizeof(Position) * sw->scale.image->height);
- sw->scale.table.width =
+ sw->scale.table.width =
(Dimension *) XtMalloc(sizeof(Dimension) * sw->scale.image->width);
- sw->scale.table.height =
+ sw->scale.table.height =
(Dimension *) XtMalloc(sizeof(Dimension) * sw->scale.image->height);
-
- /* Build the scaling table */
+
+ /* Build the scaling table */
for (x = 0; x < sw->scale.image->width; x++) {
sw->scale.table.x[(int) x] = (Position) myrint(sw->scale.scale_x * x);
sw->scale.table.width[(int) x] = (Dimension)
@@ -372,22 +372,22 @@ BuildTable(ScaleWidget sw)
-static void
+static void
FlushRectangles(ScaleWidget sw, Drawable drawable, GC gc)
{
- XFillRectangles(XtDisplay(sw), drawable, gc,
+ XFillRectangles(XtDisplay(sw), drawable, gc,
sw->scale.rectangles, sw->scale.nrectangles);
-
+
sw->scale.nrectangles = 0;
}
-static void
-FillRectangle(ScaleWidget sw, Drawable drawable, GC gc,
+static void
+FillRectangle(ScaleWidget sw, Drawable drawable, GC gc,
Position x, Position y, Dimension width, Dimension height)
{
-
+
if (sw->scale.nrectangles == sw->scale.buffer_size)
FlushRectangles(sw, drawable, gc);
@@ -401,11 +401,11 @@ FillRectangle(ScaleWidget sw, Drawable drawable, GC gc,
-static void
-ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y,
- Position dst_x, Position dst_y,
+static void
+ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y,
+ Position dst_x, Position dst_y,
Dimension img_width, Dimension img_height)
- /*
+ /*
* This procedure scales image into the specified drawable
* It assumes scaling table was already built
*/
@@ -414,18 +414,18 @@ ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y,
XGCValues gcv;
Position x, y;
Pixel pixel;
-
+
/* Clip the img coordinates */
img_x = min(max(img_x, 0), (Position) sw->scale.image->width - 1);
img_y = min(max(img_y, 0), (Position) sw->scale.image->height - 1);
- img_width =
+ img_width =
min(img_width, (Dimension)(sw->scale.image->width - (Dimension)img_x));
- img_height =
+ img_height =
min(img_height, (Dimension)(sw->scale.image->height - (Dimension)img_y));
- if (sw->scale.scale_x == 1.0 && sw->scale.scale_y == 1.0)
- XPutImage(XtDisplay(sw), drawable, sw->scale.gc, sw->scale.image,
- img_x, img_y, dst_x, dst_y,
+ if (sw->scale.scale_x == 1.0 && sw->scale.scale_y == 1.0)
+ XPutImage(XtDisplay(sw), drawable, sw->scale.gc, sw->scale.image,
+ img_x, img_y, dst_x, dst_y,
img_width, img_height);
else {
dst_x = dst_x - sw->scale.table.x[(int) img_x];
@@ -438,29 +438,29 @@ ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y,
/* make sure gc knows the right background */
gcv.background = sw->core.background_pixel;
- XChangeGC(XtDisplay(sw), gc, GCBackground, &gcv);
+ XChangeGC(XtDisplay(sw), gc, GCBackground, &gcv);
/* Set the background of drawable. If the most frequent color
is the background color it can speed up scaling process. */
gcv.foreground = gcv.background;
XChangeGC(XtDisplay(sw), gc, GCForeground, &gcv);
- XFillRectangle(XtDisplay(sw), drawable, gc,
- sw->scale.table.x[(int) img_x] + dst_x,
- sw->scale.table.y[(int) img_y] + dst_y,
- sw->scale.table.x[(int) img_x + img_width - 1] -
- sw->scale.table.x[(int) img_x],
- sw->scale.table.y[(int) img_y + img_height - 1] -
+ XFillRectangle(XtDisplay(sw), drawable, gc,
+ sw->scale.table.x[(int) img_x] + dst_x,
+ sw->scale.table.y[(int) img_y] + dst_y,
+ sw->scale.table.x[(int) img_x + img_width - 1] -
+ sw->scale.table.x[(int) img_x],
+ sw->scale.table.y[(int) img_y + img_height - 1] -
sw->scale.table.y[(int) img_y]);
-
+
if (sw->scale.image->format == XYBitmap) {
for (x = img_x; x < img_x + (Position)img_width; x++)
for (y = img_y; y < img_y + (Position)img_height; y++) {
pixel = XGetPixel(sw->scale.image, x, y);
if (pixel) /* Do not draw background */
- FillRectangle(sw, drawable, sw->scale.gc,
- sw->scale.table.x[(int) x] + dst_x,
- sw->scale.table.y[(int) y] + dst_y,
- sw->scale.table.width[(int) x],
+ FillRectangle(sw, drawable, sw->scale.gc,
+ sw->scale.table.x[(int) x] + dst_x,
+ sw->scale.table.y[(int) y] + dst_y,
+ sw->scale.table.width[(int) x],
sw->scale.table.height[(int) y]);
}
FlushRectangles(sw, drawable, sw->scale.gc);
@@ -475,9 +475,9 @@ ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y,
XChangeGC(XtDisplay(sw), gc, GCForeground, &gcv);
}
XFillRectangle(XtDisplay(sw), drawable, gc,
- sw->scale.table.x[(int) x] + dst_x,
- sw->scale.table.y[(int) y] + dst_y,
- sw->scale.table.width[(int) x],
+ sw->scale.table.x[(int) x] + dst_x,
+ sw->scale.table.y[(int) y] + dst_y,
+ sw->scale.table.width[(int) x],
sw->scale.table.height[(int) y]);
}
}
@@ -488,21 +488,21 @@ ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y,
-static int
-FindPixel(ScaleWidget sw, Position x, Position y,
+static int
+FindPixel(ScaleWidget sw, Position x, Position y,
Position *img_x, Position *img_y, Pixel *img_pixel)
/* (x,y) == (0,0) where image starts in sw window*/
{
- if (*img_x < 0 || *img_x >= sw->scale.image->width
+ if (*img_x < 0 || *img_x >= sw->scale.image->width
||
*img_y < 0 || *img_y >= sw->scale.image->height)
return (-1);
-
+
if (sw->scale.table.x[(int) *img_x] >= x) {
--*img_x;
return FindPixel(sw, x, y, img_x, img_y, img_pixel);
}
- if (sw->scale.table.x[(int) *img_x] +
+ if (sw->scale.table.x[(int) *img_x] +
(Position)sw->scale.table.width[(int) *img_x] < x) {
++*img_x;
return FindPixel(sw, x, y, img_x, img_y, img_pixel);
@@ -511,38 +511,38 @@ FindPixel(ScaleWidget sw, Position x, Position y,
--*img_y;
return FindPixel(sw, x, y, img_x, img_y, img_pixel);
}
- if (sw->scale.table.y[(int) *img_y] +
+ if (sw->scale.table.y[(int) *img_y] +
(Position)sw->scale.table.height[(int) *img_y] < y) {
++*img_y;
return FindPixel(sw, x, y, img_x, img_y, img_pixel);
}
-
+
*img_pixel = XGetPixel(sw->scale.image, *img_x, *img_y);
-
+
return (0);
}
-int
-SWGetImagePixel(Widget w, Position x, Position y,
+int
+SWGetImagePixel(Widget w, Position x, Position y,
Position *img_x, Position *img_y, Pixel *img_pixel)
{
ScaleWidget sw = (ScaleWidget) w;
-
+
x -= sw->scale.x;
y -= sw->scale.y;
-
+
*img_x = (Position) floor(x / sw->scale.scale_x);
*img_y = (Position) floor(y / sw->scale.scale_y);
-
+
return FindPixel(sw, x, y, img_x, img_y, img_pixel);
}
/* ARGSUSED */
-static void
+static void
Redisplay(Widget w, XEvent *event, Region region)
{
ScaleWidget sw = (ScaleWidget) w;
@@ -560,7 +560,7 @@ Redisplay(Widget w, XEvent *event, Region region)
x = event->xexpose.x - sw->scale.x;
width = event->xexpose.width;
}
-
+
if (event->xexpose.y < sw->scale.y) {
y = 0;
height = event->xexpose.height -
@@ -570,22 +570,22 @@ Redisplay(Widget w, XEvent *event, Region region)
y = event->xexpose.y - sw->scale.y;
height = event->xexpose.height;
}
-
- img_x = min(max((Position) floor((float) x
+
+ img_x = min(max((Position) floor((float) x
/ (float) sw->scale.scale_x), 0),
(Position) sw->scale.image->width - 1);
img_y = min(max((Position) floor((float) y
/ (float) sw->scale.scale_y), 0),
(Position) sw->scale.image->height - 1);
-
- if (sw->core.visible) {
+
+ if (sw->core.visible) {
ScaleImage(sw, XtWindow(w),
img_x, img_y,
sw->scale.x + sw->scale.table.x[(int) img_x],
sw->scale.y + sw->scale.table.y[(int) img_y],
(Dimension) ceil((float) width
- / sw->scale.scale_x) + 1,
+ / sw->scale.scale_x) + 1,
(Dimension) ceil((float) height
/ sw->scale.scale_y) + 1);
}
@@ -594,23 +594,23 @@ Redisplay(Widget w, XEvent *event, Region region)
-static void
+static void
TryResize(ScaleWidget sw)
{
Dimension width, height;
XtGeometryResult result;
- width = (Dimension)
+ width = (Dimension)
floor(sw->scale.image->width * sw->scale.scale_x)
+ 2 * sw->scale.internal_width;
- height = (Dimension)
+ height = (Dimension)
floor(sw->scale.image->height * sw->scale.scale_y)
+ 2 * sw->scale.internal_height;
-
- while ((result =
+
+ while ((result =
/* SUPPRESS 530 */XtMakeResizeRequest((Widget)sw,width,height,&width,&height))
- == XtGeometryAlmost);
-
+ == XtGeometryAlmost);
+
if (result != XtGeometryNo) {
sw->core.width = width;
sw->core.height = height;
@@ -619,7 +619,7 @@ TryResize(ScaleWidget sw)
-static void
+static void
Precision(ScaleWidget sw)
{
if (sw->scale.scale_x != 1.0)
@@ -633,14 +633,14 @@ Precision(ScaleWidget sw)
-static void
+static void
Proportional(ScaleWidget sw)
{
float scale_x, scale_y;
scale_x = sw->scale.scale_y / sw->scale.aspect_ratio;
scale_y = sw->scale.scale_x * sw->scale.aspect_ratio;
-
+
if (scale_x <= sw->scale.scale_x && scale_y <= sw->scale.scale_y) {
if (scale_x > scale_y)
sw->scale.scale_x = scale_x;
@@ -653,24 +653,24 @@ Proportional(ScaleWidget sw)
sw->scale.scale_y = scale_y;
else {
float x_ratio, y_ratio;
-
+
x_ratio = scale_x / sw->scale.scale_x;
y_ratio = scale_y / sw->scale.scale_y;
-
+
if (x_ratio < y_ratio)
sw->scale.scale_y /= x_ratio;
else
sw->scale.scale_x /= y_ratio;
}
- if (fabs(sw->scale.scale_x / sw->scale.scale_y * sw->scale.aspect_ratio
+ if (fabs(sw->scale.scale_x / sw->scale.scale_y * sw->scale.aspect_ratio
- 1.0) > sw->scale.precision)
XtWarning("can not preserve aspect ratio");
}
-static void
+static void
GetScaledSize(ScaleWidget sw)
{
sw->scale.width = (Dimension)
@@ -681,14 +681,14 @@ GetScaledSize(ScaleWidget sw)
-static void
+static void
GetScaleValues(ScaleWidget sw)
{
/*
* Make sure to subtract internal width and height.
*/
-
- sw->scale.scale_x =
+
+ sw->scale.scale_x =
(float) max((int)(sw->core.width - 2 * sw->scale.internal_width), 1)
/ (float) sw->scale.image->width;
@@ -699,19 +699,19 @@ GetScaleValues(ScaleWidget sw)
-static void
+static void
Unscale(ScaleWidget sw)
{
sw->scale.scale_x = sw->scale.scale_y = 1.0;
-
- GetScaledSize(sw);
-
+
+ GetScaledSize(sw);
+
BuildTable(sw);
}
-static void
+static void
Autoscale(ScaleWidget sw)
{
GetScaleValues(sw);
@@ -721,27 +721,27 @@ Autoscale(ScaleWidget sw)
Precision(sw);
GetScaledSize(sw);
-
+
BuildTable(sw);
}
-static void
+static void
PositionImage(ScaleWidget sw)
{
/*
* Set as if for ForgegGravity (that is center the image)
*/
- sw->scale.x = (Position)
+ sw->scale.x = (Position)
(sw->core.width - sw->scale.width) / 2;
sw->scale.y = (Position)
(sw->core.height - sw->scale.height) / 2;
-
+
/*****
- if (sw->scale.gravity & WestGravity) {
+ if (sw->scale.gravity & WestGravity) {
}
- if (sw->scale.gravity & EastGravity) {
+ if (sw->scale.gravity & EastGravity) {
}
if (sw->scale.gravity & NorthGravity) {
}
@@ -752,38 +752,38 @@ PositionImage(ScaleWidget sw)
-static void
+static void
Resize(Widget w)
{
ScaleWidget sw = (ScaleWidget) w;
-
+
if (sw->scale.autoscale) Autoscale(sw);
-
+
PositionImage(sw);
}
-static void
+static void
Realize(Widget wid, Mask *vmask, XSetWindowAttributes *attr)
{
ScaleWidget sw = (ScaleWidget) wid;
XtCreateWindow(wid, (unsigned int) InputOutput,
(Visual *) sw->scale.visual, *vmask, attr);
}
-
+
-static void
+static void
Destroy(Widget w)
{
- ScaleWidget sw = (ScaleWidget) w;
+ ScaleWidget sw = (ScaleWidget) w;
XtFree((char *) sw->scale.table.x);
XtFree((char *) sw->scale.table.y);
XtFree((char *) sw->scale.table.width);
XtFree((char *) sw->scale.table.height);
-
+
XtFree((char *) sw->scale.rectangles);
XtReleaseGC(w, sw->scale.gc);
@@ -794,8 +794,8 @@ Destroy(Widget w)
/* ARGSUSED */
-static Boolean
-SetValues(Widget current, Widget request, Widget new,
+static Boolean
+SetValues(Widget current, Widget request, Widget new,
ArgList args, Cardinal *num_args)
{
ScaleWidget cur_sw = (ScaleWidget) current;
@@ -803,30 +803,30 @@ SetValues(Widget current, Widget request, Widget new,
ScaleWidget new_sw = (ScaleWidget) new;
Boolean redisplay = False;
Cardinal i;
-
+
for (i = 0; i < *num_args; i++) {
if (streq(XtNbackground, args[i].name)) {
- XSetBackground(XtDisplay(new), new_sw->scale.gc,
+ XSetBackground(XtDisplay(new), new_sw->scale.gc,
new_sw->core.background_pixel);
}
if (streq(XtNforeground, args[i].name)) {
- XSetForeground(XtDisplay(new), new_sw->scale.gc,
+ XSetForeground(XtDisplay(new), new_sw->scale.gc,
new_sw->scale.foreground_pixel);
}
if (streq(XtNimage, args[i].name)) {
XDestroyImage(cur_sw->scale.image);
if (new_sw->scale.image == NULL)
new_sw->scale.image = XCreateImage(XtDisplay(new),
- DefaultVisual(XtDisplay(new),
+ DefaultVisual(XtDisplay(new),
DefaultScreen(XtDisplay(new))),
- 1, XYBitmap, 0,
+ 1, XYBitmap, 0,
XtCalloc(1, sizeof(char)),
1, 1, 8, 0);
else
- new_sw->scale.image =
- XSubImage(new_sw->scale.image,
- 0, 0,
- new_sw->scale.image->width,
+ new_sw->scale.image =
+ XSubImage(new_sw->scale.image,
+ 0, 0,
+ new_sw->scale.image->width,
new_sw->scale.image->height);
if (new_sw->scale.resize)
@@ -841,7 +841,7 @@ SetValues(Widget current, Widget request, Widget new,
redisplay = True;
}
- if (streq(XtNuserData, args[i].name))
+ if (streq(XtNuserData, args[i].name))
new_sw->scale.userData = (XtPointer)args[i].value;
if (streq(XtNbufferSize, args[i].name)) {
@@ -851,7 +851,7 @@ SetValues(Widget current, Widget request, Widget new,
}
if (streq(XtNaspectRatio, args[i].name)) {
- if ((new_sw->scale.aspect_ratio =
+ if ((new_sw->scale.aspect_ratio =
atof(new_sw->scale.aspect_ratio_str)) < 0.0) {
new_sw->scale.aspect_ratio = cur_sw->scale.aspect_ratio;
XtWarning("AspectRatio has to be a positive number.");
@@ -867,7 +867,7 @@ SetValues(Widget current, Widget request, Widget new,
}
}
}
-
+
if (streq(XtNproportional, args[i].name)) {
if (new_sw->scale.proportional != cur_sw->scale.proportional) {
if (new_sw->scale.proportional) Proportional(new_sw);
@@ -878,21 +878,21 @@ SetValues(Widget current, Widget request, Widget new,
redisplay = True;
}
}
-
+
if (streq(XtNscaleX, args[i].name)
- ||
+ ||
streq(XtNscaleY, args[i].name)) {
if (new_sw->scale.scale_x_str == DefaultScaleFactor
- ||
+ ||
new_sw->scale.scale_y_str == DefaultScaleFactor)
GetInitialScaleValues(new_sw);
else {
- if ((new_sw->scale.scale_x =
+ if ((new_sw->scale.scale_x =
atof(new_sw->scale.scale_x_str)) < 0.0) {
new_sw->scale.scale_x = cur_sw->scale.scale_x;
XtWarning("ScaleValue has to be a positive number.");
}
- if ((new_sw->scale.scale_y =
+ if ((new_sw->scale.scale_y =
atof(new_sw->scale.scale_y_str)) < 0.0) {
new_sw->scale.scale_y = cur_sw->scale.scale_y;
XtWarning("ScaleValue has to be a positive number.");
@@ -901,24 +901,24 @@ SetValues(Widget current, Widget request, Widget new,
if (new_sw->scale.scale_x != cur_sw->scale.scale_x
||
new_sw->scale.scale_y != cur_sw->scale.scale_y) {
-
+
/*?*?*?*?*?*?*?*?*?*?*?*?*?*?**?*?*?*?*?*?*?*?*?***?*/
fprintf(stderr, "================>>%f %f\n",
new_sw->scale.scale_x, new_sw->scale.scale_y);
-
+
if (new_sw->scale.proportional) Proportional(new_sw);
Precision(new_sw);
if (new_sw->scale.resize)
TryResize(new_sw);
- GetScaledSize(new_sw);
+ GetScaledSize(new_sw);
BuildTable(new_sw);
PositionImage(new_sw);
redisplay = True;
}
}
-
+
if (streq(XtNprecision, args[i].name)) {
- if ((new_sw->scale.precision =
+ if ((new_sw->scale.precision =
atof(new_sw->scale.precision_str)) < 0.0) {
new_sw->scale.precision = cur_sw->scale.precision;
XtWarning("Precision has to be a positive number.");
@@ -926,19 +926,19 @@ SetValues(Widget current, Widget request, Widget new,
if (new_sw->scale.precision != cur_sw->scale.precision) {
if (new_sw->scale.proportional) Proportional(new_sw);
Precision(new_sw);
- GetScaledSize(new_sw);
+ GetScaledSize(new_sw);
BuildTable(new_sw);
PositionImage(new_sw);
redisplay = True;
}
}
- }
+ }
return(redisplay);
}
-void
+void
SWUnscale(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
ScaleWidget sw = (ScaleWidget) w;
@@ -950,7 +950,7 @@ SWUnscale(Widget w, XEvent *event, String *params, Cardinal *num_params)
-void
+void
SWAutoscale(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
ScaleWidget sw = (ScaleWidget) w;
@@ -962,18 +962,18 @@ SWAutoscale(Widget w, XEvent *event, String *params, Cardinal *num_params)
-void
+void
SWInitialSize(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
ScaleWidget sw = (ScaleWidget) w;
-
+
GetInitialScaleValues(sw);
if (sw->scale.proportional) Proportional(sw);
Precision(sw);
if (sw->scale.resize)
TryResize(sw);
- GetScaledSize(sw);
+ GetScaledSize(sw);
BuildTable(sw);
PositionImage(sw);
XClearArea(XtDisplay(w), XtWindow(w), 0, 0, 0, 0, True);
@@ -981,12 +981,12 @@ SWInitialSize(Widget w, XEvent *event, String *params, Cardinal *num_params)
-void
+void
SWSetImage(Widget w, XImage *image)
{
int n;
Arg wargs[2];
-
+
n = 0;
XtSetArg(wargs[n], XtNimage, (XtArgVal) image); n++;
XtSetValues(w, wargs, n);
@@ -995,7 +995,7 @@ SWSetImage(Widget w, XImage *image)
-void
+void
RequestSelection(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
SWRequestSelection(w, event->xbutton.time);
@@ -1003,7 +1003,7 @@ RequestSelection(Widget w, XEvent *event, String *params, Cardinal *num_params)
-void
+void
GrabSelection(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
SWGrabSelection(w, event->xbutton.time);
@@ -1011,20 +1011,20 @@ GrabSelection(Widget w, XEvent *event, String *params, Cardinal *num_params)
-Pixmap
+Pixmap
SWGetPixmap(Widget w)
{
ScaleWidget sw = (ScaleWidget) w;
Pixmap pixmap;
- pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w),
- sw->scale.width,
- sw->scale.height,
+ pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w),
+ sw->scale.width,
+ sw->scale.height,
sw->scale.image->depth);
- ScaleImage(sw, pixmap,
- 0, 0, 0, 0,
- (Dimension) sw->scale.image->width,
+ ScaleImage(sw, pixmap,
+ 0, 0, 0, 0,
+ (Dimension) sw->scale.image->width,
(Dimension) sw->scale.image->height);
-
+
return(pixmap);
}
diff --git a/Scale.h b/Scale.h
index 68a2b68..4863d17 100644
--- a/Scale.h
+++ b/Scale.h
@@ -108,19 +108,19 @@ extern WidgetClass scaleWidgetClass;
typedef struct _ScaleClassRec *ScaleWidgetClass;
typedef struct _ScaleRec *ScaleWidget;
-extern int SWGetImagePixel ( Widget w, Position x, Position y,
- Position *img_x, Position *img_y,
+extern int SWGetImagePixel ( Widget w, Position x, Position y,
+ Position *img_x, Position *img_y,
Pixel *img_pixel );
-extern void SWUnscale ( Widget w, XEvent *event, String *params,
+extern void SWUnscale ( Widget w, XEvent *event, String *params,
Cardinal *num_params );
-extern void SWAutoscale ( Widget w, XEvent *event, String *params,
+extern void SWAutoscale ( Widget w, XEvent *event, String *params,
Cardinal *num_params );
-extern void SWInitialSize ( Widget w, XEvent *event, String *params,
+extern void SWInitialSize ( Widget w, XEvent *event, String *params,
Cardinal *num_params );
extern void SWSetImage ( Widget w, XImage *image );
-extern void RequestSelection ( Widget w, XEvent *event, String *params,
+extern void RequestSelection ( Widget w, XEvent *event, String *params,
Cardinal *num_params );
-extern void GrabSelection ( Widget w, XEvent *event, String *params,
+extern void GrabSelection ( Widget w, XEvent *event, String *params,
Cardinal *num_params );
extern Pixmap SWGetPixmap ( Widget w );
diff --git a/xmag.c b/xmag.c
index 0fca602..e1d6505 100644
--- a/xmag.c
+++ b/xmag.c
@@ -85,14 +85,14 @@ from The Open Group.
#endif
/* highlight mode */
-typedef enum { drag, resize, done } hlMode;
+typedef enum { drag, resize, done } hlMode;
/* highlight data structure */
-typedef struct {
+typedef struct {
Boolean newScale;
hlMode selectMode;
GC gc;
- XWindowAttributes win_info;
+ XWindowAttributes win_info;
XImage *image;
Position homeX, homeY, x, y;
Dimension width, height;
@@ -106,7 +106,7 @@ static XtAppContext app;
static Cursor ulAngle, urAngle, lrAngle, llAngle;
static Display *dpy;
static int scr;
-static GC selectGC;
+static GC selectGC;
static XGCValues selectGCV;
static Widget toplevel, root;
static Atom wm_delete_window;
@@ -170,7 +170,7 @@ static XrmOptionDescRec optionDesc[] = {
{"-bd", "*borderColor", XrmoptionSepArg, (XtPointer)NULL},
{"-bg", "*background", XrmoptionSepArg, (XtPointer)NULL},
{"-bw", "*borderWidth", XrmoptionSepArg, (XtPointer)NULL},
-
+
{"-geometry", "*geometry", XrmoptionSepArg, (XtPointer)NULL},
{"-mag", "*mag", XrmoptionSepArg, (XtPointer)NULL},
{"-source", "*source", XrmoptionSepArg, (XtPointer)NULL},
@@ -199,7 +199,7 @@ static XtActionsRec actions_table[] = {
* Error() -- Error handler: Catch a bad match in magnifying an
* area that contains bits of different depths.
*/
-static int
+static int
Error(Display *dpy, XErrorEvent *err)
{
(void) XmuPrintDefaultErrorMessage (dpy, err, stderr);
@@ -209,7 +209,7 @@ Error(Display *dpy, XErrorEvent *err)
/*
* CloseAP() -- Close this dialog. If its the last one exit the program.
- *
+ *
*/
static void /* ARGSUSED */
CloseAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
@@ -219,7 +219,7 @@ CloseAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
if (event->type != ClientMessage) {
n = 0; /* get user data */
XtSetArg(wargs[0], XtNuserData, &data); n++;
- XtGetValues(w, wargs, n);
+ XtGetValues(w, wargs, n);
w = data->scaleShell;
}
XtPopdown(w);
@@ -230,7 +230,7 @@ CloseAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
/*
* SetCmapPropsAP() -- Put the scale widget first in WM_COLORMAP_WINDOWS
- *
+ *
*/
static void /* ARGSUSED */
SetCmapPropsAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
@@ -250,7 +250,7 @@ SetCmapPropsAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
/*
* UnsetCmapPropsAP() -- Put the shell first in WM_COLORMAP_WINDOWS
- *
+ *
*/
static void /* ARGSUSED */
UnsetCmapPropsAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
@@ -289,7 +289,7 @@ ReplaceAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
Arg wargs[2]; int n; hlPtr data;
n = 0; /* get user data */
XtSetArg(wargs[0], XtNuserData, &data); n++;
- XtGetValues(w, wargs, n);
+ XtGetValues(w, wargs, n);
StartRootPtrGrab(False, data);
}
@@ -317,13 +317,13 @@ PopupPixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
XtSetArg(wargs[n], XtNheight, &scale_height); n++;
XtGetValues(w, wargs, n);
XtTranslateCoords(w, -1, -1, &scale_x, &scale_y);
-
+
XtRealizeWidget(data->pixShell); /* to get the right height */
n = 0;
XtSetArg(wargs[n], XtNheight, &label_height); n++;
XtGetValues(data->pixShell, wargs, n);
-
+
if ((double) event->xbutton.y / (double) scale_height > 0.5) {
label_x = scale_x;
label_y = scale_y;
@@ -371,7 +371,7 @@ UpdatePixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
pixel, x + data->x, y + data->y,
color.red, color.green, color.blue);
n = 0;
- XtSetArg(wargs[n], XtNlabel, string); n++;
+ XtSetArg(wargs[n], XtNlabel, string); n++;
XtSetValues(data->pixLabel, wargs, n);
XtPopup(data->pixShell, XtGrabNone);
}
@@ -388,7 +388,7 @@ PopdownPixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
int n;
Arg wargs[3];
hlPtr data = NULL;
-
+
n = 0;
XtSetArg(wargs[0], XtNuserData, &data); n++;
XtGetValues(w, wargs, n);
@@ -401,14 +401,14 @@ PopdownPixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
static void /* ARGSUSED */
SelectRegionAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
-/***** NOT SURE WHAT TO DO WITH THIS
+{
+/***** NOT SURE WHAT TO DO WITH THIS
if (app_resources.unmap)
XtUnmapWidget(toplevel);
Redisplay(XtDisplay(w), RootWindow(XtDisplay(w),
DefaultScreen(XtDisplay(w))),
- source.width, source.height,
- app_resources.freq, app_resources.puls,
+ source.width, source.height,
+ app_resources.freq, app_resources.puls,
ul_angle, lr_angle,
app_resources.grab);
@@ -419,19 +419,19 @@ SelectRegionAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
-/*
+/*
* CheckPoints() -- Change the cursor for the correct quadrant.
- * Make sure the first point is less than the second
+ * Make sure the first point is less than the second
* for drawing the selection rectangle.
*
*/
-static void
+static void
CheckPoints(Position *x1, Position *x2, Position *y1, Position *y2)
{
- Position tmp;
+ Position tmp;
Boolean above, left;
Cursor newC;
- above = (*y2 < *y1); left = (*x2 < *x1);
+ above = (*y2 < *y1); left = (*x2 < *x1);
if (above&&left) newC = ulAngle;
else if (above&&!left) newC = urAngle;
else if (!above&&!left) newC = lrAngle;
@@ -454,24 +454,24 @@ HighlightTO(XtPointer closure, XtIntervalId *id) /* ARGSUSED */
hlPtr data = (hlPtr)closure;
XGrabServer(dpy);
if (data->selectMode == drag) {
- XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc,
+ XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc,
data->x, data->y, data->width, data->height);
XFlush(dpy);
HLSLEEP;
- XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc,
+ XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc,
data->x, data->y, data->width, data->height);
}
- else if (data->selectMode == resize) {
+ else if (data->selectMode == resize) {
Position x1 = data->homeX,
x2 = data->x,
y1 = data->homeY,
y2 = data->y;
CheckPoints(&x1, &x2, &y1, &y2);
- XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc,
+ XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc,
x1, y1, x2 - x1, y2 - y1);
XFlush(dpy);
HLSLEEP;
- XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc,
+ XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc,
x1, y1, x2 - x1, y2 - y1);
}
XUngrabServer(dpy);
@@ -546,7 +546,7 @@ PasteCB(Widget w, XtPointer clientData, XtPointer callData)
/*
* SetupGC() -- Graphics context for magnification selection.
*/
-static void
+static void
SetupGC(void)
{
selectGCV.function = GXxor;
@@ -554,7 +554,7 @@ SetupGC(void)
selectGCV.subwindow_mode = IncludeInferiors;
selectGC = XtGetGC(toplevel, GCFunction|GCForeground|GCSubwindowMode,
&selectGCV);
-}
+}
@@ -562,7 +562,7 @@ SetupGC(void)
* FindWindow() -- Determine window the pointer is over.
*
*/
-static Window
+static Window
FindWindow(int x, int y) /* Location of cursor */
{
XWindowAttributes wa;
@@ -572,7 +572,7 @@ FindWindow(int x, int y) /* Location of cursor */
stopW = findW;
while (stopW) {
- XTranslateCoordinates(dpy, findW, stopW,
+ XTranslateCoordinates(dpy, findW, stopW,
x, y, &x, &y, &childW);
findW = stopW;
/* If child is not InputOutput (for example, InputOnly) */
@@ -592,15 +592,15 @@ FindWindow(int x, int y) /* Location of cursor */
/*
* ResizeEH() -- Event Handler for resize of selection box.
*/
-static void
-ResizeEH(Widget w, XtPointer closure, XEvent *event,
+static void
+ResizeEH(Widget w, XtPointer closure, XEvent *event,
Boolean *continue_to_dispatch) /* ARGSUSED */
{
hlPtr data = (hlPtr)closure;
switch (event->type) {
case MotionNotify:
data->x = event->xmotion.x_root;
- data->y = event->xmotion.y_root;
+ data->y = event->xmotion.y_root;
break;
case ButtonRelease:
GetImageAndAttributes(FindWindow(event->xmotion.x_root,
@@ -612,7 +612,7 @@ ResizeEH(Widget w, XtPointer closure, XEvent *event,
data);
if (data->newScale)
PopupNewScale(data);
- else
+ else
SWSetImage(data->scaleInstance, data->image);
XtUngrabPointer(w, CurrentTime);
/*****
@@ -631,8 +631,8 @@ ResizeEH(Widget w, XtPointer closure, XEvent *event,
/*
* DragEH() -- Event Handler for dragging selection box.
*/
-static void
-DragEH(Widget w, XtPointer closure, XEvent *event,
+static void
+DragEH(Widget w, XtPointer closure, XEvent *event,
Boolean *continue_to_dispatch) /* ARGSUSED */
{
hlPtr data = (hlPtr)closure;
@@ -648,9 +648,9 @@ DragEH(Widget w, XtPointer closure, XEvent *event,
* where the depth of the window does not match the depth of
* the root window.
*/
- GetImageAndAttributes(FindWindow(event->xmotion.x_root,
+ GetImageAndAttributes(FindWindow(event->xmotion.x_root,
event->xmotion.y_root),
- event->xbutton.x_root,
+ event->xbutton.x_root,
event->xbutton.y_root,
srcWidth, srcHeight, data);
if (data->newScale)
@@ -665,21 +665,21 @@ DragEH(Widget w, XtPointer closure, XEvent *event,
}
break;
- case ButtonPress:
+ case ButtonPress:
if (event->xbutton.button == Button2) { /* turn on resize mode */
- data->homeX = event->xbutton.x_root;
+ data->homeX = event->xbutton.x_root;
data->homeY = event->xbutton.y_root;
data->x = event->xbutton.x_root + srcWidth;
- data->y = event->xbutton.y_root + srcHeight;
+ data->y = event->xbutton.y_root + srcHeight;
data->selectMode = resize;
XtRemoveRawEventHandler(w, PointerMotionMask|ButtonPressMask|
ButtonReleaseMask, True, DragEH, (XtPointer)data);
XChangeActivePointerGrab
(dpy, PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
lrAngle, CurrentTime);
- XWarpPointer(dpy, None, None, 0, 0, 0, 0,
+ XWarpPointer(dpy, None, None, 0, 0, 0, 0,
srcWidth, srcHeight);
- XtAddEventHandler(w, PointerMotionMask|ButtonReleaseMask,
+ XtAddEventHandler(w, PointerMotionMask|ButtonReleaseMask,
True, ResizeEH, (XtPointer)data);
}
break;
@@ -691,7 +691,7 @@ DragEH(Widget w, XtPointer closure, XEvent *event,
/*
* StartRootPtrGrab() -- Bring up the selection box.
- *
+ *
*/
static void
StartRootPtrGrab(int new, /* do we create a new scale instance? */
@@ -705,7 +705,7 @@ StartRootPtrGrab(int new, /* do we create a new scale instance? */
(root, False,
PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, ulAngle, CurrentTime);
- XQueryPointer(dpy, DefaultRootWindow(dpy), &rootR, &childR,
+ XQueryPointer(dpy, DefaultRootWindow(dpy), &rootR, &childR,
&rootX, &rootY, &winX, &winY, &mask);
if (new) {
numXmags++;
@@ -720,7 +720,7 @@ StartRootPtrGrab(int new, /* do we create a new scale instance? */
hlData->width = srcWidth;
hlData->height = srcHeight;
XtAddRawEventHandler
- (root, PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
+ (root, PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
True, DragEH, (XtPointer)hlData);
(void) XtAppAddTimeOut(app, HLINTERVAL, HighlightTO, (XtPointer)hlData);
}
@@ -738,7 +738,7 @@ CreateRoot(void)
hlPtr data;
root = XtCreateWidget("root", rootWindowWidgetClass, toplevel, NULL, 0);
XtRealizeWidget(root);
- if (XValue & srcStat && YValue &srcStat) {
+ if (XValue & srcStat && YValue &srcStat) {
numXmags = 1;
data = (hlPtr)XtMalloc(sizeof(hlStruct));
data = data;
@@ -749,7 +749,7 @@ CreateRoot(void)
data->gc = selectGC;
data->width = srcWidth;
data->height = srcHeight;
- GetImageAndAttributes(RootWindow(dpy, scr), srcX, srcY, srcWidth,
+ GetImageAndAttributes(RootWindow(dpy, scr), srcX, srcY, srcWidth,
srcHeight, data);
PopupNewScale(data);
return;
@@ -757,13 +757,13 @@ CreateRoot(void)
}
-/*
+/*
* GetImageAndAttributes() -- Get the image bits from the screen.
* We will also determine here the colormap, depth, and
- * visual to be used for the magnification image.
+ * visual to be used for the magnification image.
*/
-static void
-GetImageAndAttributes(Window w, int x, int y, int width, int height,
+static void
+GetImageAndAttributes(Window w, int x, int y, int width, int height,
hlPtr data)
{
/* get parameters of window being magnified */
@@ -842,22 +842,22 @@ GetImageAndAttributes(Window w, int x, int y, int width, int height,
* This function was taken from xwd (thanks Bob...)
*/
#define lowbit(x) ((x) & (~(x) + 1))
-static int
+static int
Get_XColors(XWindowAttributes *win_info, XColor **colors)
{
int i, ncolors;
-
+
if (!win_info->colormap)
return(0);
-
+
ncolors = win_info->visual->map_entries;
if (!(*colors = (XColor *) XtMalloc (sizeof(XColor) * ncolors)))
XtError("Out of memory!");
-
+
if (win_info->visual->class == DirectColor ||
win_info->visual->class == TrueColor) {
Pixel red, green, blue, red1, green1, blue1;
-
+
red = green = blue = 0;
red1 = lowbit(win_info->visual->red_mask);
green1 = lowbit(win_info->visual->green_mask);
@@ -881,9 +881,9 @@ Get_XColors(XWindowAttributes *win_info, XColor **colors)
(*colors)[i].pad = 0;
}
}
-
+
XQueryColors(dpy, win_info->colormap, *colors, ncolors);
-
+
return(ncolors);
}
@@ -900,12 +900,12 @@ GetMaxIntensity(hlPtr data)
XColor *colors = NULL, *mptr, *tptr;
int i, ncolors;
- if (data->win_info.colormap == DefaultColormap(dpy, scr))
+ if (data->win_info.colormap == DefaultColormap(dpy, scr))
return WhitePixel(dpy, scr);
- ncolors = Get_XColors(&data->win_info, &colors);
+ ncolors = Get_XColors(&data->win_info, &colors);
mptr = tptr = colors; tptr++;
for (i=1; i<ncolors; i++) {
- if ((int)Intensity(mptr) < (int)Intensity(tptr))
+ if ((int)Intensity(mptr) < (int)Intensity(tptr))
mptr = tptr;
tptr++;
}
@@ -925,13 +925,13 @@ GetMinIntensity(hlPtr data)
XColor *colors = NULL, *mptr, *tptr;
int i, ncolors;
- if (data->win_info.colormap == DefaultColormap(dpy, scr))
+ if (data->win_info.colormap == DefaultColormap(dpy, scr))
return BlackPixel(dpy, scr);
- ncolors = Get_XColors(&data->win_info, &colors);
+ ncolors = Get_XColors(&data->win_info, &colors);
mptr = tptr = colors; tptr++;
for (i=1; i<ncolors; i++) {
if ((int)Intensity(mptr) > (int)Intensity(tptr))
- mptr = tptr;
+ mptr = tptr;
tptr++;
}
/* Null pointer protection */
@@ -949,13 +949,13 @@ static Widget pane1, pane2, pane3, cclose, replace, new, select_w, paste;
/*
* PopupNewScale() -- Create and popup a new scale composite.
*/
-static void
+static void
PopupNewScale(hlPtr data)
{
Arg warg;
- data->scaleShell =
- XtVaCreatePopupShell("xmag", topLevelShellWidgetClass, toplevel,
+ data->scaleShell =
+ XtVaCreatePopupShell("xmag", topLevelShellWidgetClass, toplevel,
XtNgeometry, (XtArgVal)options.geometry,
XtNtitle, (XtArgVal)options.title,
NULL);
@@ -982,8 +982,8 @@ PopupNewScale(hlPtr data)
(Arg *) NULL, 0);
pane3 = XtCreateManagedWidget("pane2", panedWidgetClass, pane1,
(Arg *) NULL, 0);
- data->scaleInstance =
- XtVaCreateManagedWidget("scale", scaleWidgetClass,
+ data->scaleInstance =
+ XtVaCreateManagedWidget("scale", scaleWidgetClass,
pane3,
XtNvisual, (XtArgVal)data->win_info.visual,
XtNcolormap, (XtArgVal)data->win_info.colormap,
@@ -997,17 +997,17 @@ PopupNewScale(hlPtr data)
XtParseTranslationTable ("<Message>WM_PROTOCOLS: close()"));
XtSetArg(warg, XtNuserData, data);
XtSetValues(data->scaleInstance, &warg, 1);
- data->pixShell =
- XtVaCreatePopupShell("pixShell", overrideShellWidgetClass,
+ data->pixShell =
+ XtVaCreatePopupShell("pixShell", overrideShellWidgetClass,
toplevel,
XtNvisual, (XtArgVal)data->win_info.visual,
XtNcolormap, (XtArgVal)data->win_info.colormap,
XtNdepth, (XtArgVal)data->win_info.depth,
XtNborderWidth, (XtPointer)0,
NULL);
- data->pixLabel =
- XtVaCreateManagedWidget("pixLabel", labelWidgetClass,
- data->pixShell,
+ data->pixLabel =
+ XtVaCreateManagedWidget("pixLabel", labelWidgetClass,
+ data->pixShell,
XtNforeground, (XtPointer)GetMaxIntensity(data),
XtNbackground, (XtPointer)GetMinIntensity(data),
XtNborderWidth, (XtPointer)0,
@@ -1019,7 +1019,7 @@ PopupNewScale(hlPtr data)
(dpy, XtWindow(data->scaleShell), &wm_delete_window, 1);
}
if (data->win_info.colormap != DefaultColormap(dpy, scr)) {
- data->cmapWinList[0] = data->scaleShell;
+ data->cmapWinList[0] = data->scaleShell;
data->cmapWinList[1] = data->scaleInstance;
XtSetWMColormapWindows(data->scaleShell, data->cmapWinList, 2);
}
@@ -1046,10 +1046,10 @@ RedoOldScale(hlPtr data)
XtSetArg(wargs[n], XtNvisual, &oldVis); n++;
XtSetArg(wargs[n], XtNdepth, &oldDepth); n++;
XtSetArg(wargs[n], XtNcolormap, &oldCmap); n++;
- XtGetValues(data->scaleInstance, wargs, n);
+ XtGetValues(data->scaleInstance, wargs, n);
if (oldVis == data->win_info.visual && oldDepth == data->win_info.depth
&& oldCmap == data->win_info.colormap) {
- SWSetImage(data->scaleInstance, data->image);
+ SWSetImage(data->scaleInstance, data->image);
return;
}
/* get width and height, save and reuse them */
@@ -1064,7 +1064,7 @@ RedoOldScale(hlPtr data)
XtSetArg(wargs[n], XtNforeground, GetMaxIntensity(data)); n++;
XtSetArg(wargs[n], XtNbackground, GetMinIntensity(data)); n++;
XtSetValues(data->pixLabel, wargs, n);
- SWSetImage(data->scaleInstance, data->image);
+ SWSetImage(data->scaleInstance, data->image);
XtRealizeWidget(data->scaleInstance);
XtManageChild(data->scaleInstance);
}
@@ -1088,11 +1088,11 @@ InitCursors(void)
/*
* ParseSourceGeom() -- Determine dimensions of area to magnify from resources.
*/
-static void
+static void
ParseSourceGeom(void)
{
/* source */
- srcStat =
+ srcStat =
XParseGeometry(options.source, &srcX, &srcY, &srcWidth, &srcHeight);
if (!srcWidth) srcWidth = SRCWIDTH;
if (!srcHeight) srcHeight = SRCHEIGHT;
@@ -1106,11 +1106,11 @@ ParseSourceGeom(void)
/*
* Main program.
*/
-int
+int
main(int argc, char *argv[])
{
XSetErrorHandler(Error);
-
+
/* SUPPRESS 594 */
toplevel = XtAppInitialize(&app, "Xmag", optionDesc, XtNumber(optionDesc),
&argc, argv, NULL,
@@ -1125,7 +1125,7 @@ main(int argc, char *argv[])
"usage: xmag [-source geom] [-mag magfactor] [-toolkitoption]\n");
exit(1);
}
-
+
ParseSourceGeom();
XtAppAddActions(app, actions_table, XtNumber(actions_table));