[Xfce4-commits] <midori:master> Drop KatzeScrolled in favour of GTK+ 3.4 touchscreen support

Christian Dywan noreply at xfce.org
Mon Feb 25 19:30:04 CET 2013


Updating branch refs/heads/master
         to b39b4287fb781ca94b0e2ee2c3be7d868e22cda9 (commit)
       from 09e0422ead571f748667dc9ca47ad1c1785a832e (commit)

commit b39b4287fb781ca94b0e2ee2c3be7d868e22cda9
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Feb 25 18:56:14 2013 +0100

    Drop KatzeScrolled in favour of GTK+ 3.4 touchscreen support

 katze/katze-scrolled.c      |  908 -------------------------------------------
 katze/katze-scrolled.h      |   59 ---
 katze/katze-utils.c         |   33 --
 katze/katze.h               |    1 -
 midori/midori-app.c         |    7 +-
 midori/midori-preferences.c |   20 +-
 midori/midori-settings.vala |    1 +
 midori/midori-view.c        |   14 +-
 po/POTFILES.in              |    1 -
 9 files changed, 14 insertions(+), 1030 deletions(-)

diff --git a/katze/katze-scrolled.c b/katze/katze-scrolled.c
deleted file mode 100644
index 0b2d7da..0000000
--- a/katze/katze-scrolled.c
+++ /dev/null
@@ -1,908 +0,0 @@
-/*
- Copyright (C) 2007 Henrik Hedberg <hhedberg at innologies.fi>
- Copyright (C) 2009 Nadav Wiener <nadavwr at yahoo.com>
- Copyright (C) 2009 Christian Dywan <christian at twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "katze-scrolled.h"
-#include "katze-utils.h"
-#include "midori/midori-core.h"
-
-#define DEFAULT_INTERVAL 50
-#define DEFAULT_DECELERATION 0.7
-#define DEFAULT_DRAGGING_STOPPED_DELAY 100
-
-/**
- * SECTION:katze-scrolled
- * @short_description: Implements drag scrolling and kinetic scrolling
- * @see_also: #GtkScrolledWindow
- *
- * A scrolled window derived from #GtkScrolledWindow that implements
- * drag scrolling and kinetic scrolling. Can be used as a drop-in replacement
- * for the existing #GtkScrolledWindow.
- *
- * If a direct child of the #KatzeScrolled has its own window
- * (InputOnly is enough for events), it is automatically activated when added
- * as a child. All motion events in that area will be used to scroll.
- *
- * If some descendant widgets capture button press, button release and/ or
- * motion nofity events, the user can not scroll the area by pressing those
- * widgets (unless the widget is activated). #GtkButton is a typical example
- * of that. Usually that is the desired behaviour.
- *
- * Any widget can be registered to provide pointer events for the
- * #KatzeScrolled by using the
- * #katze_scrolled_activate_scrolling function.
- *
- **/
-
-G_DEFINE_TYPE (KatzeScrolled, katze_scrolled, GTK_TYPE_SCROLLED_WINDOW);
-
-enum
-{
-    PROP_0,
-
-    PROP_DRAG_SCROLLING,
-    PROP_KINETIC_SCROLLING
-};
-
-static void
-katze_scrolled_set_property (GObject* object,
-                             guint prop_id,
-                             const GValue* value,
-                             GParamSpec* pspec);
-
-static void
-katze_scrolled_get_property (GObject* object,
-                             guint prop_id,
-                             GValue* value,
-                             GParamSpec* pspec);
-
-static void
-katze_scrolled_dispose (GObject* object);
-
-static void
-katze_scrolled_activate_scrolling (KatzeScrolled* scrolled,
-                                   GtkWidget*     widget);
-
-static void
-katze_scrolled_set_drag_scrolling (KatzeScrolled* scrolled,
-                                   gboolean       drag_scrolling);
-
-struct _KatzeScrolledPrivate
-{
-    /* Settings */
-    guint interval;
-    gdouble deceleration;
-    gboolean drag_scrolling;
-    gboolean kinetic_scrolling;
-    guint32 dragging_stopped_delay;
-    gboolean scrolling_hints;
-
-    /* Temporary variables */
-    gboolean dragged;
-    gboolean press_received;
-    GdkWindow* synthetic_crossing_event_window;
-
-    /* Disabling twice happening scrolling adjustment */
-    GtkAdjustment* hadjustment;
-    GtkWidget* viewport;
-
-    /* Motion scrolling */
-    gint start_x;
-    gint start_y;
-    gint previous_x;
-    gint previous_y;
-    gint farest_x;
-    gint farest_y;
-    guint32 start_time;
-    guint32 previous_time;
-    guint32 farest_time;
-    gboolean going_right;
-    gboolean going_down;
-
-    /* Kinetic scrolling */
-    guint scrolling_timeout_id;
-    gdouble horizontal_speed;
-    gdouble vertical_speed;
-    gdouble horizontal_deceleration;
-    gdouble vertical_deceleration;
-};
-
-typedef struct _KatzeScrolledState KatzeScrolledState;
-typedef gboolean (*KatzeScrolledEventHandler)(GdkEvent*           event,
-                                              KatzeScrolledState* state,
-                                              gpointer            user_data);
-
-typedef struct
-{
-    KatzeScrolledEventHandler event_handler;
-    gpointer user_data;
-} EventHandlerData;
-
-struct _KatzeScrolledState
-{
-    GList* current_event_handler;
-};
-
-static GList* event_handlers = NULL;
-
-static void
-katze_scrolled_event_handler_func (GdkEvent* event,
-                                   gpointer  data);
-
-static void
-katze_scrolled_event_handler_append (KatzeScrolledEventHandler event_handler,
-                                     gpointer                  user_data)
-{
-    EventHandlerData* data;
-
-    data = g_new0 (EventHandlerData, 1);
-    data->event_handler = event_handler;
-    data->user_data = user_data;
-    event_handlers = g_list_append (event_handlers, data);
-
-    gdk_event_handler_set ((GdkEventFunc)katze_scrolled_event_handler_func, NULL, NULL);
-}
-
-static void
-katze_scrolled_event_handler_next (GdkEvent*           event,
-                                   KatzeScrolledState* state)
-{
-    EventHandlerData* data;
-    gboolean stop_propagating;
-
-    state->current_event_handler = g_list_next (state->current_event_handler);
-    if (state->current_event_handler)
-    {
-        data = (EventHandlerData*)state->current_event_handler->data;
-        stop_propagating = data->event_handler (event, state, data->user_data);
-        if (!stop_propagating && state->current_event_handler)
-            g_critical ("%s: handler returned FALSE without calling %s first",
-                        G_STRFUNC, G_STRFUNC);
-    }
-    else
-        gtk_main_do_event (event);
-}
-
-static void
-katze_scrolled_event_handler_func (GdkEvent* event,
-                                   gpointer  user_data)
-{
-    KatzeScrolledState* state;
-    EventHandlerData* data;
-    gboolean stop_propagating;
-
-    state = g_slice_new (KatzeScrolledState);
-    state->current_event_handler = g_list_first (event_handlers);
-    if (state->current_event_handler)
-    {
-        data = (EventHandlerData*)state->current_event_handler->data;
-        stop_propagating = data->event_handler (event, state, data->user_data);
-        if (!stop_propagating && state->current_event_handler)
-            g_critical ("%s: handler returned FALSE without calling %s first",
-                        G_STRFUNC, "katze_scrolled_event_handler_next");
-    }
-    else
-        gtk_main_do_event (event);
-
-    g_slice_free (KatzeScrolledState, state);
-}
-
-static GdkWindow* current_gdk_window;
-static KatzeScrolled* current_scrolled_window;
-static GtkWidget* current_widget;
-static gboolean synthetized_crossing_event;
-
-static GTree* activated_widgets;
-
-static gint
-compare_pointers (gconstpointer a,
-                  gconstpointer b)
-{
-    return a - b;
-}
-
-static void
-disable_hadjustment (KatzeScrolled* scrolled)
-{
-    KatzeScrolledPrivate* priv = scrolled->priv;
-    GtkAdjustment* hadjustment;
-    GtkWidget* viewport;
-
-    if ((hadjustment = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scrolled)))
-        && priv->hadjustment != hadjustment)
-    {
-        priv->hadjustment = hadjustment;
-        priv->viewport = NULL;
-        viewport = GTK_WIDGET (scrolled);
-        while (GTK_IS_BIN (viewport))
-        {
-            viewport = gtk_bin_get_child (GTK_BIN (viewport));
-            if (GTK_IS_VIEWPORT (viewport))
-            {
-                priv->viewport = viewport;
-                break;
-            }
-        }
-    }
-    g_signal_handlers_block_matched (priv->hadjustment, G_SIGNAL_MATCH_DATA,
-                                     0, 0, 0, 0, priv->viewport);
-}
-
-static void
-enable_hadjustment (KatzeScrolled* scrolled)
-{
-    KatzeScrolledPrivate* priv = scrolled->priv;
-
-    g_signal_handlers_unblock_matched (priv->hadjustment, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, priv->viewport);
-}
-
-static gdouble
-calculate_timeout_scroll_values (gdouble  old_value,
-                                 gdouble  upper_limit,
-                                 gdouble* scrolling_speed_pointer,
-                                 gdouble  deceleration,
-                                 gdouble* other_deceleration,
-                                 gdouble normal_deceleration)
-{
-    gdouble new_value = old_value;
-
-    if (*scrolling_speed_pointer > deceleration ||
-        *scrolling_speed_pointer < -deceleration)
-    {
-        if (old_value + *scrolling_speed_pointer <= 0.0)
-        {
-            new_value = -1.0;
-            *scrolling_speed_pointer = 0.0;
-            *other_deceleration = normal_deceleration;
-        }
-        else if (old_value + *scrolling_speed_pointer >= upper_limit)
-        {
-            new_value = upper_limit;
-            *scrolling_speed_pointer = 0.0;
-            *other_deceleration = normal_deceleration;
-        }
-        else
-            new_value = old_value + *scrolling_speed_pointer;
-        if (*scrolling_speed_pointer > deceleration)
-            *scrolling_speed_pointer -= deceleration;
-        else if (*scrolling_speed_pointer < -deceleration)
-            *scrolling_speed_pointer += deceleration;
-    }
-
-    return new_value;
-}
-
-static void
-do_timeout_scroll (KatzeScrolled* scrolled)
-{
-    KatzeScrolledPrivate* priv = scrolled->priv;
-    GtkScrolledWindow* gtk_scrolled = GTK_SCROLLED_WINDOW (scrolled);
-    GtkAdjustment* hadjustment;
-    GtkAdjustment* vadjustment;
-    gdouble hpage_size, hupper, hvalue, new_hvalue;
-    gdouble vpage_size, vupper, vvalue, new_vvalue;
-
-    hadjustment = gtk_scrolled_window_get_hadjustment (gtk_scrolled);
-    hpage_size = gtk_adjustment_get_page_size (hadjustment);
-    hupper = gtk_adjustment_get_upper (hadjustment);
-    hvalue = gtk_adjustment_get_value (hadjustment);
-    new_hvalue = calculate_timeout_scroll_values (hvalue,
-        hupper - hpage_size,
-        &priv->horizontal_speed,
-        priv->horizontal_deceleration,
-        &priv->vertical_deceleration,
-        priv->deceleration);
-
-    vadjustment = gtk_scrolled_window_get_vadjustment (gtk_scrolled);
-    vpage_size = gtk_adjustment_get_page_size (vadjustment);
-    vupper = gtk_adjustment_get_upper (vadjustment);
-    vvalue = gtk_adjustment_get_value (vadjustment);
-    new_vvalue = calculate_timeout_scroll_values (vvalue,
-        vupper - vpage_size,
-        &priv->vertical_speed,
-        priv->vertical_deceleration,
-        &priv->horizontal_deceleration,
-        priv->deceleration);
-
-    if (new_vvalue != vvalue)
-    {
-        if (new_hvalue != hvalue)
-        {
-            disable_hadjustment (scrolled);
-            gtk_adjustment_set_value (hadjustment, new_hvalue);
-            enable_hadjustment (scrolled);
-        }
-        gtk_adjustment_set_value (vadjustment, new_vvalue);
-    }
-    else if (new_hvalue != hvalue)
-        gtk_adjustment_set_value (hadjustment, new_hvalue);
-}
-
-static gboolean
-timeout_scroll (gpointer data)
-{
-    gboolean ret = TRUE;
-    KatzeScrolled* scrolled = KATZE_SCROLLED (data);
-    KatzeScrolledPrivate* priv = scrolled->priv;
-
-    gdk_threads_enter ();
-    do_timeout_scroll (scrolled);
-
-    if (priv->vertical_speed < priv->deceleration &&
-        priv->vertical_speed > -priv->deceleration &&
-        priv->horizontal_speed < priv->deceleration &&
-        priv->horizontal_speed > -priv->deceleration)
-    {
-        priv->scrolling_timeout_id = 0;
-        ret = FALSE;
-    }
-    gdk_threads_leave ();
-
-    return ret;
-}
-
-static gdouble
-calculate_motion_scroll_values (gdouble old_value,
-                                gdouble upper_limit,
-                                gint    current_coordinate,
-                                gint    previous_coordinate)
-{
-    gdouble new_value = old_value;
-    gint movement;
-
-    movement = current_coordinate - previous_coordinate;
-
-    if (old_value - movement < upper_limit)
-        new_value = old_value - movement;
-    else
-        new_value = upper_limit;
-
-    return new_value;
-}
-
-static void
-do_motion_scroll (KatzeScrolled* scrolled,
-                  GtkWidget*     widget,
-                  gint           x,
-                  gint           y,
-                  guint32        timestamp)
-{
-    KatzeScrolledPrivate* priv = scrolled->priv;
-
-    if (priv->dragged || gtk_drag_check_threshold (widget, priv->start_x, priv->start_y, x, y))
-    {
-        GtkAdjustment* hadjustment;
-        GtkAdjustment* vadjustment;
-        gdouble hpage_size, hupper, hvalue, new_hvalue;
-        gdouble vpage_size, vupper, vvalue, new_vvalue;
-
-        if (timestamp - priv->previous_time > priv->dragging_stopped_delay || !priv->dragged)
-        {
-            priv->dragged = TRUE;
-            priv->going_right = priv->start_x < x;
-            priv->going_down = priv->start_y < y;
-            priv->start_x = priv->farest_x = x;
-            priv->start_y = priv->farest_y = y;
-            priv->start_time = priv->farest_time = timestamp;
-        }
-        else
-        {
-            if ((priv->going_right && x > priv->farest_x)
-                || (!priv->going_right && x < priv->farest_x))
-            {
-                priv->farest_x = x;
-                priv->farest_time = timestamp;
-            }
-            if ((priv->going_down && y > priv->farest_y)
-                || (!priv->going_down && y < priv->farest_y))
-            {
-                priv->farest_y = y;
-                priv->farest_time = timestamp;
-            }
-            if (gtk_drag_check_threshold (widget, priv->farest_x, priv->farest_y, x, y))
-            {
-                priv->start_x = priv->farest_x;
-                priv->farest_x = x;
-                priv->start_y = priv->farest_y;
-                priv->farest_y = y;
-                priv->start_time = priv->farest_time;
-                priv->farest_time = timestamp;
-                priv->going_right = priv->start_x < x;
-                priv->going_down = priv->start_y < y;
-            }
-        }
-
-        hadjustment = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scrolled));
-        hpage_size = gtk_adjustment_get_page_size (hadjustment);
-        hupper = gtk_adjustment_get_upper (hadjustment);
-        hvalue = gtk_adjustment_get_value (hadjustment);
-        new_hvalue = calculate_motion_scroll_values (hvalue,
-            hupper - hpage_size, x, priv->previous_x);
-
-        vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled));
-        vpage_size = gtk_adjustment_get_page_size (vadjustment);
-        vupper = gtk_adjustment_get_upper (vadjustment);
-        vvalue = gtk_adjustment_get_value (vadjustment);
-        new_vvalue = calculate_motion_scroll_values (vvalue,
-            vupper - vpage_size, y, priv->previous_y);
-        if (new_vvalue != vvalue)
-        {
-            if (new_hvalue != hvalue)
-            {
-                disable_hadjustment (scrolled);
-                gtk_adjustment_set_value (hadjustment, new_hvalue);
-                enable_hadjustment (scrolled);
-            }
-            gtk_adjustment_set_value (vadjustment, new_vvalue);
-        }
-        else if (new_hvalue != hvalue)
-            gtk_adjustment_set_value (hadjustment, new_hvalue);
-    }
-
-    priv->previous_y = y;
-    priv->previous_x = x;
-    priv->previous_time = timestamp;
-}
-
-static gboolean
-button_press_event (GtkWidget*      widget,
-                    GdkEventButton* event,
-                    KatzeScrolled*  scrolled)
-{
-    KatzeScrolledPrivate* priv = scrolled->priv;
-    gint x;
-    gint y;
-    GdkModifierType mask;
-
-    if (!priv->drag_scrolling || event->button != 1)
-        return FALSE;
-
-    priv->press_received = TRUE;
-    gdk_window_get_pointer (gtk_widget_get_window (GTK_WIDGET (scrolled)),
-                            &x, &y, &mask);
-    if (event->time - priv->previous_time < priv->dragging_stopped_delay &&
-        gtk_drag_check_threshold (widget, priv->previous_x, priv->previous_y, x, y))
-    {
-        if (priv->scrolling_timeout_id)
-        {
-            g_source_remove (priv->scrolling_timeout_id);
-            priv->scrolling_timeout_id = 0;
-        }
-        /* do_motion_scroll (scrolled, widget, x, y, event->time); */
-    }
-    else
-    {
-        if (priv->scrolling_timeout_id)
-        {
-            g_source_remove (priv->scrolling_timeout_id);
-            priv->scrolling_timeout_id = 0;
-            priv->previous_time = 0;
-        }
-        else
-        {
-            priv->dragged = FALSE;
-            priv->previous_time = event->time;
-        }
-        priv->start_x = priv->previous_x = priv->farest_x = x;
-        priv->start_y = priv->previous_y = priv->farest_y = y;
-        priv->start_time  = event->time;
-    }
-
-    return FALSE;
-}
-
-static gboolean
-button_release_event (GtkWidget*      widget,
-                      GdkEventButton* event,
-                      KatzeScrolled*  scrolled)
-{
-    KatzeScrolledPrivate* priv = scrolled->priv;
-    gint x;
-    gint y;
-    GdkModifierType mask;
-
-    gdk_window_get_pointer (gtk_widget_get_window (GTK_WIDGET (scrolled)),
-                            &x, &y, &mask);
-    if (priv->press_received &&
-        gtk_drag_check_threshold (widget, priv->start_x, priv->start_y, x, y)) {
-        priv->dragged = TRUE;
-    }
-
-    if (priv->press_received && priv->kinetic_scrolling &&
-        event->time - priv->previous_time < priv->dragging_stopped_delay) {
-        priv->vertical_speed = (gdouble)(priv->start_y - y) / (event->time - priv->start_time) * priv->interval;
-        priv->horizontal_speed = (gdouble)(priv->start_x - x) / (event->time - priv->start_time) * priv->interval;
-        if (ABS (priv->vertical_speed) > ABS (priv->horizontal_speed)) {
-            priv->vertical_deceleration = priv->deceleration;
-            priv->horizontal_deceleration = priv->deceleration * ABS (priv->horizontal_speed / priv->vertical_speed);
-        } else {
-            priv->horizontal_deceleration = priv->deceleration;
-            priv->vertical_deceleration = priv->deceleration * ABS (priv->vertical_speed / priv->horizontal_speed);
-        }
-        priv->scrolling_timeout_id = midori_timeout_add (priv->interval,
-            timeout_scroll, scrolled, NULL);
-
-        do_timeout_scroll (scrolled);
-    }
-    priv->previous_x = x;
-    priv->previous_y = y;
-    priv->previous_time = event->time;
-
-    priv->press_received = FALSE;
-
-    return FALSE;
-}
-
-static gboolean
-motion_notify_event (GtkWidget*      widget,
-                     GdkEventMotion* event,
-                     KatzeScrolled*  scrolled)
-{
-    KatzeScrolledPrivate* priv = scrolled->priv;
-    gint x;
-    gint y;
-    GdkModifierType mask;
-
-    if (priv->press_received)
-    {
-        gdk_window_get_pointer (gtk_widget_get_window (GTK_WIDGET (scrolled)),
-                                &x, &y, &mask);
-        do_motion_scroll (scrolled, widget, x, y, event->time);
-    }
-
-    return FALSE;
-}
-
-static gboolean
-katze_scrolled_event_handler (GdkEvent*           event,
-                              KatzeScrolledState* state,
-                              gpointer            user_data)
-{
-    gboolean stop_propagating;
-    GdkEventCrossing crossing;
-
-    stop_propagating = FALSE;
-
-    if (event->type == GDK_BUTTON_PRESS)
-    {
-        gdk_window_get_user_data (event->button.window, (gpointer)&current_widget);
-
-        if ((current_scrolled_window = g_tree_lookup (activated_widgets, current_widget)))
-        {
-            current_gdk_window = event->button.window;
-            stop_propagating = button_press_event (current_widget, &event->button, current_scrolled_window);
-        }
-        else
-            current_gdk_window = NULL;
-    }
-    else if (event->any.window == current_gdk_window)
-    {
-        if (event->type == GDK_MOTION_NOTIFY)
-        {
-            if (current_scrolled_window->priv->dragged)
-                stop_propagating = motion_notify_event (current_widget, &event->motion, current_scrolled_window);
-            else
-            {
-                stop_propagating = motion_notify_event (current_widget, &event->motion, current_scrolled_window);
-                if (current_scrolled_window->priv->dragged)
-                {
-                    crossing.type = GDK_LEAVE_NOTIFY;
-                    crossing.window = event->motion.window;
-                    crossing.send_event = event->motion.send_event;
-                    crossing.subwindow = gtk_widget_get_window (
-                        GTK_WIDGET (current_scrolled_window));
-                    crossing.time = event->motion.time;
-                    crossing.x = event->motion.x;
-                    crossing.y = event->motion.y;
-                    crossing.x_root = event->motion.x_root;
-                    crossing.y_root = event->motion.y_root;
-                    crossing.mode = GDK_CROSSING_GRAB;
-                    crossing.detail = GDK_NOTIFY_ANCESTOR;
-                    crossing.focus = TRUE;
-                    crossing.state = event->motion.state;
-
-                    gtk_main_do_event ((GdkEvent*)&crossing);
-                    synthetized_crossing_event = TRUE;
-                }
-            }
-        }
-        else if ((event->type == GDK_ENTER_NOTIFY || event->type == GDK_LEAVE_NOTIFY) &&
-                   synthetized_crossing_event)
-            stop_propagating = TRUE;
-        else if (event->type == GDK_BUTTON_RELEASE)
-            stop_propagating = button_release_event (current_widget, &event->button, current_scrolled_window);
-    }
-
-    if (!stop_propagating)
-        katze_scrolled_event_handler_next (event, state);
-
-    if (event->type == GDK_BUTTON_RELEASE && event->button.window == current_gdk_window)
-    {
-        crossing.type = GDK_ENTER_NOTIFY;
-        crossing.window = event->button.window;
-        crossing.send_event = event->button.send_event;
-        crossing.subwindow = gtk_widget_get_window (
-            GTK_WIDGET (current_scrolled_window));
-        crossing.time = event->button.time;
-        crossing.x = event->button.x;
-        crossing.y = event->button.y;
-        crossing.x_root = event->button.x_root;
-        crossing.y_root = event->button.y_root;
-        crossing.mode = GDK_CROSSING_UNGRAB;
-        crossing.detail = GDK_NOTIFY_ANCESTOR;
-        crossing.focus = TRUE;
-        crossing.state = event->button.state;
-
-        gtk_main_do_event ((GdkEvent*)&crossing);
-        synthetized_crossing_event = FALSE;
-    }
-
-    return stop_propagating;
-}
-
-static void
-katze_scrolled_add (GtkContainer* container,
-                    GtkWidget*    widget)
-{
-    katze_scrolled_activate_scrolling (KATZE_SCROLLED (container), widget);
-
-    (*GTK_CONTAINER_CLASS (katze_scrolled_parent_class)->add) (container, widget);
-}
-
-static void
-katze_scrolled_realize (GtkWidget* widget)
-{
-    KatzeScrolled* scrolled = KATZE_SCROLLED (widget);
-    gboolean drag_scrolling;
-    GtkPolicyType policy;
-    GdkWindow* window;
-    GdkWindowAttr attr;
-
-    (*GTK_WIDGET_CLASS (katze_scrolled_parent_class)->realize) (widget);
-
-    drag_scrolling = katze_widget_has_touchscreen_mode (widget);
-    policy = drag_scrolling ? GTK_POLICY_NEVER : GTK_POLICY_AUTOMATIC;
-    g_object_set (scrolled, "drag-scrolling", drag_scrolling,
-        "hscrollbar-policy", policy, "vscrollbar-policy", policy, NULL);
-
-    window = g_object_ref (gtk_widget_get_parent_window (widget));
-    gtk_widget_set_window (widget, window);
-
-    attr.height = attr.width = 10;
-    attr.event_mask = GDK_EXPOSURE_MASK;
-    attr.wclass = GDK_INPUT_OUTPUT;
-    attr.window_type = GDK_WINDOW_CHILD;
-    attr.override_redirect = TRUE;
-
-    gtk_widget_set_realized (widget, TRUE);
-}
-
-static void
-katze_scrolled_dispose (GObject* object)
-{
-    KatzeScrolled* scrolled = KATZE_SCROLLED (object);
-    KatzeScrolledPrivate* priv = scrolled->priv;
-
-    if (priv->scrolling_timeout_id)
-    {
-        g_source_remove (priv->scrolling_timeout_id);
-        priv->scrolling_timeout_id = 0;
-    }
-
-    (*G_OBJECT_CLASS (katze_scrolled_parent_class)->dispose) (object);
-}
-
-static void
-katze_scrolled_class_init (KatzeScrolledClass* class)
-{
-    GObjectClass* gobject_class;
-    GtkWidgetClass* widget_class;
-    GtkContainerClass* container_class;
-    GParamFlags flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT;
-
-    gobject_class = G_OBJECT_CLASS (class);
-    widget_class = GTK_WIDGET_CLASS (class);
-    container_class = GTK_CONTAINER_CLASS (class);
-
-    gobject_class->set_property = katze_scrolled_set_property;
-    gobject_class->get_property = katze_scrolled_get_property;
-    gobject_class->dispose = katze_scrolled_dispose;
-
-    widget_class->realize = katze_scrolled_realize;
-
-    container_class->add = katze_scrolled_add;
-
-    /**
-     * KatzeScrolled:drag-scrolling:
-     *
-     * Whether the widget can be scrolled by dragging its contents.
-     *
-     * If "gtk-touchscreen-mode" is enabled, drag scrolling is
-     * automatically enabled.
-     *
-     * Since: 0.2.0
-     */
-    g_object_class_install_property (gobject_class,
-                                     PROP_DRAG_SCROLLING,
-                                     g_param_spec_boolean (
-                                     "drag-scrolling",
-                                     "Drag Scrolling",
-                                     "Whether the widget can be scrolled by dragging its contents",
-                                     FALSE,
-                                     flags));
-
-    /**
-     * KatzeScrolled:kinetic-scrolling:
-     *
-     * Whether drag scrolling is kinetic, that is releasing the
-     * pointer keeps the contents scrolling further relative to
-     * the speed with which they were dragged.
-     *
-     * Since: 0.2.0
-     */
-    g_object_class_install_property (gobject_class,
-                                     PROP_KINETIC_SCROLLING,
-                                     g_param_spec_boolean (
-                                     "kinetic-scrolling",
-                                     "Kinetic Scrolling",
-                                     "Whether drag scrolling is kinetic",
-                                     TRUE,
-                                     flags));
-
-    activated_widgets = g_tree_new ((GCompareFunc)compare_pointers);
-    current_gdk_window = NULL;
-
-    /* Usually touchscreen mode is either always set or it isn't, so it
-      should be a safe optimization to not setup events if not needed. */
-    if (katze_widget_has_touchscreen_mode (NULL))
-        katze_scrolled_event_handler_append (katze_scrolled_event_handler, NULL);
-
-    g_type_class_add_private (class, sizeof (KatzeScrolledPrivate));
-}
-
-static void
-katze_scrolled_init (KatzeScrolled* scrolled)
-{
-    KatzeScrolledPrivate* priv;
-
-    scrolled->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE ((scrolled),
-        KATZE_TYPE_SCROLLED, KatzeScrolledPrivate);
-
-    priv->interval = DEFAULT_INTERVAL;
-    priv->deceleration = DEFAULT_DECELERATION;
-    priv->drag_scrolling = FALSE;
-    priv->kinetic_scrolling = TRUE;
-    priv->dragging_stopped_delay = DEFAULT_DRAGGING_STOPPED_DELAY;
-}
-
-static void
-katze_scrolled_set_property (GObject*      object,
-                             guint         prop_id,
-                             const GValue* value,
-                             GParamSpec*   pspec)
-{
-    KatzeScrolled* scrolled = KATZE_SCROLLED (object);
-
-    switch (prop_id)
-    {
-    case PROP_DRAG_SCROLLING:
-        katze_scrolled_set_drag_scrolling (scrolled, g_value_get_boolean (value));
-        break;
-    case PROP_KINETIC_SCROLLING:
-        scrolled->priv->kinetic_scrolling = g_value_get_boolean (value);
-        break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-        break;
-    }
-}
-
-static void
-katze_scrolled_get_property (GObject*    object,
-                             guint       prop_id,
-                             GValue*     value,
-                             GParamSpec* pspec)
-{
-    KatzeScrolled* scrolled = KATZE_SCROLLED (object);
-
-    switch (prop_id)
-    {
-    case PROP_DRAG_SCROLLING:
-        g_value_set_boolean (value, scrolled->priv->drag_scrolling);
-        break;
-    case PROP_KINETIC_SCROLLING:
-        g_value_set_boolean (value, scrolled->priv->kinetic_scrolling);
-        break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-        break;
-    }
-}
-
-/**
- * katze_scrolled_new:
- * @hadjustment: a horizontal #GtkAdjustment, or %NULL
- * @vadjustment: a vertical #GtkAdjustment, or %NULL
- *
- * Creates a new #KatzeScrolled.
- *
- * Since: 0.2.0
- **/
-
-GtkWidget*
-katze_scrolled_new (GtkAdjustment* hadjustment,
-                            GtkAdjustment* vadjustment)
-{
-    if (hadjustment)
-        g_return_val_if_fail (GTK_IS_ADJUSTMENT (hadjustment), NULL);
-    if (vadjustment)
-        g_return_val_if_fail (GTK_IS_ADJUSTMENT (vadjustment), NULL);
-
-    return gtk_widget_new (KATZE_TYPE_SCROLLED,
-                           "hadjustment", hadjustment,
-                           "vadjustment", vadjustment, NULL);
-}
-
-/**
- * katze_scrolled_activate_scrolling:
- * @scrolled: a #KatzeScrolled
- * @widget: a #GtkWidget of which area is made active event source for
- * drag and kinetic scrolling.
- *
- * Activates the widget so that pointer motion events inside the widget are
- * used to scroll the #KatzeScrolled. The widget can be a child of the
- * #KatzeScrolled or even a separate widget ("touchpad" style).
- *
- * The direct child of the #KatzeScrolled (typically #GtkViewport) is
- * activated automatically when added. This function has to be used if indirect
- * descendant widgets are stopping propagation of the button press and release
- * as well as motion events (for example GtkButton is doing so) but scrolling
- * should be possible inside their area too.
- *
- * This function adds #GDK_BUTTON_PRESS_MASK, #GDK_BUTTON_RELEASE_MASK,
- * #GDK_POINTER_MOTION_MASK, and #GDK_MOTION_HINT_MAKS into the widgets event mask.
- */
-
-static void
-katze_scrolled_activate_scrolling (KatzeScrolled* scrolled,
-                                   GtkWidget*     widget)
-{
-    gtk_widget_add_events (widget,
-        GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-        | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
-    g_tree_insert (activated_widgets, widget, scrolled);
-}
-
-static void
-katze_scrolled_set_drag_scrolling (KatzeScrolled* scrolled,
-                                   gboolean       drag_scrolling)
-{
-    KatzeScrolledPrivate* priv = scrolled->priv;
-
-    if (priv->drag_scrolling && !drag_scrolling)
-    {
-        if (priv->scrolling_timeout_id)
-        {
-            g_source_remove (priv->scrolling_timeout_id);
-            priv->scrolling_timeout_id = 0;
-            priv->previous_time = 0;
-        }
-
-        priv->press_received = FALSE;
-    }
-
-    priv->drag_scrolling = drag_scrolling;
-}
diff --git a/katze/katze-scrolled.h b/katze/katze-scrolled.h
deleted file mode 100644
index 5535d44..0000000
--- a/katze/katze-scrolled.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- Copyright (C) 2007 Henrik Hedberg <hhedberg at innologies.fi>
- Copyright (C) 2009 Nadav Wiener <nadavwr at yahoo.com>
- Copyright (C) 2009 Christian Dywan <christian at twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
- */
-
-#ifndef KATZE_SCROLLED_H
-#define KATZE_SCROLLED_H
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define KATZE_TYPE_SCROLLED (katze_scrolled_get_type())
-#define KATZE_SCROLLED(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), KATZE_TYPE_SCROLLED, KatzeScrolled))
-#define KATZE_SCROLLED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), KATZE_TYPE_SCROLLED, KatzeScrolledClass))
-#define KATZE_IS_SCROLLED(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), KATZE_TYPE_SCROLLED))
-#define KATZE_IS_SCROLLED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), KATZE_TYPE_SCROLLED))
-#define KATZE_SCROLLED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), KATZE_TYPE_SCROLLED, KatzeScrolledClass))
-
-typedef struct _KatzeScrolled KatzeScrolled;
-typedef struct _KatzeScrolledClass KatzeScrolledClass;
-typedef struct _KatzeScrolledPrivate KatzeScrolledPrivate;
-
-struct _KatzeScrolled
-{
-    GtkScrolledWindow parent;
-
-    KatzeScrolledPrivate* priv;
-};
-
-struct _KatzeScrolledClass
-{
-    GtkScrolledWindowClass parent;
-
-    /* Padding for future expansion */
-    void (*_katze_reserved1) (void);
-    void (*_katze_reserved2) (void);
-    void (*_katze_reserved3) (void);
-    void (*_katze_reserved4) (void);
-};
-
-GType
-katze_scrolled_get_type         (void) G_GNUC_CONST;
-
-GtkWidget*
-katze_scrolled_new              (GtkAdjustment* hadjustment,
-                                 GtkAdjustment* vadjustment);
-
-G_END_DECLS
-
-#endif /* __KATZE_SCROLLED_H__ */
diff --git a/katze/katze-utils.c b/katze/katze-utils.c
index 8826dd2..00cc408 100644
--- a/katze/katze-utils.c
+++ b/katze/katze-utils.c
@@ -1314,39 +1314,6 @@ katze_mkdir_with_parents (const gchar* pathname,
     return 0;
 }
 
-/**
- * katze_widget_has_touchscreen_mode:
- * @widget: a #GtkWidget, or %NULL
- *
- * Determines whether @widget should operate in touchscreen
- * mode, as determined by GtkSettings or the environment
- * variable MIDORI_TOUCHSCREEN.
- *
- * If @widget is %NULL, the default screen will be used.
- *
- * Returns: %TRUE if touchscreen mode should be used
- *
- * Since: 0.2.1
- */
-gboolean
-katze_widget_has_touchscreen_mode (GtkWidget* widget)
-{
-    const gchar* touchscreen = g_getenv ("MIDORI_TOUCHSCREEN");
-    if (touchscreen && touchscreen[0] == '1')
-        return TRUE;
-    else if (touchscreen && touchscreen[0] == '0')
-        return FALSE;
-    else
-    {
-        GdkScreen* screen = widget && gtk_widget_has_screen (widget)
-            ? gtk_widget_get_screen (widget) : gdk_screen_get_default ();
-        GtkSettings* gtk_settings = gtk_settings_get_for_screen (screen);
-        gboolean enabled;
-        g_object_get (gtk_settings, "gtk-touchscreen-mode", &enabled, NULL);
-        return enabled;
-    }
-}
-
 static void
 katze_uri_entry_changed_cb (GtkWidget* entry,
                             GtkWidget* other_widget)
diff --git a/katze/katze.h b/katze/katze.h
index c31fb96..773a5f1 100644
--- a/katze/katze.h
+++ b/katze/katze.h
@@ -22,7 +22,6 @@
 #include "katze-arrayaction.h"
 #include "katze-separatoraction.h"
 #include "katze-net.h"
-#include "katze-scrolled.h"
 #include "katze-preferences.h"
 
 #endif /* __KATZE_H__ */
diff --git a/midori/midori-app.c b/midori/midori-app.c
index 360111a..7289453 100644
--- a/midori/midori-app.c
+++ b/midori/midori-app.c
@@ -1447,12 +1447,17 @@ gboolean
 midori_debug (const gchar* token)
 {
     static const gchar* debug_token = NULL;
-    const gchar* debug = g_getenv ("MIDORI_DEBUG");
     const gchar* debug_tokens = "headers body referer cookies paths hsts unarmed bookmarks ";
     const gchar* full_debug_tokens = "adblock:match adblock:time startup ";
     if (debug_token == NULL)
     {
         gchar* found_token;
+        const gchar* debug = g_getenv ("MIDORI_DEBUG");
+        const gchar* legacy_touchscreen = g_getenv ("MIDORI_TOUCHSCREEN");
+        if (legacy_touchscreen && *legacy_touchscreen)
+            g_warning ("MIDORI_TOUCHSCREEN is obsolete: "
+                "GTK+ 3.4 enables touchscreens automatically, "
+                "older GTK+ versions aren't supported as of Midori 0.4.9");
         if (debug && (found_token = strstr (full_debug_tokens, debug)) && *(found_token + strlen (debug)) == ' ')
         {
             #ifdef G_ENABLE_DEBUG
diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c
index 630c943..28cb2a4 100644
--- a/midori/midori-preferences.c
+++ b/midori/midori-preferences.c
@@ -396,19 +396,9 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
     gtk_button_set_label (GTK_BUTTON (button), _("Allow scripts to open popups"));
     gtk_widget_set_tooltip_text (button, _("Whether scripts are allowed to open popup windows automatically"));
     SPANNED_ADD (button);
-    if (katze_widget_has_touchscreen_mode (parent ?
-        GTK_WIDGET (parent) : GTK_WIDGET (preferences)))
-    {
-        button = katze_property_proxy (settings, "kinetic-scrolling", NULL);
-        gtk_button_set_label (GTK_BUTTON (button), _("Kinetic scrolling"));
-        gtk_widget_set_tooltip_text (button, _("Whether scrolling should kinetically move according to speed"));
-    }
-    else
-    {
-        button = katze_property_proxy (settings, "middle-click-opens-selection", NULL);
-        gtk_button_set_label (GTK_BUTTON (button), _("Middle click opens Selection"));
-        gtk_widget_set_tooltip_text (button, _("Load an address from the selection via middle click"));
-    }
+    button = katze_property_proxy (settings, "middle-click-opens-selection", NULL);
+    gtk_button_set_label (GTK_BUTTON (button), _("Middle click opens Selection"));
+    gtk_widget_set_tooltip_text (button, _("Load an address from the selection via middle click"));
     INDENTED_ADD (button);
     #ifndef G_OS_WIN32
     button = katze_property_proxy (settings, "flash-window-on-new-bg-tabs", NULL);
@@ -595,9 +585,9 @@ midori_preferences_add_extension_category (KatzePreferences*  preferences,
     }
     g_object_unref (array);
 
-    scrolled = g_object_new (KATZE_TYPE_SCROLLED, "visible", TRUE, NULL);
+    scrolled = gtk_scrolled_window_new (NULL, NULL);
     /* For lack of a better way of keeping descriptions visible */
-    g_object_set (scrolled, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
+    g_object_set (scrolled, "visible", TRUE, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
     addon = g_object_new (MIDORI_TYPE_EXTENSIONS, "app", app, NULL);
     children = gtk_container_get_children (GTK_CONTAINER (addon));
     gtk_widget_reparent (g_list_nth_data (children, 0), scrolled);
diff --git a/midori/midori-settings.vala b/midori/midori-settings.vala
index 14999d8..1f33058 100644
--- a/midori/midori-settings.vala
+++ b/midori/midori-settings.vala
@@ -92,6 +92,7 @@ namespace Midori {
         /* Since: 0.1.3 */
         public bool zoom_text_and_images { get; set; default = true; }
         /* Since: 0.2.0 */
+        // [Deprecated (since = "0.4.9")]
         public bool kinetic_scrolling { get; set; default = true; }
         public bool middle_click_opens_selection { get; set; default = true; }
         public bool flash_window_on_new_bg_tabs { get; set; default = false; }
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 53521ff..2f26041 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -123,7 +123,6 @@ struct _MidoriView
     #endif
     KatzeItem* item;
     gint scrollh, scrollv;
-    gboolean back_forward_set;
     GtkWidget* scrolled_window;
 
     #if GTK_CHECK_VERSION (3, 2, 0)
@@ -3155,10 +3154,8 @@ midori_view_init (MidoriView* view)
     view->item = katze_item_new ();
 
     view->scrollh = view->scrollv = -2;
-    view->back_forward_set = FALSE;
-
     /* Adjustments are not created initially, but overwritten later */
-    view->scrolled_window = katze_scrolled_new (NULL, NULL);
+    view->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
     gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view->scrolled_window),
                                          GTK_SHADOW_NONE);
 
@@ -3286,7 +3283,7 @@ static void
 _midori_view_set_settings (MidoriView*        view,
                            MidoriWebSettings* settings)
 {
-    gboolean zoom_text_and_images, kinetic_scrolling;
+    gboolean zoom_text_and_images;
 
     if (view->settings)
         g_signal_handlers_disconnect_by_func (view->settings,
@@ -3302,7 +3299,6 @@ _midori_view_set_settings (MidoriView*        view,
 
     g_object_get (view->settings,
         "zoom-text-and-images", &zoom_text_and_images,
-        "kinetic-scrolling", &kinetic_scrolling,
         "close-buttons-on-tabs", &view->close_buttons_on_tabs,
         "open-new-pages-in", &view->open_new_pages_in,
         "middle-click-opens-selection", &view->middle_click_opens_selection,
@@ -3313,7 +3309,6 @@ _midori_view_set_settings (MidoriView*        view,
                   "settings", settings,
                   "full-content-zoom", zoom_text_and_images,
                   NULL);
-    g_object_set (view->scrolled_window, "kinetic-scrolling", kinetic_scrolling, NULL);
 }
 
 /**
@@ -3390,11 +3385,6 @@ midori_view_settings_notify_cb (MidoriWebSettings* settings,
             g_object_set (view->web_view, "full-content-zoom",
                           g_value_get_boolean (&value), NULL);
     }
-    else if (name == g_intern_string ("kinetic-scrolling"))
-    {
-        g_object_set (view, "kinetic-scrolling",
-                      g_value_get_boolean (&value), NULL);
-    }
     else if (name == g_intern_string ("close-buttons-on-tabs"))
     {
         view->close_buttons_on_tabs = g_value_get_boolean (&value);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 50b04bf..a9cad0a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -63,7 +63,6 @@ extensions/toolbar-editor.c
 extensions/web-cache.c
 katze/katze-net.c
 katze/midori-hsts.vala
-katze/katze-scrolled.c
 katze/katze-separatoraction.c
 katze/gtk3-compat.c
 katze/katze-http-cookies-sqlite.c


More information about the Xfce4-commits mailing list