---
 clients/window.c |   25 ++++++++++++++++++++++++-
 clients/window.h |    3 +++
 src/shell.c      |    9 ++++++++-
 3 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index d13a1ac..7093a38 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -220,6 +220,7 @@ struct window {
        int resize_needed;
        int type;
        int focus_count;
+       int minimized;
 
        int resizing;
        int fullscreen_method;
@@ -1925,7 +1926,7 @@ frame_button_button_handler(struct widget *widget,
                        display_exit(window->display);
                break;
        case FRAME_BUTTON_MINIMIZE:
-               fprintf(stderr,"Minimize stub\n");
+               window_set_minimized(window, !window->minimized);
                break;
        case FRAME_BUTTON_MAXIMIZE:
                window_set_maximized(window, window->type != TYPE_MAXIMIZED);
@@ -3326,11 +3327,17 @@ handle_unmaximize(void *data, struct wl_shell_surface 
*shell_surface)
 static void
 handle_minimize(void *data, struct wl_shell_surface *shell_surface)
 {
+       struct window *window = data;
+
+       window->minimized = 1;
 }
 
 static void
 handle_unminimize(void *data, struct wl_shell_surface *shell_surface)
 {
+       struct window *window = data;
+
+       window->minimized = 0;
 }
 
 static const struct wl_shell_surface_listener shell_surface_listener = {
@@ -3472,6 +3479,22 @@ window_set_maximized(struct window *window, int 
maximized)
 }
 
 void
+window_set_minimized(struct window *window, int minimized)
+{
+       if (!window->display->shell)
+               return;
+
+       if (window->minimized == minimized)
+               return;
+
+       if (minimized) {
+               wl_shell_surface_set_minimized(window->shell_surface);
+               window->minimized = 1;
+       } else
+               window->minimized = 0;
+}
+
+void
 window_set_user_data(struct window *window, void *data)
 {
        window->user_data = data;
diff --git a/clients/window.h b/clients/window.h
index c2946d8..331ce23 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -313,6 +313,9 @@ void
 window_set_maximized(struct window *window, int maximized);
 
 void
+window_set_minimized(struct window *window, int maximized);
+
+void
 window_set_user_data(struct window *window, void *data);
 
 void *
diff --git a/src/shell.c b/src/shell.c
index f3877d2..fd1411b 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1470,6 +1470,9 @@ shell_surface_minimize(struct shell_surface *shsurf)
        shsurf->saved_type = shsurf->type;
        shsurf->minimized = 1;
 
+       send_surface_data_focused_state(surface);
+       wl_shell_surface_send_minimize(&shsurf->resource);
+
        /* Focus next surface in stack */
        wl_list_for_each(seat, &compositor->seat_list, link)
                if (seat->seat.keyboard &&
@@ -1486,7 +1489,6 @@ shell_surface_minimize(struct shell_surface *shsurf)
                                wl_keyboard_set_focus(seat->seat.keyboard, 
NULL);
                }
 
-       send_surface_data_focused_state(surface);
        weston_compositor_damage_all(compositor);
 }
 
@@ -1506,6 +1508,7 @@ surface_unminimize(struct shell_surface *shsurf, struct 
workspace *ws)
        shell_surface_focus(shsurf);
        send_surface_data_focused_state(surface);
        shsurf->minimized = false;
+       wl_shell_surface_send_unminimize(&shsurf->resource);
        weston_compositor_damage_all(compositor);
 }
 
@@ -1947,6 +1950,10 @@ static void
 shell_surface_set_minimized(struct wl_client *client,
                            struct wl_resource *resource)
 {
+       struct shell_surface *shsurf = resource->data;
+
+       shell_surface_minimize(shsurf);
+       send_surface_data_minimized_state(shsurf->surface);
 }
 
 static void
-- 
1.7.10.4

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to