+Fri Nov 23 19:22:50 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c: Handle events in windows other
+ than widget->event_window properly. (#65079, reported
+ by Damon Chaplin)
+
+ * gdk/gdkevents.c (gdk_event_get_coords): Fix x/y bug.
+
Fri Nov 23 18:57:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmessagedialog.c (gtk_message_dialog_init): Align
- the image at the top, #65020, request from Seth Nickell)
+ the image at the top. (#65020, request from Seth Nickell)
Fri Nov 23 18:49:53 2001 Owen Taylor <otaylor@redhat.com>
+Fri Nov 23 19:22:50 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c: Handle events in windows other
+ than widget->event_window properly. (#65079, reported
+ by Damon Chaplin)
+
+ * gdk/gdkevents.c (gdk_event_get_coords): Fix x/y bug.
+
Fri Nov 23 18:57:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmessagedialog.c (gtk_message_dialog_init): Align
- the image at the top, #65020, request from Seth Nickell)
+ the image at the top. (#65020, request from Seth Nickell)
Fri Nov 23 18:49:53 2001 Owen Taylor <otaylor@redhat.com>
+Fri Nov 23 19:22:50 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c: Handle events in windows other
+ than widget->event_window properly. (#65079, reported
+ by Damon Chaplin)
+
+ * gdk/gdkevents.c (gdk_event_get_coords): Fix x/y bug.
+
Fri Nov 23 18:57:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmessagedialog.c (gtk_message_dialog_init): Align
- the image at the top, #65020, request from Seth Nickell)
+ the image at the top. (#65020, request from Seth Nickell)
Fri Nov 23 18:49:53 2001 Owen Taylor <otaylor@redhat.com>
+Fri Nov 23 19:22:50 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c: Handle events in windows other
+ than widget->event_window properly. (#65079, reported
+ by Damon Chaplin)
+
+ * gdk/gdkevents.c (gdk_event_get_coords): Fix x/y bug.
+
Fri Nov 23 18:57:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmessagedialog.c (gtk_message_dialog_init): Align
- the image at the top, #65020, request from Seth Nickell)
+ the image at the top. (#65020, request from Seth Nickell)
Fri Nov 23 18:49:53 2001 Owen Taylor <otaylor@redhat.com>
+Fri Nov 23 19:22:50 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c: Handle events in windows other
+ than widget->event_window properly. (#65079, reported
+ by Damon Chaplin)
+
+ * gdk/gdkevents.c (gdk_event_get_coords): Fix x/y bug.
+
Fri Nov 23 18:57:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmessagedialog.c (gtk_message_dialog_init): Align
- the image at the top, #65020, request from Seth Nickell)
+ the image at the top. (#65020, request from Seth Nickell)
Fri Nov 23 18:49:53 2001 Owen Taylor <otaylor@redhat.com>
+Fri Nov 23 19:22:50 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c: Handle events in windows other
+ than widget->event_window properly. (#65079, reported
+ by Damon Chaplin)
+
+ * gdk/gdkevents.c (gdk_event_get_coords): Fix x/y bug.
+
Fri Nov 23 18:57:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmessagedialog.c (gtk_message_dialog_init): Align
- the image at the top, #65020, request from Seth Nickell)
+ the image at the top. (#65020, request from Seth Nickell)
Fri Nov 23 18:49:53 2001 Owen Taylor <otaylor@redhat.com>
+Fri Nov 23 19:22:50 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtknotebook.c: Handle events in windows other
+ than widget->event_window properly. (#65079, reported
+ by Damon Chaplin)
+
+ * gdk/gdkevents.c (gdk_event_get_coords): Fix x/y bug.
+
Fri Nov 23 18:57:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmessagedialog.c (gtk_message_dialog_init): Align
- the image at the top, #65020, request from Seth Nickell)
+ the image at the top. (#65020, request from Seth Nickell)
Fri Nov 23 18:49:53 2001 Owen Taylor <otaylor@redhat.com>
if (x_win)
*x_win = x;
if (y_win)
- *y_win = x;
+ *y_win = y;
return fetched;
}
gtk_notebook_get_event_window_position (notebook, &event_window_pos);
gtk_notebook_get_arrow_rect (notebook, &arrow_rect);
- x -= arrow_rect.x - event_window_pos.x;
- y -= arrow_rect.y - event_window_pos.y;
+ x -= arrow_rect.x;
+ y -= arrow_rect.y;
if (y >= 0 && y < arrow_rect.height)
{
return TRUE;
}
+static gboolean
+get_widget_coordinates (GtkWidget *widget,
+ GdkEvent *event,
+ gint *x,
+ gint *y)
+{
+ GdkWindow *window = ((GdkEventAny *)event)->window;
+ gdouble tx, ty;
+
+ if (!gdk_event_get_coords (event, &tx, &ty))
+ return FALSE;
+
+ while (window && window != widget->window)
+ {
+ gint window_x, window_y;
+
+ gdk_window_get_position (window, &window_x, &window_y);
+ tx += window_x;
+ ty += window_y;
+
+ window = gdk_window_get_parent (window);
+ }
+
+ if (window)
+ {
+ *x = tx;
+ *y = ty;
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
static gboolean
gtk_notebook_button_press (GtkWidget *widget,
GdkEventButton *event)
GtkNotebookPage *page;
GList *children;
GtkArrowType arrow;
- GdkRectangle event_window_pos;
gint num;
gint x, y;
notebook->button)
return FALSE;
- arrow = gtk_notebook_get_arrow (notebook, event->x, event->y);
+ if (!get_widget_coordinates (widget, (GdkEvent *)event, &x, &y))
+ return FALSE;
+
+ arrow = gtk_notebook_get_arrow (notebook, x, y);
if (arrow)
return gtk_notebook_arrow_button_press (notebook, arrow, event);
return TRUE;
}
- /* Translate coordinates from event_window to widget->window
- */
- gtk_notebook_get_event_window_position (notebook, &event_window_pos);
- x = event->x + event_window_pos.x;
- y = event->y + event_window_pos.y;
-
num = 0;
children = notebook->children;
while (children)
{
GtkNotebook *notebook;
GtkArrowType arrow;
+ gint x, y;
g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
notebook = GTK_NOTEBOOK (widget);
- arrow = gtk_notebook_get_arrow (notebook, event->x, event->y);
+ if (!get_widget_coordinates (widget, (GdkEvent *)event, &x, &y))
+ return FALSE;
+
+ arrow = gtk_notebook_get_arrow (notebook, x, y);
if (arrow != notebook->in_child)
{
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkArrowType arrow;
+ gint x, y;
+
+ if (!get_widget_coordinates (widget, (GdkEvent *)event, &x, &y))
+ return FALSE;
- arrow = gtk_notebook_get_arrow (notebook, event->x, event->y);
+ arrow = gtk_notebook_get_arrow (notebook, x, y);
if (notebook->in_child)
{
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkArrowType arrow;
-
+ gint x, y;
+
if (notebook->button)
return FALSE;
- arrow = gtk_notebook_get_arrow (notebook, event->x, event->y);
+ if (!get_widget_coordinates (widget, (GdkEvent *)event, &x, &y))
+ return FALSE;
+
+ arrow = gtk_notebook_get_arrow (notebook, x, y);
if (arrow != notebook->in_child)
{