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
|
--- gtk+-2.6.4/gtk/gtkwindow.c 2005-02-21 06:21:49.000000000 +0200
+++ gtk+-2.6.4/gtk/gtkwindow.c 2005-04-06 16:19:38.407699504 +0300
@@ -166,6 +166,7 @@
guint skips_taskbar : 1;
guint skips_pager : 1;
guint accept_focus : 1;
+ GtkWidget *prev_focus_widget;
guint focus_on_map : 1;
};
@@ -293,6 +294,9 @@
GValue *value,
GParamSpec *pspec);
+static void gtk_window_focus_weak_notify (GtkWindow *window,
+ GtkWidget *widget);
+static void gtk_window_weak_notify(GtkWidget *widget, GtkWindow *window);
GType
gtk_window_get_type (void)
@@ -771,6 +775,7 @@
window->decorated = TRUE;
window->mnemonic_modifier = GDK_MOD1_MASK;
window->screen = gdk_screen_get_default ();
+ priv->prev_focus_widget = NULL;
priv->accept_focus = TRUE;
priv->focus_on_map = TRUE;
@@ -7505,3 +7510,49 @@
}
#endif
+
+/*Hildon focus handling*/
+GtkWidget *gtk_window_get_prev_focus_widget( GtkWindow *window )
+{
+ g_return_val_if_fail( GTK_IS_WINDOW(window), NULL );
+ return GTK_WINDOW_GET_PRIVATE(window)->prev_focus_widget;
+}
+
+static void gtk_window_weak_notify(GtkWidget *widget, GtkWindow *window)
+{
+ GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE(window);
+ if (priv->prev_focus_widget == widget)
+ g_object_weak_unref(G_OBJECT(widget),
+ (GWeakNotify)gtk_window_focus_weak_notify,
+ (gpointer)window);
+}
+
+void gtk_window_set_prev_focus_widget( GtkWindow *window, GtkWidget *widget )
+{
+ GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE(window);
+ g_return_if_fail(GTK_IS_WINDOW(window));
+ g_return_if_fail(GTK_IS_WIDGET(widget));
+
+ if (priv->prev_focus_widget)
+ {
+ g_object_weak_unref(G_OBJECT(window), (GWeakNotify)gtk_window_weak_notify,
+ (gpointer)priv->prev_focus_widget);
+ g_object_weak_unref(G_OBJECT(priv->prev_focus_widget),
+ (GWeakNotify)gtk_window_focus_weak_notify,
+ (gpointer)window);
+ }
+
+ priv->prev_focus_widget = widget;
+
+ g_object_weak_ref(G_OBJECT(window), (GWeakNotify)gtk_window_weak_notify,
+ (gpointer)widget);
+ g_object_weak_ref(G_OBJECT(widget), (GWeakNotify)gtk_window_focus_weak_notify,
+ (gpointer)window);
+}
+
+static void gtk_window_focus_weak_notify(GtkWindow *window, GtkWidget *widget)
+{
+ GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE(window);
+ priv->prev_focus_widget = window->focus_widget;
+}
+
|