]> Pileus Git - ~andy/gtk/commitdiff
Handle the case where the pointer is moved between screens during a handle
authorOwen Taylor <otaylor@redhat.com>
Sat, 14 Dec 2002 02:41:30 +0000 (02:41 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Sat, 14 Dec 2002 02:41:30 +0000 (02:41 +0000)
Fri Dec 13 21:35:12 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle
        the case where the pointer is moved between screens
        during a handle box drag by resetting the original
        location. (#94562)

        * gtk/gtkinputdialog.c (gtk_input_dialog_get_private):
        Fix a leftover variable name from cut-and-paste.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkhandlebox.c
gtk/gtkinputdialog.c

index 7af59c5133b42c5fde4cdbc564eda01907633e8a..3ddadb63a5346c0f84a2fa53a98df0f33d670838 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Fri Dec 13 21:35:12 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle
+       the case where the pointer is moved between screens
+       during a handle box drag by resetting the original
+       location. (#94562)
+
+       * gtk/gtkinputdialog.c (gtk_input_dialog_get_private): 
+       Fix a leftover variable name from cut-and-paste.
+
 Fri Dec 13 18:57:20 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdialog.c: Change the Escape key binding to only close
index 7af59c5133b42c5fde4cdbc564eda01907633e8a..3ddadb63a5346c0f84a2fa53a98df0f33d670838 100644 (file)
@@ -1,3 +1,13 @@
+Fri Dec 13 21:35:12 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle
+       the case where the pointer is moved between screens
+       during a handle box drag by resetting the original
+       location. (#94562)
+
+       * gtk/gtkinputdialog.c (gtk_input_dialog_get_private): 
+       Fix a leftover variable name from cut-and-paste.
+
 Fri Dec 13 18:57:20 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdialog.c: Change the Escape key binding to only close
index 7af59c5133b42c5fde4cdbc564eda01907633e8a..3ddadb63a5346c0f84a2fa53a98df0f33d670838 100644 (file)
@@ -1,3 +1,13 @@
+Fri Dec 13 21:35:12 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle
+       the case where the pointer is moved between screens
+       during a handle box drag by resetting the original
+       location. (#94562)
+
+       * gtk/gtkinputdialog.c (gtk_input_dialog_get_private): 
+       Fix a leftover variable name from cut-and-paste.
+
 Fri Dec 13 18:57:20 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdialog.c: Change the Escape key binding to only close
index 7af59c5133b42c5fde4cdbc564eda01907633e8a..3ddadb63a5346c0f84a2fa53a98df0f33d670838 100644 (file)
@@ -1,3 +1,13 @@
+Fri Dec 13 21:35:12 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle
+       the case where the pointer is moved between screens
+       during a handle box drag by resetting the original
+       location. (#94562)
+
+       * gtk/gtkinputdialog.c (gtk_input_dialog_get_private): 
+       Fix a leftover variable name from cut-and-paste.
+
 Fri Dec 13 18:57:20 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdialog.c: Change the Escape key binding to only close
index 7af59c5133b42c5fde4cdbc564eda01907633e8a..3ddadb63a5346c0f84a2fa53a98df0f33d670838 100644 (file)
@@ -1,3 +1,13 @@
+Fri Dec 13 21:35:12 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle
+       the case where the pointer is moved between screens
+       during a handle box drag by resetting the original
+       location. (#94562)
+
+       * gtk/gtkinputdialog.c (gtk_input_dialog_get_private): 
+       Fix a leftover variable name from cut-and-paste.
+
 Fri Dec 13 18:57:20 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdialog.c: Change the Escape key binding to only close
index 7af59c5133b42c5fde4cdbc564eda01907633e8a..3ddadb63a5346c0f84a2fa53a98df0f33d670838 100644 (file)
@@ -1,3 +1,13 @@
+Fri Dec 13 21:35:12 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkhandlebox.c (gtk_handle_box_motion): Handle
+       the case where the pointer is moved between screens
+       during a handle box drag by resetting the original
+       location. (#94562)
+
+       * gtk/gtkinputdialog.c (gtk_input_dialog_get_private): 
+       Fix a leftover variable name from cut-and-paste.
+
 Fri Dec 13 18:57:20 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkdialog.c: Change the Escape key binding to only close
index 9611d12de615ac7bfd338937efc4d4131de4b481..c34d90f9e1e91bd54471f781deb2ccfdc69229cf 100644 (file)
 #include "gtkwindow.h"
 #include "gtkintl.h"
 
+typedef struct _GtkHandleBoxPrivate GtkHandleBoxPrivate;
+
+struct _GtkHandleBoxPrivate
+{
+  gint orig_x;
+  gint orig_y;
+};
+
 enum {
   PROP_0,
   PROP_SHADOW,
@@ -264,6 +272,27 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class)
                  GTK_TYPE_WIDGET);
 }
 
+GtkHandleBoxPrivate *
+gtk_handle_box_get_private (GtkHandleBox *hb)
+{
+  GtkHandleBoxPrivate *private;
+  static GQuark private_quark = 0;
+
+  if (!private_quark)
+    private_quark = g_quark_from_static_string ("gtk-handle-box-private");
+
+  private = g_object_get_qdata (G_OBJECT (hb), private_quark);
+
+  if (!private)
+    {
+      private = g_new0 (GtkHandleBoxPrivate, 1);
+      g_object_set_qdata_full (G_OBJECT (hb), private_quark,
+                              private, g_free);
+    }
+
+  return private;
+}
+
 static void
 gtk_handle_box_init (GtkHandleBox *handle_box)
 {
@@ -1022,13 +1051,17 @@ gtk_handle_box_button_changed (GtkWidget      *widget,
        {
          if (event->type == GDK_BUTTON_PRESS) /* Start a drag */
            {
+             GtkHandleBoxPrivate *private = gtk_handle_box_get_private (hb);
              gint desk_x, desk_y;
              gint root_x, root_y;
              gint width, height;
-             
+
              gdk_window_get_deskrelative_origin (hb->bin_window, &desk_x, &desk_y);
              gdk_window_get_origin (hb->bin_window, &root_x, &root_y);
              gdk_drawable_get_size (hb->bin_window, &width, &height);
+
+             private->orig_x = event->x_root;
+             private->orig_y = event->y_root;
              
              hb->float_allocation.x = root_x - event->x_root;
              hb->float_allocation.y = root_y - event->y_root;
@@ -1095,6 +1128,7 @@ gtk_handle_box_motion (GtkWidget      *widget,
   gboolean is_snapped = FALSE;
   gint handle_position;
   GdkGeometry geometry;
+  GdkScreen *screen, *pointer_screen;
 
   hb = GTK_HANDLE_BOX (widget);
   if (!hb->in_drag)
@@ -1110,8 +1144,18 @@ gtk_handle_box_motion (GtkWidget      *widget,
    */
   new_x = 0;
   new_y = 0;
-  gdk_window_get_pointer (gtk_widget_get_root_window (widget), 
-                         &new_x, &new_y, NULL);
+  screen = gtk_widget_get_screen (widget);
+  gdk_display_get_pointer (gdk_screen_get_display (screen),
+                          &pointer_screen, 
+                          &new_x, &new_y, NULL);
+  if (pointer_screen != screen)
+    {
+      GtkHandleBoxPrivate *private = gtk_handle_box_get_private (hb);
+
+      new_x = private->orig_x;
+      new_y = private->orig_y;
+    }
+  
   new_x += hb->float_allocation.x;
   new_y += hb->float_allocation.y;
 
index 0efe51a34aa29493ee885c71caabcbf63aa8a1b4..ffb35e807f1619a3a501b992ba0711ae97bf9496 100644 (file)
@@ -146,7 +146,7 @@ gtk_input_dialog_get_type (void)
 }
 
 GtkInputDialogPrivate *
-gtk_input_dialog_get_private (GtkInputDialog *menu)
+gtk_input_dialog_get_private (GtkInputDialog *input_dialog)
 {
   GtkInputDialogPrivate *private;
   static GQuark private_quark = 0;
@@ -154,12 +154,12 @@ gtk_input_dialog_get_private (GtkInputDialog *menu)
   if (!private_quark)
     private_quark = g_quark_from_static_string ("gtk-input-dialog-private");
 
-  private = g_object_get_qdata (G_OBJECT (menu), private_quark);
+  private = g_object_get_qdata (G_OBJECT (input_dialog), private_quark);
 
   if (!private)
     {
       private = g_new0 (GtkInputDialogPrivate, 1);
-      g_object_set_qdata_full (G_OBJECT (menu), private_quark,
+      g_object_set_qdata_full (G_OBJECT (input_dialog), private_quark,
                               private, g_free);
     }