use meta_XFree not XFree

2002-01-03  Havoc Pennington  <hp@pobox.com>

	* src/window.c: use meta_XFree not XFree

	* src/display.h (meta_XFree): add null-safe XFree

	* src/util.c (meta_warning): have message prefix indicate that
	it's a warning
	(meta_fatal): indicate it's an error

	* src/window.c (update_sm_hints): clean up using
	meta_prop_get_latin1_string
	(update_role): ditto
	(read_client_leader): clean up using meta_prop_get_window
	(update_net_wm_type): clean up using meta_prop_get_cardinal
	(update_initial_workspace): ditto
	(update_net_wm_type): clean up using meta_prop_get_atom_list
	(read_rgb_icon): get result from XGetWindowProperty return value
	not from error trap
	(update_kwm_icon): ditto
	(meta_window_new): fix to read WM_STATE correctly
This commit is contained in:
Havoc Pennington 2002-01-04 03:25:53 +00:00 committed by Havoc Pennington
parent b9701454b8
commit 501a60ab20
6 changed files with 354 additions and 262 deletions

View File

@ -1,3 +1,25 @@
2002-01-03 Havoc Pennington <hp@pobox.com>
* src/window.c: use meta_XFree not XFree
* src/display.h (meta_XFree): add null-safe XFree
* src/util.c (meta_warning): have message prefix indicate that
it's a warning
(meta_fatal): indicate it's an error
* src/window.c (update_sm_hints): clean up using
meta_prop_get_latin1_string
(update_role): ditto
(read_client_leader): clean up using meta_prop_get_window
(update_net_wm_type): clean up using meta_prop_get_cardinal
(update_initial_workspace): ditto
(update_net_wm_type): clean up using meta_prop_get_atom_list
(read_rgb_icon): get result from XGetWindowProperty return value
not from error trap
(update_kwm_icon): ditto
(meta_window_new): fix to read WM_STATE correctly
2002-01-03 Havoc Pennington <hp@pobox.com>
* src/window.c (update_net_wm_state): clean up using

View File

@ -27,6 +27,8 @@
#include "eventqueue.h"
#include "common.h"
#define meta_XFree(p) do { if ((p)) XFree ((p)); } while (0)
/* this doesn't really belong here, oh well. */
typedef struct _MetaRectangle MetaRectangle;

View File

@ -252,7 +252,7 @@ meta_warning (const char *format, ...)
out = logfile ? logfile : stderr;
if (no_prefix == 0)
fputs ("Window manager: ", out);
fputs ("Window manager warning: ", out);
fputs (str, out);
g_free (str);
@ -274,7 +274,7 @@ meta_fatal (const char *format, ...)
out = logfile ? logfile : stderr;
if (no_prefix == 0)
fputs ("Window manager: ", out);
fputs ("Window manager error: ", out);
fputs (str, out);
fflush (out);

View File

@ -65,8 +65,8 @@ static void update_mwm_hints (MetaWindow *window);
static int update_wm_class (MetaWindow *window);
static int update_transient_for (MetaWindow *window);
static void update_sm_hints (MetaWindow *window);
static int update_role (MetaWindow *window);
static int update_net_wm_type (MetaWindow *window);
static void update_role (MetaWindow *window);
static void update_net_wm_type (MetaWindow *window);
static int update_initial_workspace (MetaWindow *window);
static int update_icon_name (MetaWindow *window);
static int update_icon (MetaWindow *window,
@ -105,19 +105,10 @@ static void meta_window_move_resize_internal (MetaWindow *window,
void meta_window_move_resize_now (MetaWindow *window);
static gboolean get_cardinal (MetaDisplay *display,
Window xwindow,
Atom atom,
gulong *val);
static char* get_text_property (MetaDisplay *display,
Window xwindow,
Atom atom);
static char* get_utf8_property (MetaDisplay *display,
Window xwindow,
Atom atom);
void meta_window_unqueue_calc_showing (MetaWindow *window);
void meta_window_flush_calc_showing (MetaWindow *window);
@ -176,10 +167,11 @@ meta_window_new (MetaDisplay *display, Window xwindow,
/* Only manage if WM_STATE is IconicState or NormalState */
gulong state;
/* FIXME WM_STATE isn't a cardinal, it's type WM_STATE */
if (!(get_cardinal (display, xwindow,
display->atom_wm_state,
&state) &&
/* WM_STATE isn't a cardinal, it's type WM_STATE, but is an int */
if (!(meta_prop_get_cardinal_with_atom_type (display, xwindow,
display->atom_wm_state,
display->atom_wm_state,
&state) &&
(state == IconicState || state == NormalState)))
{
meta_verbose ("Deciding not to manage unmapped or unviewable window 0x%lx\n", xwindow);
@ -2441,10 +2433,8 @@ meta_window_client_message (MetaWindow *window,
str1 ? str1 : "(unknown)",
str2 ? str2 : "(unknown)");
if (str1)
XFree (str1);
if (str2)
XFree (str2);
meta_XFree (str1);
meta_XFree (str2);
}
if (first == display->atom_net_wm_state_shaded ||
@ -3111,6 +3101,8 @@ update_size_hints (MetaWindow *window)
static int
update_title (MetaWindow *window)
{
char *str;
meta_error_trap_push (window->display);
if (window->title)
@ -3119,9 +3111,13 @@ update_title (MetaWindow *window)
window->title = NULL;
}
window->title = get_utf8_property (window->display,
window->xwindow,
window->display->atom_net_wm_name);
str = NULL;
meta_prop_get_utf8_string (window->display,
window->xwindow,
window->display->atom_net_wm_name,
&str);
window->title = g_strdup (str);
meta_XFree (str);
if (window->title)
{
@ -3183,8 +3179,7 @@ update_protocols (MetaWindow *window)
++i;
}
if (protocols)
XFree (protocols);
meta_XFree (protocols);
}
meta_verbose ("Window %s has take_focus = %d delete_window = %d\n",
@ -3243,7 +3238,7 @@ update_wm_hints (MetaWindow *window)
window->xgroup_leader, window->icon_pixmap,
window->icon_mask);
XFree (hints);
meta_XFree (hints);
}
return meta_error_trap_pop (window->display);
@ -3284,7 +3279,7 @@ update_net_wm_state (MetaWindow *window)
++i;
}
XFree (atoms);
meta_XFree (atoms);
}
recalc_window_type (window);
@ -3392,7 +3387,7 @@ update_mwm_hints (MetaWindow *window)
else
meta_verbose ("Functions flag unset\n");
XFree (hints);
meta_XFree (hints);
recalc_window_features (window);
}
@ -3413,7 +3408,7 @@ meta_window_get_icon_geometry (MetaWindow *window,
{
meta_verbose ("_NET_WM_ICON_GEOMETRY on %s has %d values instead of 4\n",
window->desc, nitems);
XFree (geometry);
meta_XFree (geometry);
return FALSE;
}
@ -3425,7 +3420,7 @@ meta_window_get_icon_geometry (MetaWindow *window,
rect->height = geometry[3];
}
XFree (geometry);
meta_XFree (geometry);
return TRUE;
}
@ -3475,71 +3470,15 @@ update_wm_class (MetaWindow *window)
return meta_error_trap_pop (window->display);
}
static int
read_string_prop (MetaDisplay *display,
Window xwindow,
Atom atom,
char **strp)
{
Atom type;
int format;
gulong nitems;
gulong bytes_after;
guchar *str;
int result;
meta_error_trap_push (display);
str = NULL;
XGetWindowProperty (display->xdisplay,
xwindow, atom,
0, G_MAXLONG,
False, XA_STRING, &type, &format, &nitems,
&bytes_after, (guchar **)&str);
result = meta_error_trap_pop (display);
if (result != Success)
return result;
if (type != XA_STRING)
return -1; /* whatever */
*strp = g_strdup (str);
XFree (str);
return Success;
}
static Window
read_client_leader (MetaDisplay *display,
Window xwindow)
{
Atom type;
int format;
gulong nitems;
gulong bytes_after;
Window *leader;
int result;
Window retval;
Window retval = None;
meta_error_trap_push (display);
leader = NULL;
XGetWindowProperty (display->xdisplay, xwindow,
display->atom_wm_client_leader,
0, G_MAXLONG,
False, XA_WINDOW, &type, &format, &nitems,
&bytes_after, (guchar **)&leader);
result = meta_error_trap_pop (display);
if (result != Success)
return None;
if (type != XA_WINDOW)
return None;
retval = *leader;
XFree (leader);
meta_prop_get_window (display, xwindow,
display->atom_wm_client_leader,
&retval);
return retval;
}
@ -3577,36 +3516,45 @@ update_sm_hints (MetaWindow *window)
if (leader)
{
char *str;
window->xclient_leader = leader;
read_string_prop (window->display, leader,
window->display->atom_sm_client_id,
&window->sm_client_id);
if (meta_prop_get_latin1_string (window->display, leader,
window->display->atom_sm_client_id,
&str))
{
window->sm_client_id = g_strdup (str);
meta_XFree (str);
}
meta_verbose ("Window %s client leader: 0x%lx SM_CLIENT_ID: '%s'\n",
window->desc, window->xclient_leader,
window->sm_client_id ? window->sm_client_id : "(null)");
window->sm_client_id ? window->sm_client_id : "(null)");
}
else
meta_verbose ("Didn't find a client leader for %s\n", window->desc);
}
static int
static void
update_role (MetaWindow *window)
{
int result;
char *str;
if (window->role)
g_free (window->role);
window->role = NULL;
result = read_string_prop (window->display, window->xwindow,
window->display->atom_wm_window_role,
&window->role);
if (meta_prop_get_latin1_string (window->display, window->xwindow,
window->display->atom_wm_window_role,
&str))
{
window->role = g_strdup (str);
meta_XFree (str);
}
meta_verbose ("Updated role of %s to '%s'\n",
window->desc, window->role ? window->role : "(null)");
return Success;
}
static int
@ -3636,42 +3584,6 @@ update_transient_for (MetaWindow *window)
return meta_error_trap_pop (window->display);
}
static gboolean
get_cardinal (MetaDisplay *display,
Window xwindow,
Atom atom,
gulong *val)
{
Atom type;
int format;
gulong nitems;
gulong bytes_after;
gulong *num;
int err;
meta_error_trap_push (display);
type = None;
XGetWindowProperty (display->xdisplay,
xwindow,
atom,
0, G_MAXLONG,
False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, (guchar **)&num);
err = meta_error_trap_pop (display);
if (err != Success)
return FALSE;
if (type != XA_CARDINAL)
return FALSE; /* FIXME free num ? */
*val = *num;
XFree (num);
return TRUE;
}
static char*
get_text_property (MetaDisplay *display,
Window xwindow,
@ -3704,61 +3616,6 @@ get_text_property (MetaDisplay *display,
return retval;
}
static char*
get_utf8_property (MetaDisplay *display,
Window xwindow,
Atom atom)
{
Atom type;
int format;
gulong nitems;
gulong bytes_after;
guchar *val;
int err;
char *retval;
meta_error_trap_push (display);
type = None;
val = NULL;
XGetWindowProperty (display->xdisplay,
xwindow,
atom,
0, G_MAXLONG,
False, display->atom_utf8_string,
&type, &format, &nitems,
&bytes_after, (guchar **)&val);
err = meta_error_trap_pop (display);
if (err != Success)
return NULL;
if (type != display->atom_utf8_string ||
format != 8 ||
nitems == 0)
{
if (val)
XFree (val);
return NULL;
}
if (!g_utf8_validate (val, nitems, NULL))
{
char *name;
name = XGetAtomName (display->xdisplay, atom);
meta_warning ("Property %s contained invalid UTF-8\n",
name);
XFree (name);
XFree (val);
return NULL;
}
retval = g_strndup (val, nitems);
XFree (val);
return retval;
}
/* some legacy cruft */
typedef enum
{
@ -3770,37 +3627,28 @@ typedef enum
WIN_LAYER_ABOVE_DOCK = 10
} GnomeWinLayer;
static int
static void
update_net_wm_type (MetaWindow *window)
{
Atom type;
int format;
gulong n_atoms;
gulong bytes_after;
int n_atoms;
Atom *atoms;
int result;
int i;
window->type_atom = None;
n_atoms = 0;
atoms = NULL;
meta_error_trap_push (window->display);
XGetWindowProperty (window->display->xdisplay, window->xwindow,
window->display->atom_net_wm_window_type,
0, G_MAXLONG,
False, XA_ATOM, &type, &format, &n_atoms,
&bytes_after, (guchar **)&atoms);
result = meta_error_trap_pop (window->display);
if (result != Success ||
type != XA_ATOM)
if (!meta_prop_get_atom_list (window->display, window->xwindow,
window->display->atom_net_wm_window_type,
&atoms, &n_atoms))
{
/* Fall back to WIN_LAYER */
gulong layer = WIN_LAYER_NORMAL;
if (get_cardinal (window->display,
window->xwindow,
window->display->atom_win_layer,
&layer))
if (meta_prop_get_cardinal (window->display,
window->xwindow,
window->display->atom_win_layer,
&layer))
{
meta_verbose ("%s falling back to _WIN_LAYER hint, layer %ld\n",
window->desc, layer);
@ -3824,9 +3672,8 @@ update_net_wm_type (MetaWindow *window)
}
recalc_window_type (window);
return result;
}
i = 0;
while (i < n_atoms)
{
@ -3847,7 +3694,7 @@ update_net_wm_type (MetaWindow *window)
++i;
}
XFree (atoms);
meta_XFree (atoms);
if (meta_is_verbose ())
{
@ -3862,11 +3709,10 @@ update_net_wm_type (MetaWindow *window)
str ? str : "(none)");
if (str)
XFree (str);
meta_XFree (str);
}
recalc_window_type (window);
return Success;
}
static int
@ -3880,18 +3726,18 @@ update_initial_workspace (MetaWindow *window)
* is just to be nice when restarting from old Sawfish basically,
* should nuke it eventually
*/
if (get_cardinal (window->display,
window->xwindow,
window->display->atom_net_wm_desktop,
&val))
if (meta_prop_get_cardinal (window->display,
window->xwindow,
window->display->atom_net_wm_desktop,
&val))
{
window->initial_workspace_set = TRUE;
window->initial_workspace = val;
}
else if (get_cardinal (window->display,
window->xwindow,
window->display->atom_win_workspace,
&val))
else if (meta_prop_get_cardinal (window->display,
window->xwindow,
window->display->atom_win_workspace,
&val))
{
window->initial_workspace_set = TRUE;
window->initial_workspace = val;
@ -3903,6 +3749,8 @@ update_initial_workspace (MetaWindow *window)
static int
update_icon_name (MetaWindow *window)
{
char *str;
meta_error_trap_push (window->display);
if (window->icon_name)
@ -3911,9 +3759,15 @@ update_icon_name (MetaWindow *window)
window->icon_name = NULL;
}
window->icon_name = get_utf8_property (window->display, window->xwindow,
window->display->atom_net_wm_icon_name);
str = NULL;
meta_prop_get_utf8_string (window->display, window->xwindow,
window->display->atom_net_wm_icon_name,
&str);
window->icon_name = g_strdup (str);
if (str)
meta_XFree (str);
if (window->icon_name)
{
meta_verbose ("Using _NET_WM_ICON_NAME for new icon name of %s: '%s'\n",
@ -4085,23 +3939,19 @@ read_rgb_icon (MetaWindow *window,
gulong *best;
int w, h;
gulong *best_mini;
int mini_w, mini_h;
if (sizeof (gulong) != 4)
meta_warning ("%s: Whoops, I think this function may be broken on 64-bit\n",
G_GNUC_FUNCTION);
int mini_w, mini_h;
meta_error_trap_push (window->display);
type = None;
data = NULL;
XGetWindowProperty (window->display->xdisplay,
window->xwindow,
window->display->atom_net_wm_icon,
0, G_MAXLONG,
False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, ((guchar **)&data));
result = XGetWindowProperty (window->display->xdisplay,
window->xwindow,
window->display->atom_net_wm_icon,
0, G_MAXLONG,
False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, ((guchar **)&data));
result = meta_error_trap_pop (window->display);
meta_error_trap_pop (window->display);
if (result != Success || type != XA_CARDINAL)
{
@ -4113,14 +3963,14 @@ read_rgb_icon (MetaWindow *window,
if (!find_best_size (data, nitems, META_ICON_WIDTH, META_ICON_HEIGHT,
&w, &h, &best))
{
XFree (data);
meta_XFree (data);
return FALSE;
}
if (!find_best_size (data, nitems, META_MINI_ICON_WIDTH, META_MINI_ICON_HEIGHT,
&mini_w, &mini_h, &best_mini))
{
XFree (data);
meta_XFree (data);
return FALSE;
}
@ -4133,7 +3983,7 @@ read_rgb_icon (MetaWindow *window,
argbdata_to_pixdata (best, w * h, pixdata);
argbdata_to_pixdata (best_mini, mini_w * mini_h, mini_pixdata);
XFree (data);
meta_XFree (data);
return TRUE;
}
@ -4460,26 +4310,26 @@ update_kwm_icon (MetaWindow *window)
meta_error_trap_push (window->display);
icons = NULL;
XGetWindowProperty (window->display->xdisplay, window->xwindow,
window->display->atom_kwm_win_icon,
0, G_MAXLONG,
False, window->display->atom_kwm_win_icon,
&type, &format, &nitems,
&bytes_after, (guchar **)&icons);
result = XGetWindowProperty (window->display->xdisplay, window->xwindow,
window->display->atom_kwm_win_icon,
0, G_MAXLONG,
False, window->display->atom_kwm_win_icon,
&type, &format, &nitems,
&bytes_after, (guchar **)&icons);
result = meta_error_trap_pop (window->display);
meta_error_trap_pop (window->display);
if (result != Success)
return result;
if (type != window->display->atom_kwm_win_icon)
return -1; /* FIXME mem leak? */
window->kwm_pixmap = icons[0];
window->kwm_mask = icons[1];
meta_verbose ("Found KWM_WIN_ICON 0x%lx\n", window->kwm_pixmap);
XFree (icons);
meta_XFree (icons);
return Success;
}

View File

@ -30,7 +30,8 @@ check_type_and_format (MetaDisplay *display,
Window xwindow,
Atom xatom,
int expected_format,
Atom expected_type,
Atom expected_type,
int n_items, /* -1 to not check this */
int format,
Atom type)
{
@ -39,8 +40,9 @@ check_type_and_format (MetaDisplay *display,
char *prop_name;
if (expected_format == format &&
expected_type == type)
return TRUE;
expected_type == type &&
(n_items < 0 || n_items > 0))
return TRUE;
meta_error_trap_push (display);
type_name = XGetAtomName (display->xdisplay, type);
@ -48,13 +50,13 @@ check_type_and_format (MetaDisplay *display,
prop_name = XGetAtomName (display->xdisplay, xatom);
meta_error_trap_pop (display);
meta_warning (_("Window 0x%lx has property %s that was expected to have type %s format %d and actually has type %s format %d\n"),
meta_warning (_("Window 0x%lx has property %s that was expected to have type %s format %d and actually has type %s format %d n_items %d\n"),
xwindow,
prop_name ? prop_name : "(bad atom)",
expected_name ? expected_name : "(bad atom)",
expected_format,
type_name ? type_name : "(bad atom)",
format);
format, n_items);
if (type_name)
XFree (type_name);
@ -86,7 +88,8 @@ meta_prop_get_atom_list (MetaDisplay *display,
if (XGetWindowProperty (display->xdisplay, xwindow, xatom,
0, G_MAXLONG,
False, XA_ATOM, &type, &format, &n_atoms,
&bytes_after, (guchar **)&atoms) != Success)
&bytes_after, (guchar **)&atoms) != Success ||
type == None)
{
meta_error_trap_pop (display);
return FALSE;
@ -96,7 +99,7 @@ meta_prop_get_atom_list (MetaDisplay *display,
return FALSE;
if (!check_type_and_format (display, xwindow, xatom, 32, XA_ATOM,
format, type))
-1, format, type))
{
XFree (atoms);
return FALSE;
@ -128,7 +131,8 @@ meta_prop_get_cardinal_list (MetaDisplay *display,
if (XGetWindowProperty (display->xdisplay, xwindow, xatom,
0, G_MAXLONG,
False, XA_CARDINAL, &type, &format, &n_cardinals,
&bytes_after, (guchar **)&cardinals) != Success)
&bytes_after, (guchar **)&cardinals) != Success ||
type == None)
{
meta_error_trap_pop (display);
return FALSE;
@ -138,7 +142,7 @@ meta_prop_get_cardinal_list (MetaDisplay *display,
return FALSE;
if (!check_type_and_format (display, xwindow, xatom, 32, XA_CARDINAL,
format, type))
-1, format, type))
{
XFree (cardinals);
return FALSE;
@ -170,7 +174,8 @@ meta_prop_get_motif_hints (MetaDisplay *display,
if (XGetWindowProperty (display->xdisplay, xwindow, xatom,
0, EXPECTED_ITEMS,
False, AnyPropertyType, &type, &format, &n_items,
&bytes_after, (guchar **)&hints) != Success)
&bytes_after, (guchar **)&hints) != Success ||
type == None)
{
meta_error_trap_pop (display);
return FALSE;
@ -190,3 +195,195 @@ meta_prop_get_motif_hints (MetaDisplay *display,
return TRUE;
}
gboolean
meta_prop_get_latin1_string (MetaDisplay *display,
Window xwindow,
Atom xatom,
char **str_p)
{
Atom type;
int format;
gulong bytes_after;
guchar *str;
gulong n_items;
*str_p = NULL;
meta_error_trap_push (display);
if (XGetWindowProperty (display->xdisplay, xwindow, xatom,
0, G_MAXLONG,
False, XA_STRING, &type, &format, &n_items,
&bytes_after, (guchar **)&str) != Success ||
type == None)
{
meta_error_trap_pop (display);
return FALSE;
}
if (meta_error_trap_pop (display) != Success)
return FALSE;
if (!check_type_and_format (display, xwindow, xatom, 8, XA_STRING,
-1, format, type))
{
XFree (str);
return FALSE;
}
*str_p = str;
return TRUE;
}
gboolean
meta_prop_get_utf8_string (MetaDisplay *display,
Window xwindow,
Atom xatom,
char **str_p)
{
Atom type;
int format;
gulong bytes_after;
guchar *str;
gulong n_items;
*str_p = NULL;
meta_error_trap_push (display);
if (XGetWindowProperty (display->xdisplay, xwindow, xatom,
0, G_MAXLONG,
False, display->atom_utf8_string,
&type, &format, &n_items,
&bytes_after, (guchar **)&str) != Success ||
type == None)
{
meta_error_trap_pop (display);
return FALSE;
}
if (meta_error_trap_pop (display) != Success)
return FALSE;
if (!check_type_and_format (display, xwindow, xatom, 8,
display->atom_utf8_string,
-1, format, type))
{
XFree (str);
return FALSE;
}
if (!g_utf8_validate (str, n_items, NULL))
{
char *name;
name = XGetAtomName (display->xdisplay, xatom);
meta_warning (_("Property %s on window 0x%lx contained invalid UTF-8\n"),
name, xwindow);
XFree (name);
XFree (str);
return FALSE;
}
*str_p = str;
return TRUE;
}
gboolean
meta_prop_get_window (MetaDisplay *display,
Window xwindow,
Atom xatom,
Window *window_p)
{
Atom type;
int format;
gulong bytes_after;
Window *window;
gulong n_items;
*window_p = None;
meta_error_trap_push (display);
if (XGetWindowProperty (display->xdisplay, xwindow, xatom,
0, G_MAXLONG,
False, XA_WINDOW, &type, &format, &n_items,
&bytes_after, (guchar **)&window) != Success ||
type == None)
{
meta_error_trap_pop (display);
return FALSE;
}
if (meta_error_trap_pop (display) != Success)
return FALSE;
if (!check_type_and_format (display, xwindow, xatom, 32, XA_WINDOW,
-1, format, type))
{
XFree (window);
return FALSE;
}
*window_p = *window;
XFree (window);
return TRUE;
}
gboolean
meta_prop_get_cardinal (MetaDisplay *display,
Window xwindow,
Atom xatom,
gulong *cardinal_p)
{
return meta_prop_get_cardinal_with_atom_type (display, xwindow, xatom,
XA_CARDINAL, cardinal_p);
}
gboolean
meta_prop_get_cardinal_with_atom_type (MetaDisplay *display,
Window xwindow,
Atom xatom,
Atom prop_type,
gulong *cardinal_p)
{
Atom type;
int format;
gulong bytes_after;
gulong *cardinal;
gulong n_items;
*cardinal_p = 0;
meta_error_trap_push (display);
if (XGetWindowProperty (display->xdisplay, xwindow, xatom,
0, G_MAXLONG,
False, prop_type, &type, &format, &n_items,
&bytes_after, (guchar **)&cardinal) != Success ||
type == None)
{
meta_error_trap_pop (display);
return FALSE;
}
if (meta_error_trap_pop (display) != Success)
return FALSE;
if (!check_type_and_format (display, xwindow, xatom, 32, prop_type,
-1, format, type))
{
XFree (cardinal);
return FALSE;
}
*cardinal_p = *cardinal;
XFree (cardinal);
return TRUE;
}

View File

@ -81,6 +81,27 @@ gboolean meta_prop_get_cardinal_list (MetaDisplay *display,
Atom xatom,
gulong **cardinals_p,
int *n_cardinals_p);
gboolean meta_prop_get_latin1_string (MetaDisplay *display,
Window xwindow,
Atom xatom,
char **str_p);
gboolean meta_prop_get_utf8_string (MetaDisplay *display,
Window xwindow,
Atom xatom,
char **str_p);
gboolean meta_prop_get_window (MetaDisplay *display,
Window xwindow,
Atom xatom,
Window *window_p);
gboolean meta_prop_get_cardinal (MetaDisplay *display,
Window xwindow,
Atom xatom,
gulong *cardinal_p);
gboolean meta_prop_get_cardinal_with_atom_type (MetaDisplay *display,
Window xwindow,
Atom xatom,
Atom prop_type,
gulong *cardinal_p);
#endif