[gtk+] listbox: Rewrite coords from child windows
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] listbox: Rewrite coords from child windows
- Date: Mon, 17 Jun 2013 13:16:03 +0000 (UTC)
commit e4a981eef22cb88cf2ffa086249b6db52b19f78a
Author: Alexander Larsson <alexl redhat com>
Date: Mon Jun 17 14:52:05 2013 +0200
listbox: Rewrite coords from child windows
If button events are from child windows we need to rewrite
the coordinates to our window.
gtk/gtklistbox.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index f335a1a..20b2fe9 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -1197,6 +1197,8 @@ gtk_list_box_real_button_press_event (GtkWidget *widget,
GtkListBox *list_box = GTK_LIST_BOX (widget);
GtkListBoxPrivate *priv = list_box->priv;
gboolean ctrl_pressed;
+ GdkWindow *window;
+ double x, y;
if (event->button == GDK_BUTTON_PRIMARY)
{
@@ -1206,7 +1208,17 @@ gtk_list_box_real_button_press_event (GtkWidget *widget,
priv->active_row = NULL;
- row = gtk_list_box_get_row_at_y (list_box, event->y);
+ window = event->window;
+ x = event->x;
+ y = event->y;
+
+ while (window && window != gtk_widget_get_window (widget))
+ {
+ gdk_window_coords_to_parent (window, x, y, &x, &y);
+ window = gdk_window_get_effective_parent (window);
+ }
+
+ row = gtk_list_box_get_row_at_y (list_box, y);
if (row != NULL)
{
if (ctrl_pressed)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]