Exemplo n.º 1
0
void 
eng_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth EINA_UNUSED)
{
   ob->w = w;
   ob->h = h;
   ob->rot = rot;
   eng_window_use(ob);
   glsym_evas_gl_common_context_resize(ob->gl_context, w, h, rot);

   if (ob->win)
     {
        int aw, ah, dx = 0, dy = 0;

        if ((ob->rot == 90) || (ob->rot == 270))
          wl_egl_window_get_attached_size(ob->win, &ah, &aw);
        else
          wl_egl_window_get_attached_size(ob->win, &aw, &ah);

        if (ob->info->info.edges & 4) // resize from left
          {
             if ((ob->rot == 90) || (ob->rot == 270))
               dx = ah - h;
             else
               dx = aw - w;
          }

        if (ob->info->info.edges & 1) // resize from top
          {
             if ((ob->rot == 90) || (ob->rot == 270))
               dy = aw - w;
             else
               dy = ah - h;
          }

        if ((ob->rot == 90) || (ob->rot == 270))
          wl_egl_window_resize(ob->win, h, w, dx, dy);
        else
          wl_egl_window_resize(ob->win, w, h, dx, dy);
     }
}
Exemplo n.º 2
0
static void egl_resize_func(struct vo_wayland_state *wl,
                            uint32_t edges,
                            int32_t width,
                            int32_t height,
                            void *user_data)
{
    struct vo_wayland_window *w = wl->window;
    struct egl_context *ctx = user_data;
    int32_t minimum_size = 150;
    int32_t x, y;

    /* get the real window size of the window */
    wl_egl_window_get_attached_size(ctx->egl_window,
                                    &wl->window->width,
                                    &wl->window->height);

    if (width < minimum_size)
        width = minimum_size;
    if (height < minimum_size)
        height = minimum_size;

    /* if only the height is changed we have to calculate the width
     * in any other case we calculate the height */
    if (edges == WL_SHELL_SURFACE_RESIZE_BOTTOM ||
        edges == WL_SHELL_SURFACE_RESIZE_TOP)
        width = wl->vo->aspdat.asp * height;
    else
        height = (1 / wl->vo->aspdat.asp) * width;

    if (edges & WL_SHELL_SURFACE_RESIZE_LEFT)
        x = w->width - width;
    else
        x = 0;

    if (edges & WL_SHELL_SURFACE_RESIZE_TOP)
        y = w->height - height;
    else
        y = 0;

    wl_egl_window_resize(ctx->egl_window, width, height, x, y);

    w->width = width;
    w->height = height;

    /* set size for mplayer */
    wl->vo->dwidth = width;
    wl->vo->dheight = height;
}
Exemplo n.º 3
0
static void egl_resize(struct vo_wayland_state *wl)
{
    int32_t x = wl->window.sh_x;
    int32_t y = wl->window.sh_y;
    int32_t width = wl->window.sh_width;
    int32_t height = wl->window.sh_height;
    int32_t scale = 1;

    if (!wl->egl_context.egl_window)
        return;

    if (wl->display.current_output)
        scale = wl->display.current_output->scale;

    // get the real size of the window
    // this improves moving the window while resizing it
    wl_egl_window_get_attached_size(wl->egl_context.egl_window,
                                    &wl->window.width,
                                    &wl->window.height);

    MP_VERBOSE(wl, "resizing %dx%d -> %dx%d\n", wl->window.width,
                                                wl->window.height,
                                                width,
                                                height);

    if (x != 0)
        x = wl->window.width - width;

    if (y != 0)
        y = wl->window.height - height;

    wl_surface_set_buffer_scale(wl->window.video_surface, scale);
    wl_egl_window_resize(wl->egl_context.egl_window, scale*width, scale*height, x, y);

    wl->window.width = width;
    wl->window.height = height;

    /* set size for mplayer */
    wl->vo->dwidth  = scale*wl->window.width;
    wl->vo->dheight = scale*wl->window.height;

    wl->vo->want_redraw = true;
    wl->window.events = 0;
}
Exemplo n.º 4
0
void QWaylandEglWindow::redraw()
{
    createDecoration();
    QMargins margins = frameMargins();
    QSize sizeWithMargins = geometry().size() + QSize(margins.left() + margins.right(), margins.top() + margins.bottom());

    if (m_waylandEglWindow) {
        int current_width, current_height;
        wl_egl_window_get_attached_size(m_waylandEglWindow,&current_width,&current_height);
        if (current_width != sizeWithMargins.width() || current_height != sizeWithMargins.height()) {
            waitForFrameSync();
            wl_egl_window_resize(m_waylandEglWindow, sizeWithMargins.width(), sizeWithMargins.height(), mOffset.x(), mOffset.y());
            mOffset = QPoint();

            m_resize = true;
        }
    } else {
        m_waylandEglWindow = wl_egl_window_create(mSurface, sizeWithMargins.width(), sizeWithMargins.height());
    }
}
Exemplo n.º 5
0
static void
triangle_redraw_handler(struct widget *widget, void *data)
{
	struct triangle *tri = data;
	int w, h;

	wl_egl_window_get_attached_size(tri->egl_window, &w, &h);

	DBG("previous %dx%d, new %dx%d\n", w, h, tri->width, tri->height);

	/* If size is not changing, do not redraw ahead of time.
	 * That would risk blocking in eglSwapbuffers().
	 */
	if (w == tri->width && h == tri->height)
		return;

	if (tri->frame_cb) {
		wl_callback_destroy(tri->frame_cb);
		tri->frame_cb = NULL;
	}
	triangle_frame_callback(tri, NULL, tri->time);
}
Exemplo n.º 6
0
static void egl_resize(struct vo_wayland_state *wl,
                       struct egl_context *ctx)
{
    int32_t x = wl->window.sh_x;
    int32_t y = wl->window.sh_y;
    int32_t width = wl->window.sh_width;
    int32_t height = wl->window.sh_height;

    // get the real size of the window
    // this improves moving the window while resizing it
    wl_egl_window_get_attached_size(ctx->egl_window,
                                    &wl->window.width,
                                    &wl->window.height);

    MP_DBG(wl->vo, "resizing %dx%d -> %dx%d\n", wl->window.width,
                                                wl->window.height,
                                                width,
                                                height);

    if (x != 0)
        x = wl->window.width - width;

    if (y != 0)
        y = wl->window.height - height;

    wl_egl_window_resize(ctx->egl_window, width, height, x, y);

    wl->window.width = width;
    wl->window.height = height;

    /* set size for mplayer */
    wl->vo->dwidth = wl->window.width;
    wl->vo->dheight = wl->window.height;

    wl->vo->want_redraw = true;
    wl->window.events = 0;
}