示例#1
0
static void handle_view_destroyed(wlc_handle handle) {
	sway_log(L_DEBUG, "Destroying window %lu", handle);
	swayc_t *view = get_swayc_for_handle(handle, &root_container);

	switch (wlc_view_get_type(handle)) {
	// regular view created regularly
	case 0:
	case WLC_BIT_MODAL:
		if (view) {
			swayc_t *parent = destroy_view(view);
			arrange_windows(parent, -1, -1);
		}
		break;
	// takes keyboard focus
	case WLC_BIT_OVERRIDE_REDIRECT:
		locked_view_focus = false;
		break;
	// Takes container focus
	case WLC_BIT_OVERRIDE_REDIRECT|WLC_BIT_UNMANAGED:
		locked_container_focus = false;
	case WLC_BIT_POPUP:
		break;
	}
	set_focused_container(get_focused_view(&root_container));
}
示例#2
0
文件: handlers.c 项目: illblew/sway
static void handle_view_destroyed(wlc_handle handle) {
	sway_log(L_DEBUG, "Destroying window %lu", handle);
	swayc_t *view = get_swayc_for_handle(handle, &root_container);

	switch (wlc_view_get_type(handle)) {
	// regular view created regularly
	case 0:
	case WLC_BIT_MODAL:
	case WLC_BIT_POPUP:
		if (view) {
			swayc_t *parent = destroy_view(view);
			arrange_windows(parent, -1, -1);
		}
		break;
	// DMENU has this flag, and takes view_focus, but other things with this
	// flag dont
	case WLC_BIT_OVERRIDE_REDIRECT:
// 		locked_view_focus = false;
		break;
	case WLC_BIT_OVERRIDE_REDIRECT|WLC_BIT_UNMANAGED:
		locked_container_focus = false;
		break;
	}
	set_focused_container(get_focused_view(&root_container));
}
示例#3
0
文件: world_tree.c 项目: LADI/ladish
void world_tree_destroy_room_views(void)
{
  gint type;
  graph_view_handle view;
  GtkTreeIter iter;
  bool valid;

  if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(g_treestore), &iter))
  {
    return;
  }

loop:
  gtk_tree_model_get(GTK_TREE_MODEL(g_treestore), &iter, COL_TYPE, &type, COL_VIEW, &view, -1);
  if (type == entry_type_view && is_room_view(view))
  {
    //log_info("removing view for room %s", get_view_opath(view));
    valid = gtk_tree_store_remove(g_treestore, &iter);

    destroy_view(view);

    if (!valid)
    {
      /* no more entries */
      return;
    }

    goto loop;
  }

  if (gtk_tree_model_iter_next(GTK_TREE_MODEL(g_treestore), &iter))
  {
    goto loop;
  }
}
示例#4
0
int do_load_desktop (Desktop * d, char *filename)
{
    int f;
    if ((f = open (filename, O_RDONLY)) >= 0) {
	int i, x = 40, y = 40;
	char *sign;
	sign = strread (f);
	if (strcmp (sign, "stereo\n - saved desktop\n\n")) {
	    close (f);
	    Cerrordialogue (CMain, 20, 20, " Load Desktop ", \
		    " This is not a desktop file ");
	    free (sign);
	    return 1;
	}
	free (sign);
	for (i = 0; i < d->num_views; i++)
	    destroy_view (&(d->view[i]));
	clear (d, Desktop);
	read (f, d, sizeof (Desktop));
	destroy ((void *) &d->cal_points);
	d->cal_points = Cmalloc (d->num_cal_points * sizeof (Vec));
	read (f, d->cal_points, d->num_cal_points * sizeof (Vec));
	d->cal_file = strread (f);
	d->temp_dir = strread (f);
	d->image_dir = strread (f);
	if (d->num_views)
	    for (i = 0; i < d->num_views; i++) {
		char *v;
		v = strread (f);
		if (v) {
		    setup_view (d, v, x += 20, y += 20, i);
		    d->view[i].filename = v;
		}
	    }
	draw_markers (d);
	close (f);
	return 0;
    } else {
	Cerrordialogue (CMain, 20, 20, " Load Desktop ", \
			get_sys_error (" Error trying to save file. "));
    }
    return 1;
}
示例#5
0
static void handle_view_destroyed(wlc_handle handle) {
    sway_log(L_DEBUG, "Destroying window %u", (unsigned int)handle);

    // Properly handle unmanaged views
    uint32_t type = wlc_view_get_type(handle);
    if (type) {
        wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true);
        sway_log(L_DEBUG,"Unmanaged window of type %x was destroyed", type);
        if (type & WLC_BIT_UNMANAGED) {
            // We need to call focus_view() on focus_pointer because unmanaged windows
            // do not alter the focus structure of the container tree. This makes focus_pointer()
            // think that it doesn't need to do anything, so we manually focus the result.
            focus_view(focus_pointer());
            return;
        }

        if (type & WLC_BIT_OVERRIDE_REDIRECT) {
            override_redirect = false;
            focus_view(focus_pointer());
            return;
        }

        // WLC_BIT_POPUP doesn't need to be dealt with since it's
        // treated as a floating view.
    }

    swayc_t *view = get_swayc_for_handle(handle, &root_container);
    swayc_t *parent;
    swayc_t *focused = get_focused_container(&root_container);

    if (view) {
        parent = destroy_view(view);
        arrange_windows(parent, -1, -1);
    }
    if (!focused || focused == view) {
        focus_pointer();
    }
}