示例#1
0
static void
meta_wayland_wl_shell_surface_popup_done (MetaWaylandPopupSurface *popup_surface)
{
  MetaWaylandWlShellSurface *wl_shell_surface =
    META_WAYLAND_WL_SHELL_SURFACE (popup_surface);

  wl_shell_surface_send_popup_done (wl_shell_surface->resource);
}
示例#2
0
static void
meta_wayland_wl_shell_surface_create_popup (MetaWaylandWlShellSurface *wl_shell_surface)
{
  MetaWaylandPopupSurface *popup_surface =
    META_WAYLAND_POPUP_SURFACE (wl_shell_surface);
  MetaWaylandSeat *seat = wl_shell_surface->popup_seat;
  MetaWaylandPopup *popup;

  popup = meta_wayland_pointer_start_popup_grab (seat->pointer, popup_surface);
  if (!popup)
    {
      wl_shell_surface_send_popup_done (wl_shell_surface->resource);
      return;
    }

  wl_shell_surface->popup = popup;
}
示例#3
0
static void
wl_shell_surface_set_popup (struct wl_client   *client,
                            struct wl_resource *resource,
                            struct wl_resource *seat_resource,
                            uint32_t            serial,
                            struct wl_resource *parent_resource,
                            int32_t             x,
                            int32_t             y,
                            uint32_t            flags)
{
  MetaWaylandWlShellSurface *wl_shell_surface =
    META_WAYLAND_WL_SHELL_SURFACE (wl_resource_get_user_data (resource));
  MetaWaylandSurface *surface =
    surface_from_wl_shell_surface_resource (resource);
  MetaWaylandSurface *parent_surf = wl_resource_get_user_data (parent_resource);
  MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);

  if (wl_shell_surface->popup)
    {
      wl_shell_surface->parent_surface = NULL;

      meta_wayland_popup_dismiss (wl_shell_surface->popup);
    }

  wl_shell_surface_set_state (surface,
                              META_WL_SHELL_SURFACE_STATE_POPUP);

  if (!meta_wayland_seat_can_popup (seat, serial))
    {
      wl_shell_surface_send_popup_done (resource);
      return;
    }

  set_wl_shell_surface_parent (surface, parent_surf);
  wl_shell_surface->popup_seat = seat;
  wl_shell_surface->x = x;
  wl_shell_surface->y = y;
  wl_shell_surface->pending_popup = TRUE;

  if (surface->window && parent_surf->window)
    sync_wl_shell_parent_relationship (surface, parent_surf);
}
示例#4
0
文件: view.c 项目: Hummer12007/wlc
void
wlc_view_close_ptr(struct wlc_view *view)
{
   if (!view)
      return;

   struct wl_resource *r;
   if (view->xdg_surface && (r = wl_resource_from_wlc_resource(view->xdg_surface, "xdg-surface"))) {
      xdg_surface_send_close(r);
   } else if (is_x11_view(view)) {
      wlc_x11_window_close(&view->x11);
   } else if (view->xdg_popup && (r = wl_resource_from_wlc_resource(view->xdg_popup, "xdg-popup"))) {
      xdg_popup_send_popup_done(r);
   } else if (view->shell_surface && (r = wl_resource_from_wlc_resource(view->shell_surface, "shell-surface"))) {
      if (view->type & WLC_BIT_POPUP) {
         wl_shell_surface_send_popup_done(r);
      } else {
         struct wl_client *client = wl_resource_get_client(r);
         wlc_resource_release(view->shell_surface);
         wl_client_destroy(client);
      }
   }
}