]> Pileus Git - ~andy/gtk/blobdiff - gdk/win32/gdkproperty-win32.c
Change FSF Address
[~andy/gtk] / gdk / win32 / gdkproperty-win32.c
index f25130a2053fd9b0e8ab646346b5f3f248fd9799..04cf3e39af1ff0b2d8f9002c7dc0d19a84ec10b9 100644 (file)
@@ -13,9 +13,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#include "config.h"
 #include <string.h>
 #include <stdlib.h>
-#include <stdio.h>
+#include <glib/gprintf.h>
 
 #include "gdkscreen.h"
 #include "gdkproperty.h"
 #include "gdkselection.h"
 #include "gdkprivate-win32.h"
+#include "gdkwin32.h"
 
 GdkAtom
-gdk_atom_intern (const gchar *atom_name,
-                gint         only_if_exists)
+_gdk_win32_display_manager_atom_intern (GdkDisplayManager *manager,
+                                       const gchar *atom_name,
+                                       gint         only_if_exists)
 {
   ATOM win32_atom;
   GdkAtom retval;
@@ -84,12 +85,14 @@ gdk_atom_intern (const gchar *atom_name,
 }
 
 gchar *
-gdk_atom_name (GdkAtom atom)
+_gdk_win32_display_manager_get_atom_name (GdkDisplayManager *manager, 
+                                         GdkAtom            atom)
 {
   ATOM win32_atom;
   gchar name[256];
 
-  if (GDK_SELECTION_PRIMARY == atom) return g_strdup ("PRIMARY");
+  if (GDK_NONE == atom) return g_strdup ("<none>");
+  else if (GDK_SELECTION_PRIMARY == atom) return g_strdup ("PRIMARY");
   else if (GDK_SELECTION_SECONDARY == atom) return g_strdup ("SECONDARY");
   else if (GDK_SELECTION_CLIPBOARD == atom) return g_strdup ("CLIPBOARD");
   else if (GDK_SELECTION_TYPE_ATOM == atom) return g_strdup ("ATOM");
@@ -111,7 +114,7 @@ gdk_atom_name (GdkAtom atom)
 }
 
 gint
-gdk_property_get (GdkWindow   *window,
+_gdk_win32_window_get_property (GdkWindow   *window,
                  GdkAtom      property,
                  GdkAtom      type,
                  gulong       offset,
@@ -133,110 +136,8 @@ gdk_property_get (GdkWindow   *window,
   return FALSE;
 }
 
-static gboolean
-find_common_locale (const guchar  *data,
-                   gint           nelements,
-                   gint           nchars,
-                   LCID          *lcidp,
-                   guchar       **bufp,
-                   gint          *sizep)
-{
-  static struct {
-    LCID lcid;
-    UINT cp;
-  } locales[] = {
-#define ENTRY(lang, sublang) \
- { MAKELCID (MAKELANGID (LANG_##lang, SUBLANG_##sublang), SORT_DEFAULT), 0 }
-    ENTRY (ENGLISH, DEFAULT),
-    ENTRY (POLISH, DEFAULT),
-    ENTRY (CZECH, DEFAULT),
-    ENTRY (LITHUANIAN, DEFAULT),
-    ENTRY (RUSSIAN, DEFAULT),
-    ENTRY (GREEK, DEFAULT),
-    ENTRY (TURKISH, DEFAULT),
-    ENTRY (HEBREW, DEFAULT),
-    ENTRY (ARABIC, DEFAULT),
-    ENTRY (THAI, DEFAULT),
-    ENTRY (JAPANESE, DEFAULT),
-    ENTRY (CHINESE, CHINESE_SIMPLIFIED),
-    ENTRY (CHINESE, CHINESE_TRADITIONAL),
-    ENTRY (KOREAN, DEFAULT),
-#undef ENTRY
-  };
-
-  static gboolean been_here = FALSE;
-  gint i;
-  wchar_t *wcs;
-
-  /* For each installed locale: Get the locale's default code page,
-   * and store the list of locales and code pages.
-   */
-  if (!been_here)
-    {
-      been_here = TRUE;
-      for (i = 0; i < G_N_ELEMENTS (locales); i++)
-       if (IsValidLocale (locales[i].lcid, LCID_INSTALLED))
-         {
-           gchar buf[10];
-           if (GetLocaleInfo (locales[i].lcid, LOCALE_IDEFAULTANSICODEPAGE,
-                              buf, sizeof (buf)))
-             {
-               gchar name[100];
-               locales[i].cp = atoi (buf);
-               GDK_NOTE (DND, (GetLocaleInfo (locales[i].lcid,
-                                              LOCALE_SENGLANGUAGE,
-                                              name, sizeof (name)),
-                               g_print ("locale %#lx: %s: CP%d\n",
-                                        (gulong) locales[i].lcid, name,
-                                        locales[i].cp)));
-             }
-         }
-    }
-  
-  /* Allocate bufp big enough to store data in any code page.  Two
-   * bytes for each Unicode char should be enough, Windows code pages
-   * are either single- or double-byte.
-   */
-  *bufp = g_malloc ((nchars+1) * 2);
-  wcs = g_new (wchar_t, nchars+1);
-
-  /* Convert to Windows wide chars into temp buf */
-  _gdk_utf8_to_ucs2 (wcs, data, nelements, nchars);
-  wcs[nchars] = 0;
-
-  /* For each code page that is the default for an installed locale: */
-  for (i = 0; i < G_N_ELEMENTS (locales); i++)
-    {
-      BOOL used_default;
-      int nbytes;
-
-      if (locales[i].cp == 0)
-       continue;
-
-      /* Convert to that code page into bufp */
-      
-      nbytes = WideCharToMultiByte (locales[i].cp, 0, wcs, -1,
-                                   *bufp, (nchars+1)*2,
-                                   NULL, &used_default);
-
-      if (!used_default)
-       {
-         /* This locale is good for the string */
-         g_free (wcs);
-         *lcidp = locales[i].lcid;
-         *sizep = nbytes;
-         return TRUE;
-       }
-    }
-
-  g_free (*bufp);
-  g_free (wcs);
-
-  return FALSE;
-}
-
 void
-gdk_property_change (GdkWindow    *window,
+_gdk_win32_window_change_property (GdkWindow    *window,
                     GdkAtom       property,
                     GdkAtom       type,
                     gint          format,
@@ -244,17 +145,11 @@ gdk_property_change (GdkWindow    *window,
                     const guchar *data,
                     gint          nelements)
 {
-  HGLOBAL hdata, hlcid, hutf8;
-  UINT cf = 0;
-  LCID lcid;
-  LCID *lcidptr;
-  GString *rtf = NULL;
-  gint i, size, nchars;
-  gchar *prop_name, *type_name;
+  HGLOBAL hdata;
+  gint i, size;
   guchar *ucptr, *buf = NULL;
-  wchar_t *wcptr;
-  enum { PLAIN_ASCII, UNICODE_TEXT, SINGLE_LOCALE, RICH_TEXT } method;
-  gboolean ok = TRUE;
+  wchar_t *wcptr, *p;
+  glong wclen;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -262,246 +157,283 @@ gdk_property_change (GdkWindow    *window,
   if (GDK_WINDOW_DESTROYED (window))
     return;
 
-  GDK_NOTE (DND,
-           (prop_name = gdk_atom_name (property),
-            type_name = gdk_atom_name (type),
-            g_print ("gdk_property_change: %#x %#x (%s) %#x (%s) %s %d*%d bytes %.10s\n",
-                     (guint) GDK_WINDOW_HWND (window),
-                     (guint) property, prop_name,
-                     (guint) type, type_name,
-                     (mode == GDK_PROP_MODE_REPLACE ? "REPLACE" :
-                      (mode == GDK_PROP_MODE_PREPEND ? "PREPEND" :
-                       (mode == GDK_PROP_MODE_APPEND ? "APPEND" :
-                        "???"))),
-                     format, nelements, data),
-            g_free (prop_name),
-            g_free (type_name)));
-
-  if (property == _gdk_selection_property
-      && type == GDK_TARGET_STRING
-      && format == 8
-      && mode == GDK_PROP_MODE_REPLACE)
-    {
-      if (!OpenClipboard (GDK_WINDOW_HWND (window)))
-       {
-         WIN32_API_FAILED ("OpenClipboard");
-         return;
-       }
-
-      /* Check if only ASCII */
-      for (i = 0; i < nelements; i++)
-       if (data[i] >= 0200)
-         break;
-
-      if (i == nelements)
-       nchars = nelements;
-      else
-       nchars = g_utf8_strlen (data, nelements);
-
-      GDK_NOTE (DND, g_print ("...nchars:%d\n", nchars));
+  GDK_NOTE (DND, {
+      gchar *prop_name = gdk_atom_name (property);
+      gchar *type_name = gdk_atom_name (type);
       
-      if (i == nelements)
-       {
-         /* If only ASCII, use CF_TEXT and the data as such. */
-         method = PLAIN_ASCII;
-         size = nelements;
-         for (i = 0; i < nelements; i++)
-           if (data[i] == '\n')
-             size++;
-         size++;
-         GDK_NOTE (DND, g_print ("...as text: %.40s\n", data));
-       }
-      else if (IS_WIN_NT ())
-       {
-         /* On NT, use CF_UNICODETEXT if any non-ASCII char present */
-         method = UNICODE_TEXT;
-         size = (nchars + 1) * 2;
-         GDK_NOTE (DND, g_print ("...as Unicode\n"));
-       }
-      else if (find_common_locale (data, nelements, nchars, &lcid, &buf, &size))
-       {
-         /* On Win9x, if all chars are in the default code page of
-          * some installed locale, use CF_TEXT and CF_LOCALE.
-          */
-         method = SINGLE_LOCALE;
-         GDK_NOTE (DND, g_print ("...as text in locale %#lx %d bytes\n",
-                                 (gulong) lcid, size));
-       }
-      else
+      g_print ("gdk_property_change: %p %s %s %s %d*%d bits: %s\n",
+              GDK_WINDOW_HWND (window),
+              prop_name,
+              type_name,
+              (mode == GDK_PROP_MODE_REPLACE ? "REPLACE" :
+               (mode == GDK_PROP_MODE_PREPEND ? "PREPEND" :
+                (mode == GDK_PROP_MODE_APPEND ? "APPEND" :
+                 "???"))),
+              format, nelements,
+              _gdk_win32_data_to_string (data, MIN (10, format*nelements/8)));
+      g_free (prop_name);
+      g_free (type_name);
+    });
+
+  /* We should never come here for these types */
+  g_return_if_fail (type != GDK_TARGET_STRING);
+  g_return_if_fail (type != _text);
+  g_return_if_fail (type != _compound_text);
+  g_return_if_fail (type != _save_targets);
+
+  if (property == _gdk_selection &&
+      format == 8 &&
+      mode == GDK_PROP_MODE_REPLACE)
+    {
+      if (type == _utf8_string)
        {
-         /* On Win9x, otherwise use RTF */
-
-         const guchar *p = data;
-
-         method = RICH_TEXT;
-         rtf = g_string_new ("{\\rtf1\\uc0 ");
-
-         while (p < data + nelements)
+         if (!OpenClipboard (GDK_WINDOW_HWND (window)))
            {
-             if (*p == '{' ||
-                 *p == '\\' ||
-                 *p == '}')
-               {
-                 rtf = g_string_append_c (rtf, '\\');
-                 rtf = g_string_append_c (rtf, *p);
-                 p++;
-               }
-             else if (*p < 0200)
-               {
-                 rtf = g_string_append_c (rtf, *p);
-                 p++;
-               }
-             else
-               {
-                 guchar *q;
-                 gint n;
-                 
-                 rtf = g_string_append (rtf, "\\uNNNNN ");
-                 rtf->len -= 6; /* five digits and a space */
-                 q = rtf->str + rtf->len;
-                 n = sprintf (q, "%d ", g_utf8_get_char (p));
-                 g_assert (n <= 6);
-                 rtf->len += n;
-                 
-                 p = g_utf8_next_char (p);
-               }
+             WIN32_API_FAILED ("OpenClipboard");
+             return;
            }
-         rtf = g_string_append (rtf, "}");
-         size = rtf->len + 1;
-         GDK_NOTE (DND, g_print ("...as RTF: %.40s\n", rtf->str));
-       }
-         
-      if (!(hdata = GlobalAlloc (GMEM_MOVEABLE, size)))
-       {
-         WIN32_API_FAILED ("GlobalAlloc");
-         if (!CloseClipboard ())
-           WIN32_API_FAILED ("CloseClipboard");
-         if (buf != NULL)
-           g_free (buf);
-         if (rtf != NULL)
-           g_string_free (rtf, TRUE);
-         return;
-       }
 
-      ucptr = GlobalLock (hdata);
+         wcptr = g_utf8_to_utf16 ((char *) data, nelements, NULL, &wclen, NULL);
 
-      switch (method)
-       {
-       case PLAIN_ASCII:
-         cf = CF_TEXT;
-         for (i = 0; i < nelements; i++)
+         wclen++;              /* Terminating 0 */
+         size = wclen * 2;
+         for (i = 0; i < wclen; i++)
+           if (wcptr[i] == '\n')
+             size += 2;
+         
+         if (!(hdata = GlobalAlloc (GMEM_MOVEABLE, size)))
            {
-             if (*data == '\n')
-               *ucptr++ = '\r';
-             *ucptr++ = data[i];
+             WIN32_API_FAILED ("GlobalAlloc");
+             if (!CloseClipboard ())
+               WIN32_API_FAILED ("CloseClipboard");
+             g_free (buf);
+             return;
            }
-         *ucptr++ = '\0';
-         break;
-
-       case UNICODE_TEXT:
-         cf = CF_UNICODETEXT;
-         wcptr = (wchar_t *) ucptr;
-         if (_gdk_utf8_to_ucs2 (wcptr, data, nelements, nchars) == -1)
-           g_warning ("_gdk_utf8_to_ucs2() failed");
-         wcptr[nchars] = 0;
-         break;
-
-       case SINGLE_LOCALE:
-         cf = CF_TEXT;
-         memmove (ucptr, buf, size);
-         g_free (buf);
-
-         /* Set the CF_LOCALE clipboard data, too */
-         if (!(hlcid = GlobalAlloc (GMEM_MOVEABLE, sizeof (LCID))))
-           WIN32_API_FAILED ("GlobalAlloc"), ok = FALSE;
-         if (ok)
+
+         ucptr = GlobalLock (hdata);
+
+         p = (wchar_t *) ucptr;
+         for (i = 0; i < wclen; i++)
            {
-             lcidptr = GlobalLock (hlcid);
-             *lcidptr = lcid;
-             GlobalUnlock (hlcid);
-             if (!SetClipboardData (CF_LOCALE, hlcid))
-               WIN32_API_FAILED ("SetClipboardData (CF_LOCALE)"), ok = FALSE;
+             if (wcptr[i] == '\n')
+               *p++ = '\r';
+             *p++ = wcptr[i];
            }
-         break;
+         g_free (wcptr);
 
-       case RICH_TEXT:
-         cf = cf_rtf;
-         memmove (ucptr, rtf->str, size);
-         g_string_free (rtf, TRUE);
-
-         /* Set the UTF8_STRING clipboard data, too, for other
-          * GTK+ apps to use (won't bother reading RTF).
+         GlobalUnlock (hdata);
+         GDK_NOTE (DND, g_print ("... SetClipboardData(CF_UNICODETEXT,%p)\n",
+                                 hdata));
+         if (!SetClipboardData (CF_UNICODETEXT, hdata))
+           WIN32_API_FAILED ("SetClipboardData");
+      
+         if (!CloseClipboard ())
+           WIN32_API_FAILED ("CloseClipboard");
+       }
+      else
+        {
+         /* We use delayed rendering for everything else than
+          * text. We can't assign hdata to the clipboard here as type
+          * may be "image/png", "image/jpg", etc. In this case
+          * there's a further conversion afterwards.
           */
-         if (!(hutf8 = GlobalAlloc (GMEM_MOVEABLE, nelements)))
-           WIN32_API_FAILED ("GlobalAlloc");
-         else
+         GDK_NOTE (DND, g_print ("... delayed rendering\n"));
+         _delayed_rendering_data = NULL;
+         if (!(hdata = GlobalAlloc (GMEM_MOVEABLE, nelements > 0 ? nelements : 1)))
            {
-             guchar *utf8ptr = GlobalLock (hutf8);
-             memmove (utf8ptr, data, nelements);
-             GlobalUnlock (hutf8);
-             if (!SetClipboardData (cf_utf8_string, hutf8))
-               WIN32_API_FAILED ("SetClipboardData (UTF8_STRING)");
+             WIN32_API_FAILED ("GlobalAlloc");
+             return;
            }
-         break;
-
-       default:
-         g_assert_not_reached ();
+         ucptr = GlobalLock (hdata);
+         memcpy (ucptr, data, nelements);
+         GlobalUnlock (hdata);
+         _delayed_rendering_data = hdata;
        }
-
-      GlobalUnlock (hdata);
-      if (ok && !SetClipboardData (cf, hdata))
-       WIN32_API_FAILED ("SetClipboardData"), ok = FALSE;
-      
-      if (!CloseClipboard ())
-       WIN32_API_FAILED ("CloseClipboard");
+    }
+  else if (property == _gdk_ole2_dnd)
+    {
+      /* Will happen only if gdkdnd-win32.c has OLE2 dnd support compiled in */
+      _gdk_win32_ole2_dnd_property_change (type, format, data, nelements);
     }
   else
     g_warning ("gdk_property_change: General case not implemented");
 }
 
 void
-gdk_property_delete (GdkWindow *window,
-                    GdkAtom    property)
+_gdk_win32_window_delete_property (GdkWindow *window,
+                                  GdkAtom    property)
 {
   gchar *prop_name;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  GDK_NOTE (DND,
-           (prop_name = gdk_atom_name (property),
-            g_print ("gdk_property_delete: %#x %#x (%s)\n",
-                     (window ? (guint) GDK_WINDOW_HWND (window) : 0),
-                     (guint) property, prop_name),
-            g_free (prop_name)));
+  GDK_NOTE (DND, {
+      prop_name = gdk_atom_name (property);
 
-  if (property == _gdk_selection_property)
+      g_print ("gdk_property_delete: %p %s\n",
+              GDK_WINDOW_HWND (window),
+              prop_name);
+      g_free (prop_name);
+    });
+
+  if (property == _gdk_selection)
     _gdk_selection_property_delete (window);
+  else if (property == _wm_transient_for)
+    gdk_window_set_transient_for (window, _gdk_root);
   else
-    g_warning ("gdk_property_delete: General case not implemented");
+    {
+      prop_name = gdk_atom_name (property);
+      g_warning ("gdk_property_delete: General case (%s) not implemented",
+                prop_name);
+      g_free (prop_name);
+    }
 }
 
+/*
+  For reference, from gdk/x11/gdksettings.c:
+
+  "Net/DoubleClickTime\0"     "gtk-double-click-time\0"
+  "Net/DoubleClickDistance\0" "gtk-double-click-distance\0"
+  "Net/DndDragThreshold\0"    "gtk-dnd-drag-threshold\0"
+  "Net/CursorBlink\0"         "gtk-cursor-blink\0"
+  "Net/CursorBlinkTime\0"     "gtk-cursor-blink-time\0"
+  "Net/ThemeName\0"           "gtk-theme-name\0"
+  "Net/IconThemeName\0"       "gtk-icon-theme-name\0"
+  "Gtk/CanChangeAccels\0"     "gtk-can-change-accels\0"
+  "Gtk/ColorPalette\0"        "gtk-color-palette\0"
+  "Gtk/FontName\0"            "gtk-font-name\0"
+  "Gtk/IconSizes\0"           "gtk-icon-sizes\0"
+  "Gtk/KeyThemeName\0"        "gtk-key-theme-name\0"
+  "Gtk/ToolbarStyle\0"        "gtk-toolbar-style\0"
+  "Gtk/ToolbarIconSize\0"     "gtk-toolbar-icon-size\0"
+  "Gtk/IMPreeditStyle\0"      "gtk-im-preedit-style\0"
+  "Gtk/IMStatusStyle\0"       "gtk-im-status-style\0"
+  "Gtk/Modules\0"             "gtk-modules\0"
+  "Gtk/FileChooserBackend\0"  "gtk-file-chooser-backend\0"
+  "Gtk/ButtonImages\0"        "gtk-button-images\0"
+  "Gtk/MenuImages\0"          "gtk-menu-images\0"
+  "Gtk/MenuBarAccel\0"        "gtk-menu-bar-accel\0"
+  "Gtk/CursorBlinkTimeout\0"  "gtk-cursor-blink-timeout\0"
+  "Gtk/CursorThemeName\0"     "gtk-cursor-theme-name\0"
+  "Gtk/CursorThemeSize\0"     "gtk-cursor-theme-size\0"
+  "Gtk/ShowInputMethodMenu\0" "gtk-show-input-method-menu\0"
+  "Gtk/ShowUnicodeMenu\0"     "gtk-show-unicode-menu\0"
+  "Gtk/TimeoutInitial\0"      "gtk-timeout-initial\0"
+  "Gtk/TimeoutRepeat\0"       "gtk-timeout-repeat\0"
+  "Gtk/ColorScheme\0"         "gtk-color-scheme\0"
+  "Gtk/EnableAnimations\0"    "gtk-enable-animations\0"
+  "Xft/Antialias\0"           "gtk-xft-antialias\0"
+  "Xft/Hinting\0"             "gtk-xft-hinting\0"
+  "Xft/HintStyle\0"           "gtk-xft-hintstyle\0"
+  "Xft/RGBA\0"                "gtk-xft-rgba\0"
+  "Xft/DPI\0"                 "gtk-xft-dpi\0"
+  "Net/FallbackIconTheme\0"   "gtk-fallback-icon-theme\0"
+  "Gtk/TouchscreenMode\0"     "gtk-touchscreen-mode\0"
+  "Gtk/EnableAccels\0"        "gtk-enable-accels\0"
+  "Gtk/EnableMnemonics\0"     "gtk-enable-mnemonics\0"
+  "Gtk/ScrolledWindowPlacement\0" "gtk-scrolled-window-placement\0"
+  "Gtk/IMModule\0"            "gtk-im-module\0"
+  "Fontconfig/Timestamp\0"    "gtk-fontconfig-timestamp\0"
+  "Net/SoundThemeName\0"      "gtk-sound-theme-name\0"
+  "Net/EnableInputFeedbackSounds\0" "gtk-enable-input-feedback-sounds\0"
+  "Net/EnableEventSounds\0"  "gtk-enable-event-sounds\0";
+
+  More, from various places in gtk sources:
+
+  gtk-entry-select-on-focus
+  gtk-split-cursor
+
+*/
 gboolean
-gdk_screen_get_setting (GdkScreen   *screen,
+_gdk_win32_screen_get_setting (GdkScreen   *screen,
                         const gchar *name,
                         GValue      *value)
 {
-  g_return_val_if_fail (screen == gdk_get_default_screen (), FALSE);
+  g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
 
   /*
    * XXX : if these values get changed through the Windoze UI the
    *       respective gdk_events are not generated yet.
    */
-  if (strcmp ("double-click-timeout", name) == 0)
+  if (strcmp ("gtk-theme-name", name) == 0) 
+    {
+      g_value_set_string (value, "ms-windows");
+    }
+  else if (strcmp ("gtk-double-click-time", name) == 0)
     {
-      g_value_set_int (value, GetDoubleClickTime ());
+      gint i = GetDoubleClickTime ();
+      GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %d\n", name, i));
+      g_value_set_int (value, i);
       return TRUE;
     }
-  else if (strcmp ("drag-threshold", name) == 0)
+  else if (strcmp ("gtk-double-click-distance", name) == 0)
     {
-      g_value_set_int (value, MAX(GetSystemMetrics (SM_CXDRAG), GetSystemMetrics (SM_CYDRAG)));
+      gint i = MAX(GetSystemMetrics (SM_CXDOUBLECLK), GetSystemMetrics (SM_CYDOUBLECLK));
+      GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %d\n", name, i));
+      g_value_set_int (value, i);
       return TRUE;
     }
-  else
-    return FALSE;
+  else if (strcmp ("gtk-dnd-drag-threshold", name) == 0)
+    {
+      gint i = MAX(GetSystemMetrics (SM_CXDRAG), GetSystemMetrics (SM_CYDRAG));
+      GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %d\n", name, i));
+      g_value_set_int (value, i);
+      return TRUE;
+    }
+  else if (strcmp ("gtk-split-cursor", name) == 0)
+    {
+      GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : FALSE\n", name));
+      g_value_set_boolean (value, FALSE);
+      return TRUE;
+    }
+  else if (strcmp ("gtk-alternative-button-order", name) == 0)
+    {
+      GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : TRUE\n", name));
+      g_value_set_boolean (value, TRUE);
+      return TRUE;
+    }
+  else if (strcmp ("gtk-alternative-sort-arrows", name) == 0)
+    {
+      GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : TRUE\n", name));
+      g_value_set_boolean (value, TRUE);
+      return TRUE;
+    }
+#if 0
+  /*
+   * With 'MS Sans Serif' as windows menu font (default on win98se) you'll get a 
+   * bunch of :
+   *   WARNING **: Couldn't load font "MS Sans Serif 8" falling back to "Sans 8"
+   * at least with testfilechooser (regardless of the bitmap check below)
+   * so just disabling this code seems to be the best we can do --hb
+   */
+  else if (strcmp ("gtk-font-name", name) == 0)
+    {
+      NONCLIENTMETRICS ncm;
+      ncm.cbSize = sizeof(NONCLIENTMETRICS);
+      if (SystemParametersInfo (SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, FALSE))
+        {
+          /* Pango finally uses GetDeviceCaps to scale, we use simple
+          * approximation here.
+          */
+          int nHeight = (0 > ncm.lfMenuFont.lfHeight ? -3*ncm.lfMenuFont.lfHeight/4 : 10);
+          if (OUT_STRING_PRECIS == ncm.lfMenuFont.lfOutPrecision)
+            GDK_NOTE(MISC, g_print("gdk_screen_get_setting(%s) : ignoring bitmap font '%s'\n", 
+                                   name, ncm.lfMenuFont.lfFaceName));
+          else if (ncm.lfMenuFont.lfFaceName && strlen(ncm.lfMenuFont.lfFaceName) > 0 &&
+                   /* Avoid issues like those described in bug #135098 */
+                   g_utf8_validate (ncm.lfMenuFont.lfFaceName, -1, NULL))
+            {
+              char* s = g_strdup_printf ("%s %d", ncm.lfMenuFont.lfFaceName, nHeight);
+              GDK_NOTE(MISC, g_print("gdk_screen_get_setting(%s) : %s\n", name, s));
+              g_value_set_string (value, s);
+
+              g_free(s);
+              return TRUE;
+            }
+        }
+    }
+#endif
+
+  return FALSE;
 }