Only handle key bindings for scrolling if the scrollbars are visible.

2007-01-01  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkscrolledwindow.h:
        * gtk/gtkscrolledwindow.c: Only handle key bindings
        for scrolling if the scrollbars are visible.
        (#340135, Christian Persch)



svn path=/trunk/; revision=17012
This commit is contained in:
Matthias Clasen 2007-01-02 07:07:09 +00:00 committed by Matthias Clasen
parent a441ab05f1
commit 5b352c0a63
3 changed files with 23 additions and 8 deletions

View File

@ -1,3 +1,10 @@
2007-01-01 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c: Only handle key bindings
for scrolling if the scrollbars are visible.
(#340135, Christian Persch)
2007-01-01 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_hpages):

View File

@ -131,7 +131,7 @@ static void gtk_scrolled_window_forall (GtkContainer *cont
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window,
static gboolean gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window,
GtkScrollType scroll,
gboolean horizontal);
static void gtk_scrolled_window_move_focus_out (GtkScrolledWindow *scrolled_window,
@ -311,8 +311,8 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkScrolledWindowClass, scroll_child),
NULL, NULL,
_gtk_marshal_VOID__ENUM_BOOLEAN,
G_TYPE_NONE, 2,
_gtk_marshal_BOOLEAN__ENUM_BOOLEAN,
G_TYPE_BOOLEAN, 2,
GTK_TYPE_SCROLL_TYPE,
G_TYPE_BOOLEAN);
signals[MOVE_FOCUS_OUT] =
@ -1000,7 +1000,7 @@ gtk_scrolled_window_forall (GtkContainer *container,
}
}
static void
static gboolean
gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window,
GtkScrollType scroll,
gboolean horizontal)
@ -1050,9 +1050,13 @@ gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window,
break;
default:
g_warning ("Invalid scroll type %u for GtkSpinButton::change-value", scroll);
return;
return FALSE;
}
if ((horizontal && (!scrolled_window->hscrollbar || !scrolled_window->hscrollbar_visible)) ||
(!horizontal && (!scrolled_window->vscrollbar || !scrolled_window->vscrollbar_visible)))
return FALSE;
if (horizontal)
{
if (scrolled_window->hscrollbar)
@ -1096,7 +1100,11 @@ gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window,
value = CLAMP (value, adjustment->lower, adjustment->upper - adjustment->page_size);
gtk_adjustment_set_value (adjustment, value);
return TRUE;
}
return FALSE;
}
static void

View File

@ -81,9 +81,9 @@ struct _GtkScrolledWindowClass
* no horizontal/vertical variants for GTK_SCROLL_START/END,
* so we have to add an additional boolean flag.
*/
void (*scroll_child) (GtkScrolledWindow *scrolled_window,
GtkScrollType scroll,
gboolean horizontal);
gboolean (*scroll_child) (GtkScrolledWindow *scrolled_window,
GtkScrollType scroll,
gboolean horizontal);
void (* move_focus_out) (GtkScrolledWindow *scrolled_window,
GtkDirectionType direction);