summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Lebl <jirka@5z.com>2003-09-22 20:58:49 +0000
committerGeorge Lebl <jirka@src.gnome.org>2003-09-22 20:58:49 +0000
commit02111674b685784216224e1701c9cb5dbae713f0 (patch)
tree0640354d447797ddc7f70f2d93d4a8dac89a21db
parentfaf70ebf0f78872ef30271f091eaeef0e853d967 (diff)
downloadgdm-02111674b685784216224e1701c9cb5dbae713f0.tar.gz
fix error handling / leaks
Mon Sep 22 13:55:50 2003 George Lebl <jirka@5z.com> * gui/modules/dwellmouselistener.c: fix error handling / leaks * gui/modules/keymouselistener.c: fix error handling and leaks, fix the stupid and annoying as hell "turn of key-repeat" hack, fix using modifier keys as the gestures themselves (#122944) * gui/modules/AccessKeyMouseEvents.in: fix documentation a bit * daemon/errorgui.c: listen to all events on the dialogs to make the accessibility gestures work
-rw-r--r--ChangeLog13
-rw-r--r--daemon/errorgui.c4
-rw-r--r--gui/modules/AccessKeyMouseEvents.in14
-rw-r--r--gui/modules/dwellmouselistener.c7
-rw-r--r--gui/modules/keymouselistener.c35
5 files changed, 55 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index fa72dbbe..99d9aefd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Mon Sep 22 13:55:50 2003 George Lebl <jirka@5z.com>
+
+ * gui/modules/dwellmouselistener.c: fix error handling / leaks
+
+ * gui/modules/keymouselistener.c: fix error handling and leaks,
+ fix the stupid and annoying as hell "turn of key-repeat" hack,
+ fix using modifier keys as the gestures themselves (#122944)
+
+ * gui/modules/AccessKeyMouseEvents.in: fix documentation a bit
+
+ * daemon/errorgui.c: listen to all events on the dialogs to
+ make the accessibility gestures work
+
Mon Sep 22 12:25:44 2003 George Lebl <jirka@5z.com>
* daemon/errorgui.c: reenable the gtk modules stuff, it wasn't
diff --git a/daemon/errorgui.c b/daemon/errorgui.c
index 0a52e746..95c64d0f 100644
--- a/daemon/errorgui.c
+++ b/daemon/errorgui.c
@@ -379,6 +379,7 @@ gdm_error_box_full (GdmDisplay *d, GtkMessageType type, const char *error,
"%s",
loc);
g_free (loc);
+ gtk_widget_set_events (dlg, GDK_ALL_EVENTS_MASK);
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
if (details_label != NULL) {
@@ -509,6 +510,7 @@ gdm_failsafe_question (GdmDisplay *d,
GTK_STOCK_OK,
GTK_RESPONSE_OK,
NULL);
+ gtk_widget_set_events (dlg, GDK_ALL_EVENTS_MASK);
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
g_signal_connect (G_OBJECT (dlg), "delete_event",
G_CALLBACK (gtk_true), NULL);
@@ -633,6 +635,7 @@ gdm_failsafe_yesno (GdmDisplay *d,
GTK_BUTTONS_YES_NO,
"%s",
loc);
+ gtk_widget_set_events (dlg, GDK_ALL_EVENTS_MASK);
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
sid = g_signal_lookup ("event",
@@ -743,6 +746,7 @@ gdm_failsafe_ask_buttons (GdmDisplay *d,
"%s",
loc);
g_free (loc);
+ gtk_widget_set_events (dlg, GDK_ALL_EVENTS_MASK);
for (i = 0; but[i] != NULL; i++) {
loc = gdm_locale_to_utf8 (but[i]);
gtk_dialog_add_button (GTK_DIALOG (dlg),
diff --git a/gui/modules/AccessKeyMouseEvents.in b/gui/modules/AccessKeyMouseEvents.in
index 7db93502..5b44cc24 100644
--- a/gui/modules/AccessKeyMouseEvents.in
+++ b/gui/modules/AccessKeyMouseEvents.in
@@ -6,7 +6,12 @@
# <modifier>[<modifier>...]key #times duration timeout executable_path +args
#
# For executable_path give the full executable path path of the program or the
-# DefaultPath is used.
+# DefaultPath is used. For key, this can be one of the normal keys such as 'k'
+# for the letter 'k', or 'F10' for the F10 key. If you wish to use one of the
+# 'modifier' keys you have to specify which one exactly, meaning usually
+# appending _L or _R depending on if it's the left or right one. The useful
+# ones are: Shift_L, Shift_R, Control_L, Control_R, Meta_L, Meta_R, Alt_L, Alt_R.
+# Do note that the modifier is optional.
#
# e.g.
#
@@ -20,6 +25,13 @@
# program, gok. Note that you cannot release the <Control> key while pressing
# otherwise the sequence will be lost.
#
+# e.g.
+# Shift_L 5 1000 10000 gok --login --access-method=directselection
+# Shift_R 5 1000 10000 gok --login --access-method=directselection
+#
+# Will start gok if you press either shift key 5 times holding it down for more
+# then 1 second each time.
+#
# For mouse button gestures the format is the same except the mouse button number
# is specified instead of a key gesture:
#
diff --git a/gui/modules/dwellmouselistener.c b/gui/modules/dwellmouselistener.c
index 3a2d0d92..a639b0fd 100644
--- a/gui/modules/dwellmouselistener.c
+++ b/gui/modules/dwellmouselistener.c
@@ -521,7 +521,6 @@ leave_enter_emission_hook (GSignalInvocationHint *ihint,
/* If this is true, then gesture was recognized */
if (i == curr_binding->input.num_gestures)
{
- GError* error = NULL;
gboolean retval;
gchar **argv = NULL;
gchar **envp = NULL;
@@ -531,8 +530,8 @@ leave_enter_emission_hook (GSignalInvocationHint *ihint,
gchar *action = (gchar *)act_li->data;
g_return_val_if_fail (action != NULL, TRUE);
- if (!g_shell_parse_argv (action, NULL, &argv, &error))
- return TRUE;
+ if (!g_shell_parse_argv (action, NULL, &argv, NULL))
+ continue;
envp = get_exec_environment (gtk_window_get_screen(window));
@@ -543,7 +542,7 @@ leave_enter_emission_hook (GSignalInvocationHint *ihint,
NULL,
NULL,
NULL,
- &error);
+ NULL);
g_strfreev (argv);
g_strfreev (envp);
diff --git a/gui/modules/keymouselistener.c b/gui/modules/keymouselistener.c
index 1745a7ae..c0a2efb8 100644
--- a/gui/modules/keymouselistener.c
+++ b/gui/modules/keymouselistener.c
@@ -150,7 +150,6 @@ static void create_event_watcher ()
/*
* Switch off keyboard autorepeat
*/
- XAutoRepeatOff(GDK_DISPLAY_XDISPLAY(display));
load_gestures(CONFIGFILE);
gdk_window_add_filter (NULL, gestures_filter, NULL);
@@ -296,6 +295,12 @@ parse_line (gchar *buf)
gtk_accelerator_parse(tmp_gesture->gesture_str,
&(tmp_gesture->input.key.keysym),
&(tmp_gesture->input.key.state));
+ if (tmp_gesture->input.key.keysym == 0 &&
+ tmp_gesture->input.key.state == 0) {
+ /* TODO - Error messages here */
+ free_gesture (tmp_gesture);
+ return NULL;
+ }
tmp_gesture->input.key.keycode =
XKeysymToKeycode(GDK_DISPLAY_XDISPLAY (display), tmp_gesture->input.key.keysym);
}
@@ -440,10 +445,15 @@ gestures_filter (GdkXEvent *gdk_xevent,
if (!last_event)
last_event = g_new0(XEvent, 1);
-
switch (xevent->type) {
case KeyPress:
+ if (last_event->type == KeyPress &&
+ last_event->xkey.keycode == xevent->xkey.keycode) {
+ /* they comes from auto key-repeat */
+ return GDK_FILTER_CONTINUE;
+ }
+
if (seq_count > 0 &&
last_event->type != KeyRelease) {
seq_count = 0;
@@ -451,8 +461,7 @@ gestures_filter (GdkXEvent *gdk_xevent,
}
if (seq_count > 0 &&
- (last_event->xkey.keycode != xevent->xkey.keycode ||
- last_event->xkey.state != xevent->xkey.state)) {
+ last_event->xkey.keycode != xevent->xkey.keycode) {
seq_count = 0;
break;
}
@@ -484,9 +493,8 @@ gestures_filter (GdkXEvent *gdk_xevent,
case KeyRelease:
if (seq_count > 0 &&
- ((last_event->type != KeyPress) ||
- last_event->xkey.keycode != xevent->xkey.keycode ||
- last_event->xkey.state != xevent->xkey.state)) {
+ (last_event->type != KeyPress ||
+ last_event->xkey.keycode != xevent->xkey.keycode)) {
seq_count = 0;
break;
}
@@ -494,12 +502,14 @@ gestures_filter (GdkXEvent *gdk_xevent,
/*
* Find the associated gesture for this keycode &state
* TODO: write a custom g_slist_find function.
+ *
+ * Note that here we don't check the state, otherwise key gestures based on
+ * modifier keys such as Control_R won't work.
*/
for (li = gesture_list; li != NULL; li = li->next) {
Gesture *gesture = (Gesture *) li->data;
if (gesture->type == GESTURE_TYPE_KEY &&
- xevent->xkey.keycode == gesture->input.key.keycode &&
- (xevent->xkey.state & USED_MODS) == gesture->input.key.state) {
+ xevent->xkey.keycode == gesture->input.key.keycode) {
/*
* OK Found the gesture.
* Now check if it has a duration value > 0.
@@ -597,7 +607,6 @@ gestures_filter (GdkXEvent *gdk_xevent,
if (seq_count != curr_gesture->n_times) {
return GDK_FILTER_CONTINUE;
} else {
- GError* error = NULL;
gboolean retval;
gchar **argv = NULL;
gchar **envp = NULL;
@@ -606,8 +615,8 @@ gestures_filter (GdkXEvent *gdk_xevent,
for (act_li = curr_gesture->actions; act_li != NULL; act_li = act_li->next) {
gchar *action = (gchar *)act_li->data;
g_return_val_if_fail (action != NULL, GDK_FILTER_CONTINUE);
- if (!g_shell_parse_argv (action, NULL, &argv, &error))
- return GDK_FILTER_CONTINUE;
+ if (!g_shell_parse_argv (action, NULL, &argv, NULL))
+ continue;
envp = get_exec_environment (xevent);
@@ -618,7 +627,7 @@ gestures_filter (GdkXEvent *gdk_xevent,
NULL,
NULL,
NULL,
- &error);
+ NULL);
g_strfreev (argv);
g_strfreev (envp);