forked from AuroraMiddleware/gtk
inspector: Use the new scroll-to-focus
This commit is contained in:
parent
13b6b9f2b4
commit
b339bde6a5
@ -90,7 +90,6 @@ struct _GtkInspectorGeneralPrivate
|
||||
GtkWidget *display_rgba;
|
||||
GtkWidget *display_composited;
|
||||
GtkSizeGroup *labels;
|
||||
GtkAdjustment *focus_adjustment;
|
||||
|
||||
GdkDisplay *display;
|
||||
};
|
||||
@ -816,7 +815,6 @@ static gboolean
|
||||
keynav_failed (GtkWidget *widget, GtkDirectionType direction, GtkInspectorGeneral *gen)
|
||||
{
|
||||
GtkWidget *next;
|
||||
gdouble value, lower, upper, page;
|
||||
|
||||
if (direction == GTK_DIR_DOWN && widget == gen->priv->version_box)
|
||||
next = gen->priv->env_box;
|
||||
@ -847,22 +845,6 @@ keynav_failed (GtkWidget *widget, GtkDirectionType direction, GtkInspectorGenera
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
value = gtk_adjustment_get_value (gen->priv->focus_adjustment);
|
||||
lower = gtk_adjustment_get_lower (gen->priv->focus_adjustment);
|
||||
upper = gtk_adjustment_get_upper (gen->priv->focus_adjustment);
|
||||
page = gtk_adjustment_get_page_size (gen->priv->focus_adjustment);
|
||||
|
||||
if (direction == GTK_DIR_UP && value > lower)
|
||||
{
|
||||
gtk_adjustment_set_value (gen->priv->focus_adjustment, lower);
|
||||
return TRUE;
|
||||
}
|
||||
else if (direction == GTK_DIR_DOWN && value < upper - page)
|
||||
{
|
||||
gtk_adjustment_set_value (gen->priv->focus_adjustment, upper - page);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -873,10 +855,6 @@ gtk_inspector_general_constructed (GObject *object)
|
||||
|
||||
G_OBJECT_CLASS (gtk_inspector_general_parent_class)->constructed (object);
|
||||
|
||||
gen->priv->focus_adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (gen->priv->swin));
|
||||
gtk_container_set_focus_vadjustment (GTK_CONTAINER (gen->priv->box),
|
||||
gen->priv->focus_adjustment);
|
||||
|
||||
g_signal_connect (gen->priv->version_box, "keynav-failed", G_CALLBACK (keynav_failed), gen);
|
||||
g_signal_connect (gen->priv->env_box, "keynav-failed", G_CALLBACK (keynav_failed), gen);
|
||||
g_signal_connect (gen->priv->display_box, "keynav-failed", G_CALLBACK (keynav_failed), gen);
|
||||
|
@ -90,8 +90,6 @@ struct _GtkInspectorVisualPrivate
|
||||
GtkWidget *touchscreen_switch;
|
||||
GtkWidget *software_gl_switch;
|
||||
|
||||
GtkAdjustment *focus_adjustment;
|
||||
|
||||
GtkInspectorOverlay *fps_overlay;
|
||||
GtkInspectorOverlay *updates_overlay;
|
||||
GtkInspectorOverlay *layout_overlay;
|
||||
@ -912,7 +910,6 @@ static gboolean
|
||||
keynav_failed (GtkWidget *widget, GtkDirectionType direction, GtkInspectorVisual *vis)
|
||||
{
|
||||
GtkWidget *next;
|
||||
gdouble value, lower, upper, page;
|
||||
|
||||
if (direction == GTK_DIR_DOWN &&
|
||||
widget == vis->priv->visual_box)
|
||||
@ -935,22 +932,6 @@ keynav_failed (GtkWidget *widget, GtkDirectionType direction, GtkInspectorVisual
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
value = gtk_adjustment_get_value (vis->priv->focus_adjustment);
|
||||
lower = gtk_adjustment_get_lower (vis->priv->focus_adjustment);
|
||||
upper = gtk_adjustment_get_upper (vis->priv->focus_adjustment);
|
||||
page = gtk_adjustment_get_page_size (vis->priv->focus_adjustment);
|
||||
|
||||
if (direction == GTK_DIR_UP && value > lower)
|
||||
{
|
||||
gtk_adjustment_set_value (vis->priv->focus_adjustment, lower);
|
||||
return TRUE;
|
||||
}
|
||||
else if (direction == GTK_DIR_DOWN && value < upper - page)
|
||||
{
|
||||
gtk_adjustment_set_value (vis->priv->focus_adjustment, upper - page);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1070,10 +1051,6 @@ gtk_inspector_visual_constructed (GObject *object)
|
||||
|
||||
G_OBJECT_CLASS (gtk_inspector_visual_parent_class)->constructed (object);
|
||||
|
||||
vis->priv->focus_adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (vis->priv->swin));
|
||||
gtk_container_set_focus_vadjustment (GTK_CONTAINER (vis->priv->box),
|
||||
vis->priv->focus_adjustment);
|
||||
|
||||
g_signal_connect (vis->priv->visual_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
|
||||
g_signal_connect (vis->priv->debug_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
|
||||
g_signal_connect (vis->priv->misc_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user