← Back to team overview

geda-developers team mailing list archive

Fix for broken zooming in gschem

 

Hi Ed,

Here is my attempt at a fix for the scrolling issue I mentioned earlier
(by private email). It restores the previous behaviour for me.

The patch acts to bypass the GTK internal event handler inside the
GtkScrolledWindow widget.

Would you mind taking a look at the approach taken and give me your thoughts?


If you have no objection, I'll push this tomorrow evening.

Best wishes,

-- 
Peter Clifton <peter.clifton@xxxxxxxxxxxxxxxxxxxxxxxxx>

Clifton Electronics

-- 
Peter Clifton <peter.clifton@xxxxxxxxxxxxxxxxxxxxxxxxx>

Clifton Electronics
>From 4e64bc9f6a1cc873318ba815520bf90a7ba55e93 Mon Sep 17 00:00:00 2001
From: Peter Clifton <peter@xxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Oct 2013 02:32:24 +0100
Subject: [PATCH] Fix zooming support broken in commit
 fb958cc4f6aec2b2a3b13a72f78d3dff2ae6ada9

Attach our x_event_scroll() handler to the drawing area, not the main window,
so we receive the event before the GtkScrolledWindow container.

Make x_event_scroll() return TRUE, stopping further signal processing, which
avoids both our, and the built-in GtkScrolledWindow signal handlers trying to
act on the event.
---
 gschem/src/x_event.c  | 3 ++-
 gschem/src/x_window.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c
index 73c7672..6367a3b 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -1377,7 +1377,8 @@ gint x_event_scroll (GtkWidget *widget, GdkEventScroll *event,
     o_undo_savestate(w_current, UNDO_VIEWPORT_ONLY);
   }
 
-  return 0;
+  /* Stop further processing of this signal */
+  return TRUE;
 }
 
 
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index 4c041e6..8ae207c 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -141,10 +141,10 @@ void x_window_setup_draw_events(GschemToplevel *w_current)
     { "configure_event",      G_CALLBACK(x_event_configure)       },
     { "key_press_event",      G_CALLBACK(x_event_key)             },
     { "key_release_event",    G_CALLBACK(x_event_key)             },
+    { "scroll_event",         G_CALLBACK(x_event_scroll)          },
     { NULL,                   NULL                                } };
   struct event_reg_t main_window_events[] = {
     { "enter_notify_event",   G_CALLBACK(x_event_enter)           },
-    { "scroll_event",         G_CALLBACK(x_event_scroll)          },
     { NULL,                   NULL                                } };
   struct event_reg_t *tmp;
 
-- 
1.8.3.2