Skip to content
Commits on Source (14)
  • Michael Olbrich's avatar
    input: send touch frame event after up event · cf1ca2c3
    Michael Olbrich authored and Marius Vlad's avatar Marius Vlad committed
    
    
    Currently the frame event gets lost: The touch focus is removed in the 'up'
    event. So the focus is gone when the frame event arrives so it is never sent to
    the clients.
    
    To avoid this, keep the touch focus until the frame is handled.
    
    Signed-off-by: default avatarMichael Olbrich <m.olbrich@pengutronix.de>
    (cherry picked from commit 54485801)
    
    This has undergone a change to avoid an ABI break, so rather than
    hooking up a pending_touch boolean in weston_touch, keep a local list of
    weston_touch_devices and have a pending_touch with each device to check
    upon.
    
    Signed-off-by: default avatarMarius Vlad <marius.vlad@collabora.com>
    cf1ca2c3
  • Michael Olbrich's avatar
    backend-wayland: always propagate touch frame event · 870db970
    Michael Olbrich authored and Marius Vlad's avatar Marius Vlad committed
    
    
    Signed-off-by: default avatarMichael Olbrich <m.olbrich@pengutronix.de>
    (cherry picked from commit 631b60b3)
    870db970
  • manuel alfayate's avatar
    Don't change the max_bpc connector prop if mode=current. · 24ee6144
    manuel alfayate authored and Marius Vlad's avatar Marius Vlad committed
    As things are, even when mode=current is specified on the .ini file,
    a full modeset is needed (and done), which causes a very noticeable
    screen blinking. That is because setting the max_bpc on a connector
    needs full modesetting.
    The idea here is that if mode=current on the .ini, no modesetting
    should be done, so the current max_bpc is programmed into the
    connector.
    But if a custom max-bpc=... is specified, that will be used instead,
    even if mode=current on the .ini
    
    Fixes: wayland/weston#660
    
    
    
    Signed-off-by: default avatarvanfanel <redwindwanderer@gmail.com>
    (cherry picked from commit 3240ccc6)
    24ee6144
  • Marius Vlad's avatar
    doc/sphinx: Make doxygen warn as error depend on meson werror flag · 0da83cc1
    Marius Vlad authored
    
    
    As seen previous times, with newer doxygen version we seem to be
    generating warnings and with it to stop generating documentation
    entirely as we have enabled warning as error in the doxygen
    configuration file.
    
    By default meson werror build option is not enabled, so users can still
    generate documentation when building regularly, and when we'll update to
    the same doxygen version we should be able to catch those errors up if
    any of them will pile up in between.
    
    Suggested-by: default avatarPekka Paalanen <pekka.paalanen@collabora.com>
    Signed-off-by: default avatarMarius Vlad <marius.vlad@collabora.com>
    (cherry picked from commit 402d9a81)
    0da83cc1
  • Marius Vlad's avatar
    backend-rdp/rdpclip: Avoid printing negative index · 715eb67c
    Marius Vlad authored
    
    
    As clipboard_find_supported_format_by_mime_type() can return -1 if it
    can't find out an index avoid trying to print outside of the array.
    
    Fixes the following warnings triggered when enabling FORTIFY_SOURCE
    combined with optimizations (-O)
    
    ../libweston/backend-rdp/rdpclip.c:1114:17: error: array subscript -1 is below array bounds of ‘uint32_t[5]’ {aka ‘unsigned int[5]’} [-Werror=array-bounds]
     1114 |                 weston_log("RDP %s (%p:%s) specified format \"%s\" index:%d formatId:%d is not supported by client\n",
          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1115 |                            __func__, source, clipboard_data_source_state_to_string(source),
          |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1116 |                            mime_type, index, source->client_format_id_table[index]);
          |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../libweston/backend-rdp/rdpclip.c:131:18: note: while referencing ‘client_format_id_table’
      131 |         uint32_t client_format_id_table[RDP_NUM_CLIPBOARD_FORMATS];
    
    Signed-off-by: default avatarMarius Vlad <marius.vlad@collabora.com>
    (cherry picked from commit 9455ad7c)
    715eb67c
  • Marius Vlad's avatar
    compositor/shared: Suppress write(2) warnings · 00a78294
    Marius Vlad authored
    
    
    Fixes the following warnings when building with _FORTIFY_SOURCE
    and optimizations enabled:
    
    ../shared/xalloc.h:49:9: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
       49 |         write(STDERR_FILENO, oommsg, strlen(oommsg));
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    or
    ../compositor/main.c:427:25: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
      427 |                         write(STDERR_FILENO, fail_seteuid,
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      428 |                               strlen(fail_seteuid));
          |                               ~~~~~~~~~~~~~~~~~~~~~
    ../compositor/main.c:434:25: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
      434 |                         write(STDERR_FILENO, fail_cloexec,
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      435 |                               strlen(fail_cloexec));
          |                               ~~~~~~~~~~~~~~~~~~~~~
    ../compositor/main.c:442:25: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
      442 |                         write(STDERR_FILENO, fail_exec, strlen(fail_exec));
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: default avatarMarius Vlad <marius.vlad@collabora.com>
    (cherry picked from commit 8c4cdd78)
    00a78294
  • Derek Foreman's avatar
    xwm: Check size hints in weston_wm_window_is_positioned() · 5517953e
    Derek Foreman authored and Marius Vlad's avatar Marius Vlad committed
    
    
    Currently we can't tell the difference between a window intentionally
    created at 0,0 and a window that we can place anywhere.
    
    Check the size hints to see if the flags indicating the placement
    is intentional are present.
    
    Signed-off-by: default avatarDerek Foreman <derek.foreman@collabora.com>
    (cherry picked from commit 1cb46994)
    5517953e
  • Paul Kocialkowski's avatar
    screenshooter: Add SHM buffer destroy listener to avoid invalid memcpy · 7678ec92
    Paul Kocialkowski authored and Marius Vlad's avatar Marius Vlad committed
    
    
    This adds a destroy listener on the SHM buffer provided by our client.
    It will unregister the frame notify listener in case our buffer is
    destroyed before the frame signal is emitted and thus avoid a memcpy
    to invalid memory.
    
    Signed-off-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
    (cherry picked from commit 0afd3428)
    7678ec92
  • Alexandros Frantzis's avatar
    kiosk-shell: Update view transform after activation. · 7a8392d2
    Alexandros Frantzis authored and Marius Vlad's avatar Marius Vlad committed
    
    
    The activation of a view implies, among other things, a change in the
    associated view layer which is initially unset. In order for this change
    to be reflected in the corresponding surface's output mask, and hence
    allow surface damage to trigger output repaints, we need to update the
    view transform.
    
    Fixes #674
    
    Signed-off-by: default avatarAlexandros Frantzis <alexandros.frantzis@collabora.com>
    (cherry picked from commit 341d09d2)
    7a8392d2
  • Michael Tretter's avatar
    ivi-shell: fix free in get_layers_under_surface · 72a69294
    Michael Tretter authored and Marius Vlad's avatar Marius Vlad committed
    
    
    If a controller requests the layers under a surface that has no views attached,
    Weston crashes since it tries to free the array that would be used to return the
    found layers, but has not been allocated before.
    
    Free the ppArray only if it was allocated in ivi_layout_get_layers_under_surface
    before and no layers were found.
    
    While at it, make it obvious that checking the length is an integer comparison
    by comparing it to 0.
    
    Signed-off-by: Michael Tretter's avatarMichael Tretter <m.tretter@pengutronix.de>
    (cherry picked from commit c56e69bc)
    72a69294
  • Michael Tretter's avatar
    ivi-shell: fix cleanup of desktop surfaces · e7cf894f
    Michael Tretter authored and Marius Vlad's avatar Marius Vlad committed
    
    
    The ivi-shell keeps track of its surfaces by adding them to the ivi_surface_list
    to be able to remove them on shutdown. It also creates an ivi_layout_surface for
    a desktop surface, but does not keep track of these surfaces.
    
    During compositor shutdown, libweston prints the following message:
    
    	BUG: finalizing a layer with views still on it.
    
    Fix it by adding the created ivi_layout_surface to the ivi_surface_list to
    remove the surfaces from the layer during shutdown.
    
    Furthermore, remove the ivi_layout_surface from the desktop surface and free it
    when the desktop surface is destroyed.
    
    Signed-off-by: Michael Tretter's avatarMichael Tretter <m.tretter@pengutronix.de>
    (cherry picked from commit 266e2e1d)
    
    Resolved small conflict which arose due to commit cbf476f2.
    
    Signed-off-by: default avatarMarius Vlad <marius.vlad@collabora.com>
    e7cf894f
  • Alexandros Frantzis's avatar
    kiosk-shell: Don't use a modifier for surface activation bindings · ad7c5162
    Alexandros Frantzis authored and Marius Vlad's avatar Marius Vlad committed
    The mouse button and touch bindings to activate a surface shouldn't
    use the binding modifier.
    
    Fixes: wayland/weston#679
    
    
    
    Signed-off-by: default avatarAlexandros Frantzis <alexandros.frantzis@collabora.com>
    (cherry picked from commit 723709aa)
    ad7c5162
  • Marius Vlad's avatar
    hmi-controller: Add missing removal of destroy listener · 097ed472
    Marius Vlad authored
    
    
    Shutting down the compositor gives us:
    
    Invalid write of size 8
       at 0x4B1AEDB: wl_list_remove (wayland-util.c:56)
       by 0x4AF05BF: weston_signal_emit_mutable (signal.c:66)
       by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
       by 0x4864A4B: wet_main (main.c:3908)
       by 0x10915D: main (executable.c:33)
     Address 0x17435f20 is 224 bytes inside a block of size 384 free'd
       at 0x484617B: free (vg_replace_malloc.c:872)
       by 0x17718C7E: hmi_controller_destroy (hmi-controller.c:761)
       by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
       by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
       by 0x4864A4B: wet_main (main.c:3908)
       by 0x10915D: main (executable.c:33)
    
    Signed-off-by: default avatarMarius Vlad <marius.vlad@collabora.com>
    (cherry picked from commit cfbf2b0a)
    097ed472
  • Marius Vlad's avatar
    ivi-shell: Move out weston_desktop_shell at the end · ac059500
    Marius Vlad authored
    
    
    To avoid the following UAF:
    
    Invalid read of size 8
       at 0x4AE5EFF: weston_desktop_get_display (libweston-desktop.c:110)
       by 0x4AEB2C9: weston_desktop_xdg_surface_schedule_configure (xdg-shell.c:1160)
       by 0x4AEA77A: weston_desktop_xdg_toplevel_set_size (xdg-shell.c:711)
       by 0x4AE839D: weston_desktop_surface_set_size (surface.c:504)
       by 0x63F7D43: ivi_layout_surface_set_size (ivi-layout.c:1599)
       by 0x63F949F: transition_move_resize_view_destroy (ivi-layout-transition.c:311)
       by 0x63F9397: layout_transition_destroy (ivi-layout-transition.c:259)
       by 0x63F8E0B: ivi_layout_remove_all_surface_transitions (ivi-layout-transition.c:121)
       by 0x63F4BC1: ivi_layout_surface_destroy (ivi-layout.c:258)
       by 0x63F38AF: layout_surface_cleanup (ivi-shell.c:162)
       by 0x63F3D2D: shell_destroy (ivi-shell.c:359)
       by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
     Address 0x174202d0 is 0 bytes inside a block of size 152 free'd
       at 0x484617B: free (vg_replace_malloc.c:872)
       by 0x4AE5EDC: weston_desktop_destroy (libweston-desktop.c:97)
       by 0x63F3CF2: shell_destroy (ivi-shell.c:355)
       by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
       by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
       by 0x4864A4B: wet_main (main.c:3908)
       by 0x10915D: main (executable.c:33)
    
    Signed-off-by: default avatarMarius Vlad <marius.vlad@collabora.com>
    (cherry picked from commit eb755cd8)
    ac059500
......@@ -385,6 +385,7 @@ weston_client_launch(struct weston_compositor *compositor,
sigset_t allsigs;
pid_t pid;
bool ret;
size_t written __attribute__((unused));
weston_log("launching '%s'\n", path);
str_printf(&fail_exec, "Error: Couldn't launch client '%s'\n", path);
......@@ -424,22 +425,23 @@ weston_client_launch(struct weston_compositor *compositor,
/* Launch clients as the user. Do not launch clients with wrong euid. */
if (seteuid(getuid()) == -1) {
write(STDERR_FILENO, fail_seteuid,
strlen(fail_seteuid));
written = write(STDERR_FILENO, fail_seteuid,
strlen(fail_seteuid));
_exit(EXIT_FAILURE);
}
ret = fdstr_clear_cloexec_fd1(&wayland_socket);
if (!ret) {
write(STDERR_FILENO, fail_cloexec,
strlen(fail_cloexec));
written = write(STDERR_FILENO, fail_cloexec,
strlen(fail_cloexec));
_exit(EXIT_FAILURE);
}
execve(argp[0], argp, envp);
if (fail_exec)
write(STDERR_FILENO, fail_exec, strlen(fail_exec));
written = write(STDERR_FILENO, fail_exec,
strlen(fail_exec));
_exit(EXIT_FAILURE);
default:
......@@ -2051,7 +2053,8 @@ drm_backend_output_configure(struct weston_output *output,
enum weston_drm_backend_output_mode mode =
WESTON_DRM_BACKEND_OUTPUT_PREFERRED;
uint32_t transform = WL_OUTPUT_TRANSFORM_NORMAL;
uint32_t max_bpc;
uint32_t max_bpc = 0;
bool max_bpc_specified = false;
char *s;
char *modeline = NULL;
char *gbm_format = NULL;
......@@ -2063,16 +2066,19 @@ drm_backend_output_configure(struct weston_output *output,
return -1;
}
weston_config_section_get_uint(section, "max-bpc", &max_bpc, 16);
api->set_max_bpc(output, max_bpc);
weston_config_section_get_string(section, "mode", &s, "preferred");
if (weston_config_section_get_uint(section, "max-bpc", &max_bpc, 16) == 0)
max_bpc_specified = true;
if (strcmp(s, "off") == 0) {
assert(0 && "off was supposed to be pruned");
return -1;
} else if (wet->drm_use_current_mode || strcmp(s, "current") == 0) {
mode = WESTON_DRM_BACKEND_OUTPUT_CURRENT;
/* If mode=current and no max-bpc was specfied on the .ini file,
use current max_bpc so full modeset is not done. */
if (!max_bpc_specified)
max_bpc = 0;
} else if (strcmp(s, "preferred") != 0) {
modeline = s;
s = NULL;
......@@ -2086,6 +2092,8 @@ drm_backend_output_configure(struct weston_output *output,
}
free(modeline);
api->set_max_bpc(output, max_bpc);
if (count_remaining_heads(output, NULL) == 1) {
struct weston_head *head = weston_output_get_first_head(output);
transform = weston_head_get_transform(head);
......
......@@ -110,6 +110,7 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
char *const *envp;
char *const *argp;
bool ret;
size_t written __attribute__ ((unused));
if (os_socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, wayland_socket.fds) < 0) {
weston_log("wl connection socketpair failed\n");
......@@ -174,8 +175,8 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
/* execve does not return on success, so it failed */
if (exec_failure_msg) {
write(STDERR_FILENO, exec_failure_msg,
strlen(exec_failure_msg));
written = write(STDERR_FILENO, exec_failure_msg,
strlen(exec_failure_msg));
}
_exit(EXIT_FAILURE);
......
......@@ -759,7 +759,7 @@ WARN_NO_PARAMDOC = NO
# a warning is encountered.
# The default value is: NO.
WARN_AS_ERROR = YES
WARN_AS_ERROR = @MESON_WERROR@
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which
......
......@@ -39,6 +39,7 @@ sphinx_conf = configure_file(
doxy_conf_data = configuration_data()
doxy_conf_data.set('SRC_ROOT', meson.source_root())
doxy_conf_data.set('OUTPUT_DIR', doxygen_database)
doxy_conf_data.set('MESON_WERROR', get_option('werror') == true ? 'YES' : 'NO')
doxygen_conf_weston = configure_file(
input: 'doxygen.ini.in',
output: 'doxygen.ini',
......
......@@ -84,7 +84,8 @@ struct weston_drm_output_api {
* The property is used for working around faulty sink hardware like
* monitors or media converters that mishandle the kernel driver
* chosen bits-per-channel on the physical link. When having trouble,
* try a lower value like 8.
* try a lower value like 8. A value of 0 means that the current max
* bpc will be reprogrammed.
*
* The value actually used in KMS is silently clamped to the range the
* KMS driver claims to support. The default value is 16.
......
......@@ -738,6 +738,8 @@ hmi_controller_destroy(struct wl_listener *listener, void *data)
struct hmi_controller *hmi_ctrl =
container_of(listener, struct hmi_controller, destroy_listener);
wl_list_remove(&hmi_ctrl->destroy_listener.link);
wl_list_for_each_safe(link, next,
&hmi_ctrl->workspace_fade.layer_list, link) {
wl_list_remove(&link->link);
......
......@@ -1192,15 +1192,14 @@ ivi_layout_get_layers_under_surface(struct ivi_layout_surface *ivisurf,
else
length--;
}
if (length == 0) {
free(*ppArray);
*ppArray = NULL;
}
}
*pLength = length;
if (!length) {
free(*ppArray);
*ppArray = NULL;
}
return IVI_SUCCEEDED;
}
......
......@@ -346,7 +346,6 @@ shell_destroy(struct wl_listener *listener, void *data)
wl_list_remove(&shell->destroy_listener.link);
wl_list_remove(&shell->wake_listener.link);
weston_desktop_destroy(shell->desktop);
wl_list_for_each_safe(ivisurf, next, &shell->ivi_surface_list, link) {
if (ivisurf->layout_surface != NULL)
......@@ -357,6 +356,7 @@ shell_destroy(struct wl_listener *listener, void *data)
ivi_layout_fini();
weston_desktop_destroy(shell->desktop);
free(shell);
}
......@@ -507,6 +507,8 @@ desktop_surface_added(struct weston_desktop_surface *surface,
ivisurf->layout_surface = layout_surface;
ivisurf->surface = weston_surf;
wl_list_insert(&shell->ivi_surface_list, &ivisurf->link);
weston_desktop_surface_set_user_data(surface, ivisurf);
}
......@@ -519,8 +521,14 @@ desktop_surface_removed(struct weston_desktop_surface *surface,
assert(ivisurf != NULL);
weston_desktop_surface_set_user_data(surface, NULL);
if (ivisurf->layout_surface)
layout_surface_cleanup(ivisurf);
wl_list_remove(&ivisurf->link);
free(ivisurf);
}
static void
......
......@@ -413,6 +413,7 @@ kiosk_shell_surface_activate(struct kiosk_shell_surface *shsurf,
weston_layer_entry_insert(&shsurf->shell->normal_layer.view_list,
&shsurf->view->layer_link);
weston_view_geometry_dirty(shsurf->view);
weston_view_update_transform(shsurf->view);
weston_surface_damage(shsurf->view->surface);
}
......@@ -1068,13 +1069,13 @@ kiosk_shell_add_bindings(struct kiosk_shell *shell)
mod = weston_shell_get_binding_modifier(shell->config, MODIFIER_SUPER);
weston_compositor_add_button_binding(shell->compositor, BTN_LEFT, mod,
weston_compositor_add_button_binding(shell->compositor, BTN_LEFT, 0,
kiosk_shell_click_to_activate_binding,
shell);
weston_compositor_add_button_binding(shell->compositor, BTN_RIGHT, mod,
weston_compositor_add_button_binding(shell->compositor, BTN_RIGHT, 0,
kiosk_shell_click_to_activate_binding,
shell);
weston_compositor_add_touch_binding(shell->compositor, mod,
weston_compositor_add_touch_binding(shell->compositor, 0,
kiosk_shell_touch_to_activate_binding,
shell);
......
......@@ -517,6 +517,7 @@ struct drm_head {
struct backlight *backlight;
drmModeModeInfo inherited_mode; /**< Original mode on the connector */
uint32_t inherited_max_bpc; /**< Original max_bpc on the connector */
uint32_t inherited_crtc_id; /**< Original CRTC assignment */
};
......
......@@ -1388,6 +1388,12 @@ drm_head_read_current_setup(struct drm_head *head, struct drm_device *device)
drmModeFreeCrtc(crtc);
}
/* Get the current max_bpc that's currently configured to
* this connector. */
head->inherited_max_bpc = drm_property_get_value(
&head->connector.props[WDRM_CONNECTOR_MAX_BPC],
head->connector.props_drm, 0);
return 0;
}
......
......@@ -912,20 +912,29 @@ drm_connector_set_max_bpc(struct drm_connector *connector,
drmModeAtomicReq *req)
{
const struct drm_property_info *info;
struct drm_head *head;
struct drm_backend *backend = output->device->backend;
uint64_t max_bpc;
uint64_t a, b;
if (!drm_connector_has_prop(connector, WDRM_CONNECTOR_MAX_BPC))
return 0;
info = &connector->props[WDRM_CONNECTOR_MAX_BPC];
assert(info->flags & DRM_MODE_PROP_RANGE);
assert(info->num_range_values == 2);
a = info->range_values[0];
b = info->range_values[1];
assert(a <= b);
if (output->max_bpc == 0) {
/* A value of 0 means that the current max_bpc must be programmed. */
head = drm_head_find_by_connector(backend, connector->connector_id);
max_bpc = head->inherited_max_bpc;
} else {
info = &connector->props[WDRM_CONNECTOR_MAX_BPC];
assert(info->flags & DRM_MODE_PROP_RANGE);
assert(info->num_range_values == 2);
a = info->range_values[0];
b = info->range_values[1];
assert(a <= b);
max_bpc = MAX(a, MIN(output->max_bpc, b));
}
max_bpc = MAX(a, MIN(output->max_bpc, b));
return connector_add_prop(req, connector,
WDRM_CONNECTOR_MAX_BPC, max_bpc);
}
......
......@@ -1111,9 +1111,9 @@ clipboard_data_source_send(struct weston_data_source *base,
}
} else {
source->state = RDP_CLIPBOARD_SOURCE_FAILED;
weston_log("RDP %s (%p:%s) specified format \"%s\" index:%d formatId:%d is not supported by client\n",
weston_log("RDP %s (%p:%s) specified format \"%s\" index:%d is not supported by client\n",
__func__, source, clipboard_data_source_state_to_string(source),
mime_type, index, source->client_format_id_table[index]);
mime_type, index);
goto error_return_close_fd;
}
......
......@@ -2162,10 +2162,6 @@ input_handle_touch_up(void *data, struct wl_touch *wl_touch,
timespec_from_msec(&ts, time);
input->touch_points--;
if (input->touch_points == 0) {
input->touch_focus = NULL;
input->touch_active = false;
}
if (!output)
return;
......@@ -2228,6 +2224,11 @@ input_handle_touch_frame(void *data, struct wl_touch *wl_touch)
return;
notify_touch_frame(input->touch_device);
if (input->touch_points == 0) {
input->touch_focus = NULL;
input->touch_active = false;
}
}
static void
......
......@@ -75,6 +75,15 @@ struct border {
enum motion_direction blocking_dir;
};
struct pending_touch {
struct weston_touch_device *touch_device;
bool pending_focus_touch_reset;
struct wl_list touch_link;
};
static struct wl_list pending_touch_list;
static void
maybe_warp_confined_pointer(struct weston_pointer_constraint *constraint);
......@@ -143,6 +152,7 @@ weston_touch_create_touch_device(struct weston_touch *touch,
const struct weston_touch_device_ops *ops)
{
struct weston_touch_device *device;
struct pending_touch *pt;
assert(syspath);
if (ops) {
......@@ -164,20 +174,55 @@ weston_touch_create_touch_device(struct weston_touch *touch,
return NULL;
}
pt = zalloc(sizeof(*pt));
if (!pt) {
free(device);
return NULL;
}
device->backend_data = backend_data;
device->ops = ops;
pt->touch_device = device;
pt->pending_focus_touch_reset = false;
device->aggregate = touch;
wl_list_insert(touch->device_list.prev, &device->link);
wl_list_insert(&pending_touch_list, &pt->touch_link);
return device;
}
static struct pending_touch *
weston_touch_get_pending(struct weston_touch_device *dev)
{
struct pending_touch *pt_iter = NULL;
struct pending_touch *pt = NULL;
wl_list_for_each(pt_iter, &pending_touch_list, touch_link) {
if (pt_iter->touch_device == dev) {
pt = pt_iter;
break;
}
}
return pt;
}
/** Destroy the touch device. */
WL_EXPORT void
weston_touch_device_destroy(struct weston_touch_device *device)
{
struct pending_touch *pt = NULL;
wl_list_remove(&device->link);
pt = weston_touch_get_pending(device);
assert(pt);
wl_list_remove(&pt->touch_link);
free(pt);
wl_signal_emit(&device->destroy_signal, device);
free(device->syspath);
free(device);
......@@ -2388,6 +2433,7 @@ process_touch_normal(struct weston_touch_device *device,
struct weston_touch_grab *grab = device->aggregate->grab;
struct weston_compositor *ec = device->aggregate->seat->compositor;
struct weston_view *ev;
struct pending_touch *pt = NULL;
wl_fixed_t sx, sy;
wl_fixed_t x = wl_fixed_from_double(double_x);
wl_fixed_t y = wl_fixed_from_double(double_y);
......@@ -2438,8 +2484,9 @@ process_touch_normal(struct weston_touch_device *device,
break;
case WL_TOUCH_UP:
grab->interface->up(grab, time, touch_id);
if (touch->num_tp == 0)
weston_touch_set_focus(touch, NULL);
pt = weston_touch_get_pending(device);
assert(pt);
pt->pending_focus_touch_reset = true;
break;
}
}
......@@ -2628,12 +2675,22 @@ WL_EXPORT void
notify_touch_frame(struct weston_touch_device *device)
{
struct weston_touch_grab *grab;
struct pending_touch *pt;
switch (weston_touch_device_get_mode(device)) {
case WESTON_TOUCH_MODE_NORMAL:
case WESTON_TOUCH_MODE_PREP_CALIB:
grab = device->aggregate->grab;
grab->interface->frame(grab);
pt = weston_touch_get_pending(device);
assert(pt);
if (pt->pending_focus_touch_reset) {
if (grab->touch->num_tp == 0)
weston_touch_set_focus(grab->touch, NULL);
pt->pending_focus_touch_reset = false;
}
break;
case WESTON_TOUCH_MODE_CALIB:
case WESTON_TOUCH_MODE_PREP_NORMAL:
......@@ -5059,6 +5116,8 @@ bind_input_timestamps_manager(struct wl_client *client, void *data,
int
weston_input_init(struct weston_compositor *compositor)
{
wl_list_init(&pending_touch_list);
if (!wl_global_create(compositor->wl_display,
&zwp_relative_pointer_manager_v1_interface, 1,
compositor, bind_relative_pointer_manager))
......
......@@ -45,7 +45,8 @@
#include "wcap/wcap-decode.h"
struct screenshooter_frame_listener {
struct wl_listener listener;
struct wl_listener frame_listener;
struct wl_listener buffer_destroy_listener;
struct weston_buffer *buffer;
struct weston_output *output;
weston_screenshooter_done_func_t done;
......@@ -120,7 +121,8 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data)
{
struct screenshooter_frame_listener *l =
container_of(listener,
struct screenshooter_frame_listener, listener);
struct screenshooter_frame_listener,
frame_listener);
struct weston_output *output = l->output;
struct weston_compositor *compositor = output->compositor;
const pixman_format_code_t pixman_format =
......@@ -130,6 +132,8 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data)
weston_output_disable_planes_decr(output);
wl_list_remove(&listener->link);
wl_list_remove(&l->buffer_destroy_listener.link);
stride = l->buffer->width * (PIXMAN_FORMAT_BPP(pixman_format) / 8);
pixels = malloc(stride * l->buffer->height);
......@@ -177,6 +181,22 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data)
free(l);
}
static void
buffer_destroy_handle(struct wl_listener *listener, void *data)
{
struct screenshooter_frame_listener *l =
container_of(listener,
struct screenshooter_frame_listener,
buffer_destroy_listener);
weston_output_disable_planes_decr(l->output);
wl_list_remove(&listener->link);
wl_list_remove(&l->frame_listener.link);
l->done(l->data, WESTON_SCREENSHOOTER_BAD_BUFFER);
free(l);
}
WL_EXPORT int
weston_screenshooter_shoot(struct weston_output *output,
struct weston_buffer *buffer,
......@@ -205,8 +225,13 @@ weston_screenshooter_shoot(struct weston_output *output,
l->output = output;
l->done = done;
l->data = data;
l->listener.notify = screenshooter_frame_notify;
wl_signal_add(&output->frame_signal, &l->listener);
l->frame_listener.notify = screenshooter_frame_notify;
wl_signal_add(&output->frame_signal, &l->frame_listener);
l->buffer_destroy_listener.notify = buffer_destroy_handle;
wl_signal_add(&buffer->destroy_signal, &l->buffer_destroy_listener);
weston_output_disable_planes_incr(output);
weston_output_schedule_repaint(output);
......
......@@ -172,7 +172,7 @@ silenty clamped to the hardware driver supported range. This artificially
limits the driver chosen link bits-per-channel which may be useful for working
around sink hardware (e.g. monitor) limitations. The default is 16 which is
practically unlimited. If you need to work around hardware issues, try a lower
value like 8.
value like 8. A value of 0 means that the current max bpc will be reprogrammed.
.SS Section remote-output
.TP
......
......@@ -40,13 +40,14 @@ static inline void *
abort_oom_if_null(void *p)
{
static const char oommsg[] = ": out of memory\n";
size_t written __attribute__((unused));
if (p)
return p;
write(STDERR_FILENO, program_invocation_short_name,
strlen(program_invocation_short_name));
write(STDERR_FILENO, oommsg, strlen(oommsg));
written = write(STDERR_FILENO, program_invocation_short_name,
strlen(program_invocation_short_name));
written = write(STDERR_FILENO, oommsg, strlen(oommsg));
abort();
}
......
......@@ -2937,6 +2937,9 @@ weston_wm_window_is_positioned(struct weston_wm_window *window)
weston_log("XWM warning: win %d did not see map request\n",
window->id);
if (window->size_hints.flags & (USPosition | PPosition))
return true;
return window->map_request_x != 0 || window->map_request_y != 0;
}
......