Initialize size_hints on window creation using code shared with size_hints property reload
This commit is contained in:
parent
75fa56391d
commit
2eec8daff5
@ -509,19 +509,11 @@ spew_size_hints_differences (const XSizeHints *old,
|
|||||||
old->win_gravity, new->win_gravity);
|
old->win_gravity, new->win_gravity);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
reload_normal_hints (MetaWindow *window,
|
meta_set_normal_hints (MetaWindow *window,
|
||||||
MetaPropValue *value)
|
XSizeHints *hints)
|
||||||
{
|
{
|
||||||
if (value->type != META_PROP_VALUE_INVALID)
|
|
||||||
{
|
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
XSizeHints old_hints;
|
|
||||||
|
|
||||||
meta_topic (META_DEBUG_GEOMETRY, "Updating WM_NORMAL_HINTS for %s\n", window->desc);
|
|
||||||
|
|
||||||
old_hints = window->size_hints;
|
|
||||||
|
|
||||||
/* Save the last ConfigureRequest, which we put here.
|
/* Save the last ConfigureRequest, which we put here.
|
||||||
* Values here set in the hints are supposed to
|
* Values here set in the hints are supposed to
|
||||||
* be ignored.
|
* be ignored.
|
||||||
@ -538,8 +530,15 @@ reload_normal_hints (MetaWindow *window,
|
|||||||
* fields if they're missing.
|
* fields if they're missing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
window->size_hints.flags = 0; /* pointless right? why did I have this here */
|
/*
|
||||||
window->size_hints = * value->v.size_hints.hints;
|
* When the window is first created, NULL hints will
|
||||||
|
* be passed in which will initialize all of the fields
|
||||||
|
* as if flags were zero
|
||||||
|
*/
|
||||||
|
if (hints)
|
||||||
|
window->size_hints = *hints;
|
||||||
|
else
|
||||||
|
window->size_hints.flags = 0;
|
||||||
|
|
||||||
/* Put back saved ConfigureRequest. */
|
/* Put back saved ConfigureRequest. */
|
||||||
window->size_hints.x = x;
|
window->size_hints.x = x;
|
||||||
@ -715,6 +714,21 @@ reload_normal_hints (MetaWindow *window,
|
|||||||
window->size_hints.win_gravity = NorthWestGravity;
|
window->size_hints.win_gravity = NorthWestGravity;
|
||||||
window->size_hints.flags |= PWinGravity;
|
window->size_hints.flags |= PWinGravity;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
reload_normal_hints (MetaWindow *window,
|
||||||
|
MetaPropValue *value)
|
||||||
|
{
|
||||||
|
if (value->type != META_PROP_VALUE_INVALID)
|
||||||
|
{
|
||||||
|
XSizeHints old_hints;
|
||||||
|
|
||||||
|
meta_topic (META_DEBUG_GEOMETRY, "Updating WM_NORMAL_HINTS for %s\n", window->desc);
|
||||||
|
|
||||||
|
old_hints = window->size_hints;
|
||||||
|
|
||||||
|
meta_set_normal_hints (window, value->v.size_hints.hints);
|
||||||
|
|
||||||
spew_size_hints_differences (&old_hints, &window->size_hints);
|
spew_size_hints_differences (&old_hints, &window->size_hints);
|
||||||
|
|
||||||
|
@ -33,4 +33,7 @@ void meta_window_reload_properties (MetaWindow *window,
|
|||||||
void meta_display_init_window_prop_hooks (MetaDisplay *display);
|
void meta_display_init_window_prop_hooks (MetaDisplay *display);
|
||||||
void meta_display_free_window_prop_hooks (MetaDisplay *display);
|
void meta_display_free_window_prop_hooks (MetaDisplay *display);
|
||||||
|
|
||||||
|
void meta_set_normal_hints (MetaWindow *window,
|
||||||
|
XSizeHints *hints);
|
||||||
|
|
||||||
#endif /* META_WINDOW_PROPS_H */
|
#endif /* META_WINDOW_PROPS_H */
|
||||||
|
@ -334,14 +334,14 @@ meta_window_new (MetaDisplay *display,
|
|||||||
window->rect.width = attrs.width;
|
window->rect.width = attrs.width;
|
||||||
window->rect.height = attrs.height;
|
window->rect.height = attrs.height;
|
||||||
|
|
||||||
window->size_hints.flags = 0;
|
|
||||||
|
|
||||||
/* And border width, size_hints are the "request" */
|
/* And border width, size_hints are the "request" */
|
||||||
window->border_width = attrs.border_width;
|
window->border_width = attrs.border_width;
|
||||||
window->size_hints.x = attrs.x;
|
window->size_hints.x = attrs.x;
|
||||||
window->size_hints.y = attrs.y;
|
window->size_hints.y = attrs.y;
|
||||||
window->size_hints.width = attrs.width;
|
window->size_hints.width = attrs.width;
|
||||||
window->size_hints.height = attrs.height;
|
window->size_hints.height = attrs.height;
|
||||||
|
/* initialize the remaining size_hints as if size_hints.flags were zero */
|
||||||
|
meta_set_normal_hints (window, NULL);
|
||||||
|
|
||||||
/* And this is our unmaximized size */
|
/* And this is our unmaximized size */
|
||||||
window->saved_rect = window->rect;
|
window->saved_rect = window->rect;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user