Compare commits

...

13 Commits

Author SHA1 Message Date
Carlos Garnacho
e5dd9b8fbc wayland: Use default cursor on tablet tools
Now that we "replace" the pointer cursor on tablet input, have it
use the default cursor so it blends in better.
2018-11-02 16:15:02 +01:00
Carlos Garnacho
83f496229b backends: Keep cursor hidden on tablet input on Wayland
Tablets have their own cursor, in order to avoid confusions just
hide the regular pointer like we do on touchscreens, so there's
the illusion that there is a single cursor.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/75
2018-11-02 16:14:55 +01:00
Carlos Garnacho
0fea0e383c backends: Unify cursor visibility checks
Instead of having device type checks spread around, unify cursor
visibility dependent on device availability on a single function.
2018-11-02 15:49:01 +01:00
Ron Yorston
92cccf53df workspace-manager: Allow workspace layout to be overridden
meta_workspace_manager_override_workspace_layout is implemented by
calling meta_workspace_manager_update_workspace_layout which
respects the workspace_layout_overridden flag.  After the first call
to meta_workspace_manager_override_workspace_layout all subsequent
calls fail silently.

Reset workspace_layout_overridden to FALSE before calling
meta_workspace_manager_update_workspace_layout.

https://gitlab.gnome.org/GNOME/mutter/issues/270
2018-10-30 10:54:57 +01:00
Pekka Paalanen
4282067e24 gpu-kms: assert on invalid flip attempts
drmModePageFlip() is guaranteed to fail for the invalid FB id 0.
Therefore it never makes sense to call this function with such argument.
Disabling a CRTC must be done with SetCrtc instead, for example.

Trying to flip to FB 0 not only fails, but it also causes Mutter to
never try page flip on this output again, using drmModeSetCrtc()
instead.
2018-10-25 09:57:39 +00:00
Pekka Paalanen
85e9784a22 renderer/native: fix next_fb_id race on CPU copy path
There was a race in setting next_fb_id when a secondary GPU was using
the CPU copy path. Losing this race caused the attempt to
drmModePageFlip () to FB ID 0 which is invalid and always fails. Failing
to flip causes Mutter to fall back to drmModeSetCrtc () permanently.

In meta_onscreen_native_swap_buffers_with_damage ():
- update_secondary_gpu_state_pre_swap_buffers ()
  - copy_shared_framebuffer_cpu () but only on the CPU copy path
    - secondary_gpu_state->gbm.next_fb_id is set
- wait_for_pending_flips ()
  - Waits for any remaining page flip events and executes and destroys
    the related page flip closures.
    - on_crtc_flipped ()
      - meta_onscreen_native_swap_drm_fb ()
        - swap_secondary_drm_fb ()
	  - secondary_gpu_state->gbm.next_fb_id = 0;
- meta_onscreen_native_flip_crtcs ()
  - meta_onscreen_native_flip_crtc ()
    - meta_gpu_kms_flip_crtc () gets called with fb_id = 0

This race was observed lost when running 'mutter --wayland' on a machine
with two outputs on Intel and one output on DisplayLink USB dock, and
wiggling around a weston-terminal window between the Intel and
DisplayLink outputs. It took from a second to a minute to trigger. For
testing with DisplayLink outputs Mutter also needed a patch to take the
DisplayLink output into use, as it would have otherwise been ignored
being a platform device rather than a PCI device.

Fix this race by first waiting for pending flips and only then
proceeding with the swap operations. This should be safe, because the
pending flips could have completed already before entering
meta_onscreen_native_swap_buffers_with_damage ().
2018-10-25 09:57:39 +00:00
Jonas Ådahl
49fea735aa wayland/text-input: Ignore text-input state commit when not focused
We might unset focus, or already be out of focus (e.g. an X11 client or
clutter text entry is focused) when a text-input state is committed by
the client. We handled this before, except when text input was
explicitly disabled by the client, the Wayland text-input was in focus
by the input method, and it focused itself out.

Simplify the logic a bit by just dropping the state on the floor in all
cases where after any potential focus changes were done, we are not
focused.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/353
2018-10-23 14:13:33 +02:00
Jonas Ådahl
8200995fdb shaped-texture: Clean up texture regions
We allocated texture regions, but didn't free them when finished,
causing a leak.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/653
2018-10-20 15:47:50 +02:00
Jonas Ådahl
71a62bb18f constraints: Make current placement rule stack allocated
We're not going to keep it past the function scope, so no reason to put
it on the heap. We also didn't free it, so this'll fix a memory leak.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/653
2018-10-20 15:46:37 +02:00
Florian Müllner
76abe87090 xprops: Make sure text_property_to_utf8() returns UTF8
Commit 840378ae68 changed the code to use XmbTextPropertyToTextList()
instead of gdk_text_property_to_utf8_list_for_display(), but didn't
take into account that the replacement returns text in the current
locale's encoding, while any callers (rightfully) expect UTF8.

Fix this by converting the text if necessary.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/227
2018-10-12 15:01:36 +02:00
Florian Müllner
62775d1913 x11/window-props: Do not convert WM_NAME
The WM_NAME property is of type TEXT_PROPERTY, which is supposed to be
returned as UTF-8. Commit 840378ae68 broke that assumption, resulting
in crashes with non-UTF8 locales; however the "fix" of converting from
LATIN1 to UTF8 is wrong as well, as the conversion will spit out garbage
when the input encoding isn't actually LATIN1.

Now that the original issue in text_property_to_utf8() has been fixed,
we can simply revert the relevant bits of commit d62491f46e.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/227
2018-10-12 15:01:29 +02:00
Jonas Ådahl
e24947a460 Revert "Characters of window title bar garbled"
For some reason Gitlab pushed the wrong commits when merging
https://gitlab.gnome.org/GNOME/mutter/merge_requests/227. Correct that.

This reverts commit d387aa428a.
2018-10-12 15:00:02 +02:00
Akira Nakajima
d387aa428a Characters of window title bar garbled 2018-10-11 07:15:22 +00:00
10 changed files with 64 additions and 64 deletions

View File

@@ -293,13 +293,6 @@ on_device_added (ClutterDeviceManager *device_manager,
create_device_monitor (backend, device_id);
}
static inline gboolean
device_is_slave_touchscreen (ClutterInputDevice *device)
{
return (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_MASTER &&
clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE);
}
static inline gboolean
check_has_pointing_device (ClutterDeviceManager *manager)
{
@@ -316,6 +309,9 @@ check_has_pointing_device (ClutterDeviceManager *manager)
if (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE ||
clutter_input_device_get_device_type (device) == CLUTTER_KEYBOARD_DEVICE)
continue;
if (clutter_input_device_get_device_type (device) == CLUTTER_TABLET_DEVICE &&
meta_is_wayland_compositor ())
continue;
return TRUE;
}
@@ -324,9 +320,10 @@ check_has_pointing_device (ClutterDeviceManager *manager)
}
static inline gboolean
check_has_slave_touchscreen (ClutterDeviceManager *manager)
check_pointer_visibility (ClutterDeviceManager *manager)
{
const GSList *devices;
gboolean pointer_visible = TRUE;
devices = clutter_device_manager_peek_devices (manager);
@@ -334,12 +331,19 @@ check_has_slave_touchscreen (ClutterDeviceManager *manager)
{
ClutterInputDevice *device = devices->data;
if (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_MASTER &&
clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE)
return TRUE;
if (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_SLAVE)
continue;
if (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE ||
(clutter_input_device_get_device_type (device) == CLUTTER_TABLET_DEVICE &&
meta_is_wayland_compositor ()))
{
pointer_visible = FALSE;
break;
}
}
return FALSE;
return pointer_visible;
}
static void
@@ -359,26 +363,16 @@ on_device_removed (ClutterDeviceManager *device_manager,
if (priv->current_device_id == device_id)
{
MetaCursorTracker *cursor_tracker = priv->cursor_tracker;
gboolean has_touchscreen, has_pointing_device;
ClutterInputDeviceType device_type;
gboolean pointer_hidden, has_pointing_device;
priv->current_device_id = 0;
device_type = clutter_input_device_get_device_type (device);
has_touchscreen = check_has_slave_touchscreen (device_manager);
pointer_hidden = !check_pointer_visibility (device_manager);
has_pointing_device = check_has_pointing_device (device_manager);
if (device_type == CLUTTER_TOUCHSCREEN_DEVICE && has_touchscreen)
{
/* There's more touchscreens left, keep the pointer hidden */
meta_cursor_tracker_set_pointer_visible (cursor_tracker, FALSE);
}
else if (device_type != CLUTTER_KEYBOARD_DEVICE)
{
has_pointing_device = check_has_pointing_device (device_manager);
meta_cursor_tracker_set_pointer_visible (cursor_tracker,
has_pointing_device &&
!has_touchscreen);
}
meta_cursor_tracker_set_pointer_visible (cursor_tracker,
has_pointing_device &&
!pointer_hidden);
}
}
@@ -405,20 +399,11 @@ set_initial_pointer_visibility (MetaBackend *backend,
ClutterDeviceManager *device_manager)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
const GSList *devices;
const GSList *l;
gboolean has_touchscreen = FALSE;
devices = clutter_device_manager_peek_devices (device_manager);
for (l = devices; l; l = l->next)
{
ClutterInputDevice *device = l->data;
has_touchscreen |= device_is_slave_touchscreen (device);
}
gboolean pointer_visible;
pointer_visible = check_pointer_visibility (device_manager);
meta_cursor_tracker_set_pointer_visible (priv->cursor_tracker,
!has_touchscreen);
pointer_visible);
}
static MetaInputSettings *
@@ -1054,6 +1039,12 @@ update_last_device (MetaBackend *backend)
{
case CLUTTER_KEYBOARD_DEVICE:
break;
case CLUTTER_TABLET_DEVICE:
if (meta_is_wayland_compositor ())
meta_cursor_tracker_set_pointer_visible (cursor_tracker, FALSE);
else
meta_cursor_tracker_set_pointer_visible (cursor_tracker, TRUE);
break;
case CLUTTER_TOUCHSCREEN_DEVICE:
meta_cursor_tracker_set_pointer_visible (cursor_tracker, FALSE);
break;

View File

@@ -2,6 +2,7 @@
/*
* Copyright (C) 2017 Red Hat
* Copyright (c) 2018 DisplayLink (UK) Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -257,6 +258,8 @@ meta_gpu_kms_flip_crtc (MetaGpuKms *gpu_kms,
g_assert (n_connectors > 0);
g_free (connectors);
g_assert (fb_id != 0);
if (!gpu_kms->page_flips_not_supported)
{
MetaGpuKmsFlipClosureContainer *closure_container;

View File

@@ -1900,6 +1900,12 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
CoglFrameInfo *frame_info;
gboolean egl_context_changed = FALSE;
/*
* Wait for the flip callback before continuing, as we might have started the
* animation earlier due to the animation being driven by some other monitor.
*/
wait_for_pending_flips (onscreen);
frame_info = g_queue_peek_tail (&onscreen->pending_frame_infos);
frame_info->global_frame_counter = renderer_native->frame_counter;
@@ -1909,12 +1915,6 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
rectangles,
n_rectangles);
/*
* Wait for the flip callback before continuing, as we might have started the
* animation earlier due to the animation being driven by some other monitor.
*/
wait_for_pending_flips (onscreen);
renderer_gpu_data = meta_renderer_native_get_gpu_data (renderer_native,
render_gpu);
switch (renderer_gpu_data->mode)

View File

@@ -516,6 +516,7 @@ meta_shaped_texture_paint (ClutterActor *actor)
}
else
{
opaque_tex_region = NULL;
use_opaque_region = FALSE;
}
@@ -659,6 +660,8 @@ meta_shaped_texture_paint (ClutterActor *actor)
}
}
g_clear_pointer (&clip_tex_region, cairo_region_destroy);
g_clear_pointer (&opaque_tex_region, cairo_region_destroy);
g_clear_pointer (&blended_tex_region, cairo_region_destroy);
}

View File

@@ -787,7 +787,7 @@ constrain_custom_rule (MetaWindow *window,
MetaPlacementRule *placement_rule;
MetaRectangle intersection;
gboolean constraint_satisfied;
MetaPlacementRule *current_rule;
MetaPlacementRule current_rule;
MetaWindow *parent;
MetaRectangle parent_rect;
@@ -820,25 +820,24 @@ constrain_custom_rule (MetaWindow *window,
if (check_only)
return constraint_satisfied;
current_rule = g_new0 (MetaPlacementRule, 1);
*current_rule = *placement_rule;
current_rule = *placement_rule;
if (constraint_satisfied)
goto done;
if (info->current.width != intersection.width &&
(current_rule->constraint_adjustment &
(current_rule.constraint_adjustment &
META_PLACEMENT_CONSTRAINT_ADJUSTMENT_FLIP_X))
{
try_flip_window_position (window, info, current_rule,
try_flip_window_position (window, info, &current_rule,
META_PLACEMENT_CONSTRAINT_ADJUSTMENT_FLIP_X,
&info->current, &intersection);
}
if (info->current.height != intersection.height &&
(current_rule->constraint_adjustment &
(current_rule.constraint_adjustment &
META_PLACEMENT_CONSTRAINT_ADJUSTMENT_FLIP_Y))
{
try_flip_window_position (window, info, current_rule,
try_flip_window_position (window, info, &current_rule,
META_PLACEMENT_CONSTRAINT_ADJUSTMENT_FLIP_Y,
&info->current, &intersection);
}
@@ -852,7 +851,7 @@ constrain_custom_rule (MetaWindow *window,
if (constraint_satisfied)
goto done;
if (current_rule->constraint_adjustment &
if (current_rule.constraint_adjustment &
META_PLACEMENT_CONSTRAINT_ADJUSTMENT_SLIDE_X)
{
if (info->current.x != intersection.x)
@@ -860,7 +859,7 @@ constrain_custom_rule (MetaWindow *window,
else if (info->current.width != intersection.width)
info->current.x -= info->current.width - intersection.width;
}
if (current_rule->constraint_adjustment &
if (current_rule.constraint_adjustment &
META_PLACEMENT_CONSTRAINT_ADJUSTMENT_SLIDE_Y)
{
if (info->current.y != intersection.y)
@@ -878,13 +877,13 @@ constrain_custom_rule (MetaWindow *window,
if (constraint_satisfied)
goto done;
if (current_rule->constraint_adjustment &
if (current_rule.constraint_adjustment &
META_PLACEMENT_CONSTRAINT_ADJUSTMENT_RESIZE_X)
{
info->current.x = intersection.x;
info->current.width = intersection.width;
}
if (current_rule->constraint_adjustment &
if (current_rule.constraint_adjustment &
META_PLACEMENT_CONSTRAINT_ADJUSTMENT_RESIZE_Y)
{
info->current.y = intersection.y;

View File

@@ -496,6 +496,8 @@ meta_workspace_manager_override_workspace_layout (MetaWorkspaceManager *workspac
int n_rows,
int n_columns)
{
workspace_manager->workspace_layout_overridden = FALSE;
meta_workspace_manager_update_workspace_layout (workspace_manager,
starting_corner,
vertical_layout,

View File

@@ -418,7 +418,7 @@ meta_wayland_tablet_tool_new (MetaWaylandTabletSeat *seat,
tool->focus_surface_destroy_listener.notify = tablet_tool_handle_focus_surface_destroy;
tool->cursor_surface_destroy_listener.notify = tablet_tool_handle_cursor_surface_destroy;
tool->default_sprite = meta_cursor_sprite_xcursor_new (META_CURSOR_CROSSHAIR);
tool->default_sprite = meta_cursor_sprite_xcursor_new (META_CURSOR_DEFAULT);
tool->prepare_at_signal_id =
g_signal_connect (tool->default_sprite, "prepare-at",
G_CALLBACK (tool_cursor_prepare_at), tool);

View File

@@ -503,7 +503,8 @@ text_input_commit_state (struct wl_client *client,
clutter_input_method_focus_out (input_method);
}
}
else if (!clutter_input_focus_is_focused (focus))
if (!clutter_input_focus_is_focused (focus))
return;
if (text_input->pending_state & META_WAYLAND_PENDING_STATE_CONTENT_TYPE)

View File

@@ -651,10 +651,7 @@ reload_wm_name (MetaWindow *window,
if (value->type != META_PROP_VALUE_INVALID)
{
g_autofree gchar *title = g_convert (value->v.str, -1,
"UTF-8", "LATIN1",
NULL, NULL, NULL);
set_window_title (window, title);
set_window_title (window, value->v.str);
meta_verbose ("Using WM_NAME for new title of %s: \"%s\"\n",
window->desc, window->title);

View File

@@ -639,6 +639,7 @@ text_property_to_utf8 (Display *xdisplay,
{
char *ret = NULL;
char **local_list = NULL;
const char *charset = NULL;
int count = 0;
int res;
@@ -649,7 +650,10 @@ text_property_to_utf8 (Display *xdisplay,
if (count == 0)
goto out;
ret = g_strdup (local_list[0]);
if (g_get_charset (&charset))
ret = g_strdup (local_list[0]);
else
ret = g_convert (local_list[0], -1, "UTF-8", charset, NULL, NULL, NULL);
out:
XFreeStringList (local_list);