Commit 6dbec6f8 authored by Jasper St. Pierre's avatar Jasper St. Pierre

xprops: More Xlib / long cleanliness with Motif WM hints

Fixes some CSD windows sometimes getting frames when they totes
shouldn't.
parent 2cbaa666
......@@ -862,7 +862,7 @@ reload_mwm_hints (MetaWindow *window,
if (hints->flags & MWM_HINTS_DECORATIONS)
{
meta_verbose ("Window %s sets MWM_HINTS_DECORATIONS 0x%lx\n",
meta_verbose ("Window %s sets MWM_HINTS_DECORATIONS 0x%x\n",
window->desc, hints->decorations);
if (hints->decorations == 0)
......@@ -878,7 +878,7 @@ reload_mwm_hints (MetaWindow *window,
{
gboolean toggle_value;
meta_verbose ("Window %s sets MWM_HINTS_FUNCTIONS 0x%lx\n",
meta_verbose ("Window %s sets MWM_HINTS_FUNCTIONS 0x%x\n",
window->desc, hints->functions);
/* If _ALL is specified, then other flags indicate what to turn off;
......
......@@ -292,19 +292,11 @@ static gboolean
motif_hints_from_results (GetPropertyResults *results,
MotifWmHints **hints_p)
{
int real_size, max_size;
#define MAX_ITEMS sizeof (MotifWmHints)/sizeof (gulong)
*hints_p = NULL;
if (results->type == None || results->n_items <= 0)
{
meta_verbose ("Motif hints had unexpected type or n_items\n");
if (results->prop)
{
g_free (results->prop);
results->prop = NULL;
}
return FALSE;
}
......@@ -312,26 +304,12 @@ motif_hints_from_results (GetPropertyResults *results,
* MotifWmHints than the one we expect, apparently. I'm not sure of
* the history behind it. See bug #89841 for example.
*/
*hints_p = malloc (sizeof (MotifWmHints));
*hints_p = calloc (1, sizeof (MotifWmHints));
if (*hints_p == NULL)
{
if (results->prop)
{
g_free (results->prop);
results->prop = NULL;
}
return FALSE;
}
real_size = results->n_items * sizeof (gulong);
max_size = MAX_ITEMS * sizeof (gulong);
memcpy (*hints_p, results->prop, MIN (real_size, max_size));
if (results->prop)
{
g_free (results->prop);
results->prop = NULL;
}
return FALSE;
memcpy(*hints_p, results->prop, MIN (sizeof (MotifWmHints),
results->n_items * sizeof (uint32_t)));
return TRUE;
}
......
......@@ -33,11 +33,11 @@
* found in some Motif reference guides online.
*/
typedef struct {
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long input_mode;
unsigned long status;
uint32_t flags;
uint32_t functions;
uint32_t decorations;
uint32_t input_mode;
uint32_t status;
} MotifWmHints, MwmHints;
#define MWM_HINTS_FUNCTIONS (1L << 0)
......
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