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>
This commit is contained in:
@@ -569,6 +569,8 @@ nodist_libtoytoolkit_la_SOURCES = \
|
|||||||
protocol/text-cursor-position-client-protocol.h \
|
protocol/text-cursor-position-client-protocol.h \
|
||||||
protocol/scaler-protocol.c \
|
protocol/scaler-protocol.c \
|
||||||
protocol/scaler-client-protocol.h \
|
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-protocol.c \
|
||||||
protocol/xdg-shell-unstable-v5-client-protocol.h \
|
protocol/xdg-shell-unstable-v5-client-protocol.h \
|
||||||
protocol/ivi-application-protocol.c \
|
protocol/ivi-application-protocol.c \
|
||||||
@@ -774,6 +776,8 @@ BUILT_SOURCES += \
|
|||||||
protocol/weston-desktop-shell-protocol.c \
|
protocol/weston-desktop-shell-protocol.c \
|
||||||
protocol/scaler-client-protocol.h \
|
protocol/scaler-client-protocol.h \
|
||||||
protocol/scaler-protocol.c \
|
protocol/scaler-protocol.c \
|
||||||
|
protocol/viewporter-client-protocol.h \
|
||||||
|
protocol/viewporter-protocol.c \
|
||||||
protocol/presentation-time-protocol.c \
|
protocol/presentation-time-protocol.c \
|
||||||
protocol/presentation-time-client-protocol.h \
|
protocol/presentation-time-client-protocol.h \
|
||||||
protocol/fullscreen-shell-unstable-v1-protocol.c \
|
protocol/fullscreen-shell-unstable-v1-protocol.c \
|
||||||
|
|||||||
+13
-30
@@ -32,7 +32,7 @@
|
|||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
|
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "scaler-client-protocol.h"
|
#include "viewporter-client-protocol.h"
|
||||||
|
|
||||||
#define BUFFER_SCALE 2
|
#define BUFFER_SCALE 2
|
||||||
static const int BUFFER_WIDTH = 421 * BUFFER_SCALE;
|
static const int BUFFER_WIDTH = 421 * BUFFER_SCALE;
|
||||||
@@ -50,9 +50,8 @@ struct box {
|
|||||||
struct widget *widget;
|
struct widget *widget;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
struct wl_scaler *scaler;
|
struct wp_viewporter *viewporter;
|
||||||
int scaler_version;
|
struct wp_viewport *viewport;
|
||||||
struct wl_viewport *viewport;
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MODE_NO_VIEWPORT,
|
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_width = wl_fixed_from_double((RECT_W - 0.5) / BUFFER_SCALE);
|
||||||
src_height = wl_fixed_from_double((RECT_H - 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){
|
switch (box->mode){
|
||||||
case MODE_SRC_ONLY:
|
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);
|
src_width, src_height);
|
||||||
break;
|
break;
|
||||||
case MODE_DST_ONLY:
|
case MODE_DST_ONLY:
|
||||||
wl_viewport_set_destination(box->viewport,
|
wp_viewport_set_destination(box->viewport,
|
||||||
dst_width, dst_height);
|
dst_width, dst_height);
|
||||||
break;
|
break;
|
||||||
case MODE_SRC_DST:
|
case MODE_SRC_DST:
|
||||||
if (box->scaler_version < 2) {
|
wp_viewport_set_source(box->viewport, src_x, src_y,
|
||||||
wl_viewport_set(box->viewport,
|
src_width, src_height);
|
||||||
src_x, src_y, src_width, src_height,
|
wp_viewport_set_destination(box->viewport,
|
||||||
dst_width, dst_height);
|
dst_width, dst_height);
|
||||||
} else {
|
|
||||||
wl_viewport_set_source(box->viewport, src_x, src_y,
|
|
||||||
src_width, src_height);
|
|
||||||
wl_viewport_set_destination(box->viewport,
|
|
||||||
dst_width, dst_height);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(!"not reached");
|
assert(!"not reached");
|
||||||
@@ -188,14 +174,11 @@ global_handler(struct display *display, uint32_t name,
|
|||||||
{
|
{
|
||||||
struct box *box = data;
|
struct box *box = data;
|
||||||
|
|
||||||
if (strcmp(interface, "wl_scaler") == 0) {
|
if (strcmp(interface, "wp_viewporter") == 0) {
|
||||||
box->scaler_version = version < 2 ? version : 2;
|
box->viewporter = display_bind(display, name,
|
||||||
|
&wp_viewporter_interface, 1);
|
||||||
|
|
||||||
box->scaler = display_bind(display, name,
|
box->viewport = wp_viewporter_get_viewport(box->viewporter,
|
||||||
&wl_scaler_interface,
|
|
||||||
box->scaler_version);
|
|
||||||
|
|
||||||
box->viewport = wl_scaler_get_viewport(box->scaler,
|
|
||||||
widget_get_wl_surface(box->widget));
|
widget_get_wl_surface(box->widget));
|
||||||
|
|
||||||
set_my_viewport(box);
|
set_my_viewport(box);
|
||||||
|
|||||||
Reference in New Issue
Block a user