[glade/tintou/not-drag-child: 8/8] Prevent dragging an ancestor inside a child



commit f4a8742f65fd79e6729279d57608e490cf767093
Author: Corentin Noël <corentin noel collabora com>
Date:   Wed Jun 26 11:39:08 2019 +0200

    Prevent dragging an ancestor inside a child

 doc/meson.build             |  6 ++++--
 gladeui/glade-design-view.c | 33 +++++++++++++++++++++------------
 gladeui/meson.build         |  8 +++++++-
 3 files changed, 32 insertions(+), 15 deletions(-)
---
diff --git a/doc/meson.build b/doc/meson.build
index b3183070..36da1ff3 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -1,6 +1,8 @@
-private_headers = [
+private_doc_headers = [
   'glade-builtins.h',
   'glade-debug.h',
+  'glade-design-private.h',
+  'glade-drag.h',
   'glade-accumulators.h',
   'glade-marshallers.h',
   'glade-paths.h',
@@ -39,7 +41,7 @@ gnome.gtkdoc(
   main_xml: gladeui_name + '-docs.xml',
   module_version: gladeui_major_version.to_string(),
   src_dir: gladeui_inc,
-  ignore_headers: private_headers,
+  ignore_headers: private_doc_headers,
   include_directories: top_inc,
   dependencies: libgladeui_dep,
   content_files: content_files,
diff --git a/gladeui/glade-design-view.c b/gladeui/glade-design-view.c
index d6beede1..a548f398 100644
--- a/gladeui/glade-design-view.c
+++ b/gladeui/glade-design-view.c
@@ -558,19 +558,28 @@ glade_design_view_drag_motion (GtkWidget *widget,
 
       if (drag_target)
         {
-          GladeWidget *gwidget;
-
-          if (GLADE_IS_PLACEHOLDER (drag_target))
-            drag = GLADE_DRAG (drag_target);
-          else if ((gwidget = glade_widget_get_from_gobject (drag_target)))
-            {
-              while (gwidget && !_glade_drag_can_drop (GLADE_DRAG (gwidget),
-                                                       xx, yy, priv->drag_data))
-                gwidget = glade_widget_get_parent (gwidget);
-
-              if (gwidget)
-                drag = GLADE_DRAG (gwidget);
+          _GladeDrag *gwidget = NULL;
+
+          if (GLADE_IS_PLACEHOLDER (drag_target)) {
+              gwidget = (_GladeDrag *) drag_target;
+          } else if (GLADE_IS_WIDGET (drag_target)) {
+              gwidget = (_GladeDrag *) glade_widget_get_from_gobject ((GladeWidget *) drag_target);
+          }
+
+          while (gwidget && !_glade_drag_can_drop (gwidget,
+                                                   xx, yy, priv->drag_data)) {
+            if (GLADE_IS_WIDGET (gwidget)) {
+              gwidget = (_GladeDrag *) glade_widget_get_parent ((GladeWidget *) gwidget);
+            } else if (GLADE_IS_PLACEHOLDER (gwidget)) {
+              gwidget = (_GladeDrag *) glade_placeholder_get_parent ((GladePlaceholder *) gwidget);
+            } else {
+              gwidget = NULL;
             }
+          }
+
+          if (gwidget) {
+            drag = GLADE_DRAG (gwidget);
+          }
         }
     }
   else if (_glade_drag_can_drop (GLADE_DRAG (widget), x, y, priv->drag_data))
diff --git a/gladeui/meson.build b/gladeui/meson.build
index 309bc57d..a4cdcb29 100644
--- a/gladeui/meson.build
+++ b/gladeui/meson.build
@@ -56,6 +56,12 @@ headers = files(
   'glade-xml-utils.h',
 )
 
+private_headers = files(
+  'glade-drag.h',
+  'glade-private.h',
+  'glade-design-private.h',
+)
+
 install_headers(
   headers,
   subdir: 'lib@0@/@1@'.format(gladeui_libname, gladeui_name),
@@ -195,7 +201,7 @@ endif
 libgladeui = shared_library(
   '@0@-@1@'.format(gladeui_name, gladeui_major_version),
   version: gladeui_libversion,
-  sources: sources + enum_sources + marshal_sources,
+  sources: sources + enum_sources + marshal_sources + private_headers + headers,
   include_directories: top_inc,
   dependencies: deps + private_deps,
   c_args: common_c_flags,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]