clients/scaler: migrate to wp_viewporter

Use wp_viewporter instead of wl_scaler and rename things accordingly.

Since interface versions were reset, there is no need to check the
interface version anymore, and the wl_scaler.set request disappeared.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
dev
Pekka Paalanen 9 years ago
parent 9c5a0d9b40
commit 7351100cd2
  1. 4
      Makefile.am
  2. 39
      clients/scaler.c

@ -569,6 +569,8 @@ nodist_libtoytoolkit_la_SOURCES = \
protocol/text-cursor-position-client-protocol.h \
protocol/scaler-protocol.c \
protocol/scaler-client-protocol.h \
protocol/viewporter-protocol.c \
protocol/viewporter-client-protocol.h \
protocol/xdg-shell-unstable-v5-protocol.c \
protocol/xdg-shell-unstable-v5-client-protocol.h \
protocol/ivi-application-protocol.c \
@ -774,6 +776,8 @@ BUILT_SOURCES += \
protocol/weston-desktop-shell-protocol.c \
protocol/scaler-client-protocol.h \
protocol/scaler-protocol.c \
protocol/viewporter-client-protocol.h \
protocol/viewporter-protocol.c \
protocol/presentation-time-protocol.c \
protocol/presentation-time-client-protocol.h \
protocol/fullscreen-shell-unstable-v1-protocol.c \

@ -32,7 +32,7 @@
#include <linux/input.h>
#include "window.h"
#include "scaler-client-protocol.h"
#include "viewporter-client-protocol.h"
#define BUFFER_SCALE 2
static const int BUFFER_WIDTH = 421 * BUFFER_SCALE;
@ -50,9 +50,8 @@ struct box {
struct widget *widget;
int width, height;
struct wl_scaler *scaler;
int scaler_version;
struct wl_viewport *viewport;
struct wp_viewporter *viewporter;
struct wp_viewport *viewport;
enum {
MODE_NO_VIEWPORT,
@ -84,33 +83,20 @@ set_my_viewport(struct box *box)
src_width = wl_fixed_from_double((RECT_W - 0.5) / BUFFER_SCALE);
src_height = wl_fixed_from_double((RECT_H - 0.5) / BUFFER_SCALE);
if (box->scaler_version < 2 && box->mode != MODE_SRC_DST) {
fprintf(stderr, "Error: server's wl_scaler interface version "
"%d does not support this mode.\n",
box->scaler_version);
exit(1);
}
switch (box->mode){
case MODE_SRC_ONLY:
wl_viewport_set_source(box->viewport, src_x, src_y,
wp_viewport_set_source(box->viewport, src_x, src_y,
src_width, src_height);
break;
case MODE_DST_ONLY:
wl_viewport_set_destination(box->viewport,
wp_viewport_set_destination(box->viewport,
dst_width, dst_height);
break;
case MODE_SRC_DST:
if (box->scaler_version < 2) {
wl_viewport_set(box->viewport,
src_x, src_y, src_width, src_height,
dst_width, dst_height);
} else {
wl_viewport_set_source(box->viewport, src_x, src_y,
wp_viewport_set_source(box->viewport, src_x, src_y,
src_width, src_height);
wl_viewport_set_destination(box->viewport,
wp_viewport_set_destination(box->viewport,
dst_width, dst_height);
}
break;
default:
assert(!"not reached");
@ -188,14 +174,11 @@ global_handler(struct display *display, uint32_t name,
{
struct box *box = data;
if (strcmp(interface, "wl_scaler") == 0) {
box->scaler_version = version < 2 ? version : 2;
box->scaler = display_bind(display, name,
&wl_scaler_interface,
box->scaler_version);
if (strcmp(interface, "wp_viewporter") == 0) {
box->viewporter = display_bind(display, name,
&wp_viewporter_interface, 1);
box->viewport = wl_scaler_get_viewport(box->scaler,
box->viewport = wp_viewporter_get_viewport(box->viewporter,
widget_get_wl_surface(box->widget));
set_my_viewport(box);

Loading…
Cancel
Save