]> Pileus Git - ~andy/gtk/commitdiff
applied the undisputable and required [due to recent gtkfilesystem
authorHans Breuer <hans@breuer.org>
Sat, 20 Mar 2004 23:45:35 +0000 (23:45 +0000)
committerHans Breuer <hans@src.gnome.org>
Sat, 20 Mar 2004 23:45:35 +0000 (23:45 +0000)
2004-03-20  Hans Breuer  <hans@breuer.org>

* gtk/gtkfilesystemwin32.c : applied the undisputable and
required [due to recent gtkfilesystem internal api semantic
changes] part of patches to fix bug #137543 (Tor Lillqvist,
J. Ali Harlow)

* gdk/gdkevents-win32.c (handle_configure_event) :
             (gdk_event_translate), WM_WINDOWPOSCHANGED : initialize
GdkWindowObject::x, y with screen coords to make
gdk_window_get_position () return the right thing and thus fix
drag and drop positioning (e.g. Gimp tabs, fixes bug #137192)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/win32/gdkevents-win32.c
gtk/gtkfilesystemwin32.c

index d5bce3fc792d8059de521658e0b2ed076b5c655e..83e21d5bc7a73d7113fde4db0e133463f06e37c3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2004-03-20  Hans Breuer  <hans@breuer.org>
+
+       * gtk/gtkfilesystemwin32.c : applied the undisputable and
+       required [due to recent gtkfilesystem internal api semantic 
+       changes] part of patches to fix bug #137543 (Tor Lillqvist,
+       J. Ali Harlow)
+
+       * gdk/gdkevents-win32.c (handle_configure_event) :
+             (gdk_event_translate), WM_WINDOWPOSCHANGED : initialize
+       GdkWindowObject::x, y with screen coords to make 
+       gdk_window_get_position () return the right thing and thus fix
+       drag and drop positioning (e.g. Gimp tabs, fixes bug #137192)
+
 2004-03-19  Federico Mena Quintero  <federico@ximian.com>
 
        * Revert the patch to #137520, as 2.4.1 is for conservative bug
index d5bce3fc792d8059de521658e0b2ed076b5c655e..83e21d5bc7a73d7113fde4db0e133463f06e37c3 100644 (file)
@@ -1,3 +1,16 @@
+2004-03-20  Hans Breuer  <hans@breuer.org>
+
+       * gtk/gtkfilesystemwin32.c : applied the undisputable and
+       required [due to recent gtkfilesystem internal api semantic 
+       changes] part of patches to fix bug #137543 (Tor Lillqvist,
+       J. Ali Harlow)
+
+       * gdk/gdkevents-win32.c (handle_configure_event) :
+             (gdk_event_translate), WM_WINDOWPOSCHANGED : initialize
+       GdkWindowObject::x, y with screen coords to make 
+       gdk_window_get_position () return the right thing and thus fix
+       drag and drop positioning (e.g. Gimp tabs, fixes bug #137192)
+
 2004-03-19  Federico Mena Quintero  <federico@ximian.com>
 
        * Revert the patch to #137520, as 2.4.1 is for conservative bug
index d5bce3fc792d8059de521658e0b2ed076b5c655e..83e21d5bc7a73d7113fde4db0e133463f06e37c3 100644 (file)
@@ -1,3 +1,16 @@
+2004-03-20  Hans Breuer  <hans@breuer.org>
+
+       * gtk/gtkfilesystemwin32.c : applied the undisputable and
+       required [due to recent gtkfilesystem internal api semantic 
+       changes] part of patches to fix bug #137543 (Tor Lillqvist,
+       J. Ali Harlow)
+
+       * gdk/gdkevents-win32.c (handle_configure_event) :
+             (gdk_event_translate), WM_WINDOWPOSCHANGED : initialize
+       GdkWindowObject::x, y with screen coords to make 
+       gdk_window_get_position () return the right thing and thus fix
+       drag and drop positioning (e.g. Gimp tabs, fixes bug #137192)
+
 2004-03-19  Federico Mena Quintero  <federico@ximian.com>
 
        * Revert the patch to #137520, as 2.4.1 is for conservative bug
index d5bce3fc792d8059de521658e0b2ed076b5c655e..83e21d5bc7a73d7113fde4db0e133463f06e37c3 100644 (file)
@@ -1,3 +1,16 @@
+2004-03-20  Hans Breuer  <hans@breuer.org>
+
+       * gtk/gtkfilesystemwin32.c : applied the undisputable and
+       required [due to recent gtkfilesystem internal api semantic 
+       changes] part of patches to fix bug #137543 (Tor Lillqvist,
+       J. Ali Harlow)
+
+       * gdk/gdkevents-win32.c (handle_configure_event) :
+             (gdk_event_translate), WM_WINDOWPOSCHANGED : initialize
+       GdkWindowObject::x, y with screen coords to make 
+       gdk_window_get_position () return the right thing and thus fix
+       drag and drop positioning (e.g. Gimp tabs, fixes bug #137192)
+
 2004-03-19  Federico Mena Quintero  <federico@ximian.com>
 
        * Revert the patch to #137520, as 2.4.1 is for conservative bug
index d5bce3fc792d8059de521658e0b2ed076b5c655e..83e21d5bc7a73d7113fde4db0e133463f06e37c3 100644 (file)
@@ -1,3 +1,16 @@
+2004-03-20  Hans Breuer  <hans@breuer.org>
+
+       * gtk/gtkfilesystemwin32.c : applied the undisputable and
+       required [due to recent gtkfilesystem internal api semantic 
+       changes] part of patches to fix bug #137543 (Tor Lillqvist,
+       J. Ali Harlow)
+
+       * gdk/gdkevents-win32.c (handle_configure_event) :
+             (gdk_event_translate), WM_WINDOWPOSCHANGED : initialize
+       GdkWindowObject::x, y with screen coords to make 
+       gdk_window_get_position () return the right thing and thus fix
+       drag and drop positioning (e.g. Gimp tabs, fixes bug #137192)
+
 2004-03-19  Federico Mena Quintero  <federico@ximian.com>
 
        * Revert the patch to #137520, as 2.4.1 is for conservative bug
index d8290856cc45ebffabc1a8699fd3b8f953fd1dfc..608da8f19e3dccc1f82aa172126c1d32e7b52765 100644 (file)
@@ -1685,23 +1685,25 @@ handle_configure_event (MSG       *msg,
                        GdkWindow *window)
 {
   RECT client_rect;
+  POINT point;
 
   GetClientRect (msg->hwnd, &client_rect);
-  
+  point.x = client_rect.left; /* always 0 */
+  point.y = client_rect.top;
+  /* top level windows need screen coords */
+  if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
+    ClientToScreen (msg->hwnd, &point);
+
   GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->width = client_rect.right - client_rect.left;
   GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->height = client_rect.bottom - client_rect.top;
   
-  ((GdkWindowObject *) window)->x = client_rect.left;
-  ((GdkWindowObject *) window)->y = client_rect.top;
+  ((GdkWindowObject *) window)->x = point.x;
+  ((GdkWindowObject *) window)->y = point.y;
   
   if (((GdkWindowObject *) window)->event_mask & GDK_STRUCTURE_MASK)
     {
-      POINT point;
       GdkEvent *event = gdk_event_new (GDK_CONFIGURE);
 
-      point.x = point.y = 0;
-      ClientToScreen (msg->hwnd, &point);
-      
       event->configure.window = window;
 
       event->configure.width = client_rect.right - client_rect.left;
@@ -2980,23 +2982,25 @@ gdk_event_translate (GdkDisplay *display,
         !GDK_WINDOW_DESTROYED (window))
        {
          RECT client_rect;
+         POINT point;
 
          GetClientRect (msg->hwnd, &client_rect);
+         point.x = client_rect.left; /* always 0 */
+         point.y = client_rect.top;
+         /* top level windows need screen coords */
+         if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
+           ClientToScreen (msg->hwnd, &point);
   
          GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->width = client_rect.right - client_rect.left;
          GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->height = client_rect.bottom - client_rect.top;
          
-         ((GdkWindowObject *) window)->x = client_rect.left;
-         ((GdkWindowObject *) window)->y = client_rect.top;
+         ((GdkWindowObject *) window)->x = point.x;
+         ((GdkWindowObject *) window)->y = point.y;
          
          if (((GdkWindowObject *) window)->event_mask & GDK_STRUCTURE_MASK)
            {
-             POINT point;
              GdkEvent *event = gdk_event_new (GDK_CONFIGURE);
              
-             point.x = point.y = 0;
-             ClientToScreen (msg->hwnd, &point);
-             
              event->configure.window = window;
              
              event->configure.width = client_rect.right - client_rect.left;
index a1a5ec5a5d4b5dfeb591251d87587b7f415028ac..8688e21b5e33bb03913523421ad102d33d820f37 100644 (file)
@@ -40,7 +40,7 @@
 #define mkdir(p,m) _mkdir(p)
 #include <gdk/win32/gdkwin32.h> /* gdk_win32_hdc_get */
 #else
-#error "The implementation is win32 only yet."
+#error "The implementation is win32 only."
 #endif /* G_OS_WIN32 */
 
 typedef struct _GtkFileSystemWin32Class GtkFileSystemWin32Class;
@@ -305,10 +305,10 @@ gtk_file_system_win32_list_volumes (GtkFileSystem *file_system)
       if (p[0] == 'a' || p[0] == 'b')
         vol->is_mounted = FALSE; /* skip floppy */
       else
-        vol->is_mounted = TRUE;
+        vol->is_mounted = TRUE; /* handle other removable drives special, too? */
 
       /*FIXME: gtk_file_path_compare() is case sensitive, we are not*/
-      p[0] = toupper (p[0]);
+      p[0] = g_ascii_toupper (p[0]);
       vol->drive = g_strdup (p);
 
       list = g_slist_append (list, vol);
@@ -328,9 +328,9 @@ gtk_file_system_win32_get_volume_for_path (GtkFileSystem     *file_system,
   g_return_val_if_fail (p != NULL, NULL);
 
   /*FIXME: gtk_file_path_compare() is case sensitive, we are not*/
-  p[0] = toupper (p[0]);
+  p[0] = g_ascii_toupper (p[0]);
   vol->drive = p;
-  vol->is_mounted = (p[0] != 'a' && p[0] != 'b');
+  vol->is_mounted = (p[0] != 'A' && p[0] != 'B');
 
   return vol;
 }
@@ -423,15 +423,35 @@ gtk_file_system_win32_volume_get_display_name (GtkFileSystem       *file_system,
                                              GtkFileSystemVolume *volume)
 {
   gchar display_name[80];
+  gunichar2 *wdrive = g_utf8_to_utf16 (volume->drive, -1, NULL, NULL, NULL);
+  gunichar2  wname[80];
 
-  if (GetVolumeInformation (volume->drive, 
+  g_return_val_if_fail (wdrive != NULL, NULL);
+
+  if (GetVolumeInformationW (wdrive, wname, sizeof(wname), 
+                             NULL, NULL, NULL, NULL, 0))
+    {
+      gchar *name = g_utf16_to_utf8 (wname, -1, NULL, NULL, NULL);
+      gchar *real_display_name = g_strconcat (name, " (", volume->drive, ")", NULL);
+
+      g_free (name);
+      g_free (wdrive);
+      GTK_NOTE (MISC, g_print ("Wide volume display name: %s\n", real_display_name));
+
+      return real_display_name;
+    }
+  else if (GetVolumeInformation (volume->drive, 
                             display_name, sizeof(display_name),
                             NULL, /* serial number */
                             NULL, /* max. component length */
                             NULL, /* fs flags */
                             NULL, 0)) /* fs type like FAT, NTFS */
     {
-      gchar* real_display_name = g_strconcat (display_name, " (", volume->drive, ")", NULL);
+      gchar *name = g_locale_to_utf8 (display_name, -1, NULL, NULL, NULL);
+      gchar *real_display_name = g_strconcat (name, " (", volume->drive, ")", NULL);
+
+      g_free (name);
+      GTK_NOTE (MISC, g_print ("Locale volume display name: %s\n", real_display_name));
 
       return real_display_name;
     }
@@ -1095,6 +1115,16 @@ gtk_file_folder_win32_get_info (GtkFileFolder     *folder,
   gchar *dirname;
   gchar *filename;
   
+  if (!path)
+    {
+      g_return_val_if_fail (filename_is_root (folder_win32->filename), NULL);
+
+      /* ??? */
+      info = filename_get_info (folder_win32->filename, folder_win32->types, error);
+
+      return info;
+    }
+
   filename = filename_from_path (path);
   g_return_val_if_fail (filename != NULL, NULL);
 
@@ -1291,6 +1321,6 @@ filename_is_root (const char *filename)
   /* accept both forms */
 
   return (   (len == 2 && filename[1] == ':')
-          || (len == 3 && filename[1] == ':' && filename[2] == '\\'));
+          || (len == 3 && filename[1] == ':' && (filename[2] == '\\' || filename[2] == '/')));
 }