[gdl] [dock] bgo #654334 - Docking windows in not working with latest version of Gtk
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdl] [dock] bgo #654334 - Docking windows in not working with latest version of Gtk
- Date: Sat, 30 Jul 2011 16:23:38 +0000 (UTC)
commit 15c8490153862727b29875cb4618724fbf6a9b8f
Author: SÃbastien Granjoux <seb sfo free fr>
Date: Sat Jul 30 18:20:08 2011 +0200
[dock] bgo #654334 - Docking windows in not working with latest version of Gtk
It was due to commit 206b9f940d632dd0ed10ab8046777956872555eb of gtk+, creating a window for each child of the GtkPaned widget.
gdl/gdl-dock-paned.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/gdl/gdl-dock-paned.c b/gdl/gdl-dock-paned.c
index 3ce1a12..a1eac1f 100644
--- a/gdl/gdl-dock-paned.c
+++ b/gdl/gdl-dock-paned.c
@@ -365,17 +365,24 @@ gdl_dock_paned_request_foreach (GdlDockObject *object,
gpointer user_data)
{
struct {
+ GtkWidget *parent;
gint x, y;
GdlDockRequest *request;
gboolean may_dock;
} *data = user_data;
-
+
+ gint child_x, child_y;
GdlDockRequest my_request;
gboolean may_dock;
+ /* Translate parent coordinate to child coordinate */
+ gtk_widget_translate_coordinates (data->parent, GTK_WIDGET (object), data->x, data->y, &child_x, &child_y);
+
my_request = *data->request;
- may_dock = gdl_dock_object_dock_request (object, data->x, data->y, &my_request);
+ may_dock = gdl_dock_object_dock_request (object, child_x, child_y, &my_request);
if (may_dock) {
+ /* Translate request coordinate back to parent coordinate */
+ gtk_widget_translate_coordinates (GTK_WIDGET (object), data->parent, my_request.rect.x, my_request.rect.y, &my_request.rect.x, &my_request.rect.y);
data->may_dock = TRUE;
*data->request = my_request;
}
@@ -453,14 +460,18 @@ gdl_dock_paned_dock_request (GdlDockObject *object,
} else { /* Otherwise try our children. */
struct {
+ GtkWidget *parent;
gint x, y;
GdlDockRequest *request;
gboolean may_dock;
} data;
/* give them coordinates in their allocation system... the
- GtkPaned has no window, so our children allocation
- coordinates are our window coordinates */
+ GtkPaned has its own window in Gtk 3.1.6, so our children
+ allocation coordinates has to be translated to and from
+ our window coordinates. It is done in the
+ gdl_dock_paned_request_foreach function. */
+ data.parent = GTK_WIDGET (object);
data.x = rel_x;
data.y = rel_y;
data.request = &my_request;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]