get window name before anything else.

2002-12-15  Havoc Pennington  <hp@pobox.com>

	* src/window.c (meta_window_new): get window name before anything
	else.

	* src/xprops.c (validate_or_free_results): instead of suggesting
	how to get window title etc. with xprop, just print out the
	window title. much better.
This commit is contained in:
Havoc Pennington 2002-12-15 21:59:38 +00:00 committed by Havoc Pennington
parent 4ad2d1a048
commit 8a9a4aba77
3 changed files with 46 additions and 5 deletions

View File

@ -1,3 +1,12 @@
2002-12-15 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_new): get window name before anything
else.
* src/xprops.c (validate_or_free_results): instead of suggesting
how to get window title etc. with xprop, just print out the
window title. much better.
2002-12-15 Havoc Pennington <hp@pobox.com>
* src/xprops.c (validate_or_free_results): make the warning about

View File

@ -436,11 +436,14 @@ meta_window_new (MetaDisplay *display,
window->initial_workspace = 0; /* not used */
meta_display_register_x_window (display, &window->xwindow, window);
/* Fill these in the order we want them to be gotten */
/* Fill these in the order we want them to be gotten.
* we want to get window name and class first
* so we can use them in error messages and such.
*/
i = 0;
initial_props[i++] = display->atom_net_wm_name;
initial_props[i++] = display->atom_wm_client_machine;
initial_props[i++] = display->atom_net_wm_pid;
initial_props[i++] = display->atom_net_wm_name;
initial_props[i++] = XA_WM_NAME;
initial_props[i++] = display->atom_net_wm_icon_name;
initial_props[i++] = XA_WM_ICON_NAME;

View File

@ -87,6 +87,7 @@ from The Open Group.
#include "metacity-Xatomtype.h"
#include <X11/Xatom.h>
#include <string.h>
#include "window.h"
typedef struct
{
@ -109,6 +110,10 @@ validate_or_free_results (GetPropertyResults *results,
char *type_name;
char *expected_name;
char *prop_name;
const char *title;
const char *res_class;
const char *res_name;
MetaWindow *w;
if (expected_format == results->format &&
expected_type == results->type &&
@ -121,14 +126,38 @@ validate_or_free_results (GetPropertyResults *results,
prop_name = XGetAtomName (results->display->xdisplay, results->xatom);
meta_error_trap_pop (results->display, TRUE);
meta_warning (_("Window 0x%lx has property %s\nthat was expected to have type %s format %d\nand actually has type %s format %d n_items %d.\nThis is most likely an application bug.\nUse \"xprop -id 0x%lx\" to print all properties on the problematic window.\nThe _NET_WM_NAME or WM_NAME or WM_CLASS properties should identify the application.\n"),
w = meta_display_lookup_x_window (results->display, results->xwindow);
if (w != NULL)
{
title = w->title;
res_class = w->res_class;
res_name = w->res_name;
}
else
{
title = NULL;
res_class = NULL;
res_name = NULL;
}
if (title == NULL)
title = "unknown";
if (res_class == NULL)
res_class = "unknown";
if (res_name == NULL)
res_name = "unknown";
meta_warning (_("Window 0x%lx has property %s\nthat was expected to have type %s format %d\nand actually has type %s format %d n_items %d.\nThis is most likely an application bug not a window manager bug.\nThe window has title=\"%s\" class=\"%s\" name=\"%s\"\n"),
results->xwindow,
prop_name ? prop_name : "(bad atom)",
expected_name ? expected_name : "(bad atom)",
expected_format,
type_name ? type_name : "(bad atom)",
results->format, (int) results->n_items,
results->xwindow);
title, res_class, res_name);
if (type_name)
XFree (type_name);