OpenVMS GTK diffs



These are all the changes I had to make to the GTK code, in order to get
it build/run on OpenVMS. I can explain the reason for each change if
needed.

Colin.


diff -u -r -x*.OBJ -x*.EXE [gtk.gtk_-1_2_7.GDK]GDKDND.C [gtk.gtk.GDK]GDKDND.C
--- [gtk.gtk_-1_2_7.GDK]GDKDND.C	Wed Feb 16 11:18:01 2000
+++ [gtk.gtk.GDK]GDKDND.C	Fri May 19 09:13:27 2000
@@ -890,6 +890,11 @@
 			      -100, -100, 10, 10, 0, 0,
 			      InputOnly, CopyFromParent,
 			      (CWOverrideRedirect | CWEventMask), &attr);
+#ifdef __VMS
+#include "config.h"
+#include <starlet.h>
+              VMS_SETUP_WINDOW_NOTIFICATION(display,motif_drag_window)
+#endif
 	      
 	      GDK_NOTE (DND,
 			g_message ("Created drag window %#lx\n", motif_drag_window));
diff -u -r -x*.OBJ -x*.EXE [gtk.gtk_-1_2_7.GDK]GDKEVENTS.C [gtk.gtk.GDK]GDKEVENTS.C
--- [gtk.gtk_-1_2_7.GDK]GDKEVENTS.C	Wed Feb 16 11:18:01 2000
+++ [gtk.gtk.GDK]GDKEVENTS.C	Fri May 19 10:09:29 2000
@@ -104,6 +104,11 @@
 					 GdkEvent  *event,
 					 gpointer   data);
 
+#ifdef __VMS
+#include <stdlib.h>
+static KeySym    VMS_translate_keysym   (KeySym keysym);
+#endif
+
 /* Private variable declarations
  */
 
@@ -220,7 +225,11 @@
 void 
 gdk_events_init (void)
 {
+#ifdef __VMS
+  connection_number = -VMS_EF_GTK_WINDOW_EVENT;
+#else
   connection_number = ConnectionNumber (gdk_display);
+#endif
   GDK_NOTE (MISC,
 	    g_message ("connection number: %d", connection_number));
 
@@ -1127,7 +1136,11 @@
       charcount = XLookupString (&xevent->xkey, buf, 16,
 				 &keysym, &compose);
 #endif
+#ifdef __VMS
+      event->key.keyval = VMS_translate_keysym(keysym);
+#else
       event->key.keyval = keysym;
+#endif
       
       if (charcount > 0 && buf[charcount-1] == '\0')
 	charcount --;
@@ -1171,7 +1184,11 @@
       keysym = GDK_VoidSymbol;
       charcount = XLookupString (&xevent->xkey, buf, 16,
 				 &keysym, &compose);
-      event->key.keyval = keysym;      
+#ifdef __VMS
+      event->key.keyval = VMS_translate_keysym(keysym);
+#else
+      event->key.keyval = keysym;
+#endif
       
       /* Print debugging info.
        */
@@ -2083,6 +2100,13 @@
   
   GDK_THREADS_ENTER ();
 
+#ifdef __VMS
+{
+#include <starlet.h>
+  sys$clref(-connection_number);
+}
+#endif
+
   if (event_poll_fd.revents & G_IO_IN)
     retval = (gdk_event_queue_find_first () != NULL) || XPending (gdk_display);
   else
@@ -2282,3 +2306,37 @@
 }
 
 
+#ifdef __VMS
+
+#define GDK_DRemove 0x1000FF00 /* XK_DRemove */
+
+static int vms_keysyms = -1;
+
+static KeySym VMS_translate_keysym(KeySym key) {
+
+    /* If first time, pick up environment variable setting */
+    if (vms_keysyms == -1) {
+        if (getenv("GTK_NO_KEY_TRANSLATION") == NULL)
+            vms_keysyms = 1;
+        else
+            vms_keysyms = 0;
+    }
+
+    /* If we are doing the magic, then do it */
+    if (vms_keysyms) {
+        switch (key) {
+          case GDK_Delete:      return GDK_BackSpace;
+          case GDK_Select:      return GDK_Delete;
+          case GDK_Find:        return GDK_Insert;
+          case GDK_Insert:      return GDK_Home;
+          case GDK_Page_Up:     return GDK_End;
+          case GDK_DRemove:     return GDK_Page_Up;
+          case GDK_Page_Down:   return GDK_Page_Down;
+          default:              break;
+        }
+    }
+
+    /* If nothing special, or mapping is off, then just return itself */
+    return key;
+}
+#endif
diff -u -r -x*.OBJ -x*.EXE [gtk.gtk_-1_2_7.GDK]GDKWINDOW.C [gtk.gtk.GDK]GDKWINDOW.C
--- [gtk.gtk_-1_2_7.GDK]GDKWINDOW.C	Wed Feb 16 11:18:07 2000
+++ [gtk.gtk.GDK]GDKWINDOW.C	Fri May 19 09:12:29 2000
@@ -408,6 +408,11 @@
 				    x, y, private->width, private->height,
 				    0, depth, class, xvisual,
 				    xattributes_mask, &xattributes);
+#ifdef __VMS
+#include "config.h"
+#include <starlet.h>
+              VMS_SETUP_WINDOW_NOTIFICATION(private->xdisplay,private->xwindow)
+#endif
   gdk_window_ref (window);
   gdk_xid_table_insert (&private->xwindow, window);
   
diff -u -r -x*.OBJ -x*.EXE [gtk.gtk_-1_2_7.GDK]GXID.C [gtk.gtk.GDK]GXID.C
--- [gtk.gtk_-1_2_7.GDK]GXID.C	Sun Aug 16 21:15:07 1998
+++ [gtk.gtk.GDK]GXID.C	Thu May 18 13:11:22 2000
@@ -18,6 +18,10 @@
 
 #include "gxid_proto.h"
 
+#if defined(__VMS)
+#define socket_fd fd_socket
+#endif
+
 /* #define DEBUG_CLIENTS  */
 /* #define DEBUG_EVENTS */
 
diff -u -r -x*.OBJ -x*.EXE [gtk.gtk_-1_2_7.GTK]GTKDND.C [gtk.gtk.GTK]GTKDND.C
--- [gtk.gtk_-1_2_7.GTK]GTKDND.C	Wed Feb 16 11:18:07 2000
+++ [gtk.gtk.GTK]GTKDND.C	Fri May 19 13:27:56 2000
@@ -24,6 +24,8 @@
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#include <stdlib.h>
+
 #include "gdk/gdkx.h"
 #include "gdk/gdkkeysyms.h"
 
diff -u -r -x*.OBJ -x*.EXE [gtk.gtk_-1_2_7.GTK]GTKFILESEL.C [gtk.gtk.GTK]GTKFILESEL.C
--- [gtk.gtk_-1_2_7.GTK]GTKFILESEL.C	Wed Feb 16 11:18:07 2000
+++ [gtk.gtk.GTK]GTKFILESEL.C	Fri May 19 13:42:41 2000
@@ -56,6 +56,14 @@
 #include "gtkdialog.h"
 #include "gtkintl.h"
 
+#ifdef __VMS
+/*
+** These are required because on OpenVMS ino_t isn't a scalar.
+*/
+#define ino_cpy(dest,from) (memcpy((void*)dest,(void*)from,3*sizeof(ino_t)))
+#define ino_eql(e1,e2) (memcmp((void *)e1,(void *)e2,3*sizeof(ino_t))==0)
+#endif
+
 #define DIR_LIST_WIDTH   180
 #define DIR_LIST_HEIGHT  180
 #define FILE_LIST_WIDTH  180
@@ -101,7 +109,11 @@
  */
 struct _CompletionDirSent
 {
+#ifndef __VMS
   ino_t inode;
+#else
+  ino_t inode[3];
+#endif
   time_t mtime;
   dev_t device;
 
@@ -1331,8 +1343,11 @@
 
   /* Set the dir_list to include ./ and ../ */
   text[1] = NULL;
+#ifndef __VMS
+/* Don't include "./" in the directory list */
   text[0] = "./";
   row = gtk_clist_append (GTK_CLIST (fs->dir_list), text);
+#endif
 
   text[0] = "../";
   row = gtk_clist_append (GTK_CLIST (fs->dir_list), text);
@@ -1972,7 +1987,11 @@
 
   sent = g_new(CompletionDirSent, 1);
   sent->mtime = sbuf->st_mtime;
+#ifndef __VMS
   sent->inode = sbuf->st_ino;
+#else
+  ino_cpy(sent->inode,sbuf->st_ino);
+#endif
   sent->device = sbuf->st_dev;
 
   path_buf_len = strlen(dir_name);
@@ -2098,7 +2117,11 @@
     {
       if (no_stat_dirs[i].present &&
 	  (no_stat_dirs[i].statbuf.st_dev == result->st_dev) &&
+#ifndef __VMS
 	  (no_stat_dirs[i].statbuf.st_ino == result->st_ino))
+#else
+          ino_eql(no_stat_dirs[i].statbuf.st_ino,result->st_ino))
+#endif
 	{
 	  *stat_subdirs = FALSE;
 	  break;
@@ -2126,7 +2149,11 @@
     {
       sent = cdsl->data;
 
+#ifndef __VMS
       if(sent->inode == sbuf.st_ino &&
+#else
+      if(ino_eql(sent->inode,sbuf.st_ino) &&
+#endif
 	 sent->mtime == sbuf.st_mtime &&
 	 sent->device == sbuf.st_dev)
 	return attach_dir(sent, dir_name, cmpl_state);
@@ -2254,7 +2281,11 @@
       return FALSE;
     }
 
+#ifndef __VMS
   if (parbuf.st_ino == sbuf->st_ino && parbuf.st_dev == sbuf->st_dev)
+#else
+  if (ino_eql(parbuf.st_ino,sbuf->st_ino) && parbuf.st_dev == sbuf->st_dev)
+#endif
     /* it wasn't a link */
     return TRUE;
 
@@ -2280,6 +2311,7 @@
 static gchar*
 find_parent_dir_fullname(gchar* dirname)
 {
+#ifndef __VMS
   gchar buffer[MAXPATHLEN];
   gchar buffer2[MAXPATHLEN];
 
@@ -2318,6 +2350,32 @@
     }
 
   return g_strdup(buffer2);
+#else
+/*
+** This is the OpenVMS version. All we do here is truncate the string to
+** the last slash (also excluding any trailing slashes that might be there).
+** If the last character is a /, then we need to locate the second from
+** last slash. This is a bug that's common to all platforms, but for
+** everyone else just means that we use the "hard way" to find our parent.
+** But on OpenVMS the "hard way" fails if we are in something like "/dka100"
+** since we can't chdir into "/" (it doesn't exist on OpenVMS).
+*/
+  gchar buffer[MAXPATHLEN+1], *last_slash;
+  int len=strlen(dirname);
+  strcpy(buffer,dirname);
+  while (len > 1) {
+    if (buffer[len-1] == '/') {
+      buffer[len-1] = 0;
+      len--;
+    }
+    else
+      break;
+  }
+  last_slash = strrchr(buffer, '/');
+  g_assert(last_slash);
+  last_slash[1] = 0;
+  return g_strdup(buffer);
+#endif
 }
 
 /**********************************************************************/
@@ -2389,7 +2447,11 @@
 {
   gint diff = 0;
 
+#ifndef __VMS
   while(*pat && *text && *text == *pat)
+#else
+  while(*pat && *text && !strncasecmp(text,pat,1))
+#endif
     {
       pat += 1;
       text += 1;
diff -u -r -x*.OBJ -x*.EXE [gtk.gtk_-1_2_7.GTK]GTKMAIN.C [gtk.gtk.GTK]GTKMAIN.C
--- [gtk.gtk_-1_2_7.GTK]GTKMAIN.C	Wed Feb 16 11:18:07 2000
+++ [gtk.gtk.GTK]GTKMAIN.C	Fri May 19 13:46:44 2000
@@ -51,6 +51,9 @@
 #include "config.h"
 #include "gtkdebug.h"
 #include "gtkintl.h"
+#ifdef __VMS
+#include <unixlib.h>
+#endif
 
 /* Private type definitions
  */
@@ -185,6 +188,31 @@
 
   if (gtk_initialized)
     return TRUE;
+
+#ifdef __VMS
+/*
+** In many places in the code, getenv("HOME") is used to get the home
+** directory. On OpenVMS this returns something like DKA0:[COLIN], but
+** in several places in the code, it expects this to be an absolute
+** UNIX filespec such as /dka0/colin. So, rather then changes all calls
+** to getenv("HOME"), let's fix HOME.
+**
+** There is a bug in the CRTL where a call to stat for a directory such as
+** /sys$sysroot/sysmgr/.netscape will fail if the .netscape directory is in
+** the SYS0 sysmgr (it works fine if its in the common sysmgr, but mkdir
+** will of course create it in SYS0). Since the most common case where this
+** happens is the SYSTEM account, we avoid the problem here by forcing it
+** to the common sysmgr.
+*/
+{
+  char *hp;
+  hp = decc$translate_vms(getenv("HOME"));
+  if (strcmp(hp,"/sys$sysroot/sysmgr"))
+    setenv ( "HOME", hp, 1 );
+  else
+    setenv ( "HOME", "/sys$common/sysmgr", 1 );
+}
+#endif
 
 #if	0
   g_set_error_handler (gtk_error);
diff -u -r -x*.OBJ -x*.EXE [gtk.gtk_-1_2_7.GTK]TESTRGB.C [gtk.gtk.GTK]TESTRGB.C
--- [gtk.gtk_-1_2_7.GTK]TESTRGB.C	Wed Feb 24 10:15:18 1999
+++ [gtk.gtk.GTK]TESTRGB.C	Fri May 19 07:51:29 2000
@@ -49,10 +49,13 @@
 get_time (void)
 {
   struct timeval tv;
+#if !defined(__VMS)
   struct timezone tz;
 
   gettimeofday (&tv, &tz);
-
+#else
+  gettimeofday (&tv, NULL);
+#endif
   return tv.tv_sec + 1e-6 * tv.tv_usec;
 }
 





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]