1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
diff -r -u -p /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/widget/gtkwidget.c gtk/widget/gtkwidget.c
--- /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/widget/gtkwidget.c 2006-05-30 13:57:49.732943065 +0800
+++ gtk/gtkwidget.c 2006-05-30 13:57:24.716589268 +0800
@@ -120,6 +120,7 @@ enum {
ACCEL_CLOSURES_CHANGED,
SCREEN_CHANGED,
CAN_ACTIVATE_ACCEL,
+ KEYNAV_FAILED,
LAST_SIGNAL
};
@@ -202,6 +203,8 @@ static gboolean gtk_widget_real_focus_o
GdkEventFocus *event);
static gboolean gtk_widget_real_focus (GtkWidget *widget,
GtkDirectionType direction);
+static gboolean gtk_widget_real_keynav_failed (GtkWidget *widget,
+ GtkDirectionType direction);
static PangoContext* gtk_widget_peek_pango_context (GtkWidget *widget);
static void gtk_widget_propagate_state (GtkWidget *widget,
GtkStateData *data);
@@ -363,6 +366,7 @@ gtk_widget_class_init (GtkWidgetClass *k
klass->mnemonic_activate = gtk_widget_real_mnemonic_activate;
klass->grab_focus = gtk_widget_real_grab_focus;
klass->focus = gtk_widget_real_focus;
+ klass->keynav_failed = gtk_widget_real_keynav_failed;
klass->event = NULL;
klass->button_press_event = NULL;
klass->button_release_event = NULL;
@@ -1368,6 +1372,16 @@ gtk_widget_class_init (GtkWidgetClass *k
_gtk_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
GDK_TYPE_SCREEN);
+
+ widget_signals[KEYNAV_FAILED] =
+ g_signal_new (("keynav_failed"),
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkWidgetClass, keynav_failed),
+ _gtk_boolean_handled_accumulator, NULL,
+ _gtk_marshal_BOOLEAN__ENUM,
+ G_TYPE_BOOLEAN, 1,
+ GTK_TYPE_DIRECTION_TYPE);
/**
* GtkWidget::can-activate-accel:
* @widget: the object which received the signal
@@ -4044,6 +4058,34 @@ gtk_widget_real_focus (GtkWidget
return FALSE;
}
+static gboolean
+gtk_widget_real_keynav_failed (GtkWidget *widget,
+ GtkDirectionType direction)
+{
+ GtkSettings *settings = gtk_widget_get_settings (widget);
+ gboolean cursor_only_focus;
+
+ g_object_get (settings, "gtk-cursor-only-focus", &cursor_only_focus, NULL);
+
+ switch (direction)
+ {
+ case GTK_DIR_TAB_FORWARD:
+ case GTK_DIR_TAB_BACKWARD:
+ return FALSE;
+
+ case GTK_DIR_UP:
+ case GTK_DIR_DOWN:
+ case GTK_DIR_LEFT:
+ case GTK_DIR_RIGHT:
+ if (cursor_only_focus)
+ return FALSE;
+ }
+
+ gdk_beep ();
+
+ return TRUE;
+}
+
/**
* gtk_widget_is_focus:
* @widget: a #GtkWidget
@@ -5500,6 +5542,20 @@ gtk_widget_child_focus (GtkWidget
return return_val;
}
+gboolean
+gtk_widget_keynav_failed (GtkWidget *widget,
+ GtkDirectionType direction)
+{
+ gboolean return_val;
+
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ g_signal_emit (widget, widget_signals[KEYNAV_FAILED], 0,
+ direction, &return_val);
+
+ return return_val;
+}
+
/**
* gtk_widget_set_uposition:
* @widget: a #GtkWidget
diff -r -u -p /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/widget/gtkwidget.h gtk/widget/gtkwidget.h
--- /data/zzz/gtk-2.6/gtk+-2.6.10/gtk/widget/gtkwidget.h 2006-05-30 13:57:49.736942642 +0800
+++ gtk/gtkwidget.h 2006-05-30 13:57:24.716589268 +0800
@@ -406,8 +406,9 @@ struct _GtkWidgetClass
gboolean (*can_activate_accel) (GtkWidget *widget,
guint signal_id);
+ gboolean (* keynav_failed) (GtkWidget *widget,
+ GtkDirectionType direction);
/* Padding for future expansion */
- void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
void (*_gtk_reserved5) (void);
@@ -562,7 +563,8 @@ GdkWindow *gtk_widget_get_parent_window
gboolean gtk_widget_child_focus (GtkWidget *widget,
GtkDirectionType direction);
-
+gboolean gtk_widget_keynav_failed (GtkWidget *widget,
+ GtkDirectionType direction);
void gtk_widget_set_size_request (GtkWidget *widget,
gint width,
gint height);
Only in gtk/widget: gtkwidget.h.bak
Only in gtk/widget: gtkwidget.lo
|