Merge lp:~ken-vandine/gtk/ubuntugtk3 into lp:~ubuntu-desktop/gtk/ubuntugtk3
- ubuntugtk3
- Merge into ubuntugtk3
Proposed by
Ken VanDine
Status: | Merged |
---|---|
Approved by: | Sebastien Bacher |
Approved revision: | 567 |
Merged at revision: | 567 |
Proposed branch: | lp:~ken-vandine/gtk/ubuntugtk3 |
Merge into: | lp:~ubuntu-desktop/gtk/ubuntugtk3 |
Diff against target: |
1765 lines (+1670/-2) 8 files modified
debian/changelog (+7/-0) debian/control (+5/-1) debian/control.in (+4/-0) debian/libgtk-3-0.symbols (+5/-0) debian/patches/0001-Update-the-GDK-Mir-backend-to-fix-a-few-problems.patch (+905/-0) debian/patches/no_content_hub.patch (+742/-0) debian/patches/series (+1/-0) debian/rules (+1/-1) |
To merge this branch: | bzr merge lp:~ken-vandine/gtk/ubuntugtk3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sebastien Bacher | Approve | ||
Review via email: mp+325179@code.launchpad.net |
Commit message
Re-enable the mir backend, however removed the content-hub related code and depends.
Description of the change
Re-enable the mir backend, however removed the content-hub related code and depends.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2017-05-22 14:18:53 +0000 |
3 | +++ debian/changelog 2017-06-06 19:53:49 +0000 |
4 | @@ -3,6 +3,13 @@ |
5 | * debian/control.in |
6 | - Bumped libpango1.0-dev build depends to >= 1.40.5 needed for |
7 | colornames test |
8 | + - Added build depends needed for the mir backend |
9 | + * debian/rules |
10 | + - re-enable mir backend |
11 | + * debian/libgtk-3-0.symbols |
12 | + - Refreshed |
13 | + * patches/no_content_hub.patch |
14 | + - Removed content-hub related code |
15 | |
16 | -- Ken VanDine <ken.vandine@canonical.com> Mon, 22 May 2017 10:16:57 -0400 |
17 | |
18 | |
19 | === modified file 'debian/control' |
20 | --- debian/control 2017-05-11 16:35:56 +0000 |
21 | +++ debian/control 2017-06-06 19:53:49 +0000 |
22 | @@ -3,7 +3,7 @@ |
23 | Priority: optional |
24 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
25 | XSBC-Original-Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org> |
26 | -Uploaders: Andreas Henriksson <andreas@fatal.se>, Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>, Jeremy Bicha <jbicha@ubuntu.com>, Michael Biebl <biebl@debian.org> |
27 | +Uploaders: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>, Jeremy Bicha <jbicha@ubuntu.com>, Michael Biebl <biebl@debian.org> |
28 | Build-Depends: debhelper (>= 9.20141010), |
29 | cdbs (>= 0.4.93), |
30 | gnome-pkg-tools (>= 0.11), |
31 | @@ -51,6 +51,8 @@ |
32 | xauth <!nocheck>, |
33 | xsltproc, |
34 | xvfb <!nocheck>, |
35 | + libmirclient-dev (>= 0.13.3), |
36 | + libmircookie-dev (>= 0.17.0), |
37 | Build-Depends-Indep: libglib2.0-doc, |
38 | libatk1.0-doc, |
39 | libpango1.0-doc, |
40 | @@ -148,6 +150,8 @@ |
41 | ${shlibs:Depends}, |
42 | libglib2.0-dev (>= 2.49.4), |
43 | libgdk-pixbuf2.0-dev (>= 2.30.0), |
44 | + libmirclient-dev (>= 0.13.3), |
45 | + libmircookie-dev (>= 0.17.0), |
46 | libpango1.0-dev (>= 1.37.3), |
47 | libatk1.0-dev (>= 2.15.1), |
48 | libatk-bridge2.0-dev, |
49 | |
50 | === modified file 'debian/control.in' |
51 | --- debian/control.in 2017-05-22 14:18:53 +0000 |
52 | +++ debian/control.in 2017-06-06 19:53:49 +0000 |
53 | @@ -51,6 +51,8 @@ |
54 | xauth <!nocheck>, |
55 | xsltproc, |
56 | xvfb <!nocheck>, |
57 | + libmirclient-dev (>= 0.13.3), |
58 | + libmircookie-dev (>= 0.17.0), |
59 | Build-Depends-Indep: libglib2.0-doc, |
60 | libatk1.0-doc, |
61 | libpango1.0-doc, |
62 | @@ -148,6 +150,8 @@ |
63 | ${shlibs:Depends}, |
64 | libglib2.0-dev (>= 2.49.4), |
65 | libgdk-pixbuf2.0-dev (>= 2.30.0), |
66 | + libmirclient-dev (>= 0.13.3), |
67 | + libmircookie-dev (>= 0.17.0), |
68 | libpango1.0-dev (>= 1.40.5), |
69 | libatk1.0-dev (>= 2.15.1), |
70 | libatk-bridge2.0-dev, |
71 | |
72 | === modified file 'debian/libgtk-3-0.symbols' |
73 | --- debian/libgtk-3-0.symbols 2017-05-11 19:42:33 +0000 |
74 | +++ debian/libgtk-3-0.symbols 2017-06-06 19:53:49 +0000 |
75 | @@ -328,6 +328,11 @@ |
76 | gdk_keyval_to_unicode@Base 3.0.0 |
77 | gdk_keyval_to_upper@Base 3.0.0 |
78 | gdk_list_visuals@Base 3.0.0 |
79 | + gdk_mir_display_get_mir_connection@Base 3.12.2-0ubuntu5 |
80 | + gdk_mir_display_get_type@Base 3.12.2-0ubuntu5 |
81 | + gdk_mir_gl_context_get_type@Base 3.16.2 |
82 | + gdk_mir_window_get_mir_surface@Base 3.16.2 |
83 | + gdk_mir_window_get_type@Base 3.12.2-0ubuntu5 |
84 | gdk_modifier_intent_get_type@Base 3.3.16 |
85 | gdk_modifier_type_get_type@Base 3.0.0 |
86 | gdk_monitor_get_display@Base 3.21.4 |
87 | |
88 | === added file 'debian/patches/0001-Update-the-GDK-Mir-backend-to-fix-a-few-problems.patch' |
89 | --- debian/patches/0001-Update-the-GDK-Mir-backend-to-fix-a-few-problems.patch 1970-01-01 00:00:00 +0000 |
90 | +++ debian/patches/0001-Update-the-GDK-Mir-backend-to-fix-a-few-problems.patch 2017-06-06 19:53:49 +0000 |
91 | @@ -0,0 +1,905 @@ |
92 | +From 52b9d12764e90efe21806a54c4191ae999ed7751 Mon Sep 17 00:00:00 2001 |
93 | +From: Andreas Pokorny <andreas.pokorny@canonical.com> |
94 | +Date: Tue, 19 Jul 2016 14:56:34 +0200 |
95 | +Subject: [PATCH] Update the GDK-Mir backend to fix a few problems |
96 | + |
97 | +See https://bugzilla.gnome.org/show_bug.cgi?id=768138 |
98 | +--- |
99 | + configure.ac | 2 +- |
100 | + gdk/mir/gdkmir-private.h | 4 +- |
101 | + gdk/mir/gdkmirdisplay.c | 2 +- |
102 | + gdk/mir/gdkmireventsource.c | 62 +++---- |
103 | + gdk/mir/gdkmirscreen.c | 4 +- |
104 | + gdk/mir/gdkmirwindowimpl.c | 425 ++++++++++++++++++++++++++++++++++++-------- |
105 | + 6 files changed, 382 insertions(+), 117 deletions(-) |
106 | + |
107 | +diff --git a/configure.ac b/configure.ac |
108 | +index 89722cd..66a5fc6 100644 |
109 | +--- a/configure.ac |
110 | ++++ b/configure.ac |
111 | +@@ -61,7 +61,7 @@ m4_define([gdk_pixbuf_required_version], [2.30.0]) |
112 | + m4_define([introspection_required_version], [1.39.0]) |
113 | + m4_define([wayland_required_version], [1.9.91]) |
114 | + m4_define([wayland_protocols_required_version], [1.0]) |
115 | +-m4_define([mirclient_required_version], [0.11.0]) |
116 | ++m4_define([mirclient_required_version], [0.22.0]) |
117 | + m4_define([mircookie_required_version], [0.17.0]) |
118 | + m4_define([epoxy_required_version], [1.0]) |
119 | + GLIB_REQUIRED_VERSION=glib_required_version |
120 | +diff --git a/gdk/mir/gdkmir-private.h b/gdk/mir/gdkmir-private.h |
121 | +index 84051a7..38f1d7a 100644 |
122 | +--- a/gdk/mir/gdkmir-private.h |
123 | ++++ b/gdk/mir/gdkmir-private.h |
124 | +@@ -83,12 +83,14 @@ GdkCursor *_gdk_mir_cursor_new_for_name (GdkDisplay *display, const gchar *name) |
125 | + |
126 | + const gchar *_gdk_mir_cursor_get_name (GdkCursor *cursor); |
127 | + |
128 | +-GdkWindowImpl *_gdk_mir_window_impl_new (void); |
129 | ++GdkWindowImpl *_gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr *attributes, gint attributes_mask); |
130 | + |
131 | + void _gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceState state); |
132 | + |
133 | + void _gdk_mir_window_impl_set_surface_type (GdkMirWindowImpl *impl, MirSurfaceType type); |
134 | + |
135 | ++void _gdk_mir_window_set_surface_output (GdkWindow *window, gdouble scale); |
136 | ++ |
137 | + void _gdk_mir_window_impl_set_cursor_state (GdkMirWindowImpl *impl, gdouble x, gdouble y, gboolean cursor_inside, guint button_state); |
138 | + |
139 | + void _gdk_mir_window_impl_get_cursor_state (GdkMirWindowImpl *impl, gdouble *x, gdouble *y, gboolean *cursor_inside, guint *button_state); |
140 | +diff --git a/gdk/mir/gdkmirdisplay.c b/gdk/mir/gdkmirdisplay.c |
141 | +index ffcee8a..eea892c 100644 |
142 | +--- a/gdk/mir/gdkmirdisplay.c |
143 | ++++ b/gdk/mir/gdkmirdisplay.c |
144 | +@@ -411,7 +411,7 @@ gdk_mir_display_create_window_impl (GdkDisplay *display, |
145 | + |
146 | + if (attributes->wclass == GDK_INPUT_OUTPUT) |
147 | + { |
148 | +- window->impl = _gdk_mir_window_impl_new (); |
149 | ++ window->impl = _gdk_mir_window_impl_new (display, window, attributes, attributes_mask); |
150 | + window->impl_window = window; |
151 | + } |
152 | + else /* attributes->wclass == GDK_INPUT_ONLY */ |
153 | +diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c |
154 | +index a288cb7..865b6f6 100644 |
155 | +--- a/gdk/mir/gdkmireventsource.c |
156 | ++++ b/gdk/mir/gdkmireventsource.c |
157 | +@@ -289,28 +289,17 @@ handle_key_event (GdkWindow *window, const MirInputEvent *event) |
158 | + if (!keyboard_event) |
159 | + return; |
160 | + |
161 | +- switch (mir_keyboard_event_action (keyboard_event)) |
162 | +- { |
163 | +- case mir_keyboard_action_up: |
164 | +- case mir_keyboard_action_down: |
165 | +- // FIXME: Convert keycode |
166 | +- _gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, NULL, &button_state); |
167 | +- modifier_state = get_modifier_state (mir_keyboard_event_modifiers (keyboard_event), button_state); |
168 | +- keymap = gdk_keymap_get_for_display (gdk_window_get_display (window)); |
169 | +- |
170 | +- generate_key_event (window, |
171 | +- mir_keyboard_event_action (keyboard_event) == mir_keyboard_action_down ? GDK_KEY_PRESS : GDK_KEY_RELEASE, |
172 | +- modifier_state, |
173 | +- mir_keyboard_event_key_code (keyboard_event), |
174 | +- mir_keyboard_event_scan_code (keyboard_event), |
175 | +- _gdk_mir_keymap_key_is_modifier (keymap, mir_keyboard_event_key_code (keyboard_event)), |
176 | +- NANO_TO_MILLI (mir_input_event_get_event_time (event))); |
177 | +- break; |
178 | +- default: |
179 | +- //case mir_key_action_multiple: |
180 | +- // FIXME |
181 | +- break; |
182 | +- } |
183 | ++ _gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, NULL, &button_state); |
184 | ++ modifier_state = get_modifier_state (mir_keyboard_event_modifiers (keyboard_event), button_state); |
185 | ++ keymap = gdk_keymap_get_for_display (gdk_window_get_display (window)); |
186 | ++ |
187 | ++ generate_key_event (window, |
188 | ++ mir_keyboard_event_action (keyboard_event) == mir_keyboard_action_up ? GDK_KEY_RELEASE : GDK_KEY_PRESS, |
189 | ++ modifier_state, |
190 | ++ mir_keyboard_event_key_code (keyboard_event), |
191 | ++ mir_keyboard_event_scan_code (keyboard_event), |
192 | ++ _gdk_mir_keymap_key_is_modifier (keymap, mir_keyboard_event_key_code (keyboard_event)), |
193 | ++ NANO_TO_MILLI (mir_input_event_get_event_time (event))); |
194 | + } |
195 | + |
196 | + static void |
197 | +@@ -324,18 +313,13 @@ handle_touch_event (GdkWindow *window, |
198 | + |
199 | + for (i = 0; i < n; i++) |
200 | + { |
201 | +- switch (mir_touch_event_action (mir_touch_event, i)) |
202 | +- { |
203 | +- case mir_touch_action_up: |
204 | +- gdk_event = gdk_event_new (GDK_TOUCH_END); |
205 | +- break; |
206 | +- case mir_touch_action_down: |
207 | +- gdk_event = gdk_event_new (GDK_TOUCH_BEGIN); |
208 | +- break; |
209 | +- case mir_touch_action_change: |
210 | +- gdk_event = gdk_event_new (GDK_TOUCH_UPDATE); |
211 | +- break; |
212 | +- } |
213 | ++ MirTouchAction action = mir_touch_event_action (mir_touch_event, i); |
214 | ++ if (action == mir_touch_action_up) |
215 | ++ gdk_event = gdk_event_new (GDK_TOUCH_END); |
216 | ++ else if (action == mir_touch_action_down) |
217 | ++ gdk_event = gdk_event_new (GDK_TOUCH_BEGIN); |
218 | ++ else |
219 | ++ gdk_event = gdk_event_new (GDK_TOUCH_UPDATE); |
220 | + |
221 | + gdk_event->touch.window = window; |
222 | + gdk_event->touch.sequence = GINT_TO_POINTER (mir_touch_event_id (mir_touch_event, i)); |
223 | +@@ -543,6 +527,13 @@ handle_close_event (GdkWindow *window) |
224 | + gdk_window_destroy_notify (window); |
225 | + } |
226 | + |
227 | ++static void |
228 | ++handle_surface_output_event (GdkWindow *window, |
229 | ++ const MirSurfaceOutputEvent *event) |
230 | ++{ |
231 | ++ _gdk_mir_window_set_surface_output (window, mir_surface_output_event_get_scale (event)); |
232 | ++} |
233 | ++ |
234 | + typedef struct |
235 | + { |
236 | + GdkWindow *window; |
237 | +@@ -597,6 +588,9 @@ gdk_mir_event_source_queue_event (GdkDisplay *display, |
238 | + case mir_event_type_close_surface: |
239 | + handle_close_event (window); |
240 | + break; |
241 | ++ case mir_event_type_surface_output: |
242 | ++ handle_surface_output_event (window, mir_event_get_surface_output_event (event)); |
243 | ++ break; |
244 | + default: |
245 | + g_warning ("Ignoring unknown Mir event %d", mir_event_get_type (event)); |
246 | + // FIXME? |
247 | +diff --git a/gdk/mir/gdkmirscreen.c b/gdk/mir/gdkmirscreen.c |
248 | +index 7aa0aa6..b369b03 100644 |
249 | +--- a/gdk/mir/gdkmirscreen.c |
250 | ++++ b/gdk/mir/gdkmirscreen.c |
251 | +@@ -257,7 +257,6 @@ gdk_mir_screen_get_root_window (GdkScreen *screen) |
252 | + get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height); |
253 | + |
254 | + s->root_window = _gdk_display_create_window (s->display); |
255 | +- s->root_window->impl = _gdk_mir_window_impl_new (); |
256 | + s->root_window->impl_window = s->root_window; |
257 | + s->root_window->visual = s->visual; |
258 | + s->root_window->window_type = GDK_WINDOW_ROOT; |
259 | +@@ -269,6 +268,7 @@ gdk_mir_screen_get_root_window (GdkScreen *screen) |
260 | + s->root_window->width = width; |
261 | + s->root_window->height = height; |
262 | + s->root_window->viewable = TRUE; |
263 | ++ s->root_window->impl = _gdk_mir_window_impl_new (s->display, s->root_window, NULL, 0); |
264 | + |
265 | + return s->root_window; |
266 | + } |
267 | +@@ -352,6 +352,8 @@ gdk_mir_screen_get_monitor_plug_name (GdkScreen *screen, |
268 | + return g_strdup_printf ("TV-%u", output->output_id); |
269 | + case mir_display_output_type_edp: |
270 | + return g_strdup_printf ("eDP-%u", output->output_id); |
271 | ++ case mir_display_output_type_virtual: |
272 | ++ return g_strdup_printf ("Virtual-%u", output->output_id); |
273 | + } |
274 | + } |
275 | + |
276 | +diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c |
277 | +index 5ca9d89..fc37c7e 100644 |
278 | +--- a/gdk/mir/gdkmirwindowimpl.c |
279 | ++++ b/gdk/mir/gdkmirwindowimpl.c |
280 | +@@ -16,6 +16,7 @@ |
281 | + */ |
282 | + |
283 | + #include <inttypes.h> |
284 | ++#include <math.h> |
285 | + |
286 | + #include "config.h" |
287 | + |
288 | +@@ -28,6 +29,7 @@ |
289 | + #include "gdkintl.h" |
290 | + #include "gdkdisplayprivate.h" |
291 | + #include "gdkdeviceprivate.h" |
292 | ++#include "gdkframeclockprivate.h" |
293 | + |
294 | + #define GDK_MIR_WINDOW_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL_MIR, GdkMirWindowImplClass)) |
295 | + #define GDK_IS_WINDOW_IMPL_MIR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL_MIR)) |
296 | +@@ -58,12 +60,21 @@ struct _GdkMirWindowImpl |
297 | + gdouble y; |
298 | + guint button_state; |
299 | + |
300 | ++ GdkDisplay *display; |
301 | ++ |
302 | + /* Surface being rendered to (only exists when window visible) */ |
303 | + MirSurface *surface; |
304 | ++ MirBufferStream *buffer_stream; |
305 | ++ MirBufferUsage buffer_usage; |
306 | + |
307 | + /* Cairo context for current frame */ |
308 | + cairo_surface_t *cairo_surface; |
309 | + |
310 | ++ gchar *title; |
311 | ++ |
312 | ++ GdkGeometry geometry_hints; |
313 | ++ GdkWindowHints geometry_mask; |
314 | ++ |
315 | + /* Egl surface for the current mir surface */ |
316 | + EGLSurface egl_surface; |
317 | + |
318 | +@@ -75,6 +86,12 @@ struct _GdkMirWindowImpl |
319 | + |
320 | + /* TRUE if cursor is inside this window */ |
321 | + gboolean cursor_inside; |
322 | ++ |
323 | ++ gboolean pending_redraw; |
324 | ++ gboolean pending_commit; |
325 | ++ gboolean pending_swap; |
326 | ++ gboolean pending_spec_update; |
327 | ++ gint output_scale; |
328 | + }; |
329 | + |
330 | + struct _GdkMirWindowImplClass |
331 | +@@ -85,11 +102,97 @@ struct _GdkMirWindowImplClass |
332 | + G_DEFINE_TYPE (GdkMirWindowImpl, gdk_mir_window_impl, GDK_TYPE_WINDOW_IMPL) |
333 | + |
334 | + static cairo_surface_t *gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window); |
335 | ++static void on_frame_clock_after_paint (GdkFrameClock *clock, GdkWindow *window); |
336 | ++static void ensure_surface (GdkWindow *window); |
337 | ++static void apply_geometry_hints (MirSurfaceSpec *spec, GdkMirWindowImpl *impl); |
338 | ++ |
339 | ++static gboolean |
340 | ++type_hint_differs (GdkWindowTypeHint lhs, GdkWindowTypeHint rhs) |
341 | ++{ |
342 | ++ if (lhs == rhs) |
343 | ++ return FALSE; |
344 | ++ |
345 | ++ switch (lhs) |
346 | ++ { |
347 | ++ case GDK_WINDOW_TYPE_HINT_DIALOG: |
348 | ++ case GDK_WINDOW_TYPE_HINT_DOCK: |
349 | ++ return rhs != GDK_WINDOW_TYPE_HINT_DIALOG && |
350 | ++ rhs != GDK_WINDOW_TYPE_HINT_DOCK; |
351 | ++ case GDK_WINDOW_TYPE_HINT_MENU: |
352 | ++ case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU: |
353 | ++ case GDK_WINDOW_TYPE_HINT_POPUP_MENU: |
354 | ++ case GDK_WINDOW_TYPE_HINT_TOOLBAR: |
355 | ++ case GDK_WINDOW_TYPE_HINT_COMBO: |
356 | ++ return rhs != GDK_WINDOW_TYPE_HINT_MENU && |
357 | ++ rhs != GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU && |
358 | ++ rhs != GDK_WINDOW_TYPE_HINT_POPUP_MENU && |
359 | ++ rhs != GDK_WINDOW_TYPE_HINT_TOOLBAR && |
360 | ++ rhs != GDK_WINDOW_TYPE_HINT_COMBO; |
361 | ++ case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN: |
362 | ++ case GDK_WINDOW_TYPE_HINT_UTILITY: |
363 | ++ return rhs != GDK_WINDOW_TYPE_HINT_SPLASHSCREEN && |
364 | ++ rhs != GDK_WINDOW_TYPE_HINT_UTILITY; |
365 | ++ case GDK_WINDOW_TYPE_HINT_DND: |
366 | ++ case GDK_WINDOW_TYPE_HINT_TOOLTIP: |
367 | ++ case GDK_WINDOW_TYPE_HINT_NOTIFICATION: |
368 | ++ return rhs != GDK_WINDOW_TYPE_HINT_DND && |
369 | ++ rhs != GDK_WINDOW_TYPE_HINT_TOOLTIP && |
370 | ++ rhs != GDK_WINDOW_TYPE_HINT_NOTIFICATION; |
371 | ++ case GDK_WINDOW_TYPE_HINT_NORMAL: |
372 | ++ case GDK_WINDOW_TYPE_HINT_DESKTOP: |
373 | ++ default: |
374 | ++ return rhs != GDK_WINDOW_TYPE_HINT_NORMAL && |
375 | ++ rhs != GDK_WINDOW_TYPE_HINT_DESKTOP; |
376 | ++ } |
377 | ++} |
378 | ++ |
379 | ++static void |
380 | ++drop_cairo_surface (GdkWindow *window) |
381 | ++{ |
382 | ++ GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
383 | ++ |
384 | ++ g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy); |
385 | ++} |
386 | ++ |
387 | ++static const gchar * |
388 | ++get_default_title (void) |
389 | ++{ |
390 | ++ const char *title; |
391 | ++ |
392 | ++ title = g_get_application_name (); |
393 | ++ if (!title) |
394 | ++ title = g_get_prgname (); |
395 | ++ if (!title) |
396 | ++ title = ""; |
397 | ++ |
398 | ++ return title; |
399 | ++} |
400 | + |
401 | + GdkWindowImpl * |
402 | +-_gdk_mir_window_impl_new (void) |
403 | ++_gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr *attributes, gint attributes_mask) |
404 | + { |
405 | +- return g_object_new (GDK_TYPE_MIR_WINDOW_IMPL, NULL); |
406 | ++ GdkFrameClock *frame_clock = gdk_window_get_frame_clock (window); |
407 | ++ GdkMirWindowImpl *impl = g_object_new (GDK_TYPE_MIR_WINDOW_IMPL, NULL); |
408 | ++ |
409 | ++ impl->display = display; |
410 | ++ |
411 | ++ if (attributes && attributes_mask & GDK_WA_TITLE) |
412 | ++ impl->title = g_strdup (attributes->title); |
413 | ++ else |
414 | ++ impl->title = g_strdup (get_default_title ()); |
415 | ++ |
416 | ++ if (attributes && attributes_mask & GDK_WA_TYPE_HINT) |
417 | ++ impl->type_hint = attributes->type_hint; |
418 | ++ |
419 | ++ impl->pending_spec_update = TRUE; |
420 | ++ |
421 | ++ if (window->window_type != GDK_WINDOW_ROOT) |
422 | ++ { |
423 | ++ g_signal_connect (frame_clock, "after-paint", |
424 | ++ G_CALLBACK (on_frame_clock_after_paint), window); |
425 | ++ } |
426 | ++ |
427 | ++ return (GdkWindowImpl *) impl; |
428 | + } |
429 | + |
430 | + void |
431 | +@@ -139,18 +242,25 @@ gdk_mir_window_impl_init (GdkMirWindowImpl *impl) |
432 | + { |
433 | + impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL; |
434 | + impl->surface_state = mir_surface_state_unknown; |
435 | ++ impl->output_scale = 1; |
436 | + } |
437 | + |
438 | + static void |
439 | + set_surface_state (GdkMirWindowImpl *impl, |
440 | + MirSurfaceState state) |
441 | + { |
442 | ++ MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display); |
443 | + if (impl->surface_state == state) |
444 | + return; |
445 | + |
446 | + impl->surface_state = state; |
447 | +- if (impl->surface) |
448 | +- mir_surface_set_state (impl->surface, state); |
449 | ++ if (impl->surface && !impl->pending_spec_update) |
450 | ++ { |
451 | ++ MirSurfaceSpec *spec = mir_connection_create_spec_for_changes (connection); |
452 | ++ mir_surface_spec_set_state (spec, state); |
453 | ++ mir_surface_apply_spec (impl->surface, spec); |
454 | ++ mir_surface_spec_release (spec); |
455 | ++ } |
456 | + } |
457 | + |
458 | + static void |
459 | +@@ -161,26 +271,21 @@ event_cb (MirSurface *surface, |
460 | + _gdk_mir_event_source_queue (context, event); |
461 | + } |
462 | + |
463 | +-static void ensure_surface (GdkWindow *window); |
464 | +- |
465 | +-static MirSurface * |
466 | +-create_mir_surface (GdkDisplay *display, |
467 | +- GdkWindow *parent, |
468 | +- gint x, |
469 | +- gint y, |
470 | +- gint width, |
471 | +- gint height, |
472 | +- GdkWindowTypeHint type, |
473 | +- MirBufferUsage buffer_usage) |
474 | ++static MirSurfaceSpec * |
475 | ++create_window_type_spec (GdkDisplay *display, |
476 | ++ GdkWindow *parent, |
477 | ++ gint x, |
478 | ++ gint y, |
479 | ++ gint width, |
480 | ++ gint height, |
481 | ++ GdkWindowTypeHint type, |
482 | ++ MirBufferUsage buffer_usage) |
483 | + { |
484 | +- MirSurface *parent_surface = NULL; |
485 | +- MirSurfaceSpec *spec; |
486 | +- MirConnection *connection; |
487 | +- MirPixelFormat format; |
488 | +- MirSurface *surface; |
489 | + MirRectangle rect; |
490 | ++ MirPixelFormat format; |
491 | ++ MirSurface *parent_surface = NULL; |
492 | ++ MirConnection *connection = gdk_mir_display_get_mir_connection (display); |
493 | + |
494 | +- connection = gdk_mir_display_get_mir_connection (display); |
495 | + format = _gdk_mir_display_get_pixel_format (display, buffer_usage); |
496 | + |
497 | + if (parent && parent->impl) |
498 | +@@ -206,11 +311,10 @@ create_mir_surface (GdkDisplay *display, |
499 | + { |
500 | + case GDK_WINDOW_TYPE_HINT_DIALOG: |
501 | + case GDK_WINDOW_TYPE_HINT_DOCK: |
502 | +- spec = mir_connection_create_spec_for_dialog (connection, |
503 | ++ return mir_connection_create_spec_for_dialog (connection, |
504 | + width, |
505 | + height, |
506 | + format); |
507 | +- break; |
508 | + case GDK_WINDOW_TYPE_HINT_MENU: |
509 | + case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU: |
510 | + case GDK_WINDOW_TYPE_HINT_POPUP_MENU: |
511 | +@@ -220,22 +324,20 @@ create_mir_surface (GdkDisplay *display, |
512 | + rect.top = y; |
513 | + rect.width = 1; |
514 | + rect.height = 1; |
515 | +- spec = mir_connection_create_spec_for_menu (connection, |
516 | ++ return mir_connection_create_spec_for_menu (connection, |
517 | + width, |
518 | + height, |
519 | + format, |
520 | + parent_surface, |
521 | + &rect, |
522 | + mir_edge_attachment_any); |
523 | +- break; |
524 | + case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN: |
525 | + case GDK_WINDOW_TYPE_HINT_UTILITY: |
526 | +- spec = mir_connection_create_spec_for_modal_dialog (connection, |
527 | ++ return mir_connection_create_spec_for_modal_dialog (connection, |
528 | + width, |
529 | + height, |
530 | + format, |
531 | + parent_surface); |
532 | +- break; |
533 | + case GDK_WINDOW_TYPE_HINT_DND: |
534 | + case GDK_WINDOW_TYPE_HINT_TOOLTIP: |
535 | + case GDK_WINDOW_TYPE_HINT_NOTIFICATION: |
536 | +@@ -243,7 +345,7 @@ create_mir_surface (GdkDisplay *display, |
537 | + rect.top = y; |
538 | + rect.width = 1; |
539 | + rect.height = 1; |
540 | +- spec = mir_connection_create_spec_for_tooltip (connection, |
541 | ++ return mir_connection_create_spec_for_tooltip (connection, |
542 | + width, |
543 | + height, |
544 | + format, |
545 | +@@ -253,19 +355,73 @@ create_mir_surface (GdkDisplay *display, |
546 | + case GDK_WINDOW_TYPE_HINT_NORMAL: |
547 | + case GDK_WINDOW_TYPE_HINT_DESKTOP: |
548 | + default: |
549 | +- spec = mir_connection_create_spec_for_normal_surface (connection, |
550 | ++ return mir_connection_create_spec_for_normal_surface (connection, |
551 | + width, |
552 | + height, |
553 | + format); |
554 | +- break; |
555 | + } |
556 | ++} |
557 | + |
558 | +- mir_surface_spec_set_name (spec, g_get_prgname ()); |
559 | +- mir_surface_spec_set_buffer_usage (spec, buffer_usage); |
560 | +- surface = mir_surface_create_sync (spec); |
561 | +- mir_surface_spec_release (spec); |
562 | ++static void |
563 | ++apply_geometry_hints (MirSurfaceSpec *spec, GdkMirWindowImpl *impl) |
564 | ++{ |
565 | ++ if (impl->geometry_mask & GDK_HINT_RESIZE_INC) |
566 | ++ { |
567 | ++ mir_surface_spec_set_width_increment (spec, impl->geometry_hints.width_inc); |
568 | ++ mir_surface_spec_set_height_increment (spec, impl->geometry_hints.height_inc); |
569 | ++ } |
570 | ++ if (impl->geometry_mask & GDK_HINT_MIN_SIZE) |
571 | ++ { |
572 | ++ mir_surface_spec_set_min_width (spec, impl->geometry_hints.min_width); |
573 | ++ mir_surface_spec_set_min_height (spec, impl->geometry_hints.min_height); |
574 | ++ } |
575 | ++ if (impl->geometry_mask & GDK_HINT_MAX_SIZE) |
576 | ++ { |
577 | ++ mir_surface_spec_set_max_width (spec, impl->geometry_hints.max_width); |
578 | ++ mir_surface_spec_set_max_height (spec, impl->geometry_hints.max_height); |
579 | ++ } |
580 | ++ if (impl->geometry_mask & GDK_HINT_ASPECT) |
581 | ++ { |
582 | ++ mir_surface_spec_set_min_aspect_ratio (spec, 1000, (unsigned)(1000.0/impl->geometry_hints.min_aspect)); |
583 | ++ mir_surface_spec_set_max_aspect_ratio (spec, 1000, (unsigned)(1000.0/impl->geometry_hints.max_aspect)); |
584 | ++ } |
585 | ++} |
586 | ++ |
587 | ++static MirSurfaceSpec* |
588 | ++create_spec (GdkWindow *window, GdkMirWindowImpl *impl) |
589 | ++{ |
590 | ++ MirSurfaceSpec *spec = NULL; |
591 | ++ |
592 | ++ spec = create_window_type_spec (impl->display, |
593 | ++ impl->transient_for, |
594 | ++ impl->transient_x, impl->transient_y, |
595 | ++ window->width, window->height, |
596 | ++ impl->type_hint, |
597 | ++ impl->buffer_usage); |
598 | ++ |
599 | ++ mir_surface_spec_set_name (spec, impl->title); |
600 | ++ mir_surface_spec_set_buffer_usage (spec, impl->buffer_usage); |
601 | ++ |
602 | ++ apply_geometry_hints (spec, impl); |
603 | ++ |
604 | ++ return spec; |
605 | ++} |
606 | ++ |
607 | ++static void |
608 | ++update_surface_spec (GdkWindow *window) |
609 | ++{ |
610 | ++ GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
611 | ++ MirSurfaceSpec *spec; |
612 | ++ |
613 | ++ if (!impl->surface) |
614 | ++ return; |
615 | ++ |
616 | ++ spec = create_spec (window, impl); |
617 | + |
618 | +- return surface; |
619 | ++ mir_surface_apply_spec (impl->surface, spec); |
620 | ++ mir_surface_spec_release (spec); |
621 | ++ impl->pending_spec_update = FALSE; |
622 | ++ impl->buffer_stream = mir_surface_get_buffer_stream (impl->surface); |
623 | + } |
624 | + |
625 | + static GdkDevice * |
626 | +@@ -319,20 +475,29 @@ ensure_surface_full (GdkWindow *window, |
627 | + { |
628 | + GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
629 | + GdkMirWindowReference *window_ref; |
630 | ++ MirSurfaceSpec *spec; |
631 | + |
632 | + if (impl->surface) |
633 | +- return; |
634 | ++ { |
635 | ++ if (impl->pending_spec_update) |
636 | ++ update_surface_spec(window); |
637 | ++ return; |
638 | ++ } |
639 | + |
640 | + /* no destroy notify -- we must leak for now |
641 | + * https://bugs.launchpad.net/mir/+bug/1324100 |
642 | + */ |
643 | + window_ref = _gdk_mir_event_source_get_window_reference (window); |
644 | ++ impl->buffer_usage = buffer_usage; |
645 | ++ |
646 | ++ spec = create_spec (window, impl); |
647 | ++ |
648 | ++ impl->surface = mir_surface_create_sync (spec); |
649 | + |
650 | +- impl->surface = create_mir_surface (gdk_window_get_display (window), impl->transient_for, |
651 | +- impl->transient_x, impl->transient_y, |
652 | +- window->width, window->height, |
653 | +- impl->type_hint, |
654 | +- buffer_usage); |
655 | ++ mir_surface_spec_release(spec); |
656 | ++ |
657 | ++ impl->pending_spec_update = FALSE; |
658 | ++ impl->buffer_stream = mir_surface_get_buffer_stream (impl->surface); |
659 | + |
660 | + /* FIXME: can't make an initial resize event */ |
661 | + // MirEvent *resize_event; |
662 | +@@ -356,9 +521,10 @@ ensure_surface_full (GdkWindow *window, |
663 | + static void |
664 | + ensure_surface (GdkWindow *window) |
665 | + { |
666 | +- ensure_surface_full (window, window->gl_paint_context ? |
667 | +- mir_buffer_usage_hardware : |
668 | +- mir_buffer_usage_software); |
669 | ++ ensure_surface_full (window, |
670 | ++ window->gl_paint_context ? |
671 | ++ mir_buffer_usage_hardware : |
672 | ++ mir_buffer_usage_software); |
673 | + } |
674 | + |
675 | + static void |
676 | +@@ -390,19 +556,63 @@ ensure_no_surface (GdkWindow *window) |
677 | + } |
678 | + } |
679 | + |
680 | ++ impl->pending_commit = FALSE; |
681 | ++ impl->pending_swap = FALSE; |
682 | + g_clear_pointer(&impl->surface, mir_surface_release_sync); |
683 | + } |
684 | + |
685 | + static void |
686 | +-send_buffer (GdkWindow *window) |
687 | ++on_swap_buffer_completed (MirBufferStream *stream, void *data) |
688 | + { |
689 | ++ GdkWindow *window = data; |
690 | + GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
691 | + |
692 | +- /* Send the completed buffer to Mir */ |
693 | +- mir_buffer_stream_swap_buffers_sync (mir_surface_get_buffer_stream (impl->surface)); |
694 | +- |
695 | + /* The Cairo context is no longer valid */ |
696 | + g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy); |
697 | ++ impl->pending_swap = FALSE; |
698 | ++ |
699 | ++ _gdk_frame_clock_thaw (gdk_window_get_frame_clock (window)); |
700 | ++} |
701 | ++ |
702 | ++static void |
703 | ++on_frame_clock_after_paint (GdkFrameClock *clock, |
704 | ++ GdkWindow *window) |
705 | ++{ |
706 | ++ GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
707 | ++ |
708 | ++ if (!impl->pending_commit) |
709 | ++ return; |
710 | ++ |
711 | ++ impl->pending_commit = FALSE; |
712 | ++ _gdk_frame_clock_freeze (clock); |
713 | ++ |
714 | ++ if (impl->pending_spec_update) |
715 | ++ update_surface_spec (window); |
716 | ++ |
717 | ++ impl->pending_spec_update = FALSE; |
718 | ++ |
719 | ++ /* Send the completed buffer to Mir */ |
720 | ++ impl->pending_swap = TRUE; |
721 | ++ mir_buffer_stream_swap_buffers (impl->buffer_stream, on_swap_buffer_completed, window); |
722 | ++} |
723 | ++ |
724 | ++static void |
725 | ++send_buffer_delayed (GdkWindow *window) |
726 | ++{ |
727 | ++ GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
728 | ++ |
729 | ++ if (impl->pending_swap || impl->pending_commit) |
730 | ++ return; |
731 | ++ |
732 | ++ impl->pending_commit = TRUE; |
733 | ++} |
734 | ++ |
735 | ++static void |
736 | ++send_buffer (GdkWindow *window) |
737 | ++{ |
738 | ++ send_buffer_delayed (window); |
739 | ++ gdk_frame_clock_request_phase (gdk_window_get_frame_clock (window), |
740 | ++ GDK_FRAME_CLOCK_PHASE_AFTER_PAINT); |
741 | + } |
742 | + |
743 | + static cairo_surface_t * |
744 | +@@ -421,15 +631,16 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window) |
745 | + return impl->cairo_surface; |
746 | + } |
747 | + |
748 | ++ ensure_surface (window); |
749 | ++ |
750 | + /* Transient windows get rendered into a buffer and copied onto their parent */ |
751 | + if (window->gl_paint_context) |
752 | + { |
753 | + cairo_surface = cairo_image_surface_create (pixel_format, window->width, window->height); |
754 | ++ cairo_surface_set_device_scale (cairo_surface, (double) impl->output_scale, (double) impl->output_scale); |
755 | + } |
756 | + else if (impl->visible) |
757 | + { |
758 | +- ensure_surface (window); |
759 | +- |
760 | + mir_buffer_stream_get_graphics_region (mir_surface_get_buffer_stream (impl->surface), ®ion); |
761 | + |
762 | + switch (region.pixel_format) |
763 | +@@ -473,6 +684,7 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window) |
764 | + region.width, |
765 | + region.height, |
766 | + region.stride); |
767 | ++ cairo_surface_set_device_scale (cairo_surface, (double) impl->output_scale, (double) impl->output_scale); |
768 | + } |
769 | + else |
770 | + cairo_surface = cairo_image_surface_create (pixel_format, 0, 0); |
771 | +@@ -506,6 +718,7 @@ gdk_mir_window_impl_finalize (GObject *object) |
772 | + { |
773 | + GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (object); |
774 | + |
775 | ++ g_free (impl->title); |
776 | + if (impl->background) |
777 | + cairo_pattern_destroy (impl->background); |
778 | + if (impl->surface) |
779 | +@@ -526,6 +739,7 @@ gdk_mir_window_impl_show (GdkWindow *window, |
780 | + //g_printerr ("gdk_mir_window_impl_show window=%p\n", window); |
781 | + |
782 | + impl->visible = TRUE; |
783 | ++ set_surface_state (impl, mir_surface_state_restored); |
784 | + |
785 | + /* Make sure there's a surface to see */ |
786 | + ensure_surface (window); |
787 | +@@ -547,7 +761,8 @@ gdk_mir_window_impl_hide (GdkWindow *window) |
788 | + |
789 | + impl->cursor_inside = FALSE; |
790 | + impl->visible = FALSE; |
791 | +- ensure_no_surface (window); |
792 | ++ |
793 | ++ set_surface_state (impl, mir_surface_state_hidden); |
794 | + } |
795 | + |
796 | + static void |
797 | +@@ -558,7 +773,8 @@ gdk_mir_window_impl_withdraw (GdkWindow *window) |
798 | + |
799 | + impl->cursor_inside = FALSE; |
800 | + impl->visible = FALSE; |
801 | +- ensure_no_surface (window); |
802 | ++ |
803 | ++ set_surface_state (impl, mir_surface_state_hidden); |
804 | + } |
805 | + |
806 | + static void |
807 | +@@ -610,32 +826,28 @@ gdk_mir_window_impl_move_resize (GdkWindow *window, |
808 | + g_printerr ("\n"); |
809 | + */ |
810 | + GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
811 | +- gboolean recreate_surface = FALSE; |
812 | +- |
813 | +- /* Transient windows can move wherever they want */ |
814 | +- if (with_move) |
815 | +- { |
816 | +- if (x != impl->transient_x || y != impl->transient_y) |
817 | +- { |
818 | +- impl->transient_x = x; |
819 | +- impl->transient_y = y; |
820 | +- recreate_surface = TRUE; |
821 | +- } |
822 | +- } |
823 | ++ //g_printerr ("gdk_mir_window_impl_move_resize window=%p, impl=%p\n", window, impl); |
824 | + |
825 | + /* If resize requested then rebuild surface */ |
826 | +- if (width >= 0) |
827 | ++ if (width >= 0 && (window->width != width || window->height != height)) |
828 | + { |
829 | + /* We accept any resize */ |
830 | + window->width = width; |
831 | + window->height = height; |
832 | +- recreate_surface = TRUE; |
833 | ++ impl->pending_redraw = TRUE; |
834 | ++ impl->pending_spec_update = TRUE; |
835 | + } |
836 | + |
837 | +- if (recreate_surface && impl->surface) |
838 | ++ /* Transient windows can move wherever they want */ |
839 | ++ if (with_move) |
840 | + { |
841 | +- ensure_no_surface (window); |
842 | +- ensure_surface (window); |
843 | ++ if (x != impl->transient_x || y != impl->transient_y) |
844 | ++ { |
845 | ++ impl->transient_x = x; |
846 | ++ impl->transient_y = y; |
847 | ++ if (!impl->pending_spec_update && impl->surface) |
848 | ++ update_surface_spec (window); |
849 | ++ } |
850 | + } |
851 | + } |
852 | + |
853 | +@@ -754,9 +966,12 @@ gdk_mir_window_impl_get_device_state (GdkWindow *window, |
854 | + static gboolean |
855 | + gdk_mir_window_impl_begin_paint (GdkWindow *window) |
856 | + { |
857 | ++ GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
858 | ++ |
859 | ++ ensure_surface (window); |
860 | + //g_printerr ("gdk_mir_window_impl_begin_paint window=%p\n", window); |
861 | + /* Indicate we are ready to be drawn onto directly? */ |
862 | +- return FALSE; |
863 | ++ return impl->pending_swap; |
864 | + } |
865 | + |
866 | + static void |
867 | +@@ -832,10 +1047,11 @@ gdk_mir_window_impl_set_type_hint (GdkWindow *window, |
868 | + { |
869 | + GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
870 | + |
871 | +- if (hint != impl->type_hint) |
872 | ++ if (type_hint_differs (hint, impl->type_hint)) |
873 | + { |
874 | + impl->type_hint = hint; |
875 | +- ensure_no_surface (window); |
876 | ++ if (impl->surface && !impl->pending_spec_update) |
877 | ++ update_surface_spec (window); |
878 | + } |
879 | + } |
880 | + |
881 | +@@ -881,15 +1097,39 @@ gdk_mir_window_impl_set_geometry_hints (GdkWindow *window, |
882 | + const GdkGeometry *geometry, |
883 | + GdkWindowHints geom_mask) |
884 | + { |
885 | +- //g_printerr ("gdk_mir_window_impl_set_geometry_hints window=%p\n", window); |
886 | +- //FIXME: ? |
887 | ++ GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
888 | ++ MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display); |
889 | ++ //g_printerr ("gdk_mir_window_impl_set_geometry_hints window=%p impl=%p\n", window, impl); |
890 | ++ |
891 | ++ impl->geometry_hints = *geometry; |
892 | ++ impl->geometry_mask = geom_mask; |
893 | ++ |
894 | ++ if (impl->surface && !impl->pending_spec_update) |
895 | ++ { |
896 | ++ MirSurfaceSpec* spec = mir_connection_create_spec_for_changes (connection); |
897 | ++ apply_geometry_hints (spec, impl); |
898 | ++ mir_surface_apply_spec (impl->surface, spec); |
899 | ++ mir_surface_spec_release (spec); |
900 | ++ } |
901 | + } |
902 | + |
903 | + static void |
904 | + gdk_mir_window_impl_set_title (GdkWindow *window, |
905 | + const gchar *title) |
906 | + { |
907 | +- // g_printerr ("gdk_mir_window_impl_set_title window=%p\n", window); |
908 | ++ GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
909 | ++ MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display); |
910 | ++ //g_printerr ("gdk_mir_window_impl_set_title window=%p\n", window); |
911 | ++ |
912 | ++ g_free (impl->title); |
913 | ++ impl->title = g_strdup (title); |
914 | ++ if (impl->surface && !impl->pending_spec_update) |
915 | ++ { |
916 | ++ MirSurfaceSpec* spec = mir_connection_create_spec_for_changes (connection); |
917 | ++ mir_surface_spec_set_name (spec, impl->title); |
918 | ++ mir_surface_apply_spec (impl->surface, spec); |
919 | ++ mir_surface_spec_release (spec); |
920 | ++ } |
921 | + } |
922 | + |
923 | + static void |
924 | +@@ -918,6 +1158,9 @@ gdk_mir_window_impl_set_transient_for (GdkWindow *window, |
925 | + |
926 | + /* Link this window to the parent */ |
927 | + impl->transient_for = parent; |
928 | ++ |
929 | ++ if (impl->surface && !impl->pending_spec_update) |
930 | ++ update_surface_spec (window); |
931 | + } |
932 | + |
933 | + static void |
934 | +@@ -1247,8 +1490,8 @@ static gint |
935 | + gdk_mir_window_impl_get_scale_factor (GdkWindow *window) |
936 | + { |
937 | + //g_printerr ("gdk_mir_window_impl_get_scale_factor window=%p\n", window); |
938 | +- /* Don't support monitor scaling */ |
939 | +- return 1; |
940 | ++ GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
941 | ++ return impl->output_scale; |
942 | + } |
943 | + |
944 | + static void |
945 | +@@ -1460,7 +1703,7 @@ _gdk_mir_window_get_egl_surface (GdkWindow *window, |
946 | + ensure_surface_full (window, mir_buffer_usage_hardware); |
947 | + |
948 | + egl_display = _gdk_mir_display_get_egl_display (gdk_window_get_display (window)); |
949 | +- egl_window = (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window (mir_surface_get_buffer_stream (impl->surface)); |
950 | ++ egl_window = (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window (impl->buffer_stream); |
951 | + |
952 | + impl->egl_surface = |
953 | + eglCreateWindowSurface (egl_display, config, egl_window, NULL); |
954 | +@@ -1485,7 +1728,7 @@ _gdk_mir_window_get_dummy_egl_surface (GdkWindow *window, |
955 | + |
956 | + display = gdk_window_get_display (window); |
957 | + egl_display = _gdk_mir_display_get_egl_display (display); |
958 | +- egl_window = (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window (mir_surface_get_buffer_stream (impl->surface)); |
959 | ++ egl_window = (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window (impl->buffer_stream); |
960 | + |
961 | + impl->dummy_egl_surface = |
962 | + eglCreateWindowSurface (egl_display, config, egl_window, NULL); |
963 | +@@ -1506,6 +1749,30 @@ gdk_mir_window_get_mir_surface (GdkWindow *window) |
964 | + return impl->surface; |
965 | + } |
966 | + |
967 | ++void |
968 | ++_gdk_mir_window_set_surface_output (GdkWindow *window, gdouble scale) |
969 | ++{ |
970 | ++ // g_printerr ("_gdk_mir_window_impl_set_surface_output impl=%p\n", impl); |
971 | ++ GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
972 | ++ GdkRectangle area = {0, 0, window->width, window->height}; |
973 | ++ cairo_region_t *region; |
974 | ++ gint new_scale = (gint) round (scale); |
975 | ++ |
976 | ++ if (impl->output_scale != new_scale) |
977 | ++ { |
978 | ++ impl->output_scale = new_scale; |
979 | ++ |
980 | ++ drop_cairo_surface (window); |
981 | ++ |
982 | ++ if (impl->buffer_stream) |
983 | ++ mir_buffer_stream_set_scale (impl->buffer_stream, (float) new_scale); |
984 | ++ |
985 | ++ region = cairo_region_create_rectangle (&area); |
986 | ++ _gdk_window_invalidate_for_expose (window, region); |
987 | ++ cairo_region_destroy (region); |
988 | ++ } |
989 | ++} |
990 | ++ |
991 | + static void |
992 | + gdk_mir_window_impl_class_init (GdkMirWindowImplClass *klass) |
993 | + { |
994 | +-- |
995 | +2.8.1 |
996 | + |
997 | |
998 | === added file 'debian/patches/no_content_hub.patch' |
999 | --- debian/patches/no_content_hub.patch 1970-01-01 00:00:00 +0000 |
1000 | +++ debian/patches/no_content_hub.patch 2017-06-06 19:53:49 +0000 |
1001 | @@ -0,0 +1,742 @@ |
1002 | +diff --git a/configure.ac b/configure.ac |
1003 | +index 6628e218f4..dbeed73235 100644 |
1004 | +--- a/configure.ac |
1005 | ++++ b/configure.ac |
1006 | +@@ -464,7 +464,7 @@ else |
1007 | + AM_CONDITIONAL(USE_WAYLAND, false) |
1008 | + fi |
1009 | + |
1010 | +-MIR_DEPENDENCIES="mirclient >= mirclient_required_version mircookie >= mircookie_required_version libcontent-hub-glib" |
1011 | ++MIR_DEPENDENCIES="mirclient >= mirclient_required_version mircookie >= mircookie_required_version" |
1012 | + if test "$enable_mir_backend" = "maybe" ; then |
1013 | + PKG_CHECK_EXISTS($MIR_DEPENDENCIES, [have_mir_deps=yes], [have_mir_deps=no]) |
1014 | + AC_MSG_CHECKING([for MIR_DEPENDENCIES]) |
1015 | +diff --git a/gdk/mir/gdkmir-private.h b/gdk/mir/gdkmir-private.h |
1016 | +index e726703b21..6decb0c310 100644 |
1017 | +--- a/gdk/mir/gdkmir-private.h |
1018 | ++++ b/gdk/mir/gdkmir-private.h |
1019 | +@@ -115,11 +115,6 @@ void _gdk_mir_display_focus_window (GdkDisplay *display, GdkWindow *window); |
1020 | + |
1021 | + void _gdk_mir_display_unfocus_window (GdkDisplay *display, GdkWindow *window); |
1022 | + |
1023 | +-void _gdk_mir_display_create_paste (GdkDisplay *display, |
1024 | +- const gchar * const *paste_formats, |
1025 | +- gconstpointer paste_data, |
1026 | +- gsize paste_size); |
1027 | +- |
1028 | + gboolean _gdk_mir_display_init_egl_display (GdkDisplay *display); |
1029 | + |
1030 | + EGLDisplay _gdk_mir_display_get_egl_display (GdkDisplay *display); |
1031 | +diff --git a/gdk/mir/gdkmirdisplay.c b/gdk/mir/gdkmirdisplay.c |
1032 | +index 8b39e82e3e..c4080aad78 100644 |
1033 | +--- a/gdk/mir/gdkmirdisplay.c |
1034 | ++++ b/gdk/mir/gdkmirdisplay.c |
1035 | +@@ -23,10 +23,6 @@ |
1036 | + #include "gdkmir.h" |
1037 | + #include "gdkmir-private.h" |
1038 | + |
1039 | +-#include <string.h> |
1040 | +- |
1041 | +-#include <com/ubuntu/content/glib/content-hub-glib.h> |
1042 | +- |
1043 | + #define GDK_TYPE_DISPLAY_MIR (gdk_mir_display_get_type ()) |
1044 | + #define GDK_MIR_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_MIR, GdkMirDisplay)) |
1045 | + #define GDK_MIR_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY_MIR, GdkMirDisplayClass)) |
1046 | +@@ -61,10 +57,6 @@ typedef struct GdkMirDisplay |
1047 | + guint have_egl_buffer_age : 1; |
1048 | + guint have_egl_swap_buffers_with_damage : 1; |
1049 | + guint have_egl_surfaceless_context : 1; |
1050 | +- |
1051 | +- ContentHubService *content_service; |
1052 | +- ContentHubHandler *content_handler; |
1053 | +- GVariant *paste_data; |
1054 | + } GdkMirDisplay; |
1055 | + |
1056 | + typedef struct GdkMirDisplayClass |
1057 | +@@ -110,20 +102,12 @@ static void get_pixel_formats (MirConnection *, MirPixelFormat *sw, MirPixelForm |
1058 | + |
1059 | + G_DEFINE_TYPE (GdkMirDisplay, gdk_mir_display, GDK_TYPE_DISPLAY) |
1060 | + |
1061 | +-static void |
1062 | +-pasteboard_changed_cb (GdkMirDisplay *display, |
1063 | +- gpointer user_data) |
1064 | +-{ |
1065 | +- g_clear_pointer (&display->paste_data, g_variant_unref); |
1066 | +-} |
1067 | +- |
1068 | + GdkDisplay * |
1069 | + _gdk_mir_display_open (const gchar *display_name) |
1070 | + { |
1071 | + MirConnection *connection; |
1072 | + MirPixelFormat sw_pixel_format, hw_pixel_format; |
1073 | + GdkMirDisplay *display; |
1074 | +- GDBusConnection *session; |
1075 | + |
1076 | + connection = mir_connect_sync (NULL, g_get_prgname ()); |
1077 | + if (!connection) |
1078 | +@@ -153,45 +137,6 @@ _gdk_mir_display_open (const gchar *display_name) |
1079 | + display->sw_pixel_format = sw_pixel_format; |
1080 | + display->hw_pixel_format = hw_pixel_format; |
1081 | + |
1082 | +- session = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); |
1083 | +- |
1084 | +- display->content_service = content_hub_service_proxy_new_sync ( |
1085 | +- session, |
1086 | +- G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES, |
1087 | +- "com.ubuntu.content.dbus.Service", |
1088 | +- "/", |
1089 | +- NULL, |
1090 | +- NULL); |
1091 | +- |
1092 | +- g_signal_connect_swapped ( |
1093 | +- display->content_service, |
1094 | +- "pasteboard-changed", |
1095 | +- G_CALLBACK (pasteboard_changed_cb), |
1096 | +- display); |
1097 | +- |
1098 | +- display->content_handler = content_hub_handler_skeleton_new (); |
1099 | +- |
1100 | +- g_dbus_interface_skeleton_export ( |
1101 | +- G_DBUS_INTERFACE_SKELETON (display->content_handler), |
1102 | +- session, |
1103 | +- "/org/gnome/gtk/content/handler", |
1104 | +- NULL); |
1105 | +- |
1106 | +- g_object_unref (session); |
1107 | +- |
1108 | +- content_hub_service_call_register_import_export_handler_sync ( |
1109 | +- display->content_service, |
1110 | +- g_application_get_application_id (g_application_get_default ()), |
1111 | +- "/org/gnome/gtk/content/handler", |
1112 | +- NULL, |
1113 | +- NULL); |
1114 | +- |
1115 | +- content_hub_service_call_handler_active_sync ( |
1116 | +- display->content_service, |
1117 | +- g_application_get_application_id (g_application_get_default ()), |
1118 | +- NULL, |
1119 | +- NULL); |
1120 | +- |
1121 | + g_signal_emit_by_name (display, "opened"); |
1122 | + |
1123 | + return GDK_DISPLAY (display); |
1124 | +@@ -227,10 +172,6 @@ gdk_mir_display_dispose (GObject *object) |
1125 | + { |
1126 | + GdkMirDisplay *display = GDK_MIR_DISPLAY (object); |
1127 | + |
1128 | +- g_clear_pointer (&display->paste_data, g_variant_unref); |
1129 | +- g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (display->content_handler)); |
1130 | +- g_clear_object (&display->content_handler); |
1131 | +- g_clear_object (&display->content_service); |
1132 | + g_clear_object (&display->screen); |
1133 | + g_clear_object (&display->keymap); |
1134 | + g_clear_pointer (&display->event_source, g_source_unref); |
1135 | +@@ -482,28 +423,7 @@ gdk_mir_display_set_selection_owner (GdkDisplay *display, |
1136 | + guint32 time, |
1137 | + gboolean send_event) |
1138 | + { |
1139 | +- GdkEvent *event; |
1140 | +- |
1141 | +- if (selection == GDK_SELECTION_CLIPBOARD) |
1142 | +- { |
1143 | +- if (owner) |
1144 | +- { |
1145 | +- event = gdk_event_new (GDK_SELECTION_REQUEST); |
1146 | +- event->selection.window = g_object_ref (owner); |
1147 | +- event->selection.send_event = FALSE; |
1148 | +- event->selection.selection = selection; |
1149 | +- event->selection.target = gdk_atom_intern_static_string ("TARGETS"); |
1150 | +- event->selection.property = gdk_atom_intern_static_string ("AVAILABLE_TARGETS"); |
1151 | +- event->selection.time = GDK_CURRENT_TIME; |
1152 | +- event->selection.requestor = g_object_ref (owner); |
1153 | +- |
1154 | +- gdk_event_put (event); |
1155 | +- gdk_event_free (event); |
1156 | +- |
1157 | +- return TRUE; |
1158 | +- } |
1159 | +- } |
1160 | +- |
1161 | ++ //g_printerr ("gdk_mir_display_set_selection_owner\n"); |
1162 | + return FALSE; |
1163 | + } |
1164 | + |
1165 | +@@ -524,261 +444,10 @@ gdk_mir_display_get_selection_property (GdkDisplay *display, |
1166 | + GdkAtom *ret_type, |
1167 | + gint *ret_format) |
1168 | + { |
1169 | +- gint length; |
1170 | +- |
1171 | +- gdk_property_get (requestor, |
1172 | +- gdk_atom_intern_static_string ("GDK_SELECTION"), |
1173 | +- GDK_NONE, |
1174 | +- 0, |
1175 | +- G_MAXULONG, |
1176 | +- FALSE, |
1177 | +- ret_type, |
1178 | +- ret_format, |
1179 | +- &length, |
1180 | +- data); |
1181 | +- |
1182 | +- return length; |
1183 | +-} |
1184 | +- |
1185 | +-static gint |
1186 | +-get_format_score (const gchar *format, |
1187 | +- GdkAtom target, |
1188 | +- GdkAtom *out_type, |
1189 | +- gint *out_size) |
1190 | +-{ |
1191 | +- const gchar *target_string; |
1192 | +- GdkAtom dummy_type; |
1193 | +- gint dummy_size; |
1194 | +- |
1195 | +- target_string = _gdk_atom_name_const (target); |
1196 | +- |
1197 | +- if (!out_type) |
1198 | +- out_type = &dummy_type; |
1199 | +- |
1200 | +- if (!out_size) |
1201 | +- out_size = &dummy_size; |
1202 | +- |
1203 | +- if (!g_ascii_strcasecmp (format, target_string)) |
1204 | +- { |
1205 | +- *out_type = GDK_SELECTION_TYPE_STRING; |
1206 | +- *out_size = sizeof (guchar); |
1207 | +- |
1208 | +- return G_MAXINT; |
1209 | +- } |
1210 | +- |
1211 | +- if (target == gdk_atom_intern_static_string ("UTF8_STRING")) |
1212 | +- return get_format_score (format, gdk_atom_intern_static_string ("text/plain;charset=utf-8"), out_type, out_size); |
1213 | +- |
1214 | +- /* TODO: use best media type for COMPOUND_TEXT target */ |
1215 | +- if (target == gdk_atom_intern_static_string ("COMPOUND_TEXT")) |
1216 | +- return get_format_score (format, gdk_atom_intern_static_string ("text/plain;charset=utf-8"), out_type, out_size); |
1217 | +- |
1218 | +- if (target == GDK_TARGET_STRING) |
1219 | +- return get_format_score (format, gdk_atom_intern_static_string ("text/plain;charset=iso-8859-1"), out_type, out_size); |
1220 | +- |
1221 | +- if (target == gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS")) |
1222 | +- return get_format_score (format, gdk_atom_intern_static_string ("text/plain;charset=utf-8"), out_type, out_size); |
1223 | +- |
1224 | +- if (g_content_type_is_a (format, target_string)) |
1225 | +- { |
1226 | +- *out_type = GDK_SELECTION_TYPE_STRING; |
1227 | +- *out_size = sizeof (guchar); |
1228 | +- |
1229 | +- return 2; |
1230 | +- } |
1231 | +- |
1232 | +- if (g_content_type_is_a (target_string, format)) |
1233 | +- { |
1234 | +- *out_type = GDK_SELECTION_TYPE_STRING; |
1235 | +- *out_size = sizeof (guchar); |
1236 | +- |
1237 | +- return 1; |
1238 | +- } |
1239 | +- |
1240 | ++ //g_printerr ("gdk_mir_display_get_selection_property\n"); |
1241 | + return 0; |
1242 | + } |
1243 | + |
1244 | +-static gint |
1245 | +-get_best_format_index (const gchar * const *formats, |
1246 | +- guint n_formats, |
1247 | +- GdkAtom target, |
1248 | +- GdkAtom *out_type, |
1249 | +- gint *out_size) |
1250 | +-{ |
1251 | +- gint best_i = -1; |
1252 | +- gint best_score = 0; |
1253 | +- GdkAtom best_type; |
1254 | +- gint best_size; |
1255 | +- gint score; |
1256 | +- GdkAtom type; |
1257 | +- gint size; |
1258 | +- gint i; |
1259 | +- |
1260 | +- if (!out_type) |
1261 | +- out_type = &best_type; |
1262 | +- |
1263 | +- if (!out_size) |
1264 | +- out_size = &best_size; |
1265 | +- |
1266 | +- *out_type = GDK_NONE; |
1267 | +- *out_size = 0; |
1268 | +- |
1269 | +- for (i = 0; i < n_formats; i++) |
1270 | +- { |
1271 | +- score = get_format_score (formats[i], target, &type, &size); |
1272 | +- |
1273 | +- if (score > best_score) |
1274 | +- { |
1275 | +- best_i = i; |
1276 | +- best_score = score; |
1277 | +- *out_type = type; |
1278 | +- *out_size = size; |
1279 | +- } |
1280 | +- } |
1281 | +- |
1282 | +- return best_i; |
1283 | +-} |
1284 | +- |
1285 | +-static void |
1286 | +-gdk_mir_display_real_convert_selection (GdkDisplay *display, |
1287 | +- GdkWindow *requestor, |
1288 | +- GdkAtom selection, |
1289 | +- GdkAtom target, |
1290 | +- guint32 time) |
1291 | +-{ |
1292 | +- GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display); |
1293 | +- const gchar *paste_data; |
1294 | +- gsize paste_size; |
1295 | +- const gint *paste_header; |
1296 | +- GPtrArray *paste_formats; |
1297 | +- GArray *paste_targets; |
1298 | +- GdkAtom paste_target; |
1299 | +- GdkEvent *event; |
1300 | +- gint best_i; |
1301 | +- GdkAtom best_type; |
1302 | +- gint best_size; |
1303 | +- gint i; |
1304 | +- |
1305 | +- g_return_if_fail (mir_display->paste_data); |
1306 | +- |
1307 | +- paste_data = g_variant_get_fixed_array (mir_display->paste_data, &paste_size, sizeof (guchar)); |
1308 | +- paste_header = (const gint *) paste_data; |
1309 | +- |
1310 | +- if (paste_data) |
1311 | +- { |
1312 | +- paste_formats = g_ptr_array_new_full (paste_header[0], g_free); |
1313 | +- |
1314 | +- for (i = 0; i < paste_header[0]; i++) |
1315 | +- g_ptr_array_add (paste_formats, g_strndup (paste_data + paste_header[1 + 4 * i], paste_header[2 + 4 * i])); |
1316 | +- } |
1317 | +- else |
1318 | +- paste_formats = g_ptr_array_new_with_free_func (g_free); |
1319 | +- |
1320 | +- if (target == gdk_atom_intern_static_string ("TARGETS")) |
1321 | +- { |
1322 | +- paste_targets = g_array_sized_new (TRUE, FALSE, sizeof (GdkAtom), paste_formats->len); |
1323 | +- |
1324 | +- for (i = 0; i < paste_formats->len; i++) |
1325 | +- { |
1326 | +- paste_target = gdk_atom_intern (g_ptr_array_index (paste_formats, i), FALSE); |
1327 | +- g_array_append_val (paste_targets, paste_target); |
1328 | +- } |
1329 | +- |
1330 | +- gdk_property_change (requestor, |
1331 | +- gdk_atom_intern_static_string ("GDK_SELECTION"), |
1332 | +- GDK_SELECTION_TYPE_ATOM, |
1333 | +- 8 * sizeof (GdkAtom), |
1334 | +- GDK_PROP_MODE_REPLACE, |
1335 | +- (const guchar *) paste_targets->data, |
1336 | +- paste_targets->len); |
1337 | +- |
1338 | +- g_array_unref (paste_targets); |
1339 | +- |
1340 | +- event = gdk_event_new (GDK_SELECTION_NOTIFY); |
1341 | +- event->selection.window = g_object_ref (requestor); |
1342 | +- event->selection.send_event = FALSE; |
1343 | +- event->selection.selection = selection; |
1344 | +- event->selection.target = target; |
1345 | +- event->selection.property = gdk_atom_intern_static_string ("GDK_SELECTION"); |
1346 | +- event->selection.time = time; |
1347 | +- event->selection.requestor = g_object_ref (requestor); |
1348 | +- |
1349 | +- gdk_event_put (event); |
1350 | +- gdk_event_free (event); |
1351 | +- } |
1352 | +- else |
1353 | +- { |
1354 | +- best_i = get_best_format_index ((const gchar * const *) paste_formats->pdata, |
1355 | +- paste_formats->len, |
1356 | +- target, |
1357 | +- &best_type, |
1358 | +- &best_size); |
1359 | +- |
1360 | +- if (best_i >= 0) |
1361 | +- { |
1362 | +- gdk_property_change (requestor, |
1363 | +- gdk_atom_intern_static_string ("GDK_SELECTION"), |
1364 | +- best_type, |
1365 | +- 8 * best_size, |
1366 | +- GDK_PROP_MODE_REPLACE, |
1367 | +- (const guchar *) paste_data + paste_header[3 + 4 * best_i], |
1368 | +- paste_header[4 + 4 * best_i] / best_size); |
1369 | +- |
1370 | +- event = gdk_event_new (GDK_SELECTION_NOTIFY); |
1371 | +- event->selection.window = g_object_ref (requestor); |
1372 | +- event->selection.send_event = FALSE; |
1373 | +- event->selection.selection = selection; |
1374 | +- event->selection.target = target; |
1375 | +- event->selection.property = gdk_atom_intern_static_string ("GDK_SELECTION"); |
1376 | +- event->selection.time = time; |
1377 | +- event->selection.requestor = g_object_ref (requestor); |
1378 | +- |
1379 | +- gdk_event_put (event); |
1380 | +- gdk_event_free (event); |
1381 | +- } |
1382 | +- } |
1383 | +- |
1384 | +- g_ptr_array_unref (paste_formats); |
1385 | +-} |
1386 | +- |
1387 | +-typedef struct |
1388 | +-{ |
1389 | +- GdkDisplay *display; |
1390 | +- GdkWindow *requestor; |
1391 | +- GdkAtom selection; |
1392 | +- GdkAtom target; |
1393 | +- guint32 time; |
1394 | +-} ConvertInfo; |
1395 | +- |
1396 | +-static void |
1397 | +-paste_data_ready_cb (GObject *source_object, |
1398 | +- GAsyncResult *res, |
1399 | +- gpointer user_data) |
1400 | +-{ |
1401 | +- ContentHubService *content_service = CONTENT_HUB_SERVICE (source_object); |
1402 | +- ConvertInfo *info = user_data; |
1403 | +- GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (info->display); |
1404 | +- gboolean result; |
1405 | +- |
1406 | +- g_clear_pointer (&mir_display->paste_data, g_variant_unref); |
1407 | +- |
1408 | +- result = content_hub_service_call_get_latest_paste_data_finish (content_service, |
1409 | +- &mir_display->paste_data, |
1410 | +- res, |
1411 | +- NULL); |
1412 | +- |
1413 | +- if (result) |
1414 | +- gdk_mir_display_real_convert_selection (info->display, |
1415 | +- info->requestor, |
1416 | +- info->selection, |
1417 | +- info->target, |
1418 | +- info->time); |
1419 | +- |
1420 | +- g_object_unref (info->requestor); |
1421 | +- g_object_unref (info->display); |
1422 | +- g_free (info); |
1423 | +-} |
1424 | +- |
1425 | + static void |
1426 | + gdk_mir_display_convert_selection (GdkDisplay *display, |
1427 | + GdkWindow *requestor, |
1428 | +@@ -786,46 +455,7 @@ gdk_mir_display_convert_selection (GdkDisplay *display, |
1429 | + GdkAtom target, |
1430 | + guint32 time) |
1431 | + { |
1432 | +- GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display); |
1433 | +- MirWindow *mir_window; |
1434 | +- MirWindowId *mir_window_id; |
1435 | +- ConvertInfo *info; |
1436 | +- |
1437 | +- if (selection != GDK_SELECTION_CLIPBOARD) |
1438 | +- return; |
1439 | +- else if (mir_display->paste_data) |
1440 | +- gdk_mir_display_real_convert_selection (display, requestor, selection, target, time); |
1441 | +- else if (mir_display->focused_window) |
1442 | +- { |
1443 | +- mir_window = _gdk_mir_window_get_mir_window (mir_display->focused_window); |
1444 | +- |
1445 | +- if (!mir_window) |
1446 | +- return; |
1447 | +- |
1448 | +- mir_window_id = mir_window_request_window_id_sync (mir_window); |
1449 | +- |
1450 | +- if (!mir_window_id) |
1451 | +- return; |
1452 | +- |
1453 | +- if (mir_window_id_is_valid (mir_window_id)) |
1454 | +- { |
1455 | +- info = g_new (ConvertInfo, 1); |
1456 | +- info->display = g_object_ref (display); |
1457 | +- info->requestor = g_object_ref (requestor); |
1458 | +- info->selection = selection; |
1459 | +- info->target = target; |
1460 | +- info->time = time; |
1461 | +- |
1462 | +- content_hub_service_call_get_latest_paste_data ( |
1463 | +- mir_display->content_service, |
1464 | +- mir_window_id_as_string (mir_window_id), |
1465 | +- NULL, |
1466 | +- paste_data_ready_cb, |
1467 | +- info); |
1468 | +- } |
1469 | +- |
1470 | +- mir_window_id_release (mir_window_id); |
1471 | +- } |
1472 | ++ //g_printerr ("gdk_mir_display_convert_selection\n"); |
1473 | + } |
1474 | + |
1475 | + static gint |
1476 | +@@ -836,38 +466,8 @@ gdk_mir_display_text_property_to_utf8_list (GdkDisplay *display, |
1477 | + gint length, |
1478 | + gchar ***list) |
1479 | + { |
1480 | +- GPtrArray *array; |
1481 | +- const gchar *ptr; |
1482 | +- gsize chunk_len; |
1483 | +- gchar *copy; |
1484 | +- guint nitems; |
1485 | +- |
1486 | +- ptr = (const gchar *) text; |
1487 | +- array = g_ptr_array_new (); |
1488 | +- |
1489 | +- /* split text into utf-8 strings */ |
1490 | +- while (ptr < (const gchar *) &text[length]) |
1491 | +- { |
1492 | +- chunk_len = strlen (ptr); |
1493 | +- |
1494 | +- if (g_utf8_validate (ptr, chunk_len, NULL)) |
1495 | +- { |
1496 | +- copy = g_strndup (ptr, chunk_len); |
1497 | +- g_ptr_array_add (array, copy); |
1498 | +- } |
1499 | +- |
1500 | +- ptr = &ptr[chunk_len + 1]; |
1501 | +- } |
1502 | +- |
1503 | +- nitems = array->len; |
1504 | +- g_ptr_array_add (array, NULL); |
1505 | +- |
1506 | +- if (list) |
1507 | +- *list = (gchar **) g_ptr_array_free (array, FALSE); |
1508 | +- else |
1509 | +- g_ptr_array_free (array, TRUE); |
1510 | +- |
1511 | +- return nitems; |
1512 | ++ //g_printerr ("gdk_mir_display_text_property_to_utf8_list\n"); |
1513 | ++ return 0; |
1514 | + } |
1515 | + |
1516 | + static gchar * |
1517 | +@@ -962,43 +562,6 @@ _gdk_mir_display_unfocus_window (GdkDisplay *display, |
1518 | + g_clear_object (&mir_display->focused_window); |
1519 | + } |
1520 | + |
1521 | +-void |
1522 | +-_gdk_mir_display_create_paste (GdkDisplay *display, |
1523 | +- const gchar * const *paste_formats, |
1524 | +- gconstpointer paste_data, |
1525 | +- gsize paste_size) |
1526 | +-{ |
1527 | +- GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display); |
1528 | +- MirWindow *mir_window; |
1529 | +- MirWindowId *mir_window_id; |
1530 | +- |
1531 | +- if (!mir_display->focused_window) |
1532 | +- return; |
1533 | +- |
1534 | +- mir_window = _gdk_mir_window_get_mir_window (mir_display->focused_window); |
1535 | +- |
1536 | +- if (!mir_window) |
1537 | +- return; |
1538 | +- |
1539 | +- mir_window_id = mir_window_request_window_id_sync (mir_window); |
1540 | +- |
1541 | +- if (!mir_window_id) |
1542 | +- return; |
1543 | +- |
1544 | +- if (mir_window_id_is_valid (mir_window_id)) |
1545 | +- content_hub_service_call_create_paste_sync ( |
1546 | +- mir_display->content_service, |
1547 | +- g_application_get_application_id (g_application_get_default ()), |
1548 | +- mir_window_id_as_string (mir_window_id), |
1549 | +- g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, paste_data, paste_size, sizeof (guchar)), |
1550 | +- paste_formats, |
1551 | +- NULL, |
1552 | +- NULL, |
1553 | +- NULL); |
1554 | +- |
1555 | +- mir_window_id_release (mir_window_id); |
1556 | +-} |
1557 | +- |
1558 | + gboolean |
1559 | + _gdk_mir_display_init_egl_display (GdkDisplay *display) |
1560 | + { |
1561 | +diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c |
1562 | +index 9f9107611e..320414fb0a 100644 |
1563 | +--- a/gdk/mir/gdkmirwindowimpl.c |
1564 | ++++ b/gdk/mir/gdkmirwindowimpl.c |
1565 | +@@ -1899,140 +1899,6 @@ gdk_mir_window_impl_get_property (GdkWindow *window, |
1566 | + } |
1567 | + |
1568 | + static void |
1569 | +-request_targets (GdkWindow *window, |
1570 | +- const GdkAtom *available_targets, |
1571 | +- gint n_available_targets) |
1572 | +-{ |
1573 | +- GArray *requested_targets; |
1574 | +- GdkAtom target_pair[2]; |
1575 | +- gchar *target_location; |
1576 | +- GdkEvent *event; |
1577 | +- gint i; |
1578 | +- |
1579 | +- requested_targets = g_array_sized_new (TRUE, FALSE, sizeof (GdkAtom), 2 * n_available_targets); |
1580 | +- |
1581 | +- for (i = 0; i < n_available_targets; i++) |
1582 | +- { |
1583 | +- target_pair[0] = available_targets[i]; |
1584 | +- |
1585 | +- if (target_pair[0] == gdk_atom_intern_static_string ("TIMESTAMP") || |
1586 | +- target_pair[0] == gdk_atom_intern_static_string ("TARGETS") || |
1587 | +- target_pair[0] == gdk_atom_intern_static_string ("MULTIPLE") || |
1588 | +- target_pair[0] == gdk_atom_intern_static_string ("SAVE_TARGETS")) |
1589 | +- continue; |
1590 | +- |
1591 | +- target_location = g_strdup_printf ("REQUESTED_TARGET_U%u", requested_targets->len / 2); |
1592 | +- target_pair[1] = gdk_atom_intern (target_location, FALSE); |
1593 | +- g_free (target_location); |
1594 | +- |
1595 | +- g_array_append_vals (requested_targets, target_pair, 2); |
1596 | +- } |
1597 | +- |
1598 | +- gdk_property_delete (window, gdk_atom_intern_static_string ("AVAILABLE_TARGETS")); |
1599 | +- gdk_property_delete (window, gdk_atom_intern_static_string ("REQUESTED_TARGETS")); |
1600 | +- |
1601 | +- gdk_property_change (window, |
1602 | +- gdk_atom_intern_static_string ("REQUESTED_TARGETS"), |
1603 | +- GDK_SELECTION_TYPE_ATOM, |
1604 | +- 8 * sizeof (GdkAtom), |
1605 | +- GDK_PROP_MODE_REPLACE, |
1606 | +- (const guchar *) requested_targets->data, |
1607 | +- requested_targets->len); |
1608 | +- |
1609 | +- g_array_unref (requested_targets); |
1610 | +- |
1611 | +- event = gdk_event_new (GDK_SELECTION_REQUEST); |
1612 | +- event->selection.window = g_object_ref (window); |
1613 | +- event->selection.send_event = FALSE; |
1614 | +- event->selection.selection = GDK_SELECTION_CLIPBOARD; |
1615 | +- event->selection.target = gdk_atom_intern_static_string ("MULTIPLE"); |
1616 | +- event->selection.property = gdk_atom_intern_static_string ("REQUESTED_TARGETS"); |
1617 | +- event->selection.time = GDK_CURRENT_TIME; |
1618 | +- event->selection.requestor = g_object_ref (window); |
1619 | +- |
1620 | +- gdk_event_put (event); |
1621 | +- gdk_event_free (event); |
1622 | +-} |
1623 | +- |
1624 | +-static void |
1625 | +-create_paste (GdkWindow *window, |
1626 | +- const GdkAtom *requested_targets, |
1627 | +- gint n_requested_targets) |
1628 | +-{ |
1629 | +- GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
1630 | +- GPtrArray *paste_formats; |
1631 | +- GArray *paste_header; |
1632 | +- GByteArray *paste_data; |
1633 | +- gint sizes[4]; |
1634 | +- GdkMirProperty *mir_property; |
1635 | +- const gchar *paste_format; |
1636 | +- gint i; |
1637 | +- |
1638 | +- paste_formats = g_ptr_array_new_full (n_requested_targets, g_free); |
1639 | +- paste_header = g_array_sized_new (FALSE, FALSE, sizeof (gint), 1 + 4 * n_requested_targets); |
1640 | +- paste_data = g_byte_array_new (); |
1641 | +- |
1642 | +- g_array_append_val (paste_header, sizes[0]); |
1643 | +- |
1644 | +- for (i = 0; i < n_requested_targets; i++) |
1645 | +- { |
1646 | +- if (requested_targets[i] == GDK_NONE) |
1647 | +- continue; |
1648 | +- |
1649 | +- mir_property = g_hash_table_lookup (impl->properties, requested_targets[i]); |
1650 | +- |
1651 | +- if (!mir_property) |
1652 | +- continue; |
1653 | +- |
1654 | +- paste_format = _gdk_atom_name_const (mir_property->type); |
1655 | +- |
1656 | +- /* skip non-MIME targets */ |
1657 | +- if (!strchr (paste_format, '/')) |
1658 | +- { |
1659 | +- g_hash_table_remove (impl->properties, requested_targets[i]); |
1660 | +- continue; |
1661 | +- } |
1662 | +- |
1663 | +- sizes[0] = paste_data->len; |
1664 | +- sizes[1] = strlen (paste_format); |
1665 | +- sizes[2] = sizes[0] + sizes[1]; |
1666 | +- sizes[3] = mir_property->array->len * g_array_get_element_size (mir_property->array); |
1667 | +- |
1668 | +- g_ptr_array_add (paste_formats, g_strdup (paste_format)); |
1669 | +- g_array_append_vals (paste_header, sizes, 4); |
1670 | +- g_byte_array_append (paste_data, (const guint8 *) paste_format, sizes[1]); |
1671 | +- g_byte_array_append (paste_data, (const guint8 *) mir_property->array->data, sizes[3]); |
1672 | +- |
1673 | +- g_hash_table_remove (impl->properties, requested_targets[i]); |
1674 | +- } |
1675 | +- |
1676 | +- gdk_property_delete (window, gdk_atom_intern_static_string ("REQUESTED_TARGETS")); |
1677 | +- |
1678 | +- g_array_index (paste_header, gint, 0) = paste_formats->len; |
1679 | +- |
1680 | +- for (i = 0; i < paste_formats->len; i++) |
1681 | +- { |
1682 | +- g_array_index (paste_header, gint, 1 + 4 * i) += paste_header->len * sizeof (gint); |
1683 | +- g_array_index (paste_header, gint, 3 + 4 * i) += paste_header->len * sizeof (gint); |
1684 | +- } |
1685 | +- |
1686 | +- g_byte_array_prepend (paste_data, |
1687 | +- (const guint8 *) paste_header->data, |
1688 | +- paste_header->len * g_array_get_element_size (paste_header)); |
1689 | +- |
1690 | +- g_ptr_array_add (paste_formats, NULL); |
1691 | +- |
1692 | +- _gdk_mir_display_create_paste (gdk_window_get_display (window), |
1693 | +- (const gchar * const *) paste_formats->pdata, |
1694 | +- paste_data->data, |
1695 | +- paste_data->len); |
1696 | +- |
1697 | +- g_byte_array_unref (paste_data); |
1698 | +- g_array_unref (paste_header); |
1699 | +- g_ptr_array_unref (paste_formats); |
1700 | +-} |
1701 | +- |
1702 | +-static void |
1703 | + gdk_mir_window_impl_change_property (GdkWindow *window, |
1704 | + GdkAtom property, |
1705 | + GdkAtom type, |
1706 | +@@ -2043,7 +1909,6 @@ gdk_mir_window_impl_change_property (GdkWindow *window, |
1707 | + { |
1708 | + GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); |
1709 | + GdkMirProperty *mir_property; |
1710 | +- gboolean existed; |
1711 | + GdkEvent *event; |
1712 | + |
1713 | + /* ICCCM 2.7: ATOMs and ATOM_PAIRs have format 32, but GdkAtoms can be 64-bit */ |
1714 | +@@ -2051,15 +1916,9 @@ gdk_mir_window_impl_change_property (GdkWindow *window, |
1715 | + format = 8 * sizeof (GdkAtom); |
1716 | + |
1717 | + if (mode != GDK_PROP_MODE_REPLACE) |
1718 | +- { |
1719 | +- mir_property = g_hash_table_lookup (impl->properties, property); |
1720 | +- existed = mir_property != NULL; |
1721 | +- } |
1722 | ++ mir_property = g_hash_table_lookup (impl->properties, property); |
1723 | + else |
1724 | +- { |
1725 | +- mir_property = NULL; |
1726 | +- existed = g_hash_table_contains (impl->properties, property); |
1727 | +- } |
1728 | ++ mir_property = NULL; |
1729 | + |
1730 | + if (!mir_property) |
1731 | + { |
1732 | +@@ -2086,11 +1945,6 @@ gdk_mir_window_impl_change_property (GdkWindow *window, |
1733 | + |
1734 | + gdk_event_put (event); |
1735 | + gdk_event_free (event); |
1736 | +- |
1737 | +- if (property == gdk_atom_intern_static_string ("AVAILABLE_TARGETS")) |
1738 | +- request_targets (window, (const GdkAtom *) data, n_elements); |
1739 | +- else if (property == gdk_atom_intern_static_string ("REQUESTED_TARGETS") && existed) |
1740 | +- create_paste (window, (const GdkAtom *) data, n_elements); |
1741 | + } |
1742 | + |
1743 | + static void |
1744 | |
1745 | === modified file 'debian/patches/series' |
1746 | --- debian/patches/series 2017-05-01 03:03:50 +0000 |
1747 | +++ debian/patches/series 2017-06-06 19:53:49 +0000 |
1748 | @@ -23,3 +23,4 @@ |
1749 | unity-border-radius.patch |
1750 | unity-headerbar-maximized-mode.patch |
1751 | gtksocket-unscale-before-sending-configurenotify.patch |
1752 | +no_content_hub.patch |
1753 | |
1754 | === modified file 'debian/rules' |
1755 | --- debian/rules 2017-05-15 09:55:48 +0000 |
1756 | +++ debian/rules 2017-06-06 19:53:49 +0000 |
1757 | @@ -73,7 +73,7 @@ |
1758 | |
1759 | DEB_CONFIGURE_FLAGS_shared = \ |
1760 | --enable-broadway-backend \ |
1761 | - --disable-mir-backend \ |
1762 | + --enable-mir-backend \ |
1763 | --enable-x11-backend \ |
1764 | --enable-gtk-doc \ |
1765 | --enable-man \ |
the changes look good, thanks Ken