Commit 8849fad8 authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

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
parent 98390873
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
......
......@@ -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 ("/",
......
......@@ -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 ("/",
......@@ -2418,6 +2426,48 @@ error_on_command (int command_index,
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
handle_run_command (MetaDisplay *display,
MetaScreen *screen,
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment