Add basic Xinerama support via new lib/DtXinerama
[oweals/cde.git] / cde / programs / dtlogin / dtchooser.c
index a2f24537099867671ebf48504a45c6d8374125e5..a6bc58a4a84d3be34a5d3fc85d474af52fee5d3c 100644 (file)
@@ -89,8 +89,9 @@
 #include       "vgmsg.h"
 #include        <Dt/MenuButton.h>
 
-
-
+#ifdef USE_XINERAMA
+#include <DtXinerama.h>
+#endif
 
 
 /***************************************************************************
@@ -264,6 +265,13 @@ static
        XtRString, sizeof(char *), XtOffset(AppInfoPtr, languageList),
        XtRString, NULL                                                 },
 
+#if defined(USE_XINERAMA)
+    { "xineramaPreferredScreen",        "XineramaPreferredScreen",
+        XtRInt, sizeof(int), XtOffset(AppInfoPtr, xineramaPreferredScreen),
+        XtRImmediate, (XtPointer) 0
+        },
+#endif
+
 #if defined (ENABLE_DYNAMIC_LANGLIST)
     {"languageListCmd", "LanguageListCmd",
         XtRString, sizeof(char *), XtOffset(AppInfoPtr, languageListCmd),
@@ -662,8 +670,9 @@ MakeDialog( DialogType dtype )
     Widget     w, text;
     Dimension  txt_width, txt_height;
     XmString   ok, cancel, nw, sv;
-    
-    
+
+    Widget      tlev;
+
     /*
      *  do things common to all dialogs...
      */
@@ -684,13 +693,25 @@ MakeDialog( DialogType dtype )
      *  create the various dialogs...
      */
 
+    /* JET - check the matte widget, and if non-null, well use that as
+     * the parent for dialogs.  Otherwise use table (the original
+     * toplevel widget for this func).  This is useful for Xinerama so
+     * that child dialogs are centered on the matte, and not the whole
+     * SLS screen.
+     */
+    if (matte != (Widget)NULL)
+      tlev = matte;
+    else
+      tlev = table;
+
+
     switch (dtype) {
 
     case error:
        xmstr = ReadCatalogXms(MC_ERROR_SET, MC_LOGIN, "");
        XtSetArg(argt[i], XmNmessageString,             xmstr           ); i++;
 
-       w = XmCreateErrorDialog(table, "error_message", argt, i);
+       w = XmCreateErrorDialog(tlev, "error_message", argt, i);
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_CANCEL_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));
 
@@ -701,7 +722,7 @@ MakeDialog( DialogType dtype )
     case help:
        xmstr = ReadCatalogXms(MC_HELP_SET, MC_HELP, MC_DEF_HELP);
        XtSetArg(argt[i], XmNmessageString,             xmstr           ); i++;
-       w = XmCreateInformationDialog(table, "help_message", argt, i);
+       w = XmCreateInformationDialog(tlev, "help_message", argt, i);
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_CANCEL_BUTTON));
         XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));
 
@@ -754,7 +775,7 @@ MakeDialog( DialogType dtype )
        fclose(fp);
        XtSetArg(argt[i], XmNmessageString,             xmstr           ); i++;
 
-       w = XmCreateInformationDialog(table, "copyright_msg", argt, i);
+       w = XmCreateInformationDialog(tlev, "copyright_msg", argt, i);
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_CANCEL_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));
        
@@ -774,7 +795,7 @@ MakeDialog( DialogType dtype )
        XtSetArg(argt[i], XmNokLabelString,             nw              ); i++;
        XtSetArg(argt[i], XmNcancelLabelString,         sv              ); i++;
 
-       w = XmCreateWarningDialog(table, "hostname_msg", argt, i);
+       w = XmCreateWarningDialog(tlev, "hostname_msg", argt, i);
 
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));
 
@@ -791,7 +812,7 @@ MakeDialog( DialogType dtype )
                            MC_DEF_PASSWD_EXPIRED);
        XtSetArg(argt[i], XmNmessageString,             xmstr           ); i++;
 
-       w = XmCreateQuestionDialog(table, "password_msg", argt, i);
+       w = XmCreateQuestionDialog(tlev, "password_msg", argt, i);
 
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));
 
@@ -802,7 +823,7 @@ MakeDialog( DialogType dtype )
     case help_chooser:
        xmstr = ReadCatalogXms(MC_HELP_SET, MC_HELP_CHOOSER, MC_DEF_HELP_CHOOSER);
 
-       w = XmCreateInformationDialog(table, "help_message", argt, i);
+       w = XmCreateInformationDialog(tlev, "help_message", argt, i);
         XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_CANCEL_BUTTON));
         XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));