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
This commit is contained in:
Havoc Pennington 2003-09-29 16:55:26 +00:00 committed by Havoc Pennington
parent 9839087306
commit 8849fad8f9
5 changed files with 93 additions and 16 deletions

View File

@ -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> 2003-09-26 Havoc Pennington <hp@redhat.com>
* src/display.c (event_callback): when focus on root window * src/display.c (event_callback): when focus on root window

View File

@ -31,6 +31,7 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
static void meta_window_present_delete_dialog (MetaWindow *window); static void meta_window_present_delete_dialog (MetaWindow *window);
@ -295,7 +296,8 @@ delete_ping_timeout_func (MetaDisplay *display,
GError *err; GError *err;
int child_pid; int child_pid;
int outpipe; int outpipe;
char *argv[5]; char *argv[7];
char numbuf[32];
char *window_id_str; char *window_id_str;
GIOChannel *channel; GIOChannel *channel;
@ -310,12 +312,16 @@ delete_ping_timeout_func (MetaDisplay *display,
} }
window_id_str = g_strdup_printf ("0x%lx", window->xwindow); window_id_str = g_strdup_printf ("0x%lx", window->xwindow);
sprintf (numbuf, "%d", window->screen->number);
argv[0] = METACITY_LIBEXECDIR"/metacity-dialog"; argv[0] = METACITY_LIBEXECDIR"/metacity-dialog";
argv[1] = "--kill-window-question"; argv[1] = "--screen";
argv[2] = window->title; argv[2] = numbuf;
argv[3] = window_id_str; argv[3] = "--kill-window-question";
argv[4] = NULL; argv[4] = window->title;
argv[5] = window_id_str;
argv[6] = NULL;
err = NULL; err = NULL;
if (!g_spawn_async_with_pipes ("/", if (!g_spawn_async_with_pipes ("/",

View File

@ -30,6 +30,8 @@
#include <X11/keysym.h> #include <X11/keysym.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <stdlib.h>
static gboolean all_bindings_disabled = FALSE; static gboolean all_bindings_disabled = FALSE;
@ -2380,23 +2382,29 @@ handle_activate_workspace (MetaDisplay *display,
static void static void
error_on_command (int command_index, error_on_command (int command_index,
const char *command, const char *command,
const char *message) const char *message,
int screen_number)
{ {
GError *err; GError *err;
char *argv[6]; char *argv[8];
char *key; char *key;
char numbuf[32];
meta_warning ("Error on command %d \"%s\": %s\n", meta_warning ("Error on command %d \"%s\": %s\n",
command_index, command, message); command_index, command, message);
key = meta_prefs_get_gconf_key_for_command (command_index); key = meta_prefs_get_gconf_key_for_command (command_index);
sprintf (numbuf, "%d", screen_number);
argv[0] = METACITY_LIBEXECDIR"/metacity-dialog"; argv[0] = METACITY_LIBEXECDIR"/metacity-dialog";
argv[1] = "--command-failed-error"; argv[1] = "--screen";
argv[2] = key; argv[2] = numbuf;
argv[3] = (char*) (command ? command : ""); argv[3] = "--command-failed-error";
argv[4] = (char*) message; argv[4] = key;
argv[5] = NULL; argv[5] = (char*) (command ? command : "");
argv[6] = (char*) message;
argv[7] = NULL;
err = NULL; err = NULL;
if (!g_spawn_async_with_pipes ("/", if (!g_spawn_async_with_pipes ("/",
@ -2418,6 +2426,48 @@ error_on_command (int command_index,
g_free (key); g_free (key);
} }
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 static void
handle_run_command (MetaDisplay *display, handle_run_command (MetaDisplay *display,
MetaScreen *screen, MetaScreen *screen,
@ -2443,16 +2493,16 @@ handle_run_command (MetaDisplay *display,
s = g_strdup_printf (_("No command %d has been defined.\n"), s = g_strdup_printf (_("No command %d has been defined.\n"),
which + 1); which + 1);
error_on_command (which, NULL, s); error_on_command (which, NULL, s, screen->number);
g_free (s); g_free (s);
return; return;
} }
err = NULL; 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); g_error_free (err);
} }

View File

@ -86,11 +86,12 @@ version (void)
static char * static char *
find_accessibility_module (const char *libname) find_accessibility_module (const char *libname)
{ {
char *sub;
char *path; char *path;
char *fname; char *fname;
char *retval; char *retval;
retval = NULL;
fname = g_strconcat (libname, "." G_MODULE_SUFFIX, NULL); fname = g_strconcat (libname, "." G_MODULE_SUFFIX, NULL);
path = g_strconcat (METACITY_LIBDIR"/gtk-2.0/modules", G_DIR_SEPARATOR_S, fname, NULL); path = g_strconcat (METACITY_LIBDIR"/gtk-2.0/modules", G_DIR_SEPARATOR_S, fname, NULL);

View File

@ -515,6 +515,7 @@ meta_gdk_pixbuf_get_from_pixmap (GdkPixbuf *dest,
GdkColormap *cmap; GdkColormap *cmap;
retval = NULL; retval = NULL;
cmap = NULL;
drawable = gdk_xid_table_lookup (xpixmap); drawable = gdk_xid_table_lookup (xpixmap);