window: Add a copy of XSizeHints

The type ended being used even in wayland code paths
so add a copy of it for now.

Helps https://gitlab.gnome.org/GNOME/mutter/-/issues/2272

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3597>
This commit is contained in:
Bilal Elmoussaoui 2024-02-19 15:05:15 +01:00
parent 6732dd540c
commit cf9f7f427e
6 changed files with 151 additions and 108 deletions

View File

@ -784,22 +784,22 @@ meta_window_place (MetaWindow *window,
{ {
switch (window->type) switch (window->type)
{ {
/* Only accept USPosition on normal windows because the app is full /* Only accept USER_POSITION on normal windows because the app is full
* of shit claiming the user set -geometry for a dialog or dock * of shit claiming the user set -geometry for a dialog or dock
*/ */
case META_WINDOW_NORMAL: case META_WINDOW_NORMAL:
if (window->size_hints.flags & USPosition) if (window->size_hints.flags & META_SIZE_HINTS_USER_POSITION)
{ {
/* don't constrain with placement algorithm */ /* don't constrain with placement algorithm */
meta_topic (META_DEBUG_PLACEMENT, meta_topic (META_DEBUG_PLACEMENT,
"Honoring USPosition for %s instead of using placement algorithm", "Honoring USER_POSITION for %s instead of using placement algorithm",
window->desc); window->desc);
goto done; goto done;
} }
break; break;
/* Ignore even USPosition on dialogs, splashscreen */ /* Ignore even USER_POSITION on dialogs, splashscreen */
case META_WINDOW_DIALOG: case META_WINDOW_DIALOG:
case META_WINDOW_MODAL_DIALOG: case META_WINDOW_MODAL_DIALOG:
case META_WINDOW_SPLASHSCREEN: case META_WINDOW_SPLASHSCREEN:
@ -819,10 +819,10 @@ meta_window_place (MetaWindow *window,
case META_WINDOW_COMBO: case META_WINDOW_COMBO:
case META_WINDOW_DND: case META_WINDOW_DND:
case META_WINDOW_OVERRIDE_OTHER: case META_WINDOW_OVERRIDE_OTHER:
if (window->size_hints.flags & PPosition) if (window->size_hints.flags & META_SIZE_HINTS_PROGRAM_POSITION)
{ {
meta_topic (META_DEBUG_PLACEMENT, meta_topic (META_DEBUG_PLACEMENT,
"Not placing non-normal non-dialog window with PPosition set"); "Not placing non-normal non-dialog window with PROGRAM_POSITION set");
goto done; goto done;
} }
break; break;
@ -832,11 +832,11 @@ meta_window_place (MetaWindow *window,
{ {
/* workarounds enabled */ /* workarounds enabled */
if ((window->size_hints.flags & PPosition) || if ((window->size_hints.flags & META_SIZE_HINTS_PROGRAM_POSITION) ||
(window->size_hints.flags & USPosition)) (window->size_hints.flags & META_SIZE_HINTS_USER_POSITION))
{ {
meta_topic (META_DEBUG_PLACEMENT, meta_topic (META_DEBUG_PLACEMENT,
"Not placing window with PPosition or USPosition set"); "Not placing window with PROGRAM_POSITION or USER_POSITION set");
avoid_being_obscured_as_second_modal_dialog (window, &x, &y); avoid_being_obscured_as_second_modal_dialog (window, &x, &y);
goto done; goto done;
} }

View File

@ -164,6 +164,49 @@ typedef enum
META_EDGE_RESISTANCE_WINDOWS = 1 << 2, META_EDGE_RESISTANCE_WINDOWS = 1 << 2,
} MetaEdgeResistanceFlags; } MetaEdgeResistanceFlags;
typedef enum
{
/* Equivalent to USPosition */
META_SIZE_HINTS_USER_POSITION = (1L << 0),
/* Equivalent to USSize */
META_SIZE_HINTS_USER_SIZE = (1L << 1),
/* Equivalent to PPosition */
META_SIZE_HINTS_PROGRAM_POSITION = (1L << 2),
/* Equivalent to PSize */
META_SIZE_HINTS_PROGRAM_SIZE = (1L << 3),
/* Equivalent to PMinSize */
META_SIZE_HINTS_PROGRAM_MIN_SIZE = (1L << 4),
/* Equivalent to PMaxSize */
META_SIZE_HINTS_PROGRAM_MAX_SIZE = (1L << 5),
/* Equivalent to PResizeInc */
META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS = (1L << 6),
/* Equivalent to PAspect */
META_SIZE_HINTS_PROGRAM_ASPECT = (1L << 7),
/* Equivalent to PBaseSize */
META_SIZE_HINTS_PROGRAM_BASE_SIZE = (1L << 8),
/* Equivalent to PWinGravity */
META_SIZE_HINTS_PROGRAM_WIN_GRAVITY = (1L << 9),
} MetaSizeHintsFlags;
/**
* A copy of XSizeHints that is meant to stay ABI compatible
* with XSizeHints for x11 code paths usages
*/
typedef struct _MetaSizeHints {
long flags; /* MetaSizeHintsFlags but kept as long to be able to cast between XSizeHints and MetaSizeHints */
int x, y;
int width, height;
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
struct {
int x; /* numerator */
int y; /* denominator */
} min_aspect, max_aspect;
int base_width, base_height;
int win_gravity;
} MetaSizeHints;
struct _MetaWindow struct _MetaWindow
{ {
GObject parent_instance; GObject parent_instance;
@ -300,7 +343,7 @@ struct _MetaWindow
MtkRectangle icon_geometry; MtkRectangle icon_geometry;
/* x/y/w/h here get filled with ConfigureRequest values */ /* x/y/w/h here get filled with ConfigureRequest values */
XSizeHints size_hints; MetaSizeHints size_hints;
/* Managed by stack.c */ /* Managed by stack.c */
MetaStackLayer layer; MetaStackLayer layer;

View File

@ -2539,8 +2539,8 @@ meta_window_unminimize (MetaWindow *window)
} }
static void static void
ensure_size_hints_satisfied (MtkRectangle *rect, ensure_size_hints_satisfied (MtkRectangle *rect,
const XSizeHints *size_hints) const MetaSizeHints *size_hints)
{ {
int minw, minh, maxw, maxh; /* min/max width/height */ int minw, minh, maxw, maxh; /* min/max width/height */
int basew, baseh, winc, hinc; /* base width/height, width/height increment */ int basew, baseh, winc, hinc; /* base width/height, width/height increment */

View File

@ -1320,7 +1320,7 @@ meta_window_wayland_set_min_size (MetaWindow *window,
{ {
window->size_hints.min_width = 0; window->size_hints.min_width = 0;
window->size_hints.min_height = 0; window->size_hints.min_height = 0;
window->size_hints.flags &= ~PMinSize; window->size_hints.flags &= ~META_SIZE_HINTS_PROGRAM_MIN_SIZE;
return; return;
} }
@ -1335,7 +1335,7 @@ meta_window_wayland_set_min_size (MetaWindow *window,
window->size_hints.min_width = (int) MIN (new_width, G_MAXINT); window->size_hints.min_width = (int) MIN (new_width, G_MAXINT);
window->size_hints.min_height = (int) MIN (new_height, G_MAXINT); window->size_hints.min_height = (int) MIN (new_height, G_MAXINT);
window->size_hints.flags |= PMinSize; window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_MIN_SIZE;
} }
void void
@ -1354,7 +1354,7 @@ meta_window_wayland_set_max_size (MetaWindow *window,
{ {
window->size_hints.max_width = G_MAXINT; window->size_hints.max_width = G_MAXINT;
window->size_hints.max_height = G_MAXINT; window->size_hints.max_height = G_MAXINT;
window->size_hints.flags &= ~PMaxSize; window->size_hints.flags &= ~META_SIZE_HINTS_PROGRAM_MAX_SIZE;
return; return;
} }
@ -1371,7 +1371,7 @@ meta_window_wayland_set_max_size (MetaWindow *window,
new_width : G_MAXINT); new_width : G_MAXINT);
window->size_hints.max_height = (int) ((new_height > 0 && new_height < G_MAXINT) ? window->size_hints.max_height = (int) ((new_height > 0 && new_height < G_MAXINT) ?
new_height : G_MAXINT); new_height : G_MAXINT);
window->size_hints.flags |= PMaxSize; window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_MAX_SIZE;
} }
void void
@ -1382,7 +1382,7 @@ meta_window_wayland_get_min_size (MetaWindow *window,
gint64 current_width, current_height; gint64 current_width, current_height;
float scale; float scale;
if (!(window->size_hints.flags & PMinSize)) if (!(window->size_hints.flags & META_SIZE_HINTS_PROGRAM_MIN_SIZE))
{ {
/* Zero means unlimited */ /* Zero means unlimited */
*width = 0; *width = 0;
@ -1414,7 +1414,7 @@ meta_window_wayland_get_max_size (MetaWindow *window,
gint64 current_height = 0; gint64 current_height = 0;
float scale; float scale;
if (!(window->size_hints.flags & PMaxSize)) if (!(window->size_hints.flags & META_SIZE_HINTS_PROGRAM_MAX_SIZE))
{ {
/* Zero means unlimited */ /* Zero means unlimited */
*width = 0; *width = 0;

View File

@ -1085,132 +1085,132 @@ reload_update_counter (MetaWindow *window,
(FLAG_TOGGLED_ON(old,new,flag) || FLAG_TOGGLED_OFF(old,new,flag)) (FLAG_TOGGLED_ON(old,new,flag) || FLAG_TOGGLED_OFF(old,new,flag))
static void static void
spew_size_hints_differences (const XSizeHints *old, spew_size_hints_differences (const MetaSizeHints *old,
const XSizeHints *new) const MetaSizeHints *new)
{ {
if (FLAG_CHANGED (old, new, USPosition)) if (FLAG_CHANGED (old, new, META_SIZE_HINTS_USER_POSITION))
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: USPosition now %s", meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: USER_POSITION now %s",
FLAG_TOGGLED_ON (old, new, USPosition) ? "set" : "unset"); FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_USER_POSITION) ? "set" : "unset");
if (FLAG_CHANGED (old, new, USSize)) if (FLAG_CHANGED (old, new, META_SIZE_HINTS_USER_SIZE))
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: USSize now %s", meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: USER_SIZE now %s",
FLAG_TOGGLED_ON (old, new, USSize) ? "set" : "unset"); FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_USER_SIZE) ? "set" : "unset");
if (FLAG_CHANGED (old, new, PPosition)) if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_POSITION))
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PPosition now %s", meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_POSITION now %s",
FLAG_TOGGLED_ON (old, new, PPosition) ? "set" : "unset"); FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_POSITION) ? "set" : "unset");
if (FLAG_CHANGED (old, new, PSize)) if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_SIZE))
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PSize now %s", meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_SIZE now %s",
FLAG_TOGGLED_ON (old, new, PSize) ? "set" : "unset"); FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_SIZE) ? "set" : "unset");
if (FLAG_CHANGED (old, new, PMinSize)) if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_MIN_SIZE))
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PMinSize now %s (%d x %d -> %d x %d)", meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_MIN_SIZE now %s (%d x %d -> %d x %d)",
FLAG_TOGGLED_ON (old, new, PMinSize) ? "set" : "unset", FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_MIN_SIZE) ? "set" : "unset",
old->min_width, old->min_height, old->min_width, old->min_height,
new->min_width, new->min_height); new->min_width, new->min_height);
if (FLAG_CHANGED (old, new, PMaxSize)) if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_MAX_SIZE))
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PMaxSize now %s (%d x %d -> %d x %d)", meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_MAX_SIZE now %s (%d x %d -> %d x %d)",
FLAG_TOGGLED_ON (old, new, PMaxSize) ? "set" : "unset", FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_MAX_SIZE) ? "set" : "unset",
old->max_width, old->max_height, old->max_width, old->max_height,
new->max_width, new->max_height); new->max_width, new->max_height);
if (FLAG_CHANGED (old, new, PResizeInc)) if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS))
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PResizeInc now %s (width_inc %d -> %d height_inc %d -> %d)", meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_RESIZE_INCREMENTS now %s (width_inc %d -> %d height_inc %d -> %d)",
FLAG_TOGGLED_ON (old, new, PResizeInc) ? "set" : "unset", FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS) ? "set" : "unset",
old->width_inc, new->width_inc, old->width_inc, new->width_inc,
old->height_inc, new->height_inc); old->height_inc, new->height_inc);
if (FLAG_CHANGED (old, new, PAspect)) if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_ASPECT))
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PAspect now %s (min %d/%d -> %d/%d max %d/%d -> %d/%d)", meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_ASPECT now %s (min %d/%d -> %d/%d max %d/%d -> %d/%d)",
FLAG_TOGGLED_ON (old, new, PAspect) ? "set" : "unset", FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_ASPECT) ? "set" : "unset",
old->min_aspect.x, old->min_aspect.y, old->min_aspect.x, old->min_aspect.y,
new->min_aspect.x, new->min_aspect.y, new->min_aspect.x, new->min_aspect.y,
old->max_aspect.x, old->max_aspect.y, old->max_aspect.x, old->max_aspect.y,
new->max_aspect.x, new->max_aspect.y); new->max_aspect.x, new->max_aspect.y);
if (FLAG_CHANGED (old, new, PBaseSize)) if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_BASE_SIZE))
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PBaseSize now %s (%d x %d -> %d x %d)", meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_BASE_SIZE now %s (%d x %d -> %d x %d)",
FLAG_TOGGLED_ON (old, new, PBaseSize) ? "set" : "unset", FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_BASE_SIZE) ? "set" : "unset",
old->base_width, old->base_height, old->base_width, old->base_height,
new->base_width, new->base_height); new->base_width, new->base_height);
if (FLAG_CHANGED (old, new, PWinGravity)) if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_WIN_GRAVITY))
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PWinGravity now %s (%d -> %d)", meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_WIN_GRAVITY now %s (%d -> %d)",
FLAG_TOGGLED_ON (old, new, PWinGravity) ? "set" : "unset", FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_WIN_GRAVITY) ? "set" : "unset",
old->win_gravity, new->win_gravity); old->win_gravity, new->win_gravity);
} }
static gboolean static gboolean
hints_have_changed (const XSizeHints *old, hints_have_changed (const MetaSizeHints *old,
const XSizeHints *new) const MetaSizeHints *new)
{ {
/* 1. Check if the relevant values have changed if the flag is set. */ /* 1. Check if the relevant values have changed if the flag is set. */
if (FLAG_TOGGLED_ON (old, new, USPosition) || if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_USER_POSITION) ||
(FLAG_IS_ON (new, USPosition) && (FLAG_IS_ON (new, META_SIZE_HINTS_USER_POSITION) &&
(old->x != new->x || (old->x != new->x ||
old->y != new->y))) old->y != new->y)))
return TRUE; return TRUE;
if (FLAG_TOGGLED_ON (old, new, USSize) || if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_USER_SIZE) ||
(FLAG_IS_ON (new, USSize) && (FLAG_IS_ON (new, META_SIZE_HINTS_USER_SIZE) &&
(old->width != new->width || (old->width != new->width ||
old->height != new->height))) old->height != new->height)))
return TRUE; return TRUE;
if (FLAG_TOGGLED_ON (old, new, PPosition) || if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_POSITION) ||
(FLAG_IS_ON (new, PPosition) && (FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_POSITION) &&
(old->x != new->x || (old->x != new->x ||
old->y != new->y))) old->y != new->y)))
return TRUE; return TRUE;
if (FLAG_TOGGLED_ON (old, new, PSize) || if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_SIZE) ||
(FLAG_IS_ON (new, PSize) && (FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_SIZE) &&
(old->width != new->width || (old->width != new->width ||
old->height != new->height))) old->height != new->height)))
return TRUE; return TRUE;
if (FLAG_TOGGLED_ON (old, new, PMinSize) || if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_MIN_SIZE) ||
(FLAG_IS_ON (new, PMinSize) && (FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_MIN_SIZE) &&
(old->min_width != new->min_width || (old->min_width != new->min_width ||
old->min_height != new->min_height))) old->min_height != new->min_height)))
return TRUE; return TRUE;
if (FLAG_TOGGLED_ON (old, new, PMaxSize) || if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_MAX_SIZE) ||
(FLAG_IS_ON (new, PMaxSize) && (FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_MAX_SIZE) &&
(old->max_width != new->max_width || (old->max_width != new->max_width ||
old->max_height != new->max_height))) old->max_height != new->max_height)))
return TRUE; return TRUE;
if (FLAG_TOGGLED_ON (old, new, PResizeInc) || if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS) ||
(FLAG_IS_ON (new, PResizeInc) && (FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS) &&
(old->width_inc != new->width_inc || (old->width_inc != new->width_inc ||
old->height_inc != new->height_inc))) old->height_inc != new->height_inc)))
return TRUE; return TRUE;
if (FLAG_TOGGLED_ON (old, new, PAspect) || if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_ASPECT) ||
(FLAG_IS_ON (new, PAspect) && (FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_ASPECT) &&
(old->min_aspect.x != new->min_aspect.x || (old->min_aspect.x != new->min_aspect.x ||
old->min_aspect.y != new->min_aspect.y || old->min_aspect.y != new->min_aspect.y ||
old->max_aspect.x != new->max_aspect.x || old->max_aspect.x != new->max_aspect.x ||
old->max_aspect.y != new->max_aspect.y))) old->max_aspect.y != new->max_aspect.y)))
return TRUE; return TRUE;
if (FLAG_TOGGLED_ON (old, new, PBaseSize) || if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_BASE_SIZE) ||
(FLAG_IS_ON (new, PBaseSize) && (FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_BASE_SIZE) &&
(old->base_width != new->base_width || (old->base_width != new->base_width ||
old->base_height != new->base_height))) old->base_height != new->base_height)))
return TRUE; return TRUE;
if (FLAG_TOGGLED_ON (old, new, PWinGravity) || if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_WIN_GRAVITY) ||
(FLAG_IS_ON (new, PWinGravity) && (FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_WIN_GRAVITY) &&
(old->win_gravity != new->win_gravity))) (old->win_gravity != new->win_gravity)))
return TRUE; return TRUE;
/* 2. Check if the flags have been unset. */ /* 2. Check if the flags have been unset. */
return FLAG_TOGGLED_OFF (old, new, USPosition) || return FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_USER_POSITION) ||
FLAG_TOGGLED_OFF (old, new, USSize) || FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_USER_POSITION) ||
FLAG_TOGGLED_OFF (old, new, PPosition) || FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_POSITION) ||
FLAG_TOGGLED_OFF (old, new, PSize) || FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_SIZE) ||
FLAG_TOGGLED_OFF (old, new, PMinSize) || FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_MIN_SIZE) ||
FLAG_TOGGLED_OFF (old, new, PMaxSize) || FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_MAX_SIZE) ||
FLAG_TOGGLED_OFF (old, new, PResizeInc) || FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS) ||
FLAG_TOGGLED_OFF (old, new, PAspect) || FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_ASPECT) ||
FLAG_TOGGLED_OFF (old, new, PBaseSize) || FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_BASE_SIZE) ||
FLAG_TOGGLED_OFF (old, new, PWinGravity); FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_WIN_GRAVITY);
} }
void void
@ -1245,7 +1245,7 @@ meta_set_normal_hints (MetaWindow *window,
* as if flags were zero * as if flags were zero
*/ */
if (hints) if (hints)
window->size_hints = *hints; window->size_hints = *(MetaSizeHints*)(hints);
else else
window->size_hints.flags = 0; window->size_hints.flags = 0;
@ -1256,14 +1256,14 @@ meta_set_normal_hints (MetaWindow *window,
window->size_hints.height = h; window->size_hints.height = h;
/* Get base size hints */ /* Get base size hints */
if (window->size_hints.flags & PBaseSize) if (window->size_hints.flags & META_SIZE_HINTS_PROGRAM_BASE_SIZE)
{ {
meta_topic (META_DEBUG_GEOMETRY, "Window %s sets base size %d x %d", meta_topic (META_DEBUG_GEOMETRY, "Window %s sets base size %d x %d",
window->desc, window->desc,
window->size_hints.base_width, window->size_hints.base_width,
window->size_hints.base_height); window->size_hints.base_height);
} }
else if (window->size_hints.flags & PMinSize) else if (window->size_hints.flags & META_SIZE_HINTS_PROGRAM_MIN_SIZE)
{ {
window->size_hints.base_width = window->size_hints.min_width; window->size_hints.base_width = window->size_hints.min_width;
window->size_hints.base_height = window->size_hints.min_height; window->size_hints.base_height = window->size_hints.min_height;
@ -1273,17 +1273,17 @@ meta_set_normal_hints (MetaWindow *window,
window->size_hints.base_width = 0; window->size_hints.base_width = 0;
window->size_hints.base_height = 0; window->size_hints.base_height = 0;
} }
window->size_hints.flags |= PBaseSize; window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_BASE_SIZE;
/* Get min size hints */ /* Get min size hints */
if (window->size_hints.flags & PMinSize) if (window->size_hints.flags & META_SIZE_HINTS_PROGRAM_MIN_SIZE)
{ {
meta_topic (META_DEBUG_GEOMETRY, "Window %s sets min size %d x %d", meta_topic (META_DEBUG_GEOMETRY, "Window %s sets min size %d x %d",
window->desc, window->desc,
window->size_hints.min_width, window->size_hints.min_width,
window->size_hints.min_height); window->size_hints.min_height);
} }
else if (window->size_hints.flags & PBaseSize) else if (window->size_hints.flags & META_SIZE_HINTS_PROGRAM_BASE_SIZE)
{ {
window->size_hints.min_width = window->size_hints.base_width; window->size_hints.min_width = window->size_hints.base_width;
window->size_hints.min_height = window->size_hints.base_height; window->size_hints.min_height = window->size_hints.base_height;
@ -1293,10 +1293,10 @@ meta_set_normal_hints (MetaWindow *window,
window->size_hints.min_width = 0; window->size_hints.min_width = 0;
window->size_hints.min_height = 0; window->size_hints.min_height = 0;
} }
window->size_hints.flags |= PMinSize; window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_MIN_SIZE;
/* Get max size hints */ /* Get max size hints */
if (window->size_hints.flags & PMaxSize) if (window->size_hints.flags & META_SIZE_HINTS_PROGRAM_MAX_SIZE)
{ {
meta_topic (META_DEBUG_GEOMETRY, "Window %s sets max size %d x %d", meta_topic (META_DEBUG_GEOMETRY, "Window %s sets max size %d x %d",
window->desc, window->desc,
@ -1307,11 +1307,11 @@ meta_set_normal_hints (MetaWindow *window,
{ {
window->size_hints.max_width = G_MAXINT; window->size_hints.max_width = G_MAXINT;
window->size_hints.max_height = G_MAXINT; window->size_hints.max_height = G_MAXINT;
window->size_hints.flags |= PMaxSize; window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_MAX_SIZE;
} }
/* Get resize increment hints */ /* Get resize increment hints */
if (window->size_hints.flags & PResizeInc) if (window->size_hints.flags & META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS)
{ {
meta_topic (META_DEBUG_GEOMETRY, meta_topic (META_DEBUG_GEOMETRY,
"Window %s sets resize width inc: %d height inc: %d", "Window %s sets resize width inc: %d height inc: %d",
@ -1323,11 +1323,11 @@ meta_set_normal_hints (MetaWindow *window,
{ {
window->size_hints.width_inc = 1; window->size_hints.width_inc = 1;
window->size_hints.height_inc = 1; window->size_hints.height_inc = 1;
window->size_hints.flags |= PResizeInc; window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS;
} }
/* Get aspect ratio hints */ /* Get aspect ratio hints */
if (window->size_hints.flags & PAspect) if (window->size_hints.flags & META_SIZE_HINTS_PROGRAM_ASPECT)
{ {
meta_topic (META_DEBUG_GEOMETRY, meta_topic (META_DEBUG_GEOMETRY,
"Window %s sets min_aspect: %d/%d max_aspect: %d/%d", "Window %s sets min_aspect: %d/%d max_aspect: %d/%d",
@ -1343,11 +1343,11 @@ meta_set_normal_hints (MetaWindow *window,
window->size_hints.min_aspect.y = G_MAXINT; window->size_hints.min_aspect.y = G_MAXINT;
window->size_hints.max_aspect.x = G_MAXINT; window->size_hints.max_aspect.x = G_MAXINT;
window->size_hints.max_aspect.y = 1; window->size_hints.max_aspect.y = 1;
window->size_hints.flags |= PAspect; window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_ASPECT;
} }
/* Get gravity hint */ /* Get gravity hint */
if (window->size_hints.flags & PWinGravity) if (window->size_hints.flags & META_SIZE_HINTS_PROGRAM_WIN_GRAVITY)
{ {
meta_topic (META_DEBUG_GEOMETRY, "Window %s sets gravity %d", meta_topic (META_DEBUG_GEOMETRY, "Window %s sets gravity %d",
window->desc, window->desc,
@ -1359,7 +1359,7 @@ meta_set_normal_hints (MetaWindow *window,
"Window %s doesn't set gravity, using NW", "Window %s doesn't set gravity, using NW",
window->desc); window->desc);
window->size_hints.win_gravity = META_GRAVITY_NORTH_WEST; window->size_hints.win_gravity = META_GRAVITY_NORTH_WEST;
window->size_hints.flags |= PWinGravity; window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_WIN_GRAVITY;
} }
/*** Lots of sanity checking ***/ /*** Lots of sanity checking ***/
@ -1562,7 +1562,7 @@ reload_normal_hints (MetaWindow *window,
{ {
if (value->type != META_PROP_VALUE_INVALID) if (value->type != META_PROP_VALUE_INVALID)
{ {
XSizeHints old_hints; MetaSizeHints old_hints;
gboolean hints_have_differences; gboolean hints_have_differences;
meta_topic (META_DEBUG_GEOMETRY, "Updating WM_NORMAL_HINTS for %s", window->desc); meta_topic (META_DEBUG_GEOMETRY, "Updating WM_NORMAL_HINTS for %s", window->desc);

View File

@ -1423,16 +1423,16 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
!(need_resize_client || need_resize_frame)) !(need_resize_client || need_resize_frame))
need_configure_notify = TRUE; need_configure_notify = TRUE;
/* MapRequest events with a PPosition or UPosition hint with a frame /* MapRequest events with a PROGRAM_POSITION or USER_POSITION hint with a frame
* are moved by mutter without resizing; send a configure notify * are moved by mutter without resizing; send a configure notify
* in such cases. See #322840. (Note that window->constructing is * in such cases. See #322840. (Note that window->constructing is
* only true iff this call is due to a MapRequest, and when * only true iff this call is due to a MapRequest, and when
* PPosition/UPosition hints aren't set, mutter seems to send a * PROGRAM_POSITION/USER_POSITION hints aren't set, mutter seems to send a
* ConfigureNotify anyway due to the above code.) * ConfigureNotify anyway due to the above code.)
*/ */
if (window->constructing && window->frame && if (window->constructing && window->frame &&
((window->size_hints.flags & PPosition) || ((window->size_hints.flags & META_SIZE_HINTS_PROGRAM_POSITION) ||
(window->size_hints.flags & USPosition))) (window->size_hints.flags & META_SIZE_HINTS_USER_POSITION)))
need_configure_notify = TRUE; need_configure_notify = TRUE;
/* If resizing, freeze commits - This is for Xwayland, and a no-op on Xorg */ /* If resizing, freeze commits - This is for Xwayland, and a no-op on Xorg */
@ -2660,11 +2660,11 @@ meta_window_move_resize_request (MetaWindow *window,
window->type == META_WINDOW_MODAL_DIALOG || window->type == META_WINDOW_MODAL_DIALOG ||
window->type == META_WINDOW_SPLASHSCREEN) window->type == META_WINDOW_SPLASHSCREEN)
; /* No position change for these */ ; /* No position change for these */
else if ((window->size_hints.flags & PPosition) || else if ((window->size_hints.flags & META_SIZE_HINTS_PROGRAM_POSITION) ||
/* USPosition is just stale if window is placed; /* USER_POSITION is just stale if window is placed;
* no --geometry involved here. * no --geometry involved here.
*/ */
((window->size_hints.flags & USPosition) && ((window->size_hints.flags & META_SIZE_HINTS_USER_POSITION) &&
!window->placed)) !window->placed))
allow_position_change = TRUE; allow_position_change = TRUE;
} }
@ -2693,9 +2693,9 @@ meta_window_move_resize_request (MetaWindow *window,
else else
{ {
meta_topic (META_DEBUG_GEOMETRY, meta_topic (META_DEBUG_GEOMETRY,
"Not allowing position change for window %s PPosition 0x%lx USPosition 0x%lx type %u", "Not allowing position change for window %s PROGRAM_POSITION 0x%lx USER_POSITION 0x%lx type %u",
window->desc, window->size_hints.flags & PPosition, window->desc, window->size_hints.flags & META_SIZE_HINTS_PROGRAM_POSITION,
window->size_hints.flags & USPosition, window->size_hints.flags & META_SIZE_HINTS_USER_POSITION,
window->type); window->type);
} }