Merge ~3v1n0/ubuntu/+source/mutter:ubuntu/master into ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/master
- Git
- lp:~3v1n0/ubuntu/+source/mutter
- ubuntu/master
- Merge into ubuntu/master
Proposed by
Marco Trevisan (Treviño)
Status: | Rejected |
---|---|
Rejected by: | Iain Lane |
Proposed branch: | ~3v1n0/ubuntu/+source/mutter:ubuntu/master |
Merge into: | ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/master |
Diff against target: |
1171 lines (+312/-199) 27 files modified
clutter/clutter/clutter-actor-private.h (+3/-0) clutter/clutter/clutter-actor.c (+39/-18) clutter/clutter/clutter-shader-effect.c (+1/-0) clutter/clutter/clutter-stage.c (+6/-25) cogl/cogl-pango/meson.build (+1/-1) debian/changelog (+31/-0) debian/rules (+1/-1) debian/watch (+2/-2) src/backends/meta-dbus-session-watcher.c (+2/-0) src/backends/meta-idle-monitor.c (+12/-3) src/backends/meta-monitor-manager.c (+13/-1) src/backends/native/meta-kms-crtc.c (+43/-3) src/backends/native/meta-kms-update-private.h (+0/-2) src/backends/native/meta-kms-update.c (+0/-6) src/backends/native/meta-kms.c (+1/-2) src/backends/x11/meta-clutter-backend-x11.c (+1/-1) src/backends/x11/meta-event-x11.c (+2/-2) src/compositor/meta-window-actor.c (+15/-11) src/core/main.c (+1/-1) src/core/meta-selection-source-memory.c (+4/-1) src/wayland/meta-selection-source-wayland-private.h (+3/-9) src/wayland/meta-selection-source-wayland.c (+22/-14) src/wayland/meta-wayland-actor-surface.c (+5/-0) src/wayland/meta-wayland-data-device.c (+60/-90) src/wayland/meta-wayland-data-device.h (+2/-0) src/wayland/meta-wayland-surface.c (+20/-6) src/x11/meta-selection-source-x11.c (+22/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Iain Lane | Disapprove | ||
Review via email: mp+374693@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Unmerged commits
- 3753872... by Marco Trevisan (Treviño)
-
Update changelog
- 69eb670... by Marco Trevisan (Treviño)
-
Merge with 'debian/master'
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/clutter/clutter/clutter-actor-private.h b/clutter/clutter/clutter-actor-private.h |
2 | index 119ec42..fa2d4c3 100644 |
3 | --- a/clutter/clutter/clutter-actor-private.h |
4 | +++ b/clutter/clutter/clutter-actor-private.h |
5 | @@ -274,6 +274,9 @@ void _clutter_actor_set_enable_paint_unmapped |
6 | void _clutter_actor_set_has_pointer (ClutterActor *self, |
7 | gboolean has_pointer); |
8 | |
9 | +void _clutter_actor_set_has_key_focus (ClutterActor *self, |
10 | + gboolean has_key_focus); |
11 | + |
12 | void _clutter_actor_queue_redraw_with_clip (ClutterActor *self, |
13 | ClutterRedrawFlags flags, |
14 | const ClutterPaintVolume *clip_volume); |
15 | diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c |
16 | index e763291..ecf9a59 100644 |
17 | --- a/clutter/clutter/clutter-actor.c |
18 | +++ b/clutter/clutter/clutter-actor.c |
19 | @@ -835,6 +835,7 @@ struct _ClutterActorPrivate |
20 | guint enable_model_view_transform : 1; |
21 | guint enable_paint_unmapped : 1; |
22 | guint has_pointer : 1; |
23 | + guint has_key_focus : 1; |
24 | guint propagated_one_redraw : 1; |
25 | guint paint_volume_valid : 1; |
26 | guint last_paint_volume_valid : 1; |
27 | @@ -1692,6 +1693,20 @@ clutter_actor_is_mapped (ClutterActor *self) |
28 | } |
29 | |
30 | static void |
31 | +maybe_unset_key_focus (ClutterActor *self) |
32 | +{ |
33 | + ClutterActor *stage; |
34 | + |
35 | + if (!self->priv->has_key_focus) |
36 | + return; |
37 | + |
38 | + stage = _clutter_actor_get_stage_internal (self); |
39 | + |
40 | + if (stage) |
41 | + clutter_stage_set_key_focus (CLUTTER_STAGE (stage), NULL); |
42 | +} |
43 | + |
44 | +static void |
45 | clutter_actor_real_unmap (ClutterActor *self) |
46 | { |
47 | ClutterActorPrivate *priv = self->priv; |
48 | @@ -1724,17 +1739,7 @@ clutter_actor_real_unmap (ClutterActor *self) |
49 | |
50 | /* relinquish keyboard focus if we were unmapped while owning it */ |
51 | if (!CLUTTER_ACTOR_IS_TOPLEVEL (self)) |
52 | - { |
53 | - ClutterStage *stage; |
54 | - |
55 | - stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self)); |
56 | - |
57 | - if (stage != NULL && |
58 | - clutter_stage_get_key_focus (stage) == self) |
59 | - { |
60 | - clutter_stage_set_key_focus (stage, NULL); |
61 | - } |
62 | - } |
63 | + maybe_unset_key_focus (self); |
64 | } |
65 | |
66 | /** |
67 | @@ -6064,6 +6069,8 @@ clutter_actor_dispose (GObject *object) |
68 | object->ref_count, |
69 | g_type_name (G_OBJECT_TYPE (self))); |
70 | |
71 | + maybe_unset_key_focus (self); |
72 | + |
73 | /* Stop the emission of any property change */ |
74 | g_object_freeze_notify (object); |
75 | |
76 | @@ -15979,6 +15986,9 @@ clutter_actor_grab_key_focus (ClutterActor *self) |
77 | |
78 | g_return_if_fail (CLUTTER_IS_ACTOR (self)); |
79 | |
80 | + if (self->priv->has_key_focus) |
81 | + return; |
82 | + |
83 | stage = _clutter_actor_get_stage_internal (self); |
84 | if (stage != NULL) |
85 | clutter_stage_set_key_focus (CLUTTER_STAGE (stage), self); |
86 | @@ -16768,6 +16778,23 @@ _clutter_actor_set_has_pointer (ClutterActor *self, |
87 | } |
88 | } |
89 | |
90 | +void |
91 | +_clutter_actor_set_has_key_focus (ClutterActor *self, |
92 | + gboolean has_key_focus) |
93 | +{ |
94 | + ClutterActorPrivate *priv = self->priv; |
95 | + |
96 | + if (priv->has_key_focus != has_key_focus) |
97 | + { |
98 | + priv->has_key_focus = has_key_focus; |
99 | + |
100 | + if (has_key_focus) |
101 | + g_signal_emit (self, actor_signals[KEY_FOCUS_IN], 0); |
102 | + else |
103 | + g_signal_emit (self, actor_signals[KEY_FOCUS_OUT], 0); |
104 | + } |
105 | +} |
106 | + |
107 | /** |
108 | * clutter_actor_get_text_direction: |
109 | * @self: a #ClutterActor |
110 | @@ -17616,15 +17643,9 @@ clutter_actor_clear_effects (ClutterActor *self) |
111 | gboolean |
112 | clutter_actor_has_key_focus (ClutterActor *self) |
113 | { |
114 | - ClutterActor *stage; |
115 | - |
116 | g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE); |
117 | |
118 | - stage = _clutter_actor_get_stage_internal (self); |
119 | - if (stage == NULL) |
120 | - return FALSE; |
121 | - |
122 | - return clutter_stage_get_key_focus (CLUTTER_STAGE (stage)) == self; |
123 | + return self->priv->has_key_focus; |
124 | } |
125 | |
126 | static gboolean |
127 | diff --git a/clutter/clutter/clutter-shader-effect.c b/clutter/clutter/clutter-shader-effect.c |
128 | index a5ae1ee..c659dab 100644 |
129 | --- a/clutter/clutter/clutter-shader-effect.c |
130 | +++ b/clutter/clutter/clutter-shader-effect.c |
131 | @@ -500,6 +500,7 @@ static void |
132 | clutter_shader_effect_init (ClutterShaderEffect *effect) |
133 | { |
134 | effect->priv = clutter_shader_effect_get_instance_private (effect); |
135 | + effect->priv->shader_type = CLUTTER_FRAGMENT_SHADER; |
136 | } |
137 | |
138 | /** |
139 | diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c |
140 | index 245cb89..c4b88b3 100644 |
141 | --- a/clutter/clutter/clutter-stage.c |
142 | +++ b/clutter/clutter/clutter-stage.c |
143 | @@ -1066,10 +1066,7 @@ clutter_stage_emit_key_focus_event (ClutterStage *stage, |
144 | if (priv->key_focused_actor == NULL) |
145 | return; |
146 | |
147 | - if (focus_in) |
148 | - g_signal_emit_by_name (priv->key_focused_actor, "key-focus-in"); |
149 | - else |
150 | - g_signal_emit_by_name (priv->key_focused_actor, "key-focus-out"); |
151 | + _clutter_actor_set_has_key_focus (CLUTTER_ACTOR (stage), focus_in); |
152 | |
153 | g_object_notify_by_pspec (G_OBJECT (stage), obj_props[PROP_KEY_FOCUS]); |
154 | } |
155 | @@ -3011,14 +3008,6 @@ clutter_stage_get_title (ClutterStage *stage) |
156 | return stage->priv->title; |
157 | } |
158 | |
159 | -static void |
160 | -on_key_focus_destroy (ClutterActor *actor, |
161 | - ClutterStage *stage) |
162 | -{ |
163 | - /* unset the key focus */ |
164 | - clutter_stage_set_key_focus (stage, NULL); |
165 | -} |
166 | - |
167 | /** |
168 | * clutter_stage_set_key_focus: |
169 | * @stage: the #ClutterStage |
170 | @@ -3058,18 +3047,14 @@ clutter_stage_set_key_focus (ClutterStage *stage, |
171 | old_focused_actor = priv->key_focused_actor; |
172 | |
173 | /* set key_focused_actor to NULL before emitting the signal or someone |
174 | - * might hide the previously focused actor in the signal handler and we'd |
175 | - * get re-entrant call and get glib critical from g_object_weak_unref |
176 | + * might hide the previously focused actor in the signal handler |
177 | */ |
178 | - g_signal_handlers_disconnect_by_func (priv->key_focused_actor, |
179 | - G_CALLBACK (on_key_focus_destroy), |
180 | - stage); |
181 | priv->key_focused_actor = NULL; |
182 | |
183 | - g_signal_emit_by_name (old_focused_actor, "key-focus-out"); |
184 | + _clutter_actor_set_has_key_focus (old_focused_actor, FALSE); |
185 | } |
186 | else |
187 | - g_signal_emit_by_name (stage, "key-focus-out"); |
188 | + _clutter_actor_set_has_key_focus (CLUTTER_ACTOR (stage), FALSE); |
189 | |
190 | /* Note, if someone changes key focus in focus-out signal handler we'd be |
191 | * overriding the latter call below moving the focus where it was originally |
192 | @@ -3079,14 +3064,10 @@ clutter_stage_set_key_focus (ClutterStage *stage, |
193 | if (actor != NULL) |
194 | { |
195 | priv->key_focused_actor = actor; |
196 | - |
197 | - g_signal_connect (actor, |
198 | - "destroy", G_CALLBACK (on_key_focus_destroy), |
199 | - stage); |
200 | - g_signal_emit_by_name (priv->key_focused_actor, "key-focus-in"); |
201 | + _clutter_actor_set_has_key_focus (actor, TRUE); |
202 | } |
203 | else |
204 | - g_signal_emit_by_name (stage, "key-focus-in"); |
205 | + _clutter_actor_set_has_key_focus (CLUTTER_ACTOR (stage), TRUE); |
206 | |
207 | g_object_notify_by_pspec (G_OBJECT (stage), obj_props[PROP_KEY_FOCUS]); |
208 | } |
209 | diff --git a/cogl/cogl-pango/meson.build b/cogl/cogl-pango/meson.build |
210 | index 787ec01..06fba51 100644 |
211 | --- a/cogl/cogl-pango/meson.build |
212 | +++ b/cogl/cogl-pango/meson.build |
213 | @@ -62,7 +62,7 @@ if have_introspection |
214 | ], |
215 | extra_args: introspection_args + [ |
216 | '-UCOGL_COMPILATION', |
217 | - '-DG_LOG_DOMAIN=\"CoglPango\"', |
218 | + '-DG_LOG_DOMAIN="CoglPango"', |
219 | ], |
220 | install_dir_gir: pkglibdir, |
221 | install_dir_typelib: pkglibdir, |
222 | diff --git a/debian/changelog b/debian/changelog |
223 | index 06847be..2515499 100644 |
224 | --- a/debian/changelog |
225 | +++ b/debian/changelog |
226 | @@ -1,3 +1,34 @@ |
227 | +mutter (3.34.1+git20191022-1ubuntu19.10.1) UNRELEASED; urgency=medium |
228 | + |
229 | + * Merge with debian. Remaining changes: |
230 | + + debian/control: |
231 | + - Update VCS flags to point to launchpad |
232 | + - Update maintainer to ubuntu |
233 | + + debian/gbp.conf: update branch to point to ubuntu/master |
234 | + + debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch: |
235 | + - X11: Add support for fractional scaling using Randr |
236 | + |
237 | + -- Marco Trevisan (Treviño) <marco@ubuntu.com> Thu, 24 Oct 2019 03:28:30 +0200 |
238 | + |
239 | +mutter (3.34.1+git20191022-1) unstable; urgency=medium |
240 | + |
241 | + * New upstream snapshot release |
242 | + + Fix night mode in wayland session (LP: #1847551) |
243 | + + Don't emit key-focus-out events on destroyed actors (LP: #1848119) |
244 | + + Fix an headers syntax error (LP: #1841709) |
245 | + + backends: Update inhibited state for the monitor and respect that state |
246 | + + clutter-backend-x11: Don't push keymap events to clutter |
247 | + + Fix drag and drop for applications in wayland |
248 | + + Avoid X11 roundtrips on underscanning checks |
249 | + |
250 | + -- Marco Trevisan (Treviño) <marco@ubuntu.com> Wed, 23 Oct 2019 10:53:23 +0100 |
251 | + |
252 | +mutter (3.34.1-3) unstable; urgency=medium |
253 | + |
254 | + * Bump meson test timeout multiplier from 4 to 6 for armel |
255 | + |
256 | + -- Jeremy Bicha <jbicha@debian.org> Sun, 20 Oct 2019 22:48:29 -0400 |
257 | + |
258 | mutter (3.34.1-1ubuntu1) eoan; urgency=medium |
259 | |
260 | * Merge with debian. Remaining changes: |
261 | diff --git a/debian/rules b/debian/rules |
262 | index ce960f4..0a6150b 100755 |
263 | --- a/debian/rules |
264 | +++ b/debian/rules |
265 | @@ -61,7 +61,7 @@ TEST_COMMAND_BASE=env \ |
266 | XDG_RUNTIME_DIR=$(BUILDDIR)/XRD \ |
267 | GSETTINGS_SCHEMA_DIR=$(BUILDDIR)/data \ |
268 | dbus-run-session -- xvfb-run -s '+iglx -noreset' -a \ |
269 | - meson test -C $(BUILDDIR) --no-rebuild --verbose --timeout-multiplier 4 \ |
270 | + meson test -C $(BUILDDIR) --no-rebuild --verbose --timeout-multiplier 6 \ |
271 | --no-stdsplit --print-errorlogs |
272 | TEST_COMMAND=$(TEST_COMMAND_BASE) --no-suite flaky |
273 | TEST_COMMAND_FLAKY=$(TEST_COMMAND_BASE) --suite flaky |
274 | diff --git a/debian/watch b/debian/watch |
275 | index 35b7b17..d8c6911 100644 |
276 | --- a/debian/watch |
277 | +++ b/debian/watch |
278 | @@ -1,3 +1,3 @@ |
279 | version=4 |
280 | -https://download.gnome.org/sources/@PACKAGE@/([\d\.]+)/ \ |
281 | - @PACKAGE@@ANY_VERSION@\.tar\.xz |
282 | +https://download.gnome.org/sources/@PACKAGE@/([\d\.]+[02468])/ \ |
283 | + @PACKAGE@@ANY_VERSION@@ARCHIVE_EXT@ |
284 | diff --git a/src/backends/meta-dbus-session-watcher.c b/src/backends/meta-dbus-session-watcher.c |
285 | index 22718e6..a885b42 100644 |
286 | --- a/src/backends/meta-dbus-session-watcher.c |
287 | +++ b/src/backends/meta-dbus-session-watcher.c |
288 | @@ -214,6 +214,8 @@ meta_dbus_session_watcher_finalize (GObject *object) |
289 | MetaDbusSessionWatcher *session_watcher = META_DBUS_SESSION_WATCHER (object); |
290 | |
291 | g_hash_table_destroy (session_watcher->clients); |
292 | + |
293 | + G_OBJECT_CLASS (meta_dbus_session_watcher_parent_class)->finalize (object); |
294 | } |
295 | |
296 | static void |
297 | diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c |
298 | index 9fa4817..2ff1602 100644 |
299 | --- a/src/backends/meta-idle-monitor.c |
300 | +++ b/src/backends/meta-idle-monitor.c |
301 | @@ -207,6 +207,8 @@ update_inhibited (MetaIdleMonitor *monitor, |
302 | if (inhibited == monitor->inhibited) |
303 | return; |
304 | |
305 | + monitor->inhibited = inhibited; |
306 | + |
307 | g_hash_table_foreach (monitor->watches, |
308 | update_inhibited_watch, |
309 | monitor); |
310 | @@ -516,9 +518,16 @@ meta_idle_monitor_reset_idletime (MetaIdleMonitor *monitor) |
311 | } |
312 | else |
313 | { |
314 | - g_source_set_ready_time (watch->timeout_source, |
315 | - monitor->last_event_time + |
316 | - watch->timeout_msec * 1000); |
317 | + if (monitor->inhibited) |
318 | + { |
319 | + g_source_set_ready_time (watch->timeout_source, -1); |
320 | + } |
321 | + else |
322 | + { |
323 | + g_source_set_ready_time (watch->timeout_source, |
324 | + monitor->last_event_time + |
325 | + watch->timeout_msec * 1000); |
326 | + } |
327 | } |
328 | } |
329 | |
330 | diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c |
331 | index 41036ca..0210aee 100644 |
332 | --- a/src/backends/meta-monitor-manager.c |
333 | +++ b/src/backends/meta-monitor-manager.c |
334 | @@ -1648,6 +1648,7 @@ create_monitor_config_from_variant (MetaMonitorManager *manager, |
335 | MetaMonitorModeSpec *monitor_mode_spec; |
336 | g_autoptr (GVariant) properties_variant = NULL; |
337 | gboolean enable_underscanning = FALSE; |
338 | + gboolean set_underscanning = FALSE; |
339 | |
340 | g_variant_get (monitor_config_variant, "(ss@a{sv})", |
341 | &connector, |
342 | @@ -1670,7 +1671,18 @@ create_monitor_config_from_variant (MetaMonitorManager *manager, |
343 | return NULL; |
344 | } |
345 | |
346 | - g_variant_lookup (properties_variant, "underscanning", "b", &enable_underscanning); |
347 | + set_underscanning = |
348 | + g_variant_lookup (properties_variant, "underscanning", "b", |
349 | + &enable_underscanning); |
350 | + if (set_underscanning) |
351 | + { |
352 | + if (enable_underscanning && !meta_monitor_supports_underscanning (monitor)) |
353 | + { |
354 | + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, |
355 | + "Underscanning requested but unsupported"); |
356 | + return NULL; |
357 | + } |
358 | + } |
359 | |
360 | monitor_spec = meta_monitor_spec_clone (meta_monitor_get_spec (monitor)); |
361 | |
362 | diff --git a/src/backends/native/meta-kms-crtc.c b/src/backends/native/meta-kms-crtc.c |
363 | index 3610df9..da99a58 100644 |
364 | --- a/src/backends/native/meta-kms-crtc.c |
365 | +++ b/src/backends/native/meta-kms-crtc.c |
366 | @@ -143,14 +143,26 @@ meta_kms_crtc_update_state (MetaKmsCrtc *crtc) |
367 | drmModeFreeCrtc (drm_crtc); |
368 | } |
369 | |
370 | +static void |
371 | +clear_gamma_state (MetaKmsCrtc *crtc) |
372 | +{ |
373 | + crtc->current_state.gamma.size = 0; |
374 | + g_clear_pointer (&crtc->current_state.gamma.red, g_free); |
375 | + g_clear_pointer (&crtc->current_state.gamma.green, g_free); |
376 | + g_clear_pointer (&crtc->current_state.gamma.blue, g_free); |
377 | +} |
378 | + |
379 | void |
380 | meta_kms_crtc_predict_state (MetaKmsCrtc *crtc, |
381 | MetaKmsUpdate *update) |
382 | { |
383 | + gboolean is_gamma_valid; |
384 | GList *mode_sets; |
385 | GList *crtc_gammas; |
386 | GList *l; |
387 | |
388 | + is_gamma_valid = TRUE; |
389 | + |
390 | mode_sets = meta_kms_update_get_mode_sets (update); |
391 | for (l = mode_sets; l; l = l->next) |
392 | { |
393 | @@ -178,6 +190,8 @@ meta_kms_crtc_predict_state (MetaKmsCrtc *crtc, |
394 | crtc->current_state.drm_mode = (drmModeModeInfo) { 0 }; |
395 | } |
396 | |
397 | + is_gamma_valid = FALSE; |
398 | + |
399 | break; |
400 | } |
401 | |
402 | @@ -196,8 +210,36 @@ meta_kms_crtc_predict_state (MetaKmsCrtc *crtc, |
403 | g_memdup (gamma->green, gamma->size * sizeof (uint16_t)); |
404 | crtc->current_state.gamma.blue = |
405 | g_memdup (gamma->blue, gamma->size * sizeof (uint16_t)); |
406 | + |
407 | + is_gamma_valid = TRUE; |
408 | break; |
409 | } |
410 | + |
411 | + if (!is_gamma_valid) |
412 | + { |
413 | + if (crtc->current_state.is_drm_mode_valid) |
414 | + { |
415 | + MetaKmsImplDevice *impl_device; |
416 | + drmModeCrtc *drm_crtc; |
417 | + |
418 | + impl_device = meta_kms_device_get_impl_device (crtc->device); |
419 | + drm_crtc = drmModeGetCrtc (meta_kms_impl_device_get_fd (impl_device), |
420 | + crtc->id); |
421 | + if (drm_crtc) |
422 | + { |
423 | + read_gamma_state (crtc, impl_device, drm_crtc); |
424 | + drmModeFreeCrtc (drm_crtc); |
425 | + } |
426 | + else |
427 | + { |
428 | + clear_gamma_state (crtc); |
429 | + } |
430 | + } |
431 | + else |
432 | + { |
433 | + clear_gamma_state (crtc); |
434 | + } |
435 | + } |
436 | } |
437 | |
438 | MetaKmsCrtc * |
439 | @@ -220,9 +262,7 @@ meta_kms_crtc_finalize (GObject *object) |
440 | { |
441 | MetaKmsCrtc *crtc = META_KMS_CRTC (object); |
442 | |
443 | - g_clear_pointer (&crtc->current_state.gamma.red, g_free); |
444 | - g_clear_pointer (&crtc->current_state.gamma.green, g_free); |
445 | - g_clear_pointer (&crtc->current_state.gamma.blue, g_free); |
446 | + clear_gamma_state (crtc); |
447 | |
448 | G_OBJECT_CLASS (meta_kms_crtc_parent_class)->finalize (object); |
449 | } |
450 | diff --git a/src/backends/native/meta-kms-update-private.h b/src/backends/native/meta-kms-update-private.h |
451 | index 88e2590..df7737c 100644 |
452 | --- a/src/backends/native/meta-kms-update-private.h |
453 | +++ b/src/backends/native/meta-kms-update-private.h |
454 | @@ -110,6 +110,4 @@ GList * meta_kms_update_get_connector_properties (MetaKmsUpdate *update); |
455 | |
456 | GList * meta_kms_update_get_crtc_gammas (MetaKmsUpdate *update); |
457 | |
458 | -gboolean meta_kms_update_has_mode_set (MetaKmsUpdate *update); |
459 | - |
460 | #endif /* META_KMS_UPDATE_PRIVATE_H */ |
461 | diff --git a/src/backends/native/meta-kms-update.c b/src/backends/native/meta-kms-update.c |
462 | index 2a4a05c..c946aa7 100644 |
463 | --- a/src/backends/native/meta-kms-update.c |
464 | +++ b/src/backends/native/meta-kms-update.c |
465 | @@ -282,12 +282,6 @@ meta_kms_update_get_crtc_gammas (MetaKmsUpdate *update) |
466 | return update->crtc_gammas; |
467 | } |
468 | |
469 | -gboolean |
470 | -meta_kms_update_has_mode_set (MetaKmsUpdate *update) |
471 | -{ |
472 | - return !!update->mode_sets; |
473 | -} |
474 | - |
475 | void |
476 | meta_kms_update_seal (MetaKmsUpdate *update) |
477 | { |
478 | diff --git a/src/backends/native/meta-kms.c b/src/backends/native/meta-kms.c |
479 | index 9485bb4..804a1ad 100644 |
480 | --- a/src/backends/native/meta-kms.c |
481 | +++ b/src/backends/native/meta-kms.c |
482 | @@ -211,8 +211,7 @@ meta_kms_update_process_in_impl (MetaKmsImpl *impl, |
483 | |
484 | ret = meta_kms_impl_process_update (impl, update, error); |
485 | |
486 | - if (meta_kms_update_has_mode_set (update)) |
487 | - meta_kms_predict_states_in_impl (meta_kms_impl_get_kms (impl), update); |
488 | + meta_kms_predict_states_in_impl (meta_kms_impl_get_kms (impl), update); |
489 | |
490 | return ret; |
491 | } |
492 | diff --git a/src/backends/x11/meta-clutter-backend-x11.c b/src/backends/x11/meta-clutter-backend-x11.c |
493 | index 8d4b64b..b6334de 100644 |
494 | --- a/src/backends/x11/meta-clutter-backend-x11.c |
495 | +++ b/src/backends/x11/meta-clutter-backend-x11.c |
496 | @@ -129,7 +129,7 @@ meta_clutter_backend_x11_translate_event (ClutterBackend *backend, |
497 | return TRUE; |
498 | |
499 | if (meta_keymap_x11_handle_event (backend_x11->keymap, native)) |
500 | - return TRUE; |
501 | + return FALSE; |
502 | |
503 | stage_x11 = META_STAGE_X11 (clutter_backend_get_stage_window (backend)); |
504 | if (meta_stage_x11_translate_event (stage_x11, native, event)) |
505 | diff --git a/src/backends/x11/meta-event-x11.c b/src/backends/x11/meta-event-x11.c |
506 | index 8b4f4fc..19da223 100644 |
507 | --- a/src/backends/x11/meta-event-x11.c |
508 | +++ b/src/backends/x11/meta-event-x11.c |
509 | @@ -82,12 +82,12 @@ meta_x11_handle_event (XEvent *xevent) |
510 | gboolean allocated_event; |
511 | |
512 | /* The return values here are someone approximate; we return |
513 | - * META_X11_FILTER_REMOVE if a clutter event is |
514 | + * CLUTTER_X11_FILTER_REMOVE if a clutter event is |
515 | * generated for the event. This mostly, but not entirely, |
516 | * corresponds to whether other event processing should be |
517 | * excluded. As long as the stage window is not shared with another |
518 | * toolkit it should be safe, and never return |
519 | - * %META_X11_FILTER_REMOVE when more processing is needed. |
520 | + * %CLUTTER_X11_FILTER_REMOVE when more processing is needed. |
521 | */ |
522 | |
523 | result = CLUTTER_X11_FILTER_CONTINUE; |
524 | diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c |
525 | index db9ccec..fd99844 100644 |
526 | --- a/src/compositor/meta-window-actor.c |
527 | +++ b/src/compositor/meta-window-actor.c |
528 | @@ -2183,21 +2183,25 @@ meta_window_actor_get_image (MetaWindowActor *self, |
529 | if (clutter_actor_get_n_children (actor) == 1) |
530 | { |
531 | MetaShapedTexture *stex; |
532 | - MetaRectangle surface_clip; |
533 | - int geometry_scale; |
534 | + MetaRectangle *surface_clip = NULL; |
535 | |
536 | - geometry_scale = |
537 | - meta_window_actor_get_geometry_scale (self); |
538 | + if (clip) |
539 | + { |
540 | |
541 | - surface_clip = (MetaRectangle) { |
542 | - .x = clip->x / geometry_scale, |
543 | - .y = clip->y / geometry_scale, |
544 | - .width = clip->width / geometry_scale, |
545 | - .height = clip->height / geometry_scale, |
546 | - }; |
547 | + int geometry_scale; |
548 | + |
549 | + geometry_scale = |
550 | + meta_window_actor_get_geometry_scale (self); |
551 | + |
552 | + surface_clip = g_alloca (sizeof (MetaRectangle)); |
553 | + surface_clip->x = clip->x / geometry_scale, |
554 | + surface_clip->y = clip->y / geometry_scale; |
555 | + surface_clip->width = clip->width / geometry_scale; |
556 | + surface_clip->height = clip->height / geometry_scale; |
557 | + } |
558 | |
559 | stex = meta_surface_actor_get_texture (priv->surface); |
560 | - return meta_shaped_texture_get_image (stex, &surface_clip); |
561 | + return meta_shaped_texture_get_image (stex, surface_clip); |
562 | } |
563 | |
564 | clutter_actor_get_size (actor, &width, &height); |
565 | diff --git a/src/core/main.c b/src/core/main.c |
566 | index 7f4f666..3935f35 100644 |
567 | --- a/src/core/main.c |
568 | +++ b/src/core/main.c |
569 | @@ -766,6 +766,6 @@ meta_test_init (void) |
570 | |
571 | close (fd); |
572 | #else |
573 | - g_error ("Tests require wayland support"); |
574 | + g_warning ("Tests require wayland support"); |
575 | #endif |
576 | } |
577 | diff --git a/src/core/meta-selection-source-memory.c b/src/core/meta-selection-source-memory.c |
578 | index 04b7f39..c8b0c83 100644 |
579 | --- a/src/core/meta-selection-source-memory.c |
580 | +++ b/src/core/meta-selection-source-memory.c |
581 | @@ -76,6 +76,9 @@ meta_selection_source_memory_get_mimetypes (MetaSelectionSource *source) |
582 | { |
583 | MetaSelectionSourceMemory *source_mem = META_SELECTION_SOURCE_MEMORY (source); |
584 | |
585 | + if (!source_mem->mimetype) |
586 | + return NULL; |
587 | + |
588 | return g_list_prepend (NULL, g_strdup (source_mem->mimetype)); |
589 | } |
590 | |
591 | @@ -84,7 +87,7 @@ meta_selection_source_memory_finalize (GObject *object) |
592 | { |
593 | MetaSelectionSourceMemory *source_mem = META_SELECTION_SOURCE_MEMORY (object); |
594 | |
595 | - g_bytes_unref (source_mem->content); |
596 | + g_clear_pointer (&source_mem->content, g_bytes_unref); |
597 | g_free (source_mem->mimetype); |
598 | |
599 | G_OBJECT_CLASS (meta_selection_source_memory_parent_class)->finalize (object); |
600 | diff --git a/src/wayland/meta-selection-source-wayland-private.h b/src/wayland/meta-selection-source-wayland-private.h |
601 | index 6affc77..a6ada88 100644 |
602 | --- a/src/wayland/meta-selection-source-wayland-private.h |
603 | +++ b/src/wayland/meta-selection-source-wayland-private.h |
604 | @@ -25,6 +25,8 @@ |
605 | #include <wayland-server.h> |
606 | |
607 | #include "meta/meta-selection-source.h" |
608 | +#include "wayland/meta-wayland-data-device.h" |
609 | +#include "wayland/meta-wayland-data-device-private.h" |
610 | |
611 | #define META_TYPE_SELECTION_SOURCE_WAYLAND (meta_selection_source_wayland_get_type ()) |
612 | |
613 | @@ -33,14 +35,6 @@ G_DECLARE_FINAL_TYPE (MetaSelectionSourceWayland, |
614 | META, SELECTION_SOURCE_WAYLAND, |
615 | MetaSelectionSource) |
616 | |
617 | -typedef void (* MetaWaylandSendFunc) (struct wl_resource *resource, |
618 | - const char *mimetype, |
619 | - int fd); |
620 | -typedef void (* MetaWaylandCancelFunc) (struct wl_resource *resource); |
621 | - |
622 | -MetaSelectionSource * meta_selection_source_wayland_new (struct wl_resource *resource, |
623 | - GList *mime_types, |
624 | - MetaWaylandSendFunc send_func, |
625 | - MetaWaylandCancelFunc cancel_func); |
626 | +MetaSelectionSource * meta_selection_source_wayland_new (MetaWaylandDataSource *source); |
627 | |
628 | #endif /* META_SELECTION_SOURCE_WAYLAND_H */ |
629 | diff --git a/src/wayland/meta-selection-source-wayland.c b/src/wayland/meta-selection-source-wayland.c |
630 | index 7031c91..4f6f0c3 100644 |
631 | --- a/src/wayland/meta-selection-source-wayland.c |
632 | +++ b/src/wayland/meta-selection-source-wayland.c |
633 | @@ -29,10 +29,8 @@ |
634 | struct _MetaSelectionSourceWayland |
635 | { |
636 | MetaSelectionSource parent_instance; |
637 | + MetaWaylandDataSource *data_source; |
638 | GList *mimetypes; |
639 | - MetaWaylandSendFunc send_func; |
640 | - MetaWaylandCancelFunc cancel_func; |
641 | - struct wl_resource *resource; |
642 | }; |
643 | |
644 | G_DEFINE_TYPE (MetaSelectionSourceWayland, meta_selection_source_wayland, |
645 | @@ -85,7 +83,8 @@ meta_selection_source_wayland_read_async (MetaSelectionSource *source, |
646 | g_task_set_source_tag (task, meta_selection_source_wayland_read_async); |
647 | |
648 | stream = g_unix_input_stream_new (pipe_fds[0], TRUE); |
649 | - source_wayland->send_func (source_wayland->resource, mimetype, pipe_fds[1]); |
650 | + meta_wayland_data_source_send (source_wayland->data_source, |
651 | + mimetype, pipe_fds[1]); |
652 | close (pipe_fds[1]); |
653 | |
654 | g_task_return_pointer (task, stream, g_object_unref); |
655 | @@ -119,7 +118,7 @@ meta_selection_source_wayland_deactivated (MetaSelectionSource *source) |
656 | MetaSelectionSourceWayland *source_wayland = |
657 | META_SELECTION_SOURCE_WAYLAND (source); |
658 | |
659 | - source_wayland->cancel_func (source_wayland->resource); |
660 | + meta_wayland_data_source_cancel (source_wayland->data_source); |
661 | META_SELECTION_SOURCE_CLASS (meta_selection_source_wayland_parent_class)->deactivated (source); |
662 | } |
663 | |
664 | @@ -143,20 +142,29 @@ meta_selection_source_wayland_init (MetaSelectionSourceWayland *source) |
665 | { |
666 | } |
667 | |
668 | +static GList * |
669 | +copy_string_array_to_list (struct wl_array *array) |
670 | +{ |
671 | + GList *l = NULL; |
672 | + char **p; |
673 | + |
674 | + wl_array_for_each (p, array) |
675 | + l = g_list_prepend (l, g_strdup (*p)); |
676 | + |
677 | + return l; |
678 | +} |
679 | + |
680 | MetaSelectionSource * |
681 | -meta_selection_source_wayland_new (struct wl_resource *resource, |
682 | - GList *mime_types, |
683 | - MetaWaylandSendFunc send_func, |
684 | - MetaWaylandCancelFunc cancel_func) |
685 | +meta_selection_source_wayland_new (MetaWaylandDataSource *data_source) |
686 | { |
687 | MetaSelectionSourceWayland *source_wayland; |
688 | + struct wl_array *mimetypes; |
689 | |
690 | source_wayland = g_object_new (META_TYPE_SELECTION_SOURCE_WAYLAND, NULL); |
691 | - source_wayland->mimetypes = g_list_copy_deep (mime_types, |
692 | - (GCopyFunc) g_strdup, NULL); |
693 | - source_wayland->send_func = send_func; |
694 | - source_wayland->cancel_func = cancel_func; |
695 | - source_wayland->resource = resource; |
696 | + source_wayland->data_source = data_source; |
697 | + |
698 | + mimetypes = meta_wayland_data_source_get_mime_types (data_source); |
699 | + source_wayland->mimetypes = copy_string_array_to_list (mimetypes); |
700 | |
701 | return META_SELECTION_SOURCE (source_wayland); |
702 | } |
703 | diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c |
704 | index f74bfc5..a61a80e 100644 |
705 | --- a/src/wayland/meta-wayland-actor-surface.c |
706 | +++ b/src/wayland/meta-wayland-actor-surface.c |
707 | @@ -241,6 +241,11 @@ meta_wayland_actor_surface_commit (MetaWaylandSurfaceRole *surface_role, |
708 | if (!priv->actor) |
709 | return; |
710 | |
711 | + if (!wl_list_empty (&pending->frame_callback_list) && |
712 | + cairo_region_is_empty (pending->surface_damage) && |
713 | + cairo_region_is_empty (pending->buffer_damage)) |
714 | + clutter_actor_queue_redraw (CLUTTER_ACTOR (priv->actor)); |
715 | + |
716 | meta_wayland_actor_surface_queue_frame_callbacks (actor_surface, pending); |
717 | |
718 | meta_wayland_actor_surface_sync_actor_state (actor_surface); |
719 | diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c |
720 | index 2ca77e8..38aa0f3 100644 |
721 | --- a/src/wayland/meta-wayland-data-device.c |
722 | +++ b/src/wayland/meta-wayland-data-device.c |
723 | @@ -36,6 +36,7 @@ |
724 | #include <unistd.h> |
725 | |
726 | #include "compositor/meta-dnd-actor-private.h" |
727 | +#include "meta/meta-selection-source-memory.h" |
728 | #include "wayland/meta-selection-source-wayland-private.h" |
729 | #include "wayland/meta-wayland-dnd-surface.h" |
730 | #include "wayland/meta-wayland-pointer.h" |
731 | @@ -59,6 +60,7 @@ struct _MetaWaylandDataOffer |
732 | gboolean action_sent; |
733 | uint32_t dnd_actions; |
734 | enum wl_data_device_manager_dnd_action preferred_dnd_action; |
735 | + MetaSelectionType selection_type; |
736 | }; |
737 | |
738 | typedef struct _MetaWaylandDataSourcePrivate |
739 | @@ -84,8 +86,6 @@ typedef struct _MetaWaylandDataSourceWayland |
740 | typedef struct _MetaWaylandDataSourcePrimary |
741 | { |
742 | MetaWaylandDataSourceWayland parent; |
743 | - |
744 | - struct wl_resource *resource; |
745 | } MetaWaylandDataSourcePrimary; |
746 | |
747 | G_DEFINE_TYPE_WITH_PRIVATE (MetaWaylandDataSource, meta_wayland_data_source, |
748 | @@ -252,7 +252,7 @@ meta_wayland_data_source_get_mime_types (const MetaWaylandDataSource *source) |
749 | return &priv->mime_types; |
750 | } |
751 | |
752 | -static void |
753 | +void |
754 | meta_wayland_data_source_cancel (MetaWaylandDataSource *source) |
755 | { |
756 | META_WAYLAND_DATA_SOURCE_GET_CLASS (source)->cancel (source); |
757 | @@ -400,11 +400,7 @@ data_offer_receive (struct wl_client *client, struct wl_resource *resource, |
758 | GList *mime_types; |
759 | gboolean found; |
760 | |
761 | - if (offer->dnd_actions != 0) |
762 | - selection_type = META_SELECTION_DND; |
763 | - else |
764 | - selection_type = META_SELECTION_CLIPBOARD; |
765 | - |
766 | + selection_type = offer->selection_type; |
767 | mime_types = meta_selection_get_mimetypes (meta_display_get_selection (display), |
768 | selection_type); |
769 | found = g_list_find_custom (mime_types, mime_type, (GCompareFunc) g_strcmp0) != NULL; |
770 | @@ -623,6 +619,7 @@ create_and_send_dnd_offer (MetaWaylandDataSource *source, |
771 | MetaWaylandDataOffer *offer = g_slice_new0 (MetaWaylandDataOffer); |
772 | char **p; |
773 | |
774 | + offer->selection_type = META_SELECTION_DND; |
775 | offer->source = source; |
776 | g_object_add_weak_pointer (G_OBJECT (source), (gpointer *)&offer->source); |
777 | offer->resource = wl_resource_create (wl_resource_get_client (target), |
778 | @@ -1154,18 +1151,6 @@ destroy_data_device_icon (struct wl_listener *listener, void *data) |
779 | clutter_actor_remove_all_children (drag_grab->feedback_actor); |
780 | } |
781 | |
782 | -static GList * |
783 | -copy_string_array_to_list (struct wl_array *array) |
784 | -{ |
785 | - GList *l = NULL; |
786 | - char **p; |
787 | - |
788 | - wl_array_for_each (p, array) |
789 | - l = g_list_prepend (l, g_strdup (*p)); |
790 | - |
791 | - return l; |
792 | -} |
793 | - |
794 | void |
795 | meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data_device, |
796 | struct wl_client *client, |
797 | @@ -1265,7 +1250,6 @@ data_device_start_drag (struct wl_client *client, |
798 | MetaWaylandSurface *surface = NULL, *icon_surface = NULL; |
799 | MetaWaylandDataSource *drag_source = NULL; |
800 | MetaSelectionSource *selection_source; |
801 | - GList *mimetypes; |
802 | |
803 | if (origin_resource) |
804 | surface = wl_resource_get_user_data (origin_resource); |
805 | @@ -1301,14 +1285,10 @@ data_device_start_drag (struct wl_client *client, |
806 | return; |
807 | } |
808 | |
809 | - mimetypes = copy_string_array_to_list (meta_wayland_data_source_get_mime_types (drag_source)); |
810 | - selection_source = meta_selection_source_wayland_new (source_resource, |
811 | - mimetypes, |
812 | - wl_data_source_send_send, |
813 | - wl_data_source_send_cancelled); |
814 | - g_list_free_full (mimetypes, g_free); |
815 | + selection_source = meta_selection_source_wayland_new (drag_source); |
816 | set_selection_source (data_device, META_SELECTION_DND, |
817 | selection_source); |
818 | + g_object_unref (selection_source); |
819 | |
820 | meta_wayland_pointer_set_focus (seat->pointer, NULL); |
821 | meta_wayland_data_device_start_drag (data_device, client, |
822 | @@ -1370,7 +1350,8 @@ meta_wayland_source_cancel (MetaWaylandDataSource *source) |
823 | MetaWaylandDataSourceWayland *source_wayland = |
824 | META_WAYLAND_DATA_SOURCE_WAYLAND (source); |
825 | |
826 | - wl_data_source_send_cancelled (source_wayland->resource); |
827 | + if (source_wayland->resource) |
828 | + wl_data_source_send_cancelled (source_wayland->resource); |
829 | } |
830 | |
831 | static void |
832 | @@ -1421,7 +1402,7 @@ meta_wayland_source_drag_finished (MetaWaylandDataSource *source) |
833 | static void |
834 | meta_wayland_source_finalize (GObject *object) |
835 | { |
836 | - G_OBJECT_CLASS (meta_wayland_data_source_parent_class)->finalize (object); |
837 | + G_OBJECT_CLASS (meta_wayland_data_source_wayland_parent_class)->finalize (object); |
838 | } |
839 | |
840 | static void |
841 | @@ -1451,10 +1432,10 @@ meta_wayland_data_source_primary_send (MetaWaylandDataSource *source, |
842 | const gchar *mime_type, |
843 | gint fd) |
844 | { |
845 | - MetaWaylandDataSourcePrimary *source_primary; |
846 | + MetaWaylandDataSourceWayland *source_wayland; |
847 | |
848 | - source_primary = META_WAYLAND_DATA_SOURCE_PRIMARY (source); |
849 | - gtk_primary_selection_source_send_send (source_primary->resource, |
850 | + source_wayland = META_WAYLAND_DATA_SOURCE_WAYLAND (source); |
851 | + gtk_primary_selection_source_send_send (source_wayland->resource, |
852 | mime_type, fd); |
853 | close (fd); |
854 | } |
855 | @@ -1462,10 +1443,11 @@ meta_wayland_data_source_primary_send (MetaWaylandDataSource *source, |
856 | static void |
857 | meta_wayland_data_source_primary_cancel (MetaWaylandDataSource *source) |
858 | { |
859 | - MetaWaylandDataSourcePrimary *source_primary; |
860 | + MetaWaylandDataSourceWayland *source_wayland; |
861 | |
862 | - source_primary = META_WAYLAND_DATA_SOURCE_PRIMARY (source); |
863 | - gtk_primary_selection_source_send_cancelled (source_primary->resource); |
864 | + source_wayland = META_WAYLAND_DATA_SOURCE_WAYLAND (source); |
865 | + if (source_wayland->resource) |
866 | + gtk_primary_selection_source_send_cancelled (source_wayland->resource); |
867 | } |
868 | |
869 | static void |
870 | @@ -1644,6 +1626,7 @@ meta_wayland_data_device_set_selection (MetaWaylandDataDevice *data_device, |
871 | MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device); |
872 | struct wl_resource *data_device_resource; |
873 | struct wl_client *focus_client; |
874 | + MetaSelectionSource *selection_source; |
875 | |
876 | if (data_device->selection_data_source && |
877 | data_device->selection_serial - serial < UINT32_MAX / 2) |
878 | @@ -1661,43 +1644,34 @@ meta_wayland_data_device_set_selection (MetaWaylandDataDevice *data_device, |
879 | data_device->selection_data_source = source; |
880 | data_device->selection_serial = serial; |
881 | |
882 | - focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard); |
883 | - if (focus_client) |
884 | - { |
885 | - data_device_resource = wl_resource_find_for_client (&data_device->resource_list, focus_client); |
886 | - if (data_device_resource) |
887 | - { |
888 | - struct wl_resource *offer; |
889 | - offer = create_and_send_clipboard_offer (data_device, data_device_resource); |
890 | - wl_data_device_send_selection (data_device_resource, offer); |
891 | - } |
892 | - } |
893 | - |
894 | if (source) |
895 | { |
896 | - MetaWaylandDataSourceWayland *source_wayland = |
897 | - META_WAYLAND_DATA_SOURCE_WAYLAND (source); |
898 | - MetaSelectionSource *selection_source; |
899 | - GList *mimetypes; |
900 | - |
901 | meta_wayland_data_source_set_seat (source, seat); |
902 | g_object_weak_ref (G_OBJECT (source), |
903 | selection_data_source_destroyed, |
904 | data_device); |
905 | |
906 | - mimetypes = copy_string_array_to_list (meta_wayland_data_source_get_mime_types (source)); |
907 | - selection_source = meta_selection_source_wayland_new (source_wayland->resource, |
908 | - mimetypes, |
909 | - wl_data_source_send_send, |
910 | - wl_data_source_send_cancelled); |
911 | - g_list_free_full (mimetypes, g_free); |
912 | - |
913 | - set_selection_source (data_device, META_SELECTION_CLIPBOARD, |
914 | - selection_source); |
915 | + selection_source = meta_selection_source_wayland_new (source); |
916 | } |
917 | else |
918 | { |
919 | - unset_selection_source (data_device, META_SELECTION_CLIPBOARD); |
920 | + selection_source = g_object_new (META_TYPE_SELECTION_SOURCE_MEMORY, NULL); |
921 | + } |
922 | + |
923 | + set_selection_source (data_device, META_SELECTION_CLIPBOARD, |
924 | + selection_source); |
925 | + g_object_unref (selection_source); |
926 | + |
927 | + focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard); |
928 | + if (focus_client) |
929 | + { |
930 | + data_device_resource = wl_resource_find_for_client (&data_device->resource_list, focus_client); |
931 | + if (data_device_resource) |
932 | + { |
933 | + struct wl_resource *offer; |
934 | + offer = create_and_send_clipboard_offer (data_device, data_device_resource); |
935 | + wl_data_device_send_selection (data_device_resource, offer); |
936 | + } |
937 | } |
938 | |
939 | wl_signal_emit (&data_device->selection_ownership_signal, source); |
940 | @@ -1773,12 +1747,13 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device, |
941 | MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device); |
942 | struct wl_resource *data_device_resource; |
943 | struct wl_client *focus_client; |
944 | + MetaSelectionSource *selection_source; |
945 | |
946 | if (META_IS_WAYLAND_DATA_SOURCE_PRIMARY (source)) |
947 | { |
948 | struct wl_resource *resource; |
949 | |
950 | - resource = META_WAYLAND_DATA_SOURCE_PRIMARY (source)->resource; |
951 | + resource = META_WAYLAND_DATA_SOURCE_WAYLAND (source)->resource; |
952 | |
953 | if (wl_resource_get_client (resource) != |
954 | meta_wayland_keyboard_get_focus_client (seat->keyboard)) |
955 | @@ -1800,41 +1775,34 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device, |
956 | data_device->primary_data_source = source; |
957 | data_device->primary_serial = serial; |
958 | |
959 | - focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard); |
960 | - if (focus_client) |
961 | - { |
962 | - data_device_resource = wl_resource_find_for_client (&data_device->primary_resource_list, focus_client); |
963 | - if (data_device_resource) |
964 | - { |
965 | - struct wl_resource *offer; |
966 | - offer = create_and_send_primary_offer (data_device, data_device_resource); |
967 | - gtk_primary_selection_device_send_selection (data_device_resource, offer); |
968 | - } |
969 | - } |
970 | - |
971 | if (source) |
972 | { |
973 | - MetaSelectionSource *selection_source; |
974 | - GList *mimetypes; |
975 | - |
976 | meta_wayland_data_source_set_seat (source, seat); |
977 | g_object_weak_ref (G_OBJECT (source), |
978 | primary_source_destroyed, |
979 | data_device); |
980 | |
981 | - mimetypes = copy_string_array_to_list (meta_wayland_data_source_get_mime_types (source)); |
982 | - selection_source = meta_selection_source_wayland_new (META_WAYLAND_DATA_SOURCE_PRIMARY (source)->resource, |
983 | - mimetypes, |
984 | - gtk_primary_selection_source_send_send, |
985 | - gtk_primary_selection_source_send_cancelled); |
986 | - g_list_free_full (mimetypes, g_free); |
987 | - |
988 | - set_selection_source (data_device, META_SELECTION_PRIMARY, |
989 | - selection_source); |
990 | + selection_source = meta_selection_source_wayland_new (source); |
991 | } |
992 | else |
993 | { |
994 | - unset_selection_source (data_device, META_SELECTION_PRIMARY); |
995 | + selection_source = g_object_new (META_TYPE_SELECTION_SOURCE_MEMORY, NULL); |
996 | + } |
997 | + |
998 | + set_selection_source (data_device, META_SELECTION_PRIMARY, |
999 | + selection_source); |
1000 | + g_object_unref (selection_source); |
1001 | + |
1002 | + focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard); |
1003 | + if (focus_client) |
1004 | + { |
1005 | + data_device_resource = wl_resource_find_for_client (&data_device->primary_resource_list, focus_client); |
1006 | + if (data_device_resource) |
1007 | + { |
1008 | + struct wl_resource *offer; |
1009 | + offer = create_and_send_primary_offer (data_device, data_device_resource); |
1010 | + gtk_primary_selection_device_send_selection (data_device_resource, offer); |
1011 | + } |
1012 | } |
1013 | |
1014 | wl_signal_emit (&data_device->primary_ownership_signal, source); |
1015 | @@ -1968,7 +1936,7 @@ static const struct wl_data_device_manager_interface manager_interface = { |
1016 | static void |
1017 | destroy_primary_source (struct wl_resource *resource) |
1018 | { |
1019 | - MetaWaylandDataSourcePrimary *source = wl_resource_get_user_data (resource); |
1020 | + MetaWaylandDataSourceWayland *source = wl_resource_get_user_data (resource); |
1021 | |
1022 | source->resource = NULL; |
1023 | g_object_unref (source); |
1024 | @@ -2073,6 +2041,7 @@ create_and_send_clipboard_offer (MetaWaylandDataDevice *data_device, |
1025 | return NULL; |
1026 | |
1027 | offer = g_slice_new0 (MetaWaylandDataOffer); |
1028 | + offer->selection_type = META_SELECTION_CLIPBOARD; |
1029 | offer->resource = wl_resource_create (wl_resource_get_client (target), |
1030 | &wl_data_offer_interface, |
1031 | wl_resource_get_version (target), 0); |
1032 | @@ -2105,6 +2074,7 @@ create_and_send_primary_offer (MetaWaylandDataDevice *data_device, |
1033 | return NULL; |
1034 | |
1035 | offer = g_slice_new0 (MetaWaylandDataOffer); |
1036 | + offer->selection_type = META_SELECTION_PRIMARY; |
1037 | offer->resource = wl_resource_create (wl_resource_get_client (target), |
1038 | >k_primary_selection_offer_interface, |
1039 | wl_resource_get_version (target), 0); |
1040 | @@ -2204,7 +2174,7 @@ meta_wayland_data_source_wayland_new (struct wl_resource *resource) |
1041 | static MetaWaylandDataSource * |
1042 | meta_wayland_data_source_primary_new (struct wl_resource *resource) |
1043 | { |
1044 | - MetaWaylandDataSourcePrimary *source_primary = |
1045 | + MetaWaylandDataSourceWayland *source_primary = |
1046 | g_object_new (META_TYPE_WAYLAND_DATA_SOURCE_PRIMARY, NULL); |
1047 | |
1048 | source_primary->resource = resource; |
1049 | diff --git a/src/wayland/meta-wayland-data-device.h b/src/wayland/meta-wayland-data-device.h |
1050 | index 729baac..efa5478 100644 |
1051 | --- a/src/wayland/meta-wayland-data-device.h |
1052 | +++ b/src/wayland/meta-wayland-data-device.h |
1053 | @@ -111,6 +111,8 @@ gboolean meta_wayland_data_source_has_target (MetaWaylandDataSource *source) |
1054 | void meta_wayland_data_source_set_has_target (MetaWaylandDataSource *source, |
1055 | gboolean has_target); |
1056 | |
1057 | +void meta_wayland_data_source_cancel (MetaWaylandDataSource *source); |
1058 | + |
1059 | void meta_wayland_data_source_send (MetaWaylandDataSource *source, |
1060 | const gchar *mime_type, |
1061 | gint fd); |
1062 | diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c |
1063 | index 5def3c5..163b7c5 100644 |
1064 | --- a/src/wayland/meta-wayland-surface.c |
1065 | +++ b/src/wayland/meta-wayland-surface.c |
1066 | @@ -401,7 +401,7 @@ static void |
1067 | pending_buffer_resource_destroyed (MetaWaylandBuffer *buffer, |
1068 | MetaWaylandPendingState *pending) |
1069 | { |
1070 | - g_signal_handler_disconnect (buffer, pending->buffer_destroy_handler_id); |
1071 | + g_clear_signal_handler (&pending->buffer_destroy_handler_id, buffer); |
1072 | pending->buffer = NULL; |
1073 | } |
1074 | |
1075 | @@ -972,8 +972,12 @@ wl_surface_frame (struct wl_client *client, |
1076 | |
1077 | callback = g_slice_new0 (MetaWaylandFrameCallback); |
1078 | callback->surface = surface; |
1079 | - callback->resource = wl_resource_create (client, &wl_callback_interface, META_WL_CALLBACK_VERSION, callback_id); |
1080 | - wl_resource_set_implementation (callback->resource, NULL, callback, destroy_frame_callback); |
1081 | + callback->resource = wl_resource_create (client, |
1082 | + &wl_callback_interface, |
1083 | + META_WL_CALLBACK_VERSION, |
1084 | + callback_id); |
1085 | + wl_resource_set_implementation (callback->resource, NULL, callback, |
1086 | + destroy_frame_callback); |
1087 | |
1088 | wl_list_insert (surface->pending->frame_callback_list.prev, &callback->link); |
1089 | } |
1090 | @@ -1370,7 +1374,9 @@ wl_surface_destructor (struct wl_resource *resource) |
1091 | |
1092 | meta_wayland_compositor_destroy_frame_callbacks (compositor, surface); |
1093 | |
1094 | - g_hash_table_foreach (surface->outputs_to_destroy_notify_id, surface_output_disconnect_signal, surface); |
1095 | + g_hash_table_foreach (surface->outputs_to_destroy_notify_id, |
1096 | + surface_output_disconnect_signal, |
1097 | + surface); |
1098 | g_hash_table_unref (surface->outputs_to_destroy_notify_id); |
1099 | |
1100 | wl_list_for_each_safe (cb, next, &surface->pending_frame_callback_list, link) |
1101 | @@ -1419,12 +1425,20 @@ meta_wayland_surface_create (MetaWaylandCompositor *compositor, |
1102 | guint32 id) |
1103 | { |
1104 | MetaWaylandSurface *surface = g_object_new (META_TYPE_WAYLAND_SURFACE, NULL); |
1105 | + int surface_version; |
1106 | |
1107 | surface->compositor = compositor; |
1108 | surface->scale = 1; |
1109 | |
1110 | - surface->resource = wl_resource_create (client, &wl_surface_interface, wl_resource_get_version (compositor_resource), id); |
1111 | - wl_resource_set_implementation (surface->resource, &meta_wayland_wl_surface_interface, surface, wl_surface_destructor); |
1112 | + surface_version = wl_resource_get_version (compositor_resource); |
1113 | + surface->resource = wl_resource_create (client, |
1114 | + &wl_surface_interface, |
1115 | + surface_version, |
1116 | + id); |
1117 | + wl_resource_set_implementation (surface->resource, |
1118 | + &meta_wayland_wl_surface_interface, |
1119 | + surface, |
1120 | + wl_surface_destructor); |
1121 | |
1122 | wl_list_init (&surface->pending_frame_callback_list); |
1123 | |
1124 | diff --git a/src/x11/meta-selection-source-x11.c b/src/x11/meta-selection-source-x11.c |
1125 | index 15a7636..55e5003 100644 |
1126 | --- a/src/x11/meta-selection-source-x11.c |
1127 | +++ b/src/x11/meta-selection-source-x11.c |
1128 | @@ -82,6 +82,15 @@ meta_selection_source_x11_read_async (MetaSelectionSource *source, |
1129 | task = g_task_new (source, cancellable, callback, user_data); |
1130 | g_task_set_source_tag (task, meta_selection_source_x11_read_async); |
1131 | |
1132 | + if (strcmp (mimetype, "text/plain") == 0 && |
1133 | + g_list_find_custom (source_x11->mimetypes, "STRING", |
1134 | + (GCompareFunc) g_strcmp0)) |
1135 | + mimetype = "STRING"; |
1136 | + else if (strcmp (mimetype, "text/plain;charset=utf-8") == 0 && |
1137 | + g_list_find_custom (source_x11->mimetypes, "UTF8_STRING", |
1138 | + (GCompareFunc) g_strcmp0)) |
1139 | + mimetype = "UTF8_STRING"; |
1140 | + |
1141 | meta_x11_selection_input_stream_new_async (source_x11->x11_display, |
1142 | source_x11->x11_display->selection.xwindow, |
1143 | gdk_x11_get_xatom_name (source_x11->xselection), |
1144 | @@ -139,6 +148,8 @@ atoms_to_mimetypes (MetaX11Display *display, |
1145 | const Atom *atoms; |
1146 | gsize size; |
1147 | guint i, n_atoms; |
1148 | + gboolean utf8_string_found = FALSE, utf8_text_plain_found = FALSE; |
1149 | + gboolean string_found = FALSE, text_plain_found = FALSE; |
1150 | |
1151 | atoms = g_bytes_get_data (bytes, &size); |
1152 | n_atoms = size / sizeof (Atom); |
1153 | @@ -149,8 +160,19 @@ atoms_to_mimetypes (MetaX11Display *display, |
1154 | |
1155 | mimetype = gdk_x11_get_xatom_name (atoms[i]); |
1156 | mimetypes = g_list_prepend (mimetypes, g_strdup (mimetype)); |
1157 | + |
1158 | + utf8_text_plain_found |= strcmp (mimetype, "text/plain;charset=utf-8") == 0; |
1159 | + text_plain_found |= strcmp (mimetype, "text/plain") == 0; |
1160 | + utf8_string_found |= strcmp (mimetype, "UTF8_STRING") == 0; |
1161 | + string_found |= strcmp (mimetype, "STRING") == 0; |
1162 | } |
1163 | |
1164 | + /* Ensure non-x11 clients get well-known mimetypes */ |
1165 | + if (string_found && !text_plain_found) |
1166 | + mimetypes = g_list_prepend (mimetypes, g_strdup ("text/plain")); |
1167 | + if (utf8_string_found && !utf8_text_plain_found) |
1168 | + mimetypes = g_list_prepend (mimetypes, g_strdup ("text/plain;charset=utf-8")); |
1169 | + |
1170 | return mimetypes; |
1171 | } |
1172 |
Sorry Marco, this is already in the eoan queue: https:/ /launchpad. net/ubuntu/ eoan/+queue? queue_state= 1&queue_ text=mutter