diff --git a/cde/lib/DtSvc/DtUtil2/Imakefile b/cde/lib/DtSvc/DtUtil2/Imakefile index faf134691..522699449 100644 --- a/cde/lib/DtSvc/DtUtil2/Imakefile +++ b/cde/lib/DtSvc/DtUtil2/Imakefile @@ -10,13 +10,18 @@ XCOMM $TOG: Imakefile /main/14 1998/04/22 14:18:31 mgreess $ #include +#if CDE_USEXINERAMA +XINOPT = -DUSE_XINERAMA +#endif + #ifndef DtSvcDefines # define DtSvcDefines -DMULTIBYTE #endif DEPEND_DEFINES = $(DEPENDDEFINES) -DEFINES = DtSvcDefines \ +DEFINES = DtSvcDefines $(XINOPT) \ -DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\" \ -DCDE_CONFIGURATION_TOP=\"$(CDE_CONFIGURATION_TOP)\" + INCLUDES = -I. -I../include #ifdef SunArchitecture diff --git a/cde/lib/DtSvc/DtUtil2/SharedProcs.c b/cde/lib/DtSvc/DtUtil2/SharedProcs.c index f6a3b371f..1a5b94433 100644 --- a/cde/lib/DtSvc/DtUtil2/SharedProcs.c +++ b/cde/lib/DtSvc/DtUtil2/SharedProcs.c @@ -65,7 +65,9 @@ #include
#include
#include
- +#ifdef USE_XINERAMA +#include +#endif #include "SharedProcs.h" @@ -74,7 +76,8 @@ /******** Static Function Declarations ********/ - +static void MessageDialogPopupCB(Widget w, XtPointer client_data, + XtPointer call_data); /******** End Static Function Declarations ********/ @@ -247,17 +250,15 @@ _DtMessageDialog( else attributes.map_state = IsUnmapped; + /* + * If parent widget isn't mapped, attach a callback + * procedure that'll center the message dialog on screen. + */ if (attributes.map_state == IsUnmapped) - { - XtSetArg(args[0], XmNx, (WidthOfScreen(XtScreen (w)) - 350) / 2); - XtSetArg(args[1], XmNy, (HeightOfScreen(XtScreen (w)) - 200) / 2); - XtSetArg(args[2], XmNdefaultPosition, False); - XtSetValues(message, args, 3); - } - + XtAddCallback(XtParent(message),XmNpopupCallback, + MessageDialogPopupCB,(XtPointer)w); /* Adjust the decorations and title for the dialog shell of the dialog */ - XtSetArg(args[0], XmNtitle, title); XtSetArg(args[1], XmNmwmFunctions, MWM_FUNC_MOVE); XtSetArg(args[2], XmNmwmDecorations, MWM_DECOR_BORDER | MWM_DECOR_TITLE); @@ -365,4 +366,52 @@ _DtMessageClose( } } +/* + * Center a message dialog on screen once it is managed. + * client_data is expected to contain the parent shell widget handle. + */ +static void MessageDialogPopupCB(Widget w, XtPointer client_data, + XtPointer call_data) +{ + Position msg_x, msg_y; + unsigned int scr_w, scr_h, off_x=0, off_y=0; + Dimension msg_w=0, msg_h=0; + Arg args[2]; + #ifdef USE_XINERAMA + DtXineramaInfo_t *dt_xi; + #endif + msg_w=XtWidth(w); + msg_h=XtHeight(w); + + scr_w=WidthOfScreen(XtScreen(w)); + scr_h=HeightOfScreen(XtScreen(w)); + + #ifdef USE_XINERAMA + /* determine xinerama screen number the parent shell resides on, + * and override scr_w/scr_h and off_x/off_y on success */ + if((dt_xi=_DtXineramaInit(XtDisplay(w)))){ + int i; + unsigned int pw_x=XtX((Widget)client_data); + unsigned int pw_y=XtY((Widget)client_data); + + for(i=0; inumscreens; i++){ + unsigned int sw,sh,sx,sy; + _DtXineramaGetScreen(dt_xi,i,&sw,&sh,&sx,&sy); + if(pw_x>=sx && pw_x<(sx+sw) && pw_y>=sy && pw_y<(sy+sh)){ + off_x=sx; off_y=sy; + scr_w=sw; scr_h=sh; + break; + } + } + } + #endif /* USE_XINERAMA */ + + msg_x=off_x+(scr_w-msg_w)/2; + msg_y=off_y+(scr_h-msg_h)/2; + + XtSetArg(args[0],XmNx,msg_x); + XtSetArg(args[1],XmNy,msg_y); + XtSetValues(w,args,2); + XtRemoveCallback(w,XmNpopupCallback,MessageDialogPopupCB,client_data); +} diff --git a/cde/lib/DtSvc/Imakefile b/cde/lib/DtSvc/Imakefile index 3585cb8ba..8ec6c3bf6 100644 --- a/cde/lib/DtSvc/Imakefile +++ b/cde/lib/DtSvc/Imakefile @@ -2,6 +2,11 @@ XCOMM $TOG: Imakefile /main/16 1998/08/10 18:02:14 mgreess $ #define IHaveSubdirs #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' 'CXXDEBUGFLAGS=$(CXXDEBUGFLAGS)' +#if CDE_USEXINERAMA +XINOPT = -DUSE_XINERAMA +XINLIB = -lDtXinerama -lXinerama +#endif + SUBDIRS = include DtUtil1 DtUtil2 DtEncap DtCodelibs DtXpm DONES = DtUtil1/DONE DtUtil2/DONE DtEncap/DONE DtCodelibs/DONE DtXpm/DONE EXTRALIBRARYDEPS = $(DONES) @@ -24,18 +29,18 @@ DependSubdirs($(SUBDIRS)) #ifndef DtSvcDefines # define DtSvcDefines -DMULTIBYTE #endif -DEFINES = DtSvcDefines +DEFINES = DtSvcDefines $(XINOPT) INCLUDES = -I. #ifdef SharedDtSvcReqs #ifdef SunArchitecture -REQUIREDLIBS = SharedDtSvcReqs +REQUIREDLIBS = SharedDtSvcReqs $(XINLIB) #ifndef HasGcc2 SHLIBLDFLAGS = -G #endif #else -REQUIREDLIBS = SharedDtSvcReqs +REQUIREDLIBS = SharedDtSvcReqs $(XINLIB) #endif #endif diff --git a/cde/lib/DtXinerama/Imakefile b/cde/lib/DtXinerama/Imakefile index 21837dc45..70347b43a 100644 --- a/cde/lib/DtXinerama/Imakefile +++ b/cde/lib/DtXinerama/Imakefile @@ -39,5 +39,8 @@ OBJS = DtXinerama.o INCLUDES = -I. +XCOMM -fpic is required for static libDtXinerama to link with libDtSvc properly +CCOPTIONS += -fpic + DependTarget() diff --git a/cde/lib/Imakefile b/cde/lib/Imakefile index 2d0bfac8d..df37a00cc 100644 --- a/cde/lib/Imakefile +++ b/cde/lib/Imakefile @@ -12,8 +12,8 @@ PAMDIR = pam PAMDIR = #endif -SUBDIRS = $(PAMDIR) tt DtSvc DtSearch DtWidget DtHelp DtPrint DtTerm DtMrm \ - csa $(XINDIR) +SUBDIRS = $(XINDIR) $(PAMDIR) tt DtSvc DtSearch DtWidget DtHelp DtPrint \ + DtTerm DtMrm csa MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS))