summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-17 19:04:09 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-17 19:04:09 +0000
commita6af3b18cab309488fe918eb75a33fc4cac8fcb3 (patch)
treed507cb0bc901327c42afa4588c449a7054a1f3db
parent4c688ea7bec8b76e643d610577104e5519722be9 (diff)
merge XFree86 4.3.0.1 to -CURRENT
-rw-r--r--CutPaste.c35
-rw-r--r--RootWin.c9
-rw-r--r--Scale.c250
-rw-r--r--Scale.h19
-rw-r--r--Xmag.ad4
-rw-r--r--xmag.c196
-rw-r--r--xmag.man5
7 files changed, 247 insertions, 271 deletions
diff --git a/CutPaste.c b/CutPaste.c
index a110744..dc5c818 100644
--- a/CutPaste.c
+++ b/CutPaste.c
@@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-
+/* $XFree86: xc/programs/xmag/CutPaste.c,v 1.6 2001/12/14 20:02:11 dawes Exp $ */
/*
* Author: Davor Matic, MIT X Consortium
*/
@@ -37,19 +37,14 @@ from The Open Group.
#include <X11/Xatom.h>
#include "ScaleP.h" /* This file should be part of the Scale widget */
#include "Scale.h"
+#include "CutPaste.h"
#include <stdio.h>
-extern Pixmap SWGetPixmap();
-extern void SWAutoscale();
/*ARGSUSED*/
static Boolean
-ConvertSelection(w, selection, target, type, value, length, format)
- Widget w;
- Atom *selection, *target, *type;
- XtPointer *value;
- unsigned long *length;
- int *format;
+ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
+ XtPointer *value, unsigned long *length, int *format)
{
Boolean success;
@@ -88,9 +83,8 @@ ConvertSelection(w, selection, target, type, value, length, format)
return success;
}
-void SWGrabSelection(w, time)
- Widget w;
- Time time;
+void
+SWGrabSelection(Widget w, Time time)
{
(void) XtOwnSelection(w, XA_PRIMARY, time, ConvertSelection, NULL, NULL);
}
@@ -98,13 +92,9 @@ void SWGrabSelection(w, time)
/*ARGSUSED*/
static void
-SelectionCallback(w, client_data, selection, type, value, length, format)
- Widget w;
- XtPointer client_data; /* unused */
- Atom *selection, *type;
- XtPointer value;
- unsigned long *length;
- int *format;
+SelectionCallback(Widget w, XtPointer client_data, Atom *selection,
+ Atom *type, XtPointer value, unsigned long *length,
+ int *format)
{
if (*type == XA_PIXMAP) {
@@ -119,16 +109,15 @@ SelectionCallback(w, client_data, selection, type, value, length, format)
&width, &height, &border_width, &depth);
image = XGetImage(XtDisplay(w), *pixmap, 0, 0, width, height,
AllPlanes, ZPixmap);
- SWAutoscale(w);
+ SWAutoscale(w, NULL, NULL, NULL);
SWSetImage(w, image);
XtFree(value);
XDestroyImage(image);
}
}
-void SWRequestSelection(w, time)
- Widget w;
- Time time;
+void
+SWRequestSelection(Widget w, Time time)
{
XtGetSelectionValue(w, XA_PRIMARY, XA_PIXMAP, SelectionCallback, NULL,
time);
diff --git a/RootWin.c b/RootWin.c
index 8a5127a..1a247a0 100644
--- a/RootWin.c
+++ b/RootWin.c
@@ -26,13 +26,14 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/xmag/RootWin.c,v 1.5 2001/12/14 20:02:11 dawes Exp $ */
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include "RootWinP.h"
-static void Realize();
+static void Realize ( Widget w, XtValueMask *value_mask, XSetWindowAttributes *attributes );
RootWindowClassRec rootWindowClassRec = {
{ /* core fields */
@@ -77,10 +78,8 @@ RootWindowClassRec rootWindowClassRec = {
WidgetClass rootWindowWidgetClass = (WidgetClass)&rootWindowClassRec;
/*ARGSUSED*/
-static void Realize(w, value_mask, attributes)
- Widget w;
- XtValueMask *value_mask;
- XSetWindowAttributes *attributes;
+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 05f4b6a..5b5751d 100644
--- a/Scale.c
+++ b/Scale.c
@@ -26,36 +26,41 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/xmag/Scale.c,v 3.9 2001/12/14 20:02:11 dawes Exp $ */
/*
* Author: Davor Matic, MIT X Consortium
*/
+#include <stdio.h>
+#include <ctype.h>
+#include <math.h>
+#include <stdlib.h>
+#if defined(ISC) && __STDC__ && !defined(ISC30)
+extern double atof(char *);
+#endif
+
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xos.h>
#include <X11/Xaw/XawInit.h>
+#include "CutPaste.h"
#include "ScaleP.h"
-#include <stdio.h>
-#include <ctype.h>
-#include <math.h>
-
#define myrint(x) floor(x + 0.5)
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
+#define streq(a,b) (strcmp( (a), (b) ) == 0)
+#ifndef min
+#define min(x, y) ((x) > (y) ? (y) : (x))
+#endif
+#ifndef max
+#define max(x, y) ((x) < (y) ? (y) : (x))
#endif
-
#if defined(ISC) && __STDC__ && !defined(ISC30)
extern double atof(char *);
#endif
-#define streq(a,b) (strcmp( (a), (b) ) == 0)
-#define min(x, y) (x > y ? y : x)
-#define max(x, y) (x < y ? y : x)
-
#define DefaultBufferSize 1024
#define DefaultScaleFactor NULL
@@ -98,19 +103,39 @@ static XtResource resources[] = {
#undef Offset
-static void ClassInitialize();
-static void Initialize();
-static void Realize();
-static void Redisplay();
-static void Resize();
-static void Destroy();
-static Boolean SetValues();
-
-void SWUnscale();
-void SWAutoscale();
-void SWInitialSize();
-void RequestSelection();
-void GrabSelection();
+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,
+ 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,
+ Dimension width, Dimension height );
+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,
+ Position *img_x, Position *img_y, Pixel *img_pixel );
+static void Redisplay ( Widget w, XEvent *event, Region region );
+static void TryResize ( ScaleWidget sw );
+static void Precision ( ScaleWidget sw );
+static void Proportional ( ScaleWidget sw );
+static void GetScaledSize ( ScaleWidget sw );
+static void GetScaleValues ( ScaleWidget sw );
+static void Unscale ( ScaleWidget sw );
+static void Autoscale ( ScaleWidget sw );
+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,
+ ArgList args, Cardinal *num_args );
+
+
static XtActionsRec actions[] =
{
@@ -178,14 +203,15 @@ WidgetClass scaleWidgetClass = (WidgetClass) &scaleClassRec;
*/
-static void ClassInitialize()
+static void
+ClassInitialize(void)
{
}
-void GetGC(sw)
- ScaleWidget sw;
+static void
+GetGC(ScaleWidget sw)
{
XGCValues values;
@@ -202,10 +228,9 @@ void GetGC(sw)
-void Proportional();
-void GetInitialScaleValues(sw)
- ScaleWidget sw;
+static void
+GetInitialScaleValues(ScaleWidget sw)
{
if (sw->scale.proportional) {
sw->scale.scale_x = sw->scale.scale_y =
@@ -221,9 +246,8 @@ void GetInitialScaleValues(sw)
-void GetRectangleBuffer(sw, buffer_size)
- ScaleWidget sw;
- Cardinal buffer_size;
+static void
+GetRectangleBuffer(ScaleWidget sw, Cardinal buffer_size)
/*
* This procedure will realloc a new rectangles buffer.
* If the new buffer size is less than nrectangles, some
@@ -243,10 +267,8 @@ void GetRectangleBuffer(sw, buffer_size)
/* ARGSUSED */
-static void Initialize(request, new, args, num_args)
- Widget request, new;
- ArgList args;
- Cardinal *num_args;
+static void
+Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args)
{
ScaleWidget new_sw = (ScaleWidget) new;
@@ -315,8 +337,8 @@ static void Initialize(request, new, args, num_args)
-void BuildTable(sw)
- ScaleWidget sw;
+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
@@ -352,10 +374,8 @@ void BuildTable(sw)
-void FlushRectangles(sw, drawable, gc)
- ScaleWidget sw;
- Drawable drawable;
- GC gc;
+static void
+FlushRectangles(ScaleWidget sw, Drawable drawable, GC gc)
{
XFillRectangles(XtDisplay(sw), drawable, gc,
sw->scale.rectangles, sw->scale.nrectangles);
@@ -365,12 +385,9 @@ void FlushRectangles(sw, drawable, gc)
-void FillRectangle(sw, drawable, gc, x, y, width, height)
- ScaleWidget sw;
- Drawable drawable;
- GC gc;
- Position x, y;
- Dimension width, height;
+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)
@@ -386,12 +403,10 @@ void FillRectangle(sw, drawable, gc, x, y, width, height)
-void ScaleImage(sw, drawable, img_x, img_y, dst_x, dst_y, img_width,img_height)
- ScaleWidget sw;
- Drawable drawable;
- Position img_x, img_y;
- Position dst_x, dst_y;
- Dimension img_width, img_height;
+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
@@ -475,11 +490,10 @@ void ScaleImage(sw, drawable, img_x, img_y, dst_x, dst_y, img_width,img_height)
-int FindPixel(sw, x, y, img_x, img_y, img_pixel)
- ScaleWidget sw;
- Position x, y; /* (x,y) == (0,0) where image starts in sw window*/
- Position *img_x, *img_y;
- Pixel *img_pixel;
+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
||
@@ -512,11 +526,9 @@ int FindPixel(sw, x, y, img_x, img_y, img_pixel)
-int SWGetImagePixel(w, x, y, img_x, img_y, img_pixel)
- Widget w;
- Position x, y;
- Position *img_x, *img_y;
- Pixel *img_pixel;
+int
+SWGetImagePixel(Widget w, Position x, Position y,
+ Position *img_x, Position *img_y, Pixel *img_pixel)
{
ScaleWidget sw = (ScaleWidget) w;
@@ -532,10 +544,8 @@ int SWGetImagePixel(w, x, y, img_x, img_y, img_pixel)
/* ARGSUSED */
-static void Redisplay(w, event, region)
- Widget w;
- XEvent *event;
- Region region;
+static void
+Redisplay(Widget w, XEvent *event, Region region)
{
ScaleWidget sw = (ScaleWidget) w;
Position x, y, img_x, img_y;
@@ -586,8 +596,8 @@ static void Redisplay(w, event, region)
-void TryResize(sw)
- ScaleWidget sw;
+static void
+TryResize(ScaleWidget sw)
{
Dimension width, height;
XtGeometryResult result;
@@ -611,8 +621,8 @@ void TryResize(sw)
-void Precision(sw)
- ScaleWidget sw;
+static void
+Precision(ScaleWidget sw)
{
if (sw->scale.scale_x != 1.0)
sw->scale.scale_x = floor(sw->scale.scale_x / sw->scale.precision)
@@ -625,8 +635,8 @@ void Precision(sw)
-void Proportional(sw)
- ScaleWidget sw;
+static void
+Proportional(ScaleWidget sw)
{
float scale_x, scale_y;
@@ -662,8 +672,8 @@ void Proportional(sw)
-void GetScaledSize(sw)
- ScaleWidget sw;
+static void
+GetScaledSize(ScaleWidget sw)
{
sw->scale.width = (Dimension)
max(myrint(sw->scale.scale_x * sw->scale.image->width), 1);
@@ -673,8 +683,8 @@ void GetScaledSize(sw)
-void GetScaleValues(sw)
- ScaleWidget sw;
+static void
+GetScaleValues(ScaleWidget sw)
{
/*
* Make sure to subtract internal width and height.
@@ -691,8 +701,8 @@ void GetScaleValues(sw)
-void Unscale(sw)
- ScaleWidget sw;
+static void
+Unscale(ScaleWidget sw)
{
sw->scale.scale_x = sw->scale.scale_y = 1.0;
@@ -703,8 +713,8 @@ void Unscale(sw)
-void Autoscale(sw)
- ScaleWidget sw;
+static void
+Autoscale(ScaleWidget sw)
{
GetScaleValues(sw);
@@ -719,8 +729,8 @@ void Autoscale(sw)
-void PositionImage(sw)
- ScaleWidget sw;
+static void
+PositionImage(ScaleWidget sw)
{
/*
* Set as if for ForgegGravity (that is center the image)
@@ -744,8 +754,8 @@ void PositionImage(sw)
-static void Resize(w)
- Widget w;
+static void
+Resize(Widget w)
{
ScaleWidget sw = (ScaleWidget) w;
@@ -756,10 +766,8 @@ static void Resize(w)
-static void Realize(wid, vmask, attr)
- Widget wid;
- Mask *vmask;
- XSetWindowAttributes *attr;
+static void
+Realize(Widget wid, Mask *vmask, XSetWindowAttributes *attr)
{
ScaleWidget sw = (ScaleWidget) wid;
XtCreateWindow(wid, (unsigned int) InputOutput,
@@ -768,8 +776,8 @@ static void Realize(wid, vmask, attr)
-static void Destroy(w)
- Widget w;
+static void
+Destroy(Widget w)
{
ScaleWidget sw = (ScaleWidget) w;
@@ -788,16 +796,15 @@ static void Destroy(w)
/* ARGSUSED */
-static Boolean SetValues(current, request, new, args, num_args)
- Widget current, request, new;
- ArgList args;
- Cardinal *num_args;
+static Boolean
+SetValues(Widget current, Widget request, Widget new,
+ ArgList args, Cardinal *num_args)
{
ScaleWidget cur_sw = (ScaleWidget) current;
/* ScaleWidget req_sw = (ScaleWidget) request; */
ScaleWidget new_sw = (ScaleWidget) new;
Boolean redisplay = False;
- int i;
+ Cardinal i;
for (i = 0; i < *num_args; i++) {
if (streq(XtNbackground, args[i].name)) {
@@ -933,11 +940,8 @@ static Boolean SetValues(current, request, new, args, num_args)
-void SWUnscale(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+void
+SWUnscale(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
ScaleWidget sw = (ScaleWidget) w;
@@ -948,11 +952,8 @@ void SWUnscale(w, event, params, num_params)
-void SWAutoscale(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+void
+SWAutoscale(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
ScaleWidget sw = (ScaleWidget) w;
@@ -963,11 +964,8 @@ void SWAutoscale(w, event, params, num_params)
-void SWInitialSize(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+void
+SWInitialSize(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
ScaleWidget sw = (ScaleWidget) w;
@@ -985,9 +983,8 @@ void SWInitialSize(w, event, params, num_params)
-void SWSetImage(w, image)
- Widget w;
- XImage *image;
+void
+SWSetImage(Widget w, XImage *image)
{
int n;
Arg wargs[2];
@@ -999,34 +996,25 @@ void SWSetImage(w, image)
-extern void SWRequestSelection();
-void RequestSelection(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+void
+RequestSelection(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
SWRequestSelection(w, event->xbutton.time);
}
-extern void SWGrabSelection();
-
-void GrabSelection(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+void
+GrabSelection(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
SWGrabSelection(w, event->xbutton.time);
}
-Pixmap SWGetPixmap(w)
- Widget w;
+Pixmap
+SWGetPixmap(Widget w)
{
ScaleWidget sw = (ScaleWidget) w;
Pixmap pixmap;
diff --git a/Scale.h b/Scale.h
index 75be7f6..83bb48e 100644
--- a/Scale.h
+++ b/Scale.h
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/xmag/Scale.h,v 1.5 2001/12/14 20:02:11 dawes Exp $ */
#ifndef _XawScale_h
#define _XawScale_h
@@ -101,8 +102,6 @@ from The Open Group.
#define XtCvisual "Visual"
#define XtRvisual "Visual"
-extern void AWSetImage();
-extern void SWSetImage();
/* Class record constants */
@@ -111,5 +110,21 @@ 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,
+ Pixel *img_pixel );
+extern void SWUnscale ( Widget w, XEvent *event, String *params,
+ Cardinal *num_params );
+extern void SWAutoscale ( Widget w, XEvent *event, String *params,
+ Cardinal *num_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,
+ Cardinal *num_params );
+extern void GrabSelection ( Widget w, XEvent *event, String *params,
+ Cardinal *num_params );
+extern Pixmap SWGetPixmap ( Widget w );
+
#endif /* _XawScale_h */
diff --git a/Xmag.ad b/Xmag.ad
index 08fd004..0a24344 100644
--- a/Xmag.ad
+++ b/Xmag.ad
@@ -1,4 +1,5 @@
-.\ "$Xorg: Xmag.ad,v 1.3 2000/08/17 19:54:54 cpqbld Exp $
+! $Xorg: Xmag.ad,v 1.3 2000/08/17 19:54:54 cpqbld Exp $
+! $XFree86: xc/programs/xmag/Xmag.ad,v 1.2 2003/01/19 04:44:45 paulo Exp $
*Font: fixed
*pane2*orientation: horizontal
*pane2*showGrip: False
@@ -22,6 +23,5 @@
<Key>space:set()notify()unset()\n\
<Btn2Up>:set()notify()unset()\n\
<Btn3Up>:set()notify()unset()
-*pixLabel.Translations:<Enter>:popdown-pixel()
*helpLabel.font: 8x13bold
*helpLabel.label: xmag
diff --git a/xmag.c b/xmag.c
index 7b77b6a..7fa8040 100644
--- a/xmag.c
+++ b/xmag.c
@@ -26,33 +26,30 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/xmag/xmag.c,v 1.11 2003/01/19 04:44:45 paulo Exp $ */
+#include <stdlib.h> /* for exit() and abs() */
+#include <stdio.h>
+
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/Paned.h>
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Label.h>
#include <X11/Shell.h>
-#include "RootWin.h"
-#include "Scale.h"
#include <X11/cursorfont.h>
-
-#include <stdio.h>
#include <X11/Xmu/Error.h>
-
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h> /* for exit() and abs() */
-#endif
+#include "RootWin.h"
+#include "Scale.h"
+#include "CutPaste.h"
#define SRCWIDTH 64
#define SRCHEIGHT 64
-#define min(a, b) a < b ? a : b
-
-extern void SWGrabSelection();
-extern void SWRequestSelection();
-extern int SWGetImagePixel();
+#ifndef min
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#endif
@@ -93,6 +90,40 @@ static unsigned int srcWidth, srcHeight;
/* forward declarations */
+#if NeedFunctionPrototypes
+/* xmag.c */
+static int Error(Display *, XErrorEvent *);
+static void CloseAP(Widget, XEvent *, String *, Cardinal *);
+static void SetCmapPropsAP(Widget, XEvent *, String *, Cardinal *);
+static void UnsetCmapPropsAP(Widget, XEvent *, String *, Cardinal *);
+static void NewAP(Widget, XEvent *, String *, Cardinal *);
+static void ReplaceAP(Widget, XEvent *, String *, Cardinal *);
+static void PopupPixelAP(Widget, XEvent *, String *, Cardinal *);
+static void UpdatePixelAP(Widget, XEvent *, String *, Cardinal *);
+static void PopdownPixelAP(Widget, XEvent *, String *, Cardinal *);
+static void SelectRegionAP(Widget, XEvent *, String *, Cardinal *);
+static void CheckPoints(Position *, Position *, Position *, Position *);
+static void HighlightTO(XtPointer, XtIntervalId *);
+static void CloseCB(Widget, XtPointer, XtPointer);
+static void ReplaceCB(Widget, XtPointer, XtPointer);
+static void NewCB(Widget, XtPointer, XtPointer);
+static void SelectCB(Widget, XtPointer, XtPointer);
+static void PasteCB(Widget, XtPointer, XtPointer);
+static void SetupGC(void);
+static Window FindWindow(int, int);
+static void ResizeEH(Widget, XtPointer, XEvent *, Boolean *);
+static void DragEH(Widget, XtPointer, XEvent *, Boolean *);
+static void StartRootPtrGrab(int, hlPtr);
+static void CreateRoot(void);
+static void GetImageAndAttributes(Window, int, int, int, int, hlPtr);
+static int Get_XColors(XWindowAttributes *, XColor **);
+static Pixel GetMaxIntensity(hlPtr);
+static Pixel GetMinIntensity(hlPtr);
+static void PopupNewScale(hlPtr);
+static void RedoOldScale(hlPtr);
+static void InitCursors(void);
+static void ParseSourceGeom(void);
+#else
static void
CloseAP(),
SetCmapPropsAP(),
@@ -130,6 +161,7 @@ static int
static Pixel
GetMaxIntensity(),
GetMinIntensity();
+#endif
@@ -185,8 +217,7 @@ static XtActionsRec actions_table[] = {
* area that contains bits of different depths.
*/
static int
-Error(dpy, err)
- Display *dpy; XErrorEvent *err;
+Error(Display *dpy, XErrorEvent *err)
{
(void) XmuPrintDefaultErrorMessage (dpy, err, stderr);
return 0;
@@ -198,11 +229,7 @@ Error(dpy, err)
*
*/
static void /* ARGSUSED */
-CloseAP(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+CloseAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
Arg wargs[2]; int n; hlPtr data;
if (!--numXmags) exit(0);
@@ -223,11 +250,7 @@ CloseAP(w, event, params, num_params)
*
*/
static void /* ARGSUSED */
-SetCmapPropsAP(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+SetCmapPropsAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
Arg wargs[2]; int n; hlPtr data;
n = 0; /* get user data */
@@ -247,11 +270,7 @@ SetCmapPropsAP(w, event, params, num_params)
*
*/
static void /* ARGSUSED */
-UnsetCmapPropsAP(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+UnsetCmapPropsAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
Arg wargs[2]; int n; hlPtr data;
n = 0; /* get user data */
@@ -271,11 +290,7 @@ UnsetCmapPropsAP(w, event, params, num_params)
* FIND A BETTER WAY....
*/
static void /* ARGSUSED */
-NewAP(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+NewAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
StartRootPtrGrab(True, NULL);
}
@@ -286,11 +301,7 @@ NewAP(w, event, params, num_params)
* ReplaceAP() -- Replace this particular xmag dialog.
*/
static void /* ARGSUSED */
-ReplaceAP(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+ReplaceAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
Arg wargs[2]; int n; hlPtr data;
n = 0; /* get user data */
@@ -305,11 +316,7 @@ ReplaceAP(w, event, params, num_params)
* PopupPixelAP() -- Show pixel information.
*/
static void /* ARGSUSED */
-PopupPixelAP(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+PopupPixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
Position scale_x, scale_y;
Dimension scale_height;
@@ -348,7 +355,7 @@ PopupPixelAP(w, event, params, num_params)
XtSetArg(wargs[n], XtNy, label_y); n++;
XtSetValues(data->pixShell, wargs, n);
- UpdatePixelAP(w, event);
+ UpdatePixelAP(w, event, 0, 0);
}
@@ -357,11 +364,7 @@ PopupPixelAP(w, event, params, num_params)
* UpdatePixelAP() -- Update pixel information.
*/
static void /* ARGSUSED */
-UpdatePixelAP(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+UpdatePixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
Position x, y;
Pixel pixel;
@@ -380,7 +383,7 @@ UpdatePixelAP(w, event, params, num_params)
else {
color.pixel = pixel;
XQueryColor(dpy, data->win_info.colormap, &color);
- sprintf(string, "Pixel %d at (%d,%d) colored (%x,%x,%x).",
+ sprintf(string, "Pixel %ld at (%d,%d) colored (%x,%x,%x).",
pixel, x + data->x, y + data->y,
color.red, color.green, color.blue);
n = 0;
@@ -396,30 +399,24 @@ UpdatePixelAP(w, event, params, num_params)
* PopdownPixelAP() -- Remove pixel info.
*/
static void /* ARGSUSED */
-PopdownPixelAP(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+PopdownPixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
int n;
Arg wargs[3];
- hlPtr data;
+ hlPtr data = NULL;
n = 0;
XtSetArg(wargs[0], XtNuserData, &data); n++;
XtGetValues(w, wargs, n);
- XtPopdown(data->pixShell);
+
+ if (data)
+ XtPopdown(data->pixShell);
}
static void /* ARGSUSED */
-SelectRegionAP(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+SelectRegionAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
/***** NOT SURE WHAT TO DO WITH THIS
if (app_resources.unmap)
@@ -445,8 +442,7 @@ SelectRegionAP(w, event, params, num_params)
*
*/
static void
-CheckPoints(x1, x2, y1, y2)
- Position *x1, *x2, *y1, *y2; /* Coordinates */
+CheckPoints(Position *x1, Position *x2, Position *y1, Position *y2)
{
Position tmp;
Boolean above, left;
@@ -469,8 +465,7 @@ CheckPoints(x1, x2, y1, y2)
* HighlightTO() -- Timer to highlight the selection box
*/
static void
-HighlightTO(closure, id) /* ARGSUSED */
- XtPointer closure; XtIntervalId *id;
+HighlightTO(XtPointer closure, XtIntervalId *id) /* ARGSUSED */
{
hlPtr data = (hlPtr)closure;
XGrabServer(dpy);
@@ -503,8 +498,7 @@ HighlightTO(closure, id) /* ARGSUSED */
* then exit.
*/
static void /* ARGSUSED */
-CloseCB(w, clientData, callData)
- Widget w; XtPointer clientData, callData;
+CloseCB(Widget w, XtPointer clientData, XtPointer callData)
{
Widget shell = (Widget)clientData;
if (!--numXmags) exit(0);
@@ -518,8 +512,7 @@ CloseCB(w, clientData, callData)
* ReplaceCB() -- Replace this particular xmag dialog.
*/
static void /* ARGSUSED */
-ReplaceCB(w, clientData, callData)
- Widget w; XtPointer clientData, callData;
+ReplaceCB(Widget w, XtPointer clientData, XtPointer callData)
{
hlPtr data = (hlPtr)clientData;
StartRootPtrGrab(False, data);
@@ -531,8 +524,7 @@ ReplaceCB(w, clientData, callData)
* NewCB() -- Create an additional xmag dialog.
*/
static void /* ARGSUSED */
-NewCB(w, clientData, callData)
- Widget w; XtPointer clientData, callData;
+NewCB(Widget w, XtPointer clientData, XtPointer callData)
{
StartRootPtrGrab(True, NULL);
}
@@ -543,8 +535,7 @@ NewCB(w, clientData, callData)
* SelectCB() -- Own the primary selection.
*/
static void /* ARGSUSED */
-SelectCB(w, clientData, callData)
- Widget w; XtPointer clientData, callData;
+SelectCB(Widget w, XtPointer clientData, XtPointer callData)
{
hlPtr data = (hlPtr)clientData;
SWGrabSelection(data->scaleInstance, XtLastTimestampProcessed(dpy));
@@ -556,8 +547,7 @@ SelectCB(w, clientData, callData)
* PasteCB() -- Paste from the primary selectin into xmag.
*/
static void /* ARGSUSED */
-PasteCB(w, clientData, callData)
- Widget w; XtPointer clientData, callData;
+PasteCB(Widget w, XtPointer clientData, XtPointer callData)
{
hlPtr data = (hlPtr)clientData;
SWRequestSelection(data->scaleInstance, XtLastTimestampProcessed(dpy));
@@ -569,7 +559,7 @@ PasteCB(w, clientData, callData)
* SetupGC() -- Graphics context for magnification selection.
*/
static void
-SetupGC()
+SetupGC(void)
{
selectGCV.function = GXxor;
selectGCV.foreground = 1L;
@@ -585,8 +575,7 @@ SetupGC()
*
*/
static Window
-FindWindow(x, y)
- int x, y; /* Locatation of cursor */
+FindWindow(int x, int y) /* Locatation of cursor */
{
XWindowAttributes wa;
Window findW = DefaultRootWindow(dpy), stopW, childW;
@@ -611,8 +600,8 @@ FindWindow(x, y)
* ResizeEH() -- Event Handler for resize of selection box.
*/
static void
-ResizeEH(w, closure, event, continue_to_dispatch) /* ARGSUSED */
- Widget w; XtPointer closure; XEvent *event; Boolean *continue_to_dispatch;
+ResizeEH(Widget w, XtPointer closure, XEvent *event,
+ Boolean *continue_to_dispatch) /* ARGSUSED */
{
hlPtr data = (hlPtr)closure;
switch (event->type) {
@@ -650,8 +639,8 @@ ResizeEH(w, closure, event, continue_to_dispatch) /* ARGSUSED */
* DragEH() -- Event Handler for draging selection box.
*/
static void
-DragEH(w, closure, event, continue_to_dispatch) /* ARGSUSED */
- Widget w; XtPointer closure; XEvent *event; Boolean *continue_to_dispatch;
+DragEH(Widget w, XtPointer closure, XEvent *event,
+ Boolean *continue_to_dispatch) /* ARGSUSED */
{
hlPtr data = (hlPtr)closure;
switch (event->type) {
@@ -712,9 +701,8 @@ DragEH(w, closure, event, continue_to_dispatch) /* ARGSUSED */
*
*/
static void
-StartRootPtrGrab(new, data)
- Boolean new; /* do we cretate a new scale instance? */
- hlPtr data; /* highligh data */
+StartRootPtrGrab(int new, /* do we cretate a new scale instance? */
+ hlPtr data) /* highligh data */
{
Window rootR, childR;
int rootX, rootY, winX, winY;
@@ -752,7 +740,7 @@ StartRootPtrGrab(new, data)
* image.
*/
static void
-CreateRoot()
+CreateRoot(void)
{
hlPtr data;
root = XtCreateWidget("root", rootWindowWidgetClass, toplevel, NULL, 0);
@@ -782,8 +770,8 @@ CreateRoot()
* visual to be used for the magnification image.
*/
static void
-GetImageAndAttributes(w, x, y, width, height, data)
- Window w; int x, y, width, height; hlPtr data;
+GetImageAndAttributes(Window w, int x, int y, int width, int height,
+ hlPtr data)
{
/* get parameters of window being magnified */
XGetWindowAttributes(dpy, w, &data->win_info);
@@ -830,9 +818,7 @@ GetImageAndAttributes(w, x, y, width, height, data)
*/
#define lowbit(x) ((x) & (~(x) + 1))
static int
-Get_XColors(win_info, colors)
- XWindowAttributes *win_info;
- XColor **colors;
+Get_XColors(XWindowAttributes *win_info, XColor **colors)
{
int i, ncolors;
@@ -884,8 +870,7 @@ Get_XColors(win_info, colors)
* GetMaxIntensity() -- Find the maximum intensity pixel value for a colormap.
*/
static Pixel
-GetMaxIntensity(data)
- hlPtr data;
+GetMaxIntensity(hlPtr data)
{
XColor *colors = NULL, *mptr, *tptr;
int i, ncolors;
@@ -906,8 +891,7 @@ GetMaxIntensity(data)
* GetMinIntensity() -- Find the minimum intensity pixel value for a colormap.
*/
static Pixel
-GetMinIntensity(data)
- hlPtr data;
+GetMinIntensity(hlPtr data)
{
XColor *colors = NULL, *mptr, *tptr;
int i, ncolors;
@@ -933,8 +917,7 @@ static Widget pane1, pane2, pane3, cclose, replace, new, select_w, paste, label;
* PopupNewScale() -- Create and popup a new scale composite.
*/
static void
-PopupNewScale(data)
- hlPtr data;
+PopupNewScale(hlPtr data)
{
Arg warg;
@@ -1018,8 +1001,7 @@ PopupNewScale(data)
* widget.
*/
static void
-RedoOldScale(data)
- hlPtr data;
+RedoOldScale(hlPtr data)
{
Arg wargs[3];
int n;
@@ -1060,7 +1042,7 @@ RedoOldScale(data)
* InitCursors() -- Create our cursors for area selection.
*/
static void
-InitCursors()
+InitCursors(void)
{
ulAngle = XCreateFontCursor(dpy, XC_ul_angle);
urAngle = XCreateFontCursor(dpy, XC_ur_angle);
@@ -1074,7 +1056,7 @@ InitCursors()
* ParseSourceGeom() -- Determin dimensions of area to magnify from resources.
*/
static void
-ParseSourceGeom()
+ParseSourceGeom(void)
{
/* source */
srcStat =
@@ -1091,9 +1073,8 @@ ParseSourceGeom()
/*
* Main program.
*/
-void main(argc, argv)
- int argc;
- char **argv;
+int
+main(int argc, char *argv[])
{
XSetErrorHandler(Error);
@@ -1122,4 +1103,5 @@ void main(argc, argv)
StartRootPtrGrab(True, (hlPtr)NULL);
wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
XtAppMainLoop(app);
+ exit(0);
}
diff --git a/xmag.man b/xmag.man
index 5ecdf6d..adb3c51 100644
--- a/xmag.man
+++ b/xmag.man
@@ -22,7 +22,10 @@
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
-.TH XMAG 1 "Release 6.4" "X Version 11"
+.\"
+.\" $XFree86: xc/programs/xmag/xmag.man,v 1.7 2001/12/14 20:02:12 dawes Exp $
+.\"
+.TH XMAG 1 __xorgversion__
.SH NAME
xmag \- magnify parts of the screen
.SH SYNOPSIS