mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
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:
parent
6732dd540c
commit
cf9f7f427e
@ -784,22 +784,22 @@ meta_window_place (MetaWindow *window,
|
||||
{
|
||||
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
|
||||
*/
|
||||
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 */
|
||||
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);
|
||||
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
||||
/* Ignore even USPosition on dialogs, splashscreen */
|
||||
/* Ignore even USER_POSITION on dialogs, splashscreen */
|
||||
case META_WINDOW_DIALOG:
|
||||
case META_WINDOW_MODAL_DIALOG:
|
||||
case META_WINDOW_SPLASHSCREEN:
|
||||
@ -819,10 +819,10 @@ meta_window_place (MetaWindow *window,
|
||||
case META_WINDOW_COMBO:
|
||||
case META_WINDOW_DND:
|
||||
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,
|
||||
"Not placing non-normal non-dialog window with PPosition set");
|
||||
"Not placing non-normal non-dialog window with PROGRAM_POSITION set");
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
@ -832,11 +832,11 @@ meta_window_place (MetaWindow *window,
|
||||
{
|
||||
/* workarounds enabled */
|
||||
|
||||
if ((window->size_hints.flags & PPosition) ||
|
||||
(window->size_hints.flags & USPosition))
|
||||
if ((window->size_hints.flags & META_SIZE_HINTS_PROGRAM_POSITION) ||
|
||||
(window->size_hints.flags & META_SIZE_HINTS_USER_POSITION))
|
||||
{
|
||||
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);
|
||||
goto done;
|
||||
}
|
||||
|
@ -164,6 +164,49 @@ typedef enum
|
||||
META_EDGE_RESISTANCE_WINDOWS = 1 << 2,
|
||||
} 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
|
||||
{
|
||||
GObject parent_instance;
|
||||
@ -300,7 +343,7 @@ struct _MetaWindow
|
||||
MtkRectangle icon_geometry;
|
||||
|
||||
/* x/y/w/h here get filled with ConfigureRequest values */
|
||||
XSizeHints size_hints;
|
||||
MetaSizeHints size_hints;
|
||||
|
||||
/* Managed by stack.c */
|
||||
MetaStackLayer layer;
|
||||
|
@ -2539,8 +2539,8 @@ meta_window_unminimize (MetaWindow *window)
|
||||
}
|
||||
|
||||
static void
|
||||
ensure_size_hints_satisfied (MtkRectangle *rect,
|
||||
const XSizeHints *size_hints)
|
||||
ensure_size_hints_satisfied (MtkRectangle *rect,
|
||||
const MetaSizeHints *size_hints)
|
||||
{
|
||||
int minw, minh, maxw, maxh; /* min/max width/height */
|
||||
int basew, baseh, winc, hinc; /* base width/height, width/height increment */
|
||||
|
@ -1320,7 +1320,7 @@ meta_window_wayland_set_min_size (MetaWindow *window,
|
||||
{
|
||||
window->size_hints.min_width = 0;
|
||||
window->size_hints.min_height = 0;
|
||||
window->size_hints.flags &= ~PMinSize;
|
||||
window->size_hints.flags &= ~META_SIZE_HINTS_PROGRAM_MIN_SIZE;
|
||||
|
||||
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_height = (int) MIN (new_height, G_MAXINT);
|
||||
window->size_hints.flags |= PMinSize;
|
||||
window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_MIN_SIZE;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1354,7 +1354,7 @@ meta_window_wayland_set_max_size (MetaWindow *window,
|
||||
{
|
||||
window->size_hints.max_width = 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;
|
||||
}
|
||||
@ -1371,7 +1371,7 @@ meta_window_wayland_set_max_size (MetaWindow *window,
|
||||
new_width : G_MAXINT);
|
||||
window->size_hints.max_height = (int) ((new_height > 0 && new_height < G_MAXINT) ?
|
||||
new_height : G_MAXINT);
|
||||
window->size_hints.flags |= PMaxSize;
|
||||
window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_MAX_SIZE;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1382,7 +1382,7 @@ meta_window_wayland_get_min_size (MetaWindow *window,
|
||||
gint64 current_width, current_height;
|
||||
float scale;
|
||||
|
||||
if (!(window->size_hints.flags & PMinSize))
|
||||
if (!(window->size_hints.flags & META_SIZE_HINTS_PROGRAM_MIN_SIZE))
|
||||
{
|
||||
/* Zero means unlimited */
|
||||
*width = 0;
|
||||
@ -1414,7 +1414,7 @@ meta_window_wayland_get_max_size (MetaWindow *window,
|
||||
gint64 current_height = 0;
|
||||
float scale;
|
||||
|
||||
if (!(window->size_hints.flags & PMaxSize))
|
||||
if (!(window->size_hints.flags & META_SIZE_HINTS_PROGRAM_MAX_SIZE))
|
||||
{
|
||||
/* Zero means unlimited */
|
||||
*width = 0;
|
||||
|
@ -1085,132 +1085,132 @@ reload_update_counter (MetaWindow *window,
|
||||
(FLAG_TOGGLED_ON(old,new,flag) || FLAG_TOGGLED_OFF(old,new,flag))
|
||||
|
||||
static void
|
||||
spew_size_hints_differences (const XSizeHints *old,
|
||||
const XSizeHints *new)
|
||||
spew_size_hints_differences (const MetaSizeHints *old,
|
||||
const MetaSizeHints *new)
|
||||
{
|
||||
if (FLAG_CHANGED (old, new, USPosition))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: USPosition now %s",
|
||||
FLAG_TOGGLED_ON (old, new, USPosition) ? "set" : "unset");
|
||||
if (FLAG_CHANGED (old, new, USSize))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: USSize now %s",
|
||||
FLAG_TOGGLED_ON (old, new, USSize) ? "set" : "unset");
|
||||
if (FLAG_CHANGED (old, new, PPosition))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PPosition now %s",
|
||||
FLAG_TOGGLED_ON (old, new, PPosition) ? "set" : "unset");
|
||||
if (FLAG_CHANGED (old, new, PSize))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PSize now %s",
|
||||
FLAG_TOGGLED_ON (old, new, PSize) ? "set" : "unset");
|
||||
if (FLAG_CHANGED (old, new, PMinSize))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PMinSize now %s (%d x %d -> %d x %d)",
|
||||
FLAG_TOGGLED_ON (old, new, PMinSize) ? "set" : "unset",
|
||||
if (FLAG_CHANGED (old, new, META_SIZE_HINTS_USER_POSITION))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: USER_POSITION now %s",
|
||||
FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_USER_POSITION) ? "set" : "unset");
|
||||
if (FLAG_CHANGED (old, new, META_SIZE_HINTS_USER_SIZE))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: USER_SIZE now %s",
|
||||
FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_USER_SIZE) ? "set" : "unset");
|
||||
if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_POSITION))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_POSITION now %s",
|
||||
FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_POSITION) ? "set" : "unset");
|
||||
if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_SIZE))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_SIZE now %s",
|
||||
FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_SIZE) ? "set" : "unset");
|
||||
if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_MIN_SIZE))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_MIN_SIZE now %s (%d x %d -> %d x %d)",
|
||||
FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_MIN_SIZE) ? "set" : "unset",
|
||||
old->min_width, old->min_height,
|
||||
new->min_width, new->min_height);
|
||||
if (FLAG_CHANGED (old, new, PMaxSize))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PMaxSize now %s (%d x %d -> %d x %d)",
|
||||
FLAG_TOGGLED_ON (old, new, PMaxSize) ? "set" : "unset",
|
||||
if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_MAX_SIZE))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_MAX_SIZE now %s (%d x %d -> %d x %d)",
|
||||
FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_MAX_SIZE) ? "set" : "unset",
|
||||
old->max_width, old->max_height,
|
||||
new->max_width, new->max_height);
|
||||
if (FLAG_CHANGED (old, new, PResizeInc))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PResizeInc now %s (width_inc %d -> %d height_inc %d -> %d)",
|
||||
FLAG_TOGGLED_ON (old, new, PResizeInc) ? "set" : "unset",
|
||||
if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_RESIZE_INCREMENTS now %s (width_inc %d -> %d height_inc %d -> %d)",
|
||||
FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS) ? "set" : "unset",
|
||||
old->width_inc, new->width_inc,
|
||||
old->height_inc, new->height_inc);
|
||||
if (FLAG_CHANGED (old, new, PAspect))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PAspect now %s (min %d/%d -> %d/%d max %d/%d -> %d/%d)",
|
||||
FLAG_TOGGLED_ON (old, new, PAspect) ? "set" : "unset",
|
||||
if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_ASPECT))
|
||||
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, META_SIZE_HINTS_PROGRAM_ASPECT) ? "set" : "unset",
|
||||
old->min_aspect.x, old->min_aspect.y,
|
||||
new->min_aspect.x, new->min_aspect.y,
|
||||
old->max_aspect.x, old->max_aspect.y,
|
||||
new->max_aspect.x, new->max_aspect.y);
|
||||
if (FLAG_CHANGED (old, new, PBaseSize))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PBaseSize now %s (%d x %d -> %d x %d)",
|
||||
FLAG_TOGGLED_ON (old, new, PBaseSize) ? "set" : "unset",
|
||||
if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_BASE_SIZE))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_BASE_SIZE now %s (%d x %d -> %d x %d)",
|
||||
FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_BASE_SIZE) ? "set" : "unset",
|
||||
old->base_width, old->base_height,
|
||||
new->base_width, new->base_height);
|
||||
if (FLAG_CHANGED (old, new, PWinGravity))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PWinGravity now %s (%d -> %d)",
|
||||
FLAG_TOGGLED_ON (old, new, PWinGravity) ? "set" : "unset",
|
||||
if (FLAG_CHANGED (old, new, META_SIZE_HINTS_PROGRAM_WIN_GRAVITY))
|
||||
meta_topic (META_DEBUG_GEOMETRY, "XSizeHints: PROGRAM_WIN_GRAVITY now %s (%d -> %d)",
|
||||
FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_WIN_GRAVITY) ? "set" : "unset",
|
||||
old->win_gravity, new->win_gravity);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
hints_have_changed (const XSizeHints *old,
|
||||
const XSizeHints *new)
|
||||
hints_have_changed (const MetaSizeHints *old,
|
||||
const MetaSizeHints *new)
|
||||
{
|
||||
/* 1. Check if the relevant values have changed if the flag is set. */
|
||||
|
||||
if (FLAG_TOGGLED_ON (old, new, USPosition) ||
|
||||
(FLAG_IS_ON (new, USPosition) &&
|
||||
if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_USER_POSITION) ||
|
||||
(FLAG_IS_ON (new, META_SIZE_HINTS_USER_POSITION) &&
|
||||
(old->x != new->x ||
|
||||
old->y != new->y)))
|
||||
return TRUE;
|
||||
|
||||
if (FLAG_TOGGLED_ON (old, new, USSize) ||
|
||||
(FLAG_IS_ON (new, USSize) &&
|
||||
if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_USER_SIZE) ||
|
||||
(FLAG_IS_ON (new, META_SIZE_HINTS_USER_SIZE) &&
|
||||
(old->width != new->width ||
|
||||
old->height != new->height)))
|
||||
return TRUE;
|
||||
|
||||
if (FLAG_TOGGLED_ON (old, new, PPosition) ||
|
||||
(FLAG_IS_ON (new, PPosition) &&
|
||||
if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_POSITION) ||
|
||||
(FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_POSITION) &&
|
||||
(old->x != new->x ||
|
||||
old->y != new->y)))
|
||||
return TRUE;
|
||||
|
||||
if (FLAG_TOGGLED_ON (old, new, PSize) ||
|
||||
(FLAG_IS_ON (new, PSize) &&
|
||||
if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_SIZE) ||
|
||||
(FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_SIZE) &&
|
||||
(old->width != new->width ||
|
||||
old->height != new->height)))
|
||||
return TRUE;
|
||||
|
||||
if (FLAG_TOGGLED_ON (old, new, PMinSize) ||
|
||||
(FLAG_IS_ON (new, PMinSize) &&
|
||||
if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_MIN_SIZE) ||
|
||||
(FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_MIN_SIZE) &&
|
||||
(old->min_width != new->min_width ||
|
||||
old->min_height != new->min_height)))
|
||||
return TRUE;
|
||||
|
||||
if (FLAG_TOGGLED_ON (old, new, PMaxSize) ||
|
||||
(FLAG_IS_ON (new, PMaxSize) &&
|
||||
if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_MAX_SIZE) ||
|
||||
(FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_MAX_SIZE) &&
|
||||
(old->max_width != new->max_width ||
|
||||
old->max_height != new->max_height)))
|
||||
return TRUE;
|
||||
|
||||
if (FLAG_TOGGLED_ON (old, new, PResizeInc) ||
|
||||
(FLAG_IS_ON (new, PResizeInc) &&
|
||||
if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS) ||
|
||||
(FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS) &&
|
||||
(old->width_inc != new->width_inc ||
|
||||
old->height_inc != new->height_inc)))
|
||||
return TRUE;
|
||||
|
||||
if (FLAG_TOGGLED_ON (old, new, PAspect) ||
|
||||
(FLAG_IS_ON (new, PAspect) &&
|
||||
if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_ASPECT) ||
|
||||
(FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_ASPECT) &&
|
||||
(old->min_aspect.x != new->min_aspect.x ||
|
||||
old->min_aspect.y != new->min_aspect.y ||
|
||||
old->max_aspect.x != new->max_aspect.x ||
|
||||
old->max_aspect.y != new->max_aspect.y)))
|
||||
return TRUE;
|
||||
|
||||
if (FLAG_TOGGLED_ON (old, new, PBaseSize) ||
|
||||
(FLAG_IS_ON (new, PBaseSize) &&
|
||||
if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_BASE_SIZE) ||
|
||||
(FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_BASE_SIZE) &&
|
||||
(old->base_width != new->base_width ||
|
||||
old->base_height != new->base_height)))
|
||||
return TRUE;
|
||||
|
||||
if (FLAG_TOGGLED_ON (old, new, PWinGravity) ||
|
||||
(FLAG_IS_ON (new, PWinGravity) &&
|
||||
if (FLAG_TOGGLED_ON (old, new, META_SIZE_HINTS_PROGRAM_WIN_GRAVITY) ||
|
||||
(FLAG_IS_ON (new, META_SIZE_HINTS_PROGRAM_WIN_GRAVITY) &&
|
||||
(old->win_gravity != new->win_gravity)))
|
||||
return TRUE;
|
||||
|
||||
/* 2. Check if the flags have been unset. */
|
||||
return FLAG_TOGGLED_OFF (old, new, USPosition) ||
|
||||
FLAG_TOGGLED_OFF (old, new, USSize) ||
|
||||
FLAG_TOGGLED_OFF (old, new, PPosition) ||
|
||||
FLAG_TOGGLED_OFF (old, new, PSize) ||
|
||||
FLAG_TOGGLED_OFF (old, new, PMinSize) ||
|
||||
FLAG_TOGGLED_OFF (old, new, PMaxSize) ||
|
||||
FLAG_TOGGLED_OFF (old, new, PResizeInc) ||
|
||||
FLAG_TOGGLED_OFF (old, new, PAspect) ||
|
||||
FLAG_TOGGLED_OFF (old, new, PBaseSize) ||
|
||||
FLAG_TOGGLED_OFF (old, new, PWinGravity);
|
||||
return FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_USER_POSITION) ||
|
||||
FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_USER_POSITION) ||
|
||||
FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_POSITION) ||
|
||||
FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_SIZE) ||
|
||||
FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_MIN_SIZE) ||
|
||||
FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_MAX_SIZE) ||
|
||||
FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS) ||
|
||||
FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_ASPECT) ||
|
||||
FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_BASE_SIZE) ||
|
||||
FLAG_TOGGLED_OFF (old, new, META_SIZE_HINTS_PROGRAM_WIN_GRAVITY);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1245,7 +1245,7 @@ meta_set_normal_hints (MetaWindow *window,
|
||||
* as if flags were zero
|
||||
*/
|
||||
if (hints)
|
||||
window->size_hints = *hints;
|
||||
window->size_hints = *(MetaSizeHints*)(hints);
|
||||
else
|
||||
window->size_hints.flags = 0;
|
||||
|
||||
@ -1256,14 +1256,14 @@ meta_set_normal_hints (MetaWindow *window,
|
||||
window->size_hints.height = h;
|
||||
|
||||
/* 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",
|
||||
window->desc,
|
||||
window->size_hints.base_width,
|
||||
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_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_height = 0;
|
||||
}
|
||||
window->size_hints.flags |= PBaseSize;
|
||||
window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_BASE_SIZE;
|
||||
|
||||
/* 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",
|
||||
window->desc,
|
||||
window->size_hints.min_width,
|
||||
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_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_height = 0;
|
||||
}
|
||||
window->size_hints.flags |= PMinSize;
|
||||
window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_MIN_SIZE;
|
||||
|
||||
/* 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",
|
||||
window->desc,
|
||||
@ -1307,11 +1307,11 @@ meta_set_normal_hints (MetaWindow *window,
|
||||
{
|
||||
window->size_hints.max_width = 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 */
|
||||
if (window->size_hints.flags & PResizeInc)
|
||||
if (window->size_hints.flags & META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS)
|
||||
{
|
||||
meta_topic (META_DEBUG_GEOMETRY,
|
||||
"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.height_inc = 1;
|
||||
window->size_hints.flags |= PResizeInc;
|
||||
window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_RESIZE_INCREMENTS;
|
||||
}
|
||||
|
||||
/* 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,
|
||||
"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.max_aspect.x = G_MAXINT;
|
||||
window->size_hints.max_aspect.y = 1;
|
||||
window->size_hints.flags |= PAspect;
|
||||
window->size_hints.flags |= META_SIZE_HINTS_PROGRAM_ASPECT;
|
||||
}
|
||||
|
||||
/* 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",
|
||||
window->desc,
|
||||
@ -1359,7 +1359,7 @@ meta_set_normal_hints (MetaWindow *window,
|
||||
"Window %s doesn't set gravity, using NW",
|
||||
window->desc);
|
||||
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 ***/
|
||||
@ -1562,7 +1562,7 @@ reload_normal_hints (MetaWindow *window,
|
||||
{
|
||||
if (value->type != META_PROP_VALUE_INVALID)
|
||||
{
|
||||
XSizeHints old_hints;
|
||||
MetaSizeHints old_hints;
|
||||
gboolean hints_have_differences;
|
||||
|
||||
meta_topic (META_DEBUG_GEOMETRY, "Updating WM_NORMAL_HINTS for %s", window->desc);
|
||||
|
@ -1423,16 +1423,16 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
|
||||
!(need_resize_client || need_resize_frame))
|
||||
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
|
||||
* in such cases. See #322840. (Note that window->constructing is
|
||||
* 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.)
|
||||
*/
|
||||
if (window->constructing && window->frame &&
|
||||
((window->size_hints.flags & PPosition) ||
|
||||
(window->size_hints.flags & USPosition)))
|
||||
((window->size_hints.flags & META_SIZE_HINTS_PROGRAM_POSITION) ||
|
||||
(window->size_hints.flags & META_SIZE_HINTS_USER_POSITION)))
|
||||
need_configure_notify = TRUE;
|
||||
|
||||
/* 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_SPLASHSCREEN)
|
||||
; /* No position change for these */
|
||||
else if ((window->size_hints.flags & PPosition) ||
|
||||
/* USPosition is just stale if window is placed;
|
||||
else if ((window->size_hints.flags & META_SIZE_HINTS_PROGRAM_POSITION) ||
|
||||
/* USER_POSITION is just stale if window is placed;
|
||||
* no --geometry involved here.
|
||||
*/
|
||||
((window->size_hints.flags & USPosition) &&
|
||||
((window->size_hints.flags & META_SIZE_HINTS_USER_POSITION) &&
|
||||
!window->placed))
|
||||
allow_position_change = TRUE;
|
||||
}
|
||||
@ -2693,9 +2693,9 @@ meta_window_move_resize_request (MetaWindow *window,
|
||||
else
|
||||
{
|
||||
meta_topic (META_DEBUG_GEOMETRY,
|
||||
"Not allowing position change for window %s PPosition 0x%lx USPosition 0x%lx type %u",
|
||||
window->desc, window->size_hints.flags & PPosition,
|
||||
window->size_hints.flags & USPosition,
|
||||
"Not allowing position change for window %s PROGRAM_POSITION 0x%lx USER_POSITION 0x%lx type %u",
|
||||
window->desc, window->size_hints.flags & META_SIZE_HINTS_PROGRAM_POSITION,
|
||||
window->size_hints.flags & META_SIZE_HINTS_USER_POSITION,
|
||||
window->type);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user