diff options
author | Tor Lillqvist <tml@novell.com> | 2005-11-27 02:58:09 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2005-11-27 02:58:09 +0000 |
commit | 3ff34d06e84c1a68d09a9d7ee31abc164024547f (patch) | |
tree | 1b76db2370f15cf66c4beb9969794ff0217b41cf | |
parent | 575149342be3510c79ce76f67f629dfa930fff0e (diff) | |
download | gdk-pixbuf-3ff34d06e84c1a68d09a9d7ee31abc164024547f.tar.gz |
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().
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 19 | ||||
-rw-r--r-- | gdk/win32/gdkwindow-win32.c | 139 |
3 files changed, 121 insertions, 56 deletions
@@ -1,8 +1,23 @@ 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. (#322516) - (gdk_window_set_geometry_hints): Adjust call correspondingly. + 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(). 2005-11-25 Dom Lachowicz <cinamod@hotmail.com> diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 6a61448aa..55b9a9036 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,8 +1,23 @@ 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. (#322516) - (gdk_window_set_geometry_hints): Adjust call correspondingly. + 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(). 2005-11-25 Dom Lachowicz <cinamod@hotmail.com> diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 19c4060d3..799ab6837 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -1590,6 +1590,89 @@ gdk_window_set_urgency_hint (GdkWindow *window, #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 gdk_window_set_geometry_hints (GdkWindow *window, GdkGeometry *geometry, @@ -1625,23 +1708,6 @@ gdk_window_set_geometry_hints (GdkWindow *window, 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) { 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)); } + + decorate_based_on_hints (window); } 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_WINDOW_HWND (window), hint)); - GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->type_hint = hint; + ((GdkWindowImplWin32 *)((GdkWindowObject *)window)->impl)->type_hint = hint; - switch (hint) - { - 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; - } + decorate_based_on_hints (window); } GdkWindowTypeHint |