Compare commits

..

24 Commits

Author SHA1 Message Date
Carlos Garnacho
74be2e9f94 wayland: Implement wl_pointer.axis_source/axis_stop/axis_frame emission
As per the spec. wl_pointer.axis_source determines the current source of
scroll events, wl_pointer.axis_stop determines when there's no further
scroll events on any axis (Which Clutter sends as dx/dy=0 events).
wl_pointer.axis_frame marks the end of a series of axis_* events.

v2: Updated to v4 of the protocol spec by
    Peter Hutterer <peter.hutterer@who-t.net>
v3: Update to use Clutter API
2015-10-23 16:21:25 +02:00
Carlos Garnacho
a5d2555196 wayland: Make it possible to trigger popups through pointer/keyboard/touch
Right now we just check the pointer serial, so the popup will be
immediately dismissed if the client passes a serial corresponding to
another input device.

Abstract this a bit further and add a meta_wayland_seat_can_popup() call
that will check the serial all input devices. This makes it possible to
trigger menus through touch or keyboard devices.

https://bugzilla.gnome.org/show_bug.cgi?id=756296
2015-10-17 18:52:52 +02:00
Carlos Garnacho
dd5a4ecdf9 wayland: Store key press/release serials on MetaWaylandKeyboard
https://bugzilla.gnome.org/show_bug.cgi?id=756296
2015-10-17 18:52:15 +02:00
Rui Matos
43a1d43f2b monitor-manager-xrandr: Be more robust when reading XRROutputInfos
We might get modes in XRROutputInfos that aren't in the
XRRScreenResources we get earlier. This always seems to be transient,
i.e. when it happens, the X server will usually send us a follow up
RRScreenChangeNotify where we then get a "stable" view of the world
again.

In any case, when these glitches happen, we end up with NULL pointers
in the MetaOutput->modes array which makes us crash later on. This
patch ensures that doesn't happen.

https://bugzilla.gnome.org/show_bug.cgi?id=756660
2015-10-16 13:57:26 +02:00
Jonas Ådahl
d6d377a447 wayland: Set the xdg_popup pointer even when not mapping
If we immediately dismiss the popup, we still need to set the
surface->xdg_popup pointer field in order for the destructor to
properly clean up the state. Not doing this may cause a crash if the
xdg_popup resource that was immediately dismissed is destoryed after
wl_surface during client destruction.

https://bugzilla.gnome.org/show_bug.cgi?id=756675
2015-10-16 11:31:51 +08:00
Florian Müllner
ffd95c2ad5 theme: Complete removal of "fringe" titlebar button support
We have been ignoring those buttons since 3.16 after they had been
broken in the default theme for a couple of versions. As nobody
appears to miss them, it's time to remove them for good.
2015-10-16 04:13:14 +02:00
Florian Müllner
72be89dfb9 theme: Reset button style state when done drawing
We use a single style context to draw titlebar buttons, updating
its state according to each button's prelight state as necessary.
This assumes that the original state is neither ACTIVE nor PRELIGHT,
which means we need to reset the state after drawing to avoid
propagating the state of the last-drawn button.
2015-10-16 04:04:34 +02:00
Florian Müllner
2feeb57dee iconcache: Mark surfaces as dirty after changing data
This is required to tell cairo to update its cached areas.
2015-10-16 04:04:31 +02:00
Florian Müllner
9c81b718f9 Bump version to 3.18.1
Update NEWS.
2015-10-15 19:06:54 +02:00
Florian Müllner
3a63d58d9e events: Don't use XIEvent serial numbers
XInput2 uses the raw sequence number for XIEvent serials[0], which only
matches the serial number in XEvents up to 16 bits[1]. So in order to
be able to make reliable comparisons with serials from other events or
calls to XNextRequest(), always use the field from the original XEvent
rather than the XIEvent serial (at least until we can get libXi fixed).

This (partially) reverts commit 35dd1e644d.

[0] http://cgit.freedesktop.org/xorg/lib/libXi/commit?id=5d43d4914dcabb6d
[1] http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/XlibInt.c#n265

https://bugzilla.gnome.org/show_bug.cgi?id=756649
2015-10-15 18:50:51 +02:00
Florian Müllner
a95ae4d178 session: Fix crash when saving sticky windows
Since commit 527c53a2a0, window->workspace is set to %NULL when
the window is sticky (see comment[0]), so don't try to save the
workspace index in that case.

[0] https://git.gnome.org/browse/mutter/tree/src/core/window.c#n4307

https://bugzilla.gnome.org/show_bug.cgi?id=756642
2015-10-15 16:30:43 +02:00
Cosimo Cecchi
a692fd3808 compositor: add hooks for fullscreen and unfullscreen animations
https://bugzilla.gnome.org/show_bug.cgi?id=707248
2015-10-12 22:28:30 -04:00
Cosimo Cecchi
377ecdb864 compositor: pass correct parameter to meta_window_actor_size_change()
We were always passing the parameter for a maximize animation.
2015-10-12 15:39:51 -04:00
Owen W. Taylor
d7f544f42e META_DEBUG_STACK: Fix message about the dumped window order
A change in the code made the windows list bottom-to-top instead
of top-to-bottom, but the message printed out still said
"Top to bottom."
2015-10-12 09:52:25 -04:00
Owen W. Taylor
1ab8b854df Improve debug logging of Wayland windows
Displaying all Wayland windows with the XID of 0x0 makes it hard
to figure out what is going on ... use the recently-added
window->stamp to show Wayland windows as W1/W2/W3...
2015-10-12 09:52:25 -04:00
Owen W. Taylor
ae7aabd5de Protect against stray calls to meta_display_end_grab_op()
If end_grab_op() is called when there's a "compositor grab"
rather than a grab op is in effect, silently return.

https://bugzilla.gnome.org/show_bug.cgi?id=745785
2015-10-12 09:50:48 -04:00
Jasper St. Pierre
b975676c5d window-actor: Draw shadows around some CSD windows
Some windows, like Chromium and Steam, are technically CSD in that they
don't want a system titlebar and draw their own, but we should still
provide them with a shadow.
2015-10-07 12:09:30 -07:00
Florian Müllner
86d8c3954f theme: Stop hiding titlebar buttons in dialogs
As design patterns have evolved, dialogs that use CSD do use titlebar
buttons, so it's time to re-enable them for SSD as well.

https://bugzilla.gnome.org/show_bug.cgi?id=641630
2015-10-07 16:09:17 +02:00
Rui Matos
54557f062e xprops: Fix reading Window and XSyncCounter properties
Both Window and XSyncCounter are XIDs which on 64 bit X clients are 8
bytes wide. But the values on the wire are 32 bit so, for these types,
we always copy 4 bytes into results->prop. As such copying them out
with a cast such as *(Window *) means that we are actually reading 8
bytes which depending on whether the higher addressed 4 bytes are zero
means that sometimes this works while others it gives us a bogus
value.

https://bugzilla.gnome.org/show_bug.cgi?id=756074
2015-10-06 22:33:42 +02:00
Jonas Ådahl
130807a308 wayland: Don't pre-multiply root cursor sizes with primary monitor scale
We cannot use the XSETTINGS value for cursor theme size because
gnome-settings-daemon already multiplies it by the primary monitor's
scale.

https://bugzilla.gnome.org/show_bug.cgi?id=755099
2015-10-04 14:17:14 +08:00
Jonas Ådahl
e84f694668 wayland: Don't scale XWayland pointer cursor sprites
We don't have any way of knowing what the intended size of a XWayland
cursor is supposed to be, so lets do what we do with regular XWayland
surfaces and don't scale them. The result is that cursor sprites of
HiDPI aware X11 clients will show correctly, but non-aware clients may
have tiny cursor sprites.

https://bugzilla.gnome.org/show_bug.cgi?id=755099
2015-10-04 14:17:14 +08:00
Carlos Garnacho
b18542f2b6 wayland: Avoid resending new data offers on intra-client focus changes
Each keyboard focus change ends up calling the MetaWaylandDataDevice
counterpart, we don't need though to notify the current selection
again. In order to fix this, keep track of the current client, and
only emit the relevant signals when the focus switches to another
client.

The situations where wl_data_device.selection were emitted during
focus changes between surfaces of the same client was inocuous most
of the times, although it's prone to inducing confusing behavior
on context menu clipboard actions, as the closing menu triggers a
focus change, which triggers a whole new wl_data_offer being created
and given on wl_data_device.selection, at a time where there's already
ongoing requests on the previous data offer.

https://bugzilla.gnome.org/show_bug.cgi?id=754357
2015-10-02 12:21:17 +02:00
Carlos Garnacho
da0aac665f xwayland: Protect against crash on x11->wayland transfer cancellation
If the transfer is cancelled, the X11SelectionData will be cleared from
the MetaSelectionBridge, although x11_data_write_cb() was invariably
expecting it to be non-NULL.

If the write was cancelled, all the actions done in x11_data_write_cb()
are moot, so just return early. If there's other errors happening
(eg. "connection closed" if the target client happens to crash), we
should still attempt at clearing the data anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=754357
2015-10-02 12:21:17 +02:00
Jonas Ådahl
8b0b0cf028 MetaWaylandSurface: Don't assume a toplevel always have a MetaWindow
When committing a toplevel surface we might no longer have a MetaWindow
associated with it. The reason may vary but some are: a popup was
dismissed, the client attached and committed a NULL buffer to a
wl_surface with the wl_shell_surface role, the client committed a
buffer to a wl_surface which previously had an toplevel window role
which extension object was destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=755490
2015-09-29 09:09:57 +08:00
35 changed files with 325 additions and 932 deletions

14
NEWS
View File

@@ -1,3 +1,17 @@
3.18.1
======
* Misc. crash fixes [Jonas, Rui, Carlos, Owen, Florian; #755096, #754979,
#755490, #754357, #745785, #756642]
* Improve HiDPI support on wayland [Jonas; #755097]
* Fix doubly-scaled cursor on XWayland HiDPI [Jonas; #755099]
* Stop hiding titlebar buttons in dialogs [Florian; #641630]
* Add support for fullscreen/unfullscreen animations [Cosimo; #707248]
* Misc. bug fixes [Rui, Colin, Florian; #743339, #752047, #756074, #756649]
Contributors:
Jonas Ådahl, Cosimo Cecchi, Carlos Garnacho, Rui Matos, Florian Müllner,
Jasper St. Pierre, Colin Walters, Owen W. Taylor
3.18.0
======
* Misc. fixes [Florian, Jonas; #753434]

View File

@@ -2,7 +2,7 @@ AC_PREREQ(2.62)
m4_define([mutter_major_version], [3])
m4_define([mutter_minor_version], [18])
m4_define([mutter_micro_version], [0])
m4_define([mutter_micro_version], [1])
m4_define([mutter_version],
[mutter_major_version.mutter_minor_version.mutter_micro_version])

View File

@@ -637,6 +637,32 @@ output_get_connector_type (MetaMonitorManagerXrandr *manager_xrandr,
return META_CONNECTOR_TYPE_Unknown;
}
static void
output_get_modes (MetaMonitorManager *manager,
MetaOutput *meta_output,
XRROutputInfo *output)
{
guint j, k;
guint n_actual_modes;
meta_output->modes = g_new0 (MetaMonitorMode *, output->nmode);
n_actual_modes = 0;
for (j = 0; j < (guint)output->nmode; j++)
{
for (k = 0; k < manager->n_modes; k++)
{
if (output->modes[j] == (XID)manager->modes[k].mode_id)
{
meta_output->modes[n_actual_modes] = &manager->modes[k];
n_actual_modes += 1;
break;
}
}
}
meta_output->n_modes = n_actual_modes;
}
static char *
get_xmode_name (XRRModeInfo *xmode)
{
@@ -773,6 +799,8 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
MetaOutput *meta_output;
output = XRRGetOutputInfo (manager_xrandr->xdisplay, resources, resources->outputs[i]);
if (!output)
continue;
meta_output = &manager->outputs[n_actual_outputs];
@@ -796,19 +824,7 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
meta_output->connector_type = output_get_connector_type (manager_xrandr, meta_output);
output_get_tile_info (manager_xrandr, meta_output);
meta_output->n_modes = output->nmode;
meta_output->modes = g_new0 (MetaMonitorMode *, meta_output->n_modes);
for (j = 0; j < meta_output->n_modes; j++)
{
for (k = 0; k < manager->n_modes; k++)
{
if (output->modes[j] == (XID)manager->modes[k].mode_id)
{
meta_output->modes[j] = &manager->modes[k];
break;
}
}
}
output_get_modes (manager, meta_output, output);
meta_output->preferred_mode = meta_output->modes[0];
meta_output->n_possible_crtcs = output->ncrtc;

View File

@@ -779,7 +779,7 @@ meta_compositor_size_change_window (MetaCompositor *compositor,
MetaRectangle *old_buffer_rect)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
meta_window_actor_size_change (window_actor, META_SIZE_CHANGE_MAXIMIZE, old_frame_rect, old_buffer_rect);
meta_window_actor_size_change (window_actor, which_change, old_frame_rect, old_buffer_rect);
}
void

View File

@@ -832,21 +832,23 @@ meta_window_actor_has_shadow (MetaWindowActor *self)
return TRUE;
/*
* Do not add shadows to non-opaque windows; eventually we should generate
* a shadow from the input shape for such windows.
* Do not add shadows to non-opaque (ARGB32) windows, as we can't easily
* generate shadows for them.
*/
if (is_non_opaque (self))
return FALSE;
/*
* Add shadows to override redirect windows on X11 unless the toolkit
* indicates that it is handling shadows itself (e.g., Gtk menus).
* If a window specifies that it has custom frame extents, that likely
* means that it is drawing a shadow itself. Don't draw our own.
*/
if (priv->window->override_redirect &&
!priv->window->has_custom_frame_extents)
return TRUE;
if (priv->window->has_custom_frame_extents)
return FALSE;
return FALSE;
/*
* Generate shadows for all other windows.
*/
return TRUE;
}
/**

View File

@@ -1963,9 +1963,12 @@ meta_display_end_grab_op (MetaDisplay *display,
meta_topic (META_DEBUG_WINDOW_OPS,
"Ending grab op %u at time %u\n", grab_op, timestamp);
if (display->event_route == META_EVENT_ROUTE_NORMAL)
if (display->event_route == META_EVENT_ROUTE_NORMAL ||
display->event_route == META_EVENT_ROUTE_COMPOSITOR_GRAB)
return;
g_assert (grab_window != NULL);
g_signal_emit (display, display_signals[GRAB_OP_END], 0,
display->screen, grab_window, grab_op);

View File

@@ -96,6 +96,10 @@ static gboolean bell_is_audible = TRUE;
static gboolean gnome_accessibility = FALSE;
static gboolean gnome_animations = TRUE;
static char *cursor_theme = NULL;
/* cursor_size will, when running as an X11 compositing window manager, be the
* actual cursor size, multiplied with the global window scaling factor. On
* Wayland, it will be the actual cursor size retrieved from gsettings.
*/
static int cursor_size = 24;
static int draggable_border_width = 10;
static int drag_threshold;
@@ -123,6 +127,9 @@ static gboolean update_binding (MetaKeyPref *binding,
static gboolean update_key_binding (const char *key,
gchar **strokes);
static void wayland_settings_changed (GSettings *settings,
gchar *key,
gpointer data);
static void settings_changed (GSettings *settings,
gchar *key,
gpointer data);
@@ -134,9 +141,10 @@ static void shell_shows_app_menu_changed (GtkSettings *settings,
GParamSpec *pspec,
gpointer data);
static void update_cursor_size (GtkSettings *settings,
GParamSpec *pspec,
gpointer data);
static void update_cursor_size_from_gtk (GtkSettings *settings,
GParamSpec *pspec,
gpointer data);
static void update_cursor_size (void);
static void queue_changed (MetaPreference pref);
@@ -963,14 +971,18 @@ meta_prefs_init (void)
G_CALLBACK (settings_changed), NULL);
g_signal_connect (settings, "changed::" KEY_GNOME_CURSOR_THEME,
G_CALLBACK (settings_changed), NULL);
if (meta_is_wayland_compositor ())
g_signal_connect (settings, "changed::cursor-size",
G_CALLBACK (wayland_settings_changed), NULL);
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings);
g_signal_connect (gtk_settings_get_default (),
"notify::gtk-shell-shows-app-menu",
G_CALLBACK (shell_shows_app_menu_changed), NULL);
g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size",
G_CALLBACK (update_cursor_size), NULL);
if (!meta_is_wayland_compositor ())
g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size",
G_CALLBACK (update_cursor_size_from_gtk), NULL);
settings = g_settings_new (SCHEMA_INPUT_SOURCES);
g_signal_connect (settings, "changed::" KEY_XKB_OPTIONS,
@@ -992,7 +1004,7 @@ meta_prefs_init (void)
handle_preference_init_string_array ();
handle_preference_init_int ();
update_cursor_size (gtk_settings_get_default (), NULL, NULL);
update_cursor_size ();
shell_shows_app_menu_changed (gtk_settings_get_default (), NULL, NULL);
init_bindings ();
@@ -1133,6 +1145,20 @@ meta_prefs_override_preference_schema (const char *key, const char *schema)
/****************************************************************************/
static void
wayland_settings_changed (GSettings *settings,
gchar *key,
gpointer data)
{
GVariant *value = g_settings_get_value (settings, key);
const GVariantType *type = g_variant_get_type (value);
g_return_if_fail (g_variant_type_equal (type, G_VARIANT_TYPE_INT32));
g_return_if_fail (g_str_equal (key, "cursor-size"));
update_cursor_size ();
}
static void
settings_changed (GSettings *settings,
gchar *key,
@@ -1216,9 +1242,29 @@ shell_shows_app_menu_changed (GtkSettings *settings,
}
static void
update_cursor_size (GtkSettings *settings,
GParamSpec *pspec,
gpointer data)
update_cursor_size (void)
{
if (meta_is_wayland_compositor ())
{
/* When running as a Wayland compositor, since we size of the cursor
* depends on what output it is on, we cannot use the GTK+
* "gtk-cursor-theme-size" setting because it has already been multiplied
* by the primary monitor scale. So, instead get the non-premultiplied
* cursor size value directly from gsettings instead.
*/
cursor_size =
g_settings_get_int (SETTINGS (SCHEMA_INTERFACE), "cursor-size");
}
else
{
update_cursor_size_from_gtk (gtk_settings_get_default (), NULL, NULL);
}
}
static void
update_cursor_size_from_gtk (GtkSettings *settings,
GParamSpec *pspec,
gpointer data)
{
GdkScreen *screen = gdk_screen_get_default ();
GValue value = G_VALUE_INIT;
@@ -1431,42 +1477,11 @@ button_function_from_string (const char *str)
return META_BUTTON_FUNCTION_MAXIMIZE;
else if (strcmp (str, "close") == 0)
return META_BUTTON_FUNCTION_CLOSE;
else if (strcmp (str, "shade") == 0)
return META_BUTTON_FUNCTION_SHADE;
else if (strcmp (str, "above") == 0)
return META_BUTTON_FUNCTION_ABOVE;
else if (strcmp (str, "stick") == 0)
return META_BUTTON_FUNCTION_STICK;
else
/* don't know; give up */
return META_BUTTON_FUNCTION_LAST;
}
static MetaButtonFunction
button_opposite_function (MetaButtonFunction ofwhat)
{
switch (ofwhat)
{
case META_BUTTON_FUNCTION_SHADE:
return META_BUTTON_FUNCTION_UNSHADE;
case META_BUTTON_FUNCTION_UNSHADE:
return META_BUTTON_FUNCTION_SHADE;
case META_BUTTON_FUNCTION_ABOVE:
return META_BUTTON_FUNCTION_UNABOVE;
case META_BUTTON_FUNCTION_UNABOVE:
return META_BUTTON_FUNCTION_ABOVE;
case META_BUTTON_FUNCTION_STICK:
return META_BUTTON_FUNCTION_UNSTICK;
case META_BUTTON_FUNCTION_UNSTICK:
return META_BUTTON_FUNCTION_STICK;
default:
return META_BUTTON_FUNCTION_LAST;
}
}
static gboolean
button_layout_handler (GVariant *value,
gpointer *result,
@@ -1510,12 +1525,6 @@ button_layout_handler (GVariant *value,
if (i > 0 && strcmp("spacer", buttons[b]) == 0)
{
new_layout.left_buttons_has_spacer[i-1] = TRUE;
f = button_opposite_function (f);
if (f != META_BUTTON_FUNCTION_LAST)
{
new_layout.left_buttons_has_spacer[i-2] = TRUE;
}
}
else
{
@@ -1524,11 +1533,6 @@ button_layout_handler (GVariant *value,
new_layout.left_buttons[i] = f;
used[f] = TRUE;
++i;
f = button_opposite_function (f);
if (f != META_BUTTON_FUNCTION_LAST)
new_layout.left_buttons[i++] = f;
}
else
{
@@ -1572,11 +1576,6 @@ button_layout_handler (GVariant *value,
if (i > 0 && strcmp("spacer", buttons[b]) == 0)
{
new_layout.right_buttons_has_spacer[i-1] = TRUE;
f = button_opposite_function (f);
if (f != META_BUTTON_FUNCTION_LAST)
{
new_layout.right_buttons_has_spacer[i-2] = TRUE;
}
}
else
{
@@ -1585,12 +1584,6 @@ button_layout_handler (GVariant *value,
new_layout.right_buttons[i] = f;
used[f] = TRUE;
++i;
f = button_opposite_function (f);
if (f != META_BUTTON_FUNCTION_LAST)
new_layout.right_buttons[i++] = f;
}
else
{

View File

@@ -1055,7 +1055,7 @@ stack_sync_to_xserver (MetaStack *stack)
all_root_children_stacked = g_array_new (FALSE, FALSE, sizeof (guint64));
x11_hidden_stack_ids = g_array_new (FALSE, FALSE, sizeof (guint64));
meta_topic (META_DEBUG_STACK, "Top to bottom: ");
meta_topic (META_DEBUG_STACK, "Bottom to top: ");
meta_push_no_msg_prefix ();
for (tmp = g_list_last(stack->sorted); tmp != NULL; tmp = tmp->prev)

View File

@@ -763,10 +763,22 @@ meta_window_update_desc (MetaWindow *window)
{
g_clear_pointer (&window->desc, g_free);
if (window->title)
window->desc = g_strdup_printf ("0x%lx (%.10s)", window->xwindow, window->title);
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
{
if (window->title)
window->desc = g_strdup_printf ("0x%lx (%.10s)", window->xwindow, window->title);
else
window->desc = g_strdup_printf ("0x%lx", window->xwindow);
}
else
window->desc = g_strdup_printf ("0x%lx", window->xwindow);
{
guint64 small_stamp = window->stamp - G_GUINT64_CONSTANT(0x100000000);
if (window->title)
window->desc = g_strdup_printf ("W%" G_GUINT64_FORMAT " (%.10s)", small_stamp, window->title);
else
window->desc = g_strdup_printf ("W%" G_GUINT64_FORMAT , small_stamp);
}
}
static void
@@ -3183,12 +3195,23 @@ meta_window_make_fullscreen (MetaWindow *window)
if (!window->fullscreen)
{
meta_window_make_fullscreen_internal (window);
MetaRectangle old_frame_rect, old_buffer_rect;
meta_window_get_frame_rect (window, &old_frame_rect);
meta_window_get_buffer_rect (window, &old_buffer_rect);
meta_window_make_fullscreen_internal (window);
meta_window_move_resize_internal (window,
META_MOVE_RESIZE_MOVE_ACTION | META_MOVE_RESIZE_RESIZE_ACTION | META_MOVE_RESIZE_STATE_CHANGED,
(META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_STATE_CHANGED |
META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR),
NorthWestGravity,
window->unconstrained_rect);
meta_compositor_size_change_window (window->display->compositor,
window, META_SIZE_CHANGE_FULLSCREEN,
&old_frame_rect, &old_buffer_rect);
}
}
@@ -3199,7 +3222,7 @@ meta_window_unmake_fullscreen (MetaWindow *window)
if (window->fullscreen)
{
MetaRectangle target_rect;
MetaRectangle old_frame_rect, old_buffer_rect, target_rect;
meta_topic (META_DEBUG_WINDOW_OPS,
"Unfullscreening %s\n", window->desc);
@@ -3208,6 +3231,8 @@ meta_window_unmake_fullscreen (MetaWindow *window)
target_rect = window->saved_rect;
meta_window_frame_size_changed (window);
meta_window_get_frame_rect (window, &old_frame_rect);
meta_window_get_buffer_rect (window, &old_buffer_rect);
/* Window's size hints may have changed while maximized, making
* saved_rect invalid. #329152
@@ -3222,10 +3247,17 @@ meta_window_unmake_fullscreen (MetaWindow *window)
set_net_wm_state (window);
meta_window_move_resize_internal (window,
META_MOVE_RESIZE_MOVE_ACTION | META_MOVE_RESIZE_RESIZE_ACTION | META_MOVE_RESIZE_STATE_CHANGED,
(META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_STATE_CHANGED |
META_MOVE_RESIZE_DONT_SYNC_COMPOSITOR),
NorthWestGravity,
target_rect);
meta_compositor_size_change_window (window->display->compositor,
window, META_SIZE_CHANGE_UNFULLSCREEN,
&old_frame_rect, &old_buffer_rect);
meta_window_update_layer (window);
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_FULLSCREEN]);

View File

@@ -372,12 +372,6 @@ typedef enum
* @META_BUTTON_FUNCTION_MINIMIZE: Minimize
* @META_BUTTON_FUNCTION_MAXIMIZE: Maximize
* @META_BUTTON_FUNCTION_CLOSE: Close
* @META_BUTTON_FUNCTION_SHADE: Shade
* @META_BUTTON_FUNCTION_ABOVE: Above
* @META_BUTTON_FUNCTION_STICK: Stick
* @META_BUTTON_FUNCTION_UNSHADE: Unshade
* @META_BUTTON_FUNCTION_UNABOVE: Unabove
* @META_BUTTON_FUNCTION_UNSTICK: Unstick
* @META_BUTTON_FUNCTION_LAST: Marks the end of the #MetaButtonFunction enumeration
*
* Function a window button can have. Note, you can't add stuff here
@@ -390,12 +384,6 @@ typedef enum
META_BUTTON_FUNCTION_MINIMIZE,
META_BUTTON_FUNCTION_MAXIMIZE,
META_BUTTON_FUNCTION_CLOSE,
META_BUTTON_FUNCTION_SHADE,
META_BUTTON_FUNCTION_ABOVE,
META_BUTTON_FUNCTION_STICK,
META_BUTTON_FUNCTION_UNSHADE,
META_BUTTON_FUNCTION_UNABOVE,
META_BUTTON_FUNCTION_UNSTICK,
META_BUTTON_FUNCTION_APPMENU,
META_BUTTON_FUNCTION_LAST
} MetaButtonFunction;
@@ -405,10 +393,10 @@ typedef enum
/* Keep array size in sync with MAX_BUTTONS_PER_CORNER */
/**
* MetaButtonLayout:
* @left_buttons: (array fixed-size=11):
* @right_buttons: (array fixed-size=11):
* @left_buttons_has_spacer: (array fixed-size=11):
* @right_buttons_has_spacer: (array fixed-size=11):
* @left_buttons: (array fixed-size=5):
* @right_buttons: (array fixed-size=5):
* @left_buttons_has_spacer: (array fixed-size=5):
* @right_buttons_has_spacer: (array fixed-size=5):
*/
typedef struct _MetaButtonLayout MetaButtonLayout;
struct _MetaButtonLayout

View File

@@ -57,6 +57,8 @@ typedef enum
typedef enum {
META_SIZE_CHANGE_MAXIMIZE,
META_SIZE_CHANGE_UNMAXIMIZE,
META_SIZE_CHANGE_FULLSCREEN,
META_SIZE_CHANGE_UNFULLSCREEN,
} MetaSizeChange;
MetaCompositor *meta_compositor_new (MetaDisplay *display);

View File

@@ -970,12 +970,6 @@ meta_frame_left_click_event (MetaUIFrame *frame,
case META_FRAME_CONTROL_UNMAXIMIZE:
case META_FRAME_CONTROL_MINIMIZE:
case META_FRAME_CONTROL_DELETE:
case META_FRAME_CONTROL_SHADE:
case META_FRAME_CONTROL_UNSHADE:
case META_FRAME_CONTROL_ABOVE:
case META_FRAME_CONTROL_UNABOVE:
case META_FRAME_CONTROL_STICK:
case META_FRAME_CONTROL_UNSTICK:
case META_FRAME_CONTROL_MENU:
case META_FRAME_CONTROL_APPMENU:
frame->grab_button = event->button;
@@ -1154,24 +1148,6 @@ handle_button_release_event (MetaUIFrame *frame,
case META_FRAME_CONTROL_DELETE:
meta_window_delete (frame->meta_window, event->time);
break;
case META_FRAME_CONTROL_SHADE:
meta_window_shade (frame->meta_window, event->time);
break;
case META_FRAME_CONTROL_UNSHADE:
meta_window_unshade (frame->meta_window, event->time);
break;
case META_FRAME_CONTROL_ABOVE:
meta_window_make_above (frame->meta_window);
break;
case META_FRAME_CONTROL_UNABOVE:
meta_window_unmake_above (frame->meta_window);
break;
case META_FRAME_CONTROL_STICK:
meta_window_stick (frame->meta_window);
break;
case META_FRAME_CONTROL_UNSTICK:
meta_window_unstick (frame->meta_window);
break;
default:
break;
}
@@ -1220,18 +1196,6 @@ meta_ui_frame_update_prelit_control (MetaUIFrame *frame,
break;
case META_FRAME_CONTROL_UNMAXIMIZE:
break;
case META_FRAME_CONTROL_SHADE:
break;
case META_FRAME_CONTROL_UNSHADE:
break;
case META_FRAME_CONTROL_ABOVE:
break;
case META_FRAME_CONTROL_UNABOVE:
break;
case META_FRAME_CONTROL_STICK:
break;
case META_FRAME_CONTROL_UNSTICK:
break;
case META_FRAME_CONTROL_RESIZE_SE:
cursor = META_CURSOR_SE_RESIZE;
break;
@@ -1270,12 +1234,6 @@ meta_ui_frame_update_prelit_control (MetaUIFrame *frame,
case META_FRAME_CONTROL_MINIMIZE:
case META_FRAME_CONTROL_MAXIMIZE:
case META_FRAME_CONTROL_DELETE:
case META_FRAME_CONTROL_SHADE:
case META_FRAME_CONTROL_UNSHADE:
case META_FRAME_CONTROL_ABOVE:
case META_FRAME_CONTROL_UNABOVE:
case META_FRAME_CONTROL_STICK:
case META_FRAME_CONTROL_UNSTICK:
case META_FRAME_CONTROL_UNMAXIMIZE:
/* leave control set */
break;
@@ -1487,24 +1445,6 @@ meta_ui_frame_paint (MetaUIFrame *frame,
case META_FRAME_CONTROL_UNMAXIMIZE:
button_type = META_BUTTON_TYPE_MAXIMIZE;
break;
case META_FRAME_CONTROL_SHADE:
button_type = META_BUTTON_TYPE_SHADE;
break;
case META_FRAME_CONTROL_UNSHADE:
button_type = META_BUTTON_TYPE_UNSHADE;
break;
case META_FRAME_CONTROL_ABOVE:
button_type = META_BUTTON_TYPE_ABOVE;
break;
case META_FRAME_CONTROL_UNABOVE:
button_type = META_BUTTON_TYPE_UNABOVE;
break;
case META_FRAME_CONTROL_STICK:
button_type = META_BUTTON_TYPE_STICK;
break;
case META_FRAME_CONTROL_UNSTICK:
button_type = META_BUTTON_TYPE_UNSTICK;
break;
case META_FRAME_CONTROL_DELETE:
button_type = META_BUTTON_TYPE_CLOSE;
break;
@@ -1624,24 +1564,6 @@ control_rect (MetaFrameControl control,
case META_FRAME_CONTROL_UNMAXIMIZE:
rect = &fgeom->max_rect.visible;
break;
case META_FRAME_CONTROL_SHADE:
rect = &fgeom->shade_rect.visible;
break;
case META_FRAME_CONTROL_UNSHADE:
rect = &fgeom->unshade_rect.visible;
break;
case META_FRAME_CONTROL_ABOVE:
rect = &fgeom->above_rect.visible;
break;
case META_FRAME_CONTROL_UNABOVE:
rect = &fgeom->unabove_rect.visible;
break;
case META_FRAME_CONTROL_STICK:
rect = &fgeom->stick_rect.visible;
break;
case META_FRAME_CONTROL_UNSTICK:
rect = &fgeom->unstick_rect.visible;
break;
case META_FRAME_CONTROL_RESIZE_SE:
break;
case META_FRAME_CONTROL_RESIZE_S:
@@ -1726,36 +1648,6 @@ get_control (MetaUIFrame *frame, int root_x, int root_y)
return META_FRAME_CONTROL_MAXIMIZE;
}
if (POINT_IN_RECT (x, y, fgeom.shade_rect.clickable))
{
return META_FRAME_CONTROL_SHADE;
}
if (POINT_IN_RECT (x, y, fgeom.unshade_rect.clickable))
{
return META_FRAME_CONTROL_UNSHADE;
}
if (POINT_IN_RECT (x, y, fgeom.above_rect.clickable))
{
return META_FRAME_CONTROL_ABOVE;
}
if (POINT_IN_RECT (x, y, fgeom.unabove_rect.clickable))
{
return META_FRAME_CONTROL_UNABOVE;
}
if (POINT_IN_RECT (x, y, fgeom.stick_rect.clickable))
{
return META_FRAME_CONTROL_STICK;
}
if (POINT_IN_RECT (x, y, fgeom.unstick_rect.clickable))
{
return META_FRAME_CONTROL_UNSTICK;
}
/* South resize always has priority over north resize,
* in case of overlap.
*/

View File

@@ -39,12 +39,6 @@ typedef enum
META_FRAME_CONTROL_MINIMIZE,
META_FRAME_CONTROL_MAXIMIZE,
META_FRAME_CONTROL_UNMAXIMIZE,
META_FRAME_CONTROL_SHADE,
META_FRAME_CONTROL_UNSHADE,
META_FRAME_CONTROL_ABOVE,
META_FRAME_CONTROL_UNABOVE,
META_FRAME_CONTROL_STICK,
META_FRAME_CONTROL_UNSTICK,
META_FRAME_CONTROL_RESIZE_SE,
META_FRAME_CONTROL_RESIZE_S,
META_FRAME_CONTROL_RESIZE_SW,

View File

@@ -115,7 +115,7 @@ struct _MetaFrameGeometry
/* used for a memset hack */
#define ADDRESS_OF_BUTTON_RECTS(fgeom) (((char*)(fgeom)) + G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, unstick_rect) + sizeof (MetaButtonSpace) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, appmenu_rect) + sizeof (MetaButtonSpace) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
/* The button rects (if changed adjust memset hack) */
MetaButtonSpace close_rect;
@@ -123,12 +123,6 @@ struct _MetaFrameGeometry
MetaButtonSpace min_rect;
MetaButtonSpace menu_rect;
MetaButtonSpace appmenu_rect;
MetaButtonSpace shade_rect;
MetaButtonSpace above_rect;
MetaButtonSpace stick_rect;
MetaButtonSpace unshade_rect;
MetaButtonSpace unabove_rect;
MetaButtonSpace unstick_rect;
/* End of button rects (if changed adjust memset hack) */
/* Saved button layout */
@@ -158,12 +152,6 @@ typedef enum
META_BUTTON_TYPE_MINIMIZE,
META_BUTTON_TYPE_MENU,
META_BUTTON_TYPE_APPMENU,
META_BUTTON_TYPE_SHADE,
META_BUTTON_TYPE_ABOVE,
META_BUTTON_TYPE_STICK,
META_BUTTON_TYPE_UNSHADE,
META_BUTTON_TYPE_UNABOVE,
META_BUTTON_TYPE_UNSTICK,
META_BUTTON_TYPE_LAST
} MetaButtonType;

View File

@@ -177,17 +177,6 @@ rect_for_function (MetaFrameGeometry *fgeom,
return &fgeom->close_rect;
else
return NULL;
case META_BUTTON_FUNCTION_STICK:
case META_BUTTON_FUNCTION_SHADE:
case META_BUTTON_FUNCTION_ABOVE:
case META_BUTTON_FUNCTION_UNSTICK:
case META_BUTTON_FUNCTION_UNSHADE:
case META_BUTTON_FUNCTION_UNABOVE:
/* Fringe buttons that used to be supported by theme versions >v1;
* if we want to support them again, we need to return the
* correspondings rects here
*/
return NULL;
case META_BUTTON_FUNCTION_LAST:
return NULL;
@@ -457,22 +446,10 @@ meta_frame_layout_calc_geometry (MetaFrameLayout *layout,
}
/* Otherwise we need to shave out a button. Shave
* above, stick, shade, min, max, close, then menu (menu is most useful);
* min, max, close, then menu (menu is most useful);
* prefer the default button locations.
*/
if (strip_button (left_func_rects, &n_left, &fgeom->above_rect))
continue;
else if (strip_button (right_func_rects, &n_right, &fgeom->above_rect))
continue;
else if (strip_button (left_func_rects, &n_left, &fgeom->stick_rect))
continue;
else if (strip_button (right_func_rects, &n_right, &fgeom->stick_rect))
continue;
else if (strip_button (left_func_rects, &n_left, &fgeom->shade_rect))
continue;
else if (strip_button (right_func_rects, &n_right, &fgeom->shade_rect))
continue;
else if (strip_button (left_func_rects, &n_left, &fgeom->min_rect))
if (strip_button (left_func_rects, &n_left, &fgeom->min_rect))
continue;
else if (strip_button (right_func_rects, &n_right, &fgeom->min_rect))
continue;
@@ -643,30 +620,6 @@ get_button_rect (MetaButtonType type,
*rect = fgeom->close_rect.visible;
break;
case META_BUTTON_TYPE_SHADE:
*rect = fgeom->shade_rect.visible;
break;
case META_BUTTON_TYPE_UNSHADE:
*rect = fgeom->unshade_rect.visible;
break;
case META_BUTTON_TYPE_ABOVE:
*rect = fgeom->above_rect.visible;
break;
case META_BUTTON_TYPE_UNABOVE:
*rect = fgeom->unabove_rect.visible;
break;
case META_BUTTON_TYPE_STICK:
*rect = fgeom->stick_rect.visible;
break;
case META_BUTTON_TYPE_UNSTICK:
*rect = fgeom->unstick_rect.visible;
break;
case META_BUTTON_TYPE_MAXIMIZE:
*rect = fgeom->max_rect.visible;
break;
@@ -890,6 +843,7 @@ meta_frame_layout_draw_with_style (MetaFrameLayout *layout,
cairo_restore (cr);
if (button_class)
gtk_style_context_remove_class (style, button_class);
gtk_style_context_set_state (style, state);
}
}
@@ -915,11 +869,9 @@ meta_theme_get_default (void)
switch (frame_type)
{
case META_FRAME_TYPE_NORMAL:
break;
case META_FRAME_TYPE_DIALOG:
case META_FRAME_TYPE_MODAL_DIALOG:
case META_FRAME_TYPE_ATTACHED:
layout->hide_buttons = TRUE;
break;
case META_FRAME_TYPE_MENU:
case META_FRAME_TYPE_UTILITY:

View File

@@ -42,18 +42,12 @@ struct _MetaWaylandDataOffer
struct wl_resource *resource;
MetaWaylandDataSource *source;
struct wl_listener source_destroy_listener;
uint32_t dnd_actions;
uint32_t preferred_dnd_action;
};
typedef struct _MetaWaylandDataSourcePrivate
{
MetaWaylandDataOffer *offer;
struct wl_array mime_types;
gboolean has_target;
uint32_t dnd_actions;
uint32_t user_dnd_action;
uint32_t current_dnd_action;
} MetaWaylandDataSourcePrivate;
typedef struct _MetaWaylandDataSourceWayland
@@ -80,50 +74,6 @@ unbind_resource (struct wl_resource *resource)
wl_list_remove (wl_resource_get_link (resource));
}
static uint32_t
data_offer_choose_action (MetaWaylandDataOffer *offer)
{
MetaWaylandDataSource *source = offer->source;
uint32_t actions, user_action, available_actions;
actions = meta_wayland_data_source_get_actions (source);
user_action = meta_wayland_data_source_get_user_action (source);
available_actions = actions & offer->dnd_actions;
if (!available_actions)
return 0;
/* If the user is forcing an action, go for it */
if ((user_action & available_actions) != 0)
return user_action;
/* If the dest side has a preferred DnD action, use it */
if ((offer->preferred_dnd_action & available_actions) != 0)
return offer->preferred_dnd_action;
/* Use the first found action, in bit order */
return 1 << (ffs (available_actions) - 1);
}
static void
data_offer_update_action (MetaWaylandDataOffer *offer)
{
uint32_t current_action, action;
if (!offer->source)
return;
current_action = meta_wayland_data_source_get_current_action (offer->source);
action = data_offer_choose_action (offer);
if (current_action == action)
return;
meta_wayland_data_source_set_current_action (offer->source, action);
wl_data_offer_send_action (offer->resource, action);
}
static void
meta_wayland_data_source_target (MetaWaylandDataSource *source,
const char *mime_type)
@@ -173,106 +123,6 @@ meta_wayland_data_source_cancel (MetaWaylandDataSource *source)
META_WAYLAND_DATA_SOURCE_GET_CLASS (source)->cancel (source);
}
uint32_t
meta_wayland_data_source_get_actions (MetaWaylandDataSource *source)
{
MetaWaylandDataSourcePrivate *priv =
meta_wayland_data_source_get_instance_private (source);
return priv->dnd_actions;
}
uint32_t
meta_wayland_data_source_get_user_action (MetaWaylandDataSource *source)
{
MetaWaylandDataSourcePrivate *priv =
meta_wayland_data_source_get_instance_private (source);
return priv->user_dnd_action;
}
uint32_t
meta_wayland_data_source_get_current_action (MetaWaylandDataSource *source)
{
MetaWaylandDataSourcePrivate *priv =
meta_wayland_data_source_get_instance_private (source);
return priv->current_dnd_action;
}
static void
meta_wayland_data_source_set_current_offer (MetaWaylandDataSource *source,
MetaWaylandDataOffer *offer)
{
MetaWaylandDataSourcePrivate *priv =
meta_wayland_data_source_get_instance_private (source);
priv->offer = offer;
}
static MetaWaylandDataOffer *
meta_wayland_data_source_get_current_offer (MetaWaylandDataSource *source)
{
MetaWaylandDataSourcePrivate *priv =
meta_wayland_data_source_get_instance_private (source);
return priv->offer;
}
void
meta_wayland_data_source_set_current_action (MetaWaylandDataSource *source,
uint32_t action)
{
MetaWaylandDataSourcePrivate *priv =
meta_wayland_data_source_get_instance_private (source);
if (priv->current_dnd_action == action)
return;
priv->current_dnd_action = action;
META_WAYLAND_DATA_SOURCE_GET_CLASS (source)->action (source, action);
}
void
meta_wayland_data_source_set_actions (MetaWaylandDataSource *source,
uint32_t dnd_actions)
{
MetaWaylandDataSourcePrivate *priv =
meta_wayland_data_source_get_instance_private (source);
MetaWaylandDataOffer *offer;
if (priv->dnd_actions == dnd_actions)
return;
priv->dnd_actions = dnd_actions;
offer = meta_wayland_data_source_get_current_offer (source);
if (offer)
{
wl_data_offer_send_source_actions (offer->resource,
priv->dnd_actions);
data_offer_update_action (offer);
}
}
static void
meta_wayland_data_source_set_user_action (MetaWaylandDataSource *source,
uint32_t action)
{
MetaWaylandDataSourcePrivate *priv =
meta_wayland_data_source_get_instance_private (source);
MetaWaylandDataOffer *offer;
if (priv->user_dnd_action == action)
return;
priv->user_dnd_action = action;
offer = meta_wayland_data_source_get_current_offer (source);
if (offer)
data_offer_update_action (offer);
}
static void
data_offer_accept (struct wl_client *client,
struct wl_resource *resource,
@@ -311,59 +161,21 @@ data_offer_destroy (struct wl_client *client, struct wl_resource *resource)
wl_resource_destroy (resource);
}
static void
data_offer_set_actions (struct wl_client *client,
struct wl_resource *resource,
uint32_t dnd_actions,
uint32_t preferred_action)
{
MetaWaylandDataOffer *offer = wl_resource_get_user_data (resource);
if (offer->dnd_actions == dnd_actions &&
offer->preferred_dnd_action == preferred_action)
return;
offer->dnd_actions = dnd_actions;
offer->preferred_dnd_action = preferred_action;
data_offer_update_action (offer);
}
static const struct wl_data_offer_interface data_offer_interface = {
data_offer_accept,
data_offer_receive,
data_offer_destroy,
data_offer_set_actions
};
static void
meta_wayland_data_source_notify_drop_performed (MetaWaylandDataSource *source)
{
META_WAYLAND_DATA_SOURCE_GET_CLASS (source)->drop_performed (source);
}
void
meta_wayland_data_source_notify_finish (MetaWaylandDataSource *source)
{
META_WAYLAND_DATA_SOURCE_GET_CLASS (source)->drag_finished (source);
}
static void
destroy_data_offer (struct wl_resource *resource)
{
MetaWaylandDataOffer *offer = wl_resource_get_user_data (resource);
if (offer->source)
{
if (offer == meta_wayland_data_source_get_current_offer (offer->source))
meta_wayland_data_source_notify_finish (offer->source);
g_object_remove_weak_pointer (G_OBJECT (offer->source),
(gpointer *)&offer->source);
g_object_remove_weak_pointer (G_OBJECT (offer->source),
(gpointer *)&offer->source);
offer->source = NULL;
}
meta_display_sync_wayland_input_focus (meta_get_display ());
g_slice_free (MetaWaylandDataOffer, offer);
}
@@ -391,9 +203,6 @@ meta_wayland_data_source_send_offer (MetaWaylandDataSource *source,
wl_array_for_each (p, &priv->mime_types)
wl_data_offer_send_offer (offer->resource, *p);
data_offer_update_action (offer);
meta_wayland_data_source_set_current_offer (source, offer);
return offer->resource;
}
@@ -413,27 +222,14 @@ data_source_destroy (struct wl_client *client, struct wl_resource *resource)
wl_resource_destroy (resource);
}
static void
data_source_set_actions (struct wl_client *client,
struct wl_resource *resource,
uint32_t dnd_actions)
{
MetaWaylandDataSource *source = wl_resource_get_user_data (resource);
meta_wayland_data_source_set_actions (source, dnd_actions);
}
static struct wl_data_source_interface data_source_interface = {
data_source_offer,
data_source_destroy,
data_source_set_actions
data_source_destroy
};
struct _MetaWaylandDragGrab {
MetaWaylandPointerGrab generic;
MetaWaylandKeyboardGrab keyboard_grab;
MetaWaylandSeat *seat;
struct wl_client *drag_client;
@@ -452,7 +248,6 @@ struct _MetaWaylandDragGrab {
struct wl_listener drag_origin_listener;
int drag_start_x, drag_start_y;
ClutterModifierType buttons;
};
static void
@@ -461,7 +256,6 @@ destroy_drag_focus (struct wl_listener *listener, void *data)
MetaWaylandDragGrab *grab = wl_container_of (listener, grab, drag_focus_listener);
grab->drag_focus_data_device = NULL;
grab->drag_focus = NULL;
}
void
@@ -491,7 +285,6 @@ meta_wayland_drag_grab_set_focus (MetaWaylandDragGrab *drag_grab,
client = wl_resource_get_client (surface->resource);
data_device_resource = wl_resource_find_for_client (&seat->data_device.resource_list, client);
meta_wayland_data_source_set_current_offer (drag_grab->drag_data_source, NULL);
if (drag_grab->drag_data_source && data_device_resource)
offer = meta_wayland_data_source_send_offer (drag_grab->drag_data_source,
@@ -519,22 +312,6 @@ drag_grab_focus (MetaWaylandPointerGrab *grab,
meta_wayland_drag_grab_set_focus (drag_grab, surface);
}
static void
data_source_update_user_dnd_action (MetaWaylandDataSource *source,
ClutterModifierType modifiers)
{
uint32_t user_dnd_action = 0;
if (modifiers & CLUTTER_SHIFT_MASK)
user_dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
else if (modifiers & CLUTTER_CONTROL_MASK)
user_dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
else if (modifiers & (CLUTTER_MOD1_MASK | CLUTTER_BUTTON2_MASK))
user_dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK;
meta_wayland_data_source_set_user_action (source, user_dnd_action);
}
static void
drag_grab_motion (MetaWaylandPointerGrab *grab,
const ClutterEvent *event)
@@ -579,15 +356,7 @@ data_device_end_drag_grab (MetaWaylandDragGrab *drag_grab)
drag_grab->seat->data_device.current_grab = NULL;
/* There might be other grabs created in result to DnD actions like popups
* on "ask" actions, we must not reset those, only our own.
*/
if (drag_grab->generic.pointer->grab == (MetaWaylandPointerGrab *) drag_grab)
{
meta_wayland_pointer_end_grab (drag_grab->generic.pointer);
meta_wayland_keyboard_end_grab (drag_grab->keyboard_grab.keyboard);
}
meta_wayland_pointer_end_grab (drag_grab->generic.pointer);
g_slice_free (MetaWaylandDragGrab, drag_grab);
}
@@ -602,23 +371,13 @@ drag_grab_button (MetaWaylandPointerGrab *grab,
if (drag_grab->generic.pointer->grab_button == clutter_event_get_button (event) &&
event_type == CLUTTER_BUTTON_RELEASE)
{
MetaWaylandDataSource *data_source = drag_grab->drag_data_source;
gboolean success = FALSE;
if (drag_grab->drag_focus &&
meta_wayland_data_source_get_current_action (drag_grab->drag_data_source) &&
meta_wayland_data_source_has_target (drag_grab->drag_data_source))
if (meta_wayland_data_source_has_target (drag_grab->drag_data_source))
{
meta_wayland_surface_drag_dest_drop (drag_grab->drag_focus);
meta_wayland_data_source_notify_drop_performed (data_source);
success = TRUE;
}
else
{
meta_wayland_data_source_cancel (data_source);
meta_wayland_data_source_set_current_offer (data_source, NULL);
meta_wayland_data_device_set_dnd_source (&drag_grab->seat->data_device, NULL);
}
/* Finish drag and let actor self-destruct */
meta_dnd_actor_drag_finish (META_DND_ACTOR (drag_grab->feedback_actor),
@@ -637,40 +396,6 @@ static const MetaWaylandPointerGrabInterface drag_grab_interface = {
drag_grab_button,
};
static gboolean
keyboard_drag_grab_key (MetaWaylandKeyboardGrab *grab,
const ClutterEvent *event)
{
return FALSE;
}
static void
keyboard_drag_grab_modifiers (MetaWaylandKeyboardGrab *grab,
ClutterModifierType modifiers)
{
MetaWaylandDragGrab *drag_grab;
drag_grab = wl_container_of (grab, drag_grab, keyboard_grab);
/* The modifiers here just contain keyboard modifiers, mix it with the
* mouse button modifiers we got when starting the drag operation.
*/
modifiers |= drag_grab->buttons;
if (drag_grab->drag_data_source)
{
data_source_update_user_dnd_action (drag_grab->drag_data_source, modifiers);
if (drag_grab->drag_focus)
meta_wayland_surface_drag_dest_update (drag_grab->drag_focus);
}
}
static const MetaWaylandKeyboardGrabInterface keyboard_drag_grab_interface = {
keyboard_drag_grab_key,
keyboard_drag_grab_modifiers
};
static void
destroy_data_device_origin (struct wl_listener *listener, void *data)
{
@@ -715,16 +440,12 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data
MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device);
MetaWaylandDragGrab *drag_grab;
ClutterPoint pos, stage_pos;
ClutterModifierType modifiers;
data_device->current_grab = drag_grab = g_slice_new0 (MetaWaylandDragGrab);
drag_grab->generic.interface = funcs;
drag_grab->generic.pointer = &seat->pointer;
drag_grab->keyboard_grab.interface = &keyboard_drag_grab_interface;
drag_grab->keyboard_grab.keyboard = &seat->keyboard;
drag_grab->drag_client = client;
drag_grab->seat = seat;
@@ -739,11 +460,6 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data
drag_grab->drag_start_x = stage_pos.x;
drag_grab->drag_start_y = stage_pos.y;
modifiers = clutter_input_device_get_modifier_state (seat->pointer.device);
drag_grab->buttons = modifiers &
(CLUTTER_BUTTON1_MASK | CLUTTER_BUTTON2_MASK | CLUTTER_BUTTON3_MASK |
CLUTTER_BUTTON4_MASK | CLUTTER_BUTTON5_MASK);
g_object_weak_ref (G_OBJECT (source),
drag_grab_data_source_destroyed,
drag_grab);
@@ -751,7 +467,6 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data
drag_grab->drag_data_source = source;
meta_wayland_data_device_set_dnd_source (data_device,
drag_grab->drag_data_source);
data_source_update_user_dnd_action (source, modifiers);
if (icon_surface)
{
@@ -833,10 +548,6 @@ data_device_start_drag (struct wl_client *client,
meta_wayland_data_device_start_drag (data_device, client,
&drag_grab_interface,
surface, drag_source, icon_surface);
meta_wayland_keyboard_set_focus (&seat->keyboard, NULL);
meta_wayland_keyboard_start_grab (&seat->keyboard,
&seat->data_device.current_grab->keyboard_grab);
}
static void
@@ -889,34 +600,6 @@ meta_wayland_source_cancel (MetaWaylandDataSource *source)
wl_data_source_send_cancelled (source_wayland->resource);
}
static void
meta_wayland_source_action (MetaWaylandDataSource *source,
uint32_t action)
{
MetaWaylandDataSourceWayland *source_wayland =
META_WAYLAND_DATA_SOURCE_WAYLAND (source);
wl_data_source_send_action (source_wayland->resource, action);
}
static void
meta_wayland_source_drop_performed (MetaWaylandDataSource *source)
{
MetaWaylandDataSourceWayland *source_wayland =
META_WAYLAND_DATA_SOURCE_WAYLAND (source);
wl_data_source_send_drop_performed (source_wayland->resource);
}
static void
meta_wayland_source_drag_finished (MetaWaylandDataSource *source)
{
MetaWaylandDataSourceWayland *source_wayland =
META_WAYLAND_DATA_SOURCE_WAYLAND (source);
wl_data_source_send_drag_finished (source_wayland->resource);
}
static void
meta_wayland_source_finalize (GObject *object)
{
@@ -940,9 +623,6 @@ meta_wayland_data_source_wayland_class_init (MetaWaylandDataSourceWaylandClass *
data_source_class->send = meta_wayland_source_send;
data_source_class->target = meta_wayland_source_target;
data_source_class->cancel = meta_wayland_source_cancel;
data_source_class->action = meta_wayland_source_action;
data_source_class->drop_performed = meta_wayland_source_drop_performed;
data_source_class->drag_finished = meta_wayland_source_drag_finished;
}
static void
@@ -967,7 +647,6 @@ meta_wayland_data_source_init (MetaWaylandDataSource *source)
meta_wayland_data_source_get_instance_private (source);
wl_array_init (&priv->mime_types);
priv->current_dnd_action = -1;
}
static void
@@ -1043,18 +722,11 @@ meta_wayland_drag_dest_drop (MetaWaylandDataDevice *data_device,
wl_data_device_send_drop (grab->drag_focus_data_device);
}
static void
meta_wayland_drag_dest_update (MetaWaylandDataDevice *data_device,
MetaWaylandSurface *surface)
{
}
static const MetaWaylandDragDestFuncs meta_wayland_drag_dest_funcs = {
meta_wayland_drag_dest_focus_in,
meta_wayland_drag_dest_focus_out,
meta_wayland_drag_dest_motion,
meta_wayland_drag_dest_drop,
meta_wayland_drag_dest_update
meta_wayland_drag_dest_drop
};
const MetaWaylandDragDestFuncs *

View File

@@ -45,11 +45,6 @@ struct _MetaWaylandDataSourceClass
void (* target) (MetaWaylandDataSource *source,
const gchar *mime_type);
void (* cancel) (MetaWaylandDataSource *source);
void (* action) (MetaWaylandDataSource *source,
uint32_t action);
void (* drop_performed) (MetaWaylandDataSource *source);
void (* drag_finished) (MetaWaylandDataSource *source);
};
struct _MetaWaylandDataDevice
@@ -100,17 +95,6 @@ void meta_wayland_data_source_send (MetaWaylandDataSource *source,
const gchar *mime_type,
gint fd);
void meta_wayland_data_source_notify_finish (MetaWaylandDataSource *source);
uint32_t meta_wayland_data_source_get_actions (MetaWaylandDataSource *source);
uint32_t meta_wayland_data_source_get_user_action (MetaWaylandDataSource *source);
uint32_t meta_wayland_data_source_get_current_action (MetaWaylandDataSource *source);
void meta_wayland_data_source_set_actions (MetaWaylandDataSource *source,
uint32_t dnd_actions);
void meta_wayland_data_source_set_current_action (MetaWaylandDataSource *source,
uint32_t action);
const MetaWaylandDragDestFuncs *
meta_wayland_data_device_get_drag_dest_funcs (void);

View File

@@ -63,7 +63,6 @@
static void meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard);
static void notify_modifiers (MetaWaylandKeyboard *keyboard);
static guint evdev_code (const ClutterKeyEvent *event);
static void
unbind_resource (struct wl_resource *resource)
@@ -252,11 +251,12 @@ notify_key (MetaWaylandKeyboard *keyboard,
{
struct wl_client *client = wl_resource_get_client (keyboard->focus_surface->resource);
struct wl_display *display = wl_client_get_display (client);
uint32_t serial = wl_display_next_serial (display);
keyboard->key_serial = wl_display_next_serial (display);
wl_resource_for_each (resource, l)
{
wl_keyboard_send_key (resource, serial, time, key, state);
wl_keyboard_send_key (resource, keyboard->key_serial, time, key, state);
}
}
@@ -265,7 +265,7 @@ notify_key (MetaWaylandKeyboard *keyboard,
}
static void
apply_modifiers (MetaWaylandKeyboard *keyboard)
notify_modifiers (MetaWaylandKeyboard *keyboard)
{
struct xkb_state *state;
struct wl_resource *resource;
@@ -290,16 +290,6 @@ apply_modifiers (MetaWaylandKeyboard *keyboard)
}
}
static void
notify_modifiers (MetaWaylandKeyboard *keyboard)
{
struct xkb_state *state;
state = keyboard->xkb_info.state;
keyboard->grab->interface->modifiers (keyboard->grab,
xkb_state_serialize_mods (state, XKB_STATE_MODS_EFFECTIVE));
}
static void
meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard)
{
@@ -379,33 +369,6 @@ settings_changed (GSettings *settings,
notify_key_repeat (keyboard);
}
static gboolean
default_grab_key (MetaWaylandKeyboardGrab *grab,
const ClutterEvent *event)
{
MetaWaylandKeyboard *keyboard = grab->keyboard;
gboolean is_press = event->type == CLUTTER_KEY_PRESS;
/* Synthetic key events are for autorepeat. Ignore those, as
* autorepeat in Wayland is done on the client side. */
if (event->key.flags & CLUTTER_EVENT_FLAG_SYNTHETIC)
return FALSE;
return notify_key (keyboard, event->key.time, evdev_code (&event->key), is_press);
}
static void
default_grab_modifiers (MetaWaylandKeyboardGrab *grab,
ClutterModifierType modifiers)
{
apply_modifiers (grab->keyboard);
}
static const MetaWaylandKeyboardGrabInterface default_keyboard_grab_interface = {
default_grab_key,
default_grab_modifiers
};
void
meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
struct wl_display *display)
@@ -423,10 +386,6 @@ meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
keyboard->xkb_info.keymap_fd = -1;
keyboard->default_grab.interface = &default_keyboard_grab_interface;
keyboard->default_grab.keyboard = keyboard;
keyboard->grab = &keyboard->default_grab;
keyboard->settings = g_settings_new ("org.gnome.desktop.peripherals.keyboard");
g_signal_connect (keyboard->settings, "changed",
G_CALLBACK (settings_changed), keyboard);
@@ -503,7 +462,7 @@ meta_wayland_keyboard_handle_event (MetaWaylandKeyboard *keyboard,
is_press ? "press" : "release",
event->hardware_keycode);
handled = keyboard->grab->interface->key (keyboard->grab, (const ClutterEvent *) event);
handled = notify_key (keyboard, event->time, evdev_code (event), is_press);
if (handled)
meta_verbose ("Sent event to wayland client\n");
@@ -715,17 +674,9 @@ meta_wayland_keyboard_create_new_resource (MetaWaylandKeyboard *keyboard,
}
}
void
meta_wayland_keyboard_start_grab (MetaWaylandKeyboard *keyboard,
MetaWaylandKeyboardGrab *grab)
gboolean
meta_wayland_keyboard_can_popup (MetaWaylandKeyboard *keyboard,
uint32_t serial)
{
meta_wayland_keyboard_set_focus (keyboard, NULL);
keyboard->grab = grab;
grab->keyboard = keyboard;
}
void
meta_wayland_keyboard_end_grab (MetaWaylandKeyboard *keyboard)
{
keyboard->grab = &keyboard->default_grab;
return keyboard->key_serial == serial;
}

View File

@@ -49,20 +49,6 @@
#include <wayland-server.h>
#include <xkbcommon/xkbcommon.h>
struct _MetaWaylandKeyboardGrabInterface
{
gboolean (* key) (MetaWaylandKeyboardGrab *grab,
const ClutterEvent *event);
void (*modifiers) (MetaWaylandKeyboardGrab *grab,
ClutterModifierType modifiers);
};
struct _MetaWaylandKeyboardGrab
{
const MetaWaylandKeyboardGrabInterface *interface;
MetaWaylandKeyboard *keyboard;
};
typedef struct
{
struct xkb_keymap *keymap;
@@ -82,13 +68,11 @@ struct _MetaWaylandKeyboard
MetaWaylandSurface *focus_surface;
struct wl_listener focus_surface_listener;
uint32_t focus_serial;
uint32_t key_serial;
MetaWaylandXkbInfo xkb_info;
enum xkb_state_component mods_changed;
MetaWaylandKeyboardGrab *grab;
MetaWaylandKeyboardGrab default_grab;
GSettings *settings;
};
@@ -117,9 +101,7 @@ void meta_wayland_keyboard_create_new_resource (MetaWaylandKeyboard *keyboard,
struct wl_resource *seat_resource,
uint32_t id);
void meta_wayland_keyboard_start_grab (MetaWaylandKeyboard *keyboard,
MetaWaylandKeyboardGrab *grab);
void meta_wayland_keyboard_end_grab (MetaWaylandKeyboard *keyboard);
gboolean meta_wayland_keyboard_can_popup (MetaWaylandKeyboard *keyboard,
uint32_t serial);
#endif /* META_WAYLAND_KEYBOARD_H */

View File

@@ -53,6 +53,7 @@
#include "meta-wayland-private.h"
#include "meta-wayland-surface.h"
#include "meta-wayland-buffer.h"
#include "meta-xwayland.h"
#include "meta-cursor.h"
#include "meta-cursor-tracker-private.h"
#include "meta-surface-actor-wayland.h"
@@ -493,10 +494,27 @@ handle_scroll_event (MetaWaylandPointer *pointer,
{
struct wl_resource *resource;
wl_fixed_t x_value = 0, y_value = 0;
enum wl_pointer_axis_source source = -1;
if (clutter_event_is_pointer_emulated (event))
return;
switch (event->scroll.scroll_source)
{
case CLUTTER_SCROLL_SOURCE_WHEEL:
source = WL_POINTER_AXIS_SOURCE_WHEEL;
break;
case CLUTTER_SCROLL_SOURCE_FINGER:
source = WL_POINTER_AXIS_SOURCE_FINGER;
break;
case CLUTTER_SCROLL_SOURCE_CONTINUOUS:
source = WL_POINTER_AXIS_SOURCE_CONTINUOUS;
break;
default:
source = WL_POINTER_AXIS_SOURCE_WHEEL;
break;
}
switch (clutter_event_get_scroll_direction (event))
{
case CLUTTER_SCROLL_UP:
@@ -536,12 +554,31 @@ handle_scroll_event (MetaWaylandPointer *pointer,
{
wl_resource_for_each (resource, &pointer->focus_client->pointer_resources)
{
if (wl_resource_get_version (resource) >= WL_POINTER_AXIS_SOURCE_SINCE_VERSION)
wl_pointer_send_axis_source (resource, source);
if (x_value)
wl_pointer_send_axis (resource, clutter_event_get_time (event),
WL_POINTER_AXIS_HORIZONTAL_SCROLL, x_value);
if ((event->scroll.finish_flags & CLUTTER_SCROLL_FINISHED_HORIZONTAL) &&
wl_resource_get_version (resource) >= WL_POINTER_AXIS_STOP_SINCE_VERSION)
wl_pointer_send_axis_stop (resource,
clutter_event_get_time (event),
WL_POINTER_AXIS_HORIZONTAL_SCROLL);
if (y_value)
wl_pointer_send_axis (resource, clutter_event_get_time (event),
WL_POINTER_AXIS_VERTICAL_SCROLL, y_value);
if ((event->scroll.finish_flags & CLUTTER_SCROLL_FINISHED_VERTICAL) &&
wl_resource_get_version (resource) >= WL_POINTER_AXIS_STOP_SINCE_VERSION)
wl_pointer_send_axis_stop (resource,
clutter_event_get_time (event),
WL_POINTER_AXIS_VERTICAL_SCROLL);
if (wl_resource_get_version (resource) >= WL_POINTER_AXIS_SOURCE_SINCE_VERSION)
wl_pointer_send_axis_frame (resource);
}
}
}
@@ -819,9 +856,12 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite,
MetaScreen *screen = display->screen;
const MetaMonitorInfo *monitor;
monitor = meta_screen_get_monitor_for_point (screen, x, y);
meta_cursor_sprite_set_texture_scale (cursor_sprite,
(float)monitor->scale / surface->scale);
if (!meta_xwayland_is_xwayland_surface (surface))
{
monitor = meta_screen_get_monitor_for_point (screen, x, y);
meta_cursor_sprite_set_texture_scale (cursor_sprite,
(float)monitor->scale / surface->scale);
}
meta_wayland_surface_update_outputs (surface);
}

View File

@@ -405,3 +405,12 @@ meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
return sequence || can_grab_surface;
}
gboolean
meta_wayland_seat_can_popup (MetaWaylandSeat *seat,
uint32_t serial)
{
return (meta_wayland_pointer_can_popup (&seat->pointer, serial) ||
meta_wayland_keyboard_can_popup (&seat->keyboard, serial) ||
meta_wayland_touch_can_popup (&seat->touch, serial));
}

View File

@@ -64,5 +64,7 @@ gboolean meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
uint32_t serial,
gfloat *x,
gfloat *y);
gboolean meta_wayland_seat_can_popup (MetaWaylandSeat *seat,
uint32_t serial);
#endif /* META_WAYLAND_SEAT_H */

View File

@@ -351,12 +351,6 @@ toplevel_surface_commit (MetaWaylandSurfaceRole *surface_role,
return;
}
}
else if (META_IS_WAYLAND_SURFACE_ROLE_XDG_POPUP (surface->role))
{
/* Ignore commits if we couldn't grab the pointer */
if (!window)
return;
}
else
{
if (surface->buffer == NULL)
@@ -369,10 +363,11 @@ toplevel_surface_commit (MetaWaylandSurfaceRole *surface_role,
}
}
g_assert (window != NULL);
/* We resize X based surfaces according to X events */
if (window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
/* Update the state of the MetaWindow if we still have one. We might not if
* the window was unmanaged (for example popup destroyed, NULL buffer attached to
* wl_shell_surface wl_surface, xdg_surface object was destroyed, etc).
*/
if (window && window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
{
MetaRectangle geom = { 0 };
@@ -1520,15 +1515,15 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
surface,
xdg_popup_destructor);
if (!meta_wayland_pointer_can_popup (&seat->pointer, serial))
surface->xdg_popup = popup_resource;
surface->xdg_shell_resource = resource;
if (!meta_wayland_seat_can_popup (seat, serial))
{
xdg_popup_send_popup_done (popup_resource);
return;
}
surface->xdg_popup = popup_resource;
surface->xdg_shell_resource = resource;
surface->popup.parent = parent_surf;
surface->popup.parent_destroy_listener.notify = handle_popup_parent_destroyed;
wl_resource_add_destroy_listener (parent_surf->resource,
@@ -1744,7 +1739,7 @@ wl_shell_surface_set_popup (struct wl_client *client,
wl_shell_surface_set_state (surface, SURFACE_STATE_TOPLEVEL);
if (!meta_wayland_pointer_can_popup (&seat->pointer, serial))
if (!meta_wayland_seat_can_popup (seat, serial))
{
wl_shell_surface_send_popup_done (resource);
return;
@@ -2381,15 +2376,6 @@ meta_wayland_surface_drag_dest_drop (MetaWaylandSurface *surface)
surface->dnd.funcs->drop (data_device, surface);
}
void
meta_wayland_surface_drag_dest_update (MetaWaylandSurface *surface)
{
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaWaylandDataDevice *data_device = &compositor->seat->data_device;
surface->dnd.funcs->update (data_device, surface);
}
MetaWindow *
meta_wayland_surface_get_toplevel_window (MetaWaylandSurface *surface)
{

View File

@@ -128,8 +128,6 @@ struct _MetaWaylandDragDestFuncs
const ClutterEvent *event);
void (* drop) (MetaWaylandDataDevice *data_device,
MetaWaylandSurface *surface);
void (* update) (MetaWaylandDataDevice *data_device,
MetaWaylandSurface *surface);
};
struct _MetaWaylandSurface
@@ -242,7 +240,6 @@ void meta_wayland_surface_drag_dest_motion (MetaWaylandSurface
const ClutterEvent *event);
void meta_wayland_surface_drag_dest_focus_out (MetaWaylandSurface *surface);
void meta_wayland_surface_drag_dest_drop (MetaWaylandSurface *surface);
void meta_wayland_surface_drag_dest_update (MetaWaylandSurface *surface);
void meta_wayland_surface_update_outputs (MetaWaylandSurface *surface);

View File

@@ -575,6 +575,26 @@ meta_wayland_touch_create_new_resource (MetaWaylandTouch *touch,
wl_list_insert (&touch->resource_list, wl_resource_get_link (cr));
}
gboolean
meta_wayland_touch_can_popup (MetaWaylandTouch *touch,
uint32_t serial)
{
MetaWaylandTouchInfo *touch_info;
GHashTableIter iter;
if (!touch->touches)
return FALSE;
g_hash_table_iter_init (&iter, touch->touches);
while (g_hash_table_iter_next (&iter, NULL, (gpointer*) &touch_info))
{
if (touch_info->slot_serial == serial)
return TRUE;
}
return FALSE;
}
ClutterEventSequence *
meta_wayland_touch_find_grab_sequence (MetaWaylandTouch *touch,
MetaWaylandSurface *surface,

View File

@@ -70,4 +70,7 @@ gboolean meta_wayland_touch_get_press_coords (MetaWaylandTouch *touch,
gfloat *x,
gfloat *y);
gboolean meta_wayland_touch_can_popup (MetaWaylandTouch *touch,
uint32_t serial);
#endif /* META_WAYLAND_TOUCH_H */

View File

@@ -29,8 +29,6 @@ typedef struct _MetaWaylandPointerGrabInterface MetaWaylandPointerGrabInterface;
typedef struct _MetaWaylandPopupGrab MetaWaylandPopupGrab;
typedef struct _MetaWaylandPopup MetaWaylandPopup;
typedef struct _MetaWaylandKeyboard MetaWaylandKeyboard;
typedef struct _MetaWaylandKeyboardGrab MetaWaylandKeyboardGrab;
typedef struct _MetaWaylandKeyboardGrabInterface MetaWaylandKeyboardGrabInterface;
typedef struct _MetaWaylandTouch MetaWaylandTouch;
typedef struct _MetaWaylandDragDestFuncs MetaWaylandDragDestFuncs;
typedef struct _MetaWaylandDataOffer MetaWaylandDataOffer;

View File

@@ -36,10 +36,10 @@
/* Global/master objects (version exported by wl_registry and negotiated through bind) */
#define META_WL_COMPOSITOR_VERSION 3
#define META_WL_DATA_DEVICE_MANAGER_VERSION 3
#define META_WL_DATA_DEVICE_MANAGER_VERSION 2
#define META_XDG_SHELL_VERSION 1
#define META_WL_SHELL_VERSION 1
#define META_WL_SEAT_VERSION 4
#define META_WL_SEAT_VERSION 5
#define META_WL_OUTPUT_VERSION 2
#define META_XSERVER_VERSION 1
#define META_GTK_SHELL_VERSION 2

View File

@@ -108,7 +108,6 @@ enum {
ATOM_DND_ACTION_MOVE,
ATOM_DND_ACTION_COPY,
ATOM_DND_ACTION_ASK,
ATOM_DND_ACTION_PRIVATE,
N_DND_ATOMS
};
@@ -127,7 +126,6 @@ const gchar *atom_names[] = {
"XdndActionMove",
"XdndActionCopy",
"XdndActionAsk",
"XdndActionPrivate",
NULL
};
@@ -137,19 +135,6 @@ G_DEFINE_TYPE (MetaWaylandDataSourceXWayland, meta_wayland_data_source_xwayland,
META_TYPE_WAYLAND_DATA_SOURCE);
/* XDND helpers */
static Atom
action_to_atom (uint32_t action)
{
if (action & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY)
return xdnd_atoms[ATOM_DND_ACTION_COPY];
else if (action & WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE)
return xdnd_atoms[ATOM_DND_ACTION_MOVE];
else if (action & WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK)
return xdnd_atoms[ATOM_DND_ACTION_ASK];
else
return None;
}
static void
xdnd_send_enter (MetaXWaylandSelection *selection_data,
Window dest)
@@ -232,21 +217,10 @@ xdnd_send_position (MetaXWaylandSelection *selection_data,
int x,
int y)
{
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaSelectionBridge *selection = &selection_data->dnd.selection;
MetaWaylandDataSource *source = compositor->seat->data_device.dnd_data_source;
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
uint32_t action = 0, user_action, actions;
XEvent xev = { 0 };
user_action = meta_wayland_data_source_get_user_action (source);
actions = meta_wayland_data_source_get_actions (source);
if (user_action & actions)
action = user_action;
if (!action)
action = actions;
xev.xclient.type = ClientMessage;
xev.xclient.message_type = xdnd_atoms[ATOM_DND_POSITION];
xev.xclient.format = 32;
@@ -256,7 +230,7 @@ xdnd_send_position (MetaXWaylandSelection *selection_data,
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = (x << 16) | y;
xev.xclient.data.l[3] = time;
xev.xclient.data.l[4] = action_to_atom (action);
xev.xclient.data.l[4] = xdnd_atoms[ATOM_DND_ACTION_COPY];
XSendEvent (xdisplay, dest, False, NoEventMask, &xev);
}
@@ -288,8 +262,6 @@ xdnd_send_finished (MetaXWaylandSelection *selection_data,
{
MetaDndBridge *selection = &selection_data->dnd;
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
MetaWaylandDataSource *source = selection_data->dnd.selection.source;
uint32_t action = 0;
XEvent xev = { 0 };
xev.xclient.type = ClientMessage;
@@ -301,9 +273,8 @@ xdnd_send_finished (MetaXWaylandSelection *selection_data,
if (accepted)
{
action = meta_wayland_data_source_get_current_action (source);
xev.xclient.data.l[1] = 1; /* Drop successful */
xev.xclient.data.l[2] = action_to_atom (action);
xev.xclient.data.l[2] = xdnd_atoms[ATOM_DND_ACTION_COPY];
}
XSendEvent (xdisplay, dest, False, NoEventMask, &xev);
@@ -312,7 +283,7 @@ xdnd_send_finished (MetaXWaylandSelection *selection_data,
static void
xdnd_send_status (MetaXWaylandSelection *selection_data,
Window dest,
uint32_t action)
gboolean accepted)
{
MetaDndBridge *selection = &selection_data->dnd;
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
@@ -325,10 +296,12 @@ xdnd_send_status (MetaXWaylandSelection *selection_data,
xev.xclient.data.l[0] = selection->dnd_window;
xev.xclient.data.l[1] = 1 << 1; /* Bit 2: dest wants XdndPosition messages */
xev.xclient.data.l[4] = action_to_atom (action);
if (xev.xclient.data.l[4])
xev.xclient.data.l[1] |= 1 << 0; /* Bit 1: dest accepts the drop */
if (accepted)
{
xev.xclient.data.l[1] |= 1 << 0; /* Bit 1: dest accepts the drop */
xev.xclient.data.l[4] = xdnd_atoms[ATOM_DND_ACTION_COPY];
}
XSendEvent (xdisplay, dest, False, NoEventMask, &xev);
}
@@ -414,32 +387,6 @@ x11_selection_data_free (X11SelectionData *data)
g_slice_free (X11SelectionData, data);
}
static void
x11_selection_data_send_finished (MetaSelectionBridge *selection,
gboolean success)
{
uint32_t action = meta_wayland_data_source_get_current_action (selection->source);
if (!selection->x11_selection)
return;
if (success && action == WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE)
{
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
/* Request data deletion on the drag source */
XConvertSelection (xdisplay,
selection->selection_atom,
gdk_x11_get_xatom_by_name ("DELETE"),
gdk_x11_get_xatom_by_name ("_META_SELECTION"),
selection->window,
CurrentTime);
}
xdnd_send_finished (selection->x11_selection->selection_data,
selection->owner, success);
}
static void
x11_selection_data_finish (MetaSelectionBridge *selection,
gboolean success)
@@ -448,18 +395,13 @@ x11_selection_data_finish (MetaSelectionBridge *selection,
return;
if (selection == &selection->x11_selection->selection_data->dnd.selection)
x11_selection_data_send_finished (selection, success);
xdnd_send_finished (selection->x11_selection->selection_data,
selection->owner, success);
g_clear_pointer (&selection->x11_selection,
(GDestroyNotify) x11_selection_data_free);
}
static void
x11_selection_data_close (X11SelectionData *data)
{
g_output_stream_close (data->stream, data->cancellable, NULL);
}
static void
x11_data_write_cb (GObject *object,
GAsyncResult *res,
@@ -493,7 +435,6 @@ x11_data_write_cb (GObject *object,
}
else
{
x11_selection_data_close (selection->x11_selection);
x11_selection_data_finish (selection, success);
}
}
@@ -752,7 +693,6 @@ meta_xwayland_selection_get_incr_chunk (MetaWaylandCompositor *compositor,
else
{
/* Transfer has completed */
x11_selection_data_close (selection->x11_selection);
x11_selection_data_finish (selection, TRUE);
}
@@ -801,15 +741,11 @@ meta_x11_source_target (MetaWaylandDataSource *source,
MetaWaylandDataSourceXWayland *source_xwayland =
META_WAYLAND_DATA_SOURCE_XWAYLAND (source);
MetaSelectionBridge *selection = source_xwayland->selection;
uint32_t action = 0;
if (selection->selection_atom == xdnd_atoms[ATOM_DND_SELECTION])
{
if (mime_type)
action = meta_wayland_data_source_get_current_action (source);
xdnd_send_status (compositor->xwayland_manager.selection_data,
selection->owner, action);
selection->owner, mime_type != NULL);
}
}
@@ -820,46 +756,10 @@ meta_x11_source_cancel (MetaWaylandDataSource *source)
META_WAYLAND_DATA_SOURCE_XWAYLAND (source);
MetaSelectionBridge *selection = source_xwayland->selection;
x11_selection_data_send_finished (selection, FALSE);
g_clear_pointer (&selection->x11_selection,
(GDestroyNotify) x11_selection_data_free);
}
static void
meta_x11_source_action (MetaWaylandDataSource *source,
uint32_t action)
{
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaWaylandDataSourceXWayland *source_xwayland =
META_WAYLAND_DATA_SOURCE_XWAYLAND (source);
MetaSelectionBridge *selection = source_xwayland->selection;
if (selection->selection_atom == xdnd_atoms[ATOM_DND_SELECTION])
{
if (!meta_wayland_data_source_has_target (source))
action = 0;
xdnd_send_status (compositor->xwayland_manager.selection_data,
selection->owner, action);
}
}
static void
meta_x11_source_drop_performed (MetaWaylandDataSource *source)
{
}
static void
meta_x11_source_drag_finished (MetaWaylandDataSource *source)
{
MetaWaylandDataSourceXWayland *source_xwayland =
META_WAYLAND_DATA_SOURCE_XWAYLAND (source);
MetaSelectionBridge *selection = source_xwayland->selection;
if (selection->x11_selection)
x11_selection_data_send_finished (selection, TRUE);
}
static void
meta_wayland_data_source_xwayland_init (MetaWaylandDataSourceXWayland *source_xwayland)
{
@@ -874,9 +774,6 @@ meta_wayland_data_source_xwayland_class_init (MetaWaylandDataSourceXWaylandClass
data_source_class->send = meta_x11_source_send;
data_source_class->target = meta_x11_source_target;
data_source_class->cancel = meta_x11_source_cancel;
data_source_class->action = meta_x11_source_action;
data_source_class->drop_performed = meta_x11_source_drop_performed;
data_source_class->drag_finished = meta_x11_source_drag_finished;
}
static MetaWaylandDataSource *
@@ -940,27 +837,11 @@ meta_x11_drag_dest_drop (MetaWaylandDataDevice *data_device,
meta_display_get_current_time_roundtrip (meta_get_display ()));
}
static void
meta_x11_drag_dest_update (MetaWaylandDataDevice *data_device,
MetaWaylandSurface *surface)
{
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaWaylandSeat *seat = compositor->seat;
ClutterPoint pos;
clutter_input_device_get_coords (seat->pointer.device, NULL, &pos);
xdnd_send_position (compositor->xwayland_manager.selection_data,
compositor->xwayland_manager.selection_data->dnd.dnd_dest,
clutter_get_current_event_time (),
pos.x, pos.y);
}
static const MetaWaylandDragDestFuncs meta_x11_drag_dest_funcs = {
meta_x11_drag_dest_focus_in,
meta_x11_drag_dest_focus_out,
meta_x11_drag_dest_motion,
meta_x11_drag_dest_drop,
meta_x11_drag_dest_update
meta_x11_drag_dest_drop
};
const MetaWaylandDragDestFuncs *
@@ -1254,10 +1135,6 @@ meta_xwayland_selection_handle_selection_request (MetaWaylandCompositor *composi
selection->timestamp);
reply_selection_request (event, TRUE);
}
else if (data_source && event->target == gdk_x11_get_xatom_by_name ("DELETE"))
{
meta_wayland_data_source_notify_finish (data_source);
}
else
{
if (data_source &&
@@ -1380,7 +1257,6 @@ meta_xwayland_selection_handle_client_message (MetaWaylandCompositor *compositor
if (event->window == dnd->selection.window)
{
MetaWaylandDataSource *data_source;
uint32_t action = 0;
data_source = compositor->seat->data_device.dnd_data_source;
@@ -1393,19 +1269,6 @@ meta_xwayland_selection_handle_client_message (MetaWaylandCompositor *compositor
meta_wayland_data_source_set_has_target (data_source,
(event->data.l[1] & 1) != 0);
/* data.l[4] contains the action atom */
if (event->data.l[4])
{
if (((Atom) event->data.l[4]) == xdnd_atoms[ATOM_DND_ACTION_COPY] ||
((Atom) event->data.l[4]) == xdnd_atoms[ATOM_DND_ACTION_PRIVATE])
action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
else if (((Atom) event->data.l[4]) == xdnd_atoms[ATOM_DND_ACTION_MOVE])
action = WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
else if (((Atom) event->data.l[4]) == xdnd_atoms[ATOM_DND_ACTION_ASK])
action = WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK;
}
meta_wayland_data_source_set_current_action (data_source, action);
return TRUE;
}
else if (event->message_type == xdnd_atoms[ATOM_DND_FINISHED])
@@ -1414,7 +1277,8 @@ meta_xwayland_selection_handle_client_message (MetaWaylandCompositor *compositor
if (compositor->seat->data_device.current_grab)
return FALSE;
meta_wayland_data_source_notify_finish (data_source);
meta_wayland_data_device_set_dnd_source (&compositor->seat->data_device,
NULL);
return TRUE;
}
}
@@ -1474,7 +1338,6 @@ meta_xwayland_selection_handle_client_message (MetaWaylandCompositor *compositor
{
ClutterEvent *motion;
ClutterPoint pos;
uint32_t action = 0;
motion = clutter_event_new (CLUTTER_MOTION);
clutter_input_device_get_coords (seat->pointer.device, NULL, &pos);
@@ -1483,19 +1346,11 @@ meta_xwayland_selection_handle_client_message (MetaWaylandCompositor *compositor
clutter_event_set_source_device (motion, seat->pointer.device);
clutter_event_set_time (motion, dnd->last_motion_time);
if ((Atom) event->data.l[4] == xdnd_atoms[ATOM_DND_ACTION_COPY])
action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
else if ((Atom) event->data.l[4] == xdnd_atoms[ATOM_DND_ACTION_MOVE])
action = WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
else if ((Atom) event->data.l[4] == xdnd_atoms[ATOM_DND_ACTION_ASK])
action = WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK;
meta_wayland_data_source_set_actions (dnd->selection.source, action);
meta_wayland_surface_drag_dest_motion (drag_focus, motion);
xdnd_send_status (compositor->xwayland_manager.selection_data,
(Window) event->data.l[0],
meta_wayland_data_source_get_current_action (dnd->selection.source));
meta_wayland_data_source_has_target (
dnd->selection.source));
clutter_event_free (motion);
return TRUE;

View File

@@ -174,6 +174,15 @@ meta_xwayland_handle_wl_surface_id (MetaWindow *window,
}
}
gboolean
meta_xwayland_is_xwayland_surface (MetaWaylandSurface *surface)
{
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaXWaylandManager *manager = &compositor->xwayland_manager;
return wl_resource_get_client (surface->resource) == manager->client;
}
static gboolean
try_display (int display,
char **filename_out,

View File

@@ -28,8 +28,13 @@
#include <glib.h>
#include <meta/types.h>
#include "wayland/meta-wayland-types.h"
void
meta_xwayland_handle_wl_surface_id (MetaWindow *window,
guint32 surface_id);
gboolean
meta_xwayland_is_xwayland_surface (MetaWaylandSurface *surface);
#endif /* META_XWAYLAND_H */

View File

@@ -691,7 +691,8 @@ meta_spew_event_print (MetaDisplay *display,
static gboolean
handle_window_focus_event (MetaDisplay *display,
MetaWindow *window,
XIEnterEvent *event)
XIEnterEvent *event,
unsigned long serial)
{
MetaWindow *focus_window;
#ifdef WITH_VERBOSE_MODE
@@ -726,7 +727,7 @@ handle_window_focus_event (MetaDisplay *display,
event->event, window_type,
meta_event_mode_to_string (event->mode),
meta_event_detail_to_string (event->mode),
event->serial);
serial);
#endif
/* FIXME our pointer tracking is broken; see how
@@ -770,7 +771,7 @@ handle_window_focus_event (MetaDisplay *display,
if (event->evtype == XI_FocusIn)
{
display->server_focus_window = event->event;
display->server_focus_serial = event->serial;
display->server_focus_serial = serial;
focus_window = window;
}
else if (event->evtype == XI_FocusOut)
@@ -784,7 +785,7 @@ handle_window_focus_event (MetaDisplay *display,
}
display->server_focus_window = None;
display->server_focus_serial = event->serial;
display->server_focus_serial = serial;
focus_window = NULL;
}
else
@@ -829,8 +830,9 @@ crossing_serial_is_ignored (MetaDisplay *display,
}
static gboolean
handle_input_xevent (MetaDisplay *display,
XIEvent *input_event)
handle_input_xevent (MetaDisplay *display,
XIEvent *input_event,
unsigned long serial)
{
XIEnterEvent *enter_event = (XIEnterEvent *) input_event;
Window modified;
@@ -867,7 +869,7 @@ handle_input_xevent (MetaDisplay *display,
/* Check if we've entered a window; do this even if window->has_focus to
* avoid races.
*/
if (window && !crossing_serial_is_ignored (display, input_event->serial) &&
if (window && !crossing_serial_is_ignored (display, serial) &&
enter_event->mode != XINotifyGrab &&
enter_event->mode != XINotifyUngrab &&
enter_event->detail != XINotifyInferior &&
@@ -892,7 +894,7 @@ handle_input_xevent (MetaDisplay *display,
break;
case XI_FocusIn:
case XI_FocusOut:
if (handle_window_focus_event (display, window, enter_event) &&
if (handle_window_focus_event (display, window, enter_event, serial) &&
enter_event->event == enter_event->root)
{
if (enter_event->evtype == XI_FocusIn &&
@@ -1736,7 +1738,7 @@ meta_display_handle_xevent (MetaDisplay *display,
}
#endif /* HAVE_XI23 */
if (handle_input_xevent (display, input_event))
if (handle_input_xevent (display, input_event, event->xany.serial))
{
bypass_gtk = bypass_compositor = TRUE;
goto out;

View File

@@ -182,6 +182,8 @@ argbdata_to_surface (gulong *argb_data, int w, int h)
}
}
cairo_surface_mark_dirty (surface);
return surface;
}

View File

@@ -946,7 +946,15 @@ save_state (void)
/* Sticky */
if (window->on_all_workspaces_requested)
fputs (" <sticky/>\n", outfile);
{
fputs (" <sticky/>\n", outfile);
} else {
int n;
n = meta_workspace_index (window->workspace);
fprintf (outfile,
" <workspace index=\"%d\"/>\n", n);
}
/* Minimized */
if (window->minimized)
@@ -963,14 +971,6 @@ save_state (void)
window->saved_rect.height);
}
/* Workspaces we're on */
{
int n;
n = meta_workspace_index (window->workspace);
fprintf (outfile,
" <workspace index=\"%d\"/>\n", n);
}
/* Gravity */
{
int x, y, w, h;

View File

@@ -507,7 +507,7 @@ window_from_results (GetPropertyResults *results,
if (!validate_or_free_results (results, 32, XA_WINDOW, TRUE))
return FALSE;
*window_p = *(Window*) results->prop;
*window_p = *(uint32_t *) results->prop;
g_free (results->prop);
results->prop = NULL;
@@ -523,7 +523,7 @@ counter_from_results (GetPropertyResults *results,
TRUE))
return FALSE;
*counter_p = *(XSyncCounter*) results->prop;
*counter_p = *(uint32_t *) results->prop;
g_free (results->prop);
results->prop = NULL;