File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,8 @@ static void pluma_view_dispose (GObject *object);
107107static void pluma_view_finalize (GObject * object );
108108static gint pluma_view_focus_out (GtkWidget * widget ,
109109 GdkEventFocus * event );
110+ static gboolean pluma_view_scroll_event (GtkWidget * widget ,
111+ GdkEventScroll * event );
110112static gboolean pluma_view_drag_motion (GtkWidget * widget ,
111113 GdkDragContext * context ,
112114 gint x ,
@@ -181,6 +183,36 @@ document_read_only_notify_handler (PlumaDocument *document,
181183 !pluma_document_get_readonly (document ));
182184}
183185
186+ static gboolean
187+ pluma_view_scroll_event (GtkWidget * widget ,
188+ GdkEventScroll * event )
189+ {
190+ if (event -> direction == GDK_SCROLL_UP )
191+ {
192+ event -> delta_x = 0 ;
193+ event -> delta_y = -1 ;
194+ }
195+ else if (event -> direction == GDK_SCROLL_DOWN )
196+ {
197+ event -> delta_x = 0 ;
198+ event -> delta_y = 1 ;
199+ }
200+ else if (event -> direction == GDK_SCROLL_LEFT )
201+ {
202+ event -> delta_x = -1 ;
203+ event -> delta_y = 0 ;
204+ }
205+ else if (event -> direction == GDK_SCROLL_RIGHT )
206+ {
207+ event -> delta_x = 1 ;
208+ event -> delta_y = 0 ;
209+ }
210+
211+ event -> direction = GDK_SCROLL_SMOOTH ;
212+
213+ return FALSE;
214+ }
215+
184216static void
185217pluma_view_class_init (PlumaViewClass * klass )
186218{
@@ -195,6 +227,7 @@ pluma_view_class_init (PlumaViewClass *klass)
195227
196228 widget_class -> focus_out_event = pluma_view_focus_out ;
197229 widget_class -> draw = pluma_view_draw ;
230+ widget_class -> scroll_event = pluma_view_scroll_event ;
198231
199232 /*
200233 * Override the gtk_text_view_drag_motion and drag_drop
You can’t perform that action at this time.
0 commit comments