diff --git a/protocol/phosh-private.xml b/protocol/phosh-private.xml
index 4eede1e58be63ed20b7086ba74cf7bfe456713c2..0312267ce504e78bf671f1f8913b091b3604d886 100644
--- a/protocol/phosh-private.xml
+++ b/protocol/phosh-private.xml
@@ -1,5 +1,5 @@
-
+
Private protocol between phosh and the compositor.
@@ -23,8 +23,8 @@
-
-
+
+
The interface is meant to list xdg surfaces (see the xdg-shell
stable wayland protocol) and to raise these surfaces to the top
@@ -65,5 +65,13 @@
+
+
+
+
+
+
+
+
diff --git a/src/app.c b/src/app.c
index 0b0867b7bc74dd4f819053bb24471da543256b64..5e338fdd5fc6e1c8c203c13742d156e026cf4af6 100644
--- a/src/app.c
+++ b/src/app.c
@@ -24,6 +24,12 @@
// Icons actually sized according to the pixel-size set in the template
#define APP_ICON_SIZE -1
+enum {
+ APP_CLOSED,
+ N_SIGNALS
+};
+static guint signals[N_SIGNALS] = { 0 };
+
enum {
PROP_0,
PROP_APP_ID,
@@ -41,6 +47,7 @@ typedef struct
GtkWidget *icon;
GtkWidget *app_name;
GtkWidget *box;
+ GtkWidget *btn_close;
int win_width;
int win_height;
@@ -142,6 +149,18 @@ phosh_app_get_property (GObject *object,
}
}
+
+static void
+on_btn_close_clicked (PhoshApp *self, GtkButton *button)
+{
+ g_return_if_fail (PHOSH_IS_APP (self));
+ g_return_if_fail (GTK_IS_BUTTON (button));
+
+ g_signal_emit(self, signals[APP_CLOSED], 0);
+ gtk_widget_destroy (GTK_WIDGET (self));
+}
+
+
static void
phosh_app_constructed (GObject *object)
{
@@ -179,6 +198,11 @@ phosh_app_constructed (GObject *object)
APP_ICON_SIZE);
}
+ g_signal_connect_swapped (priv->btn_close,
+ "clicked",
+ (GCallback) on_btn_close_clicked,
+ self);
+
G_OBJECT_CLASS (phosh_app_parent_class)->constructed (object);
}
@@ -364,11 +388,16 @@ phosh_app_class_init (PhoshAppClass *klass)
g_object_class_install_properties (object_class, LAST_PROP, props);
+ signals[APP_CLOSED] = g_signal_new ("app-closed",
+ G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ NULL, G_TYPE_NONE, 0);
+
gtk_widget_class_set_template_from_resource (widget_class, "/sm/puri/phosh/ui/app.ui");
gtk_widget_class_bind_template_child_private (widget_class, PhoshApp, app_name);
gtk_widget_class_bind_template_child_private (widget_class, PhoshApp, icon);
gtk_widget_class_bind_template_child_private (widget_class, PhoshApp, box);
+ gtk_widget_class_bind_template_child_private (widget_class, PhoshApp, btn_close);
gtk_widget_class_set_css_name (widget_class, "phosh-app");
}
diff --git a/src/favorites.c b/src/favorites.c
index 5c57ff286fe381794f8f120e77c4a5c31de96c4b..916908878314193cd9a5802733c609c6eea17bca 100644
--- a/src/favorites.c
+++ b/src/favorites.c
@@ -26,6 +26,7 @@
enum {
APP_LAUNCHED,
APP_RAISED,
+ APP_CLOSED,
SELECTION_ABORTED,
N_SIGNALS
};
@@ -76,6 +77,26 @@ app_clicked_cb (GtkButton *btn, gpointer user_data)
}
+static void
+on_app_closed (PhoshFavorites *self, PhoshApp *app)
+{
+ PhoshFavoritesPrivate *priv;
+
+ g_return_if_fail (PHOSH_IS_FAVORITES (self));
+ g_return_if_fail (PHOSH_IS_APP (app));
+
+ priv = phosh_favorites_get_instance_private (self);
+ g_return_if_fail (priv->xdg_switcher);
+
+ g_debug("Will close %s (%s)",
+ phosh_app_get_app_id (app),
+ phosh_app_get_title (app));
+ phosh_private_xdg_switcher_close_xdg_surface (priv->xdg_switcher,
+ phosh_app_get_app_id (app),
+ phosh_app_get_title (app));
+ g_signal_emit(self, signals[APP_CLOSED], 0);
+}
+
static void
handle_xdg_switcher_xdg_surface (
@@ -108,6 +129,8 @@ handle_xdg_switcher_xdg_surface (
gtk_widget_show (app);
g_signal_connect (app, "clicked", G_CALLBACK (app_clicked_cb), self);
+ g_signal_connect_swapped (app, "app-closed", G_CALLBACK (on_app_closed), self);
+
gtk_widget_show (GTK_WIDGET (self));
}
@@ -344,6 +367,9 @@ phosh_favorites_class_init (PhoshFavoritesClass *klass)
signals[SELECTION_ABORTED] = g_signal_new ("selection-aborted",
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL,
NULL, G_TYPE_NONE, 0);
+ signals[SELECTION_ABORTED] = g_signal_new ("app-closed",
+ G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ NULL, G_TYPE_NONE, 0);
}
diff --git a/src/phosh-wayland.c b/src/phosh-wayland.c
index b062a99de56c5bbac75b0cd4b390984a47aba612..bc9315fdc1d92217549c48b4ba878cee43399481 100644
--- a/src/phosh-wayland.c
+++ b/src/phosh-wayland.c
@@ -68,7 +68,7 @@ registry_handle_global (void *data,
registry,
name,
&phosh_private_interface,
- 2);
+ 3);
} else if (!strcmp (interface, zwlr_layer_shell_v1_interface.name)) {
priv->layer_shell = wl_registry_bind (
registry,
diff --git a/src/style.css b/src/style.css
index ce4a3b81035d2ca5e73529f253073824137da78c..184a79fe02e479e9ddf62bdfd2ebf7800af9deb0 100644
--- a/src/style.css
+++ b/src/style.css
@@ -68,6 +68,14 @@ phosh-home, .phosh-panel {
color: white;
}
+.phosh-app-close-button {
+ border-radius: 50%;
+ min-width: 0;
+ min-height: 0;
+ margin: 12px;
+ padding: 12px;
+}
+
/* Overview (app switcher, favorites) */
.phosh-overview {
diff --git a/src/ui/app.ui b/src/ui/app.ui
index cce2c0c606c9ee3326116556ef456a4f1be7039b..4b4d9f95d7319df912583c8240dedcb32d1e9687 100644
--- a/src/ui/app.ui
+++ b/src/ui/app.ui
@@ -25,7 +25,6 @@
True
False
end
- horizontal
6
+
+ False
+ True
+ 0
+
+
+ False
+ True
+ 1
+
True
+
+
+
+ True
+ 1
+
+