forked from 12to11/12to11
Implement wl_output version 4
* 12to11.man: * README: Update documentation. * output.c (struct _Output): Rearrange structure for alignment. (HandleBind): Send output name if necessary. (CompareOutputs): Handle name changes separately. (MakeGlobal): Support version 4 or later. (SendUpdates): Handle name changes separately.
This commit is contained in:
parent
d4df421f8b
commit
69e0902cfc
3 changed files with 27 additions and 12 deletions
|
@ -260,7 +260,7 @@ following Wayland interfaces:
|
||||||
lb lb
|
lb lb
|
||||||
lb n .
|
lb n .
|
||||||
Protocol Version
|
Protocol Version
|
||||||
wl_output 2
|
wl_output 4
|
||||||
wl_compositor 5
|
wl_compositor 5
|
||||||
wl_shm 1
|
wl_shm 1
|
||||||
xdg_wm_base 5
|
xdg_wm_base 5
|
||||||
|
|
2
README
2
README
|
@ -52,7 +52,7 @@ the "renderer" resource (class "Renderer") to "egl".
|
||||||
The following Wayland protocols are implemented to a more-or-less
|
The following Wayland protocols are implemented to a more-or-less
|
||||||
complete degree:
|
complete degree:
|
||||||
|
|
||||||
'wl_output', version: 2
|
'wl_output', version: 4
|
||||||
'wl_compositor', version: 5
|
'wl_compositor', version: 5
|
||||||
'wl_shm', version: 1
|
'wl_shm', version: 1
|
||||||
'xdg_wm_base', version: 5
|
'xdg_wm_base', version: 5
|
||||||
|
|
35
output.c
35
output.c
|
@ -39,9 +39,6 @@ struct _Output
|
||||||
/* The output ID of this output. */
|
/* The output ID of this output. */
|
||||||
RROutput output;
|
RROutput output;
|
||||||
|
|
||||||
/* Physical height of this output. */
|
|
||||||
unsigned int mm_width, mm_height;
|
|
||||||
|
|
||||||
/* List of display modes. */
|
/* List of display modes. */
|
||||||
XLList *modes;
|
XLList *modes;
|
||||||
|
|
||||||
|
@ -51,15 +48,18 @@ struct _Output
|
||||||
/* A list of resources associated with this output. */
|
/* A list of resources associated with this output. */
|
||||||
XLList *resources;
|
XLList *resources;
|
||||||
|
|
||||||
|
/* The name of the output. */
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
/* Physical height of this output. */
|
||||||
|
unsigned int mm_width, mm_height;
|
||||||
|
|
||||||
/* The X and Y position of this output. */
|
/* The X and Y position of this output. */
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
/* The width and height of this output. */
|
/* The width and height of this output. */
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
/* The name of the output. */
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
/* The transform and subpixel layout of this output. */
|
/* The transform and subpixel layout of this output. */
|
||||||
uint32_t transform, subpixel;
|
uint32_t transform, subpixel;
|
||||||
|
|
||||||
|
@ -83,10 +83,11 @@ enum
|
||||||
{
|
{
|
||||||
ModesChanged = 1,
|
ModesChanged = 1,
|
||||||
GeometryChanged = (1 << 2),
|
GeometryChanged = (1 << 2),
|
||||||
|
NameChanged = (1 << 3),
|
||||||
/* N.B. that this isn't currently checked during comparisons,
|
/* N.B. that this isn't currently checked during comparisons,
|
||||||
since the rest of the code only supports a single global
|
since the rest of the code only supports a single global
|
||||||
scale. */
|
scale. */
|
||||||
ScaleChanged = (1 << 3),
|
ScaleChanged = (1 << 4),
|
||||||
};
|
};
|
||||||
|
|
||||||
/* List of all outputs registered. */
|
/* List of all outputs registered. */
|
||||||
|
@ -271,6 +272,11 @@ HandleBind (struct wl_client *client, void *data,
|
||||||
for (tem = output->modes; tem; tem = tem->next)
|
for (tem = output->modes; tem; tem = tem->next)
|
||||||
SendMode (tem->data, resource);
|
SendMode (tem->data, resource);
|
||||||
|
|
||||||
|
/* Send the output name. I think it is supposed to be unique. */
|
||||||
|
|
||||||
|
if (wl_resource_get_version (resource) >= 3)
|
||||||
|
wl_output_send_name (resource, output->name);
|
||||||
|
|
||||||
if (wl_resource_get_version (resource) >= 2)
|
if (wl_resource_get_version (resource) >= 2)
|
||||||
wl_output_send_done (resource);
|
wl_output_send_done (resource);
|
||||||
|
|
||||||
|
@ -530,10 +536,12 @@ CompareOutputs (Output *output, Output *other, int *flags)
|
||||||
|| output->x != other->x
|
|| output->x != other->x
|
||||||
|| output->y != other->y
|
|| output->y != other->y
|
||||||
|| output->subpixel != other->subpixel
|
|| output->subpixel != other->subpixel
|
||||||
|| output->transform != other->transform
|
|| output->transform != other->transform)
|
||||||
|| !strcmp (output->name, other->name))
|
|
||||||
difference |= GeometryChanged;
|
difference |= GeometryChanged;
|
||||||
|
|
||||||
|
if (strcmp (output->name, other->name))
|
||||||
|
difference |= NameChanged;
|
||||||
|
|
||||||
*flags = difference;
|
*flags = difference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -560,7 +568,7 @@ MakeGlobal (Output *output)
|
||||||
XLAssert (!output->global);
|
XLAssert (!output->global);
|
||||||
|
|
||||||
output->global = wl_global_create (compositor.wl_display,
|
output->global = wl_global_create (compositor.wl_display,
|
||||||
&wl_output_interface, 2,
|
&wl_output_interface, 4,
|
||||||
output, HandleBind);
|
output, HandleBind);
|
||||||
|
|
||||||
if (!output->global)
|
if (!output->global)
|
||||||
|
@ -585,11 +593,18 @@ SendUpdates (Output *output, int difference)
|
||||||
if (!difference)
|
if (!difference)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Given a mask of differences, send the updated output information
|
||||||
|
to all clients. */
|
||||||
|
|
||||||
for (tem = output->resources; tem; tem = tem->next)
|
for (tem = output->resources; tem; tem = tem->next)
|
||||||
{
|
{
|
||||||
if (difference & GeometryChanged)
|
if (difference & GeometryChanged)
|
||||||
SendGeometry (output, tem->data);
|
SendGeometry (output, tem->data);
|
||||||
|
|
||||||
|
if (difference & NameChanged
|
||||||
|
&& wl_resource_get_version (tem->data) >= 3)
|
||||||
|
wl_output_send_name (tem->data, output->name);
|
||||||
|
|
||||||
if (difference & ModesChanged)
|
if (difference & ModesChanged)
|
||||||
{
|
{
|
||||||
for (tem1 = output->modes; tem1; tem1 = tem->next)
|
for (tem1 = output->modes; tem1; tem1 = tem->next)
|
||||||
|
|
Loading…
Add table
Reference in a new issue