summaryrefslogtreecommitdiff
path: root/clients/desktop-shell.c
diff options
context:
space:
mode:
authorXiong Zhang <xiong.y.zhang@intel.com>2013-10-23 13:58:35 +0800
committerKristian Høgsberg <krh@bitplanet.net>2013-10-23 22:36:37 -0700
commit83d8ee779e52c3ce7b3789f83ecaa096b926d40c (patch)
tree3bb3fe025ffc5cd9f3eb895f39aa306e9bb1915e /clients/desktop-shell.c
parent971165368d22b16f248e82b3d6f4f1f1eedb764e (diff)
downloadweston-83d8ee779e52c3ce7b3789f83ecaa096b926d40c.tar.gz
window, desktop-shell: deal with output unplug on client side
when output is removed, weston-desktop-shell should destroy panel and background surface on destroyed output. Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Diffstat (limited to 'clients/desktop-shell.c')
-rw-r--r--clients/desktop-shell.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index d864a658..4e7a815e 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -95,6 +95,7 @@ struct background {
struct output {
struct wl_output *output;
+ uint32_t server_output_id;
struct wl_list link;
struct panel *panel;
@@ -1213,6 +1214,7 @@ create_output(struct desktop *desktop, uint32_t id)
output->output =
display_bind(desktop->display, id, &wl_output_interface, 2);
+ output->server_output_id = id;
wl_output_add_listener(output->output, &output_listener, output);
@@ -1242,6 +1244,23 @@ global_handler(struct display *display, uint32_t id,
}
static void
+global_handler_remove(struct display *display, uint32_t id,
+ const char *interface, uint32_t version, void *data)
+{
+ struct desktop *desktop = data;
+ struct output *output;
+
+ if (!strcmp(interface, "wl_output")) {
+ wl_list_for_each(output, &desktop->outputs, link) {
+ if (output->server_output_id == id) {
+ output_destroy(output);
+ break;
+ }
+ }
+ }
+}
+
+static void
panel_add_launchers(struct panel *panel, struct desktop *desktop)
{
struct weston_config_section *s;
@@ -1298,6 +1317,7 @@ int main(int argc, char *argv[])
display_set_user_data(desktop.display, &desktop);
display_set_global_handler(desktop.display, global_handler);
+ display_set_global_handler_remove(desktop.display, global_handler_remove);
/* Create panel and background for outputs processed before the shell
* global interface was processed */