Re: [PATCH weston-ivi-shell 00/15] a reference shell for In-Vehicle Infotainment system
Hi, Thanks to review comments from mainling list. I refine patch series to view them clearly. I think some review comments remained there to be fixed. I will use this thread. BR, Nobuhiko 2014-03-06 18:19 に nobuhiko_tanibata さんは書きました: Hi, This patch series adds a reference implementation of a shell for In-Vehicle Infotainment system; IVI, libraries on the shell to manage layout of User interface; UI, and samples how to use them. Before stepping in overview of patches, please let me explain background and purpose of this contribution. Background) I am working for prototyping a shell for In-Vehicle Infotainment; IVI in TIZEN IVI. This prototyping is being integrated to the TIZEN IVI. https://review.tizen.org/git/?p=profile/ivi/weston-ivi-shell.git;a=summary I am also working for GENIVI wayland-ivi-extension and several private projects with several Car Makers to apply a shell to its use case. The main use case on them is very similar with each other, which is based on a concept of Layer Management. http://projects.genivi.org/ivi-layer-management/node/13 Purpose) I am contributing a reference for common use case of IVI mentioned in Background to avoid implementing same one for each user. The main use case is Layer Management to manage properties of surfaces and layer. Layer is used for grouping surfaces. In this patch series, I am contributing libweston-layout.so to support Layer management features with a set of interfaces which are defined based on ivi-layer-management from GENIVI. With libweston-layout.so, each shell developer of IVI can easily implement own shell. Overview) This patch series are mainly applied to new folder “ivi-shell” like “desktop-shell”. This patch series consists of 5 major parts, - ivi-shell.so : support ivi-application.xml protocol and initialization of libweston-layout.so. The ivi-application.xml defines simple interfaces; “ivi_application::surface_create”. An interface ivi_application::surface_create” is used to tie ID to wl_surface from application. In IVI use case, such IDs are predefined at system design phase to control surface with business logic. For example, TV application shall be invisible in case of speed restriction. - libweston-layout.so: this shall be linked to ivi-shell.so to support layer management APIs internally. These APIs allows us to manage surfaces and layer by e.g. setting properties; position, visibility, opacity and rectangle of source to crop, and so on. This APIs internally uses weston_view as abstraction layer of compositor. - hmi-controller.so: a reference implementation how to use libweston-layout.so. It implement several protocols defined by ivi-hmi-controller.xml, 1/Requesting which surface is a part of User interfaces, e.g. a surface draw an icon from PNG files. According to request, hmi-controller layouts specified surfaces on a Screen by using libweston-layout.so. 2/Requesting layout change. There are 4 types of layout for a reference; tiling, side by side, full screen, and random. 3/Requesting displaying launchers. There are several pages to group icons which can be selected by motion of input. 4/Requesting animation moving from one page to another by motion of input. A reference how to use these protocols are implemented in hmi-controller-homescreen. A pthread sets up parts of UI and triggers layout change, showing launchers, and allowing hmi-controller to select pages of launchers by using ivi-hmi-controller.xml. This can be implemented in separated process, e.g. desktop-shell.c, as well. - Supporting ivi-application protocol to example in “clients” folder. Add macro to compile ivi-application separately. Basically it uses the same code. For example, add macro: ENABLE_IVI_CLIENT to simple-egl.c for compiling weston-simple-egl-ivi at the same time. - Add reference weston.ini.in for ivi-shell in ivi-shell folder as well. It is referred by ivi-shell and hmi-controller.so to define several configurations. E.g. setting cursor, ID of surfaces and layers to be used by hmi-controller-homescreen, launchers; path to icons, binary, ID which page they are located. I am enclosing a pdf for overview of ivi-shell related parts. The pdf also mentions ivi-controller.so maintained here to keep compatibility with IVI layer manager. http://git.projects.genivi.org/?p=wayland-ivi-extension.git;a=summary It allow GENIVI graphic application to manage surfaces/layer outside of Weston process. However it is not purpose to do animation. Ideally, business logic shall be implemented inside of Weston process to reduce dispatch of process as much as possible. Best regards, Nobuhiko ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston-ivi-shell v4 0/9] a reference shell for In-Vehicle Infotainment system
Hi, Thanks to review comments from mainling list. I refine patch series to view them clearly as v4. I think some review comments remained there to be fixed. I will use this thread. BR, Nobuhiko 2014-03-06 18:19 に nobuhiko_tanibata さんは書きました: Hi, This patch series adds a reference implementation of a shell for In-Vehicle Infotainment system; IVI, libraries on the shell to manage layout of User interface; UI, and samples how to use them. Before stepping in overview of patches, please let me explain background and purpose of this contribution. Background) I am working for prototyping a shell for In-Vehicle Infotainment; IVI in TIZEN IVI. This prototyping is being integrated to the TIZEN IVI. https://review.tizen.org/git/?p=profile/ivi/weston-ivi-shell.git;a=summary I am also working for GENIVI wayland-ivi-extension and several private projects with several Car Makers to apply a shell to its use case. The main use case on them is very similar with each other, which is based on a concept of Layer Management. http://projects.genivi.org/ivi-layer-management/node/13 Purpose) I am contributing a reference for common use case of IVI mentioned in Background to avoid implementing same one for each user. The main use case is Layer Management to manage properties of surfaces and layer. Layer is used for grouping surfaces. In this patch series, I am contributing libweston-layout.so to support Layer management features with a set of interfaces which are defined based on ivi-layer-management from GENIVI. With libweston-layout.so, each shell developer of IVI can easily implement own shell. Overview) This patch series are mainly applied to new folder “ivi-shell” like “desktop-shell”. This patch series consists of 5 major parts, - ivi-shell.so : support ivi-application.xml protocol and initialization of libweston-layout.so. The ivi-application.xml defines simple interfaces; “ivi_application::surface_create”. An interface ivi_application::surface_create” is used to tie ID to wl_surface from application. In IVI use case, such IDs are predefined at system design phase to control surface with business logic. For example, TV application shall be invisible in case of speed restriction. - libweston-layout.so: this shall be linked to ivi-shell.so to support layer management APIs internally. These APIs allows us to manage surfaces and layer by e.g. setting properties; position, visibility, opacity and rectangle of source to crop, and so on. This APIs internally uses weston_view as abstraction layer of compositor. - hmi-controller.so: a reference implementation how to use libweston-layout.so. It implement several protocols defined by ivi-hmi-controller.xml, 1/Requesting which surface is a part of User interfaces, e.g. a surface draw an icon from PNG files. According to request, hmi-controller layouts specified surfaces on a Screen by using libweston-layout.so. 2/Requesting layout change. There are 4 types of layout for a reference; tiling, side by side, full screen, and random. 3/Requesting displaying launchers. There are several pages to group icons which can be selected by motion of input. 4/Requesting animation moving from one page to another by motion of input. A reference how to use these protocols are implemented in hmi-controller-homescreen. A pthread sets up parts of UI and triggers layout change, showing launchers, and allowing hmi-controller to select pages of launchers by using ivi-hmi-controller.xml. This can be implemented in separated process, e.g. desktop-shell.c, as well. - Supporting ivi-application protocol to example in “clients” folder. Add macro to compile ivi-application separately. Basically it uses the same code. For example, add macro: ENABLE_IVI_CLIENT to simple-egl.c for compiling weston-simple-egl-ivi at the same time. - Add reference weston.ini.in for ivi-shell in ivi-shell folder as well. It is referred by ivi-shell and hmi-controller.so to define several configurations. E.g. setting cursor, ID of surfaces and layers to be used by hmi-controller-homescreen, launchers; path to icons, binary, ID which page they are located. I am enclosing a pdf for overview of ivi-shell related parts. The pdf also mentions ivi-controller.so maintained here to keep compatibility with IVI layer manager. http://git.projects.genivi.org/?p=wayland-ivi-extension.git;a=summary It allow GENIVI graphic application to manage surfaces/layer outside of Weston process. However it is not purpose to do animation. Ideally, business logic shall be implemented inside of Weston process to reduce dispatch of process as much as possible. Best regards, Nobuhiko ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston-ivi-shell v4 1/9] ivi application protocol:
Add interface ivi_application, which creates ivi_surface objects tied to a given wl_surface with a given id. The given id can be used in a shell to identify which application is assigned to a wl_surface and layout the surface wherever the shell wants. ivi_surface objects can be used to receive status of wl_surface in the scenegraph of the compositor. Signed-off-by: Nobuhiko Tanibata nobuhiko_tanib...@xddp.denso.co.jp --- Changes for v2: - Rename error to warning because meaning of error in wayland is fatal. Changes for v3: - Move warning from ivi_application to ivi_surface. - Squash Makefile. - Add description to ivi_surface:destroy. - Update description of ivi_application:surface_create. Changes for v4: - Remove detail description of server side from ivi_surface::destroy - Add clear discripton what client shall do if it encounters warning in ivi_surface ::warning. - Add decription what happens when client tries to tie a wl_surface to multiple ivi_surfaces. protocol/Makefile.am | 3 +- protocol/ivi-application.xml | 99 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 protocol/ivi-application.xml diff --git a/protocol/Makefile.am b/protocol/Makefile.am index 5e331a7..9913f16 100644 --- a/protocol/Makefile.am +++ b/protocol/Makefile.am @@ -8,7 +8,8 @@ protocol_sources = \ text-cursor-position.xml\ wayland-test.xml\ xdg-shell.xml \ - scaler.xml + scaler.xml \ + ivi-application.xml if HAVE_XMLLINT .PHONY: validate diff --git a/protocol/ivi-application.xml b/protocol/ivi-application.xml new file mode 100644 index 000..37ad489 --- /dev/null +++ b/protocol/ivi-application.xml @@ -0,0 +1,99 @@ +?xml version=1.0 encoding=UTF-8? +protocol name=ivi_application + +copyright +Copyright (C) 2013 DENSO CORPORATION +Copyright (c) 2013 BMW Car IT GmbH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the Software), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +/copyright + +interface name=ivi_surface version=1 +description summary=application interface to surface in ivi compositor/ + +request name=destroy type=destructor +description summary=destroy ivi_surface +This removes link from surface_id to wl_surface and destroys ivi_surface. +/description +/request + +event name=visibility +description summary=visibility of surface in ivi compositor has changed +The new visibility state is provided in argument visibility. +If visibility is 0, the surface has become invisible. +If visibility is not 0, the surface has become visible. +/description +arg name=visibility type=int/ +/event + +enum name=warning_code +description summary=possible warning codes returned by ivi compositor +These warning codes define all possible warning codes returned by ivi compositor +on server-side warnings. +invalid_wl_surface: invalid wl_surface is set. This happens if wl_surface is destroyed before this. +surface_id_in_use: surface_id is already assigned by another application. +/description +entry name=invalid_wl_surface value=1 summary=wl_surface is invalid/ +entry name=surface_id_in_use value=2 summary=surface_id is in use and can not be shared/ +/enum + +event name=warning +description summary=server-side warning detected +The ivi compositor encountered warning while processing a request by this +application. The warning is defined by argument warning_code and optional +warning_text. If the warning is
[PATCH weston-ivi-shell v4 3/9] ivi-shell supports a type of shell for In-Vehicle Infotainment system.
In-Vehicle Infotainment system traditionally manages surfaces with global identification. A protocol, ivi_application, supports such a feature by implementing a request, ivi_application::surface_creation defined in ivi_application.xml. Additionally, it initialize a library, weston-layout, to manage properties of surfaces and group surfaces in layer. In detail, refer library, weston_layout. Signed-off-by: Nobuhiko Tanibata nobuhiko_tanib...@xddp.denso.co.jp --- Changes for v2: - apply review comments of mailing list. - squash update of Makefile into this patch. - move this patch after patch of weston-layout. - support inherit propoerties of id_surface when client attaches another wl_surface with id_surface after destroying ivi_surface once. Changes for v3: - squash internal method, configure, to ivi_shell_surface_configure. Changes for v4: - nothing. Version number aligned to the first patch ivi-shell/Makefile.am | 24 +++- ivi-shell/ivi-shell.c | 314 ++ 2 files changed, 337 insertions(+), 1 deletion(-) create mode 100644 ivi-shell/ivi-shell.c diff --git a/ivi-shell/Makefile.am b/ivi-shell/Makefile.am index 4d54c2d..d0c0d62 100644 --- a/ivi-shell/Makefile.am +++ b/ivi-shell/Makefile.am @@ -1,7 +1,8 @@ moduledir = $(libdir)/weston module_LTLIBRARIES = \ - $(libweston_layout) + $(libweston_layout) \ + $(ivi_shell) AM_CPPFLAGS = \ -I$(top_srcdir)/shared \ @@ -17,6 +18,7 @@ westoninclude_HEADERS = if ENABLE_IVI_SHELL westoninclude_HEADERS += \ + ivi-application-client-protocol.h \ weston-layout.h libweston_layout = libweston-layout.la @@ -27,4 +29,24 @@ libweston_layout_la_SOURCES =\ weston-layout.c \ weston-layout.h +ivi_shell = ivi-shell.la +ivi_shell_la_LDFLAGS = -module -avoid-version +ivi_shell_la_LIBADD = $(COMPOSITOR_LIBS) $(IVI_SHELL_LIBS) ./libweston-layout.la +ivi_shell_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS) $(IVI_SHELL_CFLAGS) +ivi_shell_la_SOURCES = \ + ivi-shell.c \ + weston-layout.h \ + ivi-application-protocol.c \ + ivi-application-server-protocol.h + endif + +BUILT_SOURCES =\ + ivi-application-protocol.c \ + ivi-application-server-protocol.h \ + ivi-application-client-protocol.h + +CLEANFILES = $(BUILT_SOURCES) + +wayland_protocoldir = $(top_srcdir)/protocol +include $(top_srcdir)/wayland-scanner.mk diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c new file mode 100644 index 000..31d39cc --- /dev/null +++ b/ivi-shell/ivi-shell.c @@ -0,0 +1,314 @@ +/* + * Copyright (C) 2013 DENSO CORPORATION + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any + * purpose. It is provided as is without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + +/** + * ivi-shell supports a type of shell for In-Vehicle Infotainment system. + * In-Vehicle Infotainment system traditionally manages surfaces with global + * identification. A protocol, ivi_application, supports such a feature + * by implementing a request, ivi_application::surface_creation defined in + * ivi_application.xml. + * + * Additionally, it initialize a library, weston-layout, to manage properties of + * surfaces and group surfaces in layer. In detail, refer weston_layout. + */ + +#include sys/wait.h +#include unistd.h +#include stdlib.h +#include stdio.h +#include string.h +#include linux/input.h + +#include compositor.h +#include ivi-application-server-protocol.h +#include weston-layout.h + +struct ivi_shell; + +struct ivi_shell_surface +{ +struct ivi_shell *shell; +struct weston_layout_surface *layout_surface; + +
[PATCH weston-ivi-shell v4 4/9] A reference protocol of ivi hmi controller to set up IVI style UI.
The reference protocol is used between hmi-controller and hmi-controller-homescreen. Signed-off-by: Nobuhiko Tanibata nobuhiko_tanib...@xddp.denso.co.jp --- Changes for v2: - squash Makefile to this patch Changes for v3 and v4 - nothing. Version number aligned to the first patch protocol/Makefile.am| 3 +- protocol/ivi-hmi-controller.xml | 105 2 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 protocol/ivi-hmi-controller.xml diff --git a/protocol/Makefile.am b/protocol/Makefile.am index 9913f16..140aef5 100644 --- a/protocol/Makefile.am +++ b/protocol/Makefile.am @@ -9,7 +9,8 @@ protocol_sources = \ wayland-test.xml\ xdg-shell.xml \ scaler.xml \ - ivi-application.xml + ivi-application.xml \ + ivi-hmi-controller.xml if HAVE_XMLLINT .PHONY: validate diff --git a/protocol/ivi-hmi-controller.xml b/protocol/ivi-hmi-controller.xml new file mode 100644 index 000..04e22f4 --- /dev/null +++ b/protocol/ivi-hmi-controller.xml @@ -0,0 +1,105 @@ +?xml version=1.0 encoding=UTF-8? +protocol name=ivi_hmi_controller + +copyright +Copyright (C) 2013 DENSO CORPORATION + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the Software), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +/copyright + +interface name=ivi_hmi_controller version=1 +description summary=set up and control IVI style UI +Currently it's possible to set up surface for background, panel, +buttons, and workspace. +/description + +request name=set_background +description summary=set surface drawing background by surface ID/ +arg name=srf_id type=uint/ +/request + +request name=set_panel +description summary=set surface drawing panel by surface ID/ +arg name=srf_id type=uint/ +/request + +request name=set_button +description summary=set surface drawing button by surface ID +Several buttons are regitered on panel by using arg; number. +/description +arg name=srf_id type=uint/ +arg name=number type=uint/ +/request + +request name=set_home_button +description summary=set surface drawing home button by surface ID/ +arg name=srf_id type=uint/ +/request + +request name=set_workspacebackground +description summary=set surface drawing background of workspace by surface ID/ +arg name=srf_id type=uint/ +/request + +request name=add_launchers +description summary=set a list of surface drawing launchers by a list of surface ID +Per calling this request, a group of launchers are added. +/description +arg name=srf_ids type=array/ +arg name=icon_size type=uint/ +/request + +request name=workspace_control +description summary=start controlling workspace by server +Give seat to the server to be controlled by server side. +/description +arg name=seat type=object interface=wl_seat/ +arg name=serial type=uint/ +/request + +enum name=layout_mode +entry name=tiling value=0/ +entry name=side_by_side value=1/ +entry name=full_screen value=2/ +entry name=random value=3 / +/enum + +request name=switch_mode +description summary=request mode switch of application layout/ +arg name=layout_mode type=uint/ +/request + +enum name=home +entry name=off value=0/ +entry name=on value=1/ +/enum + +request name=home +description summary=request showing
[PATCH weston-ivi-shell v4 6/9] A reference implementation of UI client how to use ivi-hmi-controller.
This is launched from hmi-controller by using hmi_client_start and create a pthread. The basic flow is as followed, 1/ create pthread 2/ read configuration from weston.ini. 3/ draw png file to surface according to configuration of weston.ini 4/ set up UI by using ivi-hmi-controller protocol 5/ Enter event loop 6/ If a surface receives touch/pointer event, followings are invoked according to type of event and surface 6-1/ If a surface to launch ivi_application receive touch up, it execs ivi-application configured in weston.ini. 6-2/ If a surface to switch layout mode receive touch up, it sends a request, ivi_hmi_controller_switch_mode, to hmi-controller. 6-3/ If a surface to show workspace having launchers, it sends a request, ivi_hmi_controller_home, to hmi-controller. 6-4/ If touch down events happens in workspace, ivi_hmi_controller_workspace_control is sent to slide workspace. When control finished, event: ivi_hmi_controller_workspace_end_control is received. Signed-off-by: Nobuhiko Tanibata nobuhiko_tanib...@xddp.denso.co.jp --- Changes for v2: - squash Makefile to this patch Changes for v3 and v4 - nothing. Version number aligned to the first patch ivi-shell/Makefile.am |2 + ivi-shell/hmi-controller-homescreen.c | 1370 + ivi-shell/hmi-controller-homescreen.h | 36 + ivi-shell/hmi-controller.c|3 +- 4 files changed, 1410 insertions(+), 1 deletion(-) create mode 100644 ivi-shell/hmi-controller-homescreen.c create mode 100644 ivi-shell/hmi-controller-homescreen.h diff --git a/ivi-shell/Makefile.am b/ivi-shell/Makefile.am index 28589f8..afaa5e3 100644 --- a/ivi-shell/Makefile.am +++ b/ivi-shell/Makefile.am @@ -46,6 +46,8 @@ hmi_controller_la_LIBADD = $(CLIENT_LIBS) $(IVI_SHELL_LIBS) ./libweston-layout.l hmi_controller_la_CFLAGS = $(GCC_CFLAGS) $(IVI_SHELL_CFLAGS) hmi_controller_la_SOURCES =\ hmi-controller.c\ + hmi-controller-homescreen.h \ + hmi-controller-homescreen.c \ ivi-application-protocol.c \ ivi-application-client-protocol.h \ ivi-hmi-controller-protocol.c \ diff --git a/ivi-shell/hmi-controller-homescreen.c b/ivi-shell/hmi-controller-homescreen.c new file mode 100644 index 000..51f6c75 --- /dev/null +++ b/ivi-shell/hmi-controller-homescreen.c @@ -0,0 +1,1370 @@ +/* + * Copyright (C) 2013 DENSO CORPORATION + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any + * purpose. It is provided as is without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include sys/wait.h +#include unistd.h +#include stdlib.h +#include stdio.h +#include string.h +#include linux/input.h +#include assert.h +#include fcntl.h +#include signal.h +#include sys/mman.h +#include getopt.h +#include pthread.h +#include wayland-cursor.h +#include hmi-controller-homescreen.h +#include ../shared/cairo-util.h +#include ../shared/config-parser.h +#include ivi-application-client-protocol.h +#include ivi-hmi-controller-client-protocol.h + +/** + * A reference implementation how to use ivi-hmi-controller interface to interact + * with hmi-controller. This is launched from hmi-controller by using + * hmi_client_start and create a pthread. + * + * The basic flow is as followed, + * 1/ create pthread + * 2/ read configuration from weston.ini. + * 3/ draw png file to surface according to configuration of weston.ini + * 4/ set up UI by using ivi-hmi-controller protocol + * 5/ Enter event loop + * 6/ If a surface receives touch/pointer event, followings are invoked according + *to type of event and surface + * 6-1/ If a surface to launch ivi_application receive touch up, it execs + * ivi-application configured in weston.ini. + * 6-2/ If a surface to switch layout mode receive touch up, it sends a request, + * ivi_hmi_controller_switch_mode, to
[PATCH weston-ivi-shell v4 8/9] Add a reference of weston.ini for ivi-shell and ivi-hmi-controller.
Signed-off-by: Nobuhiko Tanibata nobuhiko_tanib...@xddp.denso.co.jp --- Changes for v2: - squash Makefile to this patch Changes for v3 and v4 - nothing. Version number aligned to the first patch ivi-shell/Makefile.am | 12 ivi-shell/weston.ini.in | 79 + 2 files changed, 91 insertions(+) create mode 100644 ivi-shell/weston.ini.in diff --git a/ivi-shell/Makefile.am b/ivi-shell/Makefile.am index afaa5e3..333abb7 100644 --- a/ivi-shell/Makefile.am +++ b/ivi-shell/Makefile.am @@ -67,3 +67,15 @@ CLEANFILES = $(BUILT_SOURCES) wayland_protocoldir = $(top_srcdir)/protocol include $(top_srcdir)/wayland-scanner.mk + + +weston.ini : $(srcdir)/weston.ini.in + $(AM_V_GEN)$(SED) \ + -e 's|@bindir[@]|$(bindir)|g' \ + -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \ + -e 's|@libexecdir[@]|$(libexecdir)|g' \ + $ $@ + +all-local : weston.ini + +CLEANFILES += weston.ini diff --git a/ivi-shell/weston.ini.in b/ivi-shell/weston.ini.in new file mode 100644 index 000..c9a6861 --- /dev/null +++ b/ivi-shell/weston.ini.in @@ -0,0 +1,79 @@ +[core] +shell=ivi-shell.so +modules=hmi-controller.so + +[ivi-shell] +cursor-theme=default +cursor-size=32 + +base-layer-id=1000 +workspace-background-layer-id=2000 +workspace-layer-id=3000 +application-layer-id=4000 + +background-image=@abs_top_builddir@/data/background.png +background-id=1001 +panel-image=@abs_top_builddir@/data/panel.png +panel-id=1002 +tiling-image=@abs_top_builddir@/data/tiling.png +tiling-id=1003 +sidebyside-image=@abs_top_builddir@/data/sidebyside.png +sidebyside-id=1004 +fullscreen-image=@abs_top_builddir@/data/fullscreen.png +fullscreen-id=1005 +random-image=@abs_top_builddir@/data/random.png +random-id=1006 +home-image=@abs_top_builddir@/data/home.png +home-id=1007 +workspace-background-color=0x9900 +workspace-background-id=2001 + +[ivi-launcher] +workspace-id=0 +icon=@abs_top_builddir@/data/icon_ivi_flower.png +path=@abs_top_builddir@/clients/weston-flower-ivi + +[ivi-launcher] +workspace-id=0 +icon=@abs_top_builddir@/data/icon_ivi_clickdot.png +path=@abs_top_builddir@/clients/weston-clickdot-ivi + +[ivi-launcher] +workspace-id=1 +icon=@abs_top_builddir@/data/icon_ivi_simple-egl.png +path=@abs_top_builddir@/clients/weston-simple-egl-ivi + +[ivi-launcher] +workspace-id=1 +icon=@abs_top_builddir@/data/icon_ivi_simple-shm.png +path=@abs_top_builddir@/clients/weston-simple-shm-ivi + +[ivi-launcher] +workspace-id=2 +icon=@abs_top_builddir@/data/icon_ivi_smoke.png +path=@abs_top_builddir@/clients/weston-smoke-ivi + +[ivi-launcher] +workspace-id=3 +icon=@abs_top_builddir@/data/icon_ivi_flower.png +path=@abs_top_builddir@/clients/weston-flower-ivi + +[ivi-launcher] +workspace-id=3 +icon=@abs_top_builddir@/data/icon_ivi_clickdot.png +path=@abs_top_builddir@/clients/weston-clickdot-ivi + +[ivi-launcher] +workspace-id=3 +icon=@abs_top_builddir@/data/icon_ivi_simple-egl.png +path=@abs_top_builddir@/clients/weston-simple-egl-ivi + +[ivi-launcher] +workspace-id=3 +icon=@abs_top_builddir@/data/icon_ivi_simple-shm.png +path=@abs_top_builddir@/clients/weston-simple-shm-ivi + +[ivi-launcher] +workspace-id=3 +icon=@abs_top_builddir@/data/icon_ivi_smoke.png +path=@abs_top_builddir@/clients/weston-smoke-ivi -- 1.8.3.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston-ivi-shell v4 9/9] Modify example clients to support ivi-application.xml
Signed-off-by: Nobuhiko Tanibata nobuhiko_tanib...@xddp.denso.co.jp --- Changes for v2, v3 and v4 - nothing. Version number aligned to the first patch clients/.gitignore | 5 clients/Makefile.am | 65 ++ clients/simple-egl.c | 67 clients/simple-shm.c | 50 ++- clients/window.c | 42 ++-- 5 files changed, 211 insertions(+), 18 deletions(-) diff --git a/clients/.gitignore b/clients/.gitignore index d23027c..41b3be3 100644 --- a/clients/.gitignore +++ b/clients/.gitignore @@ -20,6 +20,11 @@ weston-stacking weston-subsurfaces weston-transformed weston-view +weston-clickdot-ivi +weston-flower-ivi +weston-simple-egl-ivi +weston-simple-shm-ivi +weston-smoke-ivi desktop-shell-client-protocol.h desktop-shell-protocol.c diff --git a/clients/Makefile.am b/clients/Makefile.am index 4f8d4a6..4bbacb3 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -7,6 +7,11 @@ demo_clients = \ $(simple_clients_programs) \ $(simple_egl_clients_programs) +if ENABLE_IVI_SHELL +demo_clients += \ + $(ivi_shell_clients_programs) +endif + if INSTALL_DEMO_CLIENTS bin_PROGRAMS += $(demo_clients) else @@ -246,6 +251,66 @@ endif endif +if ENABLE_IVI_SHELL +noinst_LTLIBRARIES = libivitoytoolkit.la + +libivitoytoolkit_la_SOURCES = \ + window.c\ + window.h\ + text-cursor-position-protocol.c \ + text-cursor-position-client-protocol.h \ + scaler-protocol.c \ + scaler-client-protocol.h\ + workspaces-protocol.c \ + workspaces-client-protocol.h + +libivitoytoolkit_la_CPPFLAGS = $(AM_CPPFLAGS) -DENABLE_IVI_CLIENT + +libivitoytoolkit_la_LIBADD = \ + $(CLIENT_LIBS) \ + $(CAIRO_EGL_LIBS) \ + ../shared/libshared-cairo.la -lrt -lm + +ivi_shell_clients_programs = \ + weston-simple-egl-ivi \ + weston-simple-shm-ivi \ + weston-flower-ivi \ + weston-smoke-ivi\ + weston-clickdot-ivi + +weston_simple_egl_ivi_SOURCES = simple-egl.c \ + ../ivi-shell/ivi-application-protocol.c \ + ../ivi-shell/ivi-application-client-protocol.h +weston_simple_egl_ivi_CPPFLAGS = $(SIMPLE_EGL_CLIENT_CFLAGS) -DENABLE_IVI_CLIENT +weston_simple_egl_ivi_LDADD = $(SIMPLE_EGL_CLIENT_LIBS) -lm + +weston_simple_shm_ivi_SOURCES = simple-shm.c \ + ../shared/os-compatibility.c\ + ../shared/os-compatibility.h\ + ../ivi-shell/ivi-application-protocol.c \ + ../ivi-shell/ivi-application-client-protocol.h +weston_simple_shm_ivi_CPPFLAGS = $(SIMPLE_CLIENT_CFLAGS) -DENABLE_IVI_CLIENT +weston_simple_shm_ivi_LDADD = $(SIMPLE_CLIENT_LIBS) + +weston_flower_ivi_SOURCES = flower.c \ + ../ivi-shell/ivi-application-protocol.c \ + ../ivi-shell/ivi-application-client-protocol.h +weston_flower_ivi_CPPFLAGS = $(AM_CPPFLAGS) -DENABLE_IVI_CLIENT +weston_flower_ivi_LDADD = libivitoytoolkit.la + +weston_smoke_ivi_SOURCES = smoke.c \ + ../ivi-shell/ivi-application-protocol.c \ + ../ivi-shell/ivi-application-client-protocol.h +weston_smoke_ivi_CPPFLAGS = $(AM_CPPFLAGS) -DENABLE_IVI_CLIENT +weston_smoke_ivi_LDADD = libivitoytoolkit.la + +weston_clickdot_ivi_SOURCES = clickdot.c \ + ../ivi-shell/ivi-application-protocol.c \ + ../ivi-shell/ivi-application-client-protocol.h +weston_clickdot_ivi_CPPFLAGS = $(AM_CPPFLAGS) -DENABLE_IVI_CLIENT +weston_clickdot_ivi_LDADD = libivitoytoolkit.la +endif + wayland_protocoldir = $(top_srcdir)/protocol include $(top_srcdir)/wayland-scanner.mk diff --git a/clients/simple-egl.c b/clients/simple-egl.c index 2c009ee..b06742f 100644 --- a/clients/simple-egl.c +++ b/clients/simple-egl.c @@ -38,6 +38,13 @@ #include EGL/egl.h #include EGL/eglext.h +#ifdef ENABLE_IVI_CLIENT +#include sys/types.h +#include unistd.h +#include ../ivi-shell/ivi-application-client-protocol.h +#define IVI_SURFACE_ID 9000 +#endif + #ifndef EGL_EXT_swap_buffers_with_damage #define EGL_EXT_swap_buffers_with_damage 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); @@ -70,6 +77,9 @@ struct display { EGLConfig conf; } egl; struct window *window; +#ifdef ENABLE_IVI_CLIENT +struct ivi_application *ivi_application; +#endif PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage; }; @@ -91,6 +101,9 @@ struct window { struct wl_egl_window *native;
Re: [PATCH weston-ivi-shell v3 02/10] ivi application protocol:
On Mon, 17 Mar 2014 13:48:45 +0900 Nobuhiko Tanibata nobuhiko_tanib...@xddp.denso.co.jp wrote: 2014-03-17 10:24 に Nobuhiko Tanibata さんは書きました: 2014-03-15 15:58 に Nobuhiko Tanibata さんは書きました: 2014-03-14 23:16 に Pekka Paalanen さんは書きました: On Wed, 12 Mar 2014 23:59:33 +0900 Nobuhiko Tanibata nobuhiko_tanib...@xddp.denso.co.jp wrote: Add interface ivi_application, which creates ivi_surface objects tied to a given wl_surface with a given id. The given id can be used in a shell to identify which application is assigned to a wl_surface and layout the surface wherever the shell wants. ivi_surface objects can be used to receive status of wl_surface in the scenegraph of the compositor. Signed-off-by: Nobuhiko Tanibata nobuhiko_tanib...@xddp.denso.co.jp --- Changes for v2: - Rename error to warning because meaning of error in wayland is fatal. Changes for v3: - Move warning from ivi_application to ivi_surface. - Squash Makefile. - Add description to ivi_surface:destroy. - Update description of ivi_application:surface_create. protocol/Makefile.am | 3 +- protocol/ivi-application.xml | 96 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 protocol/ivi-application.xml diff --git a/protocol/Makefile.am b/protocol/Makefile.am index 5e331a7..9913f16 100644 --- a/protocol/Makefile.am +++ b/protocol/Makefile.am @@ -8,7 +8,8 @@ protocol_sources = \ text-cursor-position.xml\ wayland-test.xml\ xdg-shell.xml \ -scaler.xml +scaler.xml \ +ivi-application.xml if HAVE_XMLLINT .PHONY: validate diff --git a/protocol/ivi-application.xml b/protocol/ivi-application.xml new file mode 100644 index 000..8f5c23d --- /dev/null +++ b/protocol/ivi-application.xml @@ -0,0 +1,96 @@ +?xml version=1.0 encoding=UTF-8? +protocol name=ivi_application + +copyright +Copyright (C) 2013 DENSO CORPORATION +Copyright (c) 2013 BMW Car IT GmbH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the Software), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +/copyright + +interface name=ivi_surface version=1 +description summary=application interface to surface in ivi compositor/ + +request name=destroy type=destructor +description summary=destroy ivi_surface +This removes link from surface_id to wl_surface. However it doesn't +remove internal properties, e.g. position, visibility, and so on, which +is set to the surface_id. This means when some issues happen on clients +and a ivi_surface is destroyed, it can use previous properties immediately +without setting it again if it restarts and attaches new wl_surface to +the same surface_id. This keeping of properties... why even mention it here? They are nothing this client can affect, are they? Otherwise I would ask, how would the client know if the properties are already set, or if it needs to set them again, or if the client actually needs to know some of them to function correctly. Not a big deal. Hi pq, Yes, it doesn't affect client behavior so I will remove description after However The decision shall be done in server side. So as you say, it should not be mentioned here. +/description +/request + +event name=visibility +description summary=visibility of surface in ivi compositor has changed +The new visibility state is provided in argument visibility. +If
Re: [PATCH weston-ivi-shell v3 02/10] ivi application protocol:
2014-03-17 16:15 に Pekka Paalanen さんは書きました: On Mon, 17 Mar 2014 13:48:45 +0900 Nobuhiko Tanibata nobuhiko_tanib...@xddp.denso.co.jp wrote: 2014-03-17 10:24 に Nobuhiko Tanibata さんは書きました: 2014-03-15 15:58 に Nobuhiko Tanibata さんは書きました: 2014-03-14 23:16 に Pekka Paalanen さんは書きました: On Wed, 12 Mar 2014 23:59:33 +0900 Nobuhiko Tanibata nobuhiko_tanib...@xddp.denso.co.jp wrote: Add interface ivi_application, which creates ivi_surface objects tied to a given wl_surface with a given id. The given id can be used in a shell to identify which application is assigned to a wl_surface and layout the surface wherever the shell wants. ivi_surface objects can be used to receive status of wl_surface in the scenegraph of the compositor. Signed-off-by: Nobuhiko Tanibata nobuhiko_tanib...@xddp.denso.co.jp --- Changes for v2: - Rename error to warning because meaning of error in wayland is fatal. Changes for v3: - Move warning from ivi_application to ivi_surface. - Squash Makefile. - Add description to ivi_surface:destroy. - Update description of ivi_application:surface_create. protocol/Makefile.am | 3 +- protocol/ivi-application.xml | 96 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 protocol/ivi-application.xml diff --git a/protocol/Makefile.am b/protocol/Makefile.am index 5e331a7..9913f16 100644 --- a/protocol/Makefile.am +++ b/protocol/Makefile.am @@ -8,7 +8,8 @@ protocol_sources = \ text-cursor-position.xml\ wayland-test.xml\ xdg-shell.xml \ - scaler.xml + scaler.xml \ + ivi-application.xml if HAVE_XMLLINT .PHONY: validate diff --git a/protocol/ivi-application.xml b/protocol/ivi-application.xml new file mode 100644 index 000..8f5c23d --- /dev/null +++ b/protocol/ivi-application.xml @@ -0,0 +1,96 @@ +?xml version=1.0 encoding=UTF-8? +protocol name=ivi_application + +copyright +Copyright (C) 2013 DENSO CORPORATION +Copyright (c) 2013 BMW Car IT GmbH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the Software), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +/copyright + +interface name=ivi_surface version=1 +description summary=application interface to surface in ivi compositor/ + +request name=destroy type=destructor +description summary=destroy ivi_surface +This removes link from surface_id to wl_surface. However it doesn't +remove internal properties, e.g. position, visibility, and so on, which +is set to the surface_id. This means when some issues happen on clients +and a ivi_surface is destroyed, it can use previous properties immediately +without setting it again if it restarts and attaches new wl_surface to +the same surface_id. This keeping of properties... why even mention it here? They are nothing this client can affect, are they? Otherwise I would ask, how would the client know if the properties are already set, or if it needs to set them again, or if the client actually needs to know some of them to function correctly. Not a big deal. Hi pq, Yes, it doesn't affect client behavior so I will remove description after However The decision shall be done in server side. So as you say, it should not be mentioned here. +/description +/request + +event name=visibility +description summary=visibility of surface in ivi compositor has changed +The new visibility state is provided in argument visibility. +If visibility is 0, the surface has become invisible. +If visibility is not 0, the surface has become visible. +
Re: [PATCH 02/12] shell.c: Restore maximized and fullscreen window on destroyed output
On 03/07/2014 10:27 AM, Xiong Zhang wrote: When maximized or fullscreen window is on destroyed output, compositor can't change these windows to normal window without notify client, otherwise maximize icon or F11 buttion lose its effect after output unplug. Instead we keep these window as maximized or fullscreen, just change it's size to target output. I'm not sure about this. xdg-shell lets us handle this properly and wl_shell should be deprecated at some point, so I'm more inclined to keep the current behavior. Cheers, Ander Signed-off-by: Xiong Zhang xiong.y.zh...@intel.com --- desktop-shell/shell.c | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index bee1b0b..02dd1b8 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -5534,6 +5534,7 @@ shell_reposition_view_on_output_destroy(struct weston_view *view) struct shell_surface *shsurf; float x, y; int visible; + struct weston_view *black_view; x = view-geometry.x; y = view-geometry.y; @@ -5557,6 +5558,8 @@ shell_reposition_view_on_output_destroy(struct weston_view *view) x = first_output-x + first_output-width / 4; y = first_output-y + first_output-height / 4; + output = first_output; + weston_view_set_position(view, x, y); } else weston_view_geometry_dirty(view); @@ -5566,9 +5569,24 @@ shell_reposition_view_on_output_destroy(struct weston_view *view) if (shsurf) { shsurf-saved_position_valid = false; - shsurf-next_state.maximized = false; - shsurf-next_state.fullscreen = false; - shsurf-state_changed = true; + + /* Resize maxmized window to target output. */ + if (shsurf-state.maximized) + set_maximized(shsurf, output); + + /* Resize fullscreen window to target output. */ + if (shsurf-state.fullscreen) { + black_view = shsurf-fullscreen.black_view-surface; + weston_surface_destroy(black_view-surface); + shsurf-fullscreen.black_view = NULL; + + set_fullscreen(shsurf, + shsurf-fullscreen.type, + shsurf-fullscreen.framerate, + output); + } + + shsurf-state_changed = false; } } ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH 06/12] compositor-drm: Abstract drm_output_set_mode()
That's a good clean up. Cheers, Ander On 03/07/2014 10:27 AM, Xiong Zhang wrote: Signed-off-by: Xiong Zhang xiong.y.zh...@intel.com --- src/compositor-drm.c | 45 +++-- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 78292a6..dd1c251 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -593,6 +593,26 @@ drm_output_set_gamma(struct weston_output *output_base, } static int +drm_output_set_mode(struct drm_output *output, uint32_t fb_id) +{ + struct drm_compositor *compositor = + (struct drm_compositor *)output-base.compositor; + struct drm_mode *mode; + int ret = 0; + + mode = container_of(output-base.current_mode, + struct drm_mode, base); + ret = drmModeSetCrtc(compositor-drm.fd, output-crtc_id, +fb_id, 0, 0, +output-connector_id, 1, +mode-mode_info); + if (ret) + weston_log(set mode failed: %m\n); + + return ret; +} + +static int drm_output_repaint(struct weston_output *output_base, pixman_region32_t *damage) { @@ -600,7 +620,6 @@ drm_output_repaint(struct weston_output *output_base, struct drm_compositor *compositor = (struct drm_compositor *) output-base.compositor; struct drm_sprite *s; - struct drm_mode *mode; int ret = 0; if (output-destroy_pending) @@ -611,17 +630,11 @@ drm_output_repaint(struct weston_output *output_base, if (!output-next) return -1; - mode = container_of(output-base.current_mode, struct drm_mode, base); if (!output-current || output-current-stride != output-next-stride) { - ret = drmModeSetCrtc(compositor-drm.fd, output-crtc_id, -output-next-fb_id, 0, 0, -output-connector_id, 1, -mode-mode_info); - if (ret) { - weston_log(set mode failed: %m\n); + if (drm_output_set_mode(output, output-next-fb_id)) goto err_pageflip; - } + output_base-set_dpms(output_base, WESTON_DPMS_ON); } @@ -2355,8 +2368,6 @@ static void drm_compositor_set_modes(struct drm_compositor *compositor) { struct drm_output *output; - struct drm_mode *drm_mode; - int ret; wl_list_for_each(output, compositor-base.output_list, base.link) { if (!output-current) { @@ -2369,17 +2380,7 @@ drm_compositor_set_modes(struct drm_compositor *compositor) continue; } - drm_mode = (struct drm_mode *) output-base.current_mode; - ret = drmModeSetCrtc(compositor-drm.fd, output-crtc_id, -output-current-fb_id, 0, 0, -output-connector_id, 1, -drm_mode-mode_info); - if (ret 0) { - weston_log( - failed to set mode %dx%d for output at %d,%d: %m\n, - drm_mode-base.width, drm_mode-base.height, - output-base.x, output-base.y); - } + drm_output_set_mode(output, output-current-fb_id); } } ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Suggestions for possible GSoC project proposals regarding Wayland/X11 development?
Hello, I'm a college student who is looking into taking part in the Google Summer of Code, specifically with X.Org and Wayland. However, I've been having a bit of a challenge finding a project proposal that I think I would be able to implement, and one that involves working with Wayland (or if that's not possible, X.Org) and is requires enough work to be a reasonable proposal for GSoC. As of now I currently have a mild amount of experience with the X11 codebase, as I took part in designing and implementing support in xf86-input-synaptics for emulating soft buttons for TrackPoints on the latest series of Lenovo laptops, and managed to get two commits merged upstream. I have taken a look of the list of possible proposals on the X.Org page and although it is possible I might be able to handle them once I do more research on the issues in X they cover, I want to see if I can find a proposal with Wayland or Xorg that I would feel more comfortable implementing and using as my proposal when the nearing deadline for GSoC applications come before choosing one of those. The vast majority of my programming experience is with the C programming language and I have managed to attain a very solid understanding of the language, I also have a good amount of experience with glib and GTK+3. Other then working with the TrackPoint soft buttons, my hardware experience is limited but I am always willing to learn and pick up any additional skills I might need. This being said, I'm digging through Google results and IRC channels in search of a potential proposal. I've looked around and tried to find a solid roadmap or to-do list for Wayland that I could make one with, but the only one I managed to find is apparently very out dated. I've asked around in #Wayland and Zoxc presented a task that sounds like it might be perfect for me: Implementing color management in Weston/Wayland (this is also why I Cc'd open...@lists.freedesktop.org) and updating his current patches to work with the latest versions of Wayland/Weston. The patches he mentioned can be found here: https://github.com/Zoxc/weston/compare/master...gl-work , and the current proposal for how color management will be implemented that he has come up with can be found here: https://github.com/Zoxc/weston/blob/cms/protocol/cms.xml . This is something I'd be perfectly willing to undertake, but I don't know if this is something that would be a large enough project to be a reasonable proposal. So I'd like to ask if you guys had any ideas for good GSoC proposals concerning (preferably)Wayland or X11 that aren't currently listed on the suggestions page for X.org GSoC project proposals on FreeDesktop.org? I'd also like to know if the project proposal I currently have, implementing color management for Weston/Wayland, is something you guys think would be a reasonable project proposal for GSoC. I'm eager to hear what you guys have to suggest, and am very much hoping I have a chance to take part in GSoC. And thank you very much in advance for taking the time to read through this. Sincerely, Stephen Chandler Paul ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 7/8] protocol, compositor: split wl_viewport setters
Pekka Paalanen wrote: A zero-area source can theoretically exist: you sample the color exactly at src_x,src_y and use that single color for the whole surface. That's an interesting interpretation, but it implies that the filters for sampling are allowed, and in fact expected, to sample outside the source rectangle. IMHO it should at least be allowed for an implementation to clamp the sources for filtered pixels to be inside the source rectangle (in pixman I think this is called pad extension). This cannot be done for a zero-sized source, so I still feel it should not be allowed. I do agree, that excluding 0x0 from legal source rectangle sizes would be ok, too. Then the minimum would be 1/256 x 1/256, from the definition of wl_fixed_t. I'll consider that. Yes this sounds best to me. We already have a way to do reflections, we do not need yet another one. Sounds good to me. If we make negative numbers an error, I need to add (keep) an error code for them. Isn't there a reusable invalid arguments error? It would seem kind of annoying that every function that cannot accept all possible inputs has to either ignore them or generate a new error message. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 01/18] Add a fullscreen shell protocol
Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- protocol/fullscreen-shell.xml | 206 ++ 1 file changed, 206 insertions(+) create mode 100644 protocol/fullscreen-shell.xml diff --git a/protocol/fullscreen-shell.xml b/protocol/fullscreen-shell.xml new file mode 100644 index 000..8639ea3 --- /dev/null +++ b/protocol/fullscreen-shell.xml @@ -0,0 +1,206 @@ +protocol name=fullscreen_shell + interface name=_wl_fullscreen_shell version=1 +description summary=Displays a single surface per output + Displays a single surface per output. + + This interface provides a mechanism for a single client to display + simple full-screen surfaces. While there technically may be multiple + clients bound to this interface, only one of those clients should be + shown at a time. + + To present a surface, the client uses either the present_surface or + present_surface_for_mode requests. Presenting a surface takes effect + on the next wl_surface.commit. See the individual requests for + details about scaling and mode switches. + + The client can have at most one surface per output at any time. + Requesting a surface be presented on an output that already has a + surface replaces the previously presented surface. Presenting a null + surface removes its content and effectively disables the output. + Exactly what happens when an output is disabled is + compositor-specific. The same surface may be presented on multiple + outputs simultaneously. + + Once a surface is presented on an output, it stays on that output + until either the client removes it or the compositor destroys the + output. This way, the client can update the output's contents by + simply attaching a new buffer. +/description + +request name=release type=destructor + description summary=release the wl_fullscreen_shell interface + Release the binding from the wl_fullscreen_shell interface + + This destroys the server-side object and frees this binding. If + the client binds to wl_fullscreen_shell multiple times, it may wish + to free some of those bindings. + /description +/request + +enum name=capability + description summary=capabilities advertised by the compositor + Various capabilities that can be advertised by the compositor. They + are advertised one-at-a-time when the wl_fullscreen_shell interface is + bound. See the wl_fullscreen_shell.capability event for more details. + + ARBITRARY_MODE: + This is a hint to the client that indicates that the compositor is + capable of setting practially any mode on its outputs. If this + capability is provided, wl_fullscreen_shell.present_surface_for_mode + will almost never fail and clients should feel free to set whatever + mode they like. If the compositor does not advertise this, it may + still suppot some modes that are not advertised through wl_global.mode + but it is less likely. + + CURSOR_PLANE: + This is a hint to the client that indicates that the compositor can + handle a cursor surface from the client without actually compositing. + This may be because of a hardware cursor plane or some other mechanism. + If the compositor does not advertise this capability then setting + wl_pointer.cursor may degrade performance or be ignored entirely. If + CURSOR_PLANE is not advertised, it is recommended that the client draw + its own cursor and set wl_pointer.cursor(NULL). + /description + entry name=arbitrary_modes value=1 summary=compositor is capable of almost any output mode/ + entry name=cursor_plane value=2 summary=compositor has a seperate cursor plane/ +/enum + +event name=capability + description summary=advertises a capability of the compositor + Advertises a single capability of the compositor. + + When the wl_fullscreen_shell interface is bound, this event is emitted + once for each capability advertised. Valid capabilities are given by + the wl_fullscreen_shell.capability enum. If clients want to take + advantage of any of these capabilities, they sould use a + wl_display.sync request immediatly after binding to ensure that they + recieve all the capability events. + /description + arg name=capabilty type=uint/ +/event + +enum name=present_method + description summary=different method to set the surface fullscreen + Hints to indicate to the compositor how to deal with a conflict + between the dimensions of the surface and the dimensions of the + output. The compositor is free to ignore this parameter. + /description + entry name=default value=0 summary=no preference, apply default policy/ + entry name=center value=1 summary=center the surface on
[PATCH fullscreen-shell v5 04/18] Add possible capabilities CURSOR_PLANE and ARBITRARY_MODE
The CURSOR_PLANE capability indicates that the backend has a concept of a cursor plane and can handle a cursor without compositing. This is currently only advertised by the DRM backend. The ARBITRARY_MODE flag specifies that the backend is capable of switching to virtually any resolution. This is currently only advertised in the RDP backend. While it's a bit buggy right now, it should be capable of this. Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- src/compositor-drm.c | 5 + src/compositor-rdp.c | 2 ++ src/compositor.h | 6 ++ 3 files changed, 13 insertions(+) diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 32d0769..acdbe03 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -2786,6 +2786,11 @@ drm_compositor_create(struct wl_display *display, goto err_sprite; } + /* A this point we have some idea of whether or not we have a working +* cursor plane. */ + if (!ec-cursors_are_broken) + ec-base.capabilities |= WESTON_CAP_CURSOR_PLANE; + path = NULL; if (udev_input_init(ec-input, diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c index e8e4a8d..ef14ba7 100644 --- a/src/compositor-rdp.c +++ b/src/compositor-rdp.c @@ -1033,6 +1033,8 @@ rdp_compositor_create(struct wl_display *display, if (rdp_compositor_create_output(c, config-width, config-height, config-extra_modes) 0) goto err_compositor; + c-base.capabilities |= WESTON_CAP_ARBITRARY_MODES; + if(!config-env_socket) { c-listener = freerdp_listener_new(); c-listener-PeerAccepted = rdp_incoming_peer; diff --git a/src/compositor.h b/src/compositor.h index 67d8ef9..eb917a4 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -558,6 +558,12 @@ enum weston_capability { /* screencaptures need to be y-flipped */ WESTON_CAP_CAPTURE_YFLIP= 0x0002, + + /* backend/renderer has a seperate cursor plane */ + WESTON_CAP_CURSOR_PLANE = 0x0004, + + /* backend supports setting arbitrary resolutions */ + WESTON_CAP_ARBITRARY_MODES = 0x0008, }; struct weston_compositor { -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 17/18] gl-renderer: Fix read_pixels in the case where we have output borders
Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- src/gl-renderer.c | 4 1 file changed, 4 insertions(+) diff --git a/src/gl-renderer.c b/src/gl-renderer.c index 29d96f3..6adc88a 100644 --- a/src/gl-renderer.c +++ b/src/gl-renderer.c @@ -964,6 +964,10 @@ gl_renderer_read_pixels(struct weston_output *output, uint32_t width, uint32_t height) { GLenum gl_format; + struct gl_output_state *go = get_output_state(output); + + x += go-borders[GL_RENDERER_BORDER_LEFT].width; + y += go-borders[GL_RENDERER_BORDER_BOTTOM].height; switch (format) { case PIXMAN_a8r8g8b8: -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 10/18] weston-fullscreen: Add wl_fullscreen_shell support
Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- Makefile.am | 3 + clients/fullscreen.c | 163 +++ 2 files changed, 154 insertions(+), 12 deletions(-) diff --git a/Makefile.am b/Makefile.am index 5b6b523..464d086 100644 --- a/Makefile.am +++ b/Makefile.am @@ -504,6 +504,9 @@ weston_transformed_LDADD = libtoytoolkit.la weston_transformed_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) weston_fullscreen_SOURCES = clients/fullscreen.c +nodist_weston_fullscreen_SOURCES = \ + protocol/fullscreen-shell-protocol.c\ + protocol/fullscreen-shell-client-protocol.h weston_fullscreen_LDADD = libtoytoolkit.la weston_fullscreen_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) diff --git a/clients/fullscreen.c b/clients/fullscreen.c index 46a7926..247232b 100644 --- a/clients/fullscreen.c +++ b/clients/fullscreen.c @@ -32,14 +32,25 @@ #include linux/input.h #include wayland-client.h #include window.h +#include fullscreen-shell-client-protocol.h + +struct fs_output { + struct wl_list link; + struct output *output; +}; struct fullscreen { struct display *display; struct window *window; struct widget *widget; + struct _wl_fullscreen_shell *fshell; + enum _wl_fullscreen_shell_present_method present_method; int width, height; int fullscreen; float pointer_x, pointer_y; + + struct wl_list output_list; + struct fs_output *current_output; }; static void @@ -113,6 +124,7 @@ redraw_handler(struct widget *widget, void *data) cairo_t *cr; int i; double x, y, border; + const char *method_name[] = { default, center, zoom, zoom_crop, stretch}; surface = window_get_surface(fullscreen-window); if (surface == NULL || @@ -138,17 +150,33 @@ redraw_handler(struct widget *widget, void *data) allocation.y + 25); cairo_set_source_rgb(cr, 1, 1, 1); - draw_string(cr, - Surface size: %d, %d\n - Scale: %d, transform: %d\n - Pointer: %f,%f\n - Fullscreen: %d\n - Keys: (s)cale, (t)ransform, si(z)e, (f)ullscreen, (q)uit\n, - fullscreen-width, fullscreen-height, - window_get_buffer_scale (fullscreen-window), - window_get_buffer_transform (fullscreen-window), - fullscreen-pointer_x, fullscreen-pointer_y, - fullscreen-fullscreen); + if (fullscreen-fshell) { + draw_string(cr, + Surface size: %d, %d\n + Scale: %d, transform: %d\n + Pointer: %f,%f\n + Output: %s, present method: %s\n + Keys: (s)cale, (t)ransform, si(z)e, (m)ethod,\n + (o)utput, modes(w)itch, (q)uit\n, + fullscreen-width, fullscreen-height, + window_get_buffer_scale (fullscreen-window), + window_get_buffer_transform (fullscreen-window), + fullscreen-pointer_x, fullscreen-pointer_y, + method_name[fullscreen-present_method], + fullscreen-current_output ? output_get_model(fullscreen-current_output-output): null); + } else { + draw_string(cr, + Surface size: %d, %d\n + Scale: %d, transform: %d\n + Pointer: %f,%f\n + Fullscreen: %d\n + Keys: (s)cale, (t)ransform, si(z)e, (f)ullscreen, (q)uit\n, + fullscreen-width, fullscreen-height, + window_get_buffer_scale (fullscreen-window), + window_get_buffer_transform (fullscreen-window), + fullscreen-pointer_x, fullscreen-pointer_y, + fullscreen-fullscreen); + } y = 100; i = 0; @@ -188,6 +216,8 @@ key_handler(struct window *window, struct input *input, uint32_t time, struct fullscreen *fullscreen = data; int transform, scale; static int current_size = 0; + struct fs_output *fsout; + struct wl_output *wl_output; int widths[] = { 640, 320, 800, 400 }; int heights[] = { 480, 240, 600, 300 }; @@ -220,7 +250,69 @@ key_handler(struct window *window, struct input *input, uint32_t time, fullscreen-width, fullscreen-height); break; + case XKB_KEY_m: + if (!fullscreen-fshell) + break; + + wl_output = NULL; + if (fullscreen-current_output) + wl_output =
[PATCH fullscreen-shell v5 05/18] Add a wl_fullscreen_shell implementation
Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- Makefile.am | 22 + configure.ac| 8 + fullscreen-shell/fullscreen-shell.c | 830 3 files changed, 860 insertions(+) create mode 100644 fullscreen-shell/fullscreen-shell.c diff --git a/Makefile.am b/Makefile.am index e181528..9beee99 100644 --- a/Makefile.am +++ b/Makefile.am @@ -667,6 +667,28 @@ nodist_desktop_shell_la_SOURCES = \ BUILT_SOURCES += $(nodist_desktop_shell_la_SOURCES) endif +if ENABLE_FULLSCREEN_SHELL + +module_LTLIBRARIES += fullscreen-shell.la + +fullscreen_shell_la_CPPFLAGS = \ + -I$(top_builddir)/protocol \ + -I$(top_srcdir)/shared \ + -I$(top_srcdir)/src \ + -I$(top_builddir)/src \ + -DIN_WESTON + +fullscreen_shell_la_LDFLAGS = -module -avoid-version +fullscreen_shell_la_LIBADD = $(COMPOSITOR_LIBS) +fullscreen_shell_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS) +fullscreen_shell_la_SOURCES = \ + fullscreen-shell/fullscreen-shell.c +nodist_fullscreen_shell_la_SOURCES = \ + protocol/fullscreen-shell-protocol.c\ + protocol/fullscreen-shell-server-protocol.h + +BUILT_SOURCES += $(nodist_fullscreen_shell_la_SOURCES) +endif if ENABLE_XWAYLAND diff --git a/configure.ac b/configure.ac index 4db0ed1..9e68678 100644 --- a/configure.ac +++ b/configure.ac @@ -373,6 +373,13 @@ AM_CONDITIONAL(BUILD_SUBSURFACES_CLIENT, AM_CONDITIONAL(ENABLE_DESKTOP_SHELL, true) +AC_ARG_ENABLE(fullscreen-shell, + AS_HELP_STRING([--disable-fullscreen-shell], + [do not build fullscreen-shell server plugin]),, + enable_fullscreen_shell=yes) +AM_CONDITIONAL(ENABLE_FULLSCREEN_SHELL, + test x$enable_fullscreen_shell = xyes) + # CMS modules AC_ARG_ENABLE(colord, AS_HELP_STRING([--disable-colord], @@ -504,6 +511,7 @@ AC_MSG_RESULT([ dbus${enable_dbus} Build wcap utility ${enable_wcap_tools} + Build Fullscreen Shell ${enable_fullscreen_shell} weston-launch utility ${enable_weston_launch} systemd-login support ${have_systemd_login} diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c new file mode 100644 index 000..dd8eb7c --- /dev/null +++ b/fullscreen-shell/fullscreen-shell.c @@ -0,0 +1,830 @@ +/* + * Copyright © 2013 Jason Ekstrand + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any + * purpose. It is provided as is without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include config.h + +#include sys/wait.h +#include unistd.h +#include stdlib.h +#include stdio.h +#include string.h +#include assert.h + +#include compositor.h +#include fullscreen-shell-server-protocol.h + +struct fullscreen_shell { + struct wl_client *client; + struct wl_listener client_destroyed; + struct weston_compositor *compositor; + + struct weston_layer layer; + struct wl_list output_list; + struct wl_listener output_created_listener; + + struct wl_listener seat_created_listener; +}; + +struct fs_output { + struct fullscreen_shell *shell; + struct wl_list link; + + struct weston_output *output; + struct wl_listener output_destroyed; + + struct { + struct weston_surface *surface; + struct wl_listener surface_destroyed; + struct wl_resource *mode_feedback; + + int presented_for_mode; + enum _wl_fullscreen_shell_present_method method; + int32_t framerate; + } pending; + + struct weston_surface *surface; + struct wl_listener surface_destroyed; + struct weston_view *view; + struct
[PATCH fullscreen-shell v5 02/18] Generate/build the fullscreen shell protocol files
Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 5ff4f83..e181528 100644 --- a/Makefile.am +++ b/Makefile.am @@ -920,6 +920,7 @@ EXTRA_DIST += \ protocol/text-cursor-position.xml \ protocol/wayland-test.xml \ protocol/xdg-shell.xml \ + protocol/fullscreen-shell.xml \ protocol/scaler.xml man_MANS = weston.1 weston.ini.5 -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 06/18] simple-shm: Add wl_fullscreen_shell support
This makes simple-shm act like a very simple fullscreen shell client. This is the kind of interaction one would expect out of a boot splash screen or similar. Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- Makefile.am | 6 +- clients/simple-shm.c | 31 ++- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9beee99..5b6b523 100644 --- a/Makefile.am +++ b/Makefile.am @@ -389,7 +389,9 @@ demo_clients += \ weston_simple_shm_SOURCES = clients/simple-shm.c nodist_weston_simple_shm_SOURCES = \ protocol/xdg-shell-protocol.c \ - protocol/xdg-shell-client-protocol.h + protocol/xdg-shell-client-protocol.h\ + protocol/fullscreen-shell-protocol.c\ + protocol/fullscreen-shell-client-protocol.h weston_simple_shm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS) weston_simple_shm_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la @@ -605,6 +607,8 @@ BUILT_SOURCES +=\ protocol/scaler-protocol.c \ protocol/workspaces-client-protocol.h \ protocol/workspaces-protocol.c \ + protocol/fullscreen-shell-protocol.c\ + protocol/fullscreen-shell-client-protocol.h \ protocol/xdg-shell-protocol.c \ protocol/xdg-shell-client-protocol.h diff --git a/clients/simple-shm.c b/clients/simple-shm.c index 0296028..2087a0e 100644 --- a/clients/simple-shm.c +++ b/clients/simple-shm.c @@ -35,12 +35,14 @@ #include wayland-client.h #include ../shared/os-compatibility.h #include xdg-shell-client-protocol.h +#include fullscreen-shell-client-protocol.h struct display { struct wl_display *display; struct wl_registry *registry; struct wl_compositor *compositor; struct xdg_shell *shell; + struct _wl_fullscreen_shell *fshell; struct wl_shm *shm; uint32_t formats; }; @@ -165,14 +167,26 @@ create_window(struct display *display, int width, int height) window-width = width; window-height = height; window-surface = wl_compositor_create_surface(display-compositor); - window-xdg_surface = xdg_shell_get_xdg_surface(display-shell, - window-surface); - if (window-xdg_surface) + if (display-shell) { + window-xdg_surface = + xdg_shell_get_xdg_surface(display-shell, + window-surface); + + assert(window-xdg_surface); + xdg_surface_add_listener(window-xdg_surface, xdg_surface_listener, window); - xdg_surface_set_title(window-xdg_surface, simple-shm); + xdg_surface_set_title(window-xdg_surface, simple-shm); + } else if (display-fshell) { + _wl_fullscreen_shell_present_surface(display-fshell, +window-surface, + _WL_FULLSCREEN_SHELL_PRESENT_METHOD_DEFAULT, +NULL); + } else { + assert(0); + } return window; } @@ -188,7 +202,8 @@ destroy_window(struct window *window) if (window-buffers[1].buffer) wl_buffer_destroy(window-buffers[1].buffer); - xdg_surface_destroy(window-xdg_surface); + if (window-xdg_surface) + xdg_surface_destroy(window-xdg_surface); wl_surface_destroy(window-surface); free(window); } @@ -346,6 +361,9 @@ registry_handle_global(void *data, struct wl_registry *registry, id, xdg_shell_interface, 1); xdg_shell_use_unstable_version(d-shell, XDG_VERSION); xdg_shell_add_listener(d-shell, xdg_shell_listener, d); + } else if (strcmp(interface, _wl_fullscreen_shell) == 0) { + d-fshell = wl_registry_bind(registry, +id, _wl_fullscreen_shell_interface, 1); } else if (strcmp(interface, wl_shm) == 0) { d-shm = wl_registry_bind(registry, id, wl_shm_interface, 1); @@ -408,6 +426,9 @@ destroy_display(struct display *display) if (display-shell) xdg_shell_destroy(display-shell); + if (display-fshell) + _wl_fullscreen_shell_release(display-fshell); + if (display-compositor) wl_compositor_destroy(display-compositor); -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 09/18] toytoolkit: Don't crash if wl_data_device_manager is not present
This is primaraly to get weston-fullscreen to run on compositors that lack copy-paste support. Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- clients/window.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/clients/window.c b/clients/window.c index da93604..46a5302 100644 --- a/clients/window.c +++ b/clients/window.c @@ -3516,7 +3516,8 @@ void input_set_selection(struct input *input, struct wl_data_source *source, uint32_t time) { - wl_data_device_set_selection(input-data_device, source, time); + if (input-data_device) + wl_data_device_set_selection(input-data_device, source, time); } void @@ -4912,11 +4913,14 @@ display_add_input(struct display *d, uint32_t id) wl_seat_add_listener(input-seat, seat_listener, input); wl_seat_set_user_data(input-seat, input); - input-data_device = - wl_data_device_manager_get_data_device(d-data_device_manager, - input-seat); - wl_data_device_add_listener(input-data_device, data_device_listener, - input); + if (d-data_device_manager) { + input-data_device = + wl_data_device_manager_get_data_device(d-data_device_manager, + input-seat); + wl_data_device_add_listener(input-data_device, + data_device_listener, + input); + } input-pointer_surface = wl_compositor_create_surface(d-compositor); @@ -4939,7 +4943,8 @@ input_destroy(struct input *input) if (input-selection_offer) data_offer_destroy(input-selection_offer); - wl_data_device_destroy(input-data_device); + if (input-data_device) + wl_data_device_destroy(input-data_device); if (input-display-seat_version = 3) { if (input-pointer) @@ -5422,7 +5427,10 @@ display_get_egl_display(struct display *d) struct wl_data_source * display_create_data_source(struct display *display) { - return wl_data_device_manager_create_data_source(display-data_device_manager); + if (display-data_device_manager) + return wl_data_device_manager_create_data_source(display-data_device_manager); + else + return NULL; } EGLConfig -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 15/18] compositor-wayland: Properly handle running inside a compositor that does not provide keymaps
Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- src/compositor-wayland.c | 61 +--- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index 965f3c5..8256fa1 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -167,6 +167,7 @@ struct wayland_input { } cursor; } parent; + enum weston_key_state_update keyboard_state_update; uint32_t key_serial; uint32_t enter_serial; int focus; @@ -1416,40 +1417,52 @@ input_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format, struct xkb_keymap *keymap; char *map_str; - if (!data) { - close(fd); - return; - } + if (!data) + goto error; - if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { - close(fd); - return; - } + if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { + map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); + if (map_str == MAP_FAILED) { + weston_log(mmap failed: %m\n); + goto error; + } - map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); - if (map_str == MAP_FAILED) { - close(fd); - return; - } + keymap = xkb_map_new_from_string(input-compositor-base.xkb_context, +map_str, +XKB_KEYMAP_FORMAT_TEXT_V1, +0); + munmap(map_str, size); - keymap = xkb_map_new_from_string(input-compositor-base.xkb_context, -map_str, -XKB_KEYMAP_FORMAT_TEXT_V1, -0); - munmap(map_str, size); - close(fd); + if (!keymap) { + weston_log(failed to compile keymap\n); + goto error; + } - if (!keymap) { - weston_log(failed to compile keymap\n); - return; + input-keyboard_state_update = STATE_UPDATE_NONE; + } else if (format == WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP) { + weston_log(No keymap provided; falling back to defalt\n); + keymap = NULL; + input-keyboard_state_update = STATE_UPDATE_AUTOMATIC; + } else { + weston_log(Invalid keymap\n); + goto error; } + close(fd); + if (input-base.keyboard) weston_seat_update_keymap(input-base, keymap); else weston_seat_init_keyboard(input-base, keymap); - xkb_map_unref(keymap); + if (keymap) + xkb_map_unref(keymap); + + return; + +error: + wl_keyboard_release(input-parent.keyboard); + close(fd); } static void @@ -1524,7 +1537,7 @@ input_handle_key(void *data, struct wl_keyboard *keyboard, notify_key(input-base, time, key, state ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED, - STATE_UPDATE_NONE); + input-keyboard_state_update); } static void -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 14/18] Automatically select the wayland backend if WAYLAND_SOCKET is set
Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- src/compositor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compositor.c b/src/compositor.c index 919f4c7..437c37d 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -4086,7 +4086,7 @@ int main(int argc, char *argv[]) NULL); if (!backend) { - if (getenv(WAYLAND_DISPLAY)) + if (getenv(WAYLAND_DISPLAY) || getenv(WAYLAND_SOCKET)) backend = strdup(wayland-backend.so); else if (getenv(DISPLAY)) backend = strdup(x11-backend.so); -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 13/18] compositor-wayland: Add a --sprawl option
This forces weston to create one output for every parent output. This is enabled by default if it detects a wl_fullscreen_shell. The --sprawl option is primarily to enable this on wl_shell. Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- src/compositor-wayland.c | 10 +++--- src/compositor.c | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index be6e563..965f3c5 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -64,6 +64,7 @@ struct wayland_compositor { } parent; int use_pixman; + int sprawl_across_outputs; struct theme *theme; cairo_device_t *frame_device; @@ -1712,7 +1713,7 @@ wayland_compositor_register_output(struct wayland_compositor *c, uint32_t id) wl_list_init(output-mode_list); wl_list_insert(c-parent.output_list, output-link); - if (c-parent.fshell) { + if (c-sprawl_across_outputs) { wl_display_roundtrip(c-parent.wl_display); wayland_output_create_for_parent_output(c, output); } @@ -1993,7 +1994,7 @@ backend_init(struct wl_display *display, int *argc, char *argv[], struct wayland_output *output; struct wayland_parent_output *poutput; struct weston_config_section *section; - int x, count, width, height, scale, use_pixman, fullscreen; + int x, count, width, height, scale, use_pixman, fullscreen, sprawl; const char *section_name, *display_name; char *name; @@ -2005,6 +2006,7 @@ backend_init(struct wl_display *display, int *argc, char *argv[], { WESTON_OPTION_BOOLEAN, use-pixman, 0, use_pixman }, { WESTON_OPTION_INTEGER, output-count, 0, count }, { WESTON_OPTION_BOOLEAN, fullscreen, 0, fullscreen }, + { WESTON_OPTION_BOOLEAN, sprawl, 0, sprawl }, }; width = 0; @@ -2014,6 +2016,7 @@ backend_init(struct wl_display *display, int *argc, char *argv[], use_pixman = 0; count = 1; fullscreen = 0; + sprawl = 0; parse_options(wayland_options, ARRAY_LENGTH(wayland_options), argc, argv); @@ -2022,7 +2025,8 @@ backend_init(struct wl_display *display, int *argc, char *argv[], if (!c) return NULL; - if (c-parent.fshell) { + if (sprawl || c-parent.fshell) { + c-sprawl_across_outputs = 1; wl_display_roundtrip(c-parent.wl_display); wl_list_for_each(poutput, c-parent.output_list, link) diff --git a/src/compositor.c b/src/compositor.c index 7c29d51..919f4c7 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -3953,6 +3953,7 @@ usage(int error_code) --fullscreen\t\tRun in fullscreen mode\n --use-pixman\t\tUse the pixman (CPU) renderer\n --output-count=COUNT\tCreate multiple outputs\n + --sprawl\t\tCreate one fullscreen output for every parent output\n --display=DISPLAY\tWayland display to connect to\n\n); #if defined(BUILD_RPI_COMPOSITOR) defined(HAVE_BCM_HOST) -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 03/18] Add a signal for when a seat updates its capabilities
Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- src/compositor.h | 1 + src/input.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/compositor.h b/src/compositor.h index 8fb8afb..67d8ef9 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -495,6 +495,7 @@ struct weston_seat { struct weston_output *output; /* constraint */ struct wl_signal destroy_signal; + struct wl_signal updated_caps_signal; struct weston_compositor *compositor; struct wl_list link; diff --git a/src/input.c b/src/input.c index c8c798e..9c51468 100644 --- a/src/input.c +++ b/src/input.c @@ -603,6 +603,7 @@ seat_send_updated_caps(struct weston_seat *seat) wl_resource_for_each(resource, seat-base_resource_list) { wl_seat_send_capabilities(resource, caps); } + wl_signal_emit(seat-updated_caps_signal, seat); } WL_EXPORT void @@ -2185,6 +2186,7 @@ weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec, wl_signal_init(seat-selection_signal); wl_list_init(seat-drag_resource_list); wl_signal_init(seat-destroy_signal); + wl_signal_init(seat-updated_caps_signal); seat-global = wl_global_create(ec-wl_display, wl_seat_interface, 3, seat, bind_seat); -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 11/18] weston-fullscreen: Add cursor drawing support and properly handle WL_FULLSCREEN_SHELL_CAPABILITY_CURSOR_PLANE
Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- clients/fullscreen.c | 102 +-- 1 file changed, 98 insertions(+), 4 deletions(-) diff --git a/clients/fullscreen.c b/clients/fullscreen.c index 247232b..1bf36b1 100644 --- a/clients/fullscreen.c +++ b/clients/fullscreen.c @@ -48,6 +48,7 @@ struct fullscreen { int width, height; int fullscreen; float pointer_x, pointer_y; + int focussed, draw_cursor; struct wl_list output_list; struct fs_output *current_output; @@ -186,7 +187,8 @@ redraw_handler(struct widget *widget, void *data) x = 50; cairo_set_line_width (cr, border); while (x + 70 fullscreen-width) { - if (fullscreen-pointer_x = x fullscreen-pointer_x x + 50 + if (fullscreen-focussed + fullscreen-pointer_x = x fullscreen-pointer_x x + 50 fullscreen-pointer_y = y fullscreen-pointer_y y + 40) { cairo_set_source_rgb(cr, 1, 0, 0); cairo_rectangle(cr, @@ -205,6 +207,44 @@ redraw_handler(struct widget *widget, void *data) y += 50; } + if (fullscreen-focussed fullscreen-draw_cursor) { + cairo_set_source_rgb(cr, 1, 1, 1); + cairo_set_line_width (cr, 8); + cairo_move_to(cr, + fullscreen-pointer_x - 12, + fullscreen-pointer_y - 12); + cairo_line_to(cr, + fullscreen-pointer_x + 12, + fullscreen-pointer_y + 12); + cairo_stroke(cr); + + cairo_move_to(cr, + fullscreen-pointer_x + 12, + fullscreen-pointer_y - 12); + cairo_line_to(cr, + fullscreen-pointer_x - 12, + fullscreen-pointer_y + 12); + cairo_stroke(cr); + + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_set_line_width (cr, 4); + cairo_move_to(cr, + fullscreen-pointer_x - 10, + fullscreen-pointer_y - 10); + cairo_line_to(cr, + fullscreen-pointer_x + 10, + fullscreen-pointer_y + 10); + cairo_stroke(cr); + + cairo_move_to(cr, + fullscreen-pointer_x + 10, + fullscreen-pointer_y - 10); + cairo_line_to(cr, + fullscreen-pointer_x - 10, + fullscreen-pointer_y + 10); + cairo_stroke(cr); + } + cairo_destroy(cr); } @@ -336,9 +376,37 @@ motion_handler(struct widget *widget, fullscreen-pointer_y = y; widget_schedule_redraw(widget); - return 0; + + return fullscreen-draw_cursor ? CURSOR_BLANK : CURSOR_LEFT_PTR; } +static int +enter_handler(struct widget *widget, + struct input *input, + float x, float y, void *data) +{ + struct fullscreen *fullscreen = data; + + fullscreen-focussed++; + + fullscreen-pointer_x = x; + fullscreen-pointer_y = y; + + widget_schedule_redraw(widget); + + return fullscreen-draw_cursor ? CURSOR_BLANK : CURSOR_LEFT_PTR; +} + +static void +leave_handler(struct widget *widget, + struct input *input, void *data) +{ + struct fullscreen *fullscreen = data; + + fullscreen-focussed--; + + widget_schedule_redraw(widget); +} static void button_handler(struct widget *widget, @@ -370,6 +438,25 @@ touch_handler(struct widget *widget, struct input *input, } static void +fshell_capability_handler(void *data, struct _wl_fullscreen_shell *fshell, + uint32_t capability) +{ + struct fullscreen *fullscreen = data; + + switch (capability) { + case _WL_FULLSCREEN_SHELL_CAPABILITY_CURSOR_PLANE: + fullscreen-draw_cursor = 0; + break; + default: + break; + } +} + +struct _wl_fullscreen_shell_listener fullscreen_shell_listener = { + fshell_capability_handler +}; + +static void usage(int error_code) { fprintf(stderr, Usage: fullscreen [OPTIONS]\n\n @@ -406,6 +493,9 @@ global_handler(struct display *display, uint32_t id, const char *interface, fullscreen-fshell = display_bind(display, id, _wl_fullscreen_shell_interface, 1); + _wl_fullscreen_shell_add_listener(fullscreen-fshell, + fullscreen_shell_listener, +
[PATCH fullscreen-shell v5 08/18] toytoolkit: Expose output make and model
Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- clients/window.c | 22 ++ clients/window.h | 6 ++ 2 files changed, 28 insertions(+) diff --git a/clients/window.c b/clients/window.c index ccc333e..da93604 100644 --- a/clients/window.c +++ b/clients/window.c @@ -349,6 +349,8 @@ struct output { struct wl_list link; int transform; int scale; + char *make; + char *model; display_output_handler_t destroy_handler; void *user_data; @@ -4676,6 +4678,14 @@ display_handle_geometry(void *data, output-allocation.x = x; output-allocation.y = y; output-transform = transform; + + if (output-make) + free(output-make); + output-make = strdup(make); + + if (output-model) + free(output-model); + output-model = strdup(model); } static void @@ -4863,6 +4873,18 @@ output_get_scale(struct output *output) return output-scale; } +const char * +output_get_make(struct output *output) +{ + return output-make; +} + +const char * +output_get_model(struct output *output) +{ + return output-model; +} + static void fini_xkb(struct input *input) { diff --git a/clients/window.h b/clients/window.h index 38d574f..0a113fc 100644 --- a/clients/window.h +++ b/clients/window.h @@ -602,6 +602,12 @@ output_get_transform(struct output *output); uint32_t output_get_scale(struct output *output); +const char * +output_get_make(struct output *output); + +const char * +output_get_model(struct output *output); + void keysym_modifiers_add(struct wl_array *modifiers_map, const char *name); -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 00/18] Add a fullscreen shell protocol
This is version 5 of my wl_fullscreen_shell patchset. Version 4 can be found here: http://lists.freedesktop.org/archives/wayland-devel/2014-February/013448.html For easier testing/review, this patch series can also be found on the fullscreen-shell-v5 branch on my github page: https://github.com/jekstrand/weston/tree/fullscreen-shell-v5 Changes since version 5: * Rebased on weston master. * I re-named the protocol _wl_fullscreen_shell to mark it explicitly as experimental. If/when it goes mainline, it will get re-named with the leading underscore removed. * fullscreen-shell.c has been moved into its own fullscreen-shell folder to better match desktop-shell and the proposed ivi-shell. * A capabilities mechanism has been added to allow the compositor to advertise capabilities or other hints to the client. More details on this can be found in the protocol patch itself. * Added support to weston-fullscreen to draw its own cursor in the case where WL_FULLSCREEN_SHELL_CAPABILITY_CURSOR_PLANE is not provided. The cursor it draws itself is different from any of the standard weston cursors to allow for instant identification of whether it properly received the capability. * Incorperated various fixes from Bryce Harrington. Thanks, Bryce! Jason Ekstrand (18): Add a fullscreen shell protocol Generate/build the fullscreen shell protocol files Add a signal for when a seat updates its capabilities Add possible capabilities CURSOR_PLANE and ARBITRARY_MODE Add a wl_fullscreen_shell implementation simple-shm: Add wl_fullscreen_shell support toytoolkit: Only require xdg_shell if the window is not custom toytoolkit: Expose output make and model toytoolkit: Don't crash if wl_data_device_manager is not present weston-fullscreen: Add wl_fullscreen_shell support weston-fullscreen: Add cursor drawing support and properly handle WL_FULLSCREEN_SHELL_CAPABILITY_CURSOR_PLANE compositor-wayland: Add support for running on top of wl_fullscreen_shell compositor-wayland: Add a --sprawl option Automatically select the wayland backend if WAYLAND_SOCKET is set compositor-wayland: Properly handle running inside a compositor that does not provide keymaps Add support for running with a primary client gl-renderer: Fix read_pixels in the case where we have output borders Add a screen sharing plugin Makefile.am | 57 +- clients/fullscreen.c| 263 - clients/simple-shm.c| 31 +- clients/window.c| 48 +- clients/window.h|6 + configure.ac| 21 + fullscreen-shell/fullscreen-shell.c | 830 +++ protocol/fullscreen-shell.xml | 206 +++ src/compositor-drm.c|5 + src/compositor-rdp.c|2 + src/compositor-wayland.c| 537 +++-- src/compositor.c| 49 +- src/compositor.h|7 + src/gl-renderer.c |4 + src/input.c |2 + src/screen-share.c | 1085 +++ 16 files changed, 3070 insertions(+), 83 deletions(-) create mode 100644 fullscreen-shell/fullscreen-shell.c create mode 100644 protocol/fullscreen-shell.xml create mode 100644 src/screen-share.c -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 12/18] compositor-wayland: Add support for running on top of wl_fullscreen_shell
Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- Makefile.am | 3 + src/compositor-wayland.c | 470 --- 2 files changed, 451 insertions(+), 22 deletions(-) diff --git a/Makefile.am b/Makefile.am index 464d086..a2f9038 100644 --- a/Makefile.am +++ b/Makefile.am @@ -241,6 +241,9 @@ wayland_backend_la_CFLAGS = \ $(WAYLAND_COMPOSITOR_CFLAGS)\ $(GCC_CFLAGS) wayland_backend_la_SOURCES = src/compositor-wayland.c +nodist_wayland_backend_la_SOURCES =\ + protocol/fullscreen-shell-protocol.c\ + protocol/fullscreen-shell-client-protocol.h endif if ENABLE_RPI_COMPOSITOR diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index 238946b..be6e563 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -42,6 +42,7 @@ #include ../shared/image-loader.h #include ../shared/os-compatibility.h #include ../shared/cairo-util.h +#include fullscreen-shell-client-protocol.h #define WINDOW_TITLE Weston Compositor @@ -53,8 +54,11 @@ struct wayland_compositor { struct wl_registry *registry; struct wl_compositor *compositor; struct wl_shell *shell; + struct _wl_fullscreen_shell *fshell; struct wl_shm *shm; + struct wl_list output_list; + struct wl_event_source *wl_source; uint32_t event_mask; } parent; @@ -75,6 +79,10 @@ struct wayland_output { struct { int draw_initial_frame; struct wl_surface *surface; + + struct wl_output *output; + uint32_t global_id; + struct wl_shell_surface *shell_surface; int configure_width, configure_height; } parent; @@ -103,6 +111,29 @@ struct wayland_output { uint32_t scale; }; +struct wayland_parent_output { + struct wayland_output *output; + struct wl_list link; + + struct wl_output *global; + uint32_t id; + + struct { + char *make; + char *model; + int32_t width, height; + uint32_t subpixel; + } physical; + + int32_t x, y; + uint32_t transform; + uint32_t scale; + + struct wl_list mode_list; + struct weston_mode *preferred_mode; + struct weston_mode *current_mode; +}; + struct wayland_shm_buffer { struct wayland_output *output; struct wl_list link; @@ -289,10 +320,9 @@ draw_initial_frame(struct wayland_output *output) sb-output = NULL; wl_surface_attach(output-parent.surface, sb-buffer, 0, 0); - - /* We only need to damage some part, as its only transparant -* pixels anyway. */ - wl_surface_damage(output-parent.surface, 0, 0, 1, 1); + wl_surface_damage(output-parent.surface, 0, 0, + output-base.current_mode-width, + output-base.current_mode-height); } static void @@ -553,7 +583,8 @@ wayland_output_destroy(struct weston_output *output_base) wl_egl_window_destroy(output-gl.egl_window); wl_surface_destroy(output-parent.surface); - wl_shell_surface_destroy(output-parent.shell_surface); + if (output-parent.shell_surface) + wl_shell_surface_destroy(output-parent.shell_surface); if (output-frame) frame_destroy(output-frame); @@ -738,6 +769,9 @@ wayland_output_set_fullscreen(struct wayland_output *output, enum wl_shell_surface_fullscreen_method method, uint32_t framerate, struct wl_output *target) { + struct wayland_compositor *c = + (struct wayland_compositor *)output-base.compositor; + if (output-frame) { frame_destroy(output-frame); output-frame = NULL; @@ -745,8 +779,177 @@ wayland_output_set_fullscreen(struct wayland_output *output, wayland_output_resize_surface(output); - wl_shell_surface_set_fullscreen(output-parent.shell_surface, - method, framerate, target); + if (output-parent.shell_surface) { + wl_shell_surface_set_fullscreen(output-parent.shell_surface, + method, framerate, target); + } else if (c-parent.fshell) { + _wl_fullscreen_shell_present_surface(c-parent.fshell, +output-parent.surface, +method, target); + } +} + +static struct weston_mode * +wayland_output_choose_mode(struct wayland_output *output, + struct weston_mode *ref_mode) +{ + struct weston_mode *mode; + + /* First look for an exact match */ + wl_list_for_each(mode,
[PATCH fullscreen-shell v5 16/18] Add support for running with a primary client
On startup weston now detects the WAYLAND_SERVER_SOCKET environment variable. If found, weston does not create the display like normal, but instead directly adds a client corresponding to the given fd. This, combined with the fullscreen shell, allows a process to spawn weston and use it as a backend. Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- src/compositor.c | 46 +- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index 437c37d..6ad666d 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -3998,6 +3998,16 @@ catch_signals(void) sigaction(SIGABRT, action, NULL); } +static void +handle_primary_client_destroyed(struct wl_listener *listener, void *data) +{ + struct wl_client *client = data; + + weston_log(Primary client died. Closing...\n); + + wl_display_terminate(wl_client_get_display(client)); +} + int main(int argc, char *argv[]) { int ret = EXIT_SUCCESS; @@ -4009,19 +4019,22 @@ int main(int argc, char *argv[]) *(*backend_init)(struct wl_display *display, int *argc, char *argv[], struct weston_config *config); - int i; + int i, fd; char *backend = NULL; char *option_backend = NULL; char *shell = NULL; char *option_shell = NULL; char *modules, *option_modules = NULL; char *log = NULL; + char *server_socket = NULL, *end; int32_t idle_time = 300; int32_t help = 0; char *socket_name = wayland-0; int32_t version = 0; struct weston_config *config; struct weston_config_section *section; + struct wl_client *primary_client; + struct wl_listener primary_client_destroyed; const struct weston_option core_options[] = { { WESTON_OPTION_STRING, backend, 'B', option_backend }, @@ -4144,10 +4157,33 @@ int main(int argc, char *argv[]) weston_compositor_log_capabilities(ec); - if (wl_display_add_socket(display, socket_name)) { - weston_log(fatal: failed to add socket: %m\n); - ret = EXIT_FAILURE; - goto out; + server_socket = getenv(WAYLAND_SERVER_SOCKET); + if (server_socket) { + weston_log(Running with single client\n); + fd = strtol(server_socket, end, 0); + if (*end != '\0') + fd = -1; + } else { + fd = -1; + } + + if (fd != -1) { + primary_client = wl_client_create(display, fd); + if (!primary_client) { + weston_log(fatal: failed to add client: %m\n); + ret = EXIT_FAILURE; + goto out; + } + primary_client_destroyed.notify = + handle_primary_client_destroyed; + wl_client_add_destroy_listener(primary_client, + primary_client_destroyed); + } else { + if (wl_display_add_socket(display, socket_name)) { + weston_log(fatal: failed to add socket: %m\n); + ret = EXIT_FAILURE; + goto out; + } } weston_compositor_wake(ec); -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 07/18] toytoolkit: Only require xdg_shell if the window is not custom
Signed-off-by: Jason Ekstrand ja...@jlekstrand.net --- clients/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/window.c b/clients/window.c index 3136a7d..ccc333e 100644 --- a/clients/window.c +++ b/clients/window.c @@ -4368,7 +4368,7 @@ window_create_internal(struct display *display, int custom) surface = surface_create(window); window-main_surface = surface; - fail_on_null(display-xdg_shell); + assert(custom || display-xdg_shell); window-custom = custom; window-preferred_format = WINDOW_PREFERRED_FORMAT_NONE; -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH fullscreen-shell v5 18/18] Add a screen sharing plugin
This adds a plugin called screen-share.so. If the screen-share.so module is imported, it will add the CTRL+ALT+s keybinding to start a screen sharing session. If you press CTRL+ALT+S, weston will spawn another copy of weston, this time with the RDP backend, and mirrors the current screen to it and adds any seats from RDP as aditional seats. The current screen is defined as the one with the mouse pointer. Currently the CTRL+ALT+s keybinding is hardcoded as the only way to activate screen sharing. If, at some point, shells want more control over the screen sharing process, the API's should be easy to update and export to make this possible. For security, the command and path to weston is currently hard-coded. It would not take much aditional code to make this configurable or to allow a shell to launch other screen-sharing programs. However, handling those security issues is outside the scope of this patch so it is hard-coded for now. Signed-off-by: Jason Ekstrand ja...@jlekstrand.net Reviewed-by: Bryce Harrington b.harrington at samsung.com --- Makefile.am| 22 ++ configure.ac | 13 + src/screen-share.c | 1083 3 files changed, 1118 insertions(+) create mode 100644 src/screen-share.c diff --git a/Makefile.am b/Makefile.am index a2f9038..c2df8b6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -700,6 +700,28 @@ nodist_fullscreen_shell_la_SOURCES = \ BUILT_SOURCES += $(nodist_fullscreen_shell_la_SOURCES) endif +if ENABLE_SCREEN_SHARING + +module_LTLIBRARIES += screen-share.la + +screen_share_la_CPPFLAGS = $(AM_CPPFLAGS) -DBINDIR='$(bindir)' +screen_share_la_LDFLAGS = -module -avoid-version +screen_share_la_LIBADD = \ + $(COMPOSITOR_LIBS) \ + $(SCREEN_SHARE_LIBS)\ + libshared-cairo.la +screen_share_la_CFLAGS = \ + $(COMPOSITOR_CFLAGS)\ + $(SCREEN_SHARE_CFLAGS) \ + $(GCC_CFLAGS) +screen_share_la_SOURCES = \ + src/screen-share.c +nodist_screen_share_la_SOURCES = \ + protocol/fullscreen-shell-protocol.c\ + protocol/fullscreen-shell-client-protocol.h + +endif + if ENABLE_XWAYLAND module_LTLIBRARIES += xwayland.la diff --git a/configure.ac b/configure.ac index 9e68678..b10ceba 100644 --- a/configure.ac +++ b/configure.ac @@ -222,6 +222,18 @@ if test x$enable_rdp_compositor = xyes; then CPPFLAGS=$SAVED_CPPFLAGS fi +AC_ARG_ENABLE([screen-sharing], [--enable-screen-sharing],, + enable_screen_sharing=no) +AM_CONDITIONAL([ENABLE_SCREEN_SHARING], + [test x$enable_screen_sharing = xyes]) +if test x$enable_screen_sharing = xyes; then + PKG_CHECK_MODULES(SCREEN_SHARE, [wayland-client]) + + if test x$enable_rdp_compositor != xyes; then +AC_MSG_WARN([The screen-share.so module requires the RDP backend.]) + fi +fi + AC_ARG_WITH(cairo, AS_HELP_STRING([--with-cairo=@:@image|gl|glesv2@:@] [Which Cairo renderer to use for the clients]), @@ -523,6 +535,7 @@ AC_MSG_RESULT([ RPI Compositor ${enable_rpi_compositor} FBDEV Compositor${enable_fbdev_compositor} RDP Compositor ${enable_rdp_compositor} + Screen Sharing ${enable_screen_sharing} libinput Backend${enable_libinput_backend} diff --git a/src/screen-share.c b/src/screen-share.c new file mode 100644 index 000..17b07eb --- /dev/null +++ b/src/screen-share.c @@ -0,0 +1,1083 @@ +/* + * Copyright © 2008-2011 Kristian Høgsberg + * Copyright © 2014 Jason Ekstrand + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any + * purpose. It is provided as is without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include stdlib.h +#include stdio.h
Re: [RFC PATCH libinput] udev: add libinput_udev_rescan_devices()
On Sat, Mar 15, 2014 at 07:59:29PM +0100, Jonas Ådahl wrote: On Thu, Mar 13, 2014 at 04:18:20PM +1000, Peter Hutterer wrote: When a libinput context for a given seat is initialized, not all devices may be available. Some or all devices may be paused by systemd-logind. Waiting for a unplug event is not appropriate here as the devices are physically available, just prevented from getting access. Add a libinput_udev_rescan_devices() function that triggers a scan of all devices on the current udev seat. Devices that do not exist on the seat are added, devices that already exist on the seat but have been revoked are removed. Note that devices that have been physically removed are not removed, instead we wait for the udev event to handle this for us. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- The idea here is basically to start a udev context as usual. If the compositor doesn't have the session, open_restricted will fail. Once the ResumeDevice signals are handled by the compositor it can ask libinput to rescan the device list to add the ones that failed before (or remove revoked ones). Notes on why this approach: * libinput_device_suspend()/resume() seems nicer at first but if a device fails to open, we don't have a libinput_device context. handling that would make the API complicated since we cannot guarantee that all libinput_device_* functions (specificall has_capability) work on all devices anymore. * I suspect in the 90% case the the PauseDevice/ResumeDevice signals come in in a batch anyway, so the compositor should be able to optimise this to one single call * this is a udev specific call, for the path backend the compositor can and should maintain the devices manually anyway * EVIOCGVERSION was picked because it always succeeds, except after revoke This is an RFC at this point, let me know if that approach works. Still need to write tests and better evdev duplicate detection - right now there is a race condition that could remove the wrong device. Hi, So what this patch is trying to solve is handling the following flow: * create libinput udev context - some or all devices will fail to open due to being paused * devices are resumed What stops us from simply doing * devices are resumed * create libinput udev context Jasper? you can answer that better than me As you say, a compositor should be able to know when it should rescan, and in most cases (?) before this, we won't get a single device anyway so whats the point of creating earlier than that? For resuming after session switch I suppose we'd have the same problem, but this would then just work the same: * devices are resumed * resume libinput context the question here is: is there a use-case for a single device to be paused/resumed outside of the usual process? David? We're struggling with this in X but that's caused by a completely different problem and is rather orthogonal to this. Cheers, Peter src/evdev.c | 15 +++ src/evdev.h | 2 ++ src/libinput.h | 21 + src/udev-seat.c | 46 +- 4 files changed, 79 insertions(+), 5 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index ba7c8b3..018fbb1 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -790,3 +790,18 @@ evdev_device_destroy(struct evdev_device *device) free(device-sysname); free(device); } + +int +evdev_device_is_alive(struct evdev_device *device) +{ + int rc; + int version; + + rc = ioctl(device-fd, EVIOCGVERSION, version); + + if (rc 0 errno != ENODEV) + log_info(evdev: %s failed with errno %d (%s)\n, +__func__, errno, strerror(errno)); + + return rc != -1; +} diff --git a/src/evdev.h b/src/evdev.h index b83a2f9..82a3873 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -156,4 +156,6 @@ evdev_device_remove(struct evdev_device *device); void evdev_device_destroy(struct evdev_device *device); +int +evdev_device_is_alive(struct evdev_device *device); #endif /* EVDEV_H */ diff --git a/src/libinput.h b/src/libinput.h index 3e09871..dadcac2 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -715,6 +715,27 @@ libinput_udev_create_for_seat(const struct libinput_interface *interface, /** * @ingroup base * + * Re-scan the list of devices available to this context. Devices in the + * seat specified in libinput_udev_create_for_seat() that previously have + * failed to initialize are re-initialized. Devices that have successfully + * re-initialized but are now revoked are removed. + * + * Calling libinput_udev_rescan_devices() on a context suspended with + * libinput_suspend() does nothing. + * + * @note This function should not be used for detection of physically added + * or removed devices,
Re: [PATCH 02/12] shell.c: Restore maximized and fullscreen window on destroyed output
On Mon, 2014-03-17 at 19:17 +0200, Ander Conselvan de Oliveira wrote: On 03/07/2014 10:27 AM, Xiong Zhang wrote: When maximized or fullscreen window is on destroyed output, compositor can't change these windows to normal window without notify client, otherwise maximize icon or F11 buttion lose its effect after output unplug. Instead we keep these window as maximized or fullscreen, just change it's size to target output. I'm not sure about this. xdg-shell lets us handle this properly and wl_shell should be deprecated at some point, so I'm more inclined to keep the current behavior. Cheers, Ander yes, using xdg-shell, maximize icon and F11 button can take effect after output unplug. But server secretly changes window's state from maximized to unmaximized without notifying client, it's unreasonable. If the unplugged output is much larger than remaining output, the maximized window can't been fully displayed on remaining output when the output of maximized window is unplugged. In order to restore this window to normal, user must move this window to see the maximize icon. It isn't convenient for user. thanks. Signed-off-by: Xiong Zhang xiong.y.zh...@intel.commailto:xiong.y.zh...@intel.com --- desktop-shell/shell.c | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index bee1b0b..02dd1b8 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -5534,6 +5534,7 @@ shell_reposition_view_on_output_destroy(struct weston_view *view) struct shell_surface *shsurf; float x, y; int visible; + struct weston_view *black_view; x = view-geometry.x; y = view-geometry.y; @@ -5557,6 +5558,8 @@ shell_reposition_view_on_output_destroy(struct weston_view *view) x = first_output-x + first_output-width / 4; y = first_output-y + first_output-height / 4; + output = first_output; + weston_view_set_position(view, x, y); } else weston_view_geometry_dirty(view); @@ -5566,9 +5569,24 @@ shell_reposition_view_on_output_destroy(struct weston_view *view) if (shsurf) { shsurf-saved_position_valid = false; - shsurf-next_state.maximized = false; - shsurf-next_state.fullscreen = false; - shsurf-state_changed = true; + + /* Resize maxmized window to target output. */ + if (shsurf-state.maximized) + set_maximized(shsurf, output); + + /* Resize fullscreen window to target output. */ + if (shsurf-state.fullscreen) { + black_view = shsurf-fullscreen.black_view-surface; + weston_surface_destroy(black_view-surface); + shsurf-fullscreen.black_view = NULL; + + set_fullscreen(shsurf, +shsurf-fullscreen.type, +shsurf-fullscreen.framerate, +output); + } + + shsurf-state_changed = false; } } ___ wayland-devel mailing list wayland-devel@lists.freedesktop.orgmailto:wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel