forked from AuroraMiddleware/gtk
Once again rework Win32 window decoration code. Doesn't break #104514. The
2005-11-27 Tor Lillqvist <tml@novell.com> Once again rework Win32 window decoration code. Doesn't break #104514. The dialogs in gtk-demo now have the same decorations and behaviour as on X11. Tried to fix #322516 but it seems very hard to make the trivial sample program there behave as expected. OTOH, simply moving the gtk_window_decorate() call in the #322516 sample program after the call to gtk_widget_show() helps... * gdk/win32/gdkwindow-win32.c (set_or_clear_style_bits): Revert to the correct semantics. Each call to gdk_window_set_decorations() which calls this function is supposed to affect all decorations. (decorate_based_on_hints): New function, looks at both geometry hints and type hint and sets window decorations based on that. Consolidate code from gdk_window_set_geometry_hints() and gdk_window_set_type_hint() here. (gdk_window_set_geometry_hints, gdk_window_set_type_hint): Call decorate_based_on_hints().
This commit is contained in:
parent
575149342b
commit
3ff34d06e8
19
ChangeLog
19
ChangeLog
@ -1,8 +1,23 @@
|
|||||||
2005-11-27 Tor Lillqvist <tml@novell.com>
|
2005-11-27 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
Once again rework Win32 window decoration code. Doesn't break
|
||||||
|
#104514. The dialogs in gtk-demo now have the same decorations and
|
||||||
|
behaviour as on X11. Tried to fix #322516 but it seems very hard
|
||||||
|
to make the trivial sample program there behave as expected. OTOH,
|
||||||
|
simply moving the gtk_window_decorate() call in the #322516 sample
|
||||||
|
program after the call to gtk_widget_show() helps...
|
||||||
|
|
||||||
* gdk/win32/gdkwindow-win32.c (set_or_clear_style_bits): Revert to
|
* gdk/win32/gdkwindow-win32.c (set_or_clear_style_bits): Revert to
|
||||||
the correct semantics. (#322516)
|
the correct semantics. Each call to gdk_window_set_decorations()
|
||||||
(gdk_window_set_geometry_hints): Adjust call correspondingly.
|
which calls this function is supposed to affect all decorations.
|
||||||
|
|
||||||
|
(decorate_based_on_hints): New function, looks at both geometry
|
||||||
|
hints and type hint and sets window decorations based on
|
||||||
|
that. Consolidate code from gdk_window_set_geometry_hints() and
|
||||||
|
gdk_window_set_type_hint() here.
|
||||||
|
|
||||||
|
(gdk_window_set_geometry_hints, gdk_window_set_type_hint): Call
|
||||||
|
decorate_based_on_hints().
|
||||||
|
|
||||||
2005-11-25 Dom Lachowicz <cinamod@hotmail.com>
|
2005-11-25 Dom Lachowicz <cinamod@hotmail.com>
|
||||||
|
|
||||||
|
@ -1,8 +1,23 @@
|
|||||||
2005-11-27 Tor Lillqvist <tml@novell.com>
|
2005-11-27 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
Once again rework Win32 window decoration code. Doesn't break
|
||||||
|
#104514. The dialogs in gtk-demo now have the same decorations and
|
||||||
|
behaviour as on X11. Tried to fix #322516 but it seems very hard
|
||||||
|
to make the trivial sample program there behave as expected. OTOH,
|
||||||
|
simply moving the gtk_window_decorate() call in the #322516 sample
|
||||||
|
program after the call to gtk_widget_show() helps...
|
||||||
|
|
||||||
* gdk/win32/gdkwindow-win32.c (set_or_clear_style_bits): Revert to
|
* gdk/win32/gdkwindow-win32.c (set_or_clear_style_bits): Revert to
|
||||||
the correct semantics. (#322516)
|
the correct semantics. Each call to gdk_window_set_decorations()
|
||||||
(gdk_window_set_geometry_hints): Adjust call correspondingly.
|
which calls this function is supposed to affect all decorations.
|
||||||
|
|
||||||
|
(decorate_based_on_hints): New function, looks at both geometry
|
||||||
|
hints and type hint and sets window decorations based on
|
||||||
|
that. Consolidate code from gdk_window_set_geometry_hints() and
|
||||||
|
gdk_window_set_type_hint() here.
|
||||||
|
|
||||||
|
(gdk_window_set_geometry_hints, gdk_window_set_type_hint): Call
|
||||||
|
decorate_based_on_hints().
|
||||||
|
|
||||||
2005-11-25 Dom Lachowicz <cinamod@hotmail.com>
|
2005-11-25 Dom Lachowicz <cinamod@hotmail.com>
|
||||||
|
|
||||||
|
@ -1590,6 +1590,89 @@ gdk_window_set_urgency_hint (GdkWindow *window,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
decorate_based_on_hints (GdkWindow *window)
|
||||||
|
{
|
||||||
|
GdkWindowImplWin32 *impl;
|
||||||
|
GdkWMDecoration decoration;
|
||||||
|
|
||||||
|
impl = (GdkWindowImplWin32 *)((GdkWindowObject *)window)->impl;
|
||||||
|
|
||||||
|
if (((GdkWindowObject *) window)->window_type != GDK_WINDOW_TOPLEVEL &&
|
||||||
|
((GdkWindowObject *) window)->window_type != GDK_WINDOW_DIALOG)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((impl->hint_flags & GDK_HINT_MIN_SIZE) &&
|
||||||
|
(impl->hint_flags & GDK_HINT_MAX_SIZE) &&
|
||||||
|
impl->hints.min_width == impl->hints.max_width &&
|
||||||
|
impl->hints.min_height == impl->hints.max_height)
|
||||||
|
{
|
||||||
|
decoration = GDK_DECOR_ALL | GDK_DECOR_RESIZEH | GDK_DECOR_MAXIMIZE;
|
||||||
|
if (impl->type_hint == GDK_WINDOW_TYPE_HINT_DIALOG ||
|
||||||
|
impl->type_hint == GDK_WINDOW_TYPE_HINT_MENU ||
|
||||||
|
impl->type_hint == GDK_WINDOW_TYPE_HINT_TOOLBAR)
|
||||||
|
decoration |= GDK_DECOR_MINIMIZE;
|
||||||
|
else if (impl->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN)
|
||||||
|
decoration |= GDK_DECOR_MENU | GDK_DECOR_MINIMIZE;
|
||||||
|
|
||||||
|
gdk_window_set_decorations (window, decoration);
|
||||||
|
}
|
||||||
|
else if (impl->hint_flags & GDK_HINT_MAX_SIZE)
|
||||||
|
{
|
||||||
|
decoration = GDK_DECOR_ALL | GDK_DECOR_MAXIMIZE;
|
||||||
|
if (impl->type_hint == GDK_WINDOW_TYPE_HINT_DIALOG ||
|
||||||
|
impl->type_hint == GDK_WINDOW_TYPE_HINT_MENU ||
|
||||||
|
impl->type_hint == GDK_WINDOW_TYPE_HINT_TOOLBAR)
|
||||||
|
decoration |= GDK_DECOR_MINIMIZE;
|
||||||
|
gdk_window_set_decorations (window, decoration);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (impl->type_hint)
|
||||||
|
{
|
||||||
|
case GDK_WINDOW_TYPE_HINT_DIALOG:
|
||||||
|
gdk_window_set_decorations (window,
|
||||||
|
GDK_DECOR_ALL |
|
||||||
|
GDK_DECOR_MINIMIZE |
|
||||||
|
GDK_DECOR_MAXIMIZE);
|
||||||
|
break;
|
||||||
|
case GDK_WINDOW_TYPE_HINT_MENU:
|
||||||
|
gdk_window_set_decorations (window,
|
||||||
|
GDK_DECOR_ALL |
|
||||||
|
GDK_DECOR_RESIZEH |
|
||||||
|
GDK_DECOR_MINIMIZE |
|
||||||
|
GDK_DECOR_MAXIMIZE);
|
||||||
|
break;
|
||||||
|
case GDK_WINDOW_TYPE_HINT_TOOLBAR:
|
||||||
|
gdk_window_set_decorations (window,
|
||||||
|
GDK_DECOR_ALL |
|
||||||
|
GDK_DECOR_MINIMIZE |
|
||||||
|
GDK_DECOR_MAXIMIZE);
|
||||||
|
gdk_window_set_skip_taskbar_hint (window, TRUE);
|
||||||
|
break;
|
||||||
|
case GDK_WINDOW_TYPE_HINT_UTILITY:
|
||||||
|
break;
|
||||||
|
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
|
||||||
|
gdk_window_set_decorations (window,
|
||||||
|
GDK_DECOR_ALL |
|
||||||
|
GDK_DECOR_RESIZEH |
|
||||||
|
GDK_DECOR_MENU |
|
||||||
|
GDK_DECOR_MINIMIZE |
|
||||||
|
GDK_DECOR_MAXIMIZE);
|
||||||
|
break;
|
||||||
|
case GDK_WINDOW_TYPE_HINT_DOCK:
|
||||||
|
break;
|
||||||
|
case GDK_WINDOW_TYPE_HINT_DESKTOP:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* Fall thru */
|
||||||
|
case GDK_WINDOW_TYPE_HINT_NORMAL:
|
||||||
|
gdk_window_set_decorations (window, GDK_DECOR_ALL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gdk_window_set_geometry_hints (GdkWindow *window,
|
gdk_window_set_geometry_hints (GdkWindow *window,
|
||||||
GdkGeometry *geometry,
|
GdkGeometry *geometry,
|
||||||
@ -1625,23 +1708,6 @@ gdk_window_set_geometry_hints (GdkWindow *window,
|
|||||||
geometry->max_width, geometry->max_height));
|
geometry->max_width, geometry->max_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((geom_mask & GDK_HINT_MIN_SIZE) &&
|
|
||||||
(geom_mask & GDK_HINT_MAX_SIZE) &&
|
|
||||||
geometry->min_width == geometry->max_width &&
|
|
||||||
geometry->min_height == geometry->max_height)
|
|
||||||
gdk_window_set_decorations (window,
|
|
||||||
GDK_DECOR_ALL |
|
|
||||||
GDK_DECOR_RESIZEH |
|
|
||||||
GDK_DECOR_MAXIMIZE);
|
|
||||||
else if (geom_mask & GDK_HINT_MAX_SIZE)
|
|
||||||
{
|
|
||||||
gdk_window_set_decorations (window,
|
|
||||||
GDK_DECOR_ALL |
|
|
||||||
GDK_DECOR_MAXIMIZE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gdk_window_set_decorations (window, GDK_DECOR_ALL);
|
|
||||||
|
|
||||||
if (geom_mask & GDK_HINT_BASE_SIZE)
|
if (geom_mask & GDK_HINT_BASE_SIZE)
|
||||||
{
|
{
|
||||||
GDK_NOTE (MISC, g_print ("... BASE_SIZE: %dx%d\n",
|
GDK_NOTE (MISC, g_print ("... BASE_SIZE: %dx%d\n",
|
||||||
@ -1664,6 +1730,8 @@ gdk_window_set_geometry_hints (GdkWindow *window,
|
|||||||
{
|
{
|
||||||
GDK_NOTE (MISC, g_print ("... GRAVITY: %d\n", geometry->win_gravity));
|
GDK_NOTE (MISC, g_print ("... GRAVITY: %d\n", geometry->win_gravity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
decorate_based_on_hints (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -3162,42 +3230,9 @@ gdk_window_set_type_hint (GdkWindow *window,
|
|||||||
GDK_NOTE (MISC, g_print ("gdk_window_set_type_hint: %p: %d\n",
|
GDK_NOTE (MISC, g_print ("gdk_window_set_type_hint: %p: %d\n",
|
||||||
GDK_WINDOW_HWND (window), hint));
|
GDK_WINDOW_HWND (window), hint));
|
||||||
|
|
||||||
GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->type_hint = hint;
|
((GdkWindowImplWin32 *)((GdkWindowObject *)window)->impl)->type_hint = hint;
|
||||||
|
|
||||||
switch (hint)
|
decorate_based_on_hints (window);
|
||||||
{
|
|
||||||
case GDK_WINDOW_TYPE_HINT_DIALOG:
|
|
||||||
break;
|
|
||||||
case GDK_WINDOW_TYPE_HINT_MENU:
|
|
||||||
gdk_window_set_decorations (window,
|
|
||||||
GDK_DECOR_ALL |
|
|
||||||
GDK_DECOR_RESIZEH |
|
|
||||||
GDK_DECOR_MINIMIZE |
|
|
||||||
GDK_DECOR_MAXIMIZE);
|
|
||||||
break;
|
|
||||||
case GDK_WINDOW_TYPE_HINT_TOOLBAR:
|
|
||||||
gdk_window_set_skip_taskbar_hint (window, TRUE);
|
|
||||||
break;
|
|
||||||
case GDK_WINDOW_TYPE_HINT_UTILITY:
|
|
||||||
break;
|
|
||||||
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
|
|
||||||
gdk_window_set_decorations (window,
|
|
||||||
GDK_DECOR_ALL |
|
|
||||||
GDK_DECOR_RESIZEH |
|
|
||||||
GDK_DECOR_MENU |
|
|
||||||
GDK_DECOR_MINIMIZE |
|
|
||||||
GDK_DECOR_MAXIMIZE);
|
|
||||||
break;
|
|
||||||
case GDK_WINDOW_TYPE_HINT_DOCK:
|
|
||||||
break;
|
|
||||||
case GDK_WINDOW_TYPE_HINT_DESKTOP:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
g_warning ("Unknown hint %d passed to gdk_window_set_type_hint", hint);
|
|
||||||
/* Fall thru */
|
|
||||||
case GDK_WINDOW_TYPE_HINT_NORMAL:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkWindowTypeHint
|
GdkWindowTypeHint
|
||||||
|
Loading…
Reference in New Issue
Block a user