diff options
author | Havoc Pennington <hp@redhat.com> | 2003-09-29 16:55:26 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2003-09-29 16:55:26 +0000 |
commit | 8849fad8f9dfdba843899058026ca9c7f32555a2 (patch) | |
tree | 9c3aeba7a715688faca8f969134bfb0e411c7366 | |
parent | 9839087306d94fbeb3182ba7209a09d10ea2f416 (diff) | |
download | metacity-8849fad8f9dfdba843899058026ca9c7f32555a2.tar.gz |
fix warnings (one was a real bug)
2003-09-29 Havoc Pennington <hp@redhat.com>
* src/main.c (find_accessibility_module): fix warnings (one was a
real bug)
* src/ui.c (meta_gdk_pixbuf_get_from_pixmap): fix warning that
probably explains remaining crash on bug #116923. Jeez, need to
use -Werror here or something.
Fix #103575, spawn child processes on proper screen.
* src/keybindings.c (error_on_command): pass --screen to
metacity-dialog
(handle_run_command): launch user command with DISPLAY reflecting
the screen you launch it from
* src/delete.c (delete_ping_timeout_func): pass --screen to
metacity-dialog
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | src/delete.c | 16 | ||||
-rw-r--r-- | src/keybindings.c | 70 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/ui.c | 1 |
5 files changed, 93 insertions, 16 deletions
@@ -1,3 +1,22 @@ +2003-09-29 Havoc Pennington <hp@redhat.com> + + * src/main.c (find_accessibility_module): fix warnings (one was a + real bug) + + * src/ui.c (meta_gdk_pixbuf_get_from_pixmap): fix warning that + probably explains remaining crash on bug #116923. Jeez, need to + use -Werror here or something. + + Fix #103575, spawn child processes on proper screen. + + * src/keybindings.c (error_on_command): pass --screen to + metacity-dialog + (handle_run_command): launch user command with DISPLAY reflecting + the screen you launch it from + + * src/delete.c (delete_ping_timeout_func): pass --screen to + metacity-dialog + 2003-09-26 Havoc Pennington <hp@redhat.com> * src/display.c (event_callback): when focus on root window diff --git a/src/delete.c b/src/delete.c index e7e713d1..2d30e8d7 100644 --- a/src/delete.c +++ b/src/delete.c @@ -31,6 +31,7 @@ #include <errno.h> #include <string.h> #include <stdlib.h> +#include <stdio.h> static void meta_window_present_delete_dialog (MetaWindow *window); @@ -295,7 +296,8 @@ delete_ping_timeout_func (MetaDisplay *display, GError *err; int child_pid; int outpipe; - char *argv[5]; + char *argv[7]; + char numbuf[32]; char *window_id_str; GIOChannel *channel; @@ -310,12 +312,16 @@ delete_ping_timeout_func (MetaDisplay *display, } window_id_str = g_strdup_printf ("0x%lx", window->xwindow); + + sprintf (numbuf, "%d", window->screen->number); argv[0] = METACITY_LIBEXECDIR"/metacity-dialog"; - argv[1] = "--kill-window-question"; - argv[2] = window->title; - argv[3] = window_id_str; - argv[4] = NULL; + argv[1] = "--screen"; + argv[2] = numbuf; + argv[3] = "--kill-window-question"; + argv[4] = window->title; + argv[5] = window_id_str; + argv[6] = NULL; err = NULL; if (!g_spawn_async_with_pipes ("/", diff --git a/src/keybindings.c b/src/keybindings.c index ab0a9140..2d91fe2c 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -30,6 +30,8 @@ #include <X11/keysym.h> #include <string.h> +#include <stdio.h> +#include <stdlib.h> static gboolean all_bindings_disabled = FALSE; @@ -2380,23 +2382,29 @@ handle_activate_workspace (MetaDisplay *display, static void error_on_command (int command_index, const char *command, - const char *message) + const char *message, + int screen_number) { GError *err; - char *argv[6]; + char *argv[8]; char *key; + char numbuf[32]; meta_warning ("Error on command %d \"%s\": %s\n", command_index, command, message); key = meta_prefs_get_gconf_key_for_command (command_index); + + sprintf (numbuf, "%d", screen_number); argv[0] = METACITY_LIBEXECDIR"/metacity-dialog"; - argv[1] = "--command-failed-error"; - argv[2] = key; - argv[3] = (char*) (command ? command : ""); - argv[4] = (char*) message; - argv[5] = NULL; + argv[1] = "--screen"; + argv[2] = numbuf; + argv[3] = "--command-failed-error"; + argv[4] = key; + argv[5] = (char*) (command ? command : ""); + argv[6] = (char*) message; + argv[7] = NULL; err = NULL; if (!g_spawn_async_with_pipes ("/", @@ -2419,6 +2427,48 @@ error_on_command (int command_index, } static void +set_display_setup_func (void *data) +{ + const char *screen_name = data; + char *full; + + full = g_strdup_printf ("DISPLAY=%s", screen_name); + + putenv (full); + + /* do not free full, because putenv is lame */ +} + +static gboolean +meta_spawn_command_line_async_on_screen (const gchar *command_line, + MetaScreen *screen, + GError **error) +{ + gboolean retval; + gchar **argv = 0; + + g_return_val_if_fail (command_line != NULL, FALSE); + + if (!g_shell_parse_argv (command_line, + NULL, &argv, + error)) + return FALSE; + + retval = g_spawn_async (NULL, + argv, + NULL, + G_SPAWN_SEARCH_PATH, + set_display_setup_func, + screen->screen_name, + NULL, + error); + g_strfreev (argv); + + return retval; +} + + +static void handle_run_command (MetaDisplay *display, MetaScreen *screen, MetaWindow *window, @@ -2443,16 +2493,16 @@ handle_run_command (MetaDisplay *display, s = g_strdup_printf (_("No command %d has been defined.\n"), which + 1); - error_on_command (which, NULL, s); + error_on_command (which, NULL, s, screen->number); g_free (s); return; } err = NULL; - if (!g_spawn_command_line_async (command, &err)) + if (!meta_spawn_command_line_async_on_screen (command, screen, &err)) { - error_on_command (which, command, err->message); + error_on_command (which, command, err->message, screen->number); g_error_free (err); } @@ -86,11 +86,12 @@ version (void) static char * find_accessibility_module (const char *libname) { - char *sub; char *path; char *fname; char *retval; + retval = NULL; + fname = g_strconcat (libname, "." G_MODULE_SUFFIX, NULL); path = g_strconcat (METACITY_LIBDIR"/gtk-2.0/modules", G_DIR_SEPARATOR_S, fname, NULL); @@ -515,6 +515,7 @@ meta_gdk_pixbuf_get_from_pixmap (GdkPixbuf *dest, GdkColormap *cmap; retval = NULL; + cmap = NULL; drawable = gdk_xid_table_lookup (xpixmap); |