Compare commits
3 Commits
shader-too
...
wip/matthi
Author | SHA1 | Date | |
---|---|---|---|
|
62bc807e1d | ||
|
a2549a3378 | ||
|
e91bca2b4e |
@@ -128,7 +128,6 @@ struct _GtkContainerPrivate
|
|||||||
enum {
|
enum {
|
||||||
ADD,
|
ADD,
|
||||||
REMOVE,
|
REMOVE,
|
||||||
SET_FOCUS_CHILD,
|
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -149,8 +148,8 @@ static void gtk_container_remove_unimplemented (GtkContainer *container
|
|||||||
static void gtk_container_compute_expand (GtkWidget *widget,
|
static void gtk_container_compute_expand (GtkWidget *widget,
|
||||||
gboolean *hexpand_p,
|
gboolean *hexpand_p,
|
||||||
gboolean *vexpand_p);
|
gboolean *vexpand_p);
|
||||||
static void gtk_container_real_set_focus_child (GtkContainer *container,
|
static void gtk_container_set_focus_child (GtkWidget *widget,
|
||||||
GtkWidget *widget);
|
GtkWidget *focus_child);
|
||||||
|
|
||||||
static void gtk_container_children_callback (GtkWidget *widget,
|
static void gtk_container_children_callback (GtkWidget *widget,
|
||||||
gpointer client_data);
|
gpointer client_data);
|
||||||
@@ -278,11 +277,11 @@ gtk_container_class_init (GtkContainerClass *class)
|
|||||||
widget_class->destroy = gtk_container_destroy;
|
widget_class->destroy = gtk_container_destroy;
|
||||||
widget_class->compute_expand = gtk_container_compute_expand;
|
widget_class->compute_expand = gtk_container_compute_expand;
|
||||||
widget_class->get_request_mode = gtk_container_get_request_mode;
|
widget_class->get_request_mode = gtk_container_get_request_mode;
|
||||||
|
widget_class->set_focus_child = gtk_container_set_focus_child;
|
||||||
|
|
||||||
class->add = gtk_container_add_unimplemented;
|
class->add = gtk_container_add_unimplemented;
|
||||||
class->remove = gtk_container_remove_unimplemented;
|
class->remove = gtk_container_remove_unimplemented;
|
||||||
class->forall = NULL;
|
class->forall = NULL;
|
||||||
class->set_focus_child = gtk_container_real_set_focus_child;
|
|
||||||
class->child_type = NULL;
|
class->child_type = NULL;
|
||||||
class->get_path_for_child = gtk_container_real_get_path_for_child;
|
class->get_path_for_child = gtk_container_real_get_path_for_child;
|
||||||
|
|
||||||
@@ -304,15 +303,6 @@ gtk_container_class_init (GtkContainerClass *class)
|
|||||||
NULL,
|
NULL,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
GTK_TYPE_WIDGET);
|
GTK_TYPE_WIDGET);
|
||||||
container_signals[SET_FOCUS_CHILD] =
|
|
||||||
g_signal_new (I_("set-focus-child"),
|
|
||||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
||||||
G_SIGNAL_RUN_FIRST,
|
|
||||||
G_STRUCT_OFFSET (GtkContainerClass, set_focus_child),
|
|
||||||
NULL, NULL,
|
|
||||||
NULL,
|
|
||||||
G_TYPE_NONE, 1,
|
|
||||||
GTK_TYPE_WIDGET);
|
|
||||||
|
|
||||||
if (GtkContainer_private_offset != 0)
|
if (GtkContainer_private_offset != 0)
|
||||||
g_type_class_adjust_private_offset (class, &GtkContainer_private_offset);
|
g_type_class_adjust_private_offset (class, &GtkContainer_private_offset);
|
||||||
@@ -1547,31 +1537,6 @@ gtk_container_foreach (GtkContainer *container,
|
|||||||
class->forall (container, callback, callback_data);
|
class->forall (container, callback, callback_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gtk_container_set_focus_child:
|
|
||||||
* @container: a #GtkContainer
|
|
||||||
* @child: (allow-none): a #GtkWidget, or %NULL
|
|
||||||
*
|
|
||||||
* Sets, or unsets if @child is %NULL, the focused child of @container.
|
|
||||||
*
|
|
||||||
* This function emits the GtkContainer::set_focus_child signal of
|
|
||||||
* @container. Implementations of #GtkContainer can override the
|
|
||||||
* default behaviour by overriding the class closure of this signal.
|
|
||||||
*
|
|
||||||
* This is function is mostly meant to be used by widgets. Applications can use
|
|
||||||
* gtk_widget_grab_focus() to manually set the focus to a specific widget.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gtk_container_set_focus_child (GtkContainer *container,
|
|
||||||
GtkWidget *child)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GTK_IS_CONTAINER (container));
|
|
||||||
if (child)
|
|
||||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
|
||||||
|
|
||||||
g_signal_emit (container, container_signals[SET_FOCUS_CHILD], 0, child);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_container_get_children:
|
* gtk_container_get_children:
|
||||||
* @container: a #GtkContainer
|
* @container: a #GtkContainer
|
||||||
@@ -1626,8 +1591,8 @@ gtk_container_compute_expand (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_container_real_set_focus_child (GtkContainer *container,
|
gtk_container_set_focus_child (GtkWidget *container,
|
||||||
GtkWidget *focus_child)
|
GtkWidget *focus_child)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_CONTAINER (container));
|
g_return_if_fail (GTK_IS_CONTAINER (container));
|
||||||
g_return_if_fail (focus_child == NULL || GTK_IS_WIDGET (focus_child));
|
g_return_if_fail (focus_child == NULL || GTK_IS_WIDGET (focus_child));
|
||||||
|
@@ -58,7 +58,6 @@ struct _GtkContainer
|
|||||||
* @remove: Signal emitted when a widget is removed from container.
|
* @remove: Signal emitted when a widget is removed from container.
|
||||||
* @forall: Invokes callback on each child of container. The callback handler
|
* @forall: Invokes callback on each child of container. The callback handler
|
||||||
* may remove the child.
|
* may remove the child.
|
||||||
* @set_focus_child: Sets the focused child of container.
|
|
||||||
* @child_type: Returns the type of the children supported by the container.
|
* @child_type: Returns the type of the children supported by the container.
|
||||||
* @set_child_property: Set a property on a child of container.
|
* @set_child_property: Set a property on a child of container.
|
||||||
* @get_child_property: Get a property from a child of container.
|
* @get_child_property: Get a property from a child of container.
|
||||||
@@ -80,8 +79,6 @@ struct _GtkContainerClass
|
|||||||
void (*forall) (GtkContainer *container,
|
void (*forall) (GtkContainer *container,
|
||||||
GtkCallback callback,
|
GtkCallback callback,
|
||||||
gpointer callback_data);
|
gpointer callback_data);
|
||||||
void (*set_focus_child) (GtkContainer *container,
|
|
||||||
GtkWidget *child);
|
|
||||||
GType (*child_type) (GtkContainer *container);
|
GType (*child_type) (GtkContainer *container);
|
||||||
void (*set_child_property) (GtkContainer *container,
|
void (*set_child_property) (GtkContainer *container,
|
||||||
GtkWidget *child,
|
GtkWidget *child,
|
||||||
|
@@ -29,8 +29,6 @@ G_BEGIN_DECLS
|
|||||||
void _gtk_container_queue_restyle (GtkContainer *container);
|
void _gtk_container_queue_restyle (GtkContainer *container);
|
||||||
void gtk_container_stop_idle_sizer (GtkContainer *container);
|
void gtk_container_stop_idle_sizer (GtkContainer *container);
|
||||||
void gtk_container_start_idle_sizer (GtkContainer *container);
|
void gtk_container_start_idle_sizer (GtkContainer *container);
|
||||||
void gtk_container_set_focus_child (GtkContainer *container,
|
|
||||||
GtkWidget *child);
|
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@@ -678,7 +678,7 @@ static void gtk_notebook_add (GtkContainer *container,
|
|||||||
GtkWidget *widget);
|
GtkWidget *widget);
|
||||||
static void gtk_notebook_remove (GtkContainer *container,
|
static void gtk_notebook_remove (GtkContainer *container,
|
||||||
GtkWidget *widget);
|
GtkWidget *widget);
|
||||||
static void gtk_notebook_set_focus_child (GtkContainer *container,
|
static void gtk_notebook_set_focus_child (GtkWidget *widget,
|
||||||
GtkWidget *child);
|
GtkWidget *child);
|
||||||
static GType gtk_notebook_child_type (GtkContainer *container);
|
static GType gtk_notebook_child_type (GtkContainer *container);
|
||||||
static void gtk_notebook_forall (GtkContainer *container,
|
static void gtk_notebook_forall (GtkContainer *container,
|
||||||
@@ -933,11 +933,11 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
|||||||
widget_class->drag_data_received = gtk_notebook_drag_data_received;
|
widget_class->drag_data_received = gtk_notebook_drag_data_received;
|
||||||
widget_class->drag_failed = gtk_notebook_drag_failed;
|
widget_class->drag_failed = gtk_notebook_drag_failed;
|
||||||
widget_class->compute_expand = gtk_notebook_compute_expand;
|
widget_class->compute_expand = gtk_notebook_compute_expand;
|
||||||
|
widget_class->set_focus_child = gtk_notebook_set_focus_child;
|
||||||
|
|
||||||
container_class->add = gtk_notebook_add;
|
container_class->add = gtk_notebook_add;
|
||||||
container_class->remove = gtk_notebook_remove;
|
container_class->remove = gtk_notebook_remove;
|
||||||
container_class->forall = gtk_notebook_forall;
|
container_class->forall = gtk_notebook_forall;
|
||||||
container_class->set_focus_child = gtk_notebook_set_focus_child;
|
|
||||||
container_class->child_type = gtk_notebook_child_type;
|
container_class->child_type = gtk_notebook_child_type;
|
||||||
|
|
||||||
class->switch_page = gtk_notebook_real_switch_page;
|
class->switch_page = gtk_notebook_real_switch_page;
|
||||||
@@ -3546,7 +3546,7 @@ focus_tabs_in (GtkNotebook *notebook)
|
|||||||
if (priv->show_tabs && gtk_notebook_has_current_page (notebook))
|
if (priv->show_tabs && gtk_notebook_has_current_page (notebook))
|
||||||
{
|
{
|
||||||
gtk_widget_grab_focus (GTK_WIDGET (notebook));
|
gtk_widget_grab_focus (GTK_WIDGET (notebook));
|
||||||
gtk_notebook_set_focus_child (GTK_CONTAINER (notebook), NULL);
|
gtk_notebook_set_focus_child (GTK_WIDGET (notebook), NULL);
|
||||||
gtk_notebook_switch_focus_tab (notebook,
|
gtk_notebook_switch_focus_tab (notebook,
|
||||||
g_list_find (priv->children,
|
g_list_find (priv->children,
|
||||||
priv->cur_page));
|
priv->cur_page));
|
||||||
@@ -3790,10 +3790,10 @@ gtk_notebook_focus (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_notebook_set_focus_child (GtkContainer *container,
|
gtk_notebook_set_focus_child (GtkWidget *widget,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK (container);
|
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
||||||
GtkNotebookPrivate *priv = notebook->priv;
|
GtkNotebookPrivate *priv = notebook->priv;
|
||||||
GtkWidget *page_child;
|
GtkWidget *page_child;
|
||||||
GtkWidget *toplevel;
|
GtkWidget *toplevel;
|
||||||
@@ -3803,13 +3803,13 @@ gtk_notebook_set_focus_child (GtkContainer *container,
|
|||||||
* for future use if we switch to the page with a mnemonic.
|
* for future use if we switch to the page with a mnemonic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container));
|
toplevel = gtk_widget_get_toplevel (widget);
|
||||||
if (toplevel && gtk_widget_is_toplevel (toplevel))
|
if (toplevel && gtk_widget_is_toplevel (toplevel))
|
||||||
{
|
{
|
||||||
page_child = gtk_window_get_focus (GTK_WINDOW (toplevel));
|
page_child = gtk_window_get_focus (GTK_WINDOW (toplevel));
|
||||||
while (page_child)
|
while (page_child)
|
||||||
{
|
{
|
||||||
if (gtk_widget_get_parent (page_child) == GTK_WIDGET (container))
|
if (gtk_widget_get_parent (page_child) == widget)
|
||||||
{
|
{
|
||||||
GList *list = gtk_notebook_find_child (notebook, page_child);
|
GList *list = gtk_notebook_find_child (notebook, page_child);
|
||||||
if (list != NULL)
|
if (list != NULL)
|
||||||
@@ -3853,7 +3853,7 @@ gtk_notebook_set_focus_child (GtkContainer *container,
|
|||||||
else
|
else
|
||||||
priv->child_has_focus = FALSE;
|
priv->child_has_focus = FALSE;
|
||||||
|
|
||||||
GTK_CONTAINER_CLASS (gtk_notebook_parent_class)->set_focus_child (container, child);
|
GTK_WIDGET_CLASS (gtk_notebook_parent_class)->set_focus_child (widget, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -231,7 +231,7 @@ static void gtk_paned_calc_position (GtkPaned *paned,
|
|||||||
gint allocation,
|
gint allocation,
|
||||||
gint child1_req,
|
gint child1_req,
|
||||||
gint child2_req);
|
gint child2_req);
|
||||||
static void gtk_paned_set_focus_child (GtkContainer *container,
|
static void gtk_paned_set_focus_child (GtkWidget *widget,
|
||||||
GtkWidget *child);
|
GtkWidget *child);
|
||||||
static void gtk_paned_set_saved_focus (GtkPaned *paned,
|
static void gtk_paned_set_saved_focus (GtkPaned *paned,
|
||||||
GtkWidget *widget);
|
GtkWidget *widget);
|
||||||
@@ -367,12 +367,12 @@ gtk_paned_class_init (GtkPanedClass *class)
|
|||||||
widget_class->unrealize = gtk_paned_unrealize;
|
widget_class->unrealize = gtk_paned_unrealize;
|
||||||
widget_class->focus = gtk_paned_focus;
|
widget_class->focus = gtk_paned_focus;
|
||||||
widget_class->pick = gtk_paned_pick;
|
widget_class->pick = gtk_paned_pick;
|
||||||
|
widget_class->set_focus_child = gtk_paned_set_focus_child;
|
||||||
|
|
||||||
container_class->add = gtk_paned_add;
|
container_class->add = gtk_paned_add;
|
||||||
container_class->remove = gtk_paned_remove;
|
container_class->remove = gtk_paned_remove;
|
||||||
container_class->forall = gtk_paned_forall;
|
container_class->forall = gtk_paned_forall;
|
||||||
container_class->child_type = gtk_paned_child_type;
|
container_class->child_type = gtk_paned_child_type;
|
||||||
container_class->set_focus_child = gtk_paned_set_focus_child;
|
|
||||||
container_class->set_child_property = gtk_paned_set_child_property;
|
container_class->set_child_property = gtk_paned_set_child_property;
|
||||||
container_class->get_child_property = gtk_paned_get_child_property;
|
container_class->get_child_property = gtk_paned_get_child_property;
|
||||||
|
|
||||||
@@ -1905,14 +1905,14 @@ paned_get_focus_widget (GtkPaned *paned)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_paned_set_focus_child (GtkContainer *container,
|
gtk_paned_set_focus_child (GtkWidget *widget,
|
||||||
GtkWidget *focus_child)
|
GtkWidget *focus_child)
|
||||||
{
|
{
|
||||||
GtkPaned *paned = GTK_PANED (container);
|
GtkPaned *paned = GTK_PANED (widget);
|
||||||
GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
|
GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
|
||||||
GtkWidget *container_focus_child;
|
GtkWidget *container_focus_child;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_PANED (container));
|
g_return_if_fail (GTK_IS_PANED (widget));
|
||||||
|
|
||||||
if (focus_child == NULL)
|
if (focus_child == NULL)
|
||||||
{
|
{
|
||||||
@@ -1930,7 +1930,7 @@ gtk_paned_set_focus_child (GtkContainer *container,
|
|||||||
if (GTK_IS_PANED (w))
|
if (GTK_IS_PANED (w))
|
||||||
last_focus = w;
|
last_focus = w;
|
||||||
|
|
||||||
container_focus_child = gtk_widget_get_focus_child (GTK_WIDGET (container));
|
container_focus_child = gtk_widget_get_focus_child (widget);
|
||||||
if (container_focus_child == priv->child1)
|
if (container_focus_child == priv->child1)
|
||||||
gtk_paned_set_last_child1_focus (paned, last_focus);
|
gtk_paned_set_last_child1_focus (paned, last_focus);
|
||||||
else if (container_focus_child == priv->child2)
|
else if (container_focus_child == priv->child2)
|
||||||
@@ -1938,8 +1938,8 @@ gtk_paned_set_focus_child (GtkContainer *container,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GTK_CONTAINER_CLASS (gtk_paned_parent_class)->set_focus_child)
|
if (GTK_WIDGET_CLASS (gtk_paned_parent_class)->set_focus_child)
|
||||||
GTK_CONTAINER_CLASS (gtk_paned_parent_class)->set_focus_child (container, focus_child);
|
GTK_WIDGET_CLASS (gtk_paned_parent_class)->set_focus_child (widget, focus_child);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -603,7 +603,7 @@ static void gtk_tree_view_size_allocate (GtkWidget *widget,
|
|||||||
static void gtk_tree_view_snapshot (GtkWidget *widget,
|
static void gtk_tree_view_snapshot (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
|
|
||||||
static void gtk_tree_view_set_focus_child (GtkContainer *container,
|
static void gtk_tree_view_set_focus_child (GtkWidget *widget,
|
||||||
GtkWidget *child);
|
GtkWidget *child);
|
||||||
static gboolean gtk_tree_view_key_controller_key_pressed (GtkEventControllerKey *key,
|
static gboolean gtk_tree_view_key_controller_key_pressed (GtkEventControllerKey *key,
|
||||||
guint keyval,
|
guint keyval,
|
||||||
@@ -990,11 +990,11 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
|
|||||||
widget_class->focus = gtk_tree_view_focus;
|
widget_class->focus = gtk_tree_view_focus;
|
||||||
widget_class->grab_focus = gtk_tree_view_grab_focus;
|
widget_class->grab_focus = gtk_tree_view_grab_focus;
|
||||||
widget_class->style_updated = gtk_tree_view_style_updated;
|
widget_class->style_updated = gtk_tree_view_style_updated;
|
||||||
|
widget_class->set_focus_child = gtk_tree_view_set_focus_child;
|
||||||
|
|
||||||
/* GtkContainer signals */
|
/* GtkContainer signals */
|
||||||
container_class->remove = gtk_tree_view_remove;
|
container_class->remove = gtk_tree_view_remove;
|
||||||
container_class->forall = gtk_tree_view_forall;
|
container_class->forall = gtk_tree_view_forall;
|
||||||
container_class->set_focus_child = gtk_tree_view_set_focus_child;
|
|
||||||
|
|
||||||
class->move_cursor = gtk_tree_view_real_move_cursor;
|
class->move_cursor = gtk_tree_view_real_move_cursor;
|
||||||
class->select_all = gtk_tree_view_real_select_all;
|
class->select_all = gtk_tree_view_real_select_all;
|
||||||
@@ -8020,10 +8020,10 @@ gtk_tree_view_style_updated (GtkWidget *widget)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_tree_view_set_focus_child (GtkContainer *container,
|
gtk_tree_view_set_focus_child (GtkWidget *widget,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
GtkTreeView *tree_view = GTK_TREE_VIEW (container);
|
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
|
||||||
GList *list;
|
GList *list;
|
||||||
|
|
||||||
for (list = tree_view->priv->columns; list; list = list->next)
|
for (list = tree_view->priv->columns; list; list = list->next)
|
||||||
@@ -8035,7 +8035,7 @@ gtk_tree_view_set_focus_child (GtkContainer *container,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GTK_CONTAINER_CLASS (gtk_tree_view_parent_class)->set_focus_child (container, child);
|
GTK_WIDGET_CLASS (gtk_tree_view_parent_class)->set_focus_child (widget, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@@ -484,7 +484,6 @@ enum {
|
|||||||
GRAB_NOTIFY,
|
GRAB_NOTIFY,
|
||||||
CHILD_NOTIFY,
|
CHILD_NOTIFY,
|
||||||
MNEMONIC_ACTIVATE,
|
MNEMONIC_ACTIVATE,
|
||||||
GRAB_FOCUS,
|
|
||||||
FOCUS,
|
FOCUS,
|
||||||
MOVE_FOCUS,
|
MOVE_FOCUS,
|
||||||
KEYNAV_FAILED,
|
KEYNAV_FAILED,
|
||||||
@@ -603,6 +602,8 @@ static void gtk_widget_dispatch_child_properties_changed (GtkWidget *obje
|
|||||||
GParamSpec **pspecs);
|
GParamSpec **pspecs);
|
||||||
static gboolean gtk_widget_real_focus (GtkWidget *widget,
|
static gboolean gtk_widget_real_focus (GtkWidget *widget,
|
||||||
GtkDirectionType direction);
|
GtkDirectionType direction);
|
||||||
|
static void gtk_widget_real_set_focus_child (GtkWidget *widget,
|
||||||
|
GtkWidget *focus_child);
|
||||||
static void gtk_widget_real_move_focus (GtkWidget *widget,
|
static void gtk_widget_real_move_focus (GtkWidget *widget,
|
||||||
GtkDirectionType direction);
|
GtkDirectionType direction);
|
||||||
static gboolean gtk_widget_real_keynav_failed (GtkWidget *widget,
|
static gboolean gtk_widget_real_keynav_failed (GtkWidget *widget,
|
||||||
@@ -933,6 +934,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
klass->mnemonic_activate = gtk_widget_real_mnemonic_activate;
|
klass->mnemonic_activate = gtk_widget_real_mnemonic_activate;
|
||||||
klass->grab_focus = gtk_widget_real_grab_focus;
|
klass->grab_focus = gtk_widget_real_grab_focus;
|
||||||
klass->focus = gtk_widget_real_focus;
|
klass->focus = gtk_widget_real_focus;
|
||||||
|
klass->set_focus_child = gtk_widget_real_set_focus_child;
|
||||||
klass->move_focus = gtk_widget_real_move_focus;
|
klass->move_focus = gtk_widget_real_move_focus;
|
||||||
klass->keynav_failed = gtk_widget_real_keynav_failed;
|
klass->keynav_failed = gtk_widget_real_keynav_failed;
|
||||||
klass->drag_begin = NULL;
|
klass->drag_begin = NULL;
|
||||||
@@ -1653,19 +1655,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
G_TYPE_BOOLEAN, 1,
|
G_TYPE_BOOLEAN, 1,
|
||||||
G_TYPE_BOOLEAN);
|
G_TYPE_BOOLEAN);
|
||||||
|
|
||||||
/**
|
|
||||||
* GtkWidget::grab-focus:
|
|
||||||
* @widget: the object which received the signal.
|
|
||||||
*/
|
|
||||||
widget_signals[GRAB_FOCUS] =
|
|
||||||
g_signal_new (I_("grab-focus"),
|
|
||||||
G_TYPE_FROM_CLASS (gobject_class),
|
|
||||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
|
||||||
G_STRUCT_OFFSET (GtkWidgetClass, grab_focus),
|
|
||||||
NULL, NULL,
|
|
||||||
NULL,
|
|
||||||
G_TYPE_NONE, 0);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkWidget::focus:
|
* GtkWidget::focus:
|
||||||
* @widget: the object which received the signal.
|
* @widget: the object which received the signal.
|
||||||
@@ -5343,7 +5332,7 @@ gtk_widget_grab_focus (GtkWidget *widget)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
g_object_ref (widget);
|
g_object_ref (widget);
|
||||||
g_signal_emit (widget, widget_signals[GRAB_FOCUS], 0);
|
GTK_WIDGET_GET_CLASS (widget)->grab_focus (widget);
|
||||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HAS_FOCUS]);
|
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HAS_FOCUS]);
|
||||||
g_object_unref (widget);
|
g_object_unref (widget);
|
||||||
}
|
}
|
||||||
@@ -13456,16 +13445,23 @@ void
|
|||||||
gtk_widget_set_focus_child (GtkWidget *widget,
|
gtk_widget_set_focus_child (GtkWidget *widget,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
if (child != NULL)
|
if (child != NULL)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||||
g_return_if_fail (gtk_widget_get_parent (child) == widget);
|
g_return_if_fail (gtk_widget_get_parent (child) == widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GTK_WIDGET_GET_CLASS (widget)->set_focus_child (widget, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_widget_real_set_focus_child (GtkWidget *widget,
|
||||||
|
GtkWidget *child)
|
||||||
|
{
|
||||||
|
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||||
|
|
||||||
if (priv->focus_child)
|
if (priv->focus_child)
|
||||||
gtk_widget_unset_state_flags (priv->focus_child,
|
gtk_widget_unset_state_flags (priv->focus_child,
|
||||||
GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_FOCUS_VISIBLE);
|
GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_FOCUS_VISIBLE);
|
||||||
@@ -13483,9 +13479,6 @@ gtk_widget_set_focus_child (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_set_object (&priv->focus_child, child);
|
g_set_object (&priv->focus_child, child);
|
||||||
|
|
||||||
if (GTK_IS_CONTAINER (widget))
|
|
||||||
gtk_container_set_focus_child (GTK_CONTAINER (widget), child);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -185,7 +185,8 @@ struct _GtkWidget
|
|||||||
* %FALSE, and just grabs the focus if @group_cycling is %TRUE.
|
* %FALSE, and just grabs the focus if @group_cycling is %TRUE.
|
||||||
* @grab_focus: Causes @widget to have the keyboard focus for the
|
* @grab_focus: Causes @widget to have the keyboard focus for the
|
||||||
* #GtkWindow it’s inside.
|
* #GtkWindow it’s inside.
|
||||||
* @focus:
|
* @focus: Move the focus among @widget's children
|
||||||
|
* @set_focus_child: Sets the focused child of widget
|
||||||
* @move_focus: Signal emitted when a change of focus is requested
|
* @move_focus: Signal emitted when a change of focus is requested
|
||||||
* @keynav_failed: Signal emitted if keyboard navigation fails.
|
* @keynav_failed: Signal emitted if keyboard navigation fails.
|
||||||
* @drag_begin: Signal emitted on the drag source when a drag is
|
* @drag_begin: Signal emitted on the drag source when a drag is
|
||||||
@@ -280,6 +281,8 @@ struct _GtkWidgetClass
|
|||||||
void (* grab_focus) (GtkWidget *widget);
|
void (* grab_focus) (GtkWidget *widget);
|
||||||
gboolean (* focus) (GtkWidget *widget,
|
gboolean (* focus) (GtkWidget *widget,
|
||||||
GtkDirectionType direction);
|
GtkDirectionType direction);
|
||||||
|
void (* set_focus_child) (GtkWidget *widget,
|
||||||
|
GtkWidget *focus_child);
|
||||||
|
|
||||||
/* keyboard navigation */
|
/* keyboard navigation */
|
||||||
void (* move_focus) (GtkWidget *widget,
|
void (* move_focus) (GtkWidget *widget,
|
||||||
|
Reference in New Issue
Block a user