1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00

DtWidget: Improve portability of Motif interface

- Add missing includes and prototypes
- Improve type compatibility
- Use <Xm/XmPrivate.h> for unofficial libXm headers

With this patch, dtpad no longer crashes on startup
on FreeBSD/amd64 because of a truncated 64-bit pointer.
This commit is contained in:
Marcin Cieslak 2012-08-31 01:17:48 +02:00 committed by Jon Trulson
parent 6e37640f11
commit ceb49b9130
14 changed files with 60 additions and 25 deletions

View file

@ -109,9 +109,13 @@ express or implied warranty.
#include <Xm/XmosP.h> /* for INT_MAX */
#include <Dt/DtMsgsP.h>
#include "ComboBoxP.h"
#include <Xm/DrawP.h>
#include <Xm/DisplayP.h>
#include <Xm/List.h>
#include <Xm/ComboBox.h> /* for redirecting utility functions */
#include "DtWidgetI.h" /* for _Dt thread-safety macros */
/* some unpublished Motif interfaces */
#include <Xm/XmPrivate.h>
/*
* MotifBc

View file

@ -59,12 +59,14 @@
#include <X11/Xos_r.h>
#include <Xm/GadgetP.h>
#include <Xm/DrawP.h>
#include <Xm/XmP.h>
#include <Dt/Control.h>
#include <Dt/ControlP.h>
#include <Xm/ManagerP.h>
#include <Dt/MacrosP.h>
#include <langinfo.h>
#include "DtWidgetI.h"
#include "DtSvcInternal.h"
/******** Public Function Declarations ********/
@ -577,7 +579,7 @@ BusyTimeout(
else
{
G_Set (g) = False;
G_BlinkTimer (g) = NULL;
G_BlinkTimer (g) = 0;
G_BlinkElapsed (g) = 0;
G_Busy (g) = 0;
(*call_callback) ((DtIconGadget) g, G_Callback (g), XmCR_BUSY_STOP, NULL);
@ -830,7 +832,7 @@ Initialize(
G_ControlType (new) != XmCONTROL_MAIL &&
G_ControlType (new) != XmCONTROL_MONITOR)
{
G_ControlType (new) == XmCONTROL_NONE;
G_ControlType (new) = XmCONTROL_NONE;
}
if (G_ControlType (new) == XmCONTROL_SWITCH)

View file

@ -274,7 +274,7 @@ DtDialogBoxClassRec dtDialogBoxClassRec =
{
XtInheritTranslations, /* default_translations */
NULL, /* get_resources */
NULL, /* num_get_resources */
0, /* num_get_resources */
NULL, /* get_cont_resources */
0, /* num_get_cont_resources */
XmInheritParentProcess, /* parent_process */
@ -788,7 +788,7 @@ CreateChildren(
XtSetArg (al[ac], XmNlabelString, string[i]); ac++;
}
XtSetArg (al[ac], XmNchildType, XmBUTTON); ac++;
sprintf (button_name, "%s_%d\0", M_Name (new), i+1);
sprintf (button_name, "%s_%d", M_Name (new), i+1);
btn = XmCreatePushButtonGadget ((Widget)new, button_name, al, ac);
XtManageChild (btn);
XtAddCallback (btn, XmNactivateCallback,

View file

@ -0,0 +1,2 @@
/* Additional import */
extern Pixmap _DtGetMask(Screen *screen, char *image_name);

View file

@ -1266,7 +1266,7 @@ LoadFile(
*/
loadError = Check4EnoughMemory( file_length );
if (loadError == DtEDITOR_INSUFFICIENT_MEMORY)
returnVal == loadError;
returnVal = loadError;
else {
/*

View file

@ -49,6 +49,7 @@
#include "EditorP.h"
#include "DtWidgetI.h"
#include <Xm/XmPrivate.h> /* _XmStringSourceGetString */
void
_DtEditorResetUndo(

View file

@ -69,6 +69,7 @@
# define NO_putwc
#elif defined(CSRG_BASED)
# include <wctype.h>
# include <wchar.h>
#endif /* linux */
#include <sys/wait.h>
@ -88,11 +89,17 @@
#include <Xm/MessageB.h>
#include <Xm/MwmUtil.h>
#include <Xm/TextF.h>
#include <Xm/LabelG.h>
#include <Xm/SeparatoG.h>
#include <Xm/PushBG.h>
#include <Xm/ToggleBG.h>
#include <Xm/RowColumn.h>
/* Need the following for _DtOkString */
#include <Dt/DtP.h>
#include <Dt/DtMsgsP.h>
#include <Dt/HourGlass.h>
#include "DtWidgetI.h"
@ -762,8 +769,10 @@ static XtActionsRec EditorActionTable[] = {
#endif /* _AIX */
#if !(defined(sun) && (_XOPEN_VERSION==3))
#if !(defined(__FreeBSD__))
# define iswblank(wc) iswctype((wc),blnkclass)
# undef getwc /* Use the libc function */
#endif
#if defined(__osf__) || defined(_AIX) /* __osf__ || _AIX */
/* function prototype for wctype() was changed to meet spec1170 */
/* digital compiler flagged warning */
@ -1344,13 +1353,13 @@ dtEditorClassRec =
/* XmForm Part
*/
{
(int) NULL, /* extension */
NULL, /* extension */
},
/* DtEditor Part
*/
{
(int) NULL, /* extension */
0, /* extension */
}
};

View file

@ -62,7 +62,9 @@
#include <Dt/DtMsgsP.h>
#include <Dt/Dnd.h>
#include "DtWidgetI.h"
#include "DtSvcInternal.h"
#include <Xm/XmPrivate.h> /* Motif _XmEnterGadget and friends */
/*-------------------------------------------------------------
** Public Interface
@ -527,7 +529,7 @@ static XmBaseClassExtRec iconBaseClassExtRec = {
(WidgetClass)&dtIconCacheObjClassRec, /* secondary class */
(XtInitProc)SecondaryObjectCreate, /* creation proc */
(XmGetSecResDataFunc) GetIconClassSecResData, /* getSecResData */
{NULL}, /* fast subclass */
{0}, /* fast subclass */
GetValuesPrehook, /* get_values prehook */
GetValuesPosthook, /* get_values posthook */
NULL, /* classPartInitPrehook */
@ -1717,10 +1719,10 @@ Initialize(
G_Armed (new) = False;
G_Mask (new) = NULL;
G_Mask (new) = None;
if (G_Pixmap (new) == XmUNSPECIFIED_PIXMAP)
G_Pixmap (new) = NULL;
G_Pixmap (new) = None;
if (G_ImageName (new) || G_Pixmap (new))
{
@ -1744,7 +1746,7 @@ Initialize(
{
/* warning? */
name = NULL;
G_Pixmap (new) = NULL;
G_Pixmap (new) = None;
}
}
@ -1830,7 +1832,7 @@ Initialize(
XmeGetDefaultRenderTable ((Widget)new, XmBUTTON_FONTLIST);
G_FontList (new) = XmFontListCopy (G_FontList (new));
if ((unsigned int)G_String (new) == (unsigned int)XmUNSPECIFIED_STRING)
if (G_String (new) == XmUNSPECIFIED_STRING)
G_String (new) = (_XmString) NULL;
if (G_String (new))
@ -2240,7 +2242,7 @@ SetValues(
else
{
name = NULL;
G_Pixmap (new) = NULL;
G_Pixmap (new) = None;
w = 0;
h = 0;
}
@ -2265,7 +2267,7 @@ SetValues(
if (G_Pixmap (new) != G_Pixmap (current))
{
if ((G_Pixmap (new) != NULL) &&
if ((G_Pixmap (new) != None) &&
(G_PixmapWidth (new) == w) &&
(G_PixmapHeight (new) == h))
{
@ -2292,7 +2294,7 @@ SetValues(
if (G_Mask(new) != XmUNSPECIFIED_PIXMAP)
XmDestroyPixmap (XtScreen(new),G_Mask (current));
XmDestroyPixmap (XtScreen(new),G_Pixmap (current));
G_Pixmap (new) = NULL;
G_Pixmap (new) = None;
G_PixmapWidth (new) = 0;
G_PixmapHeight (new) = 0;
}
@ -2693,7 +2695,7 @@ BorderUnhighlight( DtIconGadget g)
register int window_width;
register int window_height;
register highlight_width;
register int highlight_width;
CallCallbackProc call_callback;
window_width = g->rectangle.width;
@ -2856,6 +2858,7 @@ VisualChange(
else
return (False);
}
return (False);
}
@ -3326,8 +3329,8 @@ Draw(
if (((G_Behavior (g) == XmICON_BUTTON) && G_Armed (g)) ||
((G_Behavior (g) == XmICON_TOGGLE) &&
(!G_Set (g) && G_Armed (g)) ||
(G_Set (g) && !G_Armed (g))))
((!G_Set (g) && G_Armed (g)) ||
(G_Set (g) && !G_Armed (g)))))
shadow_type = XmSHADOW_IN;
else
shadow_type = XmSHADOW_OUT;
@ -3719,7 +3722,7 @@ _DtDuplicateIcon(
{
/* No pixmap to load */
G_ImageName(new) = NULL;
G_Pixmap(new) = NULL;
G_Pixmap(new) = None;
G_PixmapWidth(new) = 0;
G_PixmapHeight(new) = 0;
}

View file

@ -10,7 +10,7 @@ XCOMM $XConsortium: Imakefile /main/8 1996/04/21 19:11:16 drk $
#include <Threads.tmpl>
#ifndef DtWidgetDefines
# define DtWidgetDefines -DI18N_MSG -DXK_MISCELLANY -DMULTIBYTE
# define DtWidgetDefines -DI18N_MSG -DMULTIBYTE
#endif
DEFINES = DtWidgetDefines
#if defined(LinuxArchitecture)

View file

@ -63,6 +63,9 @@
#include <Xm/LabelP.h>
#include <Xm/MenuUtilP.h>
#include <Xm/DrawP.h>
#include <Xm/XmP.h>
#include <Xm/XmPrivate.h> /* _XmRecordEvent, _XmSetInDragMode, ... */
#include <X11/keysymdef.h>
#include "DtWidgetI.h"
@ -795,7 +798,7 @@ SetValues(
Boolean flag = FALSE;
Boolean adjustWidth = FALSE;
Boolean adjustHeight = FALSE;
unsigned char rowcol_type = NULL;
unsigned char rowcol_type = 0;
Display *dpy = XtDisplay(nw);
Boolean menu_glyph_changed = FALSE;
@ -911,7 +914,7 @@ Initialize(
Boolean adjustWidth = FALSE;
Boolean adjustHeight = FALSE;
Widget parent = XtParent(new_w);
unsigned char rowcol_type = NULL;
unsigned char rowcol_type = 0;
char *name = NULL;
if ((XmIsRowColumn (parent))) {

View file

@ -51,6 +51,7 @@
#include <Dt/TitleBox.h>
#include "DtWidgetI.h"
#include <ctype.h>
extern void _DtRegisterNewConverters( void ) ;

View file

@ -48,11 +48,15 @@
#include "EditorP.h"
#include <Xm/TextF.h>
#include <Xm/MessageB.h>
#include <Xm/List.h>
#include <ctype.h>
#include <limits.h>
#include <Dt/DtMsgsP.h>
#include <Dt/HourGlass.h>
#include "DtWidgetI.h"
#include <Xm/XmPrivate.h> /* _XmStringSourceGetString */
#define X_INCLUDE_STRING_H
#define XOS_USE_XT_LOCKING
#include <X11/Xos_r.h>

View file

@ -89,10 +89,14 @@ express or implied warranty.
*/
#include <Dt/DtMsgsP.h>
#include <Xm/DrawP.h>
#include <Xm/XmP.h>
#include <Xm/RepType.h>
#include "SpinBoxP.h"
#include "DtWidgetI.h"
#include <Xm/XmPrivate.h> /* _XmShellIsExclusive */
#ifdef I18N_MSG
#include <langinfo.h>
#endif
@ -1929,7 +1933,7 @@ SetTextFieldData(DtSpinBoxWidget spin)
}
else {
xm_string = (Items(spin))[Position(spin)];
if (text = GetTextString(xm_string)) {
if ((text = GetTextString(xm_string))) {
XtSetArg(arg, XmNvalue, text);
XtSetValues(Text(spin), &arg, 1);
XtFree(text);
@ -2201,7 +2205,7 @@ FinishUpDown( DtSpinBoxWidget spin,
repeat_delay, timer_dispatch, (XtPointer)spin);
/* Try to get Xevent */
if (arrow_data = (XmArrowButtonCallbackStruct*)arrow_call_data)
if ((arrow_data = (XmArrowButtonCallbackStruct*)arrow_call_data))
last_event = arrow_data->event;
/*
@ -2605,7 +2609,7 @@ DtSpinBoxDeletePos( Widget spinw,
/* To keep Position of SpinBox up to date */
if (Position(spin) > 0 &&
(Position(spin) >= total_items) || pos < Position(spin) )
((Position(spin) >= total_items) || pos < Position(spin)) )
Position(spin) = Position(spin) - 1;
if (pos < ItemCount(spin)) {

View file

@ -52,11 +52,13 @@
#include <Xm/GadgetP.h>
#endif /* RiversVersion == _31 */
#include <Xm/DrawP.h>
#include <Xm/XmP.h>
#include <Dt/TitleBoxP.h>
#include <Dt/MacrosP.h>
#include <Dt/DtMsgsP.h>
#include "DtWidgetI.h"
#include <Xm/XmPrivate.h> /* _XmClearShadowType */