Ejemplo n.º 1
0
void WaylandWindow::init()
{
//     mClient = WaylandClient::getInstance();
//     mSurface = AndroidRuntime::getWaylandClient()->surface();//wl_compositor_create_surface(mClient->getCompositor());
    mSurface = wl_compositor_create_surface(WaylandClient::getInstance().getCompositor());
//     mShellSurface = AndroidRuntime::getWaylandClient()->shellSurface();// wl_shell_get_shell_surface(mClient->getShell(), mSurface);
    mShellSurface = wl_shell_get_shell_surface(WaylandClient::getInstance().getShell(), mSurface);

    if (mShellSurface) {
        wl_shell_surface_add_listener(mShellSurface, &mShellSurfaceListener, this);
        wl_shell_surface_set_toplevel(mShellSurface);
    } else {
       ALOGW("wl_shell_get_shell_surface FAILED \n");
       return;
    }

    wl_surface_set_user_data(mSurface, this);
    wl_shell_surface_set_title(mShellSurface, "android");
    wl_surface_commit(mSurface);
    mNative = wl_egl_window_create(mSurface, mWidth, mHeight);
    if (mNative == NULL) {
        ALOGW("wl_egl_window_create FAILED \n");
        return;
    } else {
        ALOGW("wl_egl_window_create succeded, resulting in %p \n", mNative);
    }
}
Ejemplo n.º 2
0
static struct window *
create_window(struct display *display, int width, int height)
{
	struct window *window;

	window = calloc(1, sizeof *window);
	if (!window)
		return NULL;

	window->callback = NULL;
	window->display = display;
	window->width = width;
	window->height = height;
	window->surface = wl_compositor_create_surface(display->compositor);
	window->shell_surface = wl_shell_get_shell_surface(display->shell,
							   window->surface);

	if (window->shell_surface)
		wl_shell_surface_add_listener(window->shell_surface,
					      &shell_surface_listener, window);

	wl_shell_surface_set_title(window->shell_surface, "simple-shm");

	wl_shell_surface_set_toplevel(window->shell_surface);

	return window;
}
Ejemplo n.º 3
0
void UwacWindowSetTitle(UwacWindow* window, const char* name)
{
	if (window->xdg_surface)
		xdg_surface_set_title(window->xdg_surface, name);
	else if (window->shell_surface)
		wl_shell_surface_set_title(window->shell_surface, name);
}
Ejemplo n.º 4
0
void WaylandCore::createWindow( int width, int height, const char* title )
{
  if( mDisplay == NULL || mCompositor == NULL ) {
    return;
  }
  mWidth = width;
  mHeight = height;

  static wl_shell_surface_listener shell_surf_listeners = {
    shell_surface_handler_ping,
    shell_surface_handler_configure,
    shell_surface_handler_popup_done,
  };

  wl_surface* surface = wl_compositor_create_surface( mCompositor );
  wl_shell_surface* shell_surface = wl_shell_get_shell_surface( mShell, surface );
  wl_shell_surface_set_toplevel( shell_surface );
  wl_shell_surface_set_title( shell_surface, title );

  wl_shell_surface_add_listener( shell_surface, &shell_surf_listeners, this );

  mShellSurface = shell_surface;
  mSurface.surface = surface;
  
  mEglWindow = wl_egl_window_create( surface, mWidth, mHeight );
  mSurface.eglSurface = eglCreateWindowSurface( mEglDisplay, mEglConfig, mEglWindow, NULL );
  
  if( !eglMakeCurrent( mEglDisplay, mSurface.eglSurface, mSurface.eglSurface, mEglContext ) ) {
    fprintf( stderr, "MakeCurrent failed.\n" );
  }
}
Ejemplo n.º 5
0
static void
create_surface(struct window *window)
{
	struct display *display = window->display;
	EGLBoolean ret;
	
	window->surface = wl_compositor_create_surface(display->compositor);
	window->shell_surface = wl_shell_get_shell_surface(display->shell,
							   window->surface);

	wl_shell_surface_add_listener(window->shell_surface,
				      &shell_surface_listener, window);

	window->native =
		wl_egl_window_create(window->surface,
				     window->window_size.width,
				     window->window_size.height);
	window->egl_surface =
		eglCreateWindowSurface(display->egl.dpy,
				       display->egl.conf,
				       window->native, NULL);

	wl_shell_surface_set_title(window->shell_surface, "simple-egl");

	ret = eglMakeCurrent(window->display->egl.dpy, window->egl_surface,
			     window->egl_surface, window->display->egl.ctx);
	assert(ret == EGL_TRUE);

	if (!window->frame_sync)
		eglSwapInterval(display->egl.dpy, 0);

	set_fullscreen(window, window->fullscreen);
}
Ejemplo n.º 6
0
static GLFWbool createShellSurface(_GLFWwindow* window)
{
    window->wl.shellSurface = wl_shell_get_shell_surface(_glfw.wl.shell,
                                                         window->wl.surface);
    if (!window->wl.shellSurface)
        return GLFW_FALSE;

    wl_shell_surface_add_listener(window->wl.shellSurface,
                                  &shellSurfaceListener,
                                  window);

    if (window->wl.title)
        wl_shell_surface_set_title(window->wl.shellSurface, window->wl.title);

    if (window->monitor)
    {
        wl_shell_surface_set_fullscreen(
            window->wl.shellSurface,
            WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
            0,
            window->monitor->wl.output);
    }
    else if (window->wl.maximized)
    {
        wl_shell_surface_set_maximized(window->wl.shellSurface, NULL);
    }
    else
    {
        wl_shell_surface_set_toplevel(window->wl.shellSurface);
    }

    wl_surface_commit(window->wl.surface);

    return GLFW_TRUE;
}
static gboolean
create_surface (GstGLWindowWaylandEGL * window_egl)
{
  window_egl->window.surface =
      wl_compositor_create_surface (window_egl->display.compositor);
  window_egl->window.shell_surface =
      wl_shell_get_shell_surface (window_egl->display.shell,
      window_egl->window.surface);

  wl_shell_surface_add_listener (window_egl->window.shell_surface,
      &shell_surface_listener, window_egl);

  if (window_egl->window.window_width <= 0)
    window_egl->window.window_width = 320;
  if (window_egl->window.window_height <= 0)
    window_egl->window.window_height = 240;

  window_egl->window.native =
      wl_egl_window_create (window_egl->window.surface,
      window_egl->window.window_width, window_egl->window.window_height);

  wl_shell_surface_set_title (window_egl->window.shell_surface,
      "OpenGL Renderer");

  wl_shell_surface_set_toplevel (window_egl->window.shell_surface);

  return TRUE;
}
Ejemplo n.º 8
0
    void create_surface(struct display *display)
    {
      EGLBoolean ret;

      display->surface = wl_compositor_create_surface(display->compositor);
      display->shell_surface = wl_shell_get_shell_surface(display->shell,
                     display->surface);

      wl_shell_surface_add_listener(display->shell_surface,
                  &shell_surface_listener, display);

      display->native = wl_egl_window_create(display->surface, 1, 1);

      display->egl_surface =
        eglCreateWindowSurface((EGLDisplay) display->egl.dpy, display->egl.conf, (EGLNativeWindowType) display->native, NULL);

      wl_shell_surface_set_title(display->shell_surface, "projection");

      ret = eglMakeCurrent(display->egl.dpy, display->egl_surface,
               display->egl_surface, display->egl.ctx);
      assert(ret == EGL_TRUE);

      struct wl_callback *callback;

      display->configured = 0;

      wl_shell_surface_set_fullscreen(display->shell_surface,
        WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, NULL);

      callback = wl_display_sync(display->display);
      wl_callback_add_listener(callback, &configure_callback_listener, display);
    }
Ejemplo n.º 9
0
void Wayland_SetWindowTitle(_THIS, SDL_Window * window)
{
    SDL_WindowData *wind = window->driverdata;
    
    if (window->title != NULL) {
        wl_shell_surface_set_title(wind->shell_surface, window->title);
    }

    WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
}
Ejemplo n.º 10
0
static void gfx_ctx_wl_update_title(void *data, void *data2)
{
   gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
   char title[128];

   title[0] = '\0';

   video_driver_get_window_title(title, sizeof(title));

   if (wl && title[0])
      wl_shell_surface_set_title(wl->shell_surf, title);
}
Ejemplo n.º 11
0
static void gfx_ctx_wl_update_window_title(void *data)
{
   char buf[128]              = {0};
   char buf_fps[128]          = {0};
   settings_t *settings       = config_get_ptr();
   gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;

   if (video_monitor_get_fps(buf, sizeof(buf),  
            buf_fps, sizeof(buf_fps)))
      wl_shell_surface_set_title(wl->shell_surf, buf);

   if (settings->fps_show)
      runloop_msg_queue_push(buf_fps, 1, 1, false);
}
Ejemplo n.º 12
0
static void
_ecore_evas_wl_show(Ecore_Evas *ee)
{
    Evas_Engine_Info_Wayland_Egl *einfo;
    Ecore_Evas_Engine_Wl_Data *wdata;

    LOGFN(__FILE__, __LINE__, __FUNCTION__);

    if ((!ee) || (ee->visible)) return;

    wdata = ee->engine.data;
    if (wdata->win)
    {
        ecore_wl_window_show(wdata->win);
        ecore_wl_window_update_size(wdata->win, ee->w, ee->h);
        ecore_wl_window_buffer_attach(wdata->win, NULL, 0, 0);

        if ((ee->prop.clas) && (wdata->win->shell_surface))
            wl_shell_surface_set_class(wdata->win->shell_surface,
                                       ee->prop.clas);
        if ((ee->prop.title) && (wdata->win->shell_surface))
            wl_shell_surface_set_title(wdata->win->shell_surface,
                                       ee->prop.title);
    }

    if (wdata->frame)
    {
        evas_object_show(wdata->frame);
        evas_object_resize(wdata->frame, ee->w, ee->h);
    }

    if (wdata->win)
    {
        einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
        if (!einfo)
        {
            ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
            return;
        }

        einfo->info.surface = ecore_wl_window_surface_get(wdata->win);
        /* if (einfo->info.surface) */
        evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
        /* else */
        /*   printf("Failed to get a Surface from Ecore_Wl\n"); */
    }

    ee->visible = 1;
    if (ee->func.fn_show) ee->func.fn_show(ee);
}
Ejemplo n.º 13
0
static struct touch *
touch_create(int width, int height)
{
	struct touch *touch;

	touch = malloc(sizeof *touch);
	if (touch == NULL) {
		fprintf(stderr, "out of memory\n");
		exit(1);
	}
	touch->display = wl_display_connect(NULL);
	assert(touch->display);

	touch->has_argb = 0;
	touch->registry = wl_display_get_registry(touch->display);
	wl_registry_add_listener(touch->registry, &registry_listener, touch);
	wl_display_dispatch(touch->display);
	wl_display_roundtrip(touch->display);

	if (!touch->has_argb) {
		fprintf(stderr, "WL_SHM_FORMAT_ARGB32 not available\n");
		exit(1);
	}

	touch->width = width;
	touch->height = height;
	touch->surface = wl_compositor_create_surface(touch->compositor);
	touch->shell_surface = wl_shell_get_shell_surface(touch->shell,
							  touch->surface);
	create_shm_buffer(touch);

	if (touch->shell_surface) {
		wl_shell_surface_add_listener(touch->shell_surface,
					      &shell_surface_listener, touch);
		wl_shell_surface_set_toplevel(touch->shell_surface);
	}

	wl_surface_set_user_data(touch->surface, touch);
	wl_shell_surface_set_title(touch->shell_surface, "simple-touch");

	memset(touch->data, 64, width * height * 4);
	wl_surface_attach(touch->surface, touch->buffer, 0, 0);
	wl_surface_damage(touch->surface, 0, 0, width, height);
	wl_surface_commit(touch->surface);

	return touch;
}
Ejemplo n.º 14
0
void Wayland_SetWindowTitle(_THIS, SDL_Window * window)
{
    SDL_WindowData *wind = window->driverdata;
    SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
    
    if (window->title != NULL) {
        if (viddata->shell.xdg) {
            xdg_toplevel_set_title(wind->shell_surface.xdg.roleobj.toplevel, window->title);
        } else if (viddata->shell.zxdg) {
            zxdg_toplevel_v6_set_title(wind->shell_surface.zxdg.roleobj.toplevel, window->title);
        } else {
            wl_shell_surface_set_title(wind->shell_surface.wl, window->title);
        }
    }

    WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
}
Ejemplo n.º 15
0
static bool gfx_ctx_wl_set_video_mode(void *data,
      unsigned width, unsigned height,
      bool fullscreen)
{
   EGLint egl_attribs[16];
   EGLint *attr = NULL;
   gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;

   egl_install_sighandlers();

   attr = egl_fill_attribs(wl, egl_attribs);

   wl->width = width ? width : DEFAULT_WINDOWED_WIDTH;
   wl->height = height ? height : DEFAULT_WINDOWED_HEIGHT;

   wl->surface = wl_compositor_create_surface(wl->compositor);
   wl->win = wl_egl_window_create(wl->surface, wl->width, wl->height);
   wl->shell_surf = wl_shell_get_shell_surface(wl->shell, wl->surface);

   wl_shell_surface_add_listener(wl->shell_surf, &shell_surface_listener, NULL);
   wl_shell_surface_set_toplevel(wl->shell_surf);
   wl_shell_surface_set_class(wl->shell_surf, "RetroArch");
   wl_shell_surface_set_title(wl->shell_surf, "RetroArch");

   if (!egl_create_context(wl, (attr != egl_attribs) ? egl_attribs : NULL))
   {
      egl_report_error();
      goto error;
   }

   if (!egl_create_surface(wl, (EGLNativeWindowType)wl->win))
      goto error;

   egl_set_swap_interval(wl, wl->egl.interval);

   if (fullscreen)
      wl_shell_surface_set_fullscreen(wl->shell_surf, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, NULL);

   flush_wayland_fd(wl);
   return true;

error:
   gfx_ctx_wl_destroy(data);
   return false;
}
Ejemplo n.º 16
0
static struct cursor_surface *
cursor_viewer_show_cursor(struct cursor_viewer *viewer, const char *name)
{
    struct wl_cursor_image *cursor_image;
    struct wl_buffer *cursor_buffer = NULL;

    struct cursor_surface *cursor = calloc(1, sizeof (struct cursor_surface));
    if (!cursor)
        die("Cannot allocate memory for cursor_surface\n");

    cursor->name = name;
    cursor->surface = wl_compositor_create_surface(viewer->compositor);
    cursor->shsurf = wl_shell_get_shell_surface(viewer->shell, cursor->surface);

    wl_shell_surface_add_listener(cursor->shsurf, &shsurf_listener, viewer);
    wl_shell_surface_set_toplevel(cursor->shsurf);
    wl_shell_surface_set_title(cursor->shsurf, name);
    wl_surface_set_user_data(cursor->surface, viewer);

    cursor->cursor = wl_cursor_theme_get_cursor(viewer->cursor_theme, name);
    if (!cursor->cursor || cursor->cursor->image_count < 1) {
        printf("No such cursor: %s\n", name);
        cursor_surface_destroy(cursor);
        return NULL;
    }

    cursor_image = cursor->cursor->images[0];
    cursor_buffer = wl_cursor_image_get_buffer(cursor_image);

    printf("%s: %s: size=%dx%d image_count=%u\n",
        __func__, cursor->name,
        cursor_image->width, cursor_image->height,
        cursor->cursor->image_count);

    if (cursor->cursor->image_count > 1) {
        cursor->frame = wl_surface_frame(cursor->surface);
        wl_callback_add_listener(cursor->frame, &frame_listener, cursor);
    }

    wl_surface_attach(cursor->surface, cursor_buffer, 0, 0);
    wl_surface_damage(cursor->surface, 0, 0, cursor_image->width, cursor_image->height);
    wl_surface_commit(cursor->surface);

    return cursor;
}
Ejemplo n.º 17
0
bool
NativeStateWayland::create_window(WindowProperties const& properties)
{
    struct my_output *output = 0;
    if (!display_->outputs.empty()) output = display_->outputs.at(0);
    window_ = new struct my_window();
    window_->properties = properties;
    window_->surface = wl_compositor_create_surface(display_->compositor);
    if (window_->properties.fullscreen && output) {
        window_->native = wl_egl_window_create(window_->surface,
                                               output->width, output->height);
        window_->properties.width = output->width;
        window_->properties.height = output->height;
    } else {
        window_->native = wl_egl_window_create(window_->surface,
                                               properties.width, properties.height);
    }

    window_->opaque_reqion = wl_compositor_create_region(display_->compositor);
    wl_region_add(window_->opaque_reqion, 0, 0,
                  window_->properties.width,
                  window_->properties.height);
    wl_surface_set_opaque_region(window_->surface, window_->opaque_reqion);

    window_->shell_surface = wl_shell_get_shell_surface(display_->shell,
                                                        window_->surface);

    if (window_->shell_surface) {
        wl_shell_surface_add_listener(window_->shell_surface,
                                      &shell_surface_listener_, this);
    }

    wl_shell_surface_set_title(window_->shell_surface, "glmark2");

    if (window_->properties.fullscreen) {
        wl_shell_surface_set_fullscreen(window_->shell_surface,
                                        WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER,
                                        output->refresh, output->output);
    } else {
        wl_shell_surface_set_toplevel(window_->shell_surface);
    }

    return true;
}
Ejemplo n.º 18
0
BOOL wl_post_connect(freerdp* instance)
{
	struct window* window;
	struct wl_context* context;

	context = (struct wl_context*) instance->context;

	window = malloc(sizeof(*window));
	window->width = instance->settings->DesktopWidth;
	window->height = instance->settings->DesktopHeight;
	window->buffers[0].busy = 0;
	window->buffers[1].busy = 0;
	window->callback = NULL;
	window->display = context->display;
	window->surface = wl_compositor_create_surface(window->display->compositor);
	window->shell_surface = wl_shell_get_shell_surface(window->display->shell, window->surface);

	wl_shell_surface_add_listener(window->shell_surface, &wl_shell_surface_listener, NULL);
	wl_shell_surface_set_title(window->shell_surface, "FreeRDP");
	wl_shell_surface_set_toplevel(window->shell_surface);
	wl_surface_damage(window->surface, 0, 0, window->width, window->height);

	 /* GC/GDI logic here */
	rdpGdi* gdi;

	gdi_init(instance, CLRCONV_ALPHA | CLRCONV_INVERT | CLRBUF_32BPP, NULL);
	gdi = instance->context->gdi;

	 /* fill buffer with first image here */
	window->data = malloc (gdi->width * gdi->height *4);
	memcpy(window->data, (void*) gdi->primary_buffer, gdi->width * gdi->height * 4);
	instance->update->BeginPaint = wl_begin_paint;
	instance->update->EndPaint = wl_end_paint;

	 /* put Wayland data in the context here */
	context->window = window;

	freerdp_channels_post_connect(instance->context->channels, instance);

	window_redraw(window, NULL, 0);

	return TRUE;
}
Ejemplo n.º 19
0
/*
 * Set the current window's title
 */
void fgPlatformGlutSetWindowTitle( const char* title )
{
    SFG_Window* win = fgStructure.CurrentWindow;
    wl_shell_surface_set_title( win->Window.pContext.shsurface, title );
}
void
GHOST_WindowWayland::setTitle(const STR_String& title)
{
	m_title = title.ReadPtr();
	wl_shell_surface_set_title(m_shell_surface, m_title.c_str());
}
static void
create_surfaces (GstGLWindowWaylandEGL * window_egl)
{
  GstGLDisplayWayland *display =
      GST_GL_DISPLAY_WAYLAND (GST_GL_WINDOW (window_egl)->display);
  gint width, height;

  if (!window_egl->window.surface) {
    window_egl->window.surface =
        wl_compositor_create_surface (display->compositor);
    if (window_egl->window.queue)
      wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.surface,
          window_egl->window.queue);
  }

  if (window_egl->window.foreign_surface) {
    /* (re)parent */
    if (!display->subcompositor) {
      GST_ERROR_OBJECT (window_egl,
          "Wayland server does not support subsurfaces");
      window_egl->window.foreign_surface = NULL;
      goto shell_window;
    }

    if (!window_egl->window.subsurface) {
      window_egl->window.subsurface =
          wl_subcompositor_get_subsurface (display->subcompositor,
          window_egl->window.surface, window_egl->window.foreign_surface);
      if (window_egl->window.queue)
        wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.subsurface,
            window_egl->window.queue);

      wl_subsurface_set_position (window_egl->window.subsurface,
          window_egl->window.window_x, window_egl->window.window_y);
      wl_subsurface_set_desync (window_egl->window.subsurface);
    }
  } else {
  shell_window:
    if (!window_egl->window.shell_surface) {
      window_egl->window.shell_surface =
          wl_shell_get_shell_surface (display->shell,
          window_egl->window.surface);
      if (window_egl->window.queue)
        wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.
            shell_surface, window_egl->window.queue);

      wl_shell_surface_add_listener (window_egl->window.shell_surface,
          &shell_surface_listener, window_egl);

      wl_shell_surface_set_title (window_egl->window.shell_surface,
          "OpenGL Renderer");
      wl_shell_surface_set_toplevel (window_egl->window.shell_surface);
    }
  }

  if (window_egl->window.window_width > 0)
    width = window_egl->window.window_width;
  else
    width = 320;
  window_egl->window.window_width = width;

  if (window_egl->window.window_height > 0)
    height = window_egl->window.window_height;
  else
    height = 240;
  window_egl->window.window_height = height;

  if (!window_egl->window.native) {
    gst_gl_window_resize (GST_GL_WINDOW (window_egl), width, height);

    window_egl->window.native =
        wl_egl_window_create (window_egl->window.surface, width, height);
    if (window_egl->window.queue)
      wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.native,
          window_egl->window.queue);
  }
}
Ejemplo n.º 22
0
/**
 * Creates a Wayland shell surface.
 */
static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
{
    if (cfg->type != VOUT_WINDOW_TYPE_INVALID
     && cfg->type != VOUT_WINDOW_TYPE_WAYLAND)
        return VLC_EGENERIC;

    vout_window_sys_t *sys = malloc(sizeof (*sys));
    if (unlikely(sys == NULL))
        return VLC_ENOMEM;

    sys->compositor = NULL;
    sys->output = NULL;
    sys->shell = NULL;
    sys->shell_surface = NULL;
    sys->top_width = cfg->width;
    sys->top_height = cfg->height;
    sys->fs_width = cfg->width;
    sys->fs_height = cfg->height;
    sys->fullscreen = false;
    vlc_mutex_init(&sys->lock);
    wnd->sys = sys;

    /* Connect to the display server */
    char *dpy_name = var_InheritString(wnd, "wl-display");
    struct wl_display *display = wl_display_connect(dpy_name);

    free(dpy_name);

    if (display == NULL)
    {
        vlc_mutex_destroy(&sys->lock);
        free(sys);
        return VLC_EGENERIC;
    }

    /* Find the interesting singleton(s) */
    struct wl_registry *registry = wl_display_get_registry(display);
    if (registry == NULL)
        goto error;

    wl_registry_add_listener(registry, &registry_cbs, wnd);
    wl_display_roundtrip(display);
    wl_registry_destroy(registry);

    if (sys->compositor == NULL || sys->shell == NULL)
        goto error;

    if (sys->output != NULL)
        wl_output_add_listener(sys->output, &output_cbs, wnd);

    /* Create a surface */
    struct wl_surface *surface = wl_compositor_create_surface(sys->compositor);
    if (surface == NULL)
        goto error;

    struct wl_shell_surface *shell_surface =
        wl_shell_get_shell_surface(sys->shell, surface);
    if (shell_surface == NULL)
        goto error;

    sys->shell_surface = shell_surface;

    wl_shell_surface_add_listener(shell_surface, &shell_surface_cbs, wnd);
    wl_shell_surface_set_class(shell_surface, PACKAGE_NAME);
    wl_shell_surface_set_toplevel(shell_surface);

    char *title = var_InheritString(wnd, "video-title");
    wl_shell_surface_set_title(shell_surface, title ? title
                                                    : _("VLC media player"));
    free(title);

    //if (var_InheritBool (wnd, "keyboard-events"))
    //    do_something();

    wl_display_flush(display);

    wnd->type = VOUT_WINDOW_TYPE_WAYLAND;
    wnd->handle.wl = surface;
    wnd->display.wl = display;
    wnd->control = Control;

    if (vlc_clone (&sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW))
        goto error;

    vout_window_ReportSize(wnd, cfg->width, cfg->height);
    return VLC_SUCCESS;

error:
    if (sys->shell_surface != NULL)
        wl_shell_surface_destroy(sys->shell_surface);
    if (sys->shell != NULL)
        wl_shell_destroy(sys->shell);
    if (sys->output != NULL)
        wl_output_destroy(sys->output);
    if (sys->compositor != NULL)
        wl_compositor_destroy(sys->compositor);
    wl_display_disconnect(display);
    vlc_mutex_destroy(&sys->lock);
    free(sys);
    return VLC_EGENERIC;
}
Ejemplo n.º 23
0
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
{
    wl_shell_surface_set_title(window->wl.shell_surface, title);
}
Ejemplo n.º 24
0
void cWaylandInterface::UpdateFPSDisplay(const char *text)
{
	wl_shell_surface_set_title(GLWin.wl_shell_surface, text);
}
Ejemplo n.º 25
0
	void XdevLWindowWayland::setTitle(const XdevLWindowTitle& title) {
		XdevLWindowImpl::setTitle(title);
		wl_shell_surface_set_title(m_shellSurface, title.toString().c_str());
	}
Ejemplo n.º 26
0
static bool gfx_ctx_wl_set_video_mode(void *data,
      video_frame_info_t *video_info,
      unsigned width, unsigned height,
      bool fullscreen)
{
#ifdef HAVE_EGL
   EGLint egl_attribs[16];
   EGLint *attr              = egl_fill_attribs(
         (gfx_ctx_wayland_data_t*)data, egl_attribs);
#endif
   gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;

   wl->width                  = width  ? width  : DEFAULT_WINDOWED_WIDTH;
   wl->height                 = height ? height : DEFAULT_WINDOWED_HEIGHT;

   wl->surface                = wl_compositor_create_surface(wl->compositor);

   wl_surface_set_buffer_scale(wl->surface, wl->buffer_scale);

   switch (wl_api)
   {
      case GFX_CTX_OPENGL_API:
      case GFX_CTX_OPENGL_ES_API:
      case GFX_CTX_OPENVG_API:
#ifdef HAVE_EGL
         wl->win        = wl_egl_window_create(wl->surface, wl->width, wl->height);
#endif
         break;
      case GFX_CTX_NONE:
      default:
         break;
   }
   wl->shell_surf = wl_shell_get_shell_surface(wl->shell, wl->surface);

   wl_shell_surface_add_listener(wl->shell_surf, &shell_surface_listener, wl);
   wl_shell_surface_set_toplevel(wl->shell_surf);
   wl_shell_surface_set_class(wl->shell_surf, "RetroArch");
   wl_shell_surface_set_title(wl->shell_surf, "RetroArch");

   switch (wl_api)
   {
      case GFX_CTX_OPENGL_API:
      case GFX_CTX_OPENGL_ES_API:
      case GFX_CTX_OPENVG_API:
#ifdef HAVE_EGL

         if (!egl_create_context(&wl->egl, (attr != egl_attribs) ? egl_attribs : NULL))
         {
            egl_report_error();
            goto error;
         }

         if (!egl_create_surface(&wl->egl, (EGLNativeWindowType)wl->win))
            goto error;
         egl_set_swap_interval(&wl->egl, wl->egl.interval);
#endif
         break;
      case GFX_CTX_NONE:
      default:
         break;
   }

   if (fullscreen)
      wl_shell_surface_set_fullscreen(wl->shell_surf,
            WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, NULL);

   flush_wayland_fd(&wl->input);

   switch (wl_api)
   {
      case GFX_CTX_VULKAN_API:
         wl_display_roundtrip(wl->input.dpy);

#ifdef HAVE_VULKAN
         if (!vulkan_surface_create(&wl->vk, VULKAN_WSI_WAYLAND,
                  wl->input.dpy, wl->surface, 
                  wl->width, wl->height, wl->swap_interval))
            goto error;
#endif
         break;
      case GFX_CTX_NONE:
      default:
         break;
   }

   if (fullscreen)
   {
      wl->cursor.visible = false;
      gfx_ctx_wl_show_mouse(wl, false);
   }
   else
      wl->cursor.visible = true;

   return true;

error:
   gfx_ctx_wl_destroy(data);
   return false;
}
Ejemplo n.º 27
0
void wlf_SetWindowText(wlfContext* wlfc, wlfWindow* window, char* name)
{
	wl_shell_surface_set_title(window->shell_surface, name);
}
Ejemplo n.º 28
0
void cWaylandInterface::UpdateFPSDisplay(const std::string& text)
{
	wl_shell_surface_set_title(GLWin.wl_shell_surface, text.c_str());
}
Ejemplo n.º 29
0
void fgPlatformOpenWindow( SFG_Window* window, const char* title,
                           GLboolean positionUse, int x, int y,
                           GLboolean sizeUse, int w, int h,
                           GLboolean gameMode, GLboolean isSubWindow )
{
    /* Save the display mode if we are creating a menu window */
    if( window->IsMenu && ( ! fgStructure.MenuContext ) )
        fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB ;

    fghChooseConfig( &window->Window.pContext.egl.Config );

    if( ! window->Window.pContext.egl.Config )
    {
        /*
         * The "fghChooseConfig" returned a null meaning that the visual
         * context is not available.
         * Try a couple of variations to see if they will work.
         */
        if( fgState.DisplayMode & GLUT_MULTISAMPLE )
        {
            fgState.DisplayMode &= ~GLUT_MULTISAMPLE ;
            fghChooseConfig( &window->Window.pContext.egl.Config );
            fgState.DisplayMode |= GLUT_MULTISAMPLE;
        }
    }

    FREEGLUT_INTERNAL_ERROR_EXIT( window->Window.pContext.egl.Config != NULL,
                                  "EGL configuration with necessary capabilities "
                                  "not found", "fgOpenWindow" );

    if( ! positionUse )
        x = y = -1; /* default window position */
    if( ! sizeUse )
        w = h = 300; /* default window size */

    /*  Create the cursor  */
   window->Window.pContext.cursor = wl_cursor_theme_get_cursor(
                                      fgDisplay.pDisplay.cursor_theme,
                                      "left_ptr" ); 
   window->Window.pContext.cursor_surface = wl_compositor_create_surface(
                                              fgDisplay.pDisplay.compositor );

    /*  Create the main surface  */
    window->Window.pContext.surface = wl_compositor_create_surface(
                                        fgDisplay.pDisplay.compositor );

    /*  Create the shell surface with respects to the parent/child tree  */
    window->Window.pContext.shsurface = wl_shell_get_shell_surface(
                                          fgDisplay.pDisplay.shell,
                                           window->Window.pContext.surface );
    wl_shell_surface_add_listener( window->Window.pContext.shsurface,
                                   &fghShSurfaceListener, window );

    if( title)
      wl_shell_surface_set_title( window->Window.pContext.shsurface, title );

    if( gameMode )
    {
        window->State.IsFullscreen = GL_TRUE;
        wl_shell_surface_set_fullscreen( window->Window.pContext.shsurface,
                                         WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
                                         0, NULL );
    }
    else if( !isSubWindow && !window->IsMenu )
    {
        wl_shell_surface_set_toplevel( window->Window.pContext.shsurface );
    }
    else
    {
        wl_shell_surface_set_transient( window->Window.pContext.shsurface,
                                        window->Parent->Window.pContext.surface,
                                        x, y, 0 );
    }

    /*  Create the Wl_EGL_Window  */
    window->Window.Context = fghCreateNewContext( window );
    window->Window.pContext.egl_window = wl_egl_window_create( 
                                           window->Window.pContext.surface,
                                           w, h);
    window->Window.pContext.egl.Surface = eglCreateWindowSurface( 
                              fgDisplay.pDisplay.egl.Display,
                              window->Window.pContext.egl.Config,
                              (EGLNativeWindowType)window->Window.pContext.egl_window,
                              NULL );
    eglMakeCurrent( fgDisplay.pDisplay.egl.Display, window->Window.pContext.egl.Surface,
                    window->Window.pContext.egl.Surface, window->Window.Context );

   window->Window.pContext.pointer_button_pressed = GL_FALSE;
}