Commit 30b328e7 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Handle the case where the pointer is moved between screens during a handle

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.
parent 59f712ad
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> Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdialog.c: Change the Escape key binding to only close * gtk/gtkdialog.c: Change the Escape key binding to only close
......
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> Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdialog.c: Change the Escape key binding to only close * gtk/gtkdialog.c: Change the Escape key binding to only close
......
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> Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdialog.c: Change the Escape key binding to only close * gtk/gtkdialog.c: Change the Escape key binding to only close
......
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> Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdialog.c: Change the Escape key binding to only close * gtk/gtkdialog.c: Change the Escape key binding to only close
......
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> Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdialog.c: Change the Escape key binding to only close * gtk/gtkdialog.c: Change the Escape key binding to only close
......
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> Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdialog.c: Change the Escape key binding to only close * gtk/gtkdialog.c: Change the Escape key binding to only close
......
...@@ -32,6 +32,14 @@ ...@@ -32,6 +32,14 @@
#include "gtkwindow.h" #include "gtkwindow.h"
#include "gtkintl.h" #include "gtkintl.h"
typedef struct _GtkHandleBoxPrivate GtkHandleBoxPrivate;
struct _GtkHandleBoxPrivate
{
gint orig_x;
gint orig_y;
};
enum { enum {
PROP_0, PROP_0,
PROP_SHADOW, PROP_SHADOW,
...@@ -264,6 +272,27 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class) ...@@ -264,6 +272,27 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class)
GTK_TYPE_WIDGET); 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 static void
gtk_handle_box_init (GtkHandleBox *handle_box) gtk_handle_box_init (GtkHandleBox *handle_box)
{ {
...@@ -1022,13 +1051,17 @@ gtk_handle_box_button_changed (GtkWidget *widget, ...@@ -1022,13 +1051,17 @@ gtk_handle_box_button_changed (GtkWidget *widget,
{ {
if (event->type == GDK_BUTTON_PRESS) /* Start a drag */ if (event->type == GDK_BUTTON_PRESS) /* Start a drag */
{ {
GtkHandleBoxPrivate *private = gtk_handle_box_get_private (hb);
gint desk_x, desk_y; gint desk_x, desk_y;
gint root_x, root_y; gint root_x, root_y;
gint width, height; gint width, height;
gdk_window_get_deskrelative_origin (hb->bin_window, &desk_x, &desk_y); gdk_window_get_deskrelative_origin (hb->bin_window, &desk_x, &desk_y);
gdk_window_get_origin (hb->bin_window, &root_x, &root_y); gdk_window_get_origin (hb->bin_window, &root_x, &root_y);
gdk_drawable_get_size (hb->bin_window, &width, &height); 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.x = root_x - event->x_root;
hb->float_allocation.y = root_y - event->y_root; hb->float_allocation.y = root_y - event->y_root;
...@@ -1095,6 +1128,7 @@ gtk_handle_box_motion (GtkWidget *widget, ...@@ -1095,6 +1128,7 @@ gtk_handle_box_motion (GtkWidget *widget,
gboolean is_snapped = FALSE; gboolean is_snapped = FALSE;
gint handle_position; gint handle_position;
GdkGeometry geometry; GdkGeometry geometry;
GdkScreen *screen, *pointer_screen;
hb = GTK_HANDLE_BOX (widget); hb = GTK_HANDLE_BOX (widget);
if (!hb->in_drag) if (!hb->in_drag)
...@@ -1110,8 +1144,18 @@ gtk_handle_box_motion (GtkWidget *widget, ...@@ -1110,8 +1144,18 @@ gtk_handle_box_motion (GtkWidget *widget,
*/ */
new_x = 0; new_x = 0;
new_y = 0; new_y = 0;
gdk_window_get_pointer (gtk_widget_get_root_window (widget), screen = gtk_widget_get_screen (widget);
&new_x, &new_y, NULL); 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_x += hb->float_allocation.x;
new_y += hb->float_allocation.y; new_y += hb->float_allocation.y;
......
...@@ -146,7 +146,7 @@ gtk_input_dialog_get_type (void) ...@@ -146,7 +146,7 @@ gtk_input_dialog_get_type (void)
} }
GtkInputDialogPrivate * GtkInputDialogPrivate *
gtk_input_dialog_get_private (GtkInputDialog *menu) gtk_input_dialog_get_private (GtkInputDialog *input_dialog)
{ {
GtkInputDialogPrivate *private; GtkInputDialogPrivate *private;
static GQuark private_quark = 0; static GQuark private_quark = 0;
...@@ -154,12 +154,12 @@ gtk_input_dialog_get_private (GtkInputDialog *menu) ...@@ -154,12 +154,12 @@ gtk_input_dialog_get_private (GtkInputDialog *menu)
if (!private_quark) if (!private_quark)
private_quark = g_quark_from_static_string ("gtk-input-dialog-private"); 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) if (!private)
{ {
private = g_new0 (GtkInputDialogPrivate, 1); 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); private, g_free);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment